src/HOL/Algebra/poly/UnivPoly.thy
changeset 7998 3d0c34795831
child 10448 da7d0e28f746
equal deleted inserted replaced
7997:a1fb91eb9b4d 7998:3d0c34795831
       
     1 (*
       
     2     Univariate Polynomials
       
     3     $Id$
       
     4     Author: Clemens Ballarin, started 9 December 1996
       
     5 *)
       
     6 
       
     7 UnivPoly = ProtoPoly +
       
     8 
       
     9 typedef (UP)
       
    10   ('a) up = "{f :: nat => 'a::ringS. EX n. bound n f}" (UP_witness)
       
    11 
       
    12 instance
       
    13   up :: (ringS) ringS
       
    14 
       
    15 consts
       
    16   coeff		:: [nat, 'a up] => 'a::ringS
       
    17   "*s"		:: ['a::ringS, 'a up] => 'a up		(infixl 70)
       
    18   monom		:: nat => ('a::ringS) up
       
    19   const		:: 'a::ringS => 'a up
       
    20 
       
    21   "*X^"		:: ['a, nat] => 'a up		("(3_*X^/_)" [71, 71] 70)
       
    22 
       
    23 translations
       
    24   "a *X^ n"	== "a *s monom n"
       
    25   (* this translation is only nice for non-nested polynomials *)
       
    26 
       
    27 defs
       
    28   coeff_def	"coeff n p == Rep_UP p n"
       
    29   up_add_def	"p + q == Abs_UP (%n. Rep_UP p n + Rep_UP q n)"
       
    30   up_smult_def	"a *s p == Abs_UP (%n. a * Rep_UP p n)"
       
    31   monom_def	"monom m == Abs_UP (%n. if m=n then <1> else <0>)"
       
    32   const_def	"const a == Abs_UP (%n. if n=0 then a else <0>)"
       
    33   up_mult_def	"p * q == Abs_UP (%n. SUM n
       
    34 		     (%i. Rep_UP p i * Rep_UP q (n-i)))"
       
    35 
       
    36   up_zero_def	"<0> == Abs_UP (%x. <0>)"
       
    37   up_one_def	"<1> == monom 0"
       
    38   up_uminus_def	"- p == (-<1>) *s p"
       
    39   up_power_def	"a ^ n == nat_rec (<1>::('a::ringS) up) (%u b. b * a) n"
       
    40 end
       
    41 
       
    42