src/HOL/Algebra/Ideal.thy
author blanchet
Tue, 09 Aug 2011 09:33:50 +0200
changeset 44092 bf489e54d7f8
parent 41959 b460124855b8
child 44106 0e018cbcc0de
permissions -rw-r--r--
renamed E wrappers for consistency with CASC conventions
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41959
b460124855b8 tuned headers;
wenzelm
parents: 41433
diff changeset
     1
(*  Title:      HOL/Algebra/Ideal.thy
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     2
    Author:     Stephan Hohe, TU Muenchen
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     3
*)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     4
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     5
theory Ideal
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     6
imports Ring AbelCoset
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     7
begin
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     8
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     9
section {* Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    10
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    11
subsection {* Definitions *}
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    12
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    13
subsubsection {* General definition *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    14
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
    15
locale ideal = additive_subgroup I R + ring R for I and R (structure) +
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    16
  assumes I_l_closed: "\<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    17
      and I_r_closed: "\<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    18
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    19
sublocale ideal \<subseteq> abelian_subgroup I R
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    20
apply (intro abelian_subgroupI3 abelian_group.intro)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    21
  apply (rule ideal.axioms, rule ideal_axioms)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    22
 apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    23
apply (rule abelian_group.axioms, rule ring.axioms, rule ideal.axioms, rule ideal_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    24
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    25
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    26
lemma (in ideal) is_ideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    27
  "ideal I R"
26203
9625f3579b48 explicit referencing of background facts;
wenzelm
parents: 23464
diff changeset
    28
by (rule ideal_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    29
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    30
lemma idealI:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    31
  fixes R (structure)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    32
  assumes "ring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    33
  assumes a_subgroup: "subgroup I \<lparr>carrier = carrier R, mult = add R, one = zero R\<rparr>"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    34
      and I_l_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    35
      and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    36
  shows "ideal I R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    37
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    38
  interpret ring R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    39
  show ?thesis  apply (intro ideal.intro ideal_axioms.intro additive_subgroupI)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    40
     apply (rule a_subgroup)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    41
    apply (rule is_ring)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    42
   apply (erule (1) I_l_closed)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    43
  apply (erule (1) I_r_closed)
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    44
  done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    45
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    46
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
    47
30363
9b8d9b6ef803 proper local context for text with antiquotations;
wenzelm
parents: 29240
diff changeset
    48
subsubsection (in ring) {* Ideals Generated by a Subset of @{term "carrier R"} *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    49
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 30729
diff changeset
    50
definition
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    51
  genideal :: "('a, 'b) ring_scheme \<Rightarrow> 'a set \<Rightarrow> 'a set"  ("Idl\<index> _" [80] 79)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    52
  where "genideal R S = Inter {I. ideal I R \<and> S \<subseteq> I}"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    53
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    54
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    55
subsubsection {* Principal Ideals *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    56
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    57
locale principalideal = ideal +
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    58
  assumes generate: "\<exists>i \<in> carrier R. I = Idl {i}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    59
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    60
lemma (in principalideal) is_principalideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    61
  shows "principalideal I R"
26203
9625f3579b48 explicit referencing of background facts;
wenzelm
parents: 23464
diff changeset
    62
by (rule principalideal_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    63
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    64
lemma principalidealI:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    65
  fixes R (structure)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    66
  assumes "ideal I R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    67
  assumes generate: "\<exists>i \<in> carrier R. I = Idl {i}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    68
  shows "principalideal I R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    69
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    70
  interpret ideal I R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    71
  show ?thesis  by (intro principalideal.intro principalideal_axioms.intro) (rule is_ideal, rule generate)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    72
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    73
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
    74
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    75
subsubsection {* Maximal Ideals *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    76
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    77
locale maximalideal = ideal +
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    78
  assumes I_notcarr: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    79
      and I_maximal: "\<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    80
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    81
lemma (in maximalideal) is_maximalideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    82
 shows "maximalideal I R"
26203
9625f3579b48 explicit referencing of background facts;
wenzelm
parents: 23464
diff changeset
    83
by (rule maximalideal_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    84
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    85
lemma maximalidealI:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    86
  fixes R
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    87
  assumes "ideal I R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    88
  assumes I_notcarr: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    89
     and I_maximal: "\<And>J. \<lbrakk>ideal J R; I \<subseteq> J; J \<subseteq> carrier R\<rbrakk> \<Longrightarrow> J = I \<or> J = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    90
  shows "maximalideal I R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    91
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    92
  interpret ideal I R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    93
  show ?thesis by (intro maximalideal.intro maximalideal_axioms.intro)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
    94
    (rule is_ideal, rule I_notcarr, rule I_maximal)
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
    95
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    96
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
    97
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
    98
subsubsection {* Prime Ideals *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    99
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   100
locale primeideal = ideal + cring +
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   101
  assumes I_notcarr: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   102
      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"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   103
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   104
lemma (in primeideal) is_primeideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   105
 shows "primeideal I R"
26203
9625f3579b48 explicit referencing of background facts;
wenzelm
parents: 23464
diff changeset
   106
by (rule primeideal_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   107
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   108
lemma primeidealI:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   109
  fixes R (structure)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   110
  assumes "ideal I R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   111
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   112
  assumes I_notcarr: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   113
      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"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   114
  shows "primeideal I R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   115
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   116
  interpret ideal I R by fact
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   117
  interpret cring R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   118
  show ?thesis by (intro primeideal.intro primeideal_axioms.intro)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
   119
    (rule is_ideal, rule is_cring, rule I_notcarr, rule I_prime)
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   120
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   121
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   122
lemma primeidealI2:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   123
  fixes R (structure)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   124
  assumes "additive_subgroup I R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   125
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   126
  assumes I_l_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> x \<otimes> a \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   127
      and I_r_closed: "\<And>a x. \<lbrakk>a \<in> I; x \<in> carrier R\<rbrakk> \<Longrightarrow> a \<otimes> x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   128
      and I_notcarr: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   129
      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"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   130
  shows "primeideal I R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   131
proof -
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
   132
  interpret additive_subgroup I R by fact
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   133
  interpret cring R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   134
  show ?thesis apply (intro_locales)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   135
    apply (intro ideal_axioms.intro)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   136
    apply (erule (1) I_l_closed)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   137
    apply (erule (1) I_r_closed)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   138
    apply (intro primeideal_axioms.intro)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   139
    apply (rule I_notcarr)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   140
    apply (erule (2) I_prime)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   141
    done
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   142
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   143
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
   144
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   145
subsection {* Special Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   146
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   147
lemma (in ring) zeroideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   148
  shows "ideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   149
apply (intro idealI subgroup.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   150
      apply (rule is_ring)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   151
     apply simp+
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   152
  apply (fold a_inv_def, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   153
 apply simp+
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   154
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   155
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   156
lemma (in ring) oneideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   157
  shows "ideal (carrier R) R"
41433
1b8ff770f02c Abelian group facts obtained from group facts via interpretation (sublocale).
ballarin
parents: 35849
diff changeset
   158
  by (rule idealI) (auto intro: is_ring add.subgroupI)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   159
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   160
lemma (in "domain") zeroprimeideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   161
 shows "primeideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   162
apply (intro primeidealI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   163
   apply (rule zeroideal)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
   164
  apply (rule domain.axioms, rule domain_axioms)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   165
 defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   166
 apply (simp add: integral)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   167
proof (rule ccontr, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   168
  assume "carrier R = {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   169
  from this have "\<one> = \<zero>" by (rule one_zeroI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   170
  from this and one_not_zero
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   171
      show "False" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   172
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   173
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   174
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   175
subsection {* General Ideal Properies *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   176
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   177
lemma (in ideal) one_imp_carrier:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   178
  assumes I_one_closed: "\<one> \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   179
  shows "I = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   180
apply (rule)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   181
apply (rule)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   182
apply (rule a_Hcarr, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   183
proof
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   184
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   185
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   186
  from I_one_closed and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   187
      have "x \<otimes> \<one> \<in> I" by (intro I_l_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   188
  from this and xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   189
      show "x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   190
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   191
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   192
lemma (in ideal) Icarr:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   193
  assumes iI: "i \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   194
  shows "i \<in> carrier R"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 20318
diff changeset
   195
using iI by (rule a_Hcarr)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   196
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   197
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   198
subsection {* Intersection of Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   199
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   200
text {* \paragraph{Intersection of two ideals} The intersection of any
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   201
  two ideals is again an ideal in @{term R} *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   202
lemma (in ring) i_intersect:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   203
  assumes "ideal I R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   204
  assumes "ideal J R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   205
  shows "ideal (I \<inter> J) R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   206
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   207
  interpret ideal I R by fact
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
   208
  interpret ideal J R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   209
  show ?thesis
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   210
apply (intro idealI subgroup.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   211
      apply (rule is_ring)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   212
     apply (force simp add: a_subset)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   213
    apply (simp add: a_inv_def[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   214
   apply simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   215
  apply (simp add: a_inv_def[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   216
 apply (clarsimp, rule)
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27698
diff changeset
   217
  apply (fast intro: ideal.I_l_closed ideal.intro assms)+
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   218
apply (clarsimp, rule)
27714
27b4d7c01f8b Tuned (for the sake of a meaningless log entry).
ballarin
parents: 27698
diff changeset
   219
 apply (fast intro: ideal.I_r_closed ideal.intro assms)+
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   220
done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   221
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   222
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   223
text {* The intersection of any Number of Ideals is again
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   224
        an Ideal in @{term R} *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   225
lemma (in ring) i_Intersect:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   226
  assumes Sideals: "\<And>I. I \<in> S \<Longrightarrow> ideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   227
    and notempty: "S \<noteq> {}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   228
  shows "ideal (Inter S) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   229
apply (unfold_locales)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   230
apply (simp_all add: Inter_def INTER_def)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   231
      apply (rule, simp) defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   232
      apply rule defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   233
      apply rule defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   234
      apply (fold a_inv_def, rule) defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   235
      apply rule defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   236
      apply rule defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   237
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   238
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   239
  assume "\<forall>I\<in>S. x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   240
  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   241
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   242
  from notempty have "\<exists>I0. I0 \<in> S" by blast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   243
  from this obtain I0 where I0S: "I0 \<in> S" by auto
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   244
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   245
  interpret ideal I0 R by (rule Sideals[OF I0S])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   246
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   247
  from xI[OF I0S] have "x \<in> I0" .
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   248
  from this and a_subset show "x \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   249
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   250
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   251
  assume "\<forall>I\<in>S. x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   252
  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   253
  assume "\<forall>I\<in>S. y \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   254
  hence yI: "\<And>I. I \<in> S \<Longrightarrow> y \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   255
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   256
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   257
  assume JS: "J \<in> S"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   258
  interpret ideal J R by (rule Sideals[OF JS])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   259
  from xI[OF JS] and yI[OF JS]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   260
      show "x \<oplus> y \<in> J" by (rule a_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   261
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   262
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   263
  assume JS: "J \<in> S"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   264
  interpret ideal J R by (rule Sideals[OF JS])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   265
  show "\<zero> \<in> J" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   266
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   267
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   268
  assume "\<forall>I\<in>S. x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   269
  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   270
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   271
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   272
  assume JS: "J \<in> S"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   273
  interpret ideal J R by (rule Sideals[OF JS])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   274
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   275
  from xI[OF JS]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   276
      show "\<ominus> x \<in> J" by (rule a_inv_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   277
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   278
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   279
  assume "\<forall>I\<in>S. x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   280
  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   281
  assume ycarr: "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   282
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   283
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   284
  assume JS: "J \<in> S"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   285
  interpret ideal J R by (rule Sideals[OF JS])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   286
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   287
  from xI[OF JS] and ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   288
      show "y \<otimes> x \<in> J" by (rule I_l_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   289
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   290
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   291
  assume "\<forall>I\<in>S. x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   292
  hence xI: "\<And>I. I \<in> S \<Longrightarrow> x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   293
  assume ycarr: "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   294
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   295
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   296
  assume JS: "J \<in> S"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   297
  interpret ideal J R by (rule Sideals[OF JS])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   298
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   299
  from xI[OF JS] and ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   300
      show "x \<otimes> y \<in> J" by (rule I_r_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   301
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   302
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   303
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   304
subsection {* Addition of Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   305
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   306
lemma (in ring) add_ideals:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   307
  assumes idealI: "ideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   308
      and idealJ: "ideal J R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   309
  shows "ideal (I <+> J) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   310
apply (rule ideal.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   311
  apply (rule add_additive_subgroups)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   312
   apply (intro ideal.axioms[OF idealI])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   313
  apply (intro ideal.axioms[OF idealJ])
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
   314
 apply (rule is_ring)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   315
apply (rule ideal_axioms.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   316
 apply (simp add: set_add_defs, clarsimp) defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   317
 apply (simp add: set_add_defs, clarsimp) defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   318
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   319
  fix x i j
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   320
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   321
     and iI: "i \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   322
     and jJ: "j \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   323
  from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   324
      have c: "(i \<oplus> j) \<otimes> x = (i \<otimes> x) \<oplus> (j \<otimes> x)" by algebra
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   325
  from xcarr and iI
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   326
      have a: "i \<otimes> x \<in> I" by (simp add: ideal.I_r_closed[OF idealI])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   327
  from xcarr and jJ
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   328
      have b: "j \<otimes> x \<in> J" by (simp add: ideal.I_r_closed[OF idealJ])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   329
  from a b c
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   330
      show "\<exists>ha\<in>I. \<exists>ka\<in>J. (i \<oplus> j) \<otimes> x = ha \<oplus> ka" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   331
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   332
  fix x i j
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   333
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   334
     and iI: "i \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   335
     and jJ: "j \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   336
  from xcarr ideal.Icarr[OF idealI iI] ideal.Icarr[OF idealJ jJ]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   337
      have c: "x \<otimes> (i \<oplus> j) = (x \<otimes> i) \<oplus> (x \<otimes> j)" by algebra
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   338
  from xcarr and iI
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   339
      have a: "x \<otimes> i \<in> I" by (simp add: ideal.I_l_closed[OF idealI])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   340
  from xcarr and jJ
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   341
      have b: "x \<otimes> j \<in> J" by (simp add: ideal.I_l_closed[OF idealJ])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   342
  from a b c
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   343
      show "\<exists>ha\<in>I. \<exists>ka\<in>J. x \<otimes> (i \<oplus> j) = ha \<oplus> ka" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   344
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   345
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   346
30363
9b8d9b6ef803 proper local context for text with antiquotations;
wenzelm
parents: 29240
diff changeset
   347
subsection (in ring) {* Ideals generated by a subset of @{term "carrier R"} *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   348
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   349
text {* @{term genideal} generates an ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   350
lemma (in ring) genideal_ideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   351
  assumes Scarr: "S \<subseteq> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   352
  shows "ideal (Idl S) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   353
unfolding genideal_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   354
proof (rule i_Intersect, fast, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   355
  from oneideal and Scarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   356
  show "\<exists>I. ideal I R \<and> S \<le> I" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   357
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   358
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   359
lemma (in ring) genideal_self:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   360
  assumes "S \<subseteq> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   361
  shows "S \<subseteq> Idl S"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   362
unfolding genideal_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   363
by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   364
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   365
lemma (in ring) genideal_self':
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   366
  assumes carr: "i \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   367
  shows "i \<in> Idl {i}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   368
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   369
  from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   370
      have "{i} \<subseteq> Idl {i}" by (fast intro!: genideal_self)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   371
  thus "i \<in> Idl {i}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   372
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   373
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   374
text {* @{term genideal} generates the minimal ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   375
lemma (in ring) genideal_minimal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   376
  assumes a: "ideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   377
      and b: "S \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   378
  shows "Idl S \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   379
unfolding genideal_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   380
by (rule, elim InterD, simp add: a b)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   381
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   382
text {* Generated ideals and subsets *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   383
lemma (in ring) Idl_subset_ideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   384
  assumes Iideal: "ideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   385
      and Hcarr: "H \<subseteq> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   386
  shows "(Idl H \<subseteq> I) = (H \<subseteq> I)"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   387
proof
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   388
  assume a: "Idl H \<subseteq> I"
23350
50c5b0912a0c tuned proofs: avoid implicit prems;
wenzelm
parents: 20318
diff changeset
   389
  from Hcarr have "H \<subseteq> Idl H" by (rule genideal_self)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   390
  from this and a
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   391
      show "H \<subseteq> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   392
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   393
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   394
  assume HI: "H \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   395
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   396
  from Iideal and HI
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   397
      have "I \<in> {I. ideal I R \<and> H \<subseteq> I}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   398
  from this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   399
      show "Idl H \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   400
      unfolding genideal_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   401
      by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   402
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   403
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   404
lemma (in ring) subset_Idl_subset:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   405
  assumes Icarr: "I \<subseteq> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   406
      and HI: "H \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   407
  shows "Idl H \<subseteq> Idl I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   408
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   409
  from HI and genideal_self[OF Icarr] 
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   410
      have HIdlI: "H \<subseteq> Idl I" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   411
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   412
  from Icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   413
      have Iideal: "ideal (Idl I) R" by (rule genideal_ideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   414
  from HI and Icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   415
      have "H \<subseteq> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   416
  from Iideal and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   417
      have "(H \<subseteq> Idl I) = (Idl H \<subseteq> Idl I)"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   418
      by (rule Idl_subset_ideal[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   419
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   420
  from HIdlI and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   421
      show "Idl H \<subseteq> Idl I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   422
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   423
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   424
lemma (in ring) Idl_subset_ideal':
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   425
  assumes acarr: "a \<in> carrier R" and bcarr: "b \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   426
  shows "(Idl {a} \<subseteq> Idl {b}) = (a \<in> Idl {b})"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   427
apply (subst Idl_subset_ideal[OF genideal_ideal[of "{b}"], of "{a}"])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   428
  apply (fast intro: bcarr, fast intro: acarr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   429
apply fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   430
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   431
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   432
lemma (in ring) genideal_zero:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   433
  "Idl {\<zero>} = {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   434
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   435
 apply (rule genideal_minimal[OF zeroideal], simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   436
apply (simp add: genideal_self')
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   437
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   438
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   439
lemma (in ring) genideal_one:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   440
  "Idl {\<one>} = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   441
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   442
  interpret ideal "Idl {\<one>}" "R" by (rule genideal_ideal, fast intro: one_closed)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   443
  show "Idl {\<one>} = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   444
  apply (rule, rule a_subset)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   445
  apply (simp add: one_imp_carrier genideal_self')
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   446
  done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   447
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   448
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   449
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
   450
text {* Generation of Principal Ideals in Commutative Rings *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   451
35847
19f1f7066917 eliminated old constdefs;
wenzelm
parents: 30729
diff changeset
   452
definition
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   453
  cgenideal :: "('a, 'b) monoid_scheme \<Rightarrow> 'a \<Rightarrow> 'a set"  ("PIdl\<index> _" [80] 79)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
   454
  where "cgenideal R a = {x \<otimes>\<^bsub>R\<^esub> a | x. x \<in> carrier R}"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   455
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   456
text {* genhideal (?) really generates an ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   457
lemma (in cring) cgenideal_ideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   458
  assumes acarr: "a \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   459
  shows "ideal (PIdl a) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   460
apply (unfold cgenideal_def)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   461
apply (rule idealI[OF is_ring])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   462
   apply (rule subgroup.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   463
      apply (simp_all add: monoid_record_simps)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   464
      apply (blast intro: acarr m_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   465
      apply clarsimp defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   466
      defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   467
      apply (fold a_inv_def, clarsimp) defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   468
      apply clarsimp defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   469
      apply clarsimp defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   470
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   471
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   472
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   473
     and ycarr: "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   474
  note carr = acarr xcarr ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   475
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   476
  from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   477
      have "x \<otimes> a \<oplus> y \<otimes> a = (x \<oplus> y) \<otimes> a" by (simp add: l_distr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   478
  from this and carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   479
      show "\<exists>z. x \<otimes> a \<oplus> y \<otimes> a = z \<otimes> a \<and> z \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   480
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   481
  from l_null[OF acarr, symmetric] and zero_closed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   482
      show "\<exists>x. \<zero> = x \<otimes> a \<and> x \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   483
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   484
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   485
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   486
  note carr = acarr xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   487
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   488
  from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   489
      have "\<ominus> (x \<otimes> a) = (\<ominus> x) \<otimes> a" by (simp add: l_minus)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   490
  from this and carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   491
      show "\<exists>z. \<ominus> (x \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   492
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   493
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   494
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   495
     and ycarr: "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   496
  note carr = acarr xcarr ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   497
  
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   498
  from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   499
      have "y \<otimes> a \<otimes> x = (y \<otimes> x) \<otimes> a" by (simp add: m_assoc, simp add: m_comm)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   500
  from this and carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   501
      show "\<exists>z. y \<otimes> a \<otimes> x = z \<otimes> a \<and> z \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   502
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   503
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   504
  assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   505
     and ycarr: "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   506
  note carr = acarr xcarr ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   507
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   508
  from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   509
      have "x \<otimes> (y \<otimes> a) = (x \<otimes> y) \<otimes> a" by (simp add: m_assoc)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   510
  from this and carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   511
      show "\<exists>z. x \<otimes> (y \<otimes> a) = z \<otimes> a \<and> z \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   512
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   513
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   514
lemma (in ring) cgenideal_self:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   515
  assumes icarr: "i \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   516
  shows "i \<in> PIdl i"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   517
unfolding cgenideal_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   518
proof simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   519
  from icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   520
      have "i = \<one> \<otimes> i" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   521
  from this and icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   522
      show "\<exists>x. i = x \<otimes> i \<and> x \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   523
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   524
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   525
text {* @{const "cgenideal"} is minimal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   526
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   527
lemma (in ring) cgenideal_minimal:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   528
  assumes "ideal J R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   529
  assumes aJ: "a \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   530
  shows "PIdl a \<subseteq> J"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   531
proof -
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
   532
  interpret ideal J R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   533
  show ?thesis unfolding cgenideal_def
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   534
    apply rule
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   535
    apply clarify
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   536
    using aJ
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   537
    apply (erule I_l_closed)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   538
    done
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   539
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   540
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   541
lemma (in cring) cgenideal_eq_genideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   542
  assumes icarr: "i \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   543
  shows "PIdl i = Idl {i}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   544
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   545
 apply (intro cgenideal_minimal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   546
  apply (rule genideal_ideal, fast intro: icarr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   547
 apply (rule genideal_self', fast intro: icarr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   548
apply (intro genideal_minimal)
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
   549
 apply (rule cgenideal_ideal [OF icarr])
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23383
diff changeset
   550
apply (simp, rule cgenideal_self [OF icarr])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   551
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   552
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   553
lemma (in cring) cgenideal_eq_rcos:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   554
 "PIdl i = carrier R #> i"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   555
unfolding cgenideal_def r_coset_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   556
by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   557
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   558
lemma (in cring) cgenideal_is_principalideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   559
  assumes icarr: "i \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   560
  shows "principalideal (PIdl i) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   561
apply (rule principalidealI)
23464
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   562
apply (rule cgenideal_ideal [OF icarr])
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   563
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   564
  from icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   565
      have "PIdl i = Idl {i}" by (rule cgenideal_eq_genideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   566
  from icarr and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   567
      show "\<exists>i'\<in>carrier R. PIdl i = Idl {i'}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   568
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   569
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   570
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   571
subsection {* Union of Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   572
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   573
lemma (in ring) union_genideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   574
  assumes idealI: "ideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   575
      and idealJ: "ideal J R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   576
  shows "Idl (I \<union> J) = I <+> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   577
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   578
 apply (rule ring.genideal_minimal)
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
   579
   apply (rule is_ring)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   580
  apply (rule add_ideals[OF idealI idealJ])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   581
 apply (rule)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   582
 apply (simp add: set_add_defs) apply (elim disjE) defer 1 defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   583
 apply (rule) apply (simp add: set_add_defs genideal_def) apply clarsimp defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   584
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   585
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   586
  assume xI: "x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   587
  have ZJ: "\<zero> \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   588
      by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealJ])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   589
  from ideal.Icarr[OF idealI xI]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   590
      have "x = x \<oplus> \<zero>" by algebra
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   591
  from xI and ZJ and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   592
      show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   593
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   594
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   595
  assume xJ: "x \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   596
  have ZI: "\<zero> \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   597
      by (intro additive_subgroup.zero_closed, rule ideal.axioms[OF idealI])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   598
  from ideal.Icarr[OF idealJ xJ]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   599
      have "x = \<zero> \<oplus> x" by algebra
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   600
  from ZI and xJ and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   601
      show "\<exists>h\<in>I. \<exists>k\<in>J. x = h \<oplus> k" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   602
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   603
  fix i j K
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   604
  assume iI: "i \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   605
     and jJ: "j \<in> J"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   606
     and idealK: "ideal K R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   607
     and IK: "I \<subseteq> K"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   608
     and JK: "J \<subseteq> K"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   609
  from iI and IK
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   610
     have iK: "i \<in> K" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   611
  from jJ and JK
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   612
     have jK: "j \<in> K" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   613
  from iK and jK
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   614
     show "i \<oplus> j \<in> K" by (intro additive_subgroup.a_closed) (rule ideal.axioms[OF idealK])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   615
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   616
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   617
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   618
subsection {* Properties of Principal Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   619
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   620
text {* @{text "\<zero>"} generates the zero ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   621
lemma (in ring) zero_genideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   622
  shows "Idl {\<zero>} = {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   623
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   624
apply (simp add: genideal_minimal zeroideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   625
apply (fast intro!: genideal_self)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   626
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   627
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   628
text {* @{text "\<one>"} generates the unit ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   629
lemma (in ring) one_genideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   630
  shows "Idl {\<one>} = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   631
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   632
  have "\<one> \<in> Idl {\<one>}" by (simp add: genideal_self')
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   633
  thus "Idl {\<one>} = carrier R" by (intro ideal.one_imp_carrier, fast intro: genideal_ideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   634
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   635
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   636
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   637
text {* The zero ideal is a principal ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   638
corollary (in ring) zeropideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   639
  shows "principalideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   640
apply (rule principalidealI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   641
 apply (rule zeroideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   642
apply (blast intro!: zero_closed zero_genideal[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   643
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   644
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   645
text {* The unit ideal is a principal ideal *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   646
corollary (in ring) onepideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   647
  shows "principalideal (carrier R) R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   648
apply (rule principalidealI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   649
 apply (rule oneideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   650
apply (blast intro!: one_closed one_genideal[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   651
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   652
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   653
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   654
text {* Every principal ideal is a right coset of the carrier *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   655
lemma (in principalideal) rcos_generate:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   656
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   657
  shows "\<exists>x\<in>I. I = carrier R #> x"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   658
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   659
  interpret cring R by fact
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   660
  from generate
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   661
      obtain i
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   662
        where icarr: "i \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   663
        and I1: "I = Idl {i}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   664
      by fast+
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   665
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   666
  from icarr and genideal_self[of "{i}"]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   667
      have "i \<in> Idl {i}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   668
  hence iI: "i \<in> I" by (simp add: I1)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   669
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   670
  from I1 icarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   671
      have I2: "I = PIdl i" by (simp add: cgenideal_eq_genideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   672
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   673
  have "PIdl i = carrier R #> i"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   674
      unfolding cgenideal_def r_coset_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   675
      by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   676
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   677
  from I2 and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   678
      have "I = carrier R #> i" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   679
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   680
  from iI and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   681
      show "\<exists>x\<in>I. I = carrier R #> x" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   682
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   683
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   684
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   685
subsection {* Prime Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   686
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   687
lemma (in ideal) primeidealCD:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   688
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   689
  assumes notprime: "\<not> primeideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   690
  shows "carrier R = I \<or> (\<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)"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   691
proof (rule ccontr, clarsimp)
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   692
  interpret cring R by fact
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   693
  assume InR: "carrier R \<noteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   694
     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)"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   695
  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
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   696
  have "primeideal I R"
23464
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   697
      apply (rule primeideal.intro [OF is_ideal is_cring])
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   698
      apply (rule primeideal_axioms.intro)
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   699
       apply (rule InR)
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   700
      apply (erule (2) I_prime)
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   701
      done
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   702
  from this and notprime
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   703
      show "False" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   704
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   705
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   706
lemma (in ideal) primeidealCE:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   707
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   708
  assumes notprime: "\<not> primeideal I R"
23383
5460951833fa tuned proofs: avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   709
  obtains "carrier R = I"
5460951833fa tuned proofs: avoid implicit prems;
wenzelm
parents: 23350
diff changeset
   710
    | "\<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"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   711
proof -
30729
461ee3e49ad3 interpretation/interpret: prefixes are mandatory by default;
wenzelm
parents: 30363
diff changeset
   712
  interpret R: cring R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   713
  assume "carrier R = I ==> thesis"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   714
    and "\<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 \<Longrightarrow> thesis"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   715
  then show thesis using primeidealCD [OF R.is_cring notprime] by blast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   716
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   717
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   718
text {* If @{text "{\<zero>}"} is a prime ideal of a commutative ring, the ring is a domain *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   719
lemma (in cring) zeroprimeideal_domainI:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   720
  assumes pi: "primeideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   721
  shows "domain R"
23464
bc2563c37b1a tuned proofs -- avoid implicit prems;
wenzelm
parents: 23463
diff changeset
   722
apply (rule domain.intro, rule is_cring)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   723
apply (rule domain_axioms.intro)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   724
proof (rule ccontr, simp)
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   725
  interpret primeideal "{\<zero>}" "R" by (rule pi)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   726
  assume "\<one> = \<zero>"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   727
  hence "carrier R = {\<zero>}" by (rule one_zeroD)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   728
  from this[symmetric] and I_notcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   729
      show "False" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   730
next
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   731
  interpret primeideal "{\<zero>}" "R" by (rule pi)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   732
  fix a b
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   733
  assume ab: "a \<otimes> b = \<zero>"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   734
     and carr: "a \<in> carrier R" "b \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   735
  from ab
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   736
      have abI: "a \<otimes> b \<in> {\<zero>}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   737
  from carr and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   738
      have "a \<in> {\<zero>} \<or> b \<in> {\<zero>}" by (rule I_prime)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   739
  thus "a = \<zero> \<or> b = \<zero>" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   740
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   741
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   742
corollary (in cring) domain_eq_zeroprimeideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   743
  shows "domain R = primeideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   744
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   745
 apply (erule domain.zeroprimeideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   746
apply (erule zeroprimeideal_domainI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   747
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   748
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   749
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   750
subsection {* Maximal Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   751
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   752
lemma (in ideal) helper_I_closed:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   753
  assumes carr: "a \<in> carrier R" "x \<in> carrier R" "y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   754
      and axI: "a \<otimes> x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   755
  shows "a \<otimes> (x \<otimes> y) \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   756
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   757
  from axI and carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   758
     have "(a \<otimes> x) \<otimes> y \<in> I" by (simp add: I_r_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   759
  also from carr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   760
     have "(a \<otimes> x) \<otimes> y = a \<otimes> (x \<otimes> y)" by (simp add: m_assoc)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   761
  finally
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   762
     show "a \<otimes> (x \<otimes> y) \<in> I" .
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   763
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   764
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   765
lemma (in ideal) helper_max_prime:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   766
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   767
  assumes acarr: "a \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   768
  shows "ideal {x\<in>carrier R. a \<otimes> x \<in> I} R"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   769
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   770
  interpret cring R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   771
  show ?thesis apply (rule idealI)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   772
    apply (rule cring.axioms[OF is_cring])
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   773
    apply (rule subgroup.intro)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   774
    apply (simp, fast)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   775
    apply clarsimp apply (simp add: r_distr acarr)
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   776
    apply (simp add: acarr)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   777
    apply (simp add: a_inv_def[symmetric], clarify) defer 1
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   778
    apply clarsimp defer 1
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   779
    apply (fast intro!: helper_I_closed acarr)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   780
  proof -
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   781
    fix x
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   782
    assume xcarr: "x \<in> carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   783
      and ax: "a \<otimes> x \<in> I"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   784
    from ax and acarr xcarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   785
    have "\<ominus>(a \<otimes> x) \<in> I" by simp
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   786
    also from acarr xcarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   787
    have "\<ominus>(a \<otimes> x) = a \<otimes> (\<ominus>x)" by algebra
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   788
    finally
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   789
    show "a \<otimes> (\<ominus>x) \<in> I" .
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   790
    from acarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   791
    have "a \<otimes> \<zero> = \<zero>" by simp
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   792
  next
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   793
    fix x y
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   794
    assume xcarr: "x \<in> carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   795
      and ycarr: "y \<in> carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   796
      and ayI: "a \<otimes> y \<in> I"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   797
    from ayI and acarr xcarr ycarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   798
    have "a \<otimes> (y \<otimes> x) \<in> I" by (simp add: helper_I_closed)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   799
    moreover from xcarr ycarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   800
    have "y \<otimes> x = x \<otimes> y" by (simp add: m_comm)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   801
    ultimately
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   802
    show "a \<otimes> (x \<otimes> y) \<in> I" by simp
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   803
  qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   804
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   805
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   806
text {* In a cring every maximal ideal is prime *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   807
lemma (in cring) maximalideal_is_prime:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   808
  assumes "maximalideal I R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   809
  shows "primeideal I R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   810
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   811
  interpret maximalideal I R by fact
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   812
  show ?thesis apply (rule ccontr)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   813
    apply (rule primeidealCE)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   814
    apply (rule is_cring)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   815
    apply assumption
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   816
    apply (simp add: I_notcarr)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   817
  proof -
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   818
    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"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   819
    from this
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   820
    obtain a b
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   821
      where acarr: "a \<in> carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   822
      and bcarr: "b \<in> carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   823
      and abI: "a \<otimes> b \<in> I"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   824
      and anI: "a \<notin> I"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   825
      and bnI: "b \<notin> I"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   826
      by fast
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   827
    def J \<equiv> "{x\<in>carrier R. a \<otimes> x \<in> I}"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   828
    
29240
bb81c3709fb6 More porting to new locales.
ballarin
parents: 29237
diff changeset
   829
    from is_cring and acarr
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   830
    have idealJ: "ideal J R" unfolding J_def by (rule helper_max_prime)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   831
    
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   832
    have IsubJ: "I \<subseteq> J"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   833
    proof
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   834
      fix x
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   835
      assume xI: "x \<in> I"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   836
      from this and acarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   837
      have "a \<otimes> x \<in> I" by (intro I_l_closed)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   838
      from xI[THEN a_Hcarr] this
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   839
      show "x \<in> J" unfolding J_def by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   840
    qed
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   841
    
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   842
    from abI and acarr bcarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   843
    have "b \<in> J" unfolding J_def by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   844
    from bnI and this
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   845
    have JnI: "J \<noteq> I" by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   846
    from acarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   847
    have "a = a \<otimes> \<one>" by algebra
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   848
    from this and anI
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   849
    have "a \<otimes> \<one> \<notin> I" by simp
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   850
    from one_closed and this
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   851
    have "\<one> \<notin> J" unfolding J_def by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   852
    hence Jncarr: "J \<noteq> carrier R" by fast
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   853
    
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   854
    interpret ideal J R by (rule idealJ)
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   855
    
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   856
    have "J = I \<or> J = carrier R"
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   857
      apply (intro I_maximal)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   858
      apply (rule idealJ)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   859
      apply (rule IsubJ)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   860
      apply (rule a_subset)
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   861
      done
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   862
    
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   863
    from this and JnI and Jncarr
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 26203
diff changeset
   864
    show "False" by simp
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   865
  qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   866
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   867
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
   868
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27714
diff changeset
   869
subsection {* Derived Theorems *}
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   870
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   871
--"A non-zero cring that has only the two trivial ideals is a field"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   872
lemma (in cring) trivialideals_fieldI:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   873
  assumes carrnzero: "carrier R \<noteq> {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   874
      and haveideals: "{I. ideal I R} = {{\<zero>}, carrier R}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   875
  shows "field R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   876
apply (rule cring_fieldI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   877
apply (rule, rule, rule)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   878
 apply (erule Units_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   879
defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   880
  apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   881
defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   882
proof (rule ccontr, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   883
  assume zUnit: "\<zero> \<in> Units R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   884
  hence a: "\<zero> \<otimes> inv \<zero> = \<one>" by (rule Units_r_inv)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   885
  from zUnit
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   886
      have "\<zero> \<otimes> inv \<zero> = \<zero>" by (intro l_null, rule Units_inv_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   887
  from a[symmetric] and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   888
      have "\<one> = \<zero>" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   889
  hence "carrier R = {\<zero>}" by (rule one_zeroD)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   890
  from this and carrnzero
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   891
      show "False" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   892
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   893
  fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   894
  assume xcarr': "x \<in> carrier R - {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   895
  hence xcarr: "x \<in> carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   896
  from xcarr'
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   897
      have xnZ: "x \<noteq> \<zero>" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   898
  from xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   899
      have xIdl: "ideal (PIdl x) R" by (intro cgenideal_ideal, fast)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   900
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   901
  from xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   902
      have "x \<in> PIdl x" by (intro cgenideal_self, fast)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   903
  from this and xnZ
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   904
      have "PIdl x \<noteq> {\<zero>}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   905
  from haveideals and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   906
      have "PIdl x = carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   907
      by (blast intro!: xIdl)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   908
  hence "\<one> \<in> PIdl x" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   909
  hence "\<exists>y. \<one> = y \<otimes> x \<and> y \<in> carrier R" unfolding cgenideal_def by blast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   910
  from this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   911
      obtain y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   912
        where ycarr: " y \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   913
        and ylinv: "\<one> = y \<otimes> x"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   914
      by fast+
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   915
  from ylinv and xcarr ycarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   916
      have yrinv: "\<one> = x \<otimes> y" by (simp add: m_comm)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   917
  from ycarr and ylinv[symmetric] and yrinv[symmetric]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   918
      have "\<exists>y \<in> carrier R. y \<otimes> x = \<one> \<and> x \<otimes> y = \<one>" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   919
  from this and xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   920
      show "x \<in> Units R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   921
      unfolding Units_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   922
      by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   923
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   924
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   925
lemma (in field) all_ideals:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   926
  shows "{I. ideal I R} = {{\<zero>}, carrier R}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   927
apply (rule, rule)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   928
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   929
  fix I
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   930
  assume a: "I \<in> {I. ideal I R}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   931
  with this
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   932
      interpret ideal I R by simp
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   933
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   934
  show "I \<in> {{\<zero>}, carrier R}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   935
  proof (cases "\<exists>a. a \<in> I - {\<zero>}")
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   936
    assume "\<exists>a. a \<in> I - {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   937
    from this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   938
        obtain a
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   939
          where aI: "a \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   940
          and anZ: "a \<noteq> \<zero>"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   941
        by fast+
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   942
    from aI[THEN a_Hcarr] anZ
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   943
        have aUnit: "a \<in> Units R" by (simp add: field_Units)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   944
    hence a: "a \<otimes> inv a = \<one>" by (rule Units_r_inv)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   945
    from aI and aUnit
27698
197f0517f0bd Unit_inv_l, Unit_inv_r made [simp].
ballarin
parents: 27611
diff changeset
   946
        have "a \<otimes> inv a \<in> I" by (simp add: I_r_closed del: Units_r_inv)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   947
    hence oneI: "\<one> \<in> I" by (simp add: a[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   948
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   949
    have "carrier R \<subseteq> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   950
    proof
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   951
      fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   952
      assume xcarr: "x \<in> carrier R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   953
      from oneI and this
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   954
          have "\<one> \<otimes> x \<in> I" by (rule I_r_closed)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   955
      from this and xcarr
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   956
          show "x \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   957
    qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   958
    from this and a_subset
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   959
        have "I = carrier R" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   960
    thus "I \<in> {{\<zero>}, carrier R}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   961
  next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   962
    assume "\<not> (\<exists>a. a \<in> I - {\<zero>})"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   963
    hence IZ: "\<And>a. a \<in> I \<Longrightarrow> a = \<zero>" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   964
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   965
    have a: "I \<subseteq> {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   966
    proof
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   967
      fix x
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   968
      assume "x \<in> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   969
      hence "x = \<zero>" by (rule IZ)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   970
      thus "x \<in> {\<zero>}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   971
    qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   972
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   973
    have "\<zero> \<in> I" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   974
    hence "{\<zero>} \<subseteq> I" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   975
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   976
    from this and a
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   977
        have "I = {\<zero>}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   978
    thus "I \<in> {{\<zero>}, carrier R}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   979
  qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   980
qed (simp add: zeroideal oneideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   981
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   982
--"Jacobson Theorem 2.2"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   983
lemma (in cring) trivialideals_eq_field:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   984
  assumes carrnzero: "carrier R \<noteq> {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   985
  shows "({I. ideal I R} = {{\<zero>}, carrier R}) = field R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   986
by (fast intro!: trivialideals_fieldI[OF carrnzero] field.all_ideals)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   987
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   988
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   989
text {* Like zeroprimeideal for domains *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   990
lemma (in field) zeromaximalideal:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   991
  "maximalideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   992
apply (rule maximalidealI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   993
  apply (rule zeroideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   994
proof-
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   995
  from one_not_zero
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   996
      have "\<one> \<notin> {\<zero>}" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   997
  from this and one_closed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   998
      show "carrier R \<noteq> {\<zero>}" by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   999
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1000
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1001
  assume Jideal: "ideal J R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1002
  hence "J \<in> {I. ideal I R}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1003
      by fast
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1004
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1005
  from this and all_ideals
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1006
      show "J = {\<zero>} \<or> J = carrier R" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1007
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1008
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1009
lemma (in cring) zeromaximalideal_fieldI:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1010
  assumes zeromax: "maximalideal {\<zero>} R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1011
  shows "field R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1012
apply (rule trivialideals_fieldI, rule maximalideal.I_notcarr[OF zeromax])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1013
apply rule apply clarsimp defer 1
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1014
 apply (simp add: zeroideal oneideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1015
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1016
  fix J
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1017
  assume Jn0: "J \<noteq> {\<zero>}"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1018
     and idealJ: "ideal J R"
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
  1019
  interpret ideal J R by (rule idealJ)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1020
  have "{\<zero>} \<subseteq> J" by (rule ccontr, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1021
  from zeromax and idealJ and this and a_subset
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1022
      have "J = {\<zero>} \<or> J = carrier R" by (rule maximalideal.I_maximal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1023
  from this and Jn0
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1024
      show "J = carrier R" by simp
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1025
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1026
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1027
lemma (in cring) zeromaximalideal_eq_field:
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1028
  "maximalideal {\<zero>} R = field R"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1029
apply rule
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1030
 apply (erule zeromaximalideal_fieldI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1031
apply (erule field.zeromaximalideal)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1032
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1033
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1034
end