# HG changeset patch # User paulson # Date 1529406871 -3600 # Node ID ae42b0f6885d9988c1513958fcac78416629d1d1 # Parent 3ead36cbe6b7540faecae738d2d58c409105825d# Parent 44ffc5b9cd764c5ad40c7b4dde734bbc748d6e87 merged diff -r 44ffc5b9cd76 -r ae42b0f6885d src/HOL/Algebra/Ideal.thy --- a/src/HOL/Algebra/Ideal.thy Tue Jun 19 12:14:12 2018 +0100 +++ b/src/HOL/Algebra/Ideal.thy Tue Jun 19 12:14:31 2018 +0100 @@ -38,12 +38,8 @@ shows "ideal I R" 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 + show ?thesis + by (auto simp: ideal.intro ideal_axioms.intro additive_subgroupI a_subgroup is_ring I_l_closed I_r_closed) qed @@ -132,14 +128,11 @@ proof - interpret additive_subgroup I R by fact interpret cring R by fact - show ?thesis apply (intro_locales) + 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 + by (simp add: I_notcarr I_prime primeideal_axioms.intro) qed @@ -165,14 +158,11 @@ lemma (in ideal) one_imp_carrier: assumes I_one_closed: "\ \ I" shows "I = carrier R" - apply (rule) - apply (rule) - apply (rule a_Hcarr, simp) proof - fix x - assume xcarr: "x \ carrier R" - with I_one_closed have "x \ \ \ I" by (intro I_l_closed) - with xcarr show "x \ I" by simp + show "carrier R \ I" + using I_r_closed assms by fastforce + show "I \ carrier R" + by (rule a_subset) qed lemma (in ideal) Icarr: @@ -193,143 +183,82 @@ proof - interpret ideal I R by fact interpret ideal J R by fact + have IJ: "I \ J \ carrier R" + by (force simp: a_subset) show ?thesis apply (intro idealI subgroup.intro) - apply (rule is_ring) - apply (force simp add: a_subset) - apply (simp add: a_inv_def[symmetric]) - apply simp - apply (simp add: a_inv_def[symmetric]) - apply (clarsimp, rule) - apply (fast intro: ideal.I_l_closed ideal.intro assms)+ - apply (clarsimp, rule) - apply (fast intro: ideal.I_r_closed ideal.intro assms)+ + apply (simp_all add: IJ is_ring I_l_closed assms ideal.I_l_closed ideal.I_r_closed flip: a_inv_def) done qed -text \The intersection of any Number of Ideals is again - an Ideal in @{term R}\ -lemma (in ring) i_Intersect: - assumes Sideals: "\I. I \ S \ ideal I R" - and notempty: "S \ {}" - shows "ideal (\S) R" - apply (unfold_locales) - apply (simp_all add: Inter_eq) - apply rule unfolding mem_Collect_eq defer 1 - apply rule defer 1 - apply rule defer 1 - apply (fold a_inv_def, rule) defer 1 - apply rule defer 1 - apply rule defer 1 -proof - - fix x y - assume "\I\S. x \ I" - then have xI: "\I. I \ S \ x \ I" by simp - assume "\I\S. y \ I" - then have yI: "\I. I \ S \ y \ I" by simp - - fix J - assume JS: "J \ S" - interpret ideal J R by (rule Sideals[OF JS]) - from xI[OF JS] and yI[OF JS] show "x \ y \ J" by (rule a_closed) -next - fix J - assume JS: "J \ S" - interpret ideal J R by (rule Sideals[OF JS]) - show "\ \ J" by simp -next - fix x - assume "\I\S. x \ I" - then have xI: "\I. I \ S \ x \ I" by simp +text \The intersection of any Number of Ideals is again an Ideal in @{term R}\ - fix J - assume JS: "J \ S" - interpret ideal J R by (rule Sideals[OF JS]) - - from xI[OF JS] show "\ x \ J" by (rule a_inv_closed) -next - fix x y - assume "\I\S. x \ I" - then have xI: "\I. I \ S \ x \ I" by simp - assume ycarr: "y \ carrier R" - - fix J - assume JS: "J \ S" - interpret ideal J R by (rule Sideals[OF JS]) - - from xI[OF JS] and ycarr show "y \ x \ J" by (rule I_l_closed) -next - fix x y - assume "\I\S. x \ I" - then have xI: "\I. I \ S \ x \ I" by simp - assume ycarr: "y \ carrier R" - - fix J - assume JS: "J \ S" - interpret ideal J R by (rule Sideals[OF JS]) - - from xI[OF JS] and ycarr show "x \ y \ J" by (rule I_r_closed) -next - fix x - assume "\I\S. x \ I" - then have xI: "\I. I \ S \ x \ I" by simp - - from notempty have "\I0. I0 \ S" by blast - then obtain I0 where I0S: "I0 \ S" by auto - - interpret ideal I0 R by (rule Sideals[OF I0S]) - - from xI[OF I0S] have "x \ I0" . - with a_subset show "x \ carrier R" by fast -next - +lemma (in ring) i_Intersect: + assumes Sideals: "\I. I \ S \ ideal I R" and notempty: "S \ {}" + shows "ideal (\S) R" +proof - + { fix x y J + assume "\I\S. x \ I" "\I\S. y \ I" and JS: "J \ S" + interpret ideal J R by (rule Sideals[OF JS]) + have "x \ y \ J" + by (simp add: JS \\I\S. x \ I\ \\I\S. y \ I\) } + moreover + have "\ \ J" if "J \ S" for J + by (simp add: that Sideals additive_subgroup.zero_closed ideal.axioms(1)) + moreover + { fix x J + assume "\I\S. x \ I" and JS: "J \ S" + interpret ideal J R by (rule Sideals[OF JS]) + have "\ x \ J" + by (simp add: JS \\I\S. x \ I\) } + moreover + { fix x y J + assume "\I\S. x \ I" and ycarr: "y \ carrier R" and JS: "J \ S" + interpret ideal J R by (rule Sideals[OF JS]) + have "y \ x \ J" "x \ y \ J" + using I_l_closed I_r_closed JS \\I\S. x \ I\ ycarr by blast+ } + moreover + { fix x + assume "\I\S. x \ I" + obtain I0 where I0S: "I0 \ S" + using notempty by blast + interpret ideal I0 R by (rule Sideals[OF I0S]) + have "x \ I0" + by (simp add: I0S \\I\S. x \ I\) + with a_subset have "x \ carrier R" by fast } + ultimately show ?thesis + by unfold_locales (auto simp: Inter_eq simp flip: a_inv_def) qed subsection \Addition of Ideals\ lemma (in ring) add_ideals: - assumes idealI: "ideal I R" - and idealJ: "ideal J R" + assumes idealI: "ideal I R" and idealJ: "ideal J R" shows "ideal (I <+> J) R" - apply (rule ideal.intro) - apply (rule add_additive_subgroups) - apply (intro ideal.axioms[OF idealI]) - apply (intro ideal.axioms[OF idealJ]) - apply (rule is_ring) - apply (rule ideal_axioms.intro) - apply (simp add: set_add_defs, clarsimp) defer 1 - apply (simp add: set_add_defs, clarsimp) defer 1 -proof - - fix x i j - assume xcarr: "x \ carrier R" - and iI: "i \ I" - and jJ: "j \ J" - from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ] - have c: "(i \ j) \ x = (i \ x) \ (j \ x)" - by algebra - from xcarr and iI have a: "i \ x \ I" - by (simp add: ideal.I_r_closed[OF idealI]) - from xcarr and jJ have b: "j \ x \ J" - by (simp add: ideal.I_r_closed[OF idealJ]) - from a b c show "\ha\I. \ka\J. (i \ j) \ x = ha \ ka" - by fast -next - fix x i j - assume xcarr: "x \ carrier R" - and iI: "i \ I" - and jJ: "j \ J" - from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ] - have c: "x \ (i \ j) = (x \ i) \ (x \ j)" by algebra - from xcarr and iI have a: "x \ i \ I" - by (simp add: ideal.I_l_closed[OF idealI]) - from xcarr and jJ have b: "x \ j \ J" - by (simp add: ideal.I_l_closed[OF idealJ]) - from a b c show "\ha\I. \ka\J. x \ (i \ j) = ha \ ka" - by fast +proof (rule ideal.intro) + show "additive_subgroup (I <+> J) R" + by (intro ideal.axioms[OF idealI] ideal.axioms[OF idealJ] add_additive_subgroups) + show "ring R" + by (rule is_ring) + show "ideal_axioms (I <+> J) R" + proof - + { fix x i j + assume xcarr: "x \ carrier R" and iI: "i \ I" and jJ: "j \ J" + from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ] + have "\h\I. \k\J. (i \ j) \ x = h \ k" + by (meson iI ideal.I_r_closed idealJ jJ l_distr local.idealI) } + moreover + { fix x i j + assume xcarr: "x \ carrier R" and iI: "i \ I" and jJ: "j \ J" + from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ] + have "\h\I. \k\J. x \ (i \ j) = h \ k" + by (meson iI ideal.I_l_closed idealJ jJ local.idealI r_distr) } + ultimately show "ideal_axioms (I <+> J) R" + by (intro ideal_axioms.intro) (auto simp: set_add_defs) + qed qed - subsection (in ring) \Ideals generated by a subset of @{term "carrier R"}\ text \@{term genideal} generates an ideal\ @@ -350,17 +279,13 @@ lemma (in ring) genideal_self': assumes carr: "i \ carrier R" shows "i \ Idl {i}" -proof - - from carr have "{i} \ Idl {i}" by (fast intro!: genideal_self) - then show "i \ Idl {i}" by fast -qed + by (simp add: genideal_def) text \@{term genideal} generates the minimal ideal\ lemma (in ring) genideal_minimal: - assumes a: "ideal I R" - and b: "S \ I" + assumes "ideal I R" "S \ I" shows "Idl S \ I" - unfolding genideal_def by rule (elim InterD, simp add: a b) + unfolding genideal_def by rule (elim InterD, simp add: assms) text \Generated ideals and subsets\ lemma (in ring) Idl_subset_ideal: @@ -383,40 +308,40 @@ and HI: "H \ I" shows "Idl H \ Idl I" proof - - from HI and genideal_self[OF Icarr] have HIdlI: "H \ Idl I" - by fast - from Icarr have Iideal: "ideal (Idl I) R" by (rule genideal_ideal) from HI and Icarr have "H \ carrier R" by fast with Iideal have "(H \ Idl I) = (Idl H \ Idl I)" by (rule Idl_subset_ideal[symmetric]) - - with HIdlI show "Idl H \ Idl I" by simp + then show "Idl H \ Idl I" + by (meson HI Icarr genideal_self order_trans) qed lemma (in ring) Idl_subset_ideal': assumes acarr: "a \ carrier R" and bcarr: "b \ carrier R" - shows "(Idl {a} \ Idl {b}) = (a \ Idl {b})" - apply (subst Idl_subset_ideal[OF genideal_ideal[of "{b}"], of "{a}"]) - apply (fast intro: bcarr, fast intro: acarr) - apply fast - done + shows "Idl {a} \ Idl {b} \ a \ Idl {b}" +proof - + have "Idl {a} \ Idl {b} \ {a} \ Idl {b}" + by (simp add: Idl_subset_ideal acarr bcarr genideal_ideal) + also have "\ \ a \ Idl {b}" + by blast + finally show ?thesis . +qed lemma (in ring) genideal_zero: "Idl {\} = {\}" - apply rule - apply (rule genideal_minimal[OF zeroideal], simp) - apply (simp add: genideal_self') - done +proof + show "Idl {\} \ {\}" + by (simp add: genideal_minimal zeroideal) + show "{\} \ Idl {\}" + by (simp add: genideal_self') +qed lemma (in ring) genideal_one: "Idl {\} = carrier R" proof - interpret ideal "Idl {\}" "R" by (rule genideal_ideal) fast show "Idl {\} = carrier R" - apply (rule, rule a_subset) - apply (simp add: one_imp_carrier genideal_self') - done + using genideal_self' one_imp_carrier by blast qed @@ -429,58 +354,24 @@ lemma (in cring) cgenideal_ideal: assumes acarr: "a \ carrier R" shows "ideal (PIdl a) R" - apply (unfold cgenideal_def) - apply (rule idealI[OF is_ring]) - apply (rule subgroup.intro) - apply simp_all - apply (blast intro: acarr) - apply clarsimp defer 1 - defer 1 - apply (fold a_inv_def, clarsimp) defer 1 - apply clarsimp defer 1 - apply clarsimp defer 1 -proof - - fix x y - assume xcarr: "x \ carrier R" - and ycarr: "y \ carrier R" - note carr = acarr xcarr ycarr - - from carr have "x \ a \ y \ a = (x \ y) \ a" - by (simp add: l_distr) - with carr show "\z. x \ a \ y \ a = z \ a \ z \ carrier R" - by fast -next - from l_null[OF acarr, symmetric] and zero_closed - show "\x. \ = x \ a \ x \ carrier R" by fast -next - fix x - assume xcarr: "x \ carrier R" - note carr = acarr xcarr - - from carr have "\ (x \ a) = (\ x) \ a" - by (simp add: l_minus) - with carr show "\z. \ (x \ a) = z \ a \ z \ carrier R" - by fast -next - fix x y - assume xcarr: "x \ carrier R" - and ycarr: "y \ carrier R" - note carr = acarr xcarr ycarr - - from carr have "y \ a \ x = (y \ x) \ a" - by (simp add: m_assoc) (simp add: m_comm) - with carr show "\z. y \ a \ x = z \ a \ z \ carrier R" - by fast -next - fix x y - assume xcarr: "x \ carrier R" - and ycarr: "y \ carrier R" - note carr = acarr xcarr ycarr - - from carr have "x \ (y \ a) = (x \ y) \ a" - by (simp add: m_assoc) - with carr show "\z. x \ (y \ a) = z \ a \ z \ carrier R" - by fast + unfolding cgenideal_def +proof (intro subgroup.intro idealI[OF is_ring], simp_all) + show "{x \ a |x. x \ carrier R} \ carrier R" + by (blast intro: acarr) + show "\x y. \\u. x = u \ a \ u \ carrier R; \x. y = x \ a \ x \ carrier R\ + \ \v. x \ y = v \ a \ v \ carrier R" + by (metis assms cring.cring_simprules(1) is_cring l_distr) + show "\x. \ = x \ a \ x \ carrier R" + by (metis assms l_null zero_closed) + show "\x. \u. x = u \ a \ u \ carrier R + \ \v. inv\<^bsub>add_monoid R\<^esub> x = v \ a \ v \ carrier R" + by (metis a_inv_def add.inv_closed assms l_minus) + show "\b x. \\x. b = x \ a \ x \ carrier R; x \ carrier R\ + \ \z. x \ b = z \ a \ z \ carrier R" + by (metis assms m_assoc m_closed) + show "\b x. \\x. b = x \ a \ x \ carrier R; x \ carrier R\ + \ \z. b \ x = z \ a \ z \ carrier R" + by (metis assms m_assoc m_comm m_closed) qed lemma (in ring) cgenideal_self: @@ -504,119 +395,64 @@ interpret ideal J R by fact show ?thesis unfolding cgenideal_def - apply rule - apply clarify - using aJ - apply (erule I_l_closed) - done + using I_l_closed aJ by blast qed lemma (in cring) cgenideal_eq_genideal: assumes icarr: "i \ carrier R" shows "PIdl i = Idl {i}" - apply rule - apply (intro cgenideal_minimal) - apply (rule genideal_ideal, fast intro: icarr) - apply (rule genideal_self', fast intro: icarr) - apply (intro genideal_minimal) - apply (rule cgenideal_ideal [OF icarr]) - apply (simp, rule cgenideal_self [OF icarr]) - done +proof + show "PIdl i \ Idl {i}" + by (simp add: cgenideal_minimal genideal_ideal genideal_self' icarr) + show "Idl {i} \ PIdl i" + by (simp add: cgenideal_ideal cgenideal_self genideal_minimal icarr) +qed lemma (in cring) cgenideal_eq_rcos: "PIdl i = carrier R #> i" unfolding cgenideal_def r_coset_def by fast lemma (in cring) cgenideal_is_principalideal: - assumes icarr: "i \ carrier R" + assumes "i \ carrier R" shows "principalideal (PIdl i) R" - apply (rule principalidealI) - apply (rule cgenideal_ideal [OF icarr]) proof - - from icarr have "PIdl i = Idl {i}" - by (rule cgenideal_eq_genideal) - with icarr show "\i'\carrier R. PIdl i = Idl {i'}" - by fast + have "\i'\carrier R. PIdl i = Idl {i'}" + using cgenideal_eq_genideal assms by auto + then show ?thesis + by (simp add: cgenideal_ideal assms principalidealI) qed subsection \Union of Ideals\ lemma (in ring) union_genideal: - assumes idealI: "ideal I R" - and idealJ: "ideal J R" + assumes idealI: "ideal I R" and idealJ: "ideal J R" shows "Idl (I \ J) = I <+> J" - apply rule - apply (rule ring.genideal_minimal) - apply (rule is_ring) - apply (rule add_ideals[OF idealI idealJ]) - apply (rule) - apply (simp add: set_add_defs) apply (elim disjE) defer 1 defer 1 - apply (rule) apply (simp add: set_add_defs genideal_def) apply clarsimp defer 1 -proof - - fix x - assume xI: "x \ I" - have ZJ: "\ \ J" - by (intro additive_subgroup.zero_closed) (rule ideal.axioms[OF idealJ]) - from ideal.Icarr[OF idealI xI] have "x = x \ \" - by algebra - with xI and ZJ show "\h\I. \k\J. x = h \ k" - by fast +proof + show "Idl (I \ J) \ I <+> J" + proof (rule ring.genideal_minimal [OF is_ring]) + show "ideal (I <+> J) R" + by (rule add_ideals[OF idealI idealJ]) + have "\x. x \ I \ \xa\I. \xb\J. x = xa \ xb" + by (metis additive_subgroup.zero_closed ideal.Icarr idealJ ideal_def local.idealI r_zero) + moreover have "\x. x \ J \ \xa\I. \xb\J. x = xa \ xb" + by (metis additive_subgroup.zero_closed ideal.Icarr idealJ ideal_def l_zero local.idealI) + ultimately show "I \ J \ I <+> J" + by (auto simp: set_add_defs) + qed next - fix x - assume xJ: "x \ J" - have ZI: "\ \ I" - by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealI]) - from ideal.Icarr[OF idealJ xJ] have "x = \ \ x" - by algebra - with ZI and xJ show "\h\I. \k\J. x = h \ k" - by fast -next - fix i j K - assume iI: "i \ I" - and jJ: "j \ J" - and idealK: "ideal K R" - and IK: "I \ K" - and JK: "J \ K" - from iI and IK have iK: "i \ K" by fast - from jJ and JK have jK: "j \ K" by fast - from iK and jK show "i \ j \ K" - by (intro additive_subgroup.a_closed) (rule ideal.axioms[OF idealK]) + show "I <+> J \ Idl (I \ J)" + by (auto simp: set_add_defs genideal_def additive_subgroup.a_closed ideal_def set_mp) qed - subsection \Properties of Principal Ideals\ -text \\\\ generates the zero ideal\ -lemma (in ring) zero_genideal: "Idl {\} = {\}" - apply rule - apply (simp add: genideal_minimal zeroideal) - apply (fast intro!: genideal_self) - done - -text \\\\ generates the unit ideal\ -lemma (in ring) one_genideal: "Idl {\} = carrier R" -proof - - have "\ \ Idl {\}" - by (simp add: genideal_self') - then show "Idl {\} = carrier R" - by (intro ideal.one_imp_carrier) (fast intro: genideal_ideal) -qed - - text \The zero ideal is a principal ideal\ corollary (in ring) zeropideal: "principalideal {\} R" - apply (rule principalidealI) - apply (rule zeroideal) - apply (blast intro!: zero_genideal[symmetric]) - done + using genideal_zero principalidealI zeroideal by blast text \The unit ideal is a principal ideal\ corollary (in ring) onepideal: "principalideal (carrier R) R" - apply (rule principalidealI) - apply (rule oneideal) - apply (blast intro!: one_genideal[symmetric]) - done - + using genideal_one oneideal principalidealI by blast text \Every principal ideal is a right coset of the carrier\ lemma (in principalideal) rcos_generate: @@ -626,21 +462,13 @@ interpret cring R by fact from generate obtain i where icarr: "i \ carrier R" and I1: "I = Idl {i}" by fast+ - - from icarr and genideal_self[of "{i}"] have "i \ Idl {i}" - by fast - then have iI: "i \ I" by (simp add: I1) - - from I1 icarr have I2: "I = PIdl i" + then have "I = PIdl i" by (simp add: cgenideal_eq_genideal) - - have "PIdl i = carrier R #> i" + moreover have "i \ I" + by (simp add: I1 genideal_self' icarr) + moreover have "PIdl i = carrier R #> i" unfolding cgenideal_def r_coset_def by fast - - with I2 have "I = carrier R #> i" - by simp - - with iI show "\x\I. I = carrier R #> x" + ultimately show "\x\I. I = carrier R #> x" by fast qed @@ -698,11 +526,7 @@ then have I_prime: "\ a b. \a \ carrier R; b \ carrier R; a \ b \ I\ \ a \ I \ b \ I" by simp have "primeideal I R" - apply (rule primeideal.intro [OF is_ideal is_cring]) - apply (rule primeideal_axioms.intro) - apply (rule InR) - apply (erule (2) I_prime) - done + by (simp add: I_prime InR is_cring is_ideal primeidealI) with notprime show False by simp qed @@ -722,23 +546,15 @@ lemma (in cring) zeroprimeideal_domainI: assumes pi: "primeideal {\} R" shows "domain R" - apply (rule domain.intro, rule is_cring) - apply (rule domain_axioms.intro) -proof (rule ccontr, simp) - interpret primeideal "{\}" "R" by (rule pi) - assume "\ = \" - then have "carrier R = {\}" by (rule one_zeroD) - from this[symmetric] and I_notcarr show False - by simp -next - interpret primeideal "{\}" "R" by (rule pi) - fix a b - assume ab: "a \ b = \" and carr: "a \ carrier R" "b \ carrier R" - from ab have abI: "a \ b \ {\}" - by fast - with carr have "a \ {\} \ b \ {\}" - by (rule I_prime) - then show "a = \ \ b = \" by simp +proof (intro domain.intro is_cring domain_axioms.intro) + show "\ \ \" + using genideal_one genideal_zero pi primeideal.I_notcarr by force + show "a = \ \ b = \" if ab: "a \ b = \" and carr: "a \ carrier R" "b \ carrier R" for a b + proof - + interpret primeideal "{\}" "R" by (rule pi) + show "a = \ \ b = \" + using I_prime ab carr by blast + qed qed corollary (in cring) domain_eq_zeroprimeideal: "domain R = primeideal {\} R" @@ -765,37 +581,18 @@ shows "ideal {x\carrier R. a \ x \ I} R" 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 + show ?thesis + proof (rule idealI, simp_all) + show "ring R" + by (simp add: local.ring_axioms) + show "subgroup {x \ carrier R. a \ x \ I} (add_monoid R)" + by (rule subgroup.intro) (auto simp: r_distr acarr r_minus simp flip: a_inv_def) + show "\b x. \b \ carrier R \ a \ b \ I; x \ carrier R\ + \ a \ (x \ b) \ I" + using acarr helper_I_closed m_comm by auto + show "\b x. \b \ carrier R \ a \ b \ I; x \ carrier R\ + \ a \ (b \ x) \ I" + by (simp add: acarr helper_I_closed) qed qed @@ -805,53 +602,27 @@ shows "primeideal I R" proof - 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" - then 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 + show ?thesis + proof (rule ccontr) + assume neg: "\ primeideal I R" + then 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" + using primeidealCE [OF is_cring] + by (metis I_notcarr) define J where "J = {x\carrier R. a \ x \ I}" - from 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" - with acarr have "a \ x \ I" - by (intro I_l_closed) - with xI[THEN a_Hcarr] show "x \ J" - unfolding J_def by fast - qed - + using I_l_closed J_def a_Hcarr acarr by blast from abI and acarr bcarr have "b \ J" unfolding J_def by fast with bnI have JnI: "J \ I" by fast - from acarr - have "a = a \ \" by algebra - with anI have "a \ \ \ I" by simp - with one_closed have "\ \ J" - unfolding J_def by fast + have "\ \ J" + unfolding J_def by (simp add: acarr anI) then have Jncarr: "J \ carrier R" by fast - - interpret ideal J R by (rule idealJ) - + 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 - + by (simp add: I_maximal IsubJ a_subset is_ideal) with JnI and Jncarr show False by simp qed qed @@ -859,54 +630,39 @@ subsection \Derived Theorems\ -\ \A non-zero cring that has only the two trivial ideals is a field\ +text \A non-zero cring that has only the two trivial ideals is a field\ lemma (in cring) trivialideals_fieldI: assumes carrnzero: "carrier R \ {\}" and haveideals: "{I. ideal I R} = {{\}, carrier R}" shows "field R" - apply (rule cring_fieldI) - apply (rule, rule, rule) - apply (erule Units_closed) - defer 1 - apply rule - defer 1 -proof (rule ccontr, simp) - assume zUnit: "\ \ Units R" - then have a: "\ \ inv \ = \" by (rule Units_r_inv) - from zUnit have "\ \ inv \ = \" - by (intro l_null) (rule Units_inv_closed) - with a[symmetric] have "\ = \" by simp - then have "carrier R = {\}" by (rule one_zeroD) - with carrnzero show False by simp -next - fix x - assume xcarr': "x \ carrier R - {\}" - then have xcarr: "x \ carrier R" by fast - from xcarr' have xnZ: "x \ \" by fast - from xcarr have xIdl: "ideal (PIdl x) R" - by (intro cgenideal_ideal) fast - - from xcarr have "x \ PIdl x" - by (intro cgenideal_self) fast - with xnZ have "PIdl x \ {\}" by fast - with haveideals have "PIdl x = carrier R" - by (blast intro!: xIdl) - then have "\ \ PIdl x" by simp - then have "\y. \ = y \ x \ y \ carrier R" - unfolding cgenideal_def by blast - then obtain y where ycarr: " y \ carrier R" and ylinv: "\ = y \ x" - by fast+ - from ylinv and xcarr ycarr have yrinv: "\ = x \ y" - by (simp add: m_comm) - from ycarr and ylinv[symmetric] and yrinv[symmetric] - have "\y \ carrier R. y \ x = \ \ x \ y = \" by fast - with xcarr show "x \ Units R" - unfolding Units_def by fast +proof (intro cring_fieldI equalityI) + show "Units R \ carrier R - {\}" + by (metis Diff_empty Units_closed Units_r_inv_ex carrnzero l_null one_zeroD subsetI subset_Diff_insert) + show "carrier R - {\} \ Units R" + proof + fix x + assume xcarr': "x \ carrier R - {\}" + then have xcarr: "x \ carrier R" and xnZ: "x \ \" by auto + from xcarr have xIdl: "ideal (PIdl x) R" + by (intro cgenideal_ideal) fast + have "PIdl x \ {\}" + using xcarr xnZ cgenideal_self by blast + with haveideals have "PIdl x = carrier R" + by (blast intro!: xIdl) + then have "\ \ PIdl x" by simp + then have "\y. \ = y \ x \ y \ carrier R" + unfolding cgenideal_def by blast + then obtain y where ycarr: " y \ carrier R" and ylinv: "\ = y \ x" + by fast + have "\y \ carrier R. y \ x = \ \ x \ y = \" + using m_comm xcarr ycarr ylinv by auto + with xcarr show "x \ Units R" + unfolding Units_def by fast + qed qed lemma (in field) all_ideals: "{I. ideal I R} = {{\}, carrier R}" - apply (rule, rule) -proof - +proof (intro equalityI subsetI) fix I assume a: "I \ {I. ideal I R}" then interpret ideal I R by simp @@ -916,41 +672,26 @@ case True then obtain a where aI: "a \ I" and anZ: "a \ \" by fast+ - from aI[THEN a_Hcarr] anZ have aUnit: "a \ Units R" - by (simp add: field_Units) + have aUnit: "a \ Units R" + by (simp add: aI anZ field_Units) then have a: "a \ inv a = \" by (rule Units_r_inv) from aI and aUnit have "a \ inv a \ I" by (simp add: I_r_closed del: Units_r_inv) then have oneI: "\ \ I" by (simp add: a[symmetric]) - have "carrier R \ I" - proof - fix x - assume xcarr: "x \ carrier R" - with oneI have "\ \ x \ I" by (rule I_r_closed) - with xcarr show "x \ I" by simp - qed + using oneI one_imp_carrier by auto with a_subset have "I = carrier R" by fast then show "I \ {{\}, carrier R}" by fast next case False then have IZ: "\a. a \ I \ a = \" by simp - have a: "I \ {\}" - proof - fix x - assume "x \ I" - then have "x = \" by (rule IZ) - then show "x \ {\}" by fast - qed - + using False by auto have "\ \ I" by simp - then have "{\} \ I" by fast - with a have "I = {\}" by fast then show "I \ {{\}, carrier R}" by fast qed -qed (simp add: zeroideal oneideal) +qed (auto simp: zeroideal oneideal) \\"Jacobson Theorem 2.2"\ lemma (in cring) trivialideals_eq_field: @@ -961,9 +702,7 @@ text \Like zeroprimeideal for domains\ lemma (in field) zeromaximalideal: "maximalideal {\} R" - apply (rule maximalidealI) - apply (rule zeroideal) -proof- +proof (intro maximalidealI zeroideal) from one_not_zero have "\ \ {\}" by simp with one_closed show "carrier R \ {\}" by fast next @@ -977,20 +716,20 @@ lemma (in cring) zeromaximalideal_fieldI: assumes zeromax: "maximalideal {\} R" shows "field R" - apply (rule trivialideals_fieldI, rule maximalideal.I_notcarr[OF zeromax]) - apply rule apply clarsimp defer 1 - apply (simp add: zeroideal oneideal) -proof - - fix J - assume Jn0: "J \ {\}" - and idealJ: "ideal J R" - interpret ideal J R by (rule idealJ) - have "{\} \ J" by (rule ccontr) simp - from zeromax and idealJ and this and a_subset - have "J = {\} \ J = carrier R" - by (rule maximalideal.I_maximal) - with Jn0 show "J = carrier R" - by simp +proof (intro trivialideals_fieldI maximalideal.I_notcarr[OF zeromax]) + have "J = carrier R" if Jn0: "J \ {\}" and idealJ: "ideal J R" for J + proof - + interpret ideal J R by (rule idealJ) + have "{\} \ J" + by force + from zeromax idealJ this a_subset + have "J = {\} \ J = carrier R" + by (rule maximalideal.I_maximal) + with Jn0 show "J = carrier R" + by simp + qed + then show "{I. ideal I R} = {{\}, carrier R}" + by (auto simp: zeroideal oneideal) qed lemma (in cring) zeromaximalideal_eq_field: "maximalideal {\} R = field R"