misc tuning and simplification of proofs;
authorwenzelm
Sat Sep 03 22:05:25 2011 +0200 (2011-09-03 ago)
changeset 446773fb27b19e058
parent 44676 7de87f1ae965
child 44682 e5ba1c0b8cac
misc tuning and simplification of proofs;
src/HOL/Algebra/Ideal.thy
src/HOL/Algebra/Ring.thy
     1.1 --- a/src/HOL/Algebra/Ideal.thy	Sat Sep 03 21:15:35 2011 +0200
     1.2 +++ b/src/HOL/Algebra/Ideal.thy	Sat Sep 03 22:05:25 2011 +0200
     1.3 @@ -14,25 +14,24 @@
     1.4  
     1.5  locale ideal = additive_subgroup I R + ring R for I and R (structure) +
     1.6    assumes I_l_closed: "\<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
     1.7 -      and I_r_closed: "\<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
     1.8 +    and I_r_closed: "\<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
     1.9  
    1.10  sublocale ideal \<subseteq> abelian_subgroup I R
    1.11 -apply (intro abelian_subgroupI3 abelian_group.intro)
    1.12 -  apply (rule ideal.axioms, rule ideal_axioms)
    1.13 - apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
    1.14 -apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
    1.15 -done
    1.16 +  apply (intro abelian_subgroupI3 abelian_group.intro)
    1.17 +    apply (rule ideal.axioms, rule ideal_axioms)
    1.18 +   apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
    1.19 +  apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
    1.20 +  done
    1.21  
    1.22 -lemma (in ideal) is_ideal:
    1.23 -  "ideal I R"
    1.24 -by (rule ideal_axioms)
    1.25 +lemma (in ideal) is_ideal: "ideal I R"
    1.26 +  by (rule ideal_axioms)
    1.27  
    1.28  lemma idealI:
    1.29    fixes R (structure)
    1.30    assumes "ring R"
    1.31    assumes a_subgroup: "subgroup I \<lparr>carrier = carrier R, mult = add R, one = zero R\<rparr>"
    1.32 -      and I_l_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
    1.33 -      and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
    1.34 +    and I_l_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
    1.35 +    and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
    1.36    shows "ideal I R"
    1.37  proof -
    1.38    interpret ring R by fact
    1.39 @@ -47,19 +46,16 @@
    1.40  
    1.41  subsubsection (in ring) {* Ideals Generated by a Subset of @{term "carrier R"} *}
    1.42  
    1.43 -definition
    1.44 -  genideal :: "('a, 'b) ring_scheme \<Rightarrow> 'a set \<Rightarrow> 'a set"  ("Idl\<index> _" [80] 79)
    1.45 +definition genideal :: "_ \<Rightarrow> 'a set \<Rightarrow> 'a set"  ("Idl\<index> _" [80] 79)
    1.46    where "genideal R S = Inter {I. ideal I R \<and> S \<subseteq> I}"
    1.47  
    1.48 -
    1.49  subsubsection {* Principal Ideals *}
    1.50  
    1.51  locale principalideal = ideal +
    1.52    assumes generate: "\<exists>i \<in> carrier R. I = Idl {i}"
    1.53  
    1.54 -lemma (in principalideal) is_principalideal:
    1.55 -  shows "principalideal I R"
    1.56 -by (rule principalideal_axioms)
    1.57 +lemma (in principalideal) is_principalideal: "principalideal I R"
    1.58 +  by (rule principalideal_axioms)
    1.59  
    1.60  lemma principalidealI:
    1.61    fixes R (structure)
    1.62 @@ -68,7 +64,9 @@
    1.63    shows "principalideal I R"
    1.64  proof -
    1.65    interpret ideal I R by fact
    1.66 -  show ?thesis  by (intro principalideal.intro principalideal_axioms.intro) (rule is_ideal, rule generate)
    1.67 +  show ?thesis
    1.68 +    by (intro principalideal.intro principalideal_axioms.intro)
    1.69 +      (rule is_ideal, rule generate)
    1.70  qed
    1.71  
    1.72  
    1.73 @@ -76,22 +74,22 @@
    1.74  
    1.75  locale maximalideal = ideal +
    1.76    assumes I_notcarr: "carrier R \<noteq> I"
    1.77 -      and I_maximal: "\<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
    1.78 +    and I_maximal: "\<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
    1.79  
    1.80 -lemma (in maximalideal) is_maximalideal:
    1.81 - shows "maximalideal I R"
    1.82 -by (rule maximalideal_axioms)
    1.83 +lemma (in maximalideal) is_maximalideal: "maximalideal I R"
    1.84 +  by (rule maximalideal_axioms)
    1.85  
    1.86  lemma maximalidealI:
    1.87    fixes R
    1.88    assumes "ideal I R"
    1.89    assumes I_notcarr: "carrier R \<noteq> I"
    1.90 -     and I_maximal: "\<And>J. \<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
    1.91 +    and I_maximal: "\<And>J. \<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
    1.92    shows "maximalideal I R"
    1.93  proof -
    1.94    interpret ideal I R by fact
    1.95 -  show ?thesis by (intro maximalideal.intro maximalideal_axioms.intro)
    1.96 -    (rule is_ideal, rule I_notcarr, rule I_maximal)
    1.97 +  show ?thesis
    1.98 +    by (intro maximalideal.intro maximalideal_axioms.intro)
    1.99 +      (rule is_ideal, rule I_notcarr, rule I_maximal)
   1.100  qed
   1.101  
   1.102  
   1.103 @@ -99,24 +97,24 @@
   1.104  
   1.105  locale primeideal = ideal + cring +
   1.106    assumes I_notcarr: "carrier R \<noteq> I"
   1.107 -      and I_prime: "\<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.108 +    and I_prime: "\<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.109  
   1.110 -lemma (in primeideal) is_primeideal:
   1.111 - shows "primeideal I R"
   1.112 -by (rule primeideal_axioms)
   1.113 +lemma (in primeideal) is_primeideal: "primeideal I R"
   1.114 +  by (rule primeideal_axioms)
   1.115  
   1.116  lemma primeidealI:
   1.117    fixes R (structure)
   1.118    assumes "ideal I R"
   1.119    assumes "cring R"
   1.120    assumes I_notcarr: "carrier R \<noteq> I"
   1.121 -      and I_prime: "\<And>a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.122 +    and I_prime: "\<And>a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.123    shows "primeideal I R"
   1.124  proof -
   1.125    interpret ideal I R by fact
   1.126    interpret cring R by fact
   1.127 -  show ?thesis by (intro primeideal.intro primeideal_axioms.intro)
   1.128 -    (rule is_ideal, rule is_cring, rule I_notcarr, rule I_prime)
   1.129 +  show ?thesis
   1.130 +    by (intro primeideal.intro primeideal_axioms.intro)
   1.131 +      (rule is_ideal, rule is_cring, rule I_notcarr, rule I_prime)
   1.132  qed
   1.133  
   1.134  lemma primeidealI2:
   1.135 @@ -124,9 +122,9 @@
   1.136    assumes "additive_subgroup I R"
   1.137    assumes "cring R"
   1.138    assumes I_l_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
   1.139 -      and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
   1.140 -      and I_notcarr: "carrier R \<noteq> I"
   1.141 -      and I_prime: "\<And>a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.142 +    and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
   1.143 +    and I_notcarr: "carrier R \<noteq> I"
   1.144 +    and I_prime: "\<And>a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.145    shows "primeideal I R"
   1.146  proof -
   1.147    interpret additive_subgroup I R by fact
   1.148 @@ -144,31 +142,27 @@
   1.149  
   1.150  subsection {* Special Ideals *}
   1.151  
   1.152 -lemma (in ring) zeroideal:
   1.153 -  shows "ideal {\<zero>} R"
   1.154 -apply (intro idealI subgroup.intro)
   1.155 -      apply (rule is_ring)
   1.156 -     apply simp+
   1.157 -  apply (fold a_inv_def, simp)
   1.158 - apply simp+
   1.159 -done
   1.160 +lemma (in ring) zeroideal: "ideal {\<zero>} R"
   1.161 +  apply (intro idealI subgroup.intro)
   1.162 +        apply (rule is_ring)
   1.163 +       apply simp+
   1.164 +    apply (fold a_inv_def, simp)
   1.165 +   apply simp+
   1.166 +  done
   1.167  
   1.168 -lemma (in ring) oneideal:
   1.169 -  shows "ideal (carrier R) R"
   1.170 +lemma (in ring) oneideal: "ideal (carrier R) R"
   1.171    by (rule idealI) (auto intro: is_ring add.subgroupI)
   1.172  
   1.173 -lemma (in "domain") zeroprimeideal:
   1.174 - shows "primeideal {\<zero>} R"
   1.175 -apply (intro primeidealI)
   1.176 -   apply (rule zeroideal)
   1.177 -  apply (rule domain.axioms, rule domain_axioms)
   1.178 - defer 1
   1.179 - apply (simp add: integral)
   1.180 +lemma (in "domain") zeroprimeideal: "primeideal {\<zero>} R"
   1.181 +  apply (intro primeidealI)
   1.182 +     apply (rule zeroideal)
   1.183 +    apply (rule domain.axioms, rule domain_axioms)
   1.184 +   defer 1
   1.185 +   apply (simp add: integral)
   1.186  proof (rule ccontr, simp)
   1.187    assume "carrier R = {\<zero>}"
   1.188 -  from this have "\<one> = \<zero>" by (rule one_zeroI)
   1.189 -  from this and one_not_zero
   1.190 -      show "False" by simp
   1.191 +  then have "\<one> = \<zero>" by (rule one_zeroI)
   1.192 +  with one_not_zero show False by simp
   1.193  qed
   1.194  
   1.195  
   1.196 @@ -177,22 +171,20 @@
   1.197  lemma (in ideal) one_imp_carrier:
   1.198    assumes I_one_closed: "\<one> \<in> I"
   1.199    shows "I = carrier R"
   1.200 -apply (rule)
   1.201 -apply (rule)
   1.202 -apply (rule a_Hcarr, simp)
   1.203 +  apply (rule)
   1.204 +  apply (rule)
   1.205 +  apply (rule a_Hcarr, simp)
   1.206  proof
   1.207    fix x
   1.208    assume xcarr: "x \<in> carrier R"
   1.209 -  from I_one_closed and this
   1.210 -      have "x \<otimes> \<one> \<in> I" by (intro I_l_closed)
   1.211 -  from this and xcarr
   1.212 -      show "x \<in> I" by simp
   1.213 +  with I_one_closed have "x \<otimes> \<one> \<in> I" by (intro I_l_closed)
   1.214 +  with xcarr show "x \<in> I" by simp
   1.215  qed
   1.216  
   1.217  lemma (in ideal) Icarr:
   1.218    assumes iI: "i \<in> I"
   1.219    shows "i \<in> carrier R"
   1.220 -using iI by (rule a_Hcarr)
   1.221 +  using iI by (rule a_Hcarr)
   1.222  
   1.223  
   1.224  subsection {* Intersection of Ideals *}
   1.225 @@ -207,17 +199,17 @@
   1.226    interpret ideal I R by fact
   1.227    interpret ideal J R by fact
   1.228    show ?thesis
   1.229 -apply (intro idealI subgroup.intro)
   1.230 -      apply (rule is_ring)
   1.231 -     apply (force simp add: a_subset)
   1.232 -    apply (simp add: a_inv_def[symmetric])
   1.233 -   apply simp
   1.234 -  apply (simp add: a_inv_def[symmetric])
   1.235 - apply (clarsimp, rule)
   1.236 -  apply (fast intro: ideal.I_l_closed ideal.intro assms)+
   1.237 -apply (clarsimp, rule)
   1.238 - apply (fast intro: ideal.I_r_closed ideal.intro assms)+
   1.239 -done
   1.240 +    apply (intro idealI subgroup.intro)
   1.241 +          apply (rule is_ring)
   1.242 +         apply (force simp add: a_subset)
   1.243 +        apply (simp add: a_inv_def[symmetric])
   1.244 +       apply simp
   1.245 +      apply (simp add: a_inv_def[symmetric])
   1.246 +     apply (clarsimp, rule)
   1.247 +      apply (fast intro: ideal.I_l_closed ideal.intro assms)+
   1.248 +    apply (clarsimp, rule)
   1.249 +     apply (fast intro: ideal.I_r_closed ideal.intro assms)+
   1.250 +    done
   1.251  qed
   1.252  
   1.253  text {* The intersection of any Number of Ideals is again
   1.254 @@ -226,26 +218,25 @@
   1.255    assumes Sideals: "\<And>I. I \<in> S \<Longrightarrow> ideal I R"
   1.256      and notempty: "S \<noteq> {}"
   1.257    shows "ideal (Inter S) R"
   1.258 -apply (unfold_locales)
   1.259 -apply (simp_all add: Inter_eq)
   1.260 -      apply rule unfolding mem_Collect_eq defer 1
   1.261 -      apply rule defer 1
   1.262 -      apply rule defer 1
   1.263 -      apply (fold a_inv_def, rule) defer 1
   1.264 -      apply rule defer 1
   1.265 -      apply rule defer 1
   1.266 +  apply (unfold_locales)
   1.267 +  apply (simp_all add: Inter_eq)
   1.268 +        apply rule unfolding mem_Collect_eq defer 1
   1.269 +        apply rule defer 1
   1.270 +        apply rule defer 1
   1.271 +        apply (fold a_inv_def, rule) defer 1
   1.272 +        apply rule defer 1
   1.273 +        apply rule defer 1
   1.274  proof -
   1.275    fix x y
   1.276    assume "\<forall>I\<in>S. x \<in> I"
   1.277 -  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.278 +  then have xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.279    assume "\<forall>I\<in>S. y \<in> I"
   1.280 -  hence yI: "\<And>I. I \<in> S \<Longrightarrow> y \<in> I" by simp
   1.281 +  then have yI: "\<And>I. I \<in> S \<Longrightarrow> y \<in> I" by simp
   1.282  
   1.283    fix J
   1.284    assume JS: "J \<in> S"
   1.285    interpret ideal J R by (rule Sideals[OF JS])
   1.286 -  from xI[OF JS] and yI[OF JS]
   1.287 -      show "x \<oplus> y \<in> J" by (rule a_closed)
   1.288 +  from xI[OF JS] and yI[OF JS] show "x \<oplus> y \<in> J" by (rule a_closed)
   1.289  next
   1.290    fix J
   1.291    assume JS: "J \<in> S"
   1.292 @@ -254,50 +245,47 @@
   1.293  next
   1.294    fix x
   1.295    assume "\<forall>I\<in>S. x \<in> I"
   1.296 -  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.297 +  then have xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.298  
   1.299    fix J
   1.300    assume JS: "J \<in> S"
   1.301    interpret ideal J R by (rule Sideals[OF JS])
   1.302  
   1.303 -  from xI[OF JS]
   1.304 -      show "\<ominus> x \<in> J" by (rule a_inv_closed)
   1.305 +  from xI[OF JS] show "\<ominus> x \<in> J" by (rule a_inv_closed)
   1.306  next
   1.307    fix x y
   1.308    assume "\<forall>I\<in>S. x \<in> I"
   1.309 -  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.310 +  then have xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.311    assume ycarr: "y \<in> carrier R"
   1.312  
   1.313    fix J
   1.314    assume JS: "J \<in> S"
   1.315    interpret ideal J R by (rule Sideals[OF JS])
   1.316  
   1.317 -  from xI[OF JS] and ycarr
   1.318 -      show "y \<otimes> x \<in> J" by (rule I_l_closed)
   1.319 +  from xI[OF JS] and ycarr show "y \<otimes> x \<in> J" by (rule I_l_closed)
   1.320  next
   1.321    fix x y
   1.322    assume "\<forall>I\<in>S. x \<in> I"
   1.323 -  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.324 +  then have xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.325    assume ycarr: "y \<in> carrier R"
   1.326  
   1.327    fix J
   1.328    assume JS: "J \<in> S"
   1.329    interpret ideal J R by (rule Sideals[OF JS])
   1.330  
   1.331 -  from xI[OF JS] and ycarr
   1.332 -      show "x \<otimes> y \<in> J" by (rule I_r_closed)
   1.333 +  from xI[OF JS] and ycarr show "x \<otimes> y \<in> J" by (rule I_r_closed)
   1.334  next
   1.335    fix x
   1.336    assume "\<forall>I\<in>S. x \<in> I"
   1.337 -  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.338 +  then have xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
   1.339  
   1.340    from notempty have "\<exists>I0. I0 \<in> S" by blast
   1.341 -  from this obtain I0 where I0S: "I0 \<in> S" by auto
   1.342 +  then obtain I0 where I0S: "I0 \<in> S" by auto
   1.343  
   1.344    interpret ideal I0 R by (rule Sideals[OF I0S])
   1.345  
   1.346    from xI[OF I0S] have "x \<in> I0" .
   1.347 -  from this and a_subset show "x \<in> carrier R" by fast
   1.348 +  with a_subset show "x \<in> carrier R" by fast
   1.349  next
   1.350  
   1.351  qed
   1.352 @@ -309,40 +297,41 @@
   1.353    assumes idealI: "ideal I R"
   1.354        and idealJ: "ideal J R"
   1.355    shows "ideal (I <+> J) R"
   1.356 -apply (rule ideal.intro)
   1.357 -  apply (rule add_additive_subgroups)
   1.358 -   apply (intro ideal.axioms[OF idealI])
   1.359 -  apply (intro ideal.axioms[OF idealJ])
   1.360 - apply (rule is_ring)
   1.361 -apply (rule ideal_axioms.intro)
   1.362 - apply (simp add: set_add_defs, clarsimp) defer 1
   1.363 - apply (simp add: set_add_defs, clarsimp) defer 1
   1.364 +  apply (rule ideal.intro)
   1.365 +    apply (rule add_additive_subgroups)
   1.366 +     apply (intro ideal.axioms[OF idealI])
   1.367 +    apply (intro ideal.axioms[OF idealJ])
   1.368 +   apply (rule is_ring)
   1.369 +  apply (rule ideal_axioms.intro)
   1.370 +   apply (simp add: set_add_defs, clarsimp) defer 1
   1.371 +   apply (simp add: set_add_defs, clarsimp) defer 1
   1.372  proof -
   1.373    fix x i j
   1.374    assume xcarr: "x \<in> carrier R"
   1.375 -     and iI: "i \<in> I"
   1.376 -     and jJ: "j \<in> J"
   1.377 +    and iI: "i \<in> I"
   1.378 +    and jJ: "j \<in> J"
   1.379    from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ]
   1.380 -      have c: "(i \<oplus> j) \<otimes> x = (i \<otimes> x) \<oplus> (j \<otimes> x)" by algebra
   1.381 -  from xcarr and iI
   1.382 -      have a: "i \<otimes> x \<in> I" by (simp add: ideal.I_r_closed[OF idealI])
   1.383 -  from xcarr and jJ
   1.384 -      have b: "j \<otimes> x \<in> J" by (simp add: ideal.I_r_closed[OF idealJ])
   1.385 -  from a b c
   1.386 -      show "\<exists>ha\<in>I. \<exists>ka\<in>J. (i \<oplus> j) \<otimes> x = ha \<oplus> ka" by fast
   1.387 +  have c: "(i \<oplus> j) \<otimes> x = (i \<otimes> x) \<oplus> (j \<otimes> x)"
   1.388 +    by algebra
   1.389 +  from xcarr and iI have a: "i \<otimes> x \<in> I"
   1.390 +    by (simp add: ideal.I_r_closed[OF idealI])
   1.391 +  from xcarr and jJ have b: "j \<otimes> x \<in> J"
   1.392 +    by (simp add: ideal.I_r_closed[OF idealJ])
   1.393 +  from a b c show "\<exists>ha\<in>I. \<exists>ka\<in>J. (i \<oplus> j) \<otimes> x = ha \<oplus> ka"
   1.394 +    by fast
   1.395  next
   1.396    fix x i j
   1.397    assume xcarr: "x \<in> carrier R"
   1.398 -     and iI: "i \<in> I"
   1.399 -     and jJ: "j \<in> J"
   1.400 +    and iI: "i \<in> I"
   1.401 +    and jJ: "j \<in> J"
   1.402    from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ]
   1.403 -      have c: "x \<otimes> (i \<oplus> j) = (x \<otimes> i) \<oplus> (x \<otimes> j)" by algebra
   1.404 -  from xcarr and iI
   1.405 -      have a: "x \<otimes> i \<in> I" by (simp add: ideal.I_l_closed[OF idealI])
   1.406 -  from xcarr and jJ
   1.407 -      have b: "x \<otimes> j \<in> J" by (simp add: ideal.I_l_closed[OF idealJ])
   1.408 -  from a b c
   1.409 -      show "\<exists>ha\<in>I. \<exists>ka\<in>J. x \<otimes> (i \<oplus> j) = ha \<oplus> ka" by fast
   1.410 +  have c: "x \<otimes> (i \<oplus> j) = (x \<otimes> i) \<oplus> (x \<otimes> j)" by algebra
   1.411 +  from xcarr and iI have a: "x \<otimes> i \<in> I"
   1.412 +    by (simp add: ideal.I_l_closed[OF idealI])
   1.413 +  from xcarr and jJ have b: "x \<otimes> j \<in> J"
   1.414 +    by (simp add: ideal.I_l_closed[OF idealJ])
   1.415 +  from a b c show "\<exists>ha\<in>I. \<exists>ka\<in>J. x \<otimes> (i \<oplus> j) = ha \<oplus> ka"
   1.416 +    by fast
   1.417  qed
   1.418  
   1.419  
   1.420 @@ -361,87 +350,74 @@
   1.421  lemma (in ring) genideal_self:
   1.422    assumes "S \<subseteq> carrier R"
   1.423    shows "S \<subseteq> Idl S"
   1.424 -unfolding genideal_def
   1.425 -by fast
   1.426 +  unfolding genideal_def by fast
   1.427  
   1.428  lemma (in ring) genideal_self':
   1.429    assumes carr: "i \<in> carrier R"
   1.430    shows "i \<in> Idl {i}"
   1.431  proof -
   1.432 -  from carr
   1.433 -      have "{i} \<subseteq> Idl {i}" by (fast intro!: genideal_self)
   1.434 -  thus "i \<in> Idl {i}" by fast
   1.435 +  from carr have "{i} \<subseteq> Idl {i}" by (fast intro!: genideal_self)
   1.436 +  then show "i \<in> Idl {i}" by fast
   1.437  qed
   1.438  
   1.439  text {* @{term genideal} generates the minimal ideal *}
   1.440  lemma (in ring) genideal_minimal:
   1.441    assumes a: "ideal I R"
   1.442 -      and b: "S \<subseteq> I"
   1.443 +    and b: "S \<subseteq> I"
   1.444    shows "Idl S \<subseteq> I"
   1.445 -unfolding genideal_def
   1.446 -by (rule, elim InterD, simp add: a b)
   1.447 +  unfolding genideal_def by rule (elim InterD, simp add: a b)
   1.448  
   1.449  text {* Generated ideals and subsets *}
   1.450  lemma (in ring) Idl_subset_ideal:
   1.451    assumes Iideal: "ideal I R"
   1.452 -      and Hcarr: "H \<subseteq> carrier R"
   1.453 +    and Hcarr: "H \<subseteq> carrier R"
   1.454    shows "(Idl H \<subseteq> I) = (H \<subseteq> I)"
   1.455  proof
   1.456    assume a: "Idl H \<subseteq> I"
   1.457    from Hcarr have "H \<subseteq> Idl H" by (rule genideal_self)
   1.458 -  from this and a
   1.459 -      show "H \<subseteq> I" by simp
   1.460 +  with a show "H \<subseteq> I" by simp
   1.461  next
   1.462    fix x
   1.463    assume HI: "H \<subseteq> I"
   1.464 -
   1.465 -  from Iideal and HI
   1.466 -      have "I \<in> {I. ideal I R \<and> H \<subseteq> I}" by fast
   1.467 -  from this
   1.468 -      show "Idl H \<subseteq> I"
   1.469 -      unfolding genideal_def
   1.470 -      by fast
   1.471 +  from Iideal and HI have "I \<in> {I. ideal I R \<and> H \<subseteq> I}" by fast
   1.472 +  then show "Idl H \<subseteq> I" unfolding genideal_def by fast
   1.473  qed
   1.474  
   1.475  lemma (in ring) subset_Idl_subset:
   1.476    assumes Icarr: "I \<subseteq> carrier R"
   1.477 -      and HI: "H \<subseteq> I"
   1.478 +    and HI: "H \<subseteq> I"
   1.479    shows "Idl H \<subseteq> Idl I"
   1.480  proof -
   1.481 -  from HI and genideal_self[OF Icarr] 
   1.482 -      have HIdlI: "H \<subseteq> Idl I" by fast
   1.483 +  from HI and genideal_self[OF Icarr] have HIdlI: "H \<subseteq> Idl I"
   1.484 +    by fast
   1.485  
   1.486 -  from Icarr
   1.487 -      have Iideal: "ideal (Idl I) R" by (rule genideal_ideal)
   1.488 -  from HI and Icarr
   1.489 -      have "H \<subseteq> carrier R" by fast
   1.490 -  from Iideal and this
   1.491 -      have "(H \<subseteq> Idl I) = (Idl H \<subseteq> Idl I)"
   1.492 -      by (rule Idl_subset_ideal[symmetric])
   1.493 +  from Icarr have Iideal: "ideal (Idl I) R"
   1.494 +    by (rule genideal_ideal)
   1.495 +  from HI and Icarr have "H \<subseteq> carrier R"
   1.496 +    by fast
   1.497 +  with Iideal have "(H \<subseteq> Idl I) = (Idl H \<subseteq> Idl I)"
   1.498 +    by (rule Idl_subset_ideal[symmetric])
   1.499  
   1.500 -  from HIdlI and this
   1.501 -      show "Idl H \<subseteq> Idl I" by simp
   1.502 +  with HIdlI show "Idl H \<subseteq> Idl I" by simp
   1.503  qed
   1.504  
   1.505  lemma (in ring) Idl_subset_ideal':
   1.506    assumes acarr: "a \<in> carrier R" and bcarr: "b \<in> carrier R"
   1.507    shows "(Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})"
   1.508 -apply (subst Idl_subset_ideal[OF genideal_ideal[of "{b}"], of "{a}"])
   1.509 -  apply (fast intro: bcarr, fast intro: acarr)
   1.510 -apply fast
   1.511 -done
   1.512 +  apply (subst Idl_subset_ideal[OF genideal_ideal[of "{b}"], of "{a}"])
   1.513 +    apply (fast intro: bcarr, fast intro: acarr)
   1.514 +  apply fast
   1.515 +  done
   1.516  
   1.517 -lemma (in ring) genideal_zero:
   1.518 -  "Idl {\<zero>} = {\<zero>}"
   1.519 -apply rule
   1.520 - apply (rule genideal_minimal[OF zeroideal], simp)
   1.521 -apply (simp add: genideal_self')
   1.522 -done
   1.523 +lemma (in ring) genideal_zero: "Idl {\<zero>} = {\<zero>}"
   1.524 +  apply rule
   1.525 +   apply (rule genideal_minimal[OF zeroideal], simp)
   1.526 +  apply (simp add: genideal_self')
   1.527 +  done
   1.528  
   1.529 -lemma (in ring) genideal_one:
   1.530 -  "Idl {\<one>} = carrier R"
   1.531 +lemma (in ring) genideal_one: "Idl {\<one>} = carrier R"
   1.532  proof -
   1.533 -  interpret ideal "Idl {\<one>}" "R" by (rule genideal_ideal, fast intro: one_closed)
   1.534 +  interpret ideal "Idl {\<one>}" "R" by (rule genideal_ideal) fast
   1.535    show "Idl {\<one>} = carrier R"
   1.536    apply (rule, rule a_subset)
   1.537    apply (simp add: one_imp_carrier genideal_self')
   1.538 @@ -451,77 +427,76 @@
   1.539  
   1.540  text {* Generation of Principal Ideals in Commutative Rings *}
   1.541  
   1.542 -definition
   1.543 -  cgenideal :: "('a, 'b) monoid_scheme \<Rightarrow> 'a \<Rightarrow> 'a set"  ("PIdl\<index> _" [80] 79)
   1.544 +definition cgenideal :: "_ \<Rightarrow> 'a \<Rightarrow> 'a set"  ("PIdl\<index> _" [80] 79)
   1.545    where "cgenideal R a = {x \<otimes>\<^bsub>R\<^esub> a | x. x \<in> carrier R}"
   1.546  
   1.547  text {* genhideal (?) really generates an ideal *}
   1.548  lemma (in cring) cgenideal_ideal:
   1.549    assumes acarr: "a \<in> carrier R"
   1.550    shows "ideal (PIdl a) R"
   1.551 -apply (unfold cgenideal_def)
   1.552 -apply (rule idealI[OF is_ring])
   1.553 -   apply (rule subgroup.intro)
   1.554 -      apply (simp_all add: monoid_record_simps)
   1.555 -      apply (blast intro: acarr m_closed)
   1.556 -      apply clarsimp defer 1
   1.557 -      defer 1
   1.558 -      apply (fold a_inv_def, clarsimp) defer 1
   1.559 -      apply clarsimp defer 1
   1.560 -      apply clarsimp defer 1
   1.561 +  apply (unfold cgenideal_def)
   1.562 +  apply (rule idealI[OF is_ring])
   1.563 +     apply (rule subgroup.intro)
   1.564 +        apply simp_all
   1.565 +        apply (blast intro: acarr)
   1.566 +        apply clarsimp defer 1
   1.567 +        defer 1
   1.568 +        apply (fold a_inv_def, clarsimp) defer 1
   1.569 +        apply clarsimp defer 1
   1.570 +        apply clarsimp defer 1
   1.571  proof -
   1.572    fix x y
   1.573    assume xcarr: "x \<in> carrier R"
   1.574 -     and ycarr: "y \<in> carrier R"
   1.575 +    and ycarr: "y \<in> carrier R"
   1.576    note carr = acarr xcarr ycarr
   1.577  
   1.578 -  from carr
   1.579 -      have "x \<otimes> a \<oplus> y \<otimes> a = (x \<oplus> y) \<otimes> a" by (simp add: l_distr)
   1.580 -  from this and carr
   1.581 -      show "\<exists>z. x \<otimes> a \<oplus> y \<otimes> a = z \<otimes> a \<and> z \<in> carrier R" by fast
   1.582 +  from carr have "x \<otimes> a \<oplus> y \<otimes> a = (x \<oplus> y) \<otimes> a"
   1.583 +    by (simp add: l_distr)
   1.584 +  with carr show "\<exists>z. x \<otimes> a \<oplus> y \<otimes> a = z \<otimes> a \<and> z \<in> carrier R"
   1.585 +    by fast
   1.586  next
   1.587    from l_null[OF acarr, symmetric] and zero_closed
   1.588 -      show "\<exists>x. \<zero> = x \<otimes> a \<and> x \<in> carrier R" by fast
   1.589 +  show "\<exists>x. \<zero> = x \<otimes> a \<and> x \<in> carrier R" by fast
   1.590  next
   1.591    fix x
   1.592    assume xcarr: "x \<in> carrier R"
   1.593    note carr = acarr xcarr
   1.594  
   1.595 -  from carr
   1.596 -      have "\<ominus> (x \<otimes> a) = (\<ominus> x) \<otimes> a" by (simp add: l_minus)
   1.597 -  from this and carr
   1.598 -      show "\<exists>z. \<ominus> (x \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R" by fast
   1.599 +  from carr have "\<ominus> (x \<otimes> a) = (\<ominus> x) \<otimes> a"
   1.600 +    by (simp add: l_minus)
   1.601 +  with carr show "\<exists>z. \<ominus> (x \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R"
   1.602 +    by fast
   1.603  next
   1.604    fix x y
   1.605    assume xcarr: "x \<in> carrier R"
   1.606       and ycarr: "y \<in> carrier R"
   1.607    note carr = acarr xcarr ycarr
   1.608    
   1.609 -  from carr
   1.610 -      have "y \<otimes> a \<otimes> x = (y \<otimes> x) \<otimes> a" by (simp add: m_assoc, simp add: m_comm)
   1.611 -  from this and carr
   1.612 -      show "\<exists>z. y \<otimes> a \<otimes> x = z \<otimes> a \<and> z \<in> carrier R" by fast
   1.613 +  from carr have "y \<otimes> a \<otimes> x = (y \<otimes> x) \<otimes> a"
   1.614 +    by (simp add: m_assoc) (simp add: m_comm)
   1.615 +  with carr show "\<exists>z. y \<otimes> a \<otimes> x = z \<otimes> a \<and> z \<in> carrier R"
   1.616 +    by fast
   1.617  next
   1.618    fix x y
   1.619    assume xcarr: "x \<in> carrier R"
   1.620       and ycarr: "y \<in> carrier R"
   1.621    note carr = acarr xcarr ycarr
   1.622  
   1.623 -  from carr
   1.624 -      have "x \<otimes> (y \<otimes> a) = (x \<otimes> y) \<otimes> a" by (simp add: m_assoc)
   1.625 -  from this and carr
   1.626 -      show "\<exists>z. x \<otimes> (y \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R" by fast
   1.627 +  from carr have "x \<otimes> (y \<otimes> a) = (x \<otimes> y) \<otimes> a"
   1.628 +    by (simp add: m_assoc)
   1.629 +  with carr show "\<exists>z. x \<otimes> (y \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R"
   1.630 +    by fast
   1.631  qed
   1.632  
   1.633  lemma (in ring) cgenideal_self:
   1.634    assumes icarr: "i \<in> carrier R"
   1.635    shows "i \<in> PIdl i"
   1.636 -unfolding cgenideal_def
   1.637 +  unfolding cgenideal_def
   1.638  proof simp
   1.639 -  from icarr
   1.640 -      have "i = \<one> \<otimes> i" by simp
   1.641 -  from this and icarr
   1.642 -      show "\<exists>x. i = x \<otimes> i \<and> x \<in> carrier R" by fast
   1.643 +  from icarr have "i = \<one> \<otimes> i"
   1.644 +    by simp
   1.645 +  with icarr show "\<exists>x. i = x \<otimes> i \<and> x \<in> carrier R"
   1.646 +    by fast
   1.647  qed
   1.648  
   1.649  text {* @{const "cgenideal"} is minimal *}
   1.650 @@ -532,7 +507,8 @@
   1.651    shows "PIdl a \<subseteq> J"
   1.652  proof -
   1.653    interpret ideal J R by fact
   1.654 -  show ?thesis unfolding cgenideal_def
   1.655 +  show ?thesis
   1.656 +    unfolding cgenideal_def
   1.657      apply rule
   1.658      apply clarify
   1.659      using aJ
   1.660 @@ -543,30 +519,28 @@
   1.661  lemma (in cring) cgenideal_eq_genideal:
   1.662    assumes icarr: "i \<in> carrier R"
   1.663    shows "PIdl i = Idl {i}"
   1.664 -apply rule
   1.665 - apply (intro cgenideal_minimal)
   1.666 -  apply (rule genideal_ideal, fast intro: icarr)
   1.667 - apply (rule genideal_self', fast intro: icarr)
   1.668 -apply (intro genideal_minimal)
   1.669 - apply (rule cgenideal_ideal [OF icarr])
   1.670 -apply (simp, rule cgenideal_self [OF icarr])
   1.671 -done
   1.672 +  apply rule
   1.673 +   apply (intro cgenideal_minimal)
   1.674 +    apply (rule genideal_ideal, fast intro: icarr)
   1.675 +   apply (rule genideal_self', fast intro: icarr)
   1.676 +  apply (intro genideal_minimal)
   1.677 +   apply (rule cgenideal_ideal [OF icarr])
   1.678 +  apply (simp, rule cgenideal_self [OF icarr])
   1.679 +  done
   1.680  
   1.681 -lemma (in cring) cgenideal_eq_rcos:
   1.682 - "PIdl i = carrier R #> i"
   1.683 -unfolding cgenideal_def r_coset_def
   1.684 -by fast
   1.685 +lemma (in cring) cgenideal_eq_rcos: "PIdl i = carrier R #> i"
   1.686 +  unfolding cgenideal_def r_coset_def by fast
   1.687  
   1.688  lemma (in cring) cgenideal_is_principalideal:
   1.689    assumes icarr: "i \<in> carrier R"
   1.690    shows "principalideal (PIdl i) R"
   1.691 -apply (rule principalidealI)
   1.692 -apply (rule cgenideal_ideal [OF icarr])
   1.693 +  apply (rule principalidealI)
   1.694 +  apply (rule cgenideal_ideal [OF icarr])
   1.695  proof -
   1.696 -  from icarr
   1.697 -      have "PIdl i = Idl {i}" by (rule cgenideal_eq_genideal)
   1.698 -  from icarr and this
   1.699 -      show "\<exists>i'\<in>carrier R. PIdl i = Idl {i'}" by fast
   1.700 +  from icarr have "PIdl i = Idl {i}"
   1.701 +    by (rule cgenideal_eq_genideal)
   1.702 +  with icarr show "\<exists>i'\<in>carrier R. PIdl i = Idl {i'}"
   1.703 +    by fast
   1.704  qed
   1.705  
   1.706  
   1.707 @@ -574,83 +548,79 @@
   1.708  
   1.709  lemma (in ring) union_genideal:
   1.710    assumes idealI: "ideal I R"
   1.711 -      and idealJ: "ideal J R"
   1.712 +    and idealJ: "ideal J R"
   1.713    shows "Idl (I \<union> J) = I <+> J"
   1.714 -apply rule
   1.715 - apply (rule ring.genideal_minimal)
   1.716 -   apply (rule is_ring)
   1.717 -  apply (rule add_ideals[OF idealI idealJ])
   1.718 - apply (rule)
   1.719 - apply (simp add: set_add_defs) apply (elim disjE) defer 1 defer 1
   1.720 - apply (rule) apply (simp add: set_add_defs genideal_def) apply clarsimp defer 1
   1.721 +  apply rule
   1.722 +   apply (rule ring.genideal_minimal)
   1.723 +     apply (rule is_ring)
   1.724 +    apply (rule add_ideals[OF idealI idealJ])
   1.725 +   apply (rule)
   1.726 +   apply (simp add: set_add_defs) apply (elim disjE) defer 1 defer 1
   1.727 +   apply (rule) apply (simp add: set_add_defs genideal_def) apply clarsimp defer 1
   1.728  proof -
   1.729    fix x
   1.730    assume xI: "x \<in> I"
   1.731    have ZJ: "\<zero> \<in> J"
   1.732 -      by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealJ])
   1.733 -  from ideal.Icarr[OF idealI xI]
   1.734 -      have "x = x \<oplus> \<zero>" by algebra
   1.735 -  from xI and ZJ and this
   1.736 -      show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k" by fast
   1.737 +    by (intro additive_subgroup.zero_closed) (rule ideal.axioms[OF idealJ])
   1.738 +  from ideal.Icarr[OF idealI xI] have "x = x \<oplus> \<zero>"
   1.739 +    by algebra
   1.740 +  with xI and ZJ show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k"
   1.741 +    by fast
   1.742  next
   1.743    fix x
   1.744    assume xJ: "x \<in> J"
   1.745    have ZI: "\<zero> \<in> I"
   1.746 -      by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealI])
   1.747 -  from ideal.Icarr[OF idealJ xJ]
   1.748 -      have "x = \<zero> \<oplus> x" by algebra
   1.749 -  from ZI and xJ and this
   1.750 -      show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k" by fast
   1.751 +    by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealI])
   1.752 +  from ideal.Icarr[OF idealJ xJ] have "x = \<zero> \<oplus> x"
   1.753 +    by algebra
   1.754 +  with ZI and xJ show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k"
   1.755 +    by fast
   1.756  next
   1.757    fix i j K
   1.758    assume iI: "i \<in> I"
   1.759 -     and jJ: "j \<in> J"
   1.760 -     and idealK: "ideal K R"
   1.761 -     and IK: "I \<subseteq> K"
   1.762 -     and JK: "J \<subseteq> K"
   1.763 -  from iI and IK
   1.764 -     have iK: "i \<in> K" by fast
   1.765 -  from jJ and JK
   1.766 -     have jK: "j \<in> K" by fast
   1.767 -  from iK and jK
   1.768 -     show "i \<oplus> j \<in> K" by (intro additive_subgroup.a_closed) (rule ideal.axioms[OF idealK])
   1.769 +    and jJ: "j \<in> J"
   1.770 +    and idealK: "ideal K R"
   1.771 +    and IK: "I \<subseteq> K"
   1.772 +    and JK: "J \<subseteq> K"
   1.773 +  from iI and IK have iK: "i \<in> K" by fast
   1.774 +  from jJ and JK have jK: "j \<in> K" by fast
   1.775 +  from iK and jK show "i \<oplus> j \<in> K"
   1.776 +    by (intro additive_subgroup.a_closed) (rule ideal.axioms[OF idealK])
   1.777  qed
   1.778  
   1.779  
   1.780  subsection {* Properties of Principal Ideals *}
   1.781  
   1.782  text {* @{text "\<zero>"} generates the zero ideal *}
   1.783 -lemma (in ring) zero_genideal:
   1.784 -  shows "Idl {\<zero>} = {\<zero>}"
   1.785 -apply rule
   1.786 -apply (simp add: genideal_minimal zeroideal)
   1.787 -apply (fast intro!: genideal_self)
   1.788 -done
   1.789 +lemma (in ring) zero_genideal: "Idl {\<zero>} = {\<zero>}"
   1.790 +  apply rule
   1.791 +  apply (simp add: genideal_minimal zeroideal)
   1.792 +  apply (fast intro!: genideal_self)
   1.793 +  done
   1.794  
   1.795  text {* @{text "\<one>"} generates the unit ideal *}
   1.796 -lemma (in ring) one_genideal:
   1.797 -  shows "Idl {\<one>} = carrier R"
   1.798 +lemma (in ring) one_genideal: "Idl {\<one>} = carrier R"
   1.799  proof -
   1.800 -  have "\<one> \<in> Idl {\<one>}" by (simp add: genideal_self')
   1.801 -  thus "Idl {\<one>} = carrier R" by (intro ideal.one_imp_carrier, fast intro: genideal_ideal)
   1.802 +  have "\<one> \<in> Idl {\<one>}"
   1.803 +    by (simp add: genideal_self')
   1.804 +  then show "Idl {\<one>} = carrier R"
   1.805 +    by (intro ideal.one_imp_carrier) (fast intro: genideal_ideal)
   1.806  qed
   1.807  
   1.808  
   1.809  text {* The zero ideal is a principal ideal *}
   1.810 -corollary (in ring) zeropideal:
   1.811 -  shows "principalideal {\<zero>} R"
   1.812 -apply (rule principalidealI)
   1.813 - apply (rule zeroideal)
   1.814 -apply (blast intro!: zero_closed zero_genideal[symmetric])
   1.815 -done
   1.816 +corollary (in ring) zeropideal: "principalideal {\<zero>} R"
   1.817 +  apply (rule principalidealI)
   1.818 +   apply (rule zeroideal)
   1.819 +  apply (blast intro!: zero_genideal[symmetric])
   1.820 +  done
   1.821  
   1.822  text {* The unit ideal is a principal ideal *}
   1.823 -corollary (in ring) onepideal:
   1.824 -  shows "principalideal (carrier R) R"
   1.825 -apply (rule principalidealI)
   1.826 - apply (rule oneideal)
   1.827 -apply (blast intro!: one_closed one_genideal[symmetric])
   1.828 -done
   1.829 +corollary (in ring) onepideal: "principalideal (carrier R) R"
   1.830 +  apply (rule principalidealI)
   1.831 +   apply (rule oneideal)
   1.832 +  apply (blast intro!: one_genideal[symmetric])
   1.833 +  done
   1.834  
   1.835  
   1.836  text {* Every principal ideal is a right coset of the carrier *}
   1.837 @@ -659,28 +629,24 @@
   1.838    shows "\<exists>x\<in>I. I = carrier R #> x"
   1.839  proof -
   1.840    interpret cring R by fact
   1.841 -  from generate
   1.842 -      obtain i
   1.843 -        where icarr: "i \<in> carrier R"
   1.844 -        and I1: "I = Idl {i}"
   1.845 -      by fast+
   1.846 +  from generate obtain i where icarr: "i \<in> carrier R" and I1: "I = Idl {i}"
   1.847 +    by fast+
   1.848  
   1.849 -  from icarr and genideal_self[of "{i}"]
   1.850 -      have "i \<in> Idl {i}" by fast
   1.851 -  hence iI: "i \<in> I" by (simp add: I1)
   1.852 +  from icarr and genideal_self[of "{i}"] have "i \<in> Idl {i}"
   1.853 +    by fast
   1.854 +  then have iI: "i \<in> I" by (simp add: I1)
   1.855  
   1.856 -  from I1 icarr
   1.857 -      have I2: "I = PIdl i" by (simp add: cgenideal_eq_genideal)
   1.858 +  from I1 icarr have I2: "I = PIdl i"
   1.859 +    by (simp add: cgenideal_eq_genideal)
   1.860  
   1.861    have "PIdl i = carrier R #> i"
   1.862 -      unfolding cgenideal_def r_coset_def
   1.863 -      by fast
   1.864 +    unfolding cgenideal_def r_coset_def by fast
   1.865  
   1.866 -  from I2 and this
   1.867 -      have "I = carrier R #> i" by simp
   1.868 +  with I2 have "I = carrier R #> i"
   1.869 +    by simp
   1.870  
   1.871 -  from iI and this
   1.872 -      show "\<exists>x\<in>I. I = carrier R #> x" by fast
   1.873 +  with iI show "\<exists>x\<in>I. I = carrier R #> x"
   1.874 +    by fast
   1.875  qed
   1.876  
   1.877  
   1.878 @@ -693,16 +659,16 @@
   1.879  proof (rule ccontr, clarsimp)
   1.880    interpret cring R by fact
   1.881    assume InR: "carrier R \<noteq> I"
   1.882 -     and "\<forall>a. a \<in> carrier R \<longrightarrow> (\<forall>b. a \<otimes> b \<in> I \<longrightarrow> b \<in> carrier R \<longrightarrow> a \<in> I \<or> b \<in> I)"
   1.883 -  hence I_prime: "\<And> a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I" by simp
   1.884 +    and "\<forall>a. a \<in> carrier R \<longrightarrow> (\<forall>b. a \<otimes> b \<in> I \<longrightarrow> b \<in> carrier R \<longrightarrow> a \<in> I \<or> b \<in> I)"
   1.885 +  then have I_prime: "\<And> a b. \<lbrakk>a \<in> carrier R; b \<in> carrier R; a \<otimes> b \<in> I\<rbrakk> \<Longrightarrow> a \<in> I \<or> b \<in> I"
   1.886 +    by simp
   1.887    have "primeideal I R"
   1.888 -      apply (rule primeideal.intro [OF is_ideal is_cring])
   1.889 -      apply (rule primeideal_axioms.intro)
   1.890 -       apply (rule InR)
   1.891 -      apply (erule (2) I_prime)
   1.892 -      done
   1.893 -  from this and notprime
   1.894 -      show "False" by simp
   1.895 +    apply (rule primeideal.intro [OF is_ideal is_cring])
   1.896 +    apply (rule primeideal_axioms.intro)
   1.897 +     apply (rule InR)
   1.898 +    apply (erule (2) I_prime)
   1.899 +    done
   1.900 +  with notprime show False by simp
   1.901  qed
   1.902  
   1.903  lemma (in ideal) primeidealCE:
   1.904 @@ -721,47 +687,44 @@
   1.905  lemma (in cring) zeroprimeideal_domainI:
   1.906    assumes pi: "primeideal {\<zero>} R"
   1.907    shows "domain R"
   1.908 -apply (rule domain.intro, rule is_cring)
   1.909 -apply (rule domain_axioms.intro)
   1.910 +  apply (rule domain.intro, rule is_cring)
   1.911 +  apply (rule domain_axioms.intro)
   1.912  proof (rule ccontr, simp)
   1.913    interpret primeideal "{\<zero>}" "R" by (rule pi)
   1.914    assume "\<one> = \<zero>"
   1.915 -  hence "carrier R = {\<zero>}" by (rule one_zeroD)
   1.916 -  from this[symmetric] and I_notcarr
   1.917 -      show "False" by simp
   1.918 +  then have "carrier R = {\<zero>}" by (rule one_zeroD)
   1.919 +  from this[symmetric] and I_notcarr show False
   1.920 +    by simp
   1.921  next
   1.922    interpret primeideal "{\<zero>}" "R" by (rule pi)
   1.923    fix a b
   1.924 -  assume ab: "a \<otimes> b = \<zero>"
   1.925 -     and carr: "a \<in> carrier R" "b \<in> carrier R"
   1.926 -  from ab
   1.927 -      have abI: "a \<otimes> b \<in> {\<zero>}" by fast
   1.928 -  from carr and this
   1.929 -      have "a \<in> {\<zero>} \<or> b \<in> {\<zero>}" by (rule I_prime)
   1.930 -  thus "a = \<zero> \<or> b = \<zero>" by simp
   1.931 +  assume ab: "a \<otimes> b = \<zero>" and carr: "a \<in> carrier R" "b \<in> carrier R"
   1.932 +  from ab have abI: "a \<otimes> b \<in> {\<zero>}"
   1.933 +    by fast
   1.934 +  with carr have "a \<in> {\<zero>} \<or> b \<in> {\<zero>}"
   1.935 +    by (rule I_prime)
   1.936 +  then show "a = \<zero> \<or> b = \<zero>" by simp
   1.937  qed
   1.938  
   1.939 -corollary (in cring) domain_eq_zeroprimeideal:
   1.940 -  shows "domain R = primeideal {\<zero>} R"
   1.941 -apply rule
   1.942 - apply (erule domain.zeroprimeideal)
   1.943 -apply (erule zeroprimeideal_domainI)
   1.944 -done
   1.945 +corollary (in cring) domain_eq_zeroprimeideal: "domain R = primeideal {\<zero>} R"
   1.946 +  apply rule
   1.947 +   apply (erule domain.zeroprimeideal)
   1.948 +  apply (erule zeroprimeideal_domainI)
   1.949 +  done
   1.950  
   1.951  
   1.952  subsection {* Maximal Ideals *}
   1.953  
   1.954  lemma (in ideal) helper_I_closed:
   1.955    assumes carr: "a \<in> carrier R" "x \<in> carrier R" "y \<in> carrier R"
   1.956 -      and axI: "a \<otimes> x \<in> I"
   1.957 +    and axI: "a \<otimes> x \<in> I"
   1.958    shows "a \<otimes> (x \<otimes> y) \<in> I"
   1.959  proof -
   1.960 -  from axI and carr
   1.961 -     have "(a \<otimes> x) \<otimes> y \<in> I" by (simp add: I_r_closed)
   1.962 -  also from carr
   1.963 -     have "(a \<otimes> x) \<otimes> y = a \<otimes> (x \<otimes> y)" by (simp add: m_assoc)
   1.964 -  finally
   1.965 -     show "a \<otimes> (x \<otimes> y) \<in> I" .
   1.966 +  from axI and carr have "(a \<otimes> x) \<otimes> y \<in> I"
   1.967 +    by (simp add: I_r_closed)
   1.968 +  also from carr have "(a \<otimes> x) \<otimes> y = a \<otimes> (x \<otimes> y)"
   1.969 +    by (simp add: m_assoc)
   1.970 +  finally show "a \<otimes> (x \<otimes> y) \<in> I" .
   1.971  qed
   1.972  
   1.973  lemma (in ideal) helper_max_prime:
   1.974 @@ -787,19 +750,18 @@
   1.975      have "\<ominus>(a \<otimes> x) \<in> I" by simp
   1.976      also from acarr xcarr
   1.977      have "\<ominus>(a \<otimes> x) = a \<otimes> (\<ominus>x)" by algebra
   1.978 -    finally
   1.979 -    show "a \<otimes> (\<ominus>x) \<in> I" .
   1.980 -    from acarr
   1.981 -    have "a \<otimes> \<zero> = \<zero>" by simp
   1.982 +    finally show "a \<otimes> (\<ominus>x) \<in> I" .
   1.983 +    from acarr have "a \<otimes> \<zero> = \<zero>" by simp
   1.984    next
   1.985      fix x y
   1.986      assume xcarr: "x \<in> carrier R"
   1.987        and ycarr: "y \<in> carrier R"
   1.988        and ayI: "a \<otimes> y \<in> I"
   1.989 -    from ayI and acarr xcarr ycarr
   1.990 -    have "a \<otimes> (y \<otimes> x) \<in> I" by (simp add: helper_I_closed)
   1.991 -    moreover from xcarr ycarr
   1.992 -    have "y \<otimes> x = x \<otimes> y" by (simp add: m_comm)
   1.993 +    from ayI and acarr xcarr ycarr have "a \<otimes> (y \<otimes> x) \<in> I"
   1.994 +      by (simp add: helper_I_closed)
   1.995 +    moreover
   1.996 +    from xcarr ycarr have "y \<otimes> x = x \<otimes> y"
   1.997 +      by (simp add: m_comm)
   1.998      ultimately
   1.999      show "a \<otimes> (x \<otimes> y) \<in> I" by simp
  1.1000    qed
  1.1001 @@ -818,40 +780,36 @@
  1.1002      apply (simp add: I_notcarr)
  1.1003    proof -
  1.1004      assume "\<exists>a b. a \<in> carrier R \<and> b \<in> carrier R \<and> a \<otimes> b \<in> I \<and> a \<notin> I \<and> b \<notin> I"
  1.1005 -    from this
  1.1006 -    obtain a b
  1.1007 -      where acarr: "a \<in> carrier R"
  1.1008 -      and bcarr: "b \<in> carrier R"
  1.1009 -      and abI: "a \<otimes> b \<in> I"
  1.1010 -      and anI: "a \<notin> I"
  1.1011 -      and bnI: "b \<notin> I"
  1.1012 -      by fast
  1.1013 +    then obtain a b where
  1.1014 +      acarr: "a \<in> carrier R" and
  1.1015 +      bcarr: "b \<in> carrier R" and
  1.1016 +      abI: "a \<otimes> b \<in> I" and
  1.1017 +      anI: "a \<notin> I" and
  1.1018 +      bnI: "b \<notin> I" by fast
  1.1019      def J \<equiv> "{x\<in>carrier R. a \<otimes> x \<in> I}"
  1.1020      
  1.1021 -    from is_cring and acarr
  1.1022 -    have idealJ: "ideal J R" unfolding J_def by (rule helper_max_prime)
  1.1023 +    from is_cring and acarr have idealJ: "ideal J R"
  1.1024 +      unfolding J_def by (rule helper_max_prime)
  1.1025      
  1.1026      have IsubJ: "I \<subseteq> J"
  1.1027      proof
  1.1028        fix x
  1.1029        assume xI: "x \<in> I"
  1.1030 -      from this and acarr
  1.1031 -      have "a \<otimes> x \<in> I" by (intro I_l_closed)
  1.1032 -      from xI[THEN a_Hcarr] this
  1.1033 -      show "x \<in> J" unfolding J_def by fast
  1.1034 +      with acarr have "a \<otimes> x \<in> I"
  1.1035 +        by (intro I_l_closed)
  1.1036 +      with xI[THEN a_Hcarr] show "x \<in> J"
  1.1037 +        unfolding J_def by fast
  1.1038      qed
  1.1039      
  1.1040 -    from abI and acarr bcarr
  1.1041 -    have "b \<in> J" unfolding J_def by fast
  1.1042 -    from bnI and this
  1.1043 -    have JnI: "J \<noteq> I" by fast
  1.1044 +    from abI and acarr bcarr have "b \<in> J"
  1.1045 +      unfolding J_def by fast
  1.1046 +    with bnI have JnI: "J \<noteq> I" by fast
  1.1047      from acarr
  1.1048      have "a = a \<otimes> \<one>" by algebra
  1.1049 -    from this and anI
  1.1050 -    have "a \<otimes> \<one> \<notin> I" by simp
  1.1051 -    from one_closed and this
  1.1052 -    have "\<one> \<notin> J" unfolding J_def by fast
  1.1053 -    hence Jncarr: "J \<noteq> carrier R" by fast
  1.1054 +    with anI have "a \<otimes> \<one> \<notin> I" by simp
  1.1055 +    with one_closed have "\<one> \<notin> J"
  1.1056 +      unfolding J_def by fast
  1.1057 +    then have Jncarr: "J \<noteq> carrier R" by fast
  1.1058      
  1.1059      interpret ideal J R by (rule idealJ)
  1.1060      
  1.1061 @@ -862,8 +820,7 @@
  1.1062        apply (rule a_subset)
  1.1063        done
  1.1064      
  1.1065 -    from this and JnI and Jncarr
  1.1066 -    show "False" by simp
  1.1067 +    with JnI and Jncarr show False by simp
  1.1068    qed
  1.1069  qed
  1.1070  
  1.1071 @@ -873,111 +830,93 @@
  1.1072  --"A non-zero cring that has only the two trivial ideals is a field"
  1.1073  lemma (in cring) trivialideals_fieldI:
  1.1074    assumes carrnzero: "carrier R \<noteq> {\<zero>}"
  1.1075 -      and haveideals: "{I. ideal I R} = {{\<zero>}, carrier R}"
  1.1076 +    and haveideals: "{I. ideal I R} = {{\<zero>}, carrier R}"
  1.1077    shows "field R"
  1.1078 -apply (rule cring_fieldI)
  1.1079 -apply (rule, rule, rule)
  1.1080 - apply (erule Units_closed)
  1.1081 -defer 1
  1.1082 -  apply rule
  1.1083 -defer 1
  1.1084 +  apply (rule cring_fieldI)
  1.1085 +  apply (rule, rule, rule)
  1.1086 +   apply (erule Units_closed)
  1.1087 +  defer 1
  1.1088 +    apply rule
  1.1089 +  defer 1
  1.1090  proof (rule ccontr, simp)
  1.1091    assume zUnit: "\<zero> \<in> Units R"
  1.1092 -  hence a: "\<zero> \<otimes> inv \<zero> = \<one>" by (rule Units_r_inv)
  1.1093 -  from zUnit
  1.1094 -      have "\<zero> \<otimes> inv \<zero> = \<zero>" by (intro l_null, rule Units_inv_closed)
  1.1095 -  from a[symmetric] and this
  1.1096 -      have "\<one> = \<zero>" by simp
  1.1097 -  hence "carrier R = {\<zero>}" by (rule one_zeroD)
  1.1098 -  from this and carrnzero
  1.1099 -      show "False" by simp
  1.1100 +  then have a: "\<zero> \<otimes> inv \<zero> = \<one>" by (rule Units_r_inv)
  1.1101 +  from zUnit have "\<zero> \<otimes> inv \<zero> = \<zero>"
  1.1102 +    by (intro l_null) (rule Units_inv_closed)
  1.1103 +  with a[symmetric] have "\<one> = \<zero>" by simp
  1.1104 +  then have "carrier R = {\<zero>}" by (rule one_zeroD)
  1.1105 +  with carrnzero show False by simp
  1.1106  next
  1.1107    fix x
  1.1108    assume xcarr': "x \<in> carrier R - {\<zero>}"
  1.1109 -  hence xcarr: "x \<in> carrier R" by fast
  1.1110 -  from xcarr'
  1.1111 -      have xnZ: "x \<noteq> \<zero>" by fast
  1.1112 -  from xcarr
  1.1113 -      have xIdl: "ideal (PIdl x) R" by (intro cgenideal_ideal, fast)
  1.1114 +  then have xcarr: "x \<in> carrier R" by fast
  1.1115 +  from xcarr' have xnZ: "x \<noteq> \<zero>" by fast
  1.1116 +  from xcarr have xIdl: "ideal (PIdl x) R"
  1.1117 +    by (intro cgenideal_ideal) fast
  1.1118  
  1.1119 -  from xcarr
  1.1120 -      have "x \<in> PIdl x" by (intro cgenideal_self, fast)
  1.1121 -  from this and xnZ
  1.1122 -      have "PIdl x \<noteq> {\<zero>}" by fast
  1.1123 -  from haveideals and this
  1.1124 -      have "PIdl x = carrier R"
  1.1125 -      by (blast intro!: xIdl)
  1.1126 -  hence "\<one> \<in> PIdl x" by simp
  1.1127 -  hence "\<exists>y. \<one> = y \<otimes> x \<and> y \<in> carrier R" unfolding cgenideal_def by blast
  1.1128 -  from this
  1.1129 -      obtain y
  1.1130 -        where ycarr: " y \<in> carrier R"
  1.1131 -        and ylinv: "\<one> = y \<otimes> x"
  1.1132 -      by fast+
  1.1133 -  from ylinv and xcarr ycarr
  1.1134 -      have yrinv: "\<one> = x \<otimes> y" by (simp add: m_comm)
  1.1135 +  from xcarr have "x \<in> PIdl x"
  1.1136 +    by (intro cgenideal_self) fast
  1.1137 +  with xnZ have "PIdl x \<noteq> {\<zero>}" by fast
  1.1138 +  with haveideals have "PIdl x = carrier R"
  1.1139 +    by (blast intro!: xIdl)
  1.1140 +  then have "\<one> \<in> PIdl x" by simp
  1.1141 +  then have "\<exists>y. \<one> = y \<otimes> x \<and> y \<in> carrier R"
  1.1142 +    unfolding cgenideal_def by blast
  1.1143 +  then obtain y where ycarr: " y \<in> carrier R" and ylinv: "\<one> = y \<otimes> x"
  1.1144 +    by fast+
  1.1145 +  from ylinv and xcarr ycarr have yrinv: "\<one> = x \<otimes> y"
  1.1146 +    by (simp add: m_comm)
  1.1147    from ycarr and ylinv[symmetric] and yrinv[symmetric]
  1.1148 -      have "\<exists>y \<in> carrier R. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>" by fast
  1.1149 -  from this and xcarr
  1.1150 -      show "x \<in> Units R"
  1.1151 -      unfolding Units_def
  1.1152 -      by fast
  1.1153 +  have "\<exists>y \<in> carrier R. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>" by fast
  1.1154 +  with xcarr show "x \<in> Units R"
  1.1155 +    unfolding Units_def by fast
  1.1156  qed
  1.1157  
  1.1158 -lemma (in field) all_ideals:
  1.1159 -  shows "{I. ideal I R} = {{\<zero>}, carrier R}"
  1.1160 -apply (rule, rule)
  1.1161 +lemma (in field) all_ideals: "{I. ideal I R} = {{\<zero>}, carrier R}"
  1.1162 +  apply (rule, rule)
  1.1163  proof -
  1.1164    fix I
  1.1165    assume a: "I \<in> {I. ideal I R}"
  1.1166 -  with this
  1.1167 -      interpret ideal I R by simp
  1.1168 +  then interpret ideal I R by simp
  1.1169  
  1.1170    show "I \<in> {{\<zero>}, carrier R}"
  1.1171    proof (cases "\<exists>a. a \<in> I - {\<zero>}")
  1.1172 -    assume "\<exists>a. a \<in> I - {\<zero>}"
  1.1173 -    from this
  1.1174 -        obtain a
  1.1175 -          where aI: "a \<in> I"
  1.1176 -          and anZ: "a \<noteq> \<zero>"
  1.1177 -        by fast+
  1.1178 -    from aI[THEN a_Hcarr] anZ
  1.1179 -        have aUnit: "a \<in> Units R" by (simp add: field_Units)
  1.1180 -    hence a: "a \<otimes> inv a = \<one>" by (rule Units_r_inv)
  1.1181 -    from aI and aUnit
  1.1182 -        have "a \<otimes> inv a \<in> I" by (simp add: I_r_closed del: Units_r_inv)
  1.1183 -    hence oneI: "\<one> \<in> I" by (simp add: a[symmetric])
  1.1184 +    case True
  1.1185 +    then obtain a where aI: "a \<in> I" and anZ: "a \<noteq> \<zero>"
  1.1186 +      by fast+
  1.1187 +    from aI[THEN a_Hcarr] anZ have aUnit: "a \<in> Units R"
  1.1188 +      by (simp add: field_Units)
  1.1189 +    then have a: "a \<otimes> inv a = \<one>" by (rule Units_r_inv)
  1.1190 +    from aI and aUnit have "a \<otimes> inv a \<in> I"
  1.1191 +      by (simp add: I_r_closed del: Units_r_inv)
  1.1192 +    then have oneI: "\<one> \<in> I" by (simp add: a[symmetric])
  1.1193  
  1.1194      have "carrier R \<subseteq> I"
  1.1195      proof
  1.1196        fix x
  1.1197        assume xcarr: "x \<in> carrier R"
  1.1198 -      from oneI and this
  1.1199 -          have "\<one> \<otimes> x \<in> I" by (rule I_r_closed)
  1.1200 -      from this and xcarr
  1.1201 -          show "x \<in> I" by simp
  1.1202 +      with oneI have "\<one> \<otimes> x \<in> I" by (rule I_r_closed)
  1.1203 +      with xcarr show "x \<in> I" by simp
  1.1204      qed
  1.1205 -    from this and a_subset
  1.1206 -        have "I = carrier R" by fast
  1.1207 -    thus "I \<in> {{\<zero>}, carrier R}" by fast
  1.1208 +    with a_subset have "I = carrier R" by fast
  1.1209 +    then show "I \<in> {{\<zero>}, carrier R}" by fast
  1.1210    next
  1.1211 -    assume "\<not> (\<exists>a. a \<in> I - {\<zero>})"
  1.1212 -    hence IZ: "\<And>a. a \<in> I \<Longrightarrow> a = \<zero>" by simp
  1.1213 +    case False
  1.1214 +    then have IZ: "\<And>a. a \<in> I \<Longrightarrow> a = \<zero>" by simp
  1.1215  
  1.1216      have a: "I \<subseteq> {\<zero>}"
  1.1217      proof
  1.1218        fix x
  1.1219        assume "x \<in> I"
  1.1220 -      hence "x = \<zero>" by (rule IZ)
  1.1221 -      thus "x \<in> {\<zero>}" by fast
  1.1222 +      then have "x = \<zero>" by (rule IZ)
  1.1223 +      then show "x \<in> {\<zero>}" by fast
  1.1224      qed
  1.1225  
  1.1226      have "\<zero> \<in> I" by simp
  1.1227 -    hence "{\<zero>} \<subseteq> I" by fast
  1.1228 +    then have "{\<zero>} \<subseteq> I" by fast
  1.1229  
  1.1230 -    from this and a
  1.1231 -        have "I = {\<zero>}" by fast
  1.1232 -    thus "I \<in> {{\<zero>}, carrier R}" by fast
  1.1233 +    with a have "I = {\<zero>}" by fast
  1.1234 +    then show "I \<in> {{\<zero>}, carrier R}" by fast
  1.1235    qed
  1.1236  qed (simp add: zeroideal oneideal)
  1.1237  
  1.1238 @@ -985,52 +924,47 @@
  1.1239  lemma (in cring) trivialideals_eq_field:
  1.1240    assumes carrnzero: "carrier R \<noteq> {\<zero>}"
  1.1241    shows "({I. ideal I R} = {{\<zero>}, carrier R}) = field R"
  1.1242 -by (fast intro!: trivialideals_fieldI[OF carrnzero] field.all_ideals)
  1.1243 +  by (fast intro!: trivialideals_fieldI[OF carrnzero] field.all_ideals)
  1.1244  
  1.1245  
  1.1246  text {* Like zeroprimeideal for domains *}
  1.1247 -lemma (in field) zeromaximalideal:
  1.1248 -  "maximalideal {\<zero>} R"
  1.1249 -apply (rule maximalidealI)
  1.1250 -  apply (rule zeroideal)
  1.1251 +lemma (in field) zeromaximalideal: "maximalideal {\<zero>} R"
  1.1252 +  apply (rule maximalidealI)
  1.1253 +    apply (rule zeroideal)
  1.1254  proof-
  1.1255 -  from one_not_zero
  1.1256 -      have "\<one> \<notin> {\<zero>}" by simp
  1.1257 -  from this and one_closed
  1.1258 -      show "carrier R \<noteq> {\<zero>}" by fast
  1.1259 +  from one_not_zero have "\<one> \<notin> {\<zero>}" by simp
  1.1260 +  with one_closed show "carrier R \<noteq> {\<zero>}" by fast
  1.1261  next
  1.1262    fix J
  1.1263    assume Jideal: "ideal J R"
  1.1264 -  hence "J \<in> {I. ideal I R}"
  1.1265 -      by fast
  1.1266 -
  1.1267 -  from this and all_ideals
  1.1268 -      show "J = {\<zero>} \<or> J = carrier R" by simp
  1.1269 +  then have "J \<in> {I. ideal I R}" by fast
  1.1270 +  with all_ideals show "J = {\<zero>} \<or> J = carrier R"
  1.1271 +    by simp
  1.1272  qed
  1.1273  
  1.1274  lemma (in cring) zeromaximalideal_fieldI:
  1.1275    assumes zeromax: "maximalideal {\<zero>} R"
  1.1276    shows "field R"
  1.1277 -apply (rule trivialideals_fieldI, rule maximalideal.I_notcarr[OF zeromax])
  1.1278 -apply rule apply clarsimp defer 1
  1.1279 - apply (simp add: zeroideal oneideal)
  1.1280 +  apply (rule trivialideals_fieldI, rule maximalideal.I_notcarr[OF zeromax])
  1.1281 +  apply rule apply clarsimp defer 1
  1.1282 +   apply (simp add: zeroideal oneideal)
  1.1283  proof -
  1.1284    fix J
  1.1285    assume Jn0: "J \<noteq> {\<zero>}"
  1.1286 -     and idealJ: "ideal J R"
  1.1287 +    and idealJ: "ideal J R"
  1.1288    interpret ideal J R by (rule idealJ)
  1.1289 -  have "{\<zero>} \<subseteq> J" by (rule ccontr, simp)
  1.1290 +  have "{\<zero>} \<subseteq> J" by (rule ccontr) simp
  1.1291    from zeromax and idealJ and this and a_subset
  1.1292 -      have "J = {\<zero>} \<or> J = carrier R" by (rule maximalideal.I_maximal)
  1.1293 -  from this and Jn0
  1.1294 -      show "J = carrier R" by simp
  1.1295 +  have "J = {\<zero>} \<or> J = carrier R"
  1.1296 +    by (rule maximalideal.I_maximal)
  1.1297 +  with Jn0 show "J = carrier R"
  1.1298 +    by simp
  1.1299  qed
  1.1300  
  1.1301 -lemma (in cring) zeromaximalideal_eq_field:
  1.1302 -  "maximalideal {\<zero>} R = field R"
  1.1303 -apply rule
  1.1304 - apply (erule zeromaximalideal_fieldI)
  1.1305 -apply (erule field.zeromaximalideal)
  1.1306 -done
  1.1307 +lemma (in cring) zeromaximalideal_eq_field: "maximalideal {\<zero>} R = field R"
  1.1308 +  apply rule
  1.1309 +   apply (erule zeromaximalideal_fieldI)
  1.1310 +  apply (erule field.zeromaximalideal)
  1.1311 +  done
  1.1312  
  1.1313  end
     2.1 --- a/src/HOL/Algebra/Ring.thy	Sat Sep 03 21:15:35 2011 +0200
     2.2 +++ b/src/HOL/Algebra/Ring.thy	Sat Sep 03 22:05:25 2011 +0200
     2.3 @@ -367,7 +367,7 @@
     2.4  proof -
     2.5    assume R: "x \<in> carrier R" "y \<in> carrier R"
     2.6    then have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y = (\<ominus> x \<oplus> x) \<otimes> y" by (simp add: l_distr)
     2.7 -  also from R have "... = \<zero>" by (simp add: l_neg l_null)
     2.8 +  also from R have "... = \<zero>" by (simp add: l_neg)
     2.9    finally have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y = \<zero>" .
    2.10    with R have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) = \<zero> \<oplus> \<ominus> (x \<otimes> y)" by simp
    2.11    with R show ?thesis by (simp add: a_assoc r_neg)
    2.12 @@ -378,7 +378,7 @@
    2.13  proof -
    2.14    assume R: "x \<in> carrier R" "y \<in> carrier R"
    2.15    then have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y = x \<otimes> (\<ominus> y \<oplus> y)" by (simp add: r_distr)
    2.16 -  also from R have "... = \<zero>" by (simp add: l_neg r_null)
    2.17 +  also from R have "... = \<zero>" by (simp add: l_neg)
    2.18    finally have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y = \<zero>" .
    2.19    with R have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) = \<zero> \<oplus> \<ominus> (x \<otimes> y)" by simp
    2.20    with R show ?thesis by (simp add: a_assoc r_neg )
    2.21 @@ -464,7 +464,6 @@
    2.22  proof -
    2.23    interpret ring R by fact
    2.24    interpret cring S by fact
    2.25 -ML_val {* Algebra.print_structures @{context} *}
    2.26    from RS show ?thesis by algebra
    2.27  qed
    2.28