src/HOL/Algebra/poly/UnivPoly.thy
author ballarin
Sat, 10 Feb 2001 08:52:41 +0100
changeset 11093 62c2e0af1d30
parent 10448 da7d0e28f746
child 13735 7de9342aca7a
permissions -rw-r--r--
Changes to HOL/Algebra: - Axclasses consolidated (axiom one_not_zero). - Now uses summation operator setsum; SUM has been removed. - Priority of infix assoc changed to 50, in accordance to dvd.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7998
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     1
(*
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     2
    Univariate Polynomials
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     3
    $Id$
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     4
    Author: Clemens Ballarin, started 9 December 1996
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     5
*)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     6
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     7
UnivPoly = ProtoPoly +
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     8
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
     9
typedef (UP)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    10
  ('a) up = "{f :: nat => 'a::ringS. EX n. bound n f}" (UP_witness)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    11
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    12
instance
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    13
  up :: (ringS) ringS
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    14
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    15
consts
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    16
  coeff		:: [nat, 'a up] => 'a::ringS
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    17
  "*s"		:: ['a::ringS, 'a up] => 'a up		(infixl 70)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    18
  monom		:: nat => ('a::ringS) up
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    19
  const		:: 'a::ringS => 'a up
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    20
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    21
  "*X^"		:: ['a, nat] => 'a up		("(3_*X^/_)" [71, 71] 70)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    22
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    23
translations
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    24
  "a *X^ n"	== "a *s monom n"
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    25
  (* this translation is only nice for non-nested polynomials *)
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    26
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    27
defs
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    28
  coeff_def	"coeff n p == Rep_UP p n"
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    29
  up_add_def	"p + q == Abs_UP (%n. Rep_UP p n + Rep_UP q n)"
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    30
  up_smult_def	"a *s p == Abs_UP (%n. a * Rep_UP p n)"
11093
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    31
  monom_def	"monom m == Abs_UP (%n. if m=n then <1> else 0)"
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    32
  const_def	"const a == Abs_UP (%n. if n=0 then a else 0)"
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    33
  up_mult_def	"p * q == Abs_UP (%n::nat. setsum
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    34
		     (%i. Rep_UP p i * Rep_UP q (n-i)) {..n})"
7998
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    35
11093
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    36
  up_zero_def	"0 == Abs_UP (%x. 0)"
7998
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    37
  up_one_def	"<1> == monom 0"
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    38
  up_uminus_def	"- p == (-<1>) *s p"
11093
62c2e0af1d30 Changes to HOL/Algebra:
ballarin
parents: 10448
diff changeset
    39
  up_inverse_def "inverse (a::'a::ringS up) == (if a dvd <1> then @x. a*x = <1> else 0)"
10448
wenzelm
parents: 7998
diff changeset
    40
  up_divide_def "(a::'a::ringS up) / b == a * inverse b"
7998
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    41
  up_power_def	"a ^ n == nat_rec (<1>::('a::ringS) up) (%u b. b * a) n"
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    42
end
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    43
3d0c34795831 Algebra and Polynomial theories, by Clemens Ballarin
paulson
parents:
diff changeset
    44