# HG changeset patch # User ballarin # Date 1217607052 -7200 # Node ID 21bbd410ba0419d73330573af16b46bec2e7f1e0 # Parent 96699d8eb49e86a109cd65c193bddccac3356d25 Generalised polynomial lemmas from cring to ring. diff -r 96699d8eb49e -r 21bbd410ba04 NEWS --- a/NEWS Fri Aug 01 17:41:37 2008 +0200 +++ b/NEWS Fri Aug 01 18:10:52 2008 +0200 @@ -142,7 +142,8 @@ least_carrier ~> least_closed greatest_carrier ~> greatest_closed greatest_Lower_above ~> greatest_Lower_below - +one_zero ~> carrier_one_zero +one_not_zero ~> carrier_one_not_zero (collision with assumption) *** HOL-NSA *** diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/AbelCoset.thy --- a/src/HOL/Algebra/AbelCoset.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/AbelCoset.thy Fri Aug 01 18:10:52 2008 +0200 @@ -9,9 +9,9 @@ begin -section {* More Lifting from Groups to Abelian Groups *} +subsection {* More Lifting from Groups to Abelian Groups *} -subsection {* Definitions *} +subsubsection {* Definitions *} text {* Hiding @{text "<+>"} from @{theory Sum_Type} until I come up with better syntax here *} @@ -102,7 +102,7 @@ by (fold a_inv_def) -subsection {* Cosets *} +subsubsection {* Cosets *} lemma (in abelian_group) a_coset_add_assoc: "[| M \ carrier G; g \ carrier G; h \ carrier G |] @@ -178,7 +178,7 @@ *) -subsection {* Subgroups *} +subsubsection {* Subgroups *} locale additive_subgroup = var H + struct G + assumes a_subgroup: "subgroup H \carrier = carrier G, mult = add G, one = zero G\" @@ -214,9 +214,7 @@ folded a_inv_def, simplified monoid_record_simps]) -subsection {* Normal additive subgroups *} - -subsubsection {* Definition of @{text "abelian_subgroup"} *} +subsubsection {* Additive subgroups are normal *} text {* Every subgroup of an @{text "abelian_group"} is normal *} @@ -385,7 +383,7 @@ folded set_add_def A_RCOSETS_def, simplified monoid_record_simps]) -subsection {* Congruence Relation *} +subsubsection {* Congruence Relation *} lemma (in abelian_subgroup) a_equiv_rcong: shows "equiv (carrier G) (racong H)" @@ -446,7 +444,7 @@ (fast intro!: additive_subgroup.a_subgroup)+ -subsection {* Factorization *} +subsubsection {* Factorization *} lemmas A_FactGroup_defs = A_FactGroup_def FactGroup_def @@ -518,7 +516,7 @@ text {* The isomorphism theorems have been omitted from lifting, at least for now *} -subsection{*The First Isomorphism Theorem*} +subsubsection{*The First Isomorphism Theorem*} text{*The quotient by the kernel of a homomorphism is isomorphic to the range of that homomorphism.*} @@ -531,7 +529,7 @@ by (rule a_kernel_def[unfolded kernel_def, simplified ring_record_simps]) -subsection {* Homomorphisms *} +subsubsection {* Homomorphisms *} lemma abelian_group_homI: assumes "abelian_group G" @@ -640,12 +638,10 @@ by (rule group_hom.FactGroup_iso[OF a_group_hom, folded a_kernel_def A_FactGroup_def, simplified ring_record_simps]) -section {* Lemmas Lifted from CosetExt.thy *} +subsubsection {* Cosets *} text {* Not eveything from \texttt{CosetExt.thy} is lifted here. *} -subsection {* General Lemmas from \texttt{AlgebraExt.thy} *} - lemma (in additive_subgroup) a_Hcarr [simp]: assumes hH: "h \ H" shows "h \ carrier G" @@ -653,8 +649,6 @@ simplified monoid_record_simps]) (rule hH) -subsection {* Lemmas for Right Cosets *} - lemma (in abelian_subgroup) a_elemrcos_carrier: assumes acarr: "a \ carrier G" and a': "a' \ H +> a" @@ -722,8 +716,6 @@ folded a_r_coset_def, simplified monoid_record_simps]) (rule ycarr, rule repr) -subsection {* Lemmas for the Set of Right Cosets *} - lemma (in abelian_subgroup) a_rcosets_carrier: "X \ a_rcosets H \ X \ carrier G" by (rule subgroup.rcosets_carrier [OF a_subgroup a_group, @@ -731,7 +723,7 @@ -subsection {* Addition of Subgroups *} +subsubsection {* Addition of Subgroups *} lemma (in abelian_monoid) set_add_closed: assumes Acarr: "A \ carrier G" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Bij.thy --- a/src/HOL/Algebra/Bij.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Bij.thy Fri Aug 01 18:10:52 2008 +0200 @@ -6,7 +6,7 @@ theory Bij imports Group begin -section {* Bijections of a Set, Permutation Groups and Automorphism Groups *} +section {* Bijections of a Set, Permutation and Automorphism Groups *} constdefs Bij :: "'a set \ ('a \ 'a) set" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Congruence.thy --- a/src/HOL/Algebra/Congruence.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Congruence.thy Fri Aug 01 18:10:52 2008 +0200 @@ -9,12 +9,13 @@ section {* Objects *} -text {* Structure with a carrier set. *} +subsection {* Structure with Carrier Set. *} record 'a partial_object = carrier :: "'a set" -text {* Dito with equivalence relation *} + +subsection {* Structure with Carrier and Equivalence Relation @{text eq} *} record 'a eq_object = "'a partial_object" + eq :: "'a \ 'a \ bool" (infixl ".=\" 50) @@ -45,15 +46,14 @@ "x .\\ A" == "~(x .\\ A)" "A {.\}\ B" == "~(A {.=}\ B)" - -section {* Equivalence Relations *} - locale equivalence = fixes S (structure) assumes refl [simp, intro]: "x \ carrier S \ x .= x" and sym [sym]: "\ x .= y; x \ carrier S; y \ carrier S \ \ y .= x" and trans [trans]: "\ x .= y; y .= z; x \ carrier S; y \ carrier S; z \ carrier S \ \ x .= z" +(* Lemmas by Stephan Hohe *) + lemma elemI: fixes R (structure) assumes "a' \ A" and "a .= a'" @@ -205,6 +205,7 @@ by fast (* FIXME: the following two required in Isabelle 2008, not Isabelle 2007 *) +(* alternatively, could declare lemmas [trans] = ssubst [where 'a = "'a set"] *) lemma (in equivalence) equal_set_eq_trans [trans]: assumes AB: "A = B" and BC: "B {.=} C" @@ -216,6 +217,7 @@ shows "A {.=} C" using AB BC by simp + lemma (in equivalence) set_eq_trans [trans]: assumes AB: "A {.=} B" and BC: "B {.=} C" and carr: "A \ carrier S" "B \ carrier S" "C \ carrier S" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Coset.thy --- a/src/HOL/Algebra/Coset.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Coset.thy Fri Aug 01 18:10:52 2008 +0200 @@ -4,7 +4,7 @@ Stephan Hohe *) -theory Coset imports Group Exponent begin +theory Coset imports Group begin section {*Cosets and Quotient Groups*} diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Divisibility.thy --- a/src/HOL/Algebra/Divisibility.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Divisibility.thy Fri Aug 01 18:10:52 2008 +0200 @@ -3,14 +3,16 @@ Id: $Id$ Author: Clemens Ballarin, started 18 July 2008 -Based on work by Stefan Hohe. +Based on work by Stephan Hohe. *) theory Divisibility imports Permutation Coset Group begin -subsection {* Monoid with cancelation law *} +section {* Factorial Monoids *} + +subsection {* Monoids with Cancellation Law *} locale monoid_cancel = monoid + assumes l_cancel: @@ -56,7 +58,7 @@ by unfold_locales -subsection {* Products of units in monoids *} +subsection {* Products of Units in Monoids *} lemma (in monoid) Units_m_closed[simp, intro]: assumes h1unit: "h1 \ Units G" and h2unit: "h2 \ Units G" @@ -150,7 +152,7 @@ show "a \ Units G" by (simp add: Units_def, fast) qed -subsection {* Divisibility and association *} +subsection {* Divisibility and Association *} subsubsection {* Function definitions *} @@ -811,7 +813,7 @@ by (intro properfactor_trans2[OF ab] divides_prod_l, simp+) -subsection {* Irreducible elements and primes *} +subsection {* Irreducible Elements and Primes *} subsubsection {* Irreducible elements *} @@ -1031,11 +1033,7 @@ qed -subsection {* Factorization and factorial monoids *} - -(* -hide (open) const mult (* Multiset.mult, conflicting with monoid.mult *) -*) +subsection {* Factorization and Factorial Monoids *} subsubsection {* Function definitions *} @@ -1891,7 +1889,7 @@ qed (blast intro: factors_wfactors wfactors_unique) -subsection {* Factorizations as multisets *} +subsection {* Factorizations as Multisets *} text {* Gives useful operations like intersection *} @@ -2370,7 +2368,7 @@ qed -subsection {* Irreducible elements are prime *} +subsection {* Irreducible Elements are Prime *} lemma (in factorial_monoid) irreducible_is_prime: assumes pirr: "irreducible G p" @@ -2610,7 +2608,7 @@ qed -subsection {* Greatest common divisors and lowest common multiples *} +subsection {* Greatest Common Divisors and Lowest Common Multiples *} subsubsection {* Definitions *} @@ -2907,7 +2905,7 @@ qed -subsection {* Conditions for factoriality *} +subsection {* Conditions for Factoriality *} subsubsection {* Gcd condition *} @@ -3891,7 +3889,7 @@ qed -subsection {* Factoriality theorems *} +subsection {* Factoriality Theorems *} theorem factorial_condition_one: (* Jacobson theorem 2.21 *) shows "(divisor_chain_condition_monoid G \ primeness_condition_monoid G) = diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Exponent.thy --- a/src/HOL/Algebra/Exponent.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Exponent.thy Fri Aug 01 18:10:52 2008 +0200 @@ -9,12 +9,15 @@ imports Main Primes Binomial begin -section {*The Combinatorial Argument Underlying the First Sylow Theorem*} +section {*Sylow's Theorem*} + +subsection {*The Combinatorial Argument Underlying the First Sylow Theorem*} + definition exponent :: "nat => nat => nat" where "exponent p s == if prime p then (GREATEST r. p^r dvd s) else 0" -subsection{*Prime Theorems*} +text{*Prime Theorems*} lemma prime_imp_one_less: "prime p ==> Suc 0 < p" by (unfold prime_def, force) @@ -106,7 +109,7 @@ done -subsection{*Exponent Theorems*} +text{*Exponent Theorems*} lemma exponent_ge [rule_format]: "[|p^k dvd n; prime p; 0 k <= exponent p n" @@ -186,7 +189,7 @@ done -subsection{*Main Combinatorial Argument*} +text{*Main Combinatorial Argument*} lemma le_extend_mult: "[| c > 0; a <= b |] ==> a <= b * (c::nat)" apply (rule_tac P = "%x. x <= b * c" in subst) diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/FiniteProduct.thy --- a/src/HOL/Algebra/FiniteProduct.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/FiniteProduct.thy Fri Aug 01 18:10:52 2008 +0200 @@ -8,10 +8,9 @@ theory FiniteProduct imports Group begin -section {* Product Operator for Commutative Monoids *} +subsection {* Product Operator for Commutative Monoids *} - -subsection {* Inductive Definition of a Relation for Products over Sets *} +subsubsection {* Inductive Definition of a Relation for Products over Sets *} text {* Instantiation of locale @{text LC} of theory @{text Finite_Set} is not possible, because here we have explicit typing rules like @@ -62,7 +61,7 @@ qed -subsection {* Left-Commutative Operations *} +text {* Left-Commutative Operations *} locale LCD = fixes B :: "'b set" @@ -231,7 +230,7 @@ foldSetD_closed [rule del] -subsection {* Commutative Monoids *} +text {* Commutative Monoids *} text {* We enter a more restrictive context, with @{text "f :: 'a => 'a => 'a"} @@ -286,7 +285,7 @@ left_commute LCD.foldD_closed [OF LCD.intro [of D]] Un_subset_iff) -subsection {* Products over Finite Sets *} +subsubsection {* Products over Finite Sets *} constdefs (structure G) finprod :: "[('b, 'm) monoid_scheme, 'a => 'b, 'a set] => 'b" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Ideal.thy --- a/src/HOL/Algebra/Ideal.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Ideal.thy Fri Aug 01 18:10:52 2008 +0200 @@ -10,7 +10,9 @@ section {* Ideals *} -subsection {* General definition *} +subsection {* Definitions *} + +subsubsection {* General definition *} locale ideal = additive_subgroup I R + ring R + assumes I_l_closed: "\a \ I; x \ carrier R\ \ x \ a \ I" @@ -44,14 +46,14 @@ done qed -subsection {* Ideals Generated by a Subset of @{term [locale=ring] "carrier R"} *} +subsubsection {* Ideals Generated by a Subset of @{term [locale=ring] "carrier R"} *} constdefs (structure R) genideal :: "('a, 'b) ring_scheme \ 'a set \ 'a set" ("Idl\ _" [80] 79) "genideal R S \ Inter {I. ideal I R \ S \ I}" -subsection {* Principal Ideals *} +subsubsection {* Principal Ideals *} locale principalideal = ideal + assumes generate: "\i \ carrier R. I = Idl {i}" @@ -70,7 +72,7 @@ show ?thesis by (intro principalideal.intro principalideal_axioms.intro) (rule is_ideal, rule generate) qed -subsection {* Maximal Ideals *} +subsubsection {* Maximal Ideals *} locale maximalideal = ideal + assumes I_notcarr: "carrier R \ I" @@ -92,7 +94,7 @@ (rule is_ideal, rule I_notcarr, rule I_maximal) qed -subsection {* Prime Ideals *} +subsubsection {* Prime Ideals *} locale primeideal = ideal + cring + assumes I_notcarr: "carrier R \ I" @@ -138,8 +140,6 @@ done qed -section {* Properties of Ideals *} - subsection {* Special Ideals *} lemma (in ring) zeroideal: @@ -223,8 +223,6 @@ done qed -subsubsection {* Intersection of a Set of Ideals *} - text {* The intersection of any Number of Ideals is again an Ideal in @{term R} *} lemma (in ring) i_Intersect: @@ -352,8 +350,6 @@ subsection {* Ideals generated by a subset of @{term [locale=ring] "carrier R"} *} -subsubsection {* Generation of Ideals in General Rings *} - text {* @{term genideal} generates an ideal *} lemma (in ring) genideal_ideal: assumes Scarr: "S \ carrier R" @@ -455,7 +451,7 @@ qed -subsubsection {* Generation of Principal Ideals in Commutative Rings *} +text {* Generation of Principal Ideals in Commutative Rings *} constdefs (structure R) cgenideal :: "('a, 'b) monoid_scheme \ 'a \ 'a set" ("PIdl\ _" [80] 79) @@ -873,7 +869,7 @@ qed qed -subsection {* Derived Theorems Involving Ideals *} +subsection {* Derived Theorems *} --"A non-zero cring that has only the two trivial ideals is a field" lemma (in cring) trivialideals_fieldI: diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/IntRing.thy --- a/src/HOL/Algebra/IntRing.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/IntRing.thy Fri Aug 01 18:10:52 2008 +0200 @@ -5,7 +5,7 @@ *) theory IntRing -imports QuotRing Int +imports QuotRing Int Primes begin @@ -62,10 +62,7 @@ done - -subsection {* The Set of Integers as Algebraic Structure *} - -subsubsection {* Definition of @{text "\"} *} +subsection {* @{text "\"}: The Set of Integers as Algebraic Structure *} constdefs int_ring :: "int ring" ("\") @@ -94,7 +91,7 @@ apply (unfold int_ring_def, simp+) done *) -subsubsection {* Interpretations *} +subsection {* Interpretations *} text {* Since definitions of derived operations are global, their interpretation needs to be done as early as possible --- that is, @@ -254,7 +251,7 @@ by unfold_locales clarsimp -subsubsection {* Generated Ideals of @{text "\"} *} +subsection {* Generated Ideals of @{text "\"} *} lemma int_Idl: "Idl\<^bsub>\\<^esub> {a} = {x * a | x. True}" @@ -342,7 +339,7 @@ qed -subsubsection {* Ideals and Divisibility *} +subsection {* Ideals and Divisibility *} lemma int_Idl_subset_ideal: "Idl\<^bsub>\\<^esub> {k} \ Idl\<^bsub>\\<^esub> {l} = (k \ Idl\<^bsub>\\<^esub> {l})" @@ -376,7 +373,7 @@ done -subsubsection {* Ideals and the Modulus *} +subsection {* Ideals and the Modulus *} constdefs ZMod :: "int => int => int set" @@ -459,7 +456,7 @@ by (rule, erule ZMod_imp_zmod, erule zmod_imp_ZMod) -subsubsection {* Factorization *} +subsection {* Factorization *} constdefs ZFact :: "int \ int set ring" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Lattice.thy --- a/src/HOL/Algebra/Lattice.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Lattice.thy Fri Aug 01 18:10:52 2008 +0200 @@ -4,7 +4,7 @@ Author: Clemens Ballarin, started 7 November 2003 Copyright: Clemens Ballarin -Most congruence rules by Stefan Hohe. +Most congruence rules by Stephan Hohe. *) theory Lattice imports Congruence begin @@ -964,7 +964,7 @@ qed -subsection {* Complete lattices *} +subsection {* Complete Lattices *} locale weak_complete_lattice = weak_lattice + assumes sup_exists: @@ -1115,12 +1115,7 @@ end -subsubsection {* Upper and lower bounds of a set *} - -(* all relevant lemmas are global and already proved above *) - - -subsubsection {* Least and greatest, as predicate *} +text {* Least and greatest, as predicate *} lemma (in partial_order) least_unique: "[| least L x A; least L y A |] ==> x = y" @@ -1131,7 +1126,7 @@ using weak_greatest_unique unfolding eq_is_equal . -subsection {* Lattices *} +text {* Lattices *} locale upper_semilattice = partial_order + assumes sup_of_two_exists: @@ -1150,7 +1145,7 @@ locale lattice = upper_semilattice + lower_semilattice -subsubsection {* Supremum *} +text {* Supremum *} declare (in partial_order) weak_sup_of_singleton [simp del] @@ -1169,7 +1164,7 @@ using weak_join_assoc L unfolding eq_is_equal . -subsubsection {* Infimum *} +text {* Infimum *} declare (in partial_order) weak_inf_of_singleton [simp del] @@ -1190,7 +1185,7 @@ using weak_meet_assoc L unfolding eq_is_equal . -subsection {* Total Orders *} +text {* Total Orders *} locale total_order = partial_order + assumes total: "[| x \ carrier L; y \ carrier L |] ==> x \ y | y \ x" @@ -1211,7 +1206,7 @@ by unfold_locales (auto intro: sup_of_two_exists inf_of_two_exists) -subsection {* Complete lattices *} +text {* Complete lattices *} locale complete_lattice = lattice + assumes sup_exists: @@ -1280,7 +1275,7 @@ subsection {* Examples *} -subsubsection {* Powerset of a Set is a Complete Lattice *} +subsubsection {* The Powerset of a Set is a Complete Lattice *} theorem powerset_is_complete_lattice: "complete_lattice (| carrier = Pow A, eq = op =, le = op \ |)" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/QuotRing.thy --- a/src/HOL/Algebra/QuotRing.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/QuotRing.thy Fri Aug 01 18:10:52 2008 +0200 @@ -4,12 +4,12 @@ Author: Stephan Hohe *) -header {* Quotient Rings *} - theory QuotRing imports RingHom begin +section {* Quotient Rings *} + subsection {* Multiplication on Cosets *} constdefs (structure R) diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Ring.thy --- a/src/HOL/Algebra/Ring.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Ring.thy Fri Aug 01 18:10:52 2008 +0200 @@ -9,7 +9,9 @@ uses ("ringsimp.ML") begin -section {* Abelian Groups *} +section {* The Algebraic Hierarchy of Rings *} + +subsection {* Abelian Groups *} record 'a ring = "'a monoid" + zero :: 'a ("\\") @@ -341,9 +343,7 @@ *) -section {* The Algebraic Hierarchy of Rings *} - -subsection {* Basic Definitions *} +subsection {* Rings: Basic Definitions *} locale ring = abelian_group R + monoid R + assumes l_distr: "[| x \ carrier R; y \ carrier R; z \ carrier R |] @@ -554,13 +554,13 @@ show "\ = \" by simp qed -lemma (in ring) one_zero: +lemma (in ring) carrier_one_zero: shows "(carrier R = {\}) = (\ = \)" by (rule, erule one_zeroI, erule one_zeroD) -lemma (in ring) one_not_zero: +lemma (in ring) carrier_one_not_zero: shows "(carrier R \ {\}) = (\ \ \)" - by (simp add: one_zero) + by (simp add: carrier_one_zero) text {* Two examples for use of method algebra *} @@ -588,7 +588,7 @@ subsubsection {* Sums over Finite Sets *} -lemma (in cring) finsum_ldistr: +lemma (in ring) finsum_ldistr: "[| finite A; a \ carrier R; f \ A -> carrier R |] ==> finsum R f A \ a = finsum R (%i. f i \ a) A" proof (induct set: finite) @@ -597,7 +597,7 @@ case (insert x F) then show ?case by (simp add: Pi_def l_distr) qed -lemma (in cring) finsum_rdistr: +lemma (in ring) finsum_rdistr: "[| finite A; a \ carrier R; f \ A -> carrier R |] ==> a \ finsum R f A = finsum R (%i. a \ f i) A" proof (induct set: finite) diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/RingHom.thy --- a/src/HOL/Algebra/RingHom.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/RingHom.thy Fri Aug 01 18:10:52 2008 +0200 @@ -99,7 +99,7 @@ (rule R.is_cring, rule S.is_cring, rule homh) qed -subsection {* The kernel of a ring homomorphism *} +subsection {* The Kernel of a Ring Homomorphism *} --"the kernel of a ring homomorphism is an ideal" lemma (in ring_hom_ring) kernel_is_ideal: diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/Sylow.thy --- a/src/HOL/Algebra/Sylow.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/Sylow.thy Fri Aug 01 18:10:52 2008 +0200 @@ -3,10 +3,7 @@ Author: Florian Kammueller, with new proofs by L C Paulson *) -theory Sylow imports Coset begin - - -section {* Sylow's Theorem *} +theory Sylow imports Coset Exponent begin text {* See also \cite{Kammueller-Paulson:1999}. diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/UnivPoly.thy --- a/src/HOL/Algebra/UnivPoly.thy Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/UnivPoly.thy Fri Aug 01 18:10:52 2008 +0200 @@ -3,9 +3,11 @@ Id: $Id$ Author: Clemens Ballarin, started 9 December 1996 Copyright: Clemens Ballarin + +Contributions by Jesus Aransay. *) -theory UnivPoly imports Module begin +theory UnivPoly imports Module RingHom begin section {* Univariate Polynomials *} @@ -77,19 +79,16 @@ "f \ up R ==> f n \ carrier R" by (simp add: up_def Pi_def) -lemma (in cring) bound_upD [dest]: - "f \ up R ==> EX n. bound \ n f" - by (simp add: up_def) +context ring +begin + +lemma bound_upD [dest]: "f \ up R ==> EX n. bound \ n f" by (simp add: up_def) -lemma (in cring) up_one_closed: - "(%n. if n = 0 then \ else \) \ up R" - using up_def by force +lemma up_one_closed: "(%n. if n = 0 then \ else \) \ up R" using up_def by force -lemma (in cring) up_smult_closed: - "[| a \ carrier R; p \ up R |] ==> (%i. a \ p i) \ up R" - by force +lemma up_smult_closed: "[| a \ carrier R; p \ up R |] ==> (%i. a \ p i) \ up R" by force -lemma (in cring) up_add_closed: +lemma up_add_closed: "[| p \ up R; q \ up R |] ==> (%i. p i \ q i) \ up R" proof fix n @@ -112,7 +111,7 @@ qed qed -lemma (in cring) up_a_inv_closed: +lemma up_a_inv_closed: "p \ up R ==> (%i. \ (p i)) \ up R" proof assume R: "p \ up R" @@ -121,7 +120,7 @@ then show "EX n. bound \ n (%i. \ p i)" by auto qed auto -lemma (in cring) up_mult_closed: +lemma up_mult_closed: "[| p \ up R; q \ up R |] ==> (%n. \i \ {..n}. p i \ q (n-i)) \ up R" proof @@ -161,6 +160,8 @@ qed qed +end + subsection {* Effect of Operations on Coefficients *} @@ -168,19 +169,45 @@ fixes R (structure) and P (structure) defines P_def: "P == UP R" +locale UP_ring = UP + ring R + locale UP_cring = UP + cring R -locale UP_domain = UP_cring + "domain" R +interpretation UP_cring < UP_ring + by (rule P_def) intro_locales + +locale UP_domain = UP + "domain" R -text {* - Temporarily declare @{thm [locale=UP] P_def} as simp rule. -*} +interpretation UP_domain < UP_cring + by (rule P_def) intro_locales + +context UP +begin + +text {*Temporarily declare @{thm [locale=UP] P_def} as simp rule.*} + +declare P_def [simp] -declare (in UP) P_def [simp] +lemma up_eqI: + assumes prem: "!!n. coeff P p n = coeff P q n" and R: "p \ carrier P" "q \ carrier P" + shows "p = q" +proof + fix x + from prem and R show "p x = q x" by (simp add: UP_def) +qed -lemma (in UP_cring) coeff_monom [simp]: - "a \ carrier R ==> - coeff P (monom P a m) n = (if m=n then a else \)" +lemma coeff_closed [simp]: + "p \ carrier P ==> coeff P p n \ carrier R" by (auto simp add: UP_def) + +end + +context UP_ring +begin + +(* Theorems generalised to rings by Jesus Aransay. *) + +lemma coeff_monom [simp]: + "a \ carrier R ==> coeff P (monom P a m) n = (if m=n then a else \)" proof - assume R: "a \ carrier R" then have "(%n. if n = m then a else \) \ up R" @@ -188,86 +215,69 @@ with R show ?thesis by (simp add: UP_def) qed -lemma (in UP_cring) coeff_zero [simp]: - "coeff P \\<^bsub>P\<^esub> n = \" - by (auto simp add: UP_def) +lemma coeff_zero [simp]: "coeff P \\<^bsub>P\<^esub> n = \" by (auto simp add: UP_def) -lemma (in UP_cring) coeff_one [simp]: - "coeff P \\<^bsub>P\<^esub> n = (if n=0 then \ else \)" +lemma coeff_one [simp]: "coeff P \\<^bsub>P\<^esub> n = (if n=0 then \ else \)" using up_one_closed by (simp add: UP_def) -lemma (in UP_cring) coeff_smult [simp]: - "[| a \ carrier R; p \ carrier P |] ==> - coeff P (a \\<^bsub>P\<^esub> p) n = a \ coeff P p n" +lemma coeff_smult [simp]: + "[| a \ carrier R; p \ carrier P |] ==> coeff P (a \\<^bsub>P\<^esub> p) n = a \ coeff P p n" by (simp add: UP_def up_smult_closed) -lemma (in UP_cring) coeff_add [simp]: - "[| p \ carrier P; q \ carrier P |] ==> - coeff P (p \\<^bsub>P\<^esub> q) n = coeff P p n \ coeff P q n" +lemma coeff_add [simp]: + "[| p \ carrier P; q \ carrier P |] ==> coeff P (p \\<^bsub>P\<^esub> q) n = coeff P p n \ coeff P q n" by (simp add: UP_def up_add_closed) -lemma (in UP_cring) coeff_mult [simp]: - "[| p \ carrier P; q \ carrier P |] ==> - coeff P (p \\<^bsub>P\<^esub> q) n = (\i \ {..n}. coeff P p i \ coeff P q (n-i))" +lemma coeff_mult [simp]: + "[| p \ carrier P; q \ carrier P |] ==> coeff P (p \\<^bsub>P\<^esub> q) n = (\i \ {..n}. coeff P p i \ coeff P q (n-i))" by (simp add: UP_def up_mult_closed) -lemma (in UP) up_eqI: - assumes prem: "!!n. coeff P p n = coeff P q n" - and R: "p \ carrier P" "q \ carrier P" - shows "p = q" -proof - fix x - from prem and R show "p x = q x" by (simp add: UP_def) -qed +end -subsection {* Polynomials Form a Commutative Ring. *} +subsection {* Polynomials Form a Ring. *} + +context UP_ring +begin text {* Operations are closed over @{term P}. *} -lemma (in UP_cring) UP_mult_closed [simp]: - "[| p \ carrier P; q \ carrier P |] ==> p \\<^bsub>P\<^esub> q \ carrier P" - by (simp add: UP_def up_mult_closed) +lemma UP_mult_closed [simp]: + "[| p \ carrier P; q \ carrier P |] ==> p \\<^bsub>P\<^esub> q \ carrier P" by (simp add: UP_def up_mult_closed) -lemma (in UP_cring) UP_one_closed [simp]: - "\\<^bsub>P\<^esub> \ carrier P" - by (simp add: UP_def up_one_closed) +lemma UP_one_closed [simp]: + "\\<^bsub>P\<^esub> \ carrier P" by (simp add: UP_def up_one_closed) -lemma (in UP_cring) UP_zero_closed [intro, simp]: - "\\<^bsub>P\<^esub> \ carrier P" - by (auto simp add: UP_def) +lemma UP_zero_closed [intro, simp]: + "\\<^bsub>P\<^esub> \ carrier P" by (auto simp add: UP_def) -lemma (in UP_cring) UP_a_closed [intro, simp]: - "[| p \ carrier P; q \ carrier P |] ==> p \\<^bsub>P\<^esub> q \ carrier P" - by (simp add: UP_def up_add_closed) - -lemma (in UP_cring) monom_closed [simp]: - "a \ carrier R ==> monom P a n \ carrier P" - by (auto simp add: UP_def up_def Pi_def) +lemma UP_a_closed [intro, simp]: + "[| p \ carrier P; q \ carrier P |] ==> p \\<^bsub>P\<^esub> q \ carrier P" by (simp add: UP_def up_add_closed) -lemma (in UP_cring) UP_smult_closed [simp]: - "[| a \ carrier R; p \ carrier P |] ==> a \\<^bsub>P\<^esub> p \ carrier P" - by (simp add: UP_def up_smult_closed) +lemma monom_closed [simp]: + "a \ carrier R ==> monom P a n \ carrier P" by (auto simp add: UP_def up_def Pi_def) -lemma (in UP) coeff_closed [simp]: - "p \ carrier P ==> coeff P p n \ carrier R" - by (auto simp add: UP_def) +lemma UP_smult_closed [simp]: + "[| a \ carrier R; p \ carrier P |] ==> a \\<^bsub>P\<^esub> p \ carrier P" by (simp add: UP_def up_smult_closed) + +end declare (in UP) P_def [simp del] text {* Algebraic ring properties *} -lemma (in UP_cring) UP_a_assoc: - assumes R: "p \ carrier P" "q \ carrier P" "r \ carrier P" - shows "(p \\<^bsub>P\<^esub> q) \\<^bsub>P\<^esub> r = p \\<^bsub>P\<^esub> (q \\<^bsub>P\<^esub> r)" - by (rule up_eqI, simp add: a_assoc R, simp_all add: R) +context UP_ring +begin -lemma (in UP_cring) UP_l_zero [simp]: +lemma UP_a_assoc: + assumes R: "p \ carrier P" "q \ carrier P" "r \ carrier P" + shows "(p \\<^bsub>P\<^esub> q) \\<^bsub>P\<^esub> r = p \\<^bsub>P\<^esub> (q \\<^bsub>P\<^esub> r)" by (rule up_eqI, simp add: a_assoc R, simp_all add: R) + +lemma UP_l_zero [simp]: assumes R: "p \ carrier P" - shows "\\<^bsub>P\<^esub> \\<^bsub>P\<^esub> p = p" - by (rule up_eqI, simp_all add: R) + shows "\\<^bsub>P\<^esub> \\<^bsub>P\<^esub> p = p" by (rule up_eqI, simp_all add: R) -lemma (in UP_cring) UP_l_neg_ex: +lemma UP_l_neg_ex: assumes R: "p \ carrier P" shows "EX q : carrier P. q \\<^bsub>P\<^esub> p = \\<^bsub>P\<^esub>" proof - @@ -283,12 +293,17 @@ qed (rule closed) qed -lemma (in UP_cring) UP_a_comm: +lemma UP_a_comm: assumes R: "p \ carrier P" "q \ carrier P" - shows "p \\<^bsub>P\<^esub> q = q \\<^bsub>P\<^esub> p" - by (rule up_eqI, simp add: a_comm R, simp_all add: R) + shows "p \\<^bsub>P\<^esub> q = q \\<^bsub>P\<^esub> p" by (rule up_eqI, simp add: a_comm R, simp_all add: R) + +end + -lemma (in UP_cring) UP_m_assoc: +context UP_ring +begin + +lemma UP_m_assoc: assumes R: "p \ carrier P" "q \ carrier P" "r \ carrier P" shows "(p \\<^bsub>P\<^esub> q) \\<^bsub>P\<^esub> r = p \\<^bsub>P\<^esub> (q \\<^bsub>P\<^esub> r)" proof (rule up_eqI) @@ -310,14 +325,51 @@ with R show ?case by (simp cong: finsum_cong add: Suc_diff_le Pi_def l_distr r_distr m_assoc) - (simp cong: finsum_cong add: Pi_def a_ac finsum_ldistr m_assoc) + (simp cong: finsum_cong add: Pi_def a_ac finsum_ldistr m_assoc) qed } with R show "coeff P ((p \\<^bsub>P\<^esub> q) \\<^bsub>P\<^esub> r) n = coeff P (p \\<^bsub>P\<^esub> (q \\<^bsub>P\<^esub> r)) n" by (simp add: Pi_def) qed (simp_all add: R) -lemma (in UP_cring) UP_l_one [simp]: +lemma UP_r_one [simp]: + assumes R: "p \ carrier P" shows "p \\<^bsub>P\<^esub> \\<^bsub>P\<^esub> = p" +proof (rule up_eqI) + fix n + show "coeff P (p \\<^bsub>P\<^esub> \\<^bsub>P\<^esub>) n = coeff P p n" + proof (cases n) + case 0 + { + with R show ?thesis by simp + } + next + case Suc + { + (*JE: in the locale UP_cring the proof was solved only with "by (simp del: finsum_Suc add: finsum_Suc2 Pi_def)", but I did not + get it to work here*) + fix nn assume Succ: "n = Suc nn" + have "coeff P (p \\<^bsub>P\<^esub> \\<^bsub>P\<^esub>) (Suc nn) = coeff P p (Suc nn)" + proof - + have "coeff P (p \\<^bsub>P\<^esub> \\<^bsub>P\<^esub>) (Suc nn) = (\i\{..Suc nn}. coeff P p i \ (if Suc nn \ i then \ else \))" using R by simp + also have "\ = coeff P p (Suc nn) \ (if Suc nn \ Suc nn then \ else \) \ (\i\{..nn}. coeff P p i \ (if Suc nn \ i then \ else \))" + using finsum_Suc [of "(\i::nat. coeff P p i \ (if Suc nn \ i then \ else \))" "nn"] unfolding Pi_def using R by simp + also have "\ = coeff P p (Suc nn) \ (if Suc nn \ Suc nn then \ else \)" + proof - + have "(\i\{..nn}. coeff P p i \ (if Suc nn \ i then \ else \)) = (\i\{..nn}. \)" + using finsum_cong [of "{..nn}" "{..nn}" "(\i::nat. coeff P p i \ (if Suc nn \ i then \ else \))" "(\i::nat. \)"] using R + unfolding Pi_def by simp + also have "\ = \" by simp + finally show ?thesis using r_zero R by simp + qed + also have "\ = coeff P p (Suc nn)" using R by simp + finally show ?thesis by simp + qed + then show ?thesis using Succ by simp + } + qed +qed (simp_all add: R) + +lemma UP_l_one [simp]: assumes R: "p \ carrier P" shows "\\<^bsub>P\<^esub> \\<^bsub>P\<^esub> p = p" proof (rule up_eqI) @@ -331,22 +383,36 @@ qed qed (simp_all add: R) -lemma (in UP_cring) UP_l_distr: +lemma UP_l_distr: assumes R: "p \ carrier P" "q \ carrier P" "r \ carrier P" shows "(p \\<^bsub>P\<^esub> q) \\<^bsub>P\<^esub> r = (p \\<^bsub>P\<^esub> r) \\<^bsub>P\<^esub> (q \\<^bsub>P\<^esub> r)" by (rule up_eqI) (simp add: l_distr R Pi_def, simp_all add: R) -lemma (in UP_cring) UP_m_comm: - assumes R: "p \ carrier P" "q \ carrier P" - shows "p \\<^bsub>P\<^esub> q = q \\<^bsub>P\<^esub> p" +lemma UP_r_distr: + assumes R: "p \ carrier P" "q \ carrier P" "r \ carrier P" + shows "r \\<^bsub>P\<^esub> (p \\<^bsub>P\<^esub> q) = (r \\<^bsub>P\<^esub> p) \\<^bsub>P\<^esub> (r \\<^bsub>P\<^esub> q)" + by (rule up_eqI) (simp add: r_distr R Pi_def, simp_all add: R) + +theorem UP_ring: "ring P" + by (auto intro!: ringI abelian_groupI monoidI UP_a_assoc) +(auto intro: UP_a_comm UP_l_neg_ex UP_m_assoc UP_l_distr UP_r_distr) + +end + +subsection {* Polynomials form a commutative Ring. *} + +context UP_cring +begin + +lemma UP_m_comm: + assumes R1: "p \ carrier P" and R2: "q \ carrier P" shows "p \\<^bsub>P\<^esub> q = q \\<^bsub>P\<^esub> p" proof (rule up_eqI) fix n { fix k and a b :: "nat=>'a" assume R: "a \ UNIV -> carrier R" "b \ UNIV -> carrier R" then have "k <= n ==> - (\i \ {..k}. a i \ b (n-i)) = - (\i \ {..k}. a (k-i) \ b (i+n-k))" + (\i \ {..k}. a i \ b (n-i)) = (\i \ {..k}. a (k-i) \ b (i+n-k))" (is "_ \ ?eq k") proof (induct k) case 0 then show ?case by (simp add: Pi_def) @@ -356,31 +422,27 @@ qed } note l = this - from R show "coeff P (p \\<^bsub>P\<^esub> q) n = coeff P (q \\<^bsub>P\<^esub> p) n" - apply (simp add: Pi_def) - apply (subst l) - apply (auto simp add: Pi_def) - apply (simp add: m_comm) - done -qed (simp_all add: R) + from R1 R2 show "coeff P (p \\<^bsub>P\<^esub> q) n = coeff P (q \\<^bsub>P\<^esub> p) n" + unfolding coeff_mult [OF R1 R2, of n] + unfolding coeff_mult [OF R2 R1, of n] + using l [of "(\i. coeff P p i)" "(\i. coeff P q i)" "n"] by (simp add: Pi_def m_comm) +qed (simp_all add: R1 R2) -theorem (in UP_cring) UP_cring: - "cring P" - by (auto intro!: cringI abelian_groupI comm_monoidI UP_a_assoc UP_l_zero - UP_l_neg_ex UP_a_comm UP_m_assoc UP_l_one UP_m_comm UP_l_distr) +subsection{*Polynomials over a commutative ring for a commutative ring*} + +theorem UP_cring: + "cring P" using UP_ring unfolding cring_def by (auto intro!: comm_monoidI UP_m_assoc UP_m_comm) -lemma (in UP_cring) UP_ring: - (* preliminary, - we want "UP_ring R P ==> ring P", not "UP_cring R P ==> ring P" *) - "ring P" - by (auto intro: ring.intro cring.axioms UP_cring) +end + +context UP_ring +begin -lemma (in UP_cring) UP_a_inv_closed [intro, simp]: +lemma UP_a_inv_closed [intro, simp]: "p \ carrier P ==> \\<^bsub>P\<^esub> p \ carrier P" - by (rule abelian_group.a_inv_closed - [OF ring.is_abelian_group [OF UP_ring]]) + by (rule abelian_group.a_inv_closed [OF ring.is_abelian_group [OF UP_ring]]) -lemma (in UP_cring) coeff_a_inv [simp]: +lemma coeff_a_inv [simp]: assumes R: "p \ carrier P" shows "coeff P (\\<^bsub>P\<^esub> p) n = \ (coeff P p n)" proof - @@ -393,42 +455,47 @@ finally show ?thesis . qed -text {* - Interpretation of lemmas from @{term cring}. Saves lifting 43 - lemmas manually. -*} +end -interpretation UP_cring < cring P - by intro_locales - (rule cring.axioms ring.axioms abelian_group.axioms comm_monoid.axioms UP_cring)+ +interpretation UP_ring < ring P using UP_ring . +interpretation UP_cring < cring P using UP_cring . subsection {* Polynomials Form an Algebra *} -lemma (in UP_cring) UP_smult_l_distr: +context UP_ring +begin + +lemma UP_smult_l_distr: "[| a \ carrier R; b \ carrier R; p \ carrier P |] ==> (a \ b) \\<^bsub>P\<^esub> p = a \\<^bsub>P\<^esub> p \\<^bsub>P\<^esub> b \\<^bsub>P\<^esub> p" by (rule up_eqI) (simp_all add: R.l_distr) -lemma (in UP_cring) UP_smult_r_distr: +lemma UP_smult_r_distr: "[| a \ carrier R; p \ carrier P; q \ carrier P |] ==> a \\<^bsub>P\<^esub> (p \\<^bsub>P\<^esub> q) = a \\<^bsub>P\<^esub> p \\<^bsub>P\<^esub> a \\<^bsub>P\<^esub> q" by (rule up_eqI) (simp_all add: R.r_distr) -lemma (in UP_cring) UP_smult_assoc1: +lemma UP_smult_assoc1: "[| a \ carrier R; b \ carrier R; p \ carrier P |] ==> (a \ b) \\<^bsub>P\<^esub> p = a \\<^bsub>P\<^esub> (b \\<^bsub>P\<^esub> p)" by (rule up_eqI) (simp_all add: R.m_assoc) -lemma (in UP_cring) UP_smult_one [simp]: +lemma UP_smult_zero [simp]: + "p \ carrier P ==> \ \\<^bsub>P\<^esub> p = \\<^bsub>P\<^esub>" + by (rule up_eqI) simp_all + +lemma UP_smult_one [simp]: "p \ carrier P ==> \ \\<^bsub>P\<^esub> p = p" by (rule up_eqI) simp_all -lemma (in UP_cring) UP_smult_assoc2: +lemma UP_smult_assoc2: "[| a \ carrier R; p \ carrier P; q \ carrier P |] ==> (a \\<^bsub>P\<^esub> p) \\<^bsub>P\<^esub> q = a \\<^bsub>P\<^esub> (p \\<^bsub>P\<^esub> q)" by (rule up_eqI) (simp_all add: R.finsum_rdistr R.m_assoc Pi_def) +end + text {* Interpretation of lemmas from @{term algebra}. *} @@ -438,44 +505,44 @@ by unfold_locales lemma (in UP_cring) UP_algebra: - "algebra R P" - by (auto intro: algebraI R.cring UP_cring UP_smult_l_distr UP_smult_r_distr + "algebra R P" by (auto intro!: algebraI R.cring UP_cring UP_smult_l_distr UP_smult_r_distr UP_smult_assoc1 UP_smult_assoc2) -interpretation UP_cring < algebra R P - by intro_locales - (rule module.axioms algebra.axioms UP_algebra)+ +interpretation UP_cring < algebra R P using UP_algebra . subsection {* Further Lemmas Involving Monomials *} -lemma (in UP_cring) monom_zero [simp]: - "monom P \ n = \\<^bsub>P\<^esub>" - by (simp add: UP_def P_def) +context UP_ring +begin -lemma (in UP_cring) monom_mult_is_smult: +lemma monom_zero [simp]: + "monom P \ n = \\<^bsub>P\<^esub>" by (simp add: UP_def P_def) + +lemma monom_mult_is_smult: assumes R: "a \ carrier R" "p \ carrier P" shows "monom P a 0 \\<^bsub>P\<^esub> p = a \\<^bsub>P\<^esub> p" proof (rule up_eqI) fix n - have "coeff P (p \\<^bsub>P\<^esub> monom P a 0) n = coeff P (a \\<^bsub>P\<^esub> p) n" + show "coeff P (monom P a 0 \\<^bsub>P\<^esub> p) n = coeff P (a \\<^bsub>P\<^esub> p) n" proof (cases n) - case 0 with R show ?thesis by (simp add: R.m_comm) + case 0 with R show ?thesis by simp next case Suc with R show ?thesis - by (simp cong: R.finsum_cong add: R.r_null Pi_def) - (simp add: R.m_comm) + using R.finsum_Suc2 by (simp del: R.finsum_Suc add: R.r_null Pi_def) qed - with R show "coeff P (monom P a 0 \\<^bsub>P\<^esub> p) n = coeff P (a \\<^bsub>P\<^esub> p) n" - by (simp add: UP_m_comm) qed (simp_all add: R) -lemma (in UP_cring) monom_add [simp]: +lemma monom_one [simp]: + "monom P \ 0 = \\<^bsub>P\<^esub>" + by (rule up_eqI) simp_all + +lemma monom_add [simp]: "[| a \ carrier R; b \ carrier R |] ==> monom P (a \ b) n = monom P a n \\<^bsub>P\<^esub> monom P b n" by (rule up_eqI) simp_all -lemma (in UP_cring) monom_one_Suc: +lemma monom_one_Suc: "monom P \ (Suc n) = monom P \ n \\<^bsub>P\<^esub> monom P \ 1" proof (rule up_eqI) fix k @@ -550,24 +617,59 @@ qed qed (simp_all) -lemma (in UP_cring) monom_mult_smult: +lemma monom_one_Suc2: + "monom P \ (Suc n) = monom P \ 1 \\<^bsub>P\<^esub> monom P \ n" +proof (induct n) + case 0 show ?case by simp +next + case Suc + { + fix k:: nat + assume hypo: "monom P \ (Suc k) = monom P \ 1 \\<^bsub>P\<^esub> monom P \ k" + then show "monom P \ (Suc (Suc k)) = monom P \ 1 \\<^bsub>P\<^esub> monom P \ (Suc k)" + proof - + have lhs: "monom P \ (Suc (Suc k)) = monom P \ 1 \\<^bsub>P\<^esub> monom P \ k \\<^bsub>P\<^esub> monom P \ 1" + unfolding monom_one_Suc [of "Suc k"] unfolding hypo .. + note cl = monom_closed [OF R.one_closed, of 1] + note clk = monom_closed [OF R.one_closed, of k] + have rhs: "monom P \ 1 \\<^bsub>P\<^esub> monom P \ (Suc k) = monom P \ 1 \\<^bsub>P\<^esub> monom P \ k \\<^bsub>P\<^esub> monom P \ 1" + unfolding monom_one_Suc [of k] unfolding sym [OF m_assoc [OF cl clk cl]] .. + from lhs rhs show ?thesis by simp + qed + } +qed + +text{*The following corollary follows from lemmas @{thm [locale=UP_ring] "monom_one_Suc"} + and @{thm [locale=UP_ring] "monom_one_Suc2"}, and is trivial in @{term UP_cring}*} + +corollary monom_one_comm: shows "monom P \ k \\<^bsub>P\<^esub> monom P \ 1 = monom P \ 1 \\<^bsub>P\<^esub> monom P \ k" + unfolding monom_one_Suc [symmetric] monom_one_Suc2 [symmetric] .. + +lemma monom_mult_smult: "[| a \ carrier R; b \ carrier R |] ==> monom P (a \ b) n = a \\<^bsub>P\<^esub> monom P b n" by (rule up_eqI) simp_all -lemma (in UP_cring) monom_one [simp]: - "monom P \ 0 = \\<^bsub>P\<^esub>" - by (rule up_eqI) simp_all - -lemma (in UP_cring) monom_one_mult: +lemma monom_one_mult: "monom P \ (n + m) = monom P \ n \\<^bsub>P\<^esub> monom P \ m" proof (induct n) case 0 show ?case by simp next case Suc then show ?case - by (simp only: add_Suc monom_one_Suc) (simp add: P.m_ac) + unfolding add_Suc unfolding monom_one_Suc unfolding Suc.hyps + using m_assoc monom_one_comm [of m] by simp qed -lemma (in UP_cring) monom_mult [simp]: +lemma monom_one_mult_comm: "monom P \ n \\<^bsub>P\<^esub> monom P \ m = monom P \ m \\<^bsub>P\<^esub> monom P \ n" + unfolding monom_one_mult [symmetric] by (rule up_eqI) simp_all + +end + +context UP_cring +begin + +(* Could got to UP_ring? *) + +lemma monom_mult [simp]: assumes R: "a \ carrier R" "b \ carrier R" shows "monom P (a \ b) (n + m) = monom P a n \\<^bsub>P\<^esub> monom P b m" proof - @@ -579,11 +681,11 @@ also from R have "... = a \\<^bsub>P\<^esub> (b \\<^bsub>P\<^esub> (monom P \ n \\<^bsub>P\<^esub> monom P \ m))" by (simp add: UP_smult_assoc1) also from R have "... = a \\<^bsub>P\<^esub> (b \\<^bsub>P\<^esub> (monom P \ m \\<^bsub>P\<^esub> monom P \ n))" - by (simp add: P.m_comm) + unfolding monom_one_mult_comm by simp also from R have "... = a \\<^bsub>P\<^esub> ((b \\<^bsub>P\<^esub> monom P \ m) \\<^bsub>P\<^esub> monom P \ n)" by (simp add: UP_smult_assoc2) also from R have "... = a \\<^bsub>P\<^esub> (monom P \ n \\<^bsub>P\<^esub> (b \\<^bsub>P\<^esub> monom P \ m))" - by (simp add: P.m_comm) + using monom_one_mult_comm [of n m] by (simp add: P.m_comm) also from R have "... = (a \\<^bsub>P\<^esub> monom P \ n) \\<^bsub>P\<^esub> (b \\<^bsub>P\<^esub> monom P \ m)" by (simp add: UP_smult_assoc2) also from R have "... = monom P (a \ \) n \\<^bsub>P\<^esub> monom P (b \ \) m" @@ -592,11 +694,16 @@ finally show ?thesis . qed -lemma (in UP_cring) monom_a_inv [simp]: +end + +context UP_ring +begin + +lemma monom_a_inv [simp]: "a \ carrier R ==> monom P (\ a) n = \\<^bsub>P\<^esub> monom P a n" by (rule up_eqI) simp_all -lemma (in UP_cring) monom_inj: +lemma monom_inj: "inj_on (%a. monom P a n) (carrier R)" proof (rule inj_onI) fix x y @@ -605,6 +712,8 @@ with R show "x = y" by simp qed +end + subsection {* The Degree Function *} @@ -612,7 +721,10 @@ deg :: "[('a, 'm) ring_scheme, nat => 'a] => nat" "deg R p == LEAST n. bound \ n (coeff (UP R) p)" -lemma (in UP_cring) deg_aboveI: +context UP_ring +begin + +lemma deg_aboveI: "[| (!!m. n < m ==> coeff P p m = \); p \ carrier P |] ==> deg R p <= n" by (unfold deg_def P_def) (fast intro: Least_le) @@ -633,7 +745,7 @@ qed *) -lemma (in UP_cring) deg_aboveD: +lemma deg_aboveD: assumes "deg R p < m" and "p \ carrier P" shows "coeff P p m = \" proof - @@ -644,7 +756,7 @@ from this and `deg R p < m` show ?thesis .. qed -lemma (in UP_cring) deg_belowI: +lemma deg_belowI: assumes non_zero: "n ~= 0 ==> coeff P p n ~= \" and R: "p \ carrier P" shows "n <= deg R p" @@ -658,7 +770,7 @@ then show ?thesis by arith qed -lemma (in UP_cring) lcoeff_nonzero_deg: +lemma lcoeff_nonzero_deg: assumes deg: "deg R p ~= 0" and R: "p \ carrier P" shows "coeff P p (deg R p) ~= \" proof - @@ -666,9 +778,8 @@ proof - have minus: "!!(n::nat) m. n ~= 0 ==> (n - Suc 0 < m) = (n <= m)" by arith -(* TODO: why does simplification below not work with "1" *) from deg have "deg R p - 1 < (LEAST n. bound \ n (coeff P p))" - by (unfold deg_def P_def) arith + by (unfold deg_def P_def) simp then have "~ bound \ (deg R p - 1) (coeff P p)" by (rule not_less_Least) then have "EX m. deg R p - 1 < m & coeff P p m ~= \" by (unfold bound_def) fast @@ -679,7 +790,7 @@ with m_coeff show ?thesis by simp qed -lemma (in UP_cring) lcoeff_nonzero_nonzero: +lemma lcoeff_nonzero_nonzero: assumes deg: "deg R p = 0" and nonzero: "p ~= \\<^bsub>P\<^esub>" and R: "p \ carrier P" shows "coeff P p 0 ~= \" proof - @@ -695,7 +806,7 @@ with coeff show ?thesis by simp qed -lemma (in UP_cring) lcoeff_nonzero: +lemma lcoeff_nonzero: assumes neq: "p ~= \\<^bsub>P\<^esub>" and R: "p \ carrier P" shows "coeff P p (deg R p) ~= \" proof (cases "deg R p = 0") @@ -704,14 +815,14 @@ case False with neq R show ?thesis by (simp add: lcoeff_nonzero_deg) qed -lemma (in UP_cring) deg_eqI: +lemma deg_eqI: "[| !!m. n < m ==> coeff P p m = \; !!n. n ~= 0 ==> coeff P p n ~= \; p \ carrier P |] ==> deg R p = n" by (fast intro: le_anti_sym deg_aboveI deg_belowI) text {* Degree and polynomial operations *} -lemma (in UP_cring) deg_add [simp]: +lemma deg_add [simp]: assumes R: "p \ carrier P" "q \ carrier P" shows "deg R (p \\<^bsub>P\<^esub> q) <= max (deg R p) (deg R q)" proof (cases "deg R p <= deg R q") @@ -722,15 +833,15 @@ by (rule deg_aboveI) (simp_all add: False R deg_aboveD) qed -lemma (in UP_cring) deg_monom_le: +lemma deg_monom_le: "a \ carrier R ==> deg R (monom P a n) <= n" by (intro deg_aboveI) simp_all -lemma (in UP_cring) deg_monom [simp]: +lemma deg_monom [simp]: "[| a ~= \; a \ carrier R |] ==> deg R (monom P a n) = n" by (fastsimp intro: le_anti_sym deg_aboveI deg_belowI) -lemma (in UP_cring) deg_const [simp]: +lemma deg_const [simp]: assumes R: "a \ carrier R" shows "deg R (monom P a 0) = 0" proof (rule le_anti_sym) show "deg R (monom P a 0) <= 0" by (rule deg_aboveI) (simp_all add: R) @@ -738,7 +849,7 @@ show "0 <= deg R (monom P a 0)" by (rule deg_belowI) (simp_all add: R) qed -lemma (in UP_cring) deg_zero [simp]: +lemma deg_zero [simp]: "deg R \\<^bsub>P\<^esub> = 0" proof (rule le_anti_sym) show "deg R \\<^bsub>P\<^esub> <= 0" by (rule deg_aboveI) simp_all @@ -746,7 +857,7 @@ show "0 <= deg R \\<^bsub>P\<^esub>" by (rule deg_belowI) simp_all qed -lemma (in UP_cring) deg_one [simp]: +lemma deg_one [simp]: "deg R \\<^bsub>P\<^esub> = 0" proof (rule le_anti_sym) show "deg R \\<^bsub>P\<^esub> <= 0" by (rule deg_aboveI) simp_all @@ -754,7 +865,7 @@ show "0 <= deg R \\<^bsub>P\<^esub>" by (rule deg_belowI) simp_all qed -lemma (in UP_cring) deg_uminus [simp]: +lemma deg_uminus [simp]: assumes R: "p \ carrier P" shows "deg R (\\<^bsub>P\<^esub> p) = deg R p" proof (rule le_anti_sym) show "deg R (\\<^bsub>P\<^esub> p) <= deg R p" by (simp add: deg_aboveI deg_aboveD R) @@ -764,12 +875,20 @@ inj_on_iff [OF R.a_inv_inj, of _ "\", simplified] R) qed -lemma (in UP_domain) deg_smult_ring: +text{*The following lemma is later \emph{overwritten} by the most + specific one for domains, @{text deg_smult}.*} + +lemma deg_smult_ring [simp]: "[| a \ carrier R; p \ carrier P |] ==> deg R (a \\<^bsub>P\<^esub> p) <= (if a = \ then 0 else deg R p)" by (cases "a = \") (simp add: deg_aboveI deg_aboveD)+ -lemma (in UP_domain) deg_smult [simp]: +end + +context UP_domain +begin + +lemma deg_smult [simp]: assumes R: "a \ carrier R" "p \ carrier P" shows "deg R (a \\<^bsub>P\<^esub> p) = (if a = \ then 0 else deg R p)" proof (rule le_anti_sym) @@ -781,7 +900,12 @@ qed (simp, simp add: deg_belowI lcoeff_nonzero_deg integral_iff R) qed -lemma (in UP_cring) deg_mult_cring: +end + +context UP_ring +begin + +lemma deg_mult_ring: assumes R: "p \ carrier P" "q \ carrier P" shows "deg R (p \\<^bsub>P\<^esub> q) <= deg R p + deg R q" proof (rule deg_aboveI) @@ -801,12 +925,17 @@ with boundm R show "coeff P (p \\<^bsub>P\<^esub> q) m = \" by simp qed (simp add: R) -lemma (in UP_domain) deg_mult [simp]: +end + +context UP_domain +begin + +lemma deg_mult [simp]: "[| p ~= \\<^bsub>P\<^esub>; q ~= \\<^bsub>P\<^esub>; p \ carrier P; q \ carrier P |] ==> deg R (p \\<^bsub>P\<^esub> q) = deg R p + deg R q" proof (rule le_anti_sym) assume "p \ carrier P" " q \ carrier P" - then show "deg R (p \\<^bsub>P\<^esub> q) <= deg R p + deg R q" by (rule deg_mult_cring) + then show "deg R (p \\<^bsub>P\<^esub> q) <= deg R p + deg R q" by (rule deg_mult_ring) next let ?s = "(%i. coeff P p i \ coeff P q (deg R p + deg R q - i))" assume R: "p \ carrier P" "q \ carrier P" and nz: "p ~= \\<^bsub>P\<^esub>" "q ~= \\<^bsub>P\<^esub>" @@ -828,16 +957,23 @@ = coeff P p (deg R p) \ coeff P q (deg R q)" . with nz show "(\i \ {.. deg R p + deg R q}. ?s i) ~= \" by (simp add: integral_iff lcoeff_nonzero R) - qed (simp add: R) - qed + qed (simp add: R) +qed + +end -lemma (in UP_cring) coeff_finsum: +text{*The following lemmas also can be lifted to @{term UP_ring}.*} + +context UP_ring +begin + +lemma coeff_finsum: assumes fin: "finite A" shows "p \ A -> carrier P ==> coeff P (finsum P p A) k = (\i \ A. coeff P (p i) k)" using fin by induct (auto simp: Pi_def) -lemma (in UP_cring) up_repr: +lemma up_repr: assumes R: "p \ carrier P" shows "(\\<^bsub>P\<^esub> i \ {..deg R p}. monom P (coeff P p i) i) = p" proof (rule up_eqI) @@ -874,7 +1010,7 @@ qed qed (simp_all add: R Pi_def) -lemma (in UP_cring) up_repr_le: +lemma up_repr_le: "[| deg R p <= n; p \ carrier P |] ==> (\\<^bsub>P\<^esub> i \ {..n}. monom P (coeff P p i) i) = p" proof - @@ -889,6 +1025,8 @@ finally show ?thesis . qed +end + subsection {* Polynomials over Integral Domains *} @@ -901,16 +1039,19 @@ by (auto intro!: domain.intro domain_axioms.intro cring.axioms assms del: disjCI) -lemma (in UP_domain) UP_one_not_zero: +context UP_domain +begin + +lemma UP_one_not_zero: "\\<^bsub>P\<^esub> ~= \\<^bsub>P\<^esub>" proof assume "\\<^bsub>P\<^esub> = \\<^bsub>P\<^esub>" hence "coeff P \\<^bsub>P\<^esub> 0 = (coeff P \\<^bsub>P\<^esub> 0)" by simp hence "\ = \" by simp - with one_not_zero show "False" by contradiction + with R.one_not_zero show "False" by contradiction qed -lemma (in UP_domain) UP_integral: +lemma UP_integral: "[| p \\<^bsub>P\<^esub> q = \\<^bsub>P\<^esub>; p \ carrier P; q \ carrier P |] ==> p = \\<^bsub>P\<^esub> | q = \\<^bsub>P\<^esub>" proof - fix p q @@ -939,10 +1080,12 @@ qed qed -theorem (in UP_domain) UP_domain: +theorem UP_domain: "domain P" by (auto intro!: domainI UP_cring UP_one_not_zero UP_integral del: disjCI) +end + text {* Interpretation of theorems from @{term domain}. *} @@ -959,7 +1102,14 @@ !!i. i \ B ==> f i = g i |] ==> finsum G f A = finsum G g B" sorry*) -theorem (in cring) diagonal_sum: +lemma (in abelian_monoid) boundD_carrier: + "[| bound \ n f; n < m |] ==> f m \ carrier G" + by auto + +context ring +begin + +theorem diagonal_sum: "[| f \ {..n + m::nat} -> carrier R; g \ {..n + m} -> carrier R |] ==> (\k \ {..n + m}. \i \ {..k}. f i \ g (k - i)) = (\k \ {..n + m}. \i \ {..n + m - k}. f k \ g i)" @@ -992,11 +1142,7 @@ then show ?thesis by fast qed -lemma (in abelian_monoid) boundD_carrier: - "[| bound \ n f; n < m |] ==> f m \ carrier G" - by auto - -theorem (in cring) cauchy_product: +theorem cauchy_product: assumes bf: "bound \ n f" and bg: "bound \ m g" and Rf: "f \ {..n} -> carrier R" and Rg: "g \ {..m} -> carrier R" shows "(\k \ {..n + m}. \i \ {..k}. f i \ g (k - i)) = @@ -1034,7 +1180,9 @@ finally show ?thesis . qed -lemma (in UP_cring) const_ring_hom: +end + +lemma (in UP_ring) const_ring_hom: "(%a. monom P a 0) \ ring_hom R P" by (auto intro!: ring_hom_memI intro: up_eqI simp: monom_mult_is_smult) @@ -1044,17 +1192,20 @@ "eval R S phi s == \p \ carrier (UP R). \i \ {..deg R p}. phi (coeff (UP R) p i) \ s (^) i" +context UP +begin -lemma (in UP) eval_on_carrier: +lemma eval_on_carrier: fixes S (structure) shows "p \ carrier P ==> eval R S phi s p = (\\<^bsub>S\<^esub> i \ {..deg R p}. phi (coeff P p i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" by (unfold eval_def, fold P_def) simp -lemma (in UP) eval_extensional: +lemma eval_extensional: "eval R S phi p \ extensional (carrier P)" by (unfold eval_def, fold P_def) simp +end text {* The universal property of the polynomial ring *} @@ -1065,7 +1216,23 @@ assumes indet_img_carrier [simp, intro]: "s \ carrier S" defines Eval_def: "Eval == eval R S h s" -theorem (in UP_pre_univ_prop) eval_ring_hom: +text{*JE: I have moved the following lemma from Ring.thy and lifted then to the locale @{term ring_hom_ring} from @{term ring_hom_cring}.*} +text{*JE: I was considering using it in @{text eval_ring_hom}, but that property does not hold for non commutative rings, so + maybe it is not that necessary.*} + +lemma (in ring_hom_ring) hom_finsum [simp]: + "[| finite A; f \ A -> carrier R |] ==> + h (finsum R f A) = finsum S (h o f) A" +proof (induct set: finite) + case empty then show ?case by simp +next + case insert then show ?case by (simp add: Pi_def) +qed + +context UP_pre_univ_prop +begin + +theorem eval_ring_hom: assumes S: "s \ carrier S" shows "eval R S h s \ ring_hom P S" proof (rule ring_hom_memI) @@ -1076,38 +1243,6 @@ next fix p q assume R: "p \ carrier P" "q \ carrier P" - then show "eval R S h s (p \\<^bsub>P\<^esub> q) = eval R S h s p \\<^bsub>S\<^esub> eval R S h s q" - proof (simp only: eval_on_carrier UP_mult_closed) - from R S have - "(\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) = - (\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)} \ {deg R (p \\<^bsub>P\<^esub> q)<..deg R p + deg R q}. - h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" - by (simp cong: S.finsum_cong - add: deg_aboveD S.finsum_Un_disjoint ivl_disj_int_one Pi_def - del: coeff_mult) - also from R have "... = - (\\<^bsub>S\<^esub> i \ {..deg R p + deg R q}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" - by (simp only: ivl_disj_un_one deg_mult_cring) - also from R S have "... = - (\\<^bsub>S\<^esub> i \ {..deg R p + deg R q}. - \\<^bsub>S\<^esub> k \ {..i}. - h (coeff P p k) \\<^bsub>S\<^esub> h (coeff P q (i - k)) \\<^bsub>S\<^esub> - (s (^)\<^bsub>S\<^esub> k \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> (i - k)))" - by (simp cong: S.finsum_cong add: S.nat_pow_mult Pi_def - S.m_ac S.finsum_rdistr) - also from R S have "... = - (\\<^bsub>S\<^esub> i\{..deg R p}. h (coeff P p i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) \\<^bsub>S\<^esub> - (\\<^bsub>S\<^esub> i\{..deg R q}. h (coeff P q i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" - by (simp add: S.cauchy_product [THEN sym] bound.intro deg_aboveD S.m_ac - Pi_def) - finally show - "(\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) = - (\\<^bsub>S\<^esub> i \ {..deg R p}. h (coeff P p i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) \\<^bsub>S\<^esub> - (\\<^bsub>S\<^esub> i \ {..deg R q}. h (coeff P q i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" . - qed -next - fix p q - assume R: "p \ carrier P" "q \ carrier P" then show "eval R S h s (p \\<^bsub>P\<^esub> q) = eval R S h s p \\<^bsub>S\<^esub> eval R S h s q" proof (simp only: eval_on_carrier P.a_closed) from S R have @@ -1115,8 +1250,7 @@ (\\<^bsub>S \<^esub>i\{..deg R (p \\<^bsub>P\<^esub> q)} \ {deg R (p \\<^bsub>P\<^esub> q)<..max (deg R p) (deg R q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" by (simp cong: S.finsum_cong - add: deg_aboveD S.finsum_Un_disjoint ivl_disj_int_one Pi_def - del: coeff_add) + add: deg_aboveD S.finsum_Un_disjoint ivl_disj_int_one Pi_def del: coeff_add) also from R have "... = (\\<^bsub>S\<^esub> i \ {..max (deg R p) (deg R q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" @@ -1145,23 +1279,40 @@ next show "eval R S h s \\<^bsub>P\<^esub> = \\<^bsub>S\<^esub>" by (simp only: eval_on_carrier UP_one_closed) simp +next + fix p q + assume R: "p \ carrier P" "q \ carrier P" + then show "eval R S h s (p \\<^bsub>P\<^esub> q) = eval R S h s p \\<^bsub>S\<^esub> eval R S h s q" + proof (simp only: eval_on_carrier UP_mult_closed) + from R S have + "(\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) = + (\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)} \ {deg R (p \\<^bsub>P\<^esub> q)<..deg R p + deg R q}. + h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" + by (simp cong: S.finsum_cong + add: deg_aboveD S.finsum_Un_disjoint ivl_disj_int_one Pi_def + del: coeff_mult) + also from R have "... = + (\\<^bsub>S\<^esub> i \ {..deg R p + deg R q}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" + by (simp only: ivl_disj_un_one deg_mult_ring) + also from R S have "... = + (\\<^bsub>S\<^esub> i \ {..deg R p + deg R q}. + \\<^bsub>S\<^esub> k \ {..i}. + h (coeff P p k) \\<^bsub>S\<^esub> h (coeff P q (i - k)) \\<^bsub>S\<^esub> + (s (^)\<^bsub>S\<^esub> k \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> (i - k)))" + by (simp cong: S.finsum_cong add: S.nat_pow_mult Pi_def + S.m_ac S.finsum_rdistr) + also from R S have "... = + (\\<^bsub>S\<^esub> i\{..deg R p}. h (coeff P p i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) \\<^bsub>S\<^esub> + (\\<^bsub>S\<^esub> i\{..deg R q}. h (coeff P q i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" + by (simp add: S.cauchy_product [THEN sym] bound.intro deg_aboveD S.m_ac + Pi_def) + finally show + "(\\<^bsub>S\<^esub> i \ {..deg R (p \\<^bsub>P\<^esub> q)}. h (coeff P (p \\<^bsub>P\<^esub> q) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) = + (\\<^bsub>S\<^esub> i \ {..deg R p}. h (coeff P p i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) \\<^bsub>S\<^esub> + (\\<^bsub>S\<^esub> i \ {..deg R q}. h (coeff P q i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i)" . + qed qed -text {* Interpretation of ring homomorphism lemmas. *} - -interpretation UP_univ_prop < ring_hom_cring P S Eval - apply (unfold Eval_def) - apply intro_locales - apply (rule ring_hom_cring.axioms) - apply (rule ring_hom_cring.intro) - apply unfold_locales - apply (rule eval_ring_hom) - apply rule - done - - -text {* Further properties of the evaluation homomorphism. *} - text {* The following lemma could be proved in @{text UP_cring} with the additional assumption that @{text h} is closed. *} @@ -1170,6 +1321,8 @@ "[| s \ carrier S; r \ carrier R |] ==> eval R S h s (monom P r 0) = h r" by (simp only: eval_on_carrier monom_closed) simp +text {* Further properties of the evaluation homomorphism. *} + text {* The following proof is complicated by the fact that in arbitrary rings one might have @{term "one R = zero R"}. *} @@ -1198,6 +1351,20 @@ h (coeff P (monom P \ 1) i) \\<^bsub>S\<^esub> s (^)\<^bsub>S\<^esub> i) = s" . qed +end + +text {* Interpretation of ring homomorphism lemmas. *} + +interpretation UP_univ_prop < ring_hom_cring P S Eval + apply (unfold Eval_def) + apply intro_locales + apply (rule ring_hom_cring.axioms) + apply (rule ring_hom_cring.intro) + apply unfold_locales + apply (rule eval_ring_hom) + apply rule + done + lemma (in UP_cring) monom_pow: assumes R: "a \ carrier R" shows "(monom P a n) (^)\<^bsub>P\<^esub> m = monom P (a (^) m) (n * m)" @@ -1253,7 +1420,10 @@ by (fast intro: ring_hom_cring.intro ring_hom_cring_axioms.intro cring.axioms assms) -lemma (in UP_pre_univ_prop) UP_hom_unique: +context UP_pre_univ_prop +begin + +lemma UP_hom_unique: assumes "ring_hom_cring P S Phi" assumes Phi: "Phi (monom P \ (Suc 0)) = s" "!!r. r \ carrier R ==> Phi (monom P r 0) = h r" @@ -1277,7 +1447,7 @@ finally show ?thesis . qed -lemma (in UP_pre_univ_prop) ring_homD: +lemma ring_homD: assumes Phi: "Phi \ ring_hom P S" shows "ring_hom_cring P S Phi" proof (rule ring_hom_cring.intro) @@ -1285,7 +1455,7 @@ by (rule ring_hom_cring_axioms.intro) (rule Phi) qed unfold_locales -theorem (in UP_pre_univ_prop) UP_universal_property: +theorem UP_universal_property: assumes S: "s \ carrier S" shows "EX! Phi. Phi \ ring_hom P S \ extensional (carrier P) & Phi (monom P \ 1) = s & @@ -1296,6 +1466,8 @@ apply (auto intro: UP_hom_unique ring_homD) done +end + subsection {* Sample Application of Evaluation Homomorphism *} @@ -1308,9 +1480,8 @@ by (auto intro!: UP_pre_univ_prop.intro ring_hom_cring.intro ring_hom_cring_axioms.intro UP_cring.intro) -constdefs - INTEG :: "int ring" - "INTEG == (| carrier = UNIV, mult = op *, one = 1, zero = 0, add = op + |)" +definition INTEG :: "int ring" + where INTEG_def: "INTEG == (| carrier = UNIV, mult = op *, one = 1, zero = 0, add = op + |)" lemma INTEG_cring: "cring INTEG" @@ -1327,11 +1498,7 @@ "UP INTEG"} globally. *} -interpretation INTEG: UP_pre_univ_prop [INTEG INTEG id] - apply simp - using INTEG_id_eval - apply simp - done +interpretation INTEG: UP_pre_univ_prop [INTEG INTEG id] using INTEG_id_eval by simp_all lemma INTEG_closed [intro, simp]: "z \ carrier INTEG" diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/Algebra/document/root.tex --- a/src/HOL/Algebra/document/root.tex Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/Algebra/document/root.tex Fri Aug 01 18:10:52 2008 +0200 @@ -1,4 +1,3 @@ - % $Id$ \documentclass[11pt,a4paper]{article} @@ -7,23 +6,22 @@ \usepackage{amssymb} \usepackage[latin1]{inputenc} \usepackage[only,bigsqcap]{stmaryrd} -%\usepackage{masmath} +%\usepackage{amsmath} % this should be the last package used \usepackage{pdfsetup} \urlstyle{rm} -\isabellestyle{it} +\isabellestyle{tt} \pagestyle{myheadings} \begin{document} \title{The Isabelle/HOL Algebra Library} -\author{ - Clemens Ballarin \\ - Florian Kammüller \\ - Lawrence C Paulson -} +\author{Clemens Ballarin (Editor)} +\date{With contributions by Jesús Aransay, Clemens Ballarin, Stephan Hohe, + Florian Kammüller and Lawrence C Paulson \\ + \today} \maketitle \tableofcontents @@ -34,8 +32,8 @@ \clearpage -\renewcommand{\isamarkupheader}[1]% -{\section{\isabellecontext: #1}\markright{THEORY~``\isabellecontext''}} +%\renewcommand{\isamarkupheader}[1]% +%{\section{\isabellecontext: #1}\markright{THEORY~``\isabellecontext''}} \parindent 0pt\parskip 0.5ex \input{session} diff -r 96699d8eb49e -r 21bbd410ba04 src/HOL/IsaMakefile --- a/src/HOL/IsaMakefile Fri Aug 01 17:41:37 2008 +0200 +++ b/src/HOL/IsaMakefile Fri Aug 01 18:10:52 2008 +0200 @@ -520,7 +520,7 @@ Algebra/document/root.tex Algebra/poly/LongDiv.thy \ Algebra/poly/PolyHomo.thy Algebra/poly/Polynomial.thy \ Algebra/poly/UnivPoly2.thy Algebra/ringsimp.ML - @cd Algebra; $(ISATOOL) usedir -b -g true $(OUT)/HOL HOL-Algebra + @cd Algebra; $(ISATOOL) usedir -b -g true -V outline=/proof,/ML $(OUT)/HOL HOL-Algebra ## HOL-Auth