# HG changeset patch # User wenzelm # Date 1082749564 -7200 # Node ID 65f8680c3f16f398db23b78c0de62a875ef1dcb0 # Parent d2e5df3d120129495fcac7db9be1ea761f776049 improved notation; diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/Bij.thy --- a/src/HOL/Algebra/Bij.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/Bij.thy Fri Apr 23 21:46:04 2004 +0200 @@ -3,41 +3,41 @@ Author: Florian Kammueller, with new proofs by L C Paulson *) - -header{*Bijections of a Set, Permutation Groups, Automorphism Groups*} +header {* Bijections of a Set, Permutation Groups, Automorphism Groups *} theory Bij = Group: constdefs - Bij :: "'a set => (('a => 'a)set)" + Bij :: "'a set => ('a => 'a) set" --{*Only extensional functions, since otherwise we get too many.*} - "Bij S == extensional S \ {f. f`S = S & inj_on f S}" + "Bij S == extensional S \ {f. f`S = S & inj_on f S}" - BijGroup :: "'a set => (('a => 'a) monoid)" - "BijGroup S == (| carrier = Bij S, - mult = %g: Bij S. %f: Bij S. compose S g f, - one = %x: S. x |)" + BijGroup :: "'a set => ('a => 'a) monoid" + "BijGroup S == + (| carrier = Bij S, + mult = %g: Bij S. %f: Bij S. compose S g f, + one = %x: S. x |)" declare Id_compose [simp] compose_Id [simp] lemma Bij_imp_extensional: "f \ Bij S ==> f \ extensional S" -by (simp add: Bij_def) + by (simp add: Bij_def) lemma Bij_imp_funcset: "f \ Bij S ==> f \ S -> S" -by (auto simp add: Bij_def Pi_def) + by (auto simp add: Bij_def Pi_def) lemma Bij_imp_apply: "f \ Bij S ==> f ` S = S" -by (simp add: Bij_def) + by (simp add: Bij_def) lemma Bij_imp_inj_on: "f \ Bij S ==> inj_on f S" -by (simp add: Bij_def) + by (simp add: Bij_def) lemma BijI: "[| f \ extensional(S); f`S = S; inj_on f S |] ==> f \ Bij S" -by (simp add: Bij_def) + by (simp add: Bij_def) -subsection{*Bijections Form a Group*} +subsection {*Bijections Form a Group *} lemma restrict_Inv_Bij: "f \ Bij S ==> (%x:S. (Inv S f) x) \ Bij S" apply (simp add: Bij_def) @@ -60,7 +60,7 @@ lemma compose_Bij: "[| x \ Bij S; y \ Bij S|] ==> compose S x y \ Bij S" apply (rule BijI) - apply (simp add: compose_extensional) + apply (simp add: compose_extensional) apply (blast del: equalityI intro: surj_compose dest: Bij_imp_apply Bij_imp_inj_on) apply (blast intro: inj_on_compose dest: Bij_imp_apply Bij_imp_inj_on) @@ -70,44 +70,44 @@ "f \ Bij S ==> compose S (restrict (Inv S f) S) f = (\x\S. x)" apply (rule compose_Inv_id) apply (simp add: Bij_imp_inj_on) -apply (simp add: Bij_imp_apply) +apply (simp add: Bij_imp_apply) done theorem group_BijGroup: "group (BijGroup S)" -apply (simp add: BijGroup_def) +apply (simp add: BijGroup_def) apply (rule groupI) apply (simp add: compose_Bij) apply (simp add: id_Bij) apply (simp add: compose_Bij) apply (blast intro: compose_assoc [symmetric] Bij_imp_funcset) apply (simp add: id_Bij Bij_imp_funcset Bij_imp_extensional, simp) -apply (blast intro: Bij_compose_restrict_eq restrict_Inv_Bij) +apply (blast intro: Bij_compose_restrict_eq restrict_Inv_Bij) done subsection{*Automorphisms Form a Group*} lemma Bij_Inv_mem: "[| f \ Bij S; x : S |] ==> Inv S f x : S" -by (simp add: Bij_def Inv_mem) +by (simp add: Bij_def Inv_mem) lemma Bij_Inv_lemma: assumes eq: "!!x y. [|x \ S; y \ S|] ==> h(g x y) = g (h x) (h y)" - shows "[| h \ Bij S; g \ S \ S \ S; x \ S; y \ S |] + shows "[| h \ Bij S; g \ S \ S \ S; x \ S; y \ S |] ==> Inv S h (g x y) = g (Inv S h x) (Inv S h y)" -apply (simp add: Bij_def) +apply (simp add: Bij_def) apply (subgoal_tac "EX x':S. EX y':S. x = h x' & y = h y'", clarify) apply (simp add: eq [symmetric] Inv_f_f funcset_mem [THEN funcset_mem], blast) done constdefs - auto :: "('a,'b) monoid_scheme => ('a => 'a)set" + auto :: "('a, 'b) monoid_scheme => ('a => 'a) set" "auto G == hom G G \ Bij (carrier G)" - AutoGroup :: "[('a,'c) monoid_scheme] => ('a=>'a) monoid" + AutoGroup :: "('a, 'c) monoid_scheme => ('a => 'a) monoid" "AutoGroup G == BijGroup (carrier G) (|carrier := auto G |)" lemma id_in_auto: "group G ==> (%x: carrier G. x) \ auto G" - by (simp add: auto_def hom_def restrictI group.axioms id_Bij) + by (simp add: auto_def hom_def restrictI group.axioms id_Bij) lemma mult_funcset: "group G ==> mult G \ carrier G -> carrier G -> carrier G" by (simp add: Pi_I group.axioms) @@ -122,27 +122,26 @@ "f \ Bij S ==> m_inv (BijGroup S) f = (%x: S. (Inv S f) x)" apply (rule group.inv_equality) apply (rule group_BijGroup) -apply (simp_all add: BijGroup_def restrict_Inv_Bij Bij_compose_restrict_eq) +apply (simp_all add: BijGroup_def restrict_Inv_Bij Bij_compose_restrict_eq) done lemma subgroup_auto: "group G ==> subgroup (auto G) (BijGroup (carrier G))" -apply (rule group.subgroupI) - apply (rule group_BijGroup) - apply (force simp add: auto_def BijGroup_def) - apply (blast intro: dest: id_in_auto) +apply (rule group.subgroupI) + apply (rule group_BijGroup) + apply (force simp add: auto_def BijGroup_def) + apply (blast intro: dest: id_in_auto) apply (simp del: restrict_apply - add: inv_BijGroup auto_def restrict_Inv_Bij restrict_Inv_hom) + add: inv_BijGroup auto_def restrict_Inv_Bij restrict_Inv_hom) apply (simp add: BijGroup_def auto_def Bij_imp_funcset compose_hom compose_Bij) done theorem AutoGroup: "group G ==> group (AutoGroup G)" -apply (simp add: AutoGroup_def) +apply (simp add: AutoGroup_def) apply (rule Group.subgroup.groupI) -apply (erule subgroup_auto) -apply (insert Bij.group_BijGroup [of "carrier G"]) -apply (simp_all add: group_def) +apply (erule subgroup_auto) +apply (insert Bij.group_BijGroup [of "carrier G"]) +apply (simp_all add: group_def) done end - diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/CRing.thy --- a/src/HOL/Algebra/CRing.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/CRing.thy Fri Apr 23 21:46:04 2004 +0200 @@ -189,13 +189,13 @@ syntax "_finsum" :: "index => idt => 'a set => 'b => 'b" - ("\__:_. _" [1000, 0, 51, 10] 10) + ("(3\__:_. _)" [1000, 0, 51, 10] 10) syntax (xsymbols) "_finsum" :: "index => idt => 'a set => 'b => 'b" - ("\__\_. _" [1000, 0, 51, 10] 10) + ("(3\__\_. _)" [1000, 0, 51, 10] 10) syntax (HTML output) "_finsum" :: "index => idt => 'a set => 'b => 'b" - ("\__\_. _" [1000, 0, 51, 10] 10) + ("(3\__\_. _)" [1000, 0, 51, 10] 10) translations "\\i:A. b" == "finsum \\ (%i. b) A" -- {* Beware of argument permutation! *} diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/Coset.thy --- a/src/HOL/Algebra/Coset.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/Coset.thy Fri Apr 23 21:46:04 2004 +0200 @@ -7,26 +7,26 @@ theory Coset = Group + Exponent: -declare (in group) l_inv [simp] r_inv [simp] +declare (in group) l_inv [simp] and r_inv [simp] constdefs (structure G) - r_coset :: "[_,'a set, 'a] => 'a set" - "r_coset G H a == (% x. x \ a) ` H" + r_coset :: "[_,'a set, 'a] => 'a set" + "r_coset G H a == (% x. x \ a) ` H" l_coset :: "[_, 'a, 'a set] => 'a set" - "l_coset G a H == (% x. a \ x) ` H" + "l_coset G a H == (% x. a \ x) ` H" rcosets :: "[_, 'a set] => ('a set)set" - "rcosets G H == r_coset G H ` (carrier G)" + "rcosets G H == r_coset G H ` (carrier G)" set_mult :: "[_, 'a set ,'a set] => 'a set" - "set_mult G H K == (%(x,y). x \ y) ` (H \ K)" + "set_mult G H K == (%(x,y). x \ y) ` (H \ K)" set_inv :: "[_,'a set] => 'a set" - "set_inv G H == m_inv G ` H" + "set_inv G H == m_inv G ` H" normal :: "['a set, _] => bool" (infixl "<|" 60) - "normal H G == subgroup H G & + "normal H G == subgroup H G & (\x \ carrier G. r_coset G H x = l_coset G x H)" syntax (xsymbols) @@ -56,13 +56,13 @@ apply (auto simp add: Pi_def) done -lemma card_bij: - "[|f \ A\B; inj_on f A; +lemma card_bij: + "[|f \ A\B; inj_on f A; g \ B\A; inj_on g B; finite A; finite B|] ==> card(A) = card(B)" -by (blast intro: card_inj order_antisym) +by (blast intro: card_inj order_antisym) -subsection{*Lemmas Using Locale Constants*} +subsection {*Lemmas Using *} lemma (in coset) r_coset_eq: "H #> a = {b . \h\H. h \ a = b}" by (auto simp add: rcos_def r_coset_def) @@ -77,7 +77,7 @@ by (simp add: setmult_def set_mult_def image_def) lemma (in coset) coset_mult_assoc: - "[| M <= carrier G; g \ carrier G; h \ carrier G |] + "[| M <= carrier G; g \ carrier G; h \ carrier G |] ==> (M #> g) #> h = M #> (g \ h)" by (force simp add: r_coset_eq m_assoc) @@ -85,14 +85,14 @@ by (force simp add: r_coset_eq) lemma (in coset) coset_mult_inv1: - "[| M #> (x \ (inv y)) = M; x \ carrier G ; y \ carrier G; + "[| M #> (x \ (inv y)) = M; x \ carrier G ; y \ carrier G; M <= carrier G |] ==> M #> x = M #> y" apply (erule subst [of concl: "%z. M #> x = z #> y"]) apply (simp add: coset_mult_assoc m_assoc) done lemma (in coset) coset_mult_inv2: - "[| M #> x = M #> y; x \ carrier G; y \ carrier G; M <= carrier G |] + "[| M #> x = M #> y; x \ carrier G; y \ carrier G; M <= carrier G |] ==> M #> (x \ (inv y)) = M " apply (simp add: coset_mult_assoc [symmetric]) apply (simp add: coset_mult_assoc) @@ -110,7 +110,7 @@ lemma (in coset) solve_equation: "\subgroup H G; x \ H; y \ H\ \ \h\H. h \ x = y" apply (rule bexI [of _ "y \ (inv x)"]) -apply (auto simp add: subgroup.m_closed subgroup.m_inv_closed m_assoc +apply (auto simp add: subgroup.m_closed subgroup.m_inv_closed m_assoc subgroup.subset [THEN subsetD]) done @@ -133,30 +133,30 @@ text{*Really needed?*} lemma (in coset) transpose_inv: - "[| x \ y = z; x \ carrier G; y \ carrier G; z \ carrier G |] + "[| x \ y = z; x \ carrier G; y \ carrier G; z \ carrier G |] ==> (inv x) \ z = y" by (force simp add: m_assoc [symmetric]) lemma (in coset) repr_independence: "[| y \ H #> x; x \ carrier G; subgroup H G |] ==> H #> x = H #> y" -by (auto simp add: r_coset_eq m_assoc [symmetric] +by (auto simp add: r_coset_eq m_assoc [symmetric] subgroup.subset [THEN subsetD] subgroup.m_closed solve_equation) lemma (in coset) rcos_self: "[| x \ carrier G; subgroup H G |] ==> x \ H #> x" apply (simp add: r_coset_eq) -apply (blast intro: l_one subgroup.subset [THEN subsetD] +apply (blast intro: l_one subgroup.subset [THEN subsetD] subgroup.one_closed) done -subsection{*normal subgroups*} +subsection {* Normal subgroups *} (*???????????????? text "Allows use of theorems proved in the locale coset" lemma subgroup_imp_coset: "subgroup H G ==> coset G" apply (drule subgroup_imp_group) -apply (simp add: group_def coset_def) +apply (simp add: group_def coset_def) done *) @@ -180,7 +180,7 @@ lemma (in coset) normal_inv_op_closed1: "\H \ G; x \ carrier G; h \ H\ \ (inv x) \ h \ x \ H" apply (auto simp add: l_coset_eq r_coset_eq normal_iff) -apply (drule bspec, assumption) +apply (drule bspec, assumption) apply (drule equalityD1 [THEN subsetD], blast, clarify) apply (simp add: m_assoc subgroup.subset [THEN subsetD]) apply (erule subst) @@ -189,12 +189,12 @@ lemma (in coset) normal_inv_op_closed2: "\H \ G; x \ carrier G; h \ H\ \ x \ h \ (inv x) \ H" -apply (drule normal_inv_op_closed1 [of H "(inv x)"]) +apply (drule normal_inv_op_closed1 [of H "(inv x)"]) apply auto done lemma (in coset) lcos_m_assoc: - "[| M <= carrier G; g \ carrier G; h \ carrier G |] + "[| M <= carrier G; g \ carrier G; h \ carrier G |] ==> g <# (h <# M) = (g \ h) <# M" by (force simp add: l_coset_eq m_assoc) @@ -208,8 +208,8 @@ lemma (in coset) l_coset_swap: "[| y \ x <# H; x \ carrier G; subgroup H G |] ==> x \ y <# H" proof (simp add: l_coset_eq) - assume "\h\H. x \ h = y" - and x: "x \ carrier G" + assume "\h\H. x \ h = y" + and x: "x \ carrier G" and sb: "subgroup H G" then obtain h' where h': "h' \ H & x \ h' = y" by blast show "\h\H. y \ h = x" @@ -223,28 +223,28 @@ lemma (in coset) l_coset_carrier: "[| y \ x <# H; x \ carrier G; subgroup H G |] ==> y \ carrier G" -by (auto simp add: l_coset_eq m_assoc +by (auto simp add: l_coset_eq m_assoc subgroup.subset [THEN subsetD] subgroup.m_closed) lemma (in coset) l_repr_imp_subset: - assumes y: "y \ x <# H" and x: "x \ carrier G" and sb: "subgroup H G" + assumes y: "y \ x <# H" and x: "x \ carrier G" and sb: "subgroup H G" shows "y <# H \ x <# H" proof - from y obtain h' where "h' \ H" "x \ h' = y" by (auto simp add: l_coset_eq) thus ?thesis using x sb - by (auto simp add: l_coset_eq m_assoc + by (auto simp add: l_coset_eq m_assoc subgroup.subset [THEN subsetD] subgroup.m_closed) qed lemma (in coset) l_repr_independence: - assumes y: "y \ x <# H" and x: "x \ carrier G" and sb: "subgroup H G" + assumes y: "y \ x <# H" and x: "x \ carrier G" and sb: "subgroup H G" shows "x <# H = y <# H" -proof +proof show "x <# H \ y <# H" - by (rule l_repr_imp_subset, + by (rule l_repr_imp_subset, (blast intro: l_coset_swap l_coset_carrier y x sb)+) - show "y <# H \ x <# H" by (rule l_repr_imp_subset [OF y x sb]) + show "y <# H \ x <# H" by (rule l_repr_imp_subset [OF y x sb]) qed lemma (in coset) setmult_subset_G: @@ -255,29 +255,30 @@ apply (auto simp add: subgroup.m_closed set_mult_eq Sigma_def image_def) apply (rule_tac x = x in bexI) apply (rule bexI [of _ "\"]) -apply (auto simp add: subgroup.m_closed subgroup.one_closed +apply (auto simp add: subgroup.m_closed subgroup.one_closed r_one subgroup.subset [THEN subsetD]) done -(* set of inverses of an r_coset *) +text {* Set of inverses of an @{text r_coset}. *} + lemma (in coset) rcos_inv: assumes normalHG: "H <| G" and xinG: "x \ carrier G" shows "set_inv G (H #> x) = H #> (inv x)" proof - - have H_subset: "H <= carrier G" + have H_subset: "H <= carrier G" by (rule subgroup.subset [OF normal_imp_subgroup, OF normalHG]) show ?thesis proof (auto simp add: r_coset_eq image_def set_inv_def) fix h assume "h \ H" hence "((inv x) \ (inv h) \ x) \ inv x = inv (h \ x)" - by (simp add: xinG m_assoc inv_mult_group H_subset [THEN subsetD]) - thus "\j\H. j \ inv x = inv (h \ x)" + by (simp add: xinG m_assoc inv_mult_group H_subset [THEN subsetD]) + thus "\j\H. j \ inv x = inv (h \ x)" using prems - by (blast intro: normal_inv_op_closed1 normal_imp_subgroup - subgroup.m_inv_closed) + by (blast intro: normal_inv_op_closed1 normal_imp_subgroup + subgroup.m_inv_closed) next fix h assume "h \ H" @@ -285,9 +286,9 @@ by (simp add: xinG m_assoc H_subset [THEN subsetD]) hence "(\j\H. j \ x = inv (h \ (inv x))) \ h \ inv x = inv (inv (h \ (inv x)))" using prems - by (simp add: m_assoc inv_mult_group H_subset [THEN subsetD], - blast intro: eq normal_inv_op_closed2 normal_imp_subgroup - subgroup.m_inv_closed) + by (simp add: m_assoc inv_mult_group H_subset [THEN subsetD], + blast intro: eq normal_inv_op_closed2 normal_imp_subgroup + subgroup.m_inv_closed) thus "\y. (\h\H. h \ x = y) \ h \ inv x = inv y" .. qed qed @@ -314,7 +315,7 @@ apply (simp add: setrcos_eq, clarify) apply (subgoal_tac "x : carrier G") prefer 2 - apply (blast dest: r_coset_subset_G subgroup.subset normal_imp_subgroup) + apply (blast dest: r_coset_subset_G subgroup.subset normal_imp_subgroup) apply (drule repr_independence) apply assumption apply (erule normal_imp_subgroup) @@ -322,56 +323,57 @@ done -(* some rules for <#> with #> or <# *) +text {* Some rules for @{text "<#>"} with @{text "#>"} or @{text "<#"}. *} + lemma (in coset) setmult_rcos_assoc: - "[| H <= carrier G; K <= carrier G; x \ carrier G |] + "[| H <= carrier G; K <= carrier G; x \ carrier G |] ==> H <#> (K #> x) = (H <#> K) #> x" apply (auto simp add: rcos_def r_coset_def setmult_def set_mult_def) apply (force simp add: m_assoc)+ done lemma (in coset) rcos_assoc_lcos: - "[| H <= carrier G; K <= carrier G; x \ carrier G |] + "[| H <= carrier G; K <= carrier G; x \ carrier G |] ==> (H #> x) <#> K = H <#> (x <# K)" -apply (auto simp add: rcos_def r_coset_def lcos_def l_coset_def +apply (auto simp add: rcos_def r_coset_def lcos_def l_coset_def setmult_def set_mult_def Sigma_def image_def) apply (force intro!: exI bexI simp add: m_assoc)+ done lemma (in coset) rcos_mult_step1: - "[| H <| G; x \ carrier G; y \ carrier G |] + "[| H <| G; x \ carrier G; y \ carrier G |] ==> (H #> x) <#> (H #> y) = (H <#> (x <# H)) #> y" by (simp add: setmult_rcos_assoc normal_imp_subgroup [THEN subgroup.subset] r_coset_subset_G l_coset_subset_G rcos_assoc_lcos) lemma (in coset) rcos_mult_step2: - "[| H <| G; x \ carrier G; y \ carrier G |] + "[| H <| G; x \ carrier G; y \ carrier G |] ==> (H <#> (x <# H)) #> y = (H <#> (H #> x)) #> y" by (simp add: normal_imp_rcos_eq_lcos) lemma (in coset) rcos_mult_step3: - "[| H <| G; x \ carrier G; y \ carrier G |] + "[| H <| G; x \ carrier G; y \ carrier G |] ==> (H <#> (H #> x)) #> y = H #> (x \ y)" by (simp add: setmult_rcos_assoc r_coset_subset_G coset_mult_assoc setmult_subset_G subgroup_mult_id subgroup.subset normal_imp_subgroup) lemma (in coset) rcos_sum: - "[| H <| G; x \ carrier G; y \ carrier G |] + "[| H <| G; x \ carrier G; y \ carrier G |] ==> (H #> x) <#> (H #> y) = H #> (x \ y)" by (simp add: rcos_mult_step1 rcos_mult_step2 rcos_mult_step3) -(*generalizes subgroup_mult_id*) lemma (in coset) setrcos_mult_eq: "[|H <| G; M \ rcosets G H|] ==> H <#> M = M" -by (auto simp add: setrcos_eq normal_imp_subgroup subgroup.subset - setmult_rcos_assoc subgroup_mult_id) + -- {* generalizes @{text subgroup_mult_id} *} + by (auto simp add: setrcos_eq normal_imp_subgroup subgroup.subset + setmult_rcos_assoc subgroup_mult_id) -subsection{*Lemmas Leading to Lagrange's Theorem*} +subsection {*Lemmas Leading to Lagrange's Theorem *} -lemma (in coset) setrcos_part_G: "subgroup H G ==> \ rcosets G H = carrier G" +lemma (in coset) setrcos_part_G: "subgroup H G ==> \rcosets G H = carrier G" apply (rule equalityI) -apply (force simp add: subgroup.subset [THEN subsetD] +apply (force simp add: subgroup.subset [THEN subsetD] setrcos_eq r_coset_eq) apply (auto simp add: setrcos_eq subgroup.subset rcos_self) done @@ -398,13 +400,13 @@ by (force simp add: inj_on_def subsetD) lemma (in coset) card_cosets_equal: - "[| c \ rcosets G H; H <= carrier G; finite(carrier G) |] + "[| c \ rcosets G H; H <= carrier G; finite(carrier G) |] ==> card c = card H" apply (auto simp add: setrcos_eq) apply (rule card_bij_eq) - apply (rule inj_on_f, assumption+) + apply (rule inj_on_f, assumption+) apply (force simp add: m_assoc subsetD r_coset_eq) - apply (rule inj_on_g, assumption+) + apply (rule inj_on_g, assumption+) apply (force simp add: m_assoc subsetD r_coset_eq) txt{*The sets @{term "H #> a"} and @{term "H"} are finite.*} apply (simp add: r_coset_subset_G [THEN finite_subset]) @@ -414,8 +416,8 @@ subsection{*Two distinct right cosets are disjoint*} lemma (in coset) rcos_equation: - "[|subgroup H G; a \ carrier G; b \ carrier G; ha \ a = h \ b; - h \ H; ha \ H; hb \ H|] + "[|subgroup H G; a \ carrier G; b \ carrier G; ha \ a = h \ b; + h \ H; ha \ H; hb \ H|] ==> \h\H. h \ b = hb \ a" apply (rule bexI [of _"hb \ ((inv ha) \ h)"]) apply (simp add: m_assoc transpose_inv subgroup.subset [THEN subsetD]) @@ -439,16 +441,16 @@ constdefs FactGroup :: "[('a,'b) monoid_scheme, 'a set] => ('a set) monoid" (infixl "Mod" 60) - "FactGroup G H == - (| carrier = rcosets G H, - mult = (%X: rcosets G H. %Y: rcosets G H. set_mult G X Y), - one = H (*, - m_inv = (%X: rcosets G H. set_inv G X) *) |)" + "FactGroup G H == + (| carrier = rcosets G H, + mult = (%X: rcosets G H. %Y: rcosets G H. set_mult G X Y), + one = H (*, + m_inv = (%X: rcosets G H. set_inv G X) *) |)" lemma (in coset) setmult_closed: - "[| H <| G; K1 \ rcosets G H; K2 \ rcosets G H |] + "[| H <| G; K1 \ rcosets G H; K2 \ rcosets G H |] ==> K1 <#> K2 \ rcosets G H" -by (auto simp add: normal_imp_subgroup [THEN subgroup.subset] +by (auto simp add: normal_imp_subgroup [THEN subgroup.subset] rcos_sum setrcos_eq) lemma (in group) setinv_closed: @@ -467,9 +469,9 @@ *) lemma (in coset) setrcos_assoc: - "[|H <| G; M1 \ rcosets G H; M2 \ rcosets G H; M3 \ rcosets G H|] + "[|H <| G; M1 \ rcosets G H; M2 \ rcosets G H; M3 \ rcosets G H|] ==> M1 <#> M2 <#> M3 = M1 <#> (M2 <#> M3)" -by (auto simp add: setrcos_eq rcos_sum normal_imp_subgroup +by (auto simp add: setrcos_eq rcos_sum normal_imp_subgroup subgroup.subset m_assoc) lemma (in group) subgroup_in_rcosets: @@ -486,10 +488,10 @@ (* lemma subgroup_in_rcosets: "subgroup H G ==> H \ rcosets G H" -apply (frule subgroup_imp_coset) -apply (frule subgroup_imp_group) +apply (frule subgroup_imp_coset) +apply (frule subgroup_imp_group) apply (simp add: coset.setrcos_eq) -apply (blast del: equalityI +apply (blast del: equalityI intro!: group.subgroup.one_closed group.one_closed coset.coset_join2 [symmetric]) done @@ -497,7 +499,7 @@ lemma (in coset) setrcos_inv_mult_group_eq: "[|H <| G; M \ rcosets G H|] ==> set_inv G M <#> M = H" -by (auto simp add: setrcos_eq rcos_inv rcos_sum normal_imp_subgroup +by (auto simp add: setrcos_eq rcos_inv rcos_sum normal_imp_subgroup subgroup.subset) (* lemma (in group) factorgroup_is_magma: @@ -511,8 +513,8 @@ *) theorem (in group) factorgroup_is_group: "H <| G ==> group (G Mod H)" -apply (insert is_coset) -apply (simp add: FactGroup_def) +apply (insert is_coset) +apply (simp add: FactGroup_def) apply (rule groupI) apply (simp add: coset.setmult_closed) apply (simp add: normal_imp_subgroup subgroup_in_rcosets) diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/FiniteProduct.thy --- a/src/HOL/Algebra/FiniteProduct.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/FiniteProduct.thy Fri Apr 23 21:46:04 2004 +0200 @@ -290,13 +290,13 @@ syntax "_finprod" :: "index => idt => 'a set => 'b => 'b" - ("\__:_. _" [1000, 0, 51, 10] 10) + ("(3\__:_. _)" [1000, 0, 51, 10] 10) syntax (xsymbols) "_finprod" :: "index => idt => 'a set => 'b => 'b" - ("\__\_. _" [1000, 0, 51, 10] 10) + ("(3\__\_. _)" [1000, 0, 51, 10] 10) syntax (HTML output) "_finprod" :: "index => idt => 'a set => 'b => 'b" - ("\__\_. _" [1000, 0, 51, 10] 10) + ("(3\__\_. _)" [1000, 0, 51, 10] 10) translations "\\i:A. b" == "finprod \\ (%i. b) A" -- {* Beware of argument permutation! *} diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/Lattice.thy --- a/src/HOL/Algebra/Lattice.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/Lattice.thy Fri Apr 23 21:46:04 2004 +0200 @@ -186,6 +186,7 @@ shows "[| greatest L i (Lower L A); x \ A; A \ carrier L |] ==> i \ x" by (unfold greatest_def) blast + subsubsection {* Supremum *} lemma (in lattice) joinI: @@ -212,7 +213,8 @@ shows "x \ carrier L ==> \ {x} = x" by (unfold sup_def) (blast intro: least_unique least_UpperI sup_of_singletonI) -text {* Condition on A: supremum exists. *} + +text {* Condition on @{text A}: supremum exists. *} lemma (in lattice) sup_insertI: "[| !!s. least L s (Upper L (insert x A)) ==> P s; diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/Sylow.thy --- a/src/HOL/Algebra/Sylow.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/Sylow.thy Fri Apr 23 21:46:04 2004 +0200 @@ -4,7 +4,7 @@ See Florian Kamm\"uller and L. C. Paulson, A Formal Proof of Sylow's theorem: - An Experiment in Abstract Algebra with Isabelle HOL + An Experiment in Abstract Algebra with Isabelle HOL J. Automated Reasoning 23 (1999), 235-264 *) @@ -15,11 +15,11 @@ subsection {*Order of a Group and Lagrange's Theorem*} constdefs - order :: "('a,'b) semigroup_scheme => nat" + order :: "('a, 'b) semigroup_scheme => nat" "order S == card (carrier S)" theorem (in coset) lagrange: - "[| finite(carrier G); subgroup H G |] + "[| finite(carrier G); subgroup H G |] ==> card(rcosets G H) * card(H) = order(G)" apply (simp (no_asm_simp) add: order_def setrcos_part_G [symmetric]) apply (subst mult_commute) @@ -40,11 +40,11 @@ and finite_G [iff]: "finite (carrier G)" defines "calM == {s. s <= carrier(G) & card(s) = p^a}" and "RelM == {(N1,N2). N1 \ calM & N2 \ calM & - (\g \ carrier(G). N1 = (N2 #> g) )}" + (\g \ carrier(G). N1 = (N2 #> g) )}" lemma (in sylow) RelM_refl: "refl calM RelM" -apply (auto simp add: refl_def RelM_def calM_def) -apply (blast intro!: coset_mult_one [symmetric]) +apply (auto simp add: refl_def RelM_def calM_def) +apply (blast intro!: coset_mult_one [symmetric]) done lemma (in sylow) RelM_sym: "sym RelM" @@ -58,7 +58,7 @@ qed lemma (in sylow) RelM_trans: "trans RelM" -by (auto simp add: trans_def RelM_def calM_def coset_mult_assoc) +by (auto simp add: trans_def RelM_def calM_def coset_mult_assoc) lemma (in sylow) RelM_equiv: "equiv calM RelM" apply (unfold equiv_def) @@ -91,9 +91,9 @@ lemma card_nonempty: "0 < card(S) ==> S \ {}" by force -lemma (in sylow_central) exists_x_in_M1: "\x. x\M1" -apply (subgoal_tac "0 < card M1") - apply (blast dest: card_nonempty) +lemma (in sylow_central) exists_x_in_M1: "\x. x\M1" +apply (subgoal_tac "0 < card M1") + apply (blast dest: card_nonempty) apply (cut_tac prime_p [THEN prime_imp_one_less]) apply (simp (no_asm_simp) add: card_M1) done @@ -112,18 +112,18 @@ show ?thesis proof show "inj_on (\z\H. m1 \ z) H" - by (simp add: inj_on_def l_cancel [of m1 x y, THEN iffD1] H_def m1G) + by (simp add: inj_on_def l_cancel [of m1 x y, THEN iffD1] H_def m1G) show "restrict (op \ m1) H \ H \ M1" proof (rule restrictI) - fix z assume zH: "z \ H" - show "m1 \ z \ M1" - proof - - from zH - have zG: "z \ carrier G" and M1zeq: "M1 #> z = M1" - by (auto simp add: H_def) - show ?thesis - by (rule subst [OF M1zeq], simp add: m1M zG rcosI) - qed + fix z assume zH: "z \ H" + show "m1 \ z \ M1" + proof - + from zH + have zG: "z \ carrier G" and M1zeq: "M1 #> z = M1" + by (auto simp add: H_def) + show ?thesis + by (rule subst [OF M1zeq], simp add: m1M zG rcosI) + qed qed qed qed @@ -135,8 +135,8 @@ by (blast elim!: quotientE dest: RelM_equiv [THEN equiv_class_self]) lemma (in sylow) existsM1inM: "M \ calM // RelM ==> \M1. M1 \ M" -apply (subgoal_tac "M \ {}") - apply blast +apply (subgoal_tac "M \ {}") + apply blast apply (cut_tac EmptyNotInEquivSet, blast) done @@ -245,7 +245,7 @@ text{*Injections between @{term M} and @{term "rcosets G H"} show that their cardinalities are equal.*} -lemma ElemClassEquiv: +lemma ElemClassEquiv: "[| equiv A r; C\A // r |] ==> \x \ C. \y \ C. (x,y)\r" apply (unfold equiv_def quotient_def sym_def trans_def, blast) done @@ -257,11 +257,11 @@ apply (blast dest!: bspec) done -lemmas (in sylow_central) M_elem_map_carrier = - M_elem_map [THEN someI_ex, THEN conjunct1] +lemmas (in sylow_central) M_elem_map_carrier = + M_elem_map [THEN someI_ex, THEN conjunct1] lemmas (in sylow_central) M_elem_map_eq = - M_elem_map [THEN someI_ex, THEN conjunct2] + M_elem_map [THEN someI_ex, THEN conjunct2] lemma (in sylow_central) M_funcset_setrcos_H: "(%x:M. H #> (SOME g. g \ carrier G & M1 #> g = x)) \ M \ rcosets G H" @@ -293,14 +293,14 @@ "H1\rcosets G H ==> \g. g \ carrier G & H #> g = H1" by (auto simp add: setrcos_eq) -lemmas (in sylow_central) H_elem_map_carrier = - H_elem_map [THEN someI_ex, THEN conjunct1] +lemmas (in sylow_central) H_elem_map_carrier = + H_elem_map [THEN someI_ex, THEN conjunct1] lemmas (in sylow_central) H_elem_map_eq = - H_elem_map [THEN someI_ex, THEN conjunct2] + H_elem_map [THEN someI_ex, THEN conjunct2] -lemma EquivElemClass: +lemma EquivElemClass: "[|equiv A r; M\A // r; M1\M; (M1, M2)\r |] ==> M2\M" apply (unfold equiv_def quotient_def sym_def trans_def, blast) done @@ -329,7 +329,7 @@ apply (rule_tac [2] H_is_subgroup [THEN subgroup.subset]) apply (rule coset_join2) apply (blast intro: m_closed inv_closed H_elem_map_carrier) -apply (rule H_is_subgroup) +apply (rule H_is_subgroup) apply (simp add: H_I coset_mult_inv2 M1_subset_G H_elem_map_carrier) done @@ -344,9 +344,9 @@ done lemma (in sylow_central) cardMeqIndexH: "card(M) = card(rcosets G H)" -apply (insert inj_M_GmodH inj_GmodH_M) -apply (blast intro: card_bij finite_M H_is_subgroup - setrcos_subset_PowG [THEN finite_subset] +apply (insert inj_M_GmodH inj_GmodH_M) +apply (blast intro: card_bij finite_M H_is_subgroup + setrcos_subset_PowG [THEN finite_subset] finite_Pow_iff [THEN iffD2]) done @@ -364,7 +364,7 @@ lemma (in sylow_central) lemma_leq2: "card(H) <= p^a" apply (subst card_M1 [symmetric]) apply (cut_tac M1_inj_H) -apply (blast intro!: M1_subset_G intro: +apply (blast intro!: M1_subset_G intro: card_inj H_into_carrier_G finite_subset [OF _ finite_G]) done @@ -372,15 +372,15 @@ by (blast intro: le_anti_sym lemma_leq1 lemma_leq2) lemma (in sylow) sylow_thm: "\H. subgroup H G & card(H) = p^a" -apply (cut_tac lemma_A1, clarify) -apply (frule existsM1inM, clarify) +apply (cut_tac lemma_A1, clarify) +apply (frule existsM1inM, clarify) apply (subgoal_tac "sylow_central G p a m M1 M") apply (blast dest: sylow_central.H_is_subgroup sylow_central.card_H_eq) -apply (simp add: sylow_central_def sylow_central_axioms_def prems) +apply (simp add: sylow_central_def sylow_central_axioms_def prems) done text{*Needed because the locale's automatic definition refers to - @{term "semigroup G"} and @{term "group_axioms G"} rather than + @{term "semigroup G"} and @{term "group_axioms G"} rather than simply to @{term "group G"}.*} lemma sylow_eq: "sylow G p a m = (group G & sylow_axioms G p a m)" by (simp add: sylow_def group_def) @@ -389,7 +389,7 @@ "[|p \ prime; group(G); order(G) = (p^a) * m; finite (carrier G)|] ==> \H. subgroup H G & card(H) = p^a" apply (rule sylow.sylow_thm [of G p a m]) -apply (simp add: sylow_eq sylow_axioms_def) +apply (simp add: sylow_eq sylow_axioms_def) done end diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/UnivPoly.thy --- a/src/HOL/Algebra/UnivPoly.thy Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/UnivPoly.thy Fri Apr 23 21:46:04 2004 +0200 @@ -10,43 +10,32 @@ theory UnivPoly = Module: text {* - Polynomials are formalised as modules with additional operations for - extracting coefficients from polynomials and for obtaining monomials - from coefficients and exponents (record @{text "up_ring"}). - The carrier set is - a set of bounded functions from Nat to the coefficient domain. - Bounded means that these functions return zero above a certain bound - (the degree). There is a chapter on the formalisation of polynomials - in my PhD thesis (http://www4.in.tum.de/\~{}ballarin/publications/), - which was implemented with axiomatic type classes. This was later - ported to Locales. + Polynomials are formalised as modules with additional operations for + extracting coefficients from polynomials and for obtaining monomials + from coefficients and exponents (record @{text "up_ring"}). The + carrier set is a set of bounded functions from Nat to the + coefficient domain. Bounded means that these functions return zero + above a certain bound (the degree). There is a chapter on the + formalisation of polynomials in my PhD thesis + (\url{http://www4.in.tum.de/~ballarin/publications/}), which was + implemented with axiomatic type classes. This was later ported to + Locales. *} + subsection {* The Constructor for Univariate Polynomials *} -(* Could alternatively use locale ... -locale bound = cring + var bound + - defines ... -*) - -constdefs - bound :: "['a, nat, nat => 'a] => bool" - "bound z n f == (ALL i. n < i --> f i = z)" +locale bound = + fixes z :: 'a + and n :: nat + and f :: "nat => 'a" + assumes bound: "!!m. n < m \ f m = z" -lemma boundI [intro!]: - "[| !! m. n < m ==> f m = z |] ==> bound z n f" - by (unfold bound_def) fast - -lemma boundE [elim?]: - "[| bound z n f; (!! m. n < m ==> f m = z) ==> P |] ==> P" - by (unfold bound_def) fast - -lemma boundD [dest]: - "[| bound z n f; n < m |] ==> f m = z" - by (unfold bound_def) fast +declare bound.intro [intro!] + and bound.bound [dest] lemma bound_below: - assumes bound: "bound z m f" and nonzero: "f n ~= z" shows "n <= m" + assumes bound: "bound z m f" and nonzero: "f n \ z" shows "n \ m" proof (rule classical) assume "~ ?thesis" then have "m < n" by arith @@ -130,45 +119,45 @@ lemma (in cring) up_mult_closed: "[| p \ up R; q \ up R |] ==> - (%n. finsum R (%i. p i \ q (n-i)) {..n}) \ up R" + (%n. \i \ {..n}. p i \ q (n-i)) \ up R" proof fix n assume "p \ up R" "q \ up R" - then show "finsum R (%i. p i \ q (n-i)) {..n} \ carrier R" + then show "(\i \ {..n}. p i \ q (n-i)) \ carrier R" by (simp add: mem_upD funcsetI) next assume UP: "p \ up R" "q \ up R" - show "EX n. bound \ n (%n. finsum R (%i. p i \ q (n - i)) {..n})" + show "EX n. bound \ n (%n. \i \ {..n}. p i \ q (n-i))" proof - from UP obtain n where boundn: "bound \ n p" by fast from UP obtain m where boundm: "bound \ m q" by fast - have "bound \ (n + m) (%n. finsum R (%i. p i \ q (n - i)) {..n})" + have "bound \ (n + m) (%n. \i \ {..n}. p i \ q (n - i))" proof - fix k - assume bound: "n + m < k" + fix k assume bound: "n + m < k" { - fix i - have "p i \ q (k-i) = \" - proof (cases "n < i") - case True - with boundn have "p i = \" by auto + fix i + have "p i \ q (k-i) = \" + proof (cases "n < i") + case True + with boundn have "p i = \" by auto moreover from UP have "q (k-i) \ carrier R" by auto - ultimately show ?thesis by simp - next - case False - with bound have "m < k-i" by arith - with boundm have "q (k-i) = \" by auto - moreover from UP have "p i \ carrier R" by auto - ultimately show ?thesis by simp - qed + ultimately show ?thesis by simp + next + case False + with bound have "m < k-i" by arith + with boundm have "q (k-i) = \" by auto + moreover from UP have "p i \ carrier R" by auto + ultimately show ?thesis by simp + qed } - then show "finsum R (%i. p i \ q (k-i)) {..k} = \" - by (simp add: Pi_def) + then show "(\i \ {..k}. p i \ q (k-i)) = \" + by (simp add: Pi_def) qed then show ?thesis by fast qed qed + subsection {* Effect of operations on coefficients *} locale UP = struct R + struct P + @@ -214,7 +203,7 @@ lemma (in UP_cring) coeff_mult [simp]: "[| p \ carrier P; q \ carrier P |] ==> - coeff P (p \\<^sub>2 q) n = finsum R (%i. coeff P p i \ coeff P q (n-i)) {..n}" + coeff P (p \\<^sub>2 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: @@ -225,10 +214,10 @@ fix x from prem and R show "p x = q x" by (simp add: UP_def) qed - + subsection {* Polynomials form a commutative ring. *} -text {* Operations are closed over @{term "P"}. *} +text {* Operations are closed over @{term P}. *} lemma (in UP_cring) UP_mult_closed [simp]: "[| p \ carrier P; q \ carrier P |] ==> p \\<^sub>2 q \ carrier P" @@ -307,9 +296,9 @@ assume R: "a \ UNIV -> carrier R" "b \ UNIV -> carrier R" "c \ UNIV -> carrier R" then have "k <= n ==> - finsum R (%j. finsum R (%i. a i \ b (j-i)) {..j} \ c (n-j)) {..k} = - finsum R (%j. a j \ finsum R (%i. b i \ c (n-j-i)) {..k-j}) {..k}" - (is "_ ==> ?eq k") + (\j \ {..k}. (\i \ {..j}. a i \ b (j-i)) \ c (n-j)) = + (\j \ {..k}. a j \ (\i \ {..k-j}. b i \ c (n-j-i)))" + (concl is "?eq k") proof (induct k) case 0 then show ?case by (simp add: Pi_def m_assoc) next @@ -317,7 +306,7 @@ then have "k <= n" by arith then have "?eq k" by (rule Suc) with R show ?case - by (simp cong: finsum_cong + 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) qed @@ -353,19 +342,19 @@ assumes R: "p \ carrier P" "q \ carrier P" shows "p \\<^sub>2 q = q \\<^sub>2 p" proof (rule up_eqI) - fix n + fix n { fix k and a b :: "nat=>'a" assume R: "a \ UNIV -> carrier R" "b \ UNIV -> carrier R" - then have "k <= n ==> - finsum R (%i. a i \ b (n-i)) {..k} = - finsum R (%i. a (k-i) \ b (i+n-k)) {..k}" - (is "_ ==> ?eq k") + then have "k <= n ==> + (\i \ {..k}. a i \ b (n-i)) = + (\i \ {..k}. a (k-i) \ b (i+n-k))" + (concl is "?eq k") proof (induct k) case 0 then show ?case by (simp add: Pi_def) next case (Suc k) then show ?case - by (subst finsum_Suc2) (simp add: Pi_def a_comm)+ + by (subst finsum_Suc2) (simp add: Pi_def a_comm)+ qed } note l = this @@ -557,6 +546,7 @@ lemmas (in UP_cring) UP_finsum_rdistr = cring.finsum_rdistr [OF UP_cring] + subsection {* Polynomials form an Algebra *} lemma (in UP_cring) UP_smult_l_distr: @@ -658,64 +648,64 @@ proof (cases "k = Suc n") case True show ?thesis proof - - from True have less_add_diff: - "!!i. [| n < i; i <= n + m |] ==> n + m - i < m" by arith + from True have less_add_diff: + "!!i. [| n < i; i <= n + m |] ==> n + m - i < m" by arith from True have "coeff P (monom P \ (Suc n)) k = \" by simp also from True - have "... = finsum R (%i. coeff P (monom P \ n) i \ - coeff P (monom P \ 1) (k - i)) ({..n(} Un {n})" - by (simp cong: finsum_cong add: finsum_Un_disjoint Pi_def) - also have "... = finsum R (%i. coeff P (monom P \ n) i \ - coeff P (monom P \ 1) (k - i)) {..n}" - by (simp only: ivl_disj_un_singleton) - also from True have "... = finsum R (%i. coeff P (monom P \ n) i \ - coeff P (monom P \ 1) (k - i)) ({..n} Un {)n..k})" - by (simp cong: finsum_cong add: finsum_Un_disjoint ivl_disj_int_one - order_less_imp_not_eq Pi_def) + have "... = (\i \ {..n(} \ {n}. coeff P (monom P \ n) i \ + coeff P (monom P \ 1) (k - i))" + by (simp cong: finsum_cong add: finsum_Un_disjoint Pi_def) + also have "... = (\i \ {..n}. coeff P (monom P \ n) i \ + coeff P (monom P \ 1) (k - i))" + by (simp only: ivl_disj_un_singleton) + also from True have "... = (\i \ {..n} \ {)n..k}. coeff P (monom P \ n) i \ + coeff P (monom P \ 1) (k - i))" + by (simp cong: finsum_cong add: finsum_Un_disjoint ivl_disj_int_one + order_less_imp_not_eq Pi_def) also from True have "... = coeff P (monom P \ n \\<^sub>2 monom P \ 1) k" - by (simp add: ivl_disj_un_one) + by (simp add: ivl_disj_un_one) finally show ?thesis . qed next case False note neq = False let ?s = - "(\i. (if n = i then \ else \) \ (if Suc 0 = k - i then \ else \))" + "\i. (if n = i then \ else \) \ (if Suc 0 = k - i then \ else \)" from neq have "coeff P (monom P \ (Suc n)) k = \" by simp - also have "... = finsum R ?s {..k}" + also have "... = (\i \ {..k}. ?s i)" proof - - have f1: "finsum R ?s {..n(} = \" by (simp cong: finsum_cong add: Pi_def) - from neq have f2: "finsum R ?s {n} = \" - by (simp cong: finsum_cong add: Pi_def) arith - have f3: "n < k ==> finsum R ?s {)n..k} = \" - by (simp cong: finsum_cong add: order_less_imp_not_eq Pi_def) + have f1: "(\i \ {..n(}. ?s i) = \" by (simp cong: finsum_cong add: Pi_def) + from neq have f2: "(\i \ {n}. ?s i) = \" + by (simp cong: finsum_cong add: Pi_def) arith + have f3: "n < k ==> (\i \ {)n..k}. ?s i) = \" + by (simp cong: finsum_cong add: order_less_imp_not_eq Pi_def) show ?thesis proof (cases "k < n") - case True then show ?thesis by (simp cong: finsum_cong add: Pi_def) + case True then show ?thesis by (simp cong: finsum_cong add: Pi_def) next - case False then have n_le_k: "n <= k" by arith - show ?thesis - proof (cases "n = k") - case True - then have "\ = finsum R ?s ({..n(} \ {n})" - by (simp cong: finsum_cong add: finsum_Un_disjoint - ivl_disj_int_singleton Pi_def) - also from True have "... = finsum R ?s {..k}" - by (simp only: ivl_disj_un_singleton) - finally show ?thesis . - next - case False with n_le_k have n_less_k: "n < k" by arith - with neq have "\ = finsum R ?s ({..n(} \ {n})" - by (simp add: finsum_Un_disjoint f1 f2 - ivl_disj_int_singleton Pi_def del: Un_insert_right) - also have "... = finsum R ?s {..n}" - by (simp only: ivl_disj_un_singleton) - also from n_less_k neq have "... = finsum R ?s ({..n} \ {)n..k})" - by (simp add: finsum_Un_disjoint f3 ivl_disj_int_one Pi_def) - also from n_less_k have "... = finsum R ?s {..k}" - by (simp only: ivl_disj_un_one) - finally show ?thesis . - qed + case False then have n_le_k: "n <= k" by arith + show ?thesis + proof (cases "n = k") + case True + then have "\ = (\i \ {..n(} \ {n}. ?s i)" + by (simp cong: finsum_cong add: finsum_Un_disjoint + ivl_disj_int_singleton Pi_def) + also from True have "... = (\i \ {..k}. ?s i)" + by (simp only: ivl_disj_un_singleton) + finally show ?thesis . + next + case False with n_le_k have n_less_k: "n < k" by arith + with neq have "\ = (\i \ {..n(} \ {n}. ?s i)" + by (simp add: finsum_Un_disjoint f1 f2 + ivl_disj_int_singleton Pi_def del: Un_insert_right) + also have "... = (\i \ {..n}. ?s i)" + by (simp only: ivl_disj_un_singleton) + also from n_less_k neq have "... = (\i \ {..n} \ {)n..k}. ?s i)" + by (simp add: finsum_Un_disjoint f3 ivl_disj_int_one Pi_def) + also from n_less_k have "... = (\i \ {..k}. ?s i)" + by (simp only: ivl_disj_un_one) + finally show ?thesis . + qed qed qed also have "... = coeff P (monom P \ n \\<^sub>2 monom P \ 1) k" by simp @@ -789,7 +779,7 @@ "deg R p == LEAST n. bound \ n (coeff (UP R) p)" lemma (in UP_cring) deg_aboveI: - "[| (!!m. n < m ==> coeff P p m = \); p \ carrier P |] ==> deg R p <= n" + "[| (!!m. n < m ==> coeff P p m = \); p \ carrier P |] ==> deg R p <= n" by (unfold deg_def P_def) (fast intro: Least_le) (* lemma coeff_bound_ex: "EX n. bound n (coeff p)" @@ -798,7 +788,7 @@ then obtain n where "bound n (coeff p)" by (unfold UP_def) fast then show ?thesis .. qed - + lemma bound_coeff_obtain: assumes prem: "(!!n. bound n (coeff p) ==> P)" shows "P" proof - @@ -811,18 +801,18 @@ "[| deg R p < m; p \ carrier P |] ==> coeff P p m = \" proof - assume R: "p \ carrier P" and "deg R p < m" - from R obtain n where "bound \ n (coeff P p)" + from R obtain n where "bound \ n (coeff P p)" by (auto simp add: UP_def P_def) then have "bound \ (deg R p) (coeff P p)" by (auto simp: deg_def P_def dest: LeastI) - then show ?thesis by (rule boundD) + then show ?thesis .. qed lemma (in UP_cring) deg_belowI: assumes non_zero: "n ~= 0 ==> coeff P p n ~= \" and R: "p \ carrier P" shows "n <= deg R p" --- {* Logically, this is a slightly stronger version of +-- {* Logically, this is a slightly stronger version of @{thm [source] deg_aboveD} *} proof (cases "n=0") case True then show ?thesis by simp @@ -847,7 +837,7 @@ then have "EX m. deg R p - 1 < m & coeff P p m ~= \" by (unfold bound_def) fast then have "EX m. deg R p <= m & coeff P p m ~= \" by (simp add: deg minus) - then show ?thesis by auto + then show ?thesis by auto qed with deg_belowI R have "deg R p = m" by fastsimp with m_coeff show ?thesis by simp @@ -890,7 +880,7 @@ shows "deg R (p \\<^sub>2 q) <= max (deg R p) (deg R q)" proof (cases "deg R p <= deg R q") case True show ?thesis - by (rule deg_aboveI) (simp_all add: True R deg_aboveD) + by (rule deg_aboveI) (simp_all add: True R deg_aboveD) next case False show ?thesis by (rule deg_aboveI) (simp_all add: False R deg_aboveD) @@ -933,7 +923,7 @@ proof (rule le_anti_sym) show "deg R (\\<^sub>2 p) <= deg R p" by (simp add: deg_aboveI deg_aboveD R) next - show "deg R p <= deg R (\\<^sub>2 p)" + show "deg R p <= deg R (\\<^sub>2 p)" by (simp add: deg_belowI lcoeff_nonzero_deg inj_on_iff [OF a_inv_inj, of _ "\", simplified] R) qed @@ -999,10 +989,10 @@ deg_aboveD less_add_diff R Pi_def) also have "...= finsum R ?s ({deg R p} Un {)deg R p .. deg R p + deg R q})" by (simp only: ivl_disj_un_singleton) - also have "... = coeff P p (deg R p) \ coeff P q (deg R q)" + also have "... = coeff P p (deg R p) \ coeff P q (deg R q)" by (simp cong: finsum_cong add: finsum_Un_disjoint - ivl_disj_int_singleton deg_aboveD R Pi_def) - finally have "finsum R ?s {.. deg R p + deg R q} + ivl_disj_int_singleton deg_aboveD R Pi_def) + finally have "finsum R ?s {.. deg R p + deg R q} = coeff P p (deg R p) \ coeff P q (deg R q)" . with nz show "finsum R ?s {.. deg R p + deg R q} ~= \" by (simp add: integral_iff lcoeff_nonzero R) @@ -1021,7 +1011,7 @@ lemma (in UP_cring) up_repr: assumes R: "p \ carrier P" - shows "finsum P (%i. monom P (coeff P p i) i) {..deg R p} = p" + shows "(\\<^sub>2 i \ {..deg R p}. monom P (coeff P p i) i) = p" proof (rule up_eqI) let ?s = "(%i. monom P (coeff P p i) i)" fix k @@ -1030,23 +1020,23 @@ show "coeff P (finsum P ?s {..deg R p}) k = coeff P p k" proof (cases "k <= deg R p") case True - hence "coeff P (finsum P ?s {..deg R p}) k = + hence "coeff P (finsum P ?s {..deg R p}) k = coeff P (finsum P ?s ({..k} Un {)k..deg R p})) k" by (simp only: ivl_disj_un_one) also from True have "... = coeff P (finsum P ?s {..k}) k" by (simp cong: finsum_cong add: finsum_Un_disjoint - ivl_disj_int_one order_less_imp_not_eq2 coeff_finsum R RR Pi_def) + ivl_disj_int_one order_less_imp_not_eq2 coeff_finsum R RR Pi_def) also have "... = coeff P (finsum P ?s ({..k(} Un {k})) k" by (simp only: ivl_disj_un_singleton) also have "... = coeff P p k" by (simp cong: finsum_cong add: setsum_Un_disjoint - ivl_disj_int_singleton coeff_finsum deg_aboveD R RR Pi_def) + ivl_disj_int_singleton coeff_finsum deg_aboveD R RR Pi_def) finally show ?thesis . next case False - hence "coeff P (finsum P ?s {..deg R p}) k = + hence "coeff P (finsum P ?s {..deg R p}) k = coeff P (finsum P ?s ({..deg R p(} Un {deg R p})) k" by (simp only: ivl_disj_un_singleton) also from False have "... = coeff P p k" @@ -1107,11 +1097,11 @@ also from pq have "... = 0" by simp finally have "deg R p + deg R q = 0" . then have f1: "deg R p = 0 & deg R q = 0" by simp - from f1 R have "p = finsum P (%i. (monom P (coeff P p i) i)) {..0}" + from f1 R have "p = (\\<^sub>2 i \ {..0}. monom P (coeff P p i) i)" by (simp only: up_repr_le) also from R have "... = monom P (coeff P p 0) 0" by simp finally have p: "p = monom P (coeff P p 0) 0" . - from f1 R have "q = finsum P (%i. (monom P (coeff P q i) i)) {..0}" + from f1 R have "q = (\\<^sub>2 i \ {..0}. monom P (coeff P q i) i)" by (simp only: up_repr_le) also from R have "... = monom P (coeff P q 0) 0" by simp finally have q: "q = monom P (coeff P q 0) 0" . @@ -1149,49 +1139,49 @@ by (simp add: monom_mult_is_smult [THEN sym] UP_integral_iff inj_on_iff [OF monom_inj, of _ "\", simplified]) + subsection {* Evaluation Homomorphism and Universal Property*} +(* alternative congruence rule (possibly more efficient) +lemma (in abelian_monoid) finsum_cong2: + "[| !!i. i \ A ==> f i \ carrier G = True; A = B; + !!i. i \ B ==> f i = g i |] ==> finsum G f A = finsum G g B" + sorry*) + ML_setup {* simpset_ref() := simpset() setsubgoaler asm_full_simp_tac; *} -(* alternative congruence rule (possibly more efficient) -lemma (in abelian_monoid) finsum_cong2: - "[| !!i. i \ A ==> f i \ carrier G = True; A = B; - !!i. i \ B ==> f i = g i |] ==> finsum G f A = finsum G g B" - sorry -*) - theorem (in cring) diagonal_sum: "[| f \ {..n + m::nat} -> carrier R; g \ {..n + m} -> carrier R |] ==> - finsum R (%k. finsum R (%i. f i \ g (k - i)) {..k}) {..n + m} = - finsum R (%k. finsum R (%i. f k \ g i) {..n + m - k}) {..n + m}" + (\k \ {..n + m}. \i \ {..k}. f i \ g (k - i)) = + (\k \ {..n + m}. \i \ {..n + m - k}. f k \ g i)" proof - assume Rf: "f \ {..n + m} -> carrier R" and Rg: "g \ {..n + m} -> carrier R" { fix j have "j <= n + m ==> - finsum R (%k. finsum R (%i. f i \ g (k - i)) {..k}) {..j} = - finsum R (%k. finsum R (%i. f k \ g i) {..j - k}) {..j}" + (\k \ {..j}. \i \ {..k}. f i \ g (k - i)) = + (\k \ {..j}. \i \ {..j - k}. f k \ g i)" proof (induct j) case 0 from Rf Rg show ?case by (simp add: Pi_def) next - case (Suc j) + case (Suc j) (* The following could be simplified if there was a reasoner for - total orders integrated with simip. *) + total orders integrated with simip. *) have R6: "!!i k. [| k <= j; i <= Suc j - k |] ==> g i \ carrier R" - using Suc by (auto intro!: funcset_mem [OF Rg]) arith + using Suc by (auto intro!: funcset_mem [OF Rg]) arith have R8: "!!i k. [| k <= Suc j; i <= k |] ==> g (k - i) \ carrier R" - using Suc by (auto intro!: funcset_mem [OF Rg]) arith + using Suc by (auto intro!: funcset_mem [OF Rg]) arith have R9: "!!i k. [| k <= Suc j |] ==> f k \ carrier R" - using Suc by (auto intro!: funcset_mem [OF Rf]) + using Suc by (auto intro!: funcset_mem [OF Rf]) have R10: "!!i k. [| k <= Suc j; i <= Suc j - k |] ==> g i \ carrier R" - using Suc by (auto intro!: funcset_mem [OF Rg]) arith + using Suc by (auto intro!: funcset_mem [OF Rg]) arith have R11: "g 0 \ carrier R" - using Suc by (auto intro!: funcset_mem [OF Rg]) + using Suc by (auto intro!: funcset_mem [OF Rg]) from Suc show ?case - by (simp cong: finsum_cong add: Suc_diff_le a_ac - Pi_def R6 R8 R9 R10 R11) + by (simp cong: finsum_cong add: Suc_diff_le a_ac + Pi_def R6 R8 R9 R10 R11) qed } then show ?thesis by fast @@ -1204,9 +1194,8 @@ theorem (in cring) 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 "finsum R (%k. finsum R (%i. f i \ g (k-i)) {..k}) {..n + m} = - finsum R f {..n} \ finsum R g {..m}" -(* State revese direction? *) + shows "(\k \ {..n + m}. \i \ {..k}. f i \ g (k - i)) = + (\i \ {..n}. f i) \ (\i \ {..m}. g i)" (* State revese direction? *) proof - have f: "!!x. f x \ carrier R" proof - @@ -1220,24 +1209,20 @@ show "g x \ carrier R" using Rg bg boundD_carrier by (cases "x <= m") (auto simp: Pi_def) qed - from f g have "finsum R (%k. finsum R (%i. f i \ g (k-i)) {..k}) {..n + m} = - finsum R (%k. finsum R (%i. f k \ g i) {..n + m - k}) {..n + m}" + from f g have "(\k \ {..n + m}. \i \ {..k}. f i \ g (k - i)) = + (\k \ {..n + m}. \i \ {..n + m - k}. f k \ g i)" by (simp add: diagonal_sum Pi_def) - also have "... = finsum R - (%k. finsum R (%i. f k \ g i) {..n + m - k}) ({..n} Un {)n..n + m})" + also have "... = (\k \ {..n} \ {)n..n + m}. \i \ {..n + m - k}. f k \ g i)" by (simp only: ivl_disj_un_one) - also from f g have "... = finsum R - (%k. finsum R (%i. f k \ g i) {..n + m - k}) {..n}" + also from f g have "... = (\k \ {..n}. \i \ {..n + m - k}. f k \ g i)" by (simp cong: finsum_cong - add: boundD [OF bf] finsum_Un_disjoint ivl_disj_int_one Pi_def) - also from f g have "... = finsum R - (%k. finsum R (%i. f k \ g i) ({..m} Un {)m..n + m - k})) {..n}" + add: bound.bound [OF bf] finsum_Un_disjoint ivl_disj_int_one Pi_def) + also from f g have "... = (\k \ {..n}. \i \ {..m} \ {)m..n + m - k}. f k \ g i)" by (simp cong: finsum_cong add: ivl_disj_un_one le_add_diff Pi_def) - also from f g have "... = finsum R - (%k. finsum R (%i. f k \ g i) {..m}) {..n}" + also from f g have "... = (\k \ {..n}. \i \ {..m}. f k \ g i)" by (simp cong: finsum_cong - add: boundD [OF bg] finsum_Un_disjoint ivl_disj_int_one Pi_def) - also from f g have "... = finsum R f {..n} \ finsum R g {..m}" + add: bound.bound [OF bg] finsum_Un_disjoint ivl_disj_int_one Pi_def) + also from f g have "... = (\i \ {..n}. f i) \ (\i \ {..m}. g i)" by (simp add: finsum_ldistr diagonal_sum Pi_def, simp cong: finsum_cong add: finsum_rdistr Pi_def) finally show ?thesis . @@ -1256,13 +1241,13 @@ then finsum S (%i. mult S (phi (coeff (UP R) p i)) (pow S s i)) {..deg R p} else arbitrary" *) - + locale ring_hom_UP_cring = ring_hom_cring R S + UP_cring R lemma (in ring_hom_UP_cring) eval_on_carrier: "p \ carrier P ==> eval R S phi s p = - finsum S (%i. mult S (phi (coeff P p i)) (pow S s i)) {..deg R p}" + (\\<^sub>2 i \ {..deg R p}. phi (coeff P p i) \\<^sub>2 pow S s i)" by (unfold eval_def, fold P_def) simp lemma (in ring_hom_UP_cring) eval_extensional: @@ -1282,31 +1267,29 @@ then show "eval R S h s (p \\<^sub>3 q) = eval R S h s p \\<^sub>2 eval R S h s q" proof (simp only: eval_on_carrier UP_mult_closed) from RS have - "finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R (p \\<^sub>3 q)} = - finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) - ({..deg R (p \\<^sub>3 q)} Un {)deg R (p \\<^sub>3 q)..deg R p + deg R q})" + "(\\<^sub>2 i \ {..deg R (p \\<^sub>3 q)}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) = + (\\<^sub>2 i \ {..deg R (p \\<^sub>3 q)} \ {)deg R (p \\<^sub>3 q)..deg R p + deg R q}. + h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp cong: finsum_cong - add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def - del: coeff_mult) + add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def + del: coeff_mult) also from RS have "... = - finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R p + deg R q}" + (\\<^sub>2 i \ {..deg R p + deg R q}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp only: ivl_disj_un_one deg_mult_cring) also from RS have "... = - finsum S (%i. - finsum S (%k. - (h (coeff P p k) \\<^sub>2 h (coeff P q (i-k))) \\<^sub>2 (s (^)\<^sub>2 k \\<^sub>2 s (^)\<^sub>2 (i-k))) - {..i}) {..deg R p + deg R q}" + (\\<^sub>2 i \ {..deg R p + deg R q}. + \\<^sub>2 k \ {..i}. h (coeff P p k) \\<^sub>2 h (coeff P q (i - k)) \\<^sub>2 (s (^)\<^sub>2 k \\<^sub>2 s (^)\<^sub>2 (i - k)))" by (simp cong: finsum_cong add: nat_pow_mult Pi_def - S.m_ac S.finsum_rdistr) + S.m_ac S.finsum_rdistr) also from RS have "... = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R p} \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R q}" - by (simp add: S.cauchy_product [THEN sym] boundI deg_aboveD S.m_ac - Pi_def) + (\\<^sub>2i\{..deg R p}. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2i\{..deg R q}. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" + by (simp add: S.cauchy_product [THEN sym] bound.intro deg_aboveD S.m_ac + Pi_def) finally show - "finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R (p \\<^sub>3 q)} = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R p} \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R q}" . + "(\\<^sub>2 i \ {..deg R (p \\<^sub>3 q)}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) = + (\\<^sub>2 i \ {..deg R p}. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2 i \ {..deg R q}. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" . qed next fix p q @@ -1314,36 +1297,35 @@ then show "eval R S h s (p \\<^sub>3 q) = eval R S h s p \\<^sub>2 eval R S h s q" proof (simp only: eval_on_carrier UP_a_closed) from RS have - "finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R (p \\<^sub>3 q)} = - finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) - ({..deg R (p \\<^sub>3 q)} Un {)deg R (p \\<^sub>3 q)..max (deg R p) (deg R q)})" + "(\\<^sub>2i \ {..deg R (p \\<^sub>3 q)}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) = + (\\<^sub>2i \ {..deg R (p \\<^sub>3 q)} \ {)deg R (p \\<^sub>3 q)..max (deg R p) (deg R q)}. + h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp cong: finsum_cong - add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def - del: coeff_add) + add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def + del: coeff_add) also from RS have "... = - finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) - {..max (deg R p) (deg R q)}" + (\\<^sub>2 i \ {..max (deg R p) (deg R q)}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp add: ivl_disj_un_one) also from RS have "... = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) {..max (deg R p) (deg R q)} \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) {..max (deg R p) (deg R q)}" + (\\<^sub>2i\{..max (deg R p) (deg R q)}. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2i\{..max (deg R p) (deg R q)}. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp cong: finsum_cong - add: l_distr deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def) + add: l_distr deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def) also have "... = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) - ({..deg R p} Un {)deg R p..max (deg R p) (deg R q)}) \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) - ({..deg R q} Un {)deg R q..max (deg R p) (deg R q)})" + (\\<^sub>2 i \ {..deg R p} \ {)deg R p..max (deg R p) (deg R q)}. + h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2 i \ {..deg R q} \ {)deg R q..max (deg R p) (deg R q)}. + h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp only: ivl_disj_un_one le_maxI1 le_maxI2) also from RS have "... = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R p} \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R q}" + (\\<^sub>2 i \ {..deg R p}. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2 i \ {..deg R q}. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp cong: finsum_cong - add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def) + add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def) finally show - "finsum S (%i. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R (p \\<^sub>3 q)} = - finsum S (%i. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R p} \\<^sub>2 - finsum S (%i. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i) {..deg R q}" + "(\\<^sub>2i \ {..deg R (p \\<^sub>3 q)}. h (coeff P (p \\<^sub>3 q) i) \\<^sub>2 s (^)\<^sub>2 i) = + (\\<^sub>2i \ {..deg R p}. h (coeff P p i) \\<^sub>2 s (^)\<^sub>2 i) \\<^sub>2 + (\\<^sub>2i \ {..deg R q}. h (coeff P q i) \\<^sub>2 s (^)\<^sub>2 i)" . qed next @@ -1414,14 +1396,14 @@ "s \ carrier S ==> eval R S h s (monom P \ 1) = s" proof (simp only: eval_on_carrier monom_closed R.one_closed) assume S: "s \ carrier S" - then have "finsum S (\i. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) - {..deg R (monom P \ 1)} = - finsum S (\i. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) - ({..deg R (monom P \ 1)} Un {)deg R (monom P \ 1)..1})" + then have + "(\\<^sub>2 i \ {..deg R (monom P \ 1)}. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) = + (\\<^sub>2i\{..deg R (monom P \ 1)} \ {)deg R (monom P \ 1)..1}. + h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp cong: finsum_cong del: coeff_monom add: deg_aboveD finsum_Un_disjoint ivl_disj_int_one Pi_def) - also have "... = - finsum S (\i. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) {..1}" + also have "... = + (\\<^sub>2 i \ {..1}. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i)" by (simp only: ivl_disj_un_one deg_monom_le R.one_closed) also have "... = s" proof (cases "s = \\<^sub>2") @@ -1429,8 +1411,8 @@ next case False with S show ?thesis by (simp add: Pi_def) qed - finally show "finsum S (\i. h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) - {..deg R (monom P \ 1)} = s" . + finally show "(\\<^sub>2 i \ {..deg R (monom P \ 1)}. + h (coeff P (monom P \ 1) i) \\<^sub>2 s (^)\<^sub>2 i) = s" . qed lemma (in UP_cring) monom_pow: @@ -1491,15 +1473,13 @@ by (auto intro: ring_hom_cringI UP_cring S.cring Phi) have Psi_hom: "ring_hom_cring P S Psi" by (auto intro: ring_hom_cringI UP_cring S.cring Psi) - have "Phi p = Phi (finsum P - (%i. monom P (coeff P p i) 0 \\<^sub>3 (monom P \ 1) (^)\<^sub>3 i) {..deg R p})" + have "Phi p = Phi (\\<^sub>3i \ {..deg R p}. monom P (coeff P p i) 0 \\<^sub>3 monom P \ 1 (^)\<^sub>3 i)" by (simp add: up_repr RS monom_mult [THEN sym] monom_pow del: monom_mult) - also have "... = Psi (finsum P - (%i. monom P (coeff P p i) 0 \\<^sub>3 (monom P \ 1) (^)\<^sub>3 i) {..deg R p})" - by (simp add: ring_hom_cring.hom_finsum [OF Phi_hom] + also have "... = Psi (\\<^sub>3i\{..deg R p}. monom P (coeff P p i) 0 \\<^sub>3 monom P \ 1 (^)\<^sub>3 i)" + by (simp add: ring_hom_cring.hom_finsum [OF Phi_hom] ring_hom_cring.hom_mult [OF Phi_hom] ring_hom_cring.hom_pow [OF Phi_hom] Phi - ring_hom_cring.hom_finsum [OF Psi_hom] + ring_hom_cring.hom_finsum [OF Psi_hom] ring_hom_cring.hom_mult [OF Psi_hom] ring_hom_cring.hom_pow [OF Psi_hom] Psi RS Pi_def comp_def) also have "... = Psi p" @@ -1511,13 +1491,13 @@ theorem (in ring_hom_UP_cring) UP_universal_property: "s \ carrier S ==> EX! Phi. Phi \ ring_hom P S \ extensional (carrier P) & - Phi (monom P \ 1) = s & + Phi (monom P \ 1) = s & (ALL r : carrier R. Phi (monom P r 0) = h r)" - using eval_monom1 + using eval_monom1 apply (auto intro: eval_ring_hom eval_const eval_extensional) - apply (rule extensionalityI) - apply (auto intro: UP_hom_unique) - done + apply (rule extensionalityI) + apply (auto intro: UP_hom_unique) + done subsection {* Sample application of evaluation homomorphism *} @@ -1545,7 +1525,8 @@ text {* An instantiation mechanism would now import all theorems and lemmas valid in the context of homomorphisms between @{term INTEG} and @{term - "UP INTEG"}. *} + "UP INTEG"}. +*} lemma INTEG_closed [intro, simp]: "z \ carrier INTEG" @@ -1562,6 +1543,4 @@ lemma "eval INTEG INTEG id 10 (monom (UP INTEG) 5 2) = 500" by (simp add: ring_hom_UP_cring.eval_monom [OF INTEG_id]) --- {* Calculates @{term "x = 500"} *} - end diff -r d2e5df3d1201 -r 65f8680c3f16 src/HOL/Algebra/document/root.tex --- a/src/HOL/Algebra/document/root.tex Fri Apr 23 20:52:04 2004 +0200 +++ b/src/HOL/Algebra/document/root.tex Fri Apr 23 21:46:04 2004 +0200 @@ -2,6 +2,17 @@ \documentclass[11pt,a4paper]{article} \usepackage{graphicx} \usepackage{isabelle,isabellesym} +\usepackage{amssymb} +\usepackage[latin1]{inputenc} +\usepackage[only,bigsqcap]{stmaryrd} +%\usepackage{masmath} + +% this should be the last package used +\usepackage{pdfsetup} + +% proper setup for best-style documents +\urlstyle{rm} +\isabellestyle{it} %\usepackage{substr} @@ -10,33 +21,6 @@ % \chapter{\BehindSubString{Chapter: }{#1}}}{% % \section{#1}}} -% further packages required for unusual symbols (see also isabellesym.sty) - -%\usepackage{latexsym} % for \, \, \, - % \, \, \ - % and \ and others! -\usepackage{amssymb} % for \, \, - % \, \, - % \, \, \ -%\usepackage[english]{babel} % for \ \ -\usepackage[latin1]{inputenc} % for \, \, - % \, \, - % \, \ - % \ -\usepackage[only,bigsqcap]{stmaryrd} % for \ -%\usepackage{wasysym} -%\usepackage{eufrak} % for \ ... \, \ ... \ -%\usepackage{textcomp} % for \ ... \, \ - % \ -%\usepackage{marvosym} % for \ - -% this should be the last package used -\usepackage{pdfsetup} - -% proper setup for best-style documents -\urlstyle{rm} -\isabellestyle{it} - \begin{document} @@ -53,10 +37,6 @@ \parindent 0pt\parskip 0.5ex -% include generated text of all theories \input{session} -%\bibliographystyle{abbrv} -%\bibliography{root} - \end{document}