# HG changeset patch # User ballarin # Date 1216133409 -7200 # Node ID 2c01c0bdb385303fca5891f3e31933e4cd5b4d0c # Parent 8882d47e075fa1dd5d22404cb9bea5b2e2f6ac36 Removed uses of context element includes. diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/AbelCoset.thy --- a/src/HOL/Algebra/AbelCoset.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/AbelCoset.thy Tue Jul 15 16:50:09 2008 +0200 @@ -60,7 +60,7 @@ a_r_coset_def r_coset_def lemma a_r_coset_def': - includes struct G + fixes G (structure) shows "H +> a \ \h\H. {h \ a}" unfolding a_r_coset_defs by simp @@ -69,7 +69,7 @@ a_l_coset_def l_coset_def lemma a_l_coset_def': - includes struct G + fixes G (structure) shows "a <+ H \ \h\H. {a \ h}" unfolding a_l_coset_defs by simp @@ -78,7 +78,7 @@ A_RCOSETS_def RCOSETS_def lemma A_RCOSETS_def': - includes struct G + fixes G (structure) shows "a_rcosets H \ \a\carrier G. {H +> a}" unfolding A_RCOSETS_defs by (fold a_r_coset_def, simp) @@ -87,7 +87,7 @@ set_add_def set_mult_def lemma set_add_def': - includes struct G + fixes G (structure) shows "H <+> K \ \h\H. \k\K. {h \ k}" unfolding set_add_defs by simp @@ -96,7 +96,7 @@ A_SET_INV_def SET_INV_def lemma A_SET_INV_def': - includes struct G + fixes G (structure) shows "a_set_inv H \ \h\H. {\ h}" unfolding A_SET_INV_defs by (fold a_inv_def) @@ -188,7 +188,7 @@ by (rule additive_subgroup_axioms) lemma additive_subgroupI: - includes struct G + fixes G (structure) assumes a_subgroup: "subgroup H \carrier = carrier G, mult = add G, one = zero G\" shows "additive_subgroup H G" by (rule additive_subgroup.intro) (rule a_subgroup) @@ -240,7 +240,7 @@ qed lemma abelian_subgroupI2: - includes struct G + fixes G (structure) assumes a_comm_group: "comm_group \carrier = carrier G, mult = add G, one = zero G\" and a_subgroup: "subgroup H \carrier = carrier G, mult = add G, one = zero G\" shows "abelian_subgroup H G" @@ -265,7 +265,7 @@ qed lemma abelian_subgroupI3: - includes struct G + fixes G (structure) assumes asg: "additive_subgroup H G" and ag: "abelian_group G" shows "abelian_subgroup H G" @@ -451,7 +451,7 @@ lemmas A_FactGroup_defs = A_FactGroup_def FactGroup_def lemma A_FactGroup_def': - includes struct G + fixes G (structure) shows "G A_Mod H \ \carrier = a_rcosets\<^bsub>G\<^esub> H, mult = set_add G, one = H\" unfolding A_FactGroup_defs by (fold A_RCOSETS_def set_add_def) @@ -534,16 +534,20 @@ subsection {* Homomorphisms *} lemma abelian_group_homI: - includes abelian_group G - includes abelian_group H + assumes "abelian_group G" + assumes "abelian_group H" assumes a_group_hom: "group_hom (| carrier = carrier G, mult = add G, one = zero G |) (| carrier = carrier H, mult = add H, one = zero H |) h" shows "abelian_group_hom G H h" -apply (intro abelian_group_hom.intro abelian_group_hom_axioms.intro) - apply (rule G.abelian_group_axioms) - apply (rule H.abelian_group_axioms) -apply (rule a_group_hom) -done +proof - + interpret G: abelian_group [G] by fact + interpret H: abelian_group [H] by fact + show ?thesis apply (intro abelian_group_hom.intro abelian_group_hom_axioms.intro) + apply fact + apply fact + apply (rule a_group_hom) + done +qed lemma (in abelian_group_hom) is_abelian_group_hom: "abelian_group_hom G H h" @@ -688,10 +692,11 @@ --"variant" lemma (in abelian_subgroup) a_rcos_module_minus: - includes ring G + assumes "ring G" assumes carr: "x \ carrier G" "x' \ carrier G" shows "(x' \ H +> x) = (x' \ x \ H)" proof - + interpret G: ring [G] by fact from carr have "(x' \ H +> x) = (x' \ \x \ H)" by (rule a_rcos_module) with carr diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/Coset.thy --- a/src/HOL/Algebra/Coset.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/Coset.thy Tue Jul 15 16:50:09 2008 +0200 @@ -109,23 +109,27 @@ text (in group) {* Opposite of @{thm [source] "repr_independence"} *} lemma (in group) repr_independenceD: - includes subgroup H G + assumes "subgroup H G" assumes ycarr: "y \ carrier G" and repr: "H #> x = H #> y" shows "y \ H #> x" - apply (subst repr) +proof - + interpret subgroup [H G] by fact + show ?thesis apply (subst repr) apply (intro rcos_self) apply (rule ycarr) apply (rule is_subgroup) done +qed text {* Elements of a right coset are in the carrier *} lemma (in subgroup) elemrcos_carrier: - includes group + assumes "group G" assumes acarr: "a \ carrier G" and a': "a' \ H #> a" shows "a' \ carrier G" proof - + interpret group [G] by fact from subset and acarr have "H #> a \ carrier G" by (rule r_coset_subset_G) from this and a' @@ -134,38 +138,42 @@ qed lemma (in subgroup) rcos_const: - includes group + assumes "group G" assumes hH: "h \ H" shows "H #> h = H" - apply (unfold r_coset_def) - apply rule - apply rule - apply clarsimp - apply (intro subgroup.m_closed) - apply (rule is_subgroup) +proof - + interpret group [G] by fact + show ?thesis apply (unfold r_coset_def) + apply rule + apply rule + apply clarsimp + apply (intro subgroup.m_closed) + apply (rule is_subgroup) apply assumption - apply (rule hH) - apply rule - apply simp -proof - - fix h' - assume h'H: "h' \ H" - note carr = hH[THEN mem_carrier] h'H[THEN mem_carrier] - from carr - have a: "h' = (h' \ inv h) \ h" by (simp add: m_assoc) - from h'H hH - have "h' \ inv h \ H" by simp - from this and a - show "\x\H. h' = x \ h" by fast + apply (rule hH) + apply rule + apply simp + proof - + fix h' + assume h'H: "h' \ H" + note carr = hH[THEN mem_carrier] h'H[THEN mem_carrier] + from carr + have a: "h' = (h' \ inv h) \ h" by (simp add: m_assoc) + from h'H hH + have "h' \ inv h \ H" by simp + from this and a + show "\x\H. h' = x \ h" by fast + qed qed text {* Step one for lemma @{text "rcos_module"} *} lemma (in subgroup) rcos_module_imp: - includes group + assumes "group G" assumes xcarr: "x \ carrier G" and x'cos: "x' \ H #> x" shows "(x' \ inv x) \ H" proof - + interpret group [G] by fact from xcarr x'cos have x'carr: "x' \ carrier G" by (rule elemrcos_carrier[OF is_group]) @@ -200,11 +208,12 @@ text {* Step two for lemma @{text "rcos_module"} *} lemma (in subgroup) rcos_module_rev: - includes group + assumes "group G" assumes carr: "x \ carrier G" "x' \ carrier G" and xixH: "(x' \ inv x) \ H" shows "x' \ H #> x" proof - + interpret group [G] by fact from xixH have "\h\H. x' \ (inv x) = h" by fast from this @@ -231,27 +240,30 @@ text {* Module property of right cosets *} lemma (in subgroup) rcos_module: - includes group + assumes "group G" assumes carr: "x \ carrier G" "x' \ carrier G" shows "(x' \ H #> x) = (x' \ inv x \ H)" -proof - assume "x' \ H #> x" - from this and carr - show "x' \ inv x \ H" +proof - + interpret group [G] by fact + show ?thesis proof assume "x' \ H #> x" + from this and carr + show "x' \ inv x \ H" by (intro rcos_module_imp[OF is_group]) -next - assume "x' \ inv x \ H" - from this and carr - show "x' \ H #> x" + next + assume "x' \ inv x \ H" + from this and carr + show "x' \ H #> x" by (intro rcos_module_rev[OF is_group]) + qed qed text {* Right cosets are subsets of the carrier. *} lemma (in subgroup) rcosets_carrier: - includes group + assumes "group G" assumes XH: "X \ rcosets H" shows "X \ carrier G" proof - + interpret group [G] by fact from XH have "\x\ carrier G. X = H #> x" unfolding RCOSETS_def by fast @@ -331,11 +343,12 @@ qed lemma (in subgroup) lcos_module_rev: - includes group + assumes "group G" assumes carr: "x \ carrier G" "x' \ carrier G" and xixH: "(inv x \ x') \ H" shows "x' \ x <# H" proof - + interpret group [G] by fact from xixH have "\h\H. (inv x) \ x' = h" by fast from this @@ -584,29 +597,33 @@ lemma (in subgroup) equiv_rcong: - includes group G + assumes "group G" shows "equiv (carrier G) (rcong H)" -proof (intro equiv.intro) - show "refl (carrier G) (rcong H)" - by (auto simp add: r_congruent_def refl_def) -next - show "sym (rcong H)" - proof (simp add: r_congruent_def sym_def, clarify) - fix x y - assume [simp]: "x \ carrier G" "y \ carrier G" - and "inv x \ y \ H" - hence "inv (inv x \ y) \ H" by (simp add: m_inv_closed) - thus "inv y \ x \ H" by (simp add: inv_mult_group) - qed -next - show "trans (rcong H)" - proof (simp add: r_congruent_def trans_def, clarify) - fix x y z - assume [simp]: "x \ carrier G" "y \ carrier G" "z \ carrier G" - and "inv x \ y \ H" and "inv y \ z \ H" - hence "(inv x \ y) \ (inv y \ z) \ H" by simp - hence "inv x \ (y \ inv y) \ z \ H" by (simp add: m_assoc del: r_inv) - thus "inv x \ z \ H" by simp +proof - + interpret group [G] by fact + show ?thesis + proof (intro equiv.intro) + show "refl (carrier G) (rcong H)" + by (auto simp add: r_congruent_def refl_def) + next + show "sym (rcong H)" + proof (simp add: r_congruent_def sym_def, clarify) + fix x y + assume [simp]: "x \ carrier G" "y \ carrier G" + and "inv x \ y \ H" + hence "inv (inv x \ y) \ H" by (simp add: m_inv_closed) + thus "inv y \ x \ H" by (simp add: inv_mult_group) + qed + next + show "trans (rcong H)" + proof (simp add: r_congruent_def trans_def, clarify) + fix x y z + assume [simp]: "x \ carrier G" "y \ carrier G" "z \ carrier G" + and "inv x \ y \ H" and "inv y \ z \ H" + hence "(inv x \ y) \ (inv y \ z) \ H" by simp + hence "inv x \ (y \ inv y) \ z \ H" by (simp add: m_assoc del: r_inv) + thus "inv x \ z \ H" by simp + qed qed qed @@ -625,31 +642,38 @@ *) lemma (in subgroup) l_coset_eq_rcong: - includes group G + assumes "group G" assumes a: "a \ carrier G" shows "a <# H = rcong H `` {a}" -by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) - +proof - + interpret group [G] by fact + show ?thesis by (force simp add: r_congruent_def l_coset_def m_assoc [symmetric] a ) +qed subsubsection{*Two Distinct Right Cosets are Disjoint*} lemma (in group) rcos_equation: - includes subgroup H G - shows - "\ha \ a = h \ b; a \ carrier G; b \ carrier G; - h \ H; ha \ H; hb \ H\ - \ hb \ a \ (\h\H. {h \ b})" -apply (rule UN_I [of "hb \ ((inv ha) \ h)"]) -apply (simp add: ) -apply (simp add: m_assoc transpose_inv) -done + assumes "subgroup H G" + assumes p: "ha \ a = h \ b" "a \ carrier G" "b \ carrier G" "h \ H" "ha \ H" "hb \ H" + shows "hb \ a \ (\h\H. {h \ b})" +proof - + interpret subgroup [H G] by fact + from p show ?thesis apply (rule_tac UN_I [of "hb \ ((inv ha) \ h)"]) + apply (simp add: ) + apply (simp add: m_assoc transpose_inv) + done +qed lemma (in group) rcos_disjoint: - includes subgroup H G - shows "\a \ rcosets H; b \ rcosets H; a\b\ \ a \ b = {}" -apply (simp add: RCOSETS_def r_coset_def) -apply (blast intro: rcos_equation prems sym) -done + assumes "subgroup H G" + assumes p: "a \ rcosets H" "b \ rcosets H" "a\b" + shows "a \ b = {}" +proof - + interpret subgroup [H G] by fact + from p show ?thesis apply (simp add: RCOSETS_def r_coset_def) + apply (blast intro: rcos_equation prems sym) + done +qed subsection {* Further lemmas for @{text "r_congruent"} *} @@ -732,12 +756,16 @@ "order S \ card (carrier S)" lemma (in group) rcosets_part_G: - includes subgroup + assumes "subgroup H G" shows "\(rcosets H) = carrier G" -apply (rule equalityI) - apply (force simp add: RCOSETS_def r_coset_def) -apply (auto simp add: RCOSETS_def intro: rcos_self prems) -done +proof - + interpret subgroup [H G] by fact + show ?thesis + apply (rule equalityI) + apply (force simp add: RCOSETS_def r_coset_def) + apply (auto simp add: RCOSETS_def intro: rcos_self prems) + done +qed lemma (in group) cosets_finite: "\c \ rcosets H; H \ carrier G; finite (carrier G)\ \ finite c" @@ -815,9 +843,10 @@ by (auto simp add: RCOSETS_def rcos_sum m_assoc) lemma (in subgroup) subgroup_in_rcosets: - includes group G + assumes "group G" shows "H \ rcosets H" proof - + interpret group [G] by fact from _ subgroup_axioms have "H #> \ = H" by (rule coset_join2) auto then show ?thesis diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/Group.thy --- a/src/HOL/Algebra/Group.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/Group.thy Tue Jul 15 16:50:09 2008 +0200 @@ -396,9 +396,13 @@ by (rule subgroup.subset) lemma (in subgroup) subgroup_is_group [intro]: - includes group G - shows "group (G\carrier := H\)" - by (rule groupI) (auto intro: m_assoc l_inv mem_carrier) + assumes "group G" + shows "group (G\carrier := H\)" +proof - + interpret group [G] by fact + show ?thesis + by (rule groupI) (auto intro: m_assoc l_inv mem_carrier) +qed text {* Since @{term H} is nonempty, it contains some element @{term x}. Since @@ -453,9 +457,11 @@ one = (\\<^bsub>G\<^esub>, \\<^bsub>H\<^esub>)\" lemma DirProd_monoid: - includes monoid G + monoid H + assumes "monoid G" and "monoid H" shows "monoid (G \\ H)" proof - + interpret G: monoid [G] by fact + interpret H: monoid [H] by fact from prems show ?thesis by (unfold monoid_def DirProd_def, auto) qed @@ -463,11 +469,15 @@ text{*Does not use the previous result because it's easier just to use auto.*} lemma DirProd_group: - includes group G + group H + assumes "group G" and "group H" shows "group (G \\ H)" - by (rule groupI) +proof - + interpret G: group [G] by fact + interpret H: group [H] by fact + show ?thesis by (rule groupI) (auto intro: G.m_assoc H.m_assoc G.l_inv H.l_inv simp add: DirProd_def) +qed lemma carrier_DirProd [simp]: "carrier (G \\ H) = carrier G \ carrier H" @@ -482,23 +492,29 @@ by (simp add: DirProd_def) lemma inv_DirProd [simp]: - includes group G + group H + assumes "group G" and "group H" assumes g: "g \ carrier G" and h: "h \ carrier H" shows "m_inv (G \\ H) (g, h) = (inv\<^bsub>G\<^esub> g, inv\<^bsub>H\<^esub> h)" - apply (rule group.inv_equality [OF DirProd_group]) +proof - + interpret G: group [G] by fact + interpret H: group [H] by fact + show ?thesis apply (rule group.inv_equality [OF DirProd_group]) apply (simp_all add: prems group.l_inv) done +qed text{*This alternative proof of the previous result demonstrates interpret. It uses @{text Prod.inv_equality} (available after @{text interpret}) instead of @{text "group.inv_equality [OF DirProd_group]"}. *} lemma - includes group G + group H + assumes "group G" and "group H" assumes g: "g \ carrier G" and h: "h \ carrier H" shows "m_inv (G \\ H) (g, h) = (inv\<^bsub>G\<^esub> g, inv\<^bsub>H\<^esub> h)" proof - + interpret G: group [G] by fact + interpret H: group [H] by fact interpret Prod: group ["G \\ H"] by (auto intro: DirProd_group group.intro group.axioms prems) show ?thesis by (simp add: Prod.inv_equality g h) diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/Ideal.thy --- a/src/HOL/Algebra/Ideal.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/Ideal.thy Tue Jul 15 16:50:09 2008 +0200 @@ -28,18 +28,21 @@ by (rule ideal_axioms) lemma idealI: - includes ring + fixes R (structure) + assumes "ring R" assumes a_subgroup: "subgroup I \carrier = carrier R, mult = add R, one = zero R\" and I_l_closed: "\a x. \a \ I; x \ carrier R\ \ x \ a \ I" and I_r_closed: "\a x. \a \ I; x \ carrier R\ \ a \ x \ I" shows "ideal I R" - apply (intro ideal.intro ideal_axioms.intro additive_subgroupI) +proof - + interpret ring [R] by fact + show ?thesis apply (intro ideal.intro ideal_axioms.intro additive_subgroupI) apply (rule a_subgroup) apply (rule is_ring) apply (erule (1) I_l_closed) apply (erule (1) I_r_closed) done - +qed subsection {* Ideals Generated by a Subset of @{term [locale=ring] "carrier R"} *} @@ -58,11 +61,14 @@ by (rule principalideal_axioms) lemma principalidealI: - includes ideal + fixes R (structure) + assumes "ideal I R" assumes generate: "\i \ carrier R. I = Idl {i}" shows "principalideal I R" - by (intro principalideal.intro principalideal_axioms.intro) (rule is_ideal, rule generate) - +proof - + interpret ideal [I R] by fact + show ?thesis by (intro principalideal.intro principalideal_axioms.intro) (rule is_ideal, rule generate) +qed subsection {* Maximal Ideals *} @@ -75,13 +81,16 @@ by (rule maximalideal_axioms) lemma maximalidealI: - includes ideal + fixes R + assumes "ideal I R" assumes I_notcarr: "carrier R \ I" and I_maximal: "\J. \ideal J R; I \ J; J \ carrier R\ \ J = I \ J = carrier R" shows "maximalideal I R" - by (intro maximalideal.intro maximalideal_axioms.intro) +proof - + interpret ideal [I R] by fact + show ?thesis by (intro maximalideal.intro maximalideal_axioms.intro) (rule is_ideal, rule I_notcarr, rule I_maximal) - +qed subsection {* Prime Ideals *} @@ -94,31 +103,40 @@ by (rule primeideal_axioms) lemma primeidealI: - includes ideal - includes cring + fixes R (structure) + assumes "ideal I R" + assumes "cring R" assumes I_notcarr: "carrier R \ I" and I_prime: "\a b. \a \ carrier R; b \ carrier R; a \ b \ I\ \ a \ I \ b \ I" shows "primeideal I R" - by (intro primeideal.intro primeideal_axioms.intro) +proof - + interpret ideal [I R] by fact + interpret cring [R] by fact + show ?thesis by (intro primeideal.intro primeideal_axioms.intro) (rule is_ideal, rule is_cring, rule I_notcarr, rule I_prime) +qed lemma primeidealI2: - includes additive_subgroup I R - includes cring + fixes R (structure) + assumes "additive_subgroup I R" + assumes "cring R" assumes I_l_closed: "\a x. \a \ I; x \ carrier R\ \ x \ a \ I" and I_r_closed: "\a x. \a \ I; x \ carrier R\ \ a \ x \ I" and I_notcarr: "carrier R \ I" and I_prime: "\a b. \a \ carrier R; b \ carrier R; a \ b \ I\ \ a \ I \ b \ I" shows "primeideal I R" -apply (intro_locales) - apply (intro ideal_axioms.intro) - apply (erule (1) I_l_closed) - apply (erule (1) I_r_closed) -apply (intro primeideal_axioms.intro) - apply (rule I_notcarr) -apply (erule (2) I_prime) -done - +proof - + interpret additive_subgroup [I R] by fact + interpret cring [R] by fact + show ?thesis apply (intro_locales) + apply (intro ideal_axioms.intro) + apply (erule (1) I_l_closed) + apply (erule (1) I_r_closed) + apply (intro primeideal_axioms.intro) + apply (rule I_notcarr) + apply (erule (2) I_prime) + done +qed section {* Properties of Ideals *} @@ -185,9 +203,13 @@ text {* \paragraph{Intersection of two ideals} The intersection of any two ideals is again an ideal in @{term R} *} lemma (in ring) i_intersect: - includes ideal I R - includes ideal J R + assumes "ideal I R" + assumes "ideal J R" shows "ideal (I \ J) R" +proof - + interpret ideal [I R] by fact + interpret ideal [J R] by fact + show ?thesis apply (intro idealI subgroup.intro) apply (rule is_ring) apply (force simp add: a_subset) @@ -199,7 +221,7 @@ apply (clarsimp, rule) apply (fast intro: ideal.I_r_closed ideal.intro prems)+ done - +qed subsubsection {* Intersection of a Set of Ideals *} @@ -511,15 +533,18 @@ text {* @{const "cgenideal"} is minimal *} lemma (in ring) cgenideal_minimal: - includes ideal J R + assumes "ideal J R" assumes aJ: "a \ J" shows "PIdl a \ J" -unfolding cgenideal_def -apply rule -apply clarify -using aJ -apply (erule I_l_closed) -done +proof - + interpret ideal [J R] by fact + show ?thesis unfolding cgenideal_def + apply rule + apply clarify + using aJ + apply (erule I_l_closed) + done +qed lemma (in cring) cgenideal_eq_genideal: assumes icarr: "i \ carrier R" @@ -636,9 +661,10 @@ text {* Every principal ideal is a right coset of the carrier *} lemma (in principalideal) rcos_generate: - includes cring + assumes "cring R" shows "\x\I. I = carrier R #> x" proof - + interpret cring [R] by fact from generate obtain i where icarr: "i \ carrier R" @@ -667,10 +693,11 @@ subsection {* Prime Ideals *} lemma (in ideal) primeidealCD: - includes cring + assumes "cring R" assumes notprime: "\ primeideal I R" shows "carrier R = I \ (\a b. a \ carrier R \ b \ carrier R \ a \ b \ I \ a \ I \ b \ I)" proof (rule ccontr, clarsimp) + interpret cring [R] by fact assume InR: "carrier R \ I" and "\a. a \ carrier R \ (\b. a \ b \ I \ b \ carrier R \ a \ I \ b \ I)" hence I_prime: "\ a b. \a \ carrier R; b \ carrier R; a \ b \ I\ \ a \ I \ b \ I" by simp @@ -685,11 +712,16 @@ qed lemma (in ideal) primeidealCE: - includes cring + assumes "cring R" assumes notprime: "\ primeideal I R" obtains "carrier R = I" | "\a b. a \ carrier R \ b \ carrier R \ a \ b \ I \ a \ I \ b \ I" - using primeidealCD [OF R.is_cring notprime] by blast +proof - + interpret R: cring [R] by fact + assume "carrier R = I ==> thesis" + and "\a b. a \ carrier R \ b \ carrier R \ a \ b \ I \ a \ I \ b \ I \ thesis" + then show thesis using primeidealCD [OF R.is_cring notprime] by blast +qed text {* If @{text "{\}"} is a prime ideal of a commutative ring, the ring is a domain *} lemma (in cring) zeroprimeideal_domainI: @@ -739,103 +771,108 @@ qed lemma (in ideal) helper_max_prime: - includes cring + assumes "cring R" assumes acarr: "a \ carrier R" shows "ideal {x\carrier R. a \ x \ I} R" -apply (rule idealI) - apply (rule cring.axioms[OF is_cring]) - apply (rule subgroup.intro) - apply (simp, fast) +proof - + interpret cring [R] by fact + show ?thesis apply (rule idealI) + apply (rule cring.axioms[OF is_cring]) + apply (rule subgroup.intro) + apply (simp, fast) apply clarsimp apply (simp add: r_distr acarr) - apply (simp add: acarr) - apply (simp add: a_inv_def[symmetric], clarify) defer 1 - apply clarsimp defer 1 - apply (fast intro!: helper_I_closed acarr) -proof - - fix x - assume xcarr: "x \ carrier R" - and ax: "a \ x \ I" - from ax and acarr xcarr - have "\(a \ x) \ I" by simp - also from acarr xcarr - have "\(a \ x) = a \ (\x)" by algebra - finally - show "a \ (\x) \ I" . - from acarr - have "a \ \ = \" by simp -next - fix x y - assume xcarr: "x \ carrier R" - and ycarr: "y \ carrier R" - and ayI: "a \ y \ I" - from ayI and acarr xcarr ycarr - have "a \ (y \ x) \ I" by (simp add: helper_I_closed) - moreover from xcarr ycarr - have "y \ x = x \ y" by (simp add: m_comm) - ultimately - show "a \ (x \ y) \ I" by simp + apply (simp add: acarr) + apply (simp add: a_inv_def[symmetric], clarify) defer 1 + apply clarsimp defer 1 + apply (fast intro!: helper_I_closed acarr) + proof - + fix x + assume xcarr: "x \ carrier R" + and ax: "a \ x \ I" + from ax and acarr xcarr + have "\(a \ x) \ I" by simp + also from acarr xcarr + have "\(a \ x) = a \ (\x)" by algebra + finally + show "a \ (\x) \ I" . + from acarr + have "a \ \ = \" by simp + next + fix x y + assume xcarr: "x \ carrier R" + and ycarr: "y \ carrier R" + and ayI: "a \ y \ I" + from ayI and acarr xcarr ycarr + have "a \ (y \ x) \ I" by (simp add: helper_I_closed) + moreover from xcarr ycarr + have "y \ x = x \ y" by (simp add: m_comm) + ultimately + show "a \ (x \ y) \ I" by simp + qed qed text {* In a cring every maximal ideal is prime *} lemma (in cring) maximalideal_is_prime: - includes maximalideal + assumes "maximalideal I R" shows "primeideal I R" -apply (rule ccontr) -apply (rule primeidealCE) - apply (rule is_cring) - apply assumption - apply (simp add: I_notcarr) proof - - assume "\a b. a \ carrier R \ b \ carrier R \ a \ b \ I \ a \ I \ b \ I" - from this - obtain a b - where acarr: "a \ carrier R" - and bcarr: "b \ carrier R" - and abI: "a \ b \ I" - and anI: "a \ I" - and bnI: "b \ I" + interpret maximalideal [I R] by fact + show ?thesis apply (rule ccontr) + apply (rule primeidealCE) + apply (rule is_cring) + apply assumption + apply (simp add: I_notcarr) + proof - + assume "\a b. a \ carrier R \ b \ carrier R \ a \ b \ I \ a \ I \ b \ I" + from this + obtain a b + where acarr: "a \ carrier R" + and bcarr: "b \ carrier R" + and abI: "a \ b \ I" + and anI: "a \ I" + and bnI: "b \ I" by fast - def J \ "{x\carrier R. a \ x \ I}" - - from R.is_cring and acarr - have idealJ: "ideal J R" unfolding J_def by (rule helper_max_prime) - - have IsubJ: "I \ J" - proof - fix x - assume xI: "x \ I" - from this and acarr - have "a \ x \ I" by (intro I_l_closed) - from xI[THEN a_Hcarr] this - show "x \ J" unfolding J_def by fast + def J \ "{x\carrier R. a \ x \ I}" + + from R.is_cring and acarr + have idealJ: "ideal J R" unfolding J_def by (rule helper_max_prime) + + have IsubJ: "I \ J" + proof + fix x + assume xI: "x \ I" + from this and acarr + have "a \ x \ I" by (intro I_l_closed) + from xI[THEN a_Hcarr] this + show "x \ J" unfolding J_def by fast + qed + + from abI and acarr bcarr + have "b \ J" unfolding J_def by fast + from bnI and this + have JnI: "J \ I" by fast + from acarr + have "a = a \ \" by algebra + from this and anI + have "a \ \ \ I" by simp + from one_closed and this + have "\ \ J" unfolding J_def by fast + hence Jncarr: "J \ carrier R" by fast + + interpret ideal ["J" "R"] by (rule idealJ) + + have "J = I \ J = carrier R" + apply (intro I_maximal) + apply (rule idealJ) + apply (rule IsubJ) + apply (rule a_subset) + done + + from this and JnI and Jncarr + show "False" by simp qed - - from abI and acarr bcarr - have "b \ J" unfolding J_def by fast - from bnI and this - have JnI: "J \ I" by fast - from acarr - have "a = a \ \" by algebra - from this and anI - have "a \ \ \ I" by simp - from one_closed and this - have "\ \ J" unfolding J_def by fast - hence Jncarr: "J \ carrier R" by fast - - interpret ideal ["J" "R"] by (rule idealJ) - - have "J = I \ J = carrier R" - apply (intro I_maximal) - apply (rule idealJ) - apply (rule IsubJ) - apply (rule a_subset) - done - - from this and JnI and Jncarr - show "False" by simp qed - subsection {* Derived Theorems Involving Ideals *} --"A non-zero cring that has only the two trivial ideals is a field" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/QuotRing.thy --- a/src/HOL/Algebra/QuotRing.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/QuotRing.thy Tue Jul 15 16:50:09 2008 +0200 @@ -155,27 +155,32 @@ text {* The quotient of a cring is also commutative *} lemma (in ideal) quotient_is_cring: - includes cring + assumes "cring R" shows "cring (R Quot I)" -apply (intro cring.intro comm_monoid.intro comm_monoid_axioms.intro) +proof - + interpret cring [R] by fact + show ?thesis apply (intro cring.intro comm_monoid.intro comm_monoid_axioms.intro) apply (rule quotient_is_ring) apply (rule ring.axioms[OF quotient_is_ring]) apply (simp add: FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric]) apply clarify apply (simp add: rcoset_mult_add m_comm) done +qed text {* Cosets as a ring homomorphism on crings *} lemma (in ideal) rcos_ring_hom_cring: - includes cring + assumes "cring R" shows "ring_hom_cring R (R Quot I) (op +> I)" -apply (rule ring_hom_cringI) +proof - + interpret cring [R] by fact + show ?thesis apply (rule ring_hom_cringI) apply (rule rcos_ring_hom_ring) apply (rule R.is_cring) apply (rule quotient_is_cring) apply (rule R.is_cring) done - +qed subsection {* Factorization over Prime Ideals *} @@ -236,9 +241,11 @@ The proof follows ``W. Adkins, S. Weintraub: Algebra -- An Approach via Module Theory'' *} lemma (in maximalideal) quotient_is_field: - includes cring + assumes "cring R" shows "field (R Quot I)" -apply (intro cring.cring_fieldI2) +proof - + interpret cring [R] by fact + show ?thesis apply (intro cring.cring_fieldI2) apply (rule quotient_is_cring, rule is_cring) defer 1 apply (simp add: FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric], clarsimp) @@ -338,5 +345,6 @@ from rcarr and this[symmetric] show "\r\carrier R. I +> a \ r = I +> \" by fast qed +qed end diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/Ring.thy --- a/src/HOL/Algebra/Ring.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/Ring.thy Tue Jul 15 16:50:09 2008 +0200 @@ -539,16 +539,26 @@ text {* Two examples for use of method algebra *} lemma - includes ring R + cring S - shows "[| a \ carrier R; b \ carrier R; c \ carrier S; d \ carrier S |] ==> - a \ \ (a \ \ b) = b & c \\<^bsub>S\<^esub> d = d \\<^bsub>S\<^esub> c" - by algebra + fixes R (structure) and S (structure) + assumes "ring R" "cring S" + assumes RS: "a \ carrier R" "b \ carrier R" "c \ carrier S" "d \ carrier S" + shows "a \ \ (a \ \ b) = b & c \\<^bsub>S\<^esub> d = d \\<^bsub>S\<^esub> c" +proof - + interpret ring [R] by fact + interpret cring [S] by fact +ML_val {* Algebra.print_structures @{context} *} + from RS show ?thesis by algebra +qed lemma - includes cring - shows "[| a \ carrier R; b \ carrier R |] ==> a \ (a \ b) = b" - by algebra - + fixes R (structure) + assumes "ring R" + assumes R: "a \ carrier R" "b \ carrier R" + shows "a \ (a \ b) = b" +proof - + interpret ring [R] by fact + from R show ?thesis by algebra +qed subsubsection {* Sums over Finite Sets *} diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/RingHom.thy --- a/src/HOL/Algebra/RingHom.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/RingHom.thy Tue Jul 15 16:50:09 2008 +0200 @@ -31,55 +31,73 @@ done lemma (in ring_hom_ring) is_ring_hom_ring: - includes struct R + struct S - shows "ring_hom_ring R S h" -by (rule ring_hom_ring_axioms) + "ring_hom_ring R S h" + by (rule ring_hom_ring_axioms) lemma ring_hom_ringI: - includes ring R + ring S + fixes R (structure) and S (structure) + assumes "ring R" "ring S" assumes (* morphism: "h \ carrier R \ carrier S" *) hom_closed: "!!x. x \ carrier R ==> h x \ carrier S" and compatible_mult: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \ y) = h x \\<^bsub>S\<^esub> h y" and compatible_add: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \ y) = h x \\<^bsub>S\<^esub> h y" and compatible_one: "h \ = \\<^bsub>S\<^esub>" shows "ring_hom_ring R S h" -apply unfold_locales +proof - + interpret ring [R] by fact + interpret ring [S] by fact + show ?thesis apply unfold_locales apply (unfold ring_hom_def, safe) apply (simp add: hom_closed Pi_def) apply (erule (1) compatible_mult) apply (erule (1) compatible_add) apply (rule compatible_one) done +qed lemma ring_hom_ringI2: - includes ring R + ring S + assumes "ring R" "ring S" assumes h: "h \ ring_hom R S" shows "ring_hom_ring R S h" -apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro) -apply (rule R.is_ring) -apply (rule S.is_ring) -apply (rule h) -done +proof - + interpret R: ring [R] by fact + interpret S: ring [S] by fact + show ?thesis apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro) + apply (rule R.is_ring) + apply (rule S.is_ring) + apply (rule h) + done +qed lemma ring_hom_ringI3: - includes abelian_group_hom R S + ring R + ring S + fixes R (structure) and S (structure) + assumes "abelian_group_hom R S h" "ring R" "ring S" assumes compatible_mult: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \ y) = h x \\<^bsub>S\<^esub> h y" and compatible_one: "h \ = \\<^bsub>S\<^esub>" shows "ring_hom_ring R S h" -apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro, rule R.is_ring, rule S.is_ring) -apply (insert group_hom.homh[OF a_group_hom]) -apply (unfold hom_def ring_hom_def, simp) -apply safe -apply (erule (1) compatible_mult) -apply (rule compatible_one) -done +proof - + interpret abelian_group_hom [R S h] by fact + interpret R: ring [R] by fact + interpret S: ring [S] by fact + show ?thesis apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro, rule R.is_ring, rule S.is_ring) + apply (insert group_hom.homh[OF a_group_hom]) + apply (unfold hom_def ring_hom_def, simp) + apply safe + apply (erule (1) compatible_mult) + apply (rule compatible_one) + done +qed lemma ring_hom_cringI: - includes ring_hom_ring R S h + cring R + cring S + assumes "ring_hom_ring R S h" "cring R" "cring S" shows "ring_hom_cring R S h" - by (intro ring_hom_cring.intro ring_hom_cring_axioms.intro) +proof - + interpret ring_hom_ring [R S h] by fact + interpret R: cring [R] by fact + interpret S: cring [S] by fact + show ?thesis by (intro ring_hom_cring.intro ring_hom_cring_axioms.intro) (rule R.is_cring, rule S.is_cring, rule homh) - +qed subsection {* The kernel of a ring homomorphism *} diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Algebra/UnivPoly.thy --- a/src/HOL/Algebra/UnivPoly.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Algebra/UnivPoly.thy Tue Jul 15 16:50:09 2008 +0200 @@ -1254,15 +1254,17 @@ cring.axioms prems) lemma (in UP_pre_univ_prop) UP_hom_unique: - includes ring_hom_cring P S Phi + 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" - includes ring_hom_cring P S Psi + assumes "ring_hom_cring P S Psi" assumes Psi: "Psi (monom P \ (Suc 0)) = s" "!!r. r \ carrier R ==> Psi (monom P r 0) = h r" and P: "p \ carrier P" and S: "s \ carrier S" shows "Phi p = Psi p" proof - + interpret ring_hom_cring [P S Phi] by fact + interpret ring_hom_cring [P S Psi] by fact have "Phi p = Phi (\\<^bsub>P \<^esub>i \ {..deg R p}. monom P (coeff P p i) 0 \\<^bsub>P\<^esub> monom P \ 1 (^)\<^bsub>P\<^esub> i)" by (simp add: up_repr P monom_mult [THEN sym] monom_pow del: monom_mult) diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Finite_Set.thy --- a/src/HOL/Finite_Set.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Finite_Set.thy Tue Jul 15 16:50:09 2008 +0200 @@ -753,11 +753,14 @@ *} lemma fold_fusion: - includes ab_semigroup_mult g + assumes "ab_semigroup_mult g" assumes fin: "finite A" and hyp: "\x y. h (g x y) = times x (h y)" shows "h (fold g j w A) = fold times j (h w) A" - using fin hyp by (induct set: finite) simp_all +proof - + interpret ab_semigroup_mult [g] by fact + show ?thesis using fin hyp by (induct set: finite) simp_all +qed lemma fold_cong: "finite A \ (!!x. x:A ==> g x = h x) ==> fold times g z A = fold times h z A" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Hyperreal/FrechetDeriv.thy --- a/src/HOL/Hyperreal/FrechetDeriv.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Hyperreal/FrechetDeriv.thy Tue Jul 15 16:50:09 2008 +0200 @@ -61,19 +61,23 @@ by simp lemma bounded_linear_add: - includes bounded_linear f - includes bounded_linear g + assumes "bounded_linear f" + assumes "bounded_linear g" shows "bounded_linear (\x. f x + g x)" -apply (unfold_locales) -apply (simp only: f.add g.add add_ac) -apply (simp only: f.scaleR g.scaleR scaleR_right_distrib) -apply (rule f.pos_bounded [THEN exE], rename_tac Kf) -apply (rule g.pos_bounded [THEN exE], rename_tac Kg) -apply (rule_tac x="Kf + Kg" in exI, safe) -apply (subst right_distrib) -apply (rule order_trans [OF norm_triangle_ineq]) -apply (rule add_mono, erule spec, erule spec) -done +proof - + interpret f: bounded_linear [f] by fact + interpret g: bounded_linear [g] by fact + show ?thesis apply (unfold_locales) + apply (simp only: f.add g.add add_ac) + apply (simp only: f.scaleR g.scaleR scaleR_right_distrib) + apply (rule f.pos_bounded [THEN exE], rename_tac Kf) + apply (rule g.pos_bounded [THEN exE], rename_tac Kg) + apply (rule_tac x="Kf + Kg" in exI, safe) + apply (subst right_distrib) + apply (rule order_trans [OF norm_triangle_ineq]) + apply (rule add_mono, erule spec, erule spec) + done +qed lemma norm_ratio_ineq: fixes x y :: "'a::real_normed_vector" @@ -117,13 +121,16 @@ subsection {* Subtraction *} lemma bounded_linear_minus: - includes bounded_linear f + assumes "bounded_linear f" shows "bounded_linear (\x. - f x)" -apply (unfold_locales) -apply (simp add: f.add) -apply (simp add: f.scaleR) -apply (simp add: f.bounded) -done +proof - + interpret f: bounded_linear [f] by fact + show ?thesis apply (unfold_locales) + apply (simp add: f.add) + apply (simp add: f.scaleR) + apply (simp add: f.bounded) + done +qed lemma FDERIV_minus: "FDERIV f x :> F \ FDERIV (\x. - f x) x :> (\h. - F h)" @@ -169,30 +176,34 @@ by simp lemma bounded_linear_compose: - includes bounded_linear f - includes bounded_linear g + assumes "bounded_linear f" + assumes "bounded_linear g" shows "bounded_linear (\x. f (g x))" -proof (unfold_locales) - fix x y show "f (g (x + y)) = f (g x) + f (g y)" - by (simp only: f.add g.add) -next - fix r x show "f (g (scaleR r x)) = scaleR r (f (g x))" - by (simp only: f.scaleR g.scaleR) -next - from f.pos_bounded - obtain Kf where f: "\x. norm (f x) \ norm x * Kf" and Kf: "0 < Kf" by fast - from g.pos_bounded - obtain Kg where g: "\x. norm (g x) \ norm x * Kg" by fast - show "\K. \x. norm (f (g x)) \ norm x * K" - proof (intro exI allI) - fix x - have "norm (f (g x)) \ norm (g x) * Kf" - using f . - also have "\ \ (norm x * Kg) * Kf" - using g Kf [THEN order_less_imp_le] by (rule mult_right_mono) - also have "(norm x * Kg) * Kf = norm x * (Kg * Kf)" - by (rule mult_assoc) - finally show "norm (f (g x)) \ norm x * (Kg * Kf)" . +proof - + interpret f: bounded_linear [f] by fact + interpret g: bounded_linear [g] by fact + show ?thesis proof (unfold_locales) + fix x y show "f (g (x + y)) = f (g x) + f (g y)" + by (simp only: f.add g.add) + next + fix r x show "f (g (scaleR r x)) = scaleR r (f (g x))" + by (simp only: f.scaleR g.scaleR) + next + from f.pos_bounded + obtain Kf where f: "\x. norm (f x) \ norm x * Kf" and Kf: "0 < Kf" by fast + from g.pos_bounded + obtain Kg where g: "\x. norm (g x) \ norm x * Kg" by fast + show "\K. \x. norm (f (g x)) \ norm x * K" + proof (intro exI allI) + fix x + have "norm (f (g x)) \ norm (g x) * Kf" + using f . + also have "\ \ (norm x * Kg) * Kf" + using g Kf [THEN order_less_imp_le] by (rule mult_right_mono) + also have "(norm x * Kg) * Kf = norm x * (Kg * Kf)" + by (rule mult_assoc) + finally show "norm (f (g x)) \ norm x * (Kg * Kf)" . + qed qed qed diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Library/Multiset.thy Tue Jul 15 16:50:09 2008 +0200 @@ -1421,9 +1421,12 @@ qed lemma fold_mset_fusion: - includes left_commutative g - shows "(\x y. h (g x y) = f x (h y)) \ h (fold_mset g w A) = fold_mset f (h w) A" -by (induct A) auto + assumes "left_commutative g" + shows "(\x y. h (g x y) = f x (h y)) \ h (fold_mset g w A) = fold_mset f (h w) A" (is "PROP ?P") +proof - + interpret left_commutative [g] by fact + show "PROP ?P" by (induct A) auto +qed lemma fold_mset_rec: assumes "a \# A" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/MicroJava/BV/Err.thy --- a/src/HOL/MicroJava/BV/Err.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/MicroJava/BV/Err.thy Tue Jul 15 16:50:09 2008 +0200 @@ -135,19 +135,21 @@ "~(Err <_(le r) x)" by (simp add: lesssub_def lesub_def le_def split: err.split) -lemma semilat_errI [intro]: includes semilat -shows "semilat(err A, Err.le r, lift2(%x y. OK(f x y)))" -apply(insert semilat) -apply (unfold semilat_Def closed_def plussub_def lesub_def - lift2_def Err.le_def err_def) -apply (simp split: err.split) -done +lemma semilat_errI [intro]: + assumes semilat: "semilat (A, r, f)" + shows "semilat(err A, Err.le r, lift2(%x y. OK(f x y)))" + apply(insert semilat) + apply (unfold semilat_Def closed_def plussub_def lesub_def + lift2_def Err.le_def err_def) + apply (simp split: err.split) + done lemma err_semilat_eslI_aux: -includes semilat shows "err_semilat(esl(A,r,f))" -apply (unfold sl_def esl_def) -apply (simp add: semilat_errI[OF semilat]) -done + assumes semilat: "semilat (A, r, f)" + shows "err_semilat(esl(A,r,f))" + apply (unfold sl_def esl_def) + apply (simp add: semilat_errI[OF semilat]) + done lemma err_semilat_eslI [intro, simp]: "\L. semilat L \ err_semilat(esl L)" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/MicroJava/BV/Kildall.thy --- a/src/HOL/MicroJava/BV/Kildall.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/MicroJava/BV/Kildall.thy Tue Jul 15 16:50:09 2008 +0200 @@ -313,36 +313,44 @@ apply (blast intro: order_trans) done -lemma termination_lemma: includes semilat -shows "\ ss \ list n A; \(q,t)\set qs. q t\A; p\w \ \ - ss <[r] merges f qs ss \ - merges f qs ss = ss \ {q. \t. (q,t)\set qs \ t +_f ss!q \ ss!q} Un (w-{p}) < w" -apply(insert semilat) - apply (unfold lesssub_def) - apply (simp (no_asm_simp) add: merges_incr) - apply (rule impI) - apply (rule merges_same_conv [THEN iffD1, elim_format]) - apply assumption+ +lemma termination_lemma: + assumes semilat: "semilat (A, r, f)" + shows "\ ss \ list n A; \(q,t)\set qs. q t\A; p\w \ \ + ss <[r] merges f qs ss \ + merges f qs ss = ss \ {q. \t. (q,t)\set qs \ t +_f ss!q \ ss!q} Un (w-{p}) < w" (is "PROP ?P") +proof - + interpret semilat [A r f] by fact + show "PROP ?P" apply(insert semilat) + apply (unfold lesssub_def) + apply (simp (no_asm_simp) add: merges_incr) + apply (rule impI) + apply (rule merges_same_conv [THEN iffD1, elim_format]) + apply assumption+ defer apply (rule sym, assumption) - defer apply simp - apply (subgoal_tac "\q t. \((q, t) \ set qs \ t +_f ss ! q \ ss ! q)") - apply (blast intro!: psubsetI elim: equalityE) - apply clarsimp - apply (drule bspec, assumption) - apply (drule bspec, assumption) - apply clarsimp - done + defer apply simp + apply (subgoal_tac "\q t. \((q, t) \ set qs \ t +_f ss ! q \ ss ! q)") + apply (blast intro!: psubsetI elim: equalityE) + apply clarsimp + apply (drule bspec, assumption) + apply (drule bspec, assumption) + apply clarsimp + done +qed -lemma iter_properties[rule_format]: includes semilat -shows "\ acc r ; pres_type step n A; mono r step n A; +lemma iter_properties[rule_format]: + assumes semilat: "semilat (A, r, f)" + shows "\ acc r ; pres_type step n A; mono r step n A; bounded step n; \p\w0. p < n; ss0 \ list n A; \p w0 \ stable r step ss0 p \ \ iter f step ss0 w0 = (ss',w') \ ss' \ list n A \ stables r step ss' \ ss0 <=[r] ss' \ (\ts\list n A. ss0 <=[r] ts \ stables r step ts \ ss' <=[r] ts)" -apply(insert semilat) + (is "PROP ?P") +proof - + interpret semilat [A r f] by fact + show "PROP ?P" apply(insert semilat) apply (unfold iter_def stables_def) apply (rule_tac P = "%(ss,w). ss \ list n A \ (\p w \ stable r step ss p) \ ss0 <=[r] ss \ @@ -434,8 +442,10 @@ apply clarsimp done +qed -lemma kildall_properties: includes semilat +lemma kildall_properties: +assumes semilat: "semilat (A, r, f)" shows "\ acc r; pres_type step n A; mono r step n A; bounded step n; ss0 \ list n A \ \ kildall r f step ss0 \ list n A \ @@ -443,6 +453,10 @@ ss0 <=[r] kildall r f step ss0 \ (\ts\list n A. ss0 <=[r] ts \ stables r step ts \ kildall r f step ss0 <=[r] ts)" + (is "PROP ?P") +proof - + interpret semilat [A r f] by fact + show "PROP ?P" apply (unfold kildall_def) apply(case_tac "iter f step ss0 (unstables r step ss0)") apply(simp) @@ -450,11 +464,16 @@ apply (simp_all add: unstables_def stable_def) apply (rule semilat) done - +qed -lemma is_bcv_kildall: includes semilat +lemma is_bcv_kildall: +assumes semilat: "semilat (A, r, f)" shows "\ acc r; top r T; pres_type step n A; bounded step n; mono r step n A \ \ is_bcv r T step n A (kildall r f step)" + (is "PROP ?P") +proof - + interpret semilat [A r f] by fact + show "PROP ?P" apply(unfold is_bcv_def wt_step_def) apply(insert semilat kildall_properties[of A]) apply(simp add:stables_def) @@ -472,5 +491,6 @@ apply simp apply (blast intro!: le_listD less_lengthI) done +qed end diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/MicroJava/BV/Listn.thy --- a/src/HOL/MicroJava/BV/Listn.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/MicroJava/BV/Listn.thy Tue Jul 15 16:50:09 2008 +0200 @@ -378,7 +378,10 @@ lemma Listn_sl_aux: -includes semilat shows "semilat (Listn.sl n (A,r,f))" +assumes "semilat (A, r, f)" shows "semilat (Listn.sl n (A,r,f))" +proof - + interpret semilat [A r f] by fact +show ?thesis apply (unfold Listn.sl_def) apply (simp (no_asm) only: semilat_Def split_conv) apply (rule conjI) @@ -388,6 +391,7 @@ apply (simp (no_asm) only: list_def) apply (simp (no_asm_simp) add: plus_list_ub1 plus_list_ub2 plus_list_lub) done +qed lemma Listn_sl: "\L. semilat L \ semilat (Listn.sl n L)" by(simp add: Listn_sl_aux split_tupled_all) diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/MicroJava/BV/SemilatAlg.thy --- a/src/HOL/MicroJava/BV/SemilatAlg.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/MicroJava/BV/SemilatAlg.thy Tue Jul 15 16:50:09 2008 +0200 @@ -62,17 +62,20 @@ done -lemma plusplus_closed: includes semilat shows - "\y. \ set x \ A; y \ A\ \ x ++_f y \ A" -proof (induct x) - show "\y. y \ A \ [] ++_f y \ A" by simp - fix y x xs - assume y: "y \ A" and xs: "set (x#xs) \ A" - assume IH: "\y. \ set xs \ A; y \ A\ \ xs ++_f y \ A" - from xs obtain x: "x \ A" and xs': "set xs \ A" by simp - from x y have "(x +_f y) \ A" .. - with xs' have "xs ++_f (x +_f y) \ A" by (rule IH) - thus "(x#xs) ++_f y \ A" by simp +lemma plusplus_closed: assumes "semilat (A, r, f)" shows + "\y. \ set x \ A; y \ A\ \ x ++_f y \ A" (is "PROP ?P") +proof - + interpret semilat [A r f] by fact + show "PROP ?P" proof (induct x) + show "\y. y \ A \ [] ++_f y \ A" by simp + fix y x xs + assume y: "y \ A" and xs: "set (x#xs) \ A" + assume IH: "\y. \ set xs \ A; y \ A\ \ xs ++_f y \ A" + from xs obtain x: "x \ A" and xs': "set xs \ A" by simp + from x y have "(x +_f y) \ A" .. + with xs' have "xs ++_f (x +_f y) \ A" by (rule IH) + thus "(x#xs) ++_f y \ A" by simp + qed qed lemma (in semilat) pp_ub2: @@ -154,10 +157,13 @@ qed -lemma ub1': includes semilat -shows "\\(p,s) \ set S. s \ A; y \ A; (a,b) \ set S\ +lemma ub1': + assumes "semilat (A, r, f)" + shows "\\(p,s) \ set S. s \ A; y \ A; (a,b) \ set S\ \ b <=_r map snd [(p', t')\S. p' = a] ++_f y" proof - + interpret semilat [A r f] by fact + let "b <=_r ?map ++_f y" = ?thesis assume "y \ A" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/Bounds.thy --- a/src/HOL/Real/HahnBanach/Bounds.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/Bounds.thy Tue Jul 15 16:50:09 2008 +0200 @@ -24,23 +24,26 @@ the_lub ("\_" [90] 90) lemma the_lub_equality [elim?]: - includes lub + assumes "lub A x" shows "\A = (x::'a::order)" -proof (unfold the_lub_def) - from lub_axioms show "The (lub A) = x" - proof - fix x' assume lub': "lub A x'" - show "x' = x" - proof (rule order_antisym) - from lub' show "x' \ x" - proof - fix a assume "a \ A" - then show "a \ x" .. - qed - show "x \ x'" - proof - fix a assume "a \ A" - with lub' show "a \ x'" .. +proof - + interpret lub [A x] by fact + show ?thesis proof (unfold the_lub_def) + from `lub A x` show "The (lub A) = x" + proof + fix x' assume lub': "lub A x'" + show "x' = x" + proof (rule order_antisym) + from lub' show "x' \ x" + proof + fix a assume "a \ A" + then show "a \ x" .. + qed + show "x \ x'" + proof + fix a assume "a \ A" + with lub' show "a \ x'" .. + qed qed qed qed diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/FunctionNorm.thy --- a/src/HOL/Real/HahnBanach/FunctionNorm.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/FunctionNorm.thy Tue Jul 15 16:50:09 2008 +0200 @@ -26,7 +26,8 @@ declare continuous.intro [intro?] continuous_axioms.intro [intro?] lemma continuousI [intro]: - includes norm_syntax + linearform + fixes norm :: "_ \ real" ("\_\") + assumes "linearform V f" assumes r: "\x. x \ V \ \f x\ \ c * \x\" shows "continuous V norm f" proof @@ -74,6 +75,8 @@ fixes fn_norm ("\_\\_" [0, 1000] 999) defines "\f\\V \ \(B V f)" +locale normed_vectorspace_with_fn_norm = normed_vectorspace + fn_norm + lemma (in fn_norm) B_not_empty [intro]: "0 \ B V f" by (simp add: B_def) @@ -82,20 +85,11 @@ normed space @{text "(V, \\\)"} has a function norm. *} -(* Alternative statement of the lemma as - lemma (in fn_norm) - includes normed_vectorspace + continuous - shows "lub (B V f) (\f\\V)" - is not possible: - fn_norm contrains parameter norm to type "'a::zero => real", - normed_vectorspace and continuous contrain this parameter to - "'a::{minus, plus, zero} => real, which is less general. -*) - -lemma (in normed_vectorspace) fn_norm_works: - includes fn_norm + continuous +lemma (in normed_vectorspace_with_fn_norm) fn_norm_works: + assumes "continuous V norm f" shows "lub (B V f) (\f\\V)" proof - + interpret continuous [V norm f] by fact txt {* The existence of the supremum is shown using the completeness of the reals. Completeness means, that every non-empty bounded set of reals has a supremum. *} @@ -158,39 +152,40 @@ then show ?thesis by (unfold fn_norm_def) (rule the_lubI_ex) qed -lemma (in normed_vectorspace) fn_norm_ub [iff?]: - includes fn_norm + continuous +lemma (in normed_vectorspace_with_fn_norm) fn_norm_ub [iff?]: + assumes "continuous V norm f" assumes b: "b \ B V f" shows "b \ \f\\V" proof - + interpret continuous [V norm f] by fact have "lub (B V f) (\f\\V)" - unfolding B_def fn_norm_def using `continuous V norm f` by (rule fn_norm_works) from this and b show ?thesis .. qed -lemma (in normed_vectorspace) fn_norm_leastB: - includes fn_norm + continuous +lemma (in normed_vectorspace_with_fn_norm) fn_norm_leastB: + assumes "continuous V norm f" assumes b: "\b. b \ B V f \ b \ y" shows "\f\\V \ y" proof - + interpret continuous [V norm f] by fact have "lub (B V f) (\f\\V)" - unfolding B_def fn_norm_def using `continuous V norm f` by (rule fn_norm_works) from this and b show ?thesis .. qed text {* The norm of a continuous function is always @{text "\ 0"}. *} -lemma (in normed_vectorspace) fn_norm_ge_zero [iff]: - includes fn_norm + continuous +lemma (in normed_vectorspace_with_fn_norm) fn_norm_ge_zero [iff]: + assumes "continuous V norm f" shows "0 \ \f\\V" proof - + interpret continuous [V norm f] by fact txt {* The function norm is defined as the supremum of @{text B}. So it is @{text "\ 0"} if all elements in @{text B} are @{text "\ 0"}, provided the supremum exists and @{text B} is not empty. *} have "lub (B V f) (\f\\V)" - unfolding B_def fn_norm_def +(* unfolding B_def fn_norm_def *) using `continuous V norm f` by (rule fn_norm_works) moreover have "0 \ B V f" .. ultimately show ?thesis .. @@ -203,34 +198,37 @@ \end{center} *} -lemma (in normed_vectorspace) fn_norm_le_cong: - includes fn_norm + continuous + linearform +lemma (in normed_vectorspace_with_fn_norm) fn_norm_le_cong: + assumes "continuous V norm f" "linearform V f" assumes x: "x \ V" shows "\f x\ \ \f\\V * \x\" -proof cases - assume "x = 0" - then have "\f x\ = \f 0\" by simp - also have "f 0 = 0" by rule unfold_locales - also have "\\\ = 0" by simp - also have a: "0 \ \f\\V" - unfolding B_def fn_norm_def - using `continuous V norm f` by (rule fn_norm_ge_zero) - from x have "0 \ norm x" .. - with a have "0 \ \f\\V * \x\" by (simp add: zero_le_mult_iff) - finally show "\f x\ \ \f\\V * \x\" . -next - assume "x \ 0" - with x have neq: "\x\ \ 0" by simp - then have "\f x\ = (\f x\ * inverse \x\) * \x\" by simp - also have "\ \ \f\\V * \x\" - proof (rule mult_right_mono) - from x show "0 \ \x\" .. - from x and neq have "\f x\ * inverse \x\ \ B V f" - by (auto simp add: B_def real_divide_def) - with `continuous V norm f` show "\f x\ * inverse \x\ \ \f\\V" - unfolding B_def fn_norm_def by (rule fn_norm_ub) +proof - + interpret continuous [V norm f] by fact + interpret linearform [V f] . + show ?thesis proof cases + assume "x = 0" + then have "\f x\ = \f 0\" by simp + also have "f 0 = 0" by rule unfold_locales + also have "\\\ = 0" by simp + also have a: "0 \ \f\\V" + using `continuous V norm f` by (rule fn_norm_ge_zero) + from x have "0 \ norm x" .. + with a have "0 \ \f\\V * \x\" by (simp add: zero_le_mult_iff) + finally show "\f x\ \ \f\\V * \x\" . + next + assume "x \ 0" + with x have neq: "\x\ \ 0" by simp + then have "\f x\ = (\f x\ * inverse \x\) * \x\" by simp + also have "\ \ \f\\V * \x\" + proof (rule mult_right_mono) + from x show "0 \ \x\" .. + from x and neq have "\f x\ * inverse \x\ \ B V f" + by (auto simp add: B_def real_divide_def) + with `continuous V norm f` show "\f x\ * inverse \x\ \ \f\\V" + by (rule fn_norm_ub) + qed + finally show ?thesis . qed - finally show ?thesis . qed text {* @@ -241,35 +239,38 @@ \end{center} *} -lemma (in normed_vectorspace) fn_norm_least [intro?]: - includes fn_norm + continuous +lemma (in normed_vectorspace_with_fn_norm) fn_norm_least [intro?]: + assumes "continuous V norm f" assumes ineq: "\x \ V. \f x\ \ c * \x\" and ge: "0 \ c" shows "\f\\V \ c" -proof (rule fn_norm_leastB [folded B_def fn_norm_def]) - fix b assume b: "b \ B V f" - show "b \ c" - proof cases - assume "b = 0" - with ge show ?thesis by simp - next - assume "b \ 0" - with b obtain x where b_rep: "b = \f x\ * inverse \x\" +proof - + interpret continuous [V norm f] by fact + show ?thesis proof (rule fn_norm_leastB [folded B_def fn_norm_def]) + fix b assume b: "b \ B V f" + show "b \ c" + proof cases + assume "b = 0" + with ge show ?thesis by simp + next + assume "b \ 0" + with b obtain x where b_rep: "b = \f x\ * inverse \x\" and x_neq: "x \ 0" and x: "x \ V" - by (auto simp add: B_def real_divide_def) - note b_rep - also have "\f x\ * inverse \x\ \ (c * \x\) * inverse \x\" - proof (rule mult_right_mono) - have "0 < \x\" using x x_neq .. - then show "0 \ inverse \x\" by simp - from ineq and x show "\f x\ \ c * \x\" .. + by (auto simp add: B_def real_divide_def) + note b_rep + also have "\f x\ * inverse \x\ \ (c * \x\) * inverse \x\" + proof (rule mult_right_mono) + have "0 < \x\" using x x_neq .. + then show "0 \ inverse \x\" by simp + from ineq and x show "\f x\ \ c * \x\" .. + qed + also have "\ = c" + proof - + from x_neq and x have "\x\ \ 0" by simp + then show ?thesis by simp + qed + finally show ?thesis . qed - also have "\ = c" - proof - - from x_neq and x have "\x\ \ 0" by simp - then show ?thesis by simp - qed - finally show ?thesis . - qed -qed (insert `continuous V norm f`, simp_all add: continuous_def) + qed (insert `continuous V norm f`, simp_all add: continuous_def) +qed end diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/HahnBanach.thy --- a/src/HOL/Real/HahnBanach/HahnBanach.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/HahnBanach.thy Tue Jul 15 16:50:09 2008 +0200 @@ -53,17 +53,21 @@ *} theorem HahnBanach: - includes vectorspace E + subspace F E + seminorm E p + linearform F f + assumes E: "vectorspace E" and "subspace F E" + and "seminorm E p" and "linearform F f" assumes fp: "\x \ F. f x \ p x" shows "\h. linearform E h \ (\x \ F. h x = f x) \ (\x \ E. h x \ p x)" -- {* Let @{text E} be a vector space, @{text F} a subspace of @{text E}, @{text p} a seminorm on @{text E}, *} -- {* and @{text f} a linear form on @{text F} such that @{text f} is bounded by @{text p}, *} -- {* then @{text f} can be extended to a linear form @{text h} on @{text E} in a norm-preserving way. \skp *} proof - + interpret vectorspace [E] by fact + interpret subspace [F E] by fact + interpret seminorm [E p] by fact + interpret linearform [F f] by fact def M \ "norm_pres_extensions E p F f" hence M: "M = \" by (simp only:) - note E = `vectorspace E` - then have F: "vectorspace F" .. + from E have F: "vectorspace F" .. note FE = `F \ E` { fix c assume cM: "c \ chain M" and ex: "\x. x \ c" @@ -306,17 +310,22 @@ *} theorem abs_HahnBanach: - includes vectorspace E + subspace F E + linearform F f + seminorm E p + assumes E: "vectorspace E" and FE: "subspace F E" + and lf: "linearform F f" and sn: "seminorm E p" assumes fp: "\x \ F. \f x\ \ p x" shows "\g. linearform E g \ (\x \ F. g x = f x) \ (\x \ E. \g x\ \ p x)" proof - - note E = `vectorspace E` + interpret vectorspace [E] by fact + interpret subspace [F E] by fact + interpret linearform [F f] by fact + interpret seminorm [E p] by fact +(* note E = `vectorspace E` note FE = `subspace F E` note sn = `seminorm E p` note lf = `linearform F f` - have "\g. linearform E g \ (\x \ F. g x = f x) \ (\x \ E. g x \ p x)" +*) have "\g. linearform E g \ (\x \ F. g x = f x) \ (\x \ E. g x \ p x)" using E FE sn lf proof (rule HahnBanach) show "\x \ F. f x \ p x" @@ -342,22 +351,31 @@ *} theorem norm_HahnBanach: - includes normed_vectorspace E + subspace F E + linearform F f + fn_norm + continuous F norm ("\_\") f + fixes V and norm ("\_\") + fixes B defines "\V f. B V f \ {0} \ {\f x\ / \x\ | x. x \ 0 \ x \ V}" + fixes fn_norm ("\_\\_" [0, 1000] 999) + defines "\V f. \f\\V \ \(B V f)" + assumes E_norm: "normed_vectorspace E norm" and FE: "subspace F E" + and linearform: "linearform F f" and "continuous F norm f" shows "\g. linearform E g \ continuous E norm g \ (\x \ F. g x = f x) \ \g\\E = \f\\F" proof - + interpret normed_vectorspace [E norm] by fact + interpret normed_vectorspace_with_fn_norm [E norm B fn_norm] + by (auto simp: B_def fn_norm_def) intro_locales + interpret subspace [F E] by fact + interpret linearform [F f] by fact + interpret continuous [F norm f] by fact have E: "vectorspace E" by unfold_locales - have E_norm: "normed_vectorspace E norm" by rule unfold_locales - note FE = `F \ E` have F: "vectorspace F" by rule unfold_locales - note linearform = `linearform F f` have F_norm: "normed_vectorspace F norm" using FE E_norm by (rule subspace_normed_vs) have ge_zero: "0 \ \f\\F" - by (rule normed_vectorspace.fn_norm_ge_zero - [OF F_norm `continuous F norm f`, folded B_def fn_norm_def]) + by (rule normed_vectorspace_with_fn_norm.fn_norm_ge_zero + [OF normed_vectorspace_with_fn_norm.intro, + OF F_norm `continuous F norm f` , folded B_def fn_norm_def]) txt {* We define a function @{text p} on @{text E} as follows: @{text "p x = \f\ \ \x\"} *} def p \ "\x. \f\\F * \x\" @@ -406,8 +424,9 @@ fix x assume "x \ F" from this and `continuous F norm f` show "\f x\ \ p x" - by (unfold p_def) (rule normed_vectorspace.fn_norm_le_cong - [OF F_norm, folded B_def fn_norm_def]) + by (unfold p_def) (rule normed_vectorspace_with_fn_norm.fn_norm_le_cong + [OF normed_vectorspace_with_fn_norm.intro, + OF F_norm, folded B_def fn_norm_def]) qed txt {* Using the fact that @{text p} is a seminorm and @{text f} is bounded @@ -463,7 +482,9 @@ txt {* The other direction is achieved by a similar argument. *} show "\f\\F \ \g\\E" - proof (rule normed_vectorspace.fn_norm_least [OF F_norm, folded B_def fn_norm_def]) + proof (rule normed_vectorspace_with_fn_norm.fn_norm_least + [OF normed_vectorspace_with_fn_norm.intro, + OF F_norm, folded B_def fn_norm_def]) show "\x \ F. \f x\ \ \g\\E * \x\" proof fix x assume x: "x \ F" diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy --- a/src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/HahnBanachExtLemmas.thy Tue Jul 15 16:50:09 2008 +0200 @@ -40,10 +40,11 @@ *} lemma ex_xi: - includes vectorspace F + assumes "vectorspace F" assumes r: "\u v. u \ F \ v \ F \ a u \ b v" shows "\xi::real. \y \ F. a y \ xi \ xi \ b y" proof - + interpret vectorspace [F] by fact txt {* From the completeness of the reals follows: The set @{text "S = {a u. u \ F}"} has a supremum, if it is non-empty and has an upper bound. *} @@ -86,183 +87,190 @@ *} lemma h'_lf: - includes var H + var h + var E assumes h'_def: "h' \ \x. let (y, a) = SOME (y, a). x = y + a \ x0 \ y \ H in h y + a * xi" and H'_def: "H' \ H + lin x0" and HE: "H \ E" - includes linearform H h + assumes "linearform H h" assumes x0: "x0 \ H" "x0 \ E" "x0 \ 0" - includes vectorspace E + assumes E: "vectorspace E" shows "linearform H' h'" -proof - note E = `vectorspace E` - have H': "vectorspace H'" - proof (unfold H'_def) - from `x0 \ E` - have "lin x0 \ E" .. - with HE show "vectorspace (H + lin x0)" using E .. - qed - { - fix x1 x2 assume x1: "x1 \ H'" and x2: "x2 \ H'" - show "h' (x1 + x2) = h' x1 + h' x2" - proof - - from H' x1 x2 have "x1 + x2 \ H'" - by (rule vectorspace.add_closed) - with x1 x2 obtain y y1 y2 a a1 a2 where - x1x2: "x1 + x2 = y + a \ x0" and y: "y \ H" +proof - + interpret linearform [H h] by fact + interpret vectorspace [E] by fact + show ?thesis proof + note E = `vectorspace E` + have H': "vectorspace H'" + proof (unfold H'_def) + from `x0 \ E` + have "lin x0 \ E" .. + with HE show "vectorspace (H + lin x0)" using E .. + qed + { + fix x1 x2 assume x1: "x1 \ H'" and x2: "x2 \ H'" + show "h' (x1 + x2) = h' x1 + h' x2" + proof - + from H' x1 x2 have "x1 + x2 \ H'" + by (rule vectorspace.add_closed) + with x1 x2 obtain y y1 y2 a a1 a2 where + x1x2: "x1 + x2 = y + a \ x0" and y: "y \ H" and x1_rep: "x1 = y1 + a1 \ x0" and y1: "y1 \ H" and x2_rep: "x2 = y2 + a2 \ x0" and y2: "y2 \ H" - by (unfold H'_def sum_def lin_def) blast - - have ya: "y1 + y2 = y \ a1 + a2 = a" using E HE _ y x0 - proof (rule decomp_H') txt_raw {* \label{decomp-H-use} *} - from HE y1 y2 show "y1 + y2 \ H" - by (rule subspace.add_closed) - from x0 and HE y y1 y2 - have "x0 \ E" "y \ E" "y1 \ E" "y2 \ E" by auto - with x1_rep x2_rep have "(y1 + y2) + (a1 + a2) \ x0 = x1 + x2" - by (simp add: add_ac add_mult_distrib2) - also note x1x2 - finally show "(y1 + y2) + (a1 + a2) \ x0 = y + a \ x0" . + by (unfold H'_def sum_def lin_def) blast + + have ya: "y1 + y2 = y \ a1 + a2 = a" using E HE _ y x0 + proof (rule decomp_H') txt_raw {* \label{decomp-H-use} *} + from HE y1 y2 show "y1 + y2 \ H" + by (rule subspace.add_closed) + from x0 and HE y y1 y2 + have "x0 \ E" "y \ E" "y1 \ E" "y2 \ E" by auto + with x1_rep x2_rep have "(y1 + y2) + (a1 + a2) \ x0 = x1 + x2" + by (simp add: add_ac add_mult_distrib2) + also note x1x2 + finally show "(y1 + y2) + (a1 + a2) \ x0 = y + a \ x0" . + qed + + from h'_def x1x2 E HE y x0 + have "h' (x1 + x2) = h y + a * xi" + by (rule h'_definite) + also have "\ = h (y1 + y2) + (a1 + a2) * xi" + by (simp only: ya) + also from y1 y2 have "h (y1 + y2) = h y1 + h y2" + by simp + also have "\ + (a1 + a2) * xi = (h y1 + a1 * xi) + (h y2 + a2 * xi)" + by (simp add: left_distrib) + also from h'_def x1_rep E HE y1 x0 + have "h y1 + a1 * xi = h' x1" + by (rule h'_definite [symmetric]) + also from h'_def x2_rep E HE y2 x0 + have "h y2 + a2 * xi = h' x2" + by (rule h'_definite [symmetric]) + finally show ?thesis . qed - - from h'_def x1x2 E HE y x0 - have "h' (x1 + x2) = h y + a * xi" - by (rule h'_definite) - also have "\ = h (y1 + y2) + (a1 + a2) * xi" - by (simp only: ya) - also from y1 y2 have "h (y1 + y2) = h y1 + h y2" - by simp - also have "\ + (a1 + a2) * xi = (h y1 + a1 * xi) + (h y2 + a2 * xi)" - by (simp add: left_distrib) - also from h'_def x1_rep E HE y1 x0 - have "h y1 + a1 * xi = h' x1" - by (rule h'_definite [symmetric]) - also from h'_def x2_rep E HE y2 x0 - have "h y2 + a2 * xi = h' x2" - by (rule h'_definite [symmetric]) - finally show ?thesis . - qed - next - fix x1 c assume x1: "x1 \ H'" - show "h' (c \ x1) = c * (h' x1)" - proof - - from H' x1 have ax1: "c \ x1 \ H'" - by (rule vectorspace.mult_closed) - with x1 obtain y a y1 a1 where - cx1_rep: "c \ x1 = y + a \ x0" and y: "y \ H" + next + fix x1 c assume x1: "x1 \ H'" + show "h' (c \ x1) = c * (h' x1)" + proof - + from H' x1 have ax1: "c \ x1 \ H'" + by (rule vectorspace.mult_closed) + with x1 obtain y a y1 a1 where + cx1_rep: "c \ x1 = y + a \ x0" and y: "y \ H" and x1_rep: "x1 = y1 + a1 \ x0" and y1: "y1 \ H" - by (unfold H'_def sum_def lin_def) blast - - have ya: "c \ y1 = y \ c * a1 = a" using E HE _ y x0 - proof (rule decomp_H') - from HE y1 show "c \ y1 \ H" - by (rule subspace.mult_closed) - from x0 and HE y y1 - have "x0 \ E" "y \ E" "y1 \ E" by auto - with x1_rep have "c \ y1 + (c * a1) \ x0 = c \ x1" - by (simp add: mult_assoc add_mult_distrib1) - also note cx1_rep - finally show "c \ y1 + (c * a1) \ x0 = y + a \ x0" . + by (unfold H'_def sum_def lin_def) blast + + have ya: "c \ y1 = y \ c * a1 = a" using E HE _ y x0 + proof (rule decomp_H') + from HE y1 show "c \ y1 \ H" + by (rule subspace.mult_closed) + from x0 and HE y y1 + have "x0 \ E" "y \ E" "y1 \ E" by auto + with x1_rep have "c \ y1 + (c * a1) \ x0 = c \ x1" + by (simp add: mult_assoc add_mult_distrib1) + also note cx1_rep + finally show "c \ y1 + (c * a1) \ x0 = y + a \ x0" . + qed + + from h'_def cx1_rep E HE y x0 have "h' (c \ x1) = h y + a * xi" + by (rule h'_definite) + also have "\ = h (c \ y1) + (c * a1) * xi" + by (simp only: ya) + also from y1 have "h (c \ y1) = c * h y1" + by simp + also have "\ + (c * a1) * xi = c * (h y1 + a1 * xi)" + by (simp only: right_distrib) + also from h'_def x1_rep E HE y1 x0 have "h y1 + a1 * xi = h' x1" + by (rule h'_definite [symmetric]) + finally show ?thesis . qed - - from h'_def cx1_rep E HE y x0 have "h' (c \ x1) = h y + a * xi" - by (rule h'_definite) - also have "\ = h (c \ y1) + (c * a1) * xi" - by (simp only: ya) - also from y1 have "h (c \ y1) = c * h y1" - by simp - also have "\ + (c * a1) * xi = c * (h y1 + a1 * xi)" - by (simp only: right_distrib) - also from h'_def x1_rep E HE y1 x0 have "h y1 + a1 * xi = h' x1" - by (rule h'_definite [symmetric]) - finally show ?thesis . - qed - } + } + qed qed text {* \medskip The linear extension @{text h'} of @{text h} is bounded by the seminorm @{text p}. *} lemma h'_norm_pres: - includes var H + var h + var E assumes h'_def: "h' \ \x. let (y, a) = SOME (y, a). x = y + a \ x0 \ y \ H in h y + a * xi" and H'_def: "H' \ H + lin x0" and x0: "x0 \ H" "x0 \ E" "x0 \ 0" - includes vectorspace E + subspace H E + seminorm E p + linearform H h + assumes E: "vectorspace E" and HE: "subspace H E" + and "seminorm E p" and "linearform H h" assumes a: "\y \ H. h y \ p y" and a': "\y \ H. - p (y + x0) - h y \ xi \ xi \ p (y + x0) - h y" shows "\x \ H'. h' x \ p x" -proof - note E = `vectorspace E` - note HE = `subspace H E` - fix x assume x': "x \ H'" - show "h' x \ p x" - proof - - from a' have a1: "\ya \ H. - p (ya + x0) - h ya \ xi" - and a2: "\ya \ H. xi \ p (ya + x0) - h ya" by auto - from x' obtain y a where +proof - + interpret vectorspace [E] by fact + interpret subspace [H E] by fact + interpret seminorm [E p] by fact + interpret linearform [H h] by fact + show ?thesis proof + fix x assume x': "x \ H'" + show "h' x \ p x" + proof - + from a' have a1: "\ya \ H. - p (ya + x0) - h ya \ xi" + and a2: "\ya \ H. xi \ p (ya + x0) - h ya" by auto + from x' obtain y a where x_rep: "x = y + a \ x0" and y: "y \ H" - by (unfold H'_def sum_def lin_def) blast - from y have y': "y \ E" .. - from y have ay: "inverse a \ y \ H" by simp - - from h'_def x_rep E HE y x0 have "h' x = h y + a * xi" - by (rule h'_definite) - also have "\ \ p (y + a \ x0)" - proof (rule linorder_cases) - assume z: "a = 0" - then have "h y + a * xi = h y" by simp - also from a y have "\ \ p y" .. - also from x0 y' z have "p y = p (y + a \ x0)" by simp - finally show ?thesis . - next - txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"} - with @{text ya} taken as @{text "y / a"}: *} - assume lz: "a < 0" hence nz: "a \ 0" by simp - from a1 ay - have "- p (inverse a \ y + x0) - h (inverse a \ y) \ xi" .. - with lz have "a * xi \ + by (unfold H'_def sum_def lin_def) blast + from y have y': "y \ E" .. + from y have ay: "inverse a \ y \ H" by simp + + from h'_def x_rep E HE y x0 have "h' x = h y + a * xi" + by (rule h'_definite) + also have "\ \ p (y + a \ x0)" + proof (rule linorder_cases) + assume z: "a = 0" + then have "h y + a * xi = h y" by simp + also from a y have "\ \ p y" .. + also from x0 y' z have "p y = p (y + a \ x0)" by simp + finally show ?thesis . + next + txt {* In the case @{text "a < 0"}, we use @{text "a\<^sub>1"} + with @{text ya} taken as @{text "y / a"}: *} + assume lz: "a < 0" hence nz: "a \ 0" by simp + from a1 ay + have "- p (inverse a \ y + x0) - h (inverse a \ y) \ xi" .. + with lz have "a * xi \ a * (- p (inverse a \ y + x0) - h (inverse a \ y))" - by (simp add: mult_left_mono_neg order_less_imp_le) - - also have "\ = + by (simp add: mult_left_mono_neg order_less_imp_le) + + also have "\ = - a * (p (inverse a \ y + x0)) - a * (h (inverse a \ y))" - by (simp add: right_diff_distrib) - also from lz x0 y' have "- a * (p (inverse a \ y + x0)) = + by (simp add: right_diff_distrib) + also from lz x0 y' have "- a * (p (inverse a \ y + x0)) = p (a \ (inverse a \ y + x0))" - by (simp add: abs_homogenous) - also from nz x0 y' have "\ = p (y + a \ x0)" - by (simp add: add_mult_distrib1 mult_assoc [symmetric]) - also from nz y have "a * (h (inverse a \ y)) = h y" - by simp - finally have "a * xi \ p (y + a \ x0) - h y" . - then show ?thesis by simp - next - txt {* In the case @{text "a > 0"}, we use @{text "a\<^sub>2"} - with @{text ya} taken as @{text "y / a"}: *} - assume gz: "0 < a" hence nz: "a \ 0" by simp - from a2 ay - have "xi \ p (inverse a \ y + x0) - h (inverse a \ y)" .. - with gz have "a * xi \ + by (simp add: abs_homogenous) + also from nz x0 y' have "\ = p (y + a \ x0)" + by (simp add: add_mult_distrib1 mult_assoc [symmetric]) + also from nz y have "a * (h (inverse a \ y)) = h y" + by simp + finally have "a * xi \ p (y + a \ x0) - h y" . + then show ?thesis by simp + next + txt {* In the case @{text "a > 0"}, we use @{text "a\<^sub>2"} + with @{text ya} taken as @{text "y / a"}: *} + assume gz: "0 < a" hence nz: "a \ 0" by simp + from a2 ay + have "xi \ p (inverse a \ y + x0) - h (inverse a \ y)" .. + with gz have "a * xi \ a * (p (inverse a \ y + x0) - h (inverse a \ y))" - by simp - also have "... = a * p (inverse a \ y + x0) - a * h (inverse a \ y)" - by (simp add: right_diff_distrib) - also from gz x0 y' - have "a * p (inverse a \ y + x0) = p (a \ (inverse a \ y + x0))" - by (simp add: abs_homogenous) - also from nz x0 y' have "\ = p (y + a \ x0)" - by (simp add: add_mult_distrib1 mult_assoc [symmetric]) - also from nz y have "a * h (inverse a \ y) = h y" - by simp - finally have "a * xi \ p (y + a \ x0) - h y" . - then show ?thesis by simp + by simp + also have "... = a * p (inverse a \ y + x0) - a * h (inverse a \ y)" + by (simp add: right_diff_distrib) + also from gz x0 y' + have "a * p (inverse a \ y + x0) = p (a \ (inverse a \ y + x0))" + by (simp add: abs_homogenous) + also from nz x0 y' have "\ = p (y + a \ x0)" + by (simp add: add_mult_distrib1 mult_assoc [symmetric]) + also from nz y have "a * h (inverse a \ y) = h y" + by simp + finally have "a * xi \ p (y + a \ x0) - h y" . + then show ?thesis by simp + qed + also from x_rep have "\ = p x" by (simp only:) + finally show ?thesis . qed - also from x_rep have "\ = p x" by (simp only:) - finally show ?thesis . qed qed diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy --- a/src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/HahnBanachSupLemmas.thy Tue Jul 15 16:50:09 2008 +0200 @@ -399,9 +399,14 @@ *} lemma abs_ineq_iff: - includes subspace H E + vectorspace E + seminorm E p + linearform H h + assumes "subspace H E" and "vectorspace E" and "seminorm E p" + and "linearform H h" shows "(\x \ H. \h x\ \ p x) = (\x \ H. h x \ p x)" (is "?L = ?R") proof + interpret subspace [H E] by fact + interpret vectorspace [E] by fact + interpret seminorm [E p] by fact + interpret linearform [H h] by fact have H: "vectorspace H" using `vectorspace E` .. { assume l: ?L diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/Linearform.thy --- a/src/HOL/Real/HahnBanach/Linearform.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/Linearform.thy Tue Jul 15 16:50:09 2008 +0200 @@ -20,9 +20,10 @@ declare linearform.intro [intro?] lemma (in linearform) neg [iff]: - includes vectorspace + assumes "vectorspace V" shows "x \ V \ f (- x) = - f x" proof - + interpret vectorspace [V] by fact assume x: "x \ V" hence "f (- x) = f ((- 1) \ x)" by (simp add: negate_eq1) also from x have "... = (- 1) * (f x)" by (rule mult) @@ -31,9 +32,10 @@ qed lemma (in linearform) diff [iff]: - includes vectorspace + assumes "vectorspace V" shows "x \ V \ y \ V \ f (x - y) = f x - f y" proof - + interpret vectorspace [V] by fact assume x: "x \ V" and y: "y \ V" hence "x - y = x + - y" by (rule diff_eq1) also have "f ... = f x + f (- y)" by (rule add) (simp_all add: x y) @@ -44,9 +46,10 @@ text {* Every linear form yields @{text 0} for the @{text 0} vector. *} lemma (in linearform) zero [iff]: - includes vectorspace + assumes "vectorspace V" shows "f 0 = 0" proof - + interpret vectorspace [V] by fact have "f 0 = f (0 - 0)" by simp also have "\ = f 0 - f 0" using `vectorspace V` by (rule diff) simp_all also have "\ = 0" by simp diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/NormedSpace.thy --- a/src/HOL/Real/HahnBanach/NormedSpace.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/NormedSpace.thy Tue Jul 15 16:50:09 2008 +0200 @@ -27,9 +27,10 @@ declare seminorm.intro [intro?] lemma (in seminorm) diff_subadditive: - includes vectorspace + assumes "vectorspace V" shows "x \ V \ y \ V \ \x - y\ \ \x\ + \y\" proof - + interpret vectorspace [V] by fact assume x: "x \ V" and y: "y \ V" hence "x - y = x + - 1 \ y" by (simp add: diff_eq2 negate_eq2a) @@ -42,9 +43,10 @@ qed lemma (in seminorm) minus: - includes vectorspace + assumes "vectorspace V" shows "x \ V \ \- x\ = \x\" proof - + interpret vectorspace [V] by fact assume x: "x \ V" hence "- x = - 1 \ x" by (simp only: negate_eq1) also from x have "\\\ = \- 1\ * \x\" @@ -95,14 +97,19 @@ *} lemma subspace_normed_vs [intro?]: - includes subspace F E + normed_vectorspace E + fixes F E norm + assumes "subspace F E" "normed_vectorspace E norm" shows "normed_vectorspace F norm" -proof - show "vectorspace F" by (rule vectorspace) unfold_locales -next - have "NormedSpace.norm E norm" by unfold_locales - with subset show "NormedSpace.norm F norm" - by (simp add: norm_def seminorm_def norm_axioms_def) +proof - + interpret subspace [F E] by fact + interpret normed_vectorspace [E norm] by fact + show ?thesis proof + show "vectorspace F" by (rule vectorspace) unfold_locales + next + have "NormedSpace.norm E norm" by unfold_locales + with subset show "NormedSpace.norm F norm" + by (simp add: norm_def seminorm_def norm_axioms_def) + qed qed end diff -r 8882d47e075f -r 2c01c0bdb385 src/HOL/Real/HahnBanach/Subspace.thy --- a/src/HOL/Real/HahnBanach/Subspace.thy Tue Jul 15 16:02:10 2008 +0200 +++ b/src/HOL/Real/HahnBanach/Subspace.thy Tue Jul 15 16:50:09 2008 +0200 @@ -41,10 +41,12 @@ by (rule subspace.subsetD) lemma (in subspace) diff_closed [iff]: - includes vectorspace - shows "x \ U \ y \ U \ x - y \ U" - by (simp add: diff_eq1 negate_eq1) - + assumes "vectorspace V" + shows "x \ U \ y \ U \ x - y \ U" (is "PROP ?P") +proof - + interpret vectorspace [V] by fact + show "PROP ?P" by (simp add: diff_eq1 negate_eq1) +qed text {* \medskip Similar as for linear spaces, the existence of the zero @@ -53,9 +55,10 @@ *} lemma (in subspace) zero [intro]: - includes vectorspace + assumes "vectorspace V" shows "0 \ U" proof - + interpret vectorspace [V] by fact have "U \ {}" by (rule U_V.non_empty) then obtain x where x: "x \ U" by blast hence "x \ V" .. hence "0 = x - x" by simp @@ -64,32 +67,37 @@ qed lemma (in subspace) neg_closed [iff]: - includes vectorspace - shows "x \ U \ - x \ U" - by (simp add: negate_eq1) - + assumes "vectorspace V" + shows "x \ U \ - x \ U" (is "PROP ?P") +proof - + interpret vectorspace [V] by fact + show "PROP ?P" by (simp add: negate_eq1) +qed text {* \medskip Further derived laws: every subspace is a vector space. *} lemma (in subspace) vectorspace [iff]: - includes vectorspace + assumes "vectorspace V" shows "vectorspace U" -proof - show "U \ {}" .. - fix x y z assume x: "x \ U" and y: "y \ U" and z: "z \ U" - fix a b :: real - from x y show "x + y \ U" by simp - from x show "a \ x \ U" by simp - from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac) - from x y show "x + y = y + x" by (simp add: add_ac) - from x show "x - x = 0" by simp - from x show "0 + x = x" by simp - from x y show "a \ (x + y) = a \ x + a \ y" by (simp add: distrib) - from x show "(a + b) \ x = a \ x + b \ x" by (simp add: distrib) - from x show "(a * b) \ x = a \ b \ x" by (simp add: mult_assoc) - from x show "1 \ x = x" by simp - from x show "- x = - 1 \ x" by (simp add: negate_eq1) - from x y show "x - y = x + - y" by (simp add: diff_eq1) +proof - + interpret vectorspace [V] by fact + show ?thesis proof + show "U \ {}" .. + fix x y z assume x: "x \ U" and y: "y \ U" and z: "z \ U" + fix a b :: real + from x y show "x + y \ U" by simp + from x show "a \ x \ U" by simp + from x y z show "(x + y) + z = x + (y + z)" by (simp add: add_ac) + from x y show "x + y = y + x" by (simp add: add_ac) + from x show "x - x = 0" by simp + from x show "0 + x = x" by simp + from x y show "a \ (x + y) = a \ x + a \ y" by (simp add: distrib) + from x show "(a + b) \ x = a \ x + b \ x" by (simp add: distrib) + from x show "(a * b) \ x = a \ b \ x" by (simp add: mult_assoc) + from x show "1 \ x = x" by simp + from x show "- x = - 1 \ x" by (simp add: negate_eq1) + from x y show "x - y = x + - y" by (simp add: diff_eq1) + qed qed @@ -236,61 +244,70 @@ text {* @{text U} is a subspace of @{text "U + V"}. *} lemma subspace_sum1 [iff]: - includes vectorspace U + vectorspace V + assumes "vectorspace U" "vectorspace V" shows "U \ U + V" -proof - show "U \ {}" .. - show "U \ U + V" - proof - fix x assume x: "x \ U" - moreover have "0 \ V" .. - ultimately have "x + 0 \ U + V" .. - with x show "x \ U + V" by simp +proof - + interpret vectorspace [U] by fact + interpret vectorspace [V] by fact + show ?thesis proof + show "U \ {}" .. + show "U \ U + V" + proof + fix x assume x: "x \ U" + moreover have "0 \ V" .. + ultimately have "x + 0 \ U + V" .. + with x show "x \ U + V" by simp + qed + fix x y assume x: "x \ U" and "y \ U" + thus "x + y \ U" by simp + from x show "\a. a \ x \ U" by simp qed - fix x y assume x: "x \ U" and "y \ U" - thus "x + y \ U" by simp - from x show "\a. a \ x \ U" by simp qed text {* The sum of two subspaces is again a subspace. *} lemma sum_subspace [intro?]: - includes subspace U E + vectorspace E + subspace V E + assumes "subspace U E" "vectorspace E" "subspace V E" shows "U + V \ E" -proof - have "0 \ U + V" - proof - show "0 \ U" using `vectorspace E` .. - show "0 \ V" using `vectorspace E` .. - show "(0::'a) = 0 + 0" by simp - qed - thus "U + V \ {}" by blast - show "U + V \ E" - proof - fix x assume "x \ U + V" - then obtain u v where "x = u + v" and - "u \ U" and "v \ V" .. - then show "x \ E" by simp - qed - fix x y assume x: "x \ U + V" and y: "y \ U + V" - show "x + y \ U + V" - proof - - from x obtain ux vx where "x = ux + vx" and "ux \ U" and "vx \ V" .. - moreover - from y obtain uy vy where "y = uy + vy" and "uy \ U" and "vy \ V" .. - ultimately - have "ux + uy \ U" - and "vx + vy \ V" - and "x + y = (ux + uy) + (vx + vy)" - using x y by (simp_all add: add_ac) - thus ?thesis .. - qed - fix a show "a \ x \ U + V" - proof - - from x obtain u v where "x = u + v" and "u \ U" and "v \ V" .. - hence "a \ u \ U" and "a \ v \ V" - and "a \ x = (a \ u) + (a \ v)" by (simp_all add: distrib) - thus ?thesis .. +proof - + interpret subspace [U E] by fact + interpret vectorspace [E] by fact + interpret subspace [V E] by fact + show ?thesis proof + have "0 \ U + V" + proof + show "0 \ U" using `vectorspace E` .. + show "0 \ V" using `vectorspace E` .. + show "(0::'a) = 0 + 0" by simp + qed + thus "U + V \ {}" by blast + show "U + V \ E" + proof + fix x assume "x \ U + V" + then obtain u v where "x = u + v" and + "u \ U" and "v \ V" .. + then show "x \ E" by simp + qed + fix x y assume x: "x \ U + V" and y: "y \ U + V" + show "x + y \ U + V" + proof - + from x obtain ux vx where "x = ux + vx" and "ux \ U" and "vx \ V" .. + moreover + from y obtain uy vy where "y = uy + vy" and "uy \ U" and "vy \ V" .. + ultimately + have "ux + uy \ U" + and "vx + vy \ V" + and "x + y = (ux + uy) + (vx + vy)" + using x y by (simp_all add: add_ac) + thus ?thesis .. + qed + fix a show "a \ x \ U + V" + proof - + from x obtain u v where "x = u + v" and "u \ U" and "v \ V" .. + hence "a \ u \ U" and "a \ v \ V" + and "a \ x = (a \ u) + (a \ v)" by (simp_all add: distrib) + thus ?thesis .. + qed qed qed @@ -312,37 +329,42 @@ *} lemma decomp: - includes vectorspace E + subspace U E + subspace V E + assumes "vectorspace E" "subspace U E" "subspace V E" assumes direct: "U \ V = {0}" and u1: "u1 \ U" and u2: "u2 \ U" and v1: "v1 \ V" and v2: "v2 \ V" and sum: "u1 + v1 = u2 + v2" shows "u1 = u2 \ v1 = v2" -proof - have U: "vectorspace U" - using `subspace U E` `vectorspace E` by (rule subspace.vectorspace) - have V: "vectorspace V" - using `subspace V E` `vectorspace E` by (rule subspace.vectorspace) - from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1" - by (simp add: add_diff_swap) - from u1 u2 have u: "u1 - u2 \ U" - by (rule vectorspace.diff_closed [OF U]) - with eq have v': "v2 - v1 \ U" by (simp only:) - from v2 v1 have v: "v2 - v1 \ V" - by (rule vectorspace.diff_closed [OF V]) - with eq have u': " u1 - u2 \ V" by (simp only:) - - show "u1 = u2" - proof (rule add_minus_eq) - from u1 show "u1 \ E" .. - from u2 show "u2 \ E" .. - from u u' and direct show "u1 - u2 = 0" by blast - qed - show "v1 = v2" - proof (rule add_minus_eq [symmetric]) - from v1 show "v1 \ E" .. - from v2 show "v2 \ E" .. - from v v' and direct show "v2 - v1 = 0" by blast +proof - + interpret vectorspace [E] by fact + interpret subspace [U E] by fact + interpret subspace [V E] by fact + show ?thesis proof + have U: "vectorspace U" (* FIXME: use interpret *) + using `subspace U E` `vectorspace E` by (rule subspace.vectorspace) + have V: "vectorspace V" + using `subspace V E` `vectorspace E` by (rule subspace.vectorspace) + from u1 u2 v1 v2 and sum have eq: "u1 - u2 = v2 - v1" + by (simp add: add_diff_swap) + from u1 u2 have u: "u1 - u2 \ U" + by (rule vectorspace.diff_closed [OF U]) + with eq have v': "v2 - v1 \ U" by (simp only:) + from v2 v1 have v: "v2 - v1 \ V" + by (rule vectorspace.diff_closed [OF V]) + with eq have u': " u1 - u2 \ V" by (simp only:) + + show "u1 = u2" + proof (rule add_minus_eq) + from u1 show "u1 \ E" .. + from u2 show "u2 \ E" .. + from u u' and direct show "u1 - u2 = 0" by blast + qed + show "v1 = v2" + proof (rule add_minus_eq [symmetric]) + from v1 show "v1 \ E" .. + from v2 show "v2 \ E" .. + from v v' and direct show "v2 - v1 = 0" by blast + qed qed qed @@ -356,48 +378,52 @@ *} lemma decomp_H': - includes vectorspace E + subspace H E + assumes "vectorspace E" "subspace H E" assumes y1: "y1 \ H" and y2: "y2 \ H" and x': "x' \ H" "x' \ E" "x' \ 0" and eq: "y1 + a1 \ x' = y2 + a2 \ x'" shows "y1 = y2 \ a1 = a2" -proof - have c: "y1 = y2 \ a1 \ x' = a2 \ x'" - proof (rule decomp) - show "a1 \ x' \ lin x'" .. - show "a2 \ x' \ lin x'" .. - show "H \ lin x' = {0}" - proof - show "H \ lin x' \ {0}" +proof - + interpret vectorspace [E] by fact + interpret subspace [H E] by fact + show ?thesis proof + have c: "y1 = y2 \ a1 \ x' = a2 \ x'" + proof (rule decomp) + show "a1 \ x' \ lin x'" .. + show "a2 \ x' \ lin x'" .. + show "H \ lin x' = {0}" proof - fix x assume x: "x \ H \ lin x'" - then obtain a where xx': "x = a \ x'" - by blast - have "x = 0" - proof cases - assume "a = 0" - with xx' and x' show ?thesis by simp - next - assume a: "a \ 0" - from x have "x \ H" .. - with xx' have "inverse a \ a \ x' \ H" by simp - with a and x' have "x' \ H" by (simp add: mult_assoc2) - with `x' \ H` show ?thesis by contradiction - qed - thus "x \ {0}" .. + show "H \ lin x' \ {0}" + proof + fix x assume x: "x \ H \ lin x'" + then obtain a where xx': "x = a \ x'" + by blast + have "x = 0" + proof cases + assume "a = 0" + with xx' and x' show ?thesis by simp + next + assume a: "a \ 0" + from x have "x \ H" .. + with xx' have "inverse a \ a \ x' \ H" by simp + with a and x' have "x' \ H" by (simp add: mult_assoc2) + with `x' \ H` show ?thesis by contradiction + qed + thus "x \ {0}" .. + qed + show "{0} \ H \ lin x'" + proof - + have "0 \ H" using `vectorspace E` .. + moreover have "0 \ lin x'" using `x' \ E` .. + ultimately show ?thesis by blast + qed qed - show "{0} \ H \ lin x'" - proof - - have "0 \ H" using `vectorspace E` .. - moreover have "0 \ lin x'" using `x' \ E` .. - ultimately show ?thesis by blast - qed - qed - show "lin x' \ E" using `x' \ E` .. - qed (rule `vectorspace E`, rule `subspace H E`, rule y1, rule y2, rule eq) - thus "y1 = y2" .. - from c have "a1 \ x' = a2 \ x'" .. - with x' show "a1 = a2" by (simp add: mult_right_cancel) + show "lin x' \ E" using `x' \ E` .. + qed (rule `vectorspace E`, rule `subspace H E`, rule y1, rule y2, rule eq) + thus "y1 = y2" .. + from c have "a1 \ x' = a2 \ x'" .. + with x' show "a1 = a2" by (simp add: mult_right_cancel) + qed qed text {* @@ -408,19 +434,23 @@ *} lemma decomp_H'_H: - includes vectorspace E + subspace H E + assumes "vectorspace E" "subspace H E" assumes t: "t \ H" and x': "x' \ H" "x' \ E" "x' \ 0" shows "(SOME (y, a). t = y + a \ x' \ y \ H) = (t, 0)" -proof (rule, simp_all only: split_paired_all split_conv) - from t x' show "t = t + 0 \ x' \ t \ H" by simp - fix y and a assume ya: "t = y + a \ x' \ y \ H" - have "y = t \ a = 0" - proof (rule decomp_H') - from ya x' show "y + a \ x' = t + 0 \ x'" by simp - from ya show "y \ H" .. - qed (rule `vectorspace E`, rule `subspace H E`, rule t, (rule x')+) - with t x' show "(y, a) = (y + a \ x', 0)" by simp +proof - + interpret vectorspace [E] by fact + interpret subspace [H E] by fact + show ?thesis proof (rule, simp_all only: split_paired_all split_conv) + from t x' show "t = t + 0 \ x' \ t \ H" by simp + fix y and a assume ya: "t = y + a \ x' \ y \ H" + have "y = t \ a = 0" + proof (rule decomp_H') + from ya x' show "y + a \ x' = t + 0 \ x'" by simp + from ya show "y \ H" .. + qed (rule `vectorspace E`, rule `subspace H E`, rule t, (rule x')+) + with t x' show "(y, a) = (y + a \ x', 0)" by simp + qed qed text {* @@ -430,16 +460,18 @@ *} lemma h'_definite: - includes var H + fixes H assumes h'_def: "h' \ (\x. let (y, a) = SOME (y, a). (x = y + a \ x' \ y \ H) in (h y) + a * xi)" and x: "x = y + a \ x'" - includes vectorspace E + subspace H E + assumes "vectorspace E" "subspace H E" assumes y: "y \ H" and x': "x' \ H" "x' \ E" "x' \ 0" shows "h' x = h y + a * xi" proof - + interpret vectorspace [E] by fact + interpret subspace [H E] by fact from x y x' have "x \ H + lin x'" by auto have "\!p. (\(y, a). x = y + a \ x' \ y \ H) p" (is "\!p. ?P p") proof (rule ex_ex1I)