src/HOL/Algebra/QuotRing.thy
author wenzelm
Mon, 19 Sep 2011 23:18:18 +0200
changeset 45005 0d2d59525912
parent 35849 b5522b51cb1e
child 61382 efac889fccbc
permissions -rw-r--r--
tuned proofs;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     1
(*  Title:      HOL/Algebra/QuotRing.thy
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
     2
    Author:     Stephan Hohe
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 QuotRing
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     6
imports RingHom
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
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27611
diff changeset
     9
section {* Quotient Rings *}
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27611
diff changeset
    10
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    11
subsection {* Multiplication on Cosets *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    12
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    13
definition rcoset_mult :: "[('a, _) ring_scheme, 'a set, 'a set, 'a set] \<Rightarrow> 'a set"
23463
9953ff53cc64 tuned proofs -- avoid implicit prems;
wenzelm
parents: 23350
diff changeset
    14
    ("[mod _:] _ \<Otimes>\<index> _" [81,81,81] 80)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    15
  where "rcoset_mult R I A B = (\<Union>a\<in>A. \<Union>b\<in>B. I +>\<^bsub>R\<^esub> (a \<otimes>\<^bsub>R\<^esub> b))"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    16
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    17
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    18
text {* @{const "rcoset_mult"} fulfils the properties required by
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    19
  congruences *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    20
lemma (in ideal) rcoset_mult_add:
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    21
    "x \<in> carrier R \<Longrightarrow> y \<in> carrier R \<Longrightarrow> [mod I:] (I +> x) \<Otimes> (I +> y) = I +> (x \<otimes> y)"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    22
  apply rule
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    23
  apply (rule, simp add: rcoset_mult_def, clarsimp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    24
  defer 1
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    25
  apply (rule, simp add: rcoset_mult_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    26
  defer 1
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    27
proof -
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    28
  fix z x' y'
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    29
  assume carr: "x \<in> carrier R" "y \<in> carrier R"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    30
    and x'rcos: "x' \<in> I +> x"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    31
    and y'rcos: "y' \<in> I +> y"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    32
    and zrcos: "z \<in> I +> x' \<otimes> y'"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    33
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    34
  from x'rcos have "\<exists>h\<in>I. x' = h \<oplus> x"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    35
    by (simp add: a_r_coset_def r_coset_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    36
  then obtain hx where hxI: "hx \<in> I" and x': "x' = hx \<oplus> x"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    37
    by fast+
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    38
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    39
  from y'rcos have "\<exists>h\<in>I. y' = h \<oplus> y"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    40
    by (simp add: a_r_coset_def r_coset_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    41
  then obtain hy where hyI: "hy \<in> I" and y': "y' = hy \<oplus> y"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    42
    by fast+
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    43
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    44
  from zrcos have "\<exists>h\<in>I. z = h \<oplus> (x' \<otimes> y')"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    45
    by (simp add: a_r_coset_def r_coset_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    46
  then obtain hz where hzI: "hz \<in> I" and z: "z = hz \<oplus> (x' \<otimes> y')"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    47
    by fast+
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    48
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    49
  note carr = carr hxI[THEN a_Hcarr] hyI[THEN a_Hcarr] hzI[THEN a_Hcarr]
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    50
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    51
  from z have "z = hz \<oplus> (x' \<otimes> y')" .
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    52
  also from x' y' have "\<dots> = hz \<oplus> ((hx \<oplus> x) \<otimes> (hy \<oplus> y))" by simp
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    53
  also from carr have "\<dots> = (hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy) \<oplus> x \<otimes> y" by algebra
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    54
  finally have z2: "z = (hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy) \<oplus> x \<otimes> y" .
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    55
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    56
  from hxI hyI hzI carr have "hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy \<in> I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    57
    by (simp add: I_l_closed I_r_closed)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    58
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    59
  with z2 have "\<exists>h\<in>I. z = h \<oplus> x \<otimes> y" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    60
  then show "z \<in> I +> x \<otimes> y" by (simp add: a_r_coset_def r_coset_def)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    61
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    62
  fix z
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    63
  assume xcarr: "x \<in> carrier R"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    64
    and ycarr: "y \<in> carrier R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    65
    and zrcos: "z \<in> I +> x \<otimes> y"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    66
  from xcarr have xself: "x \<in> I +> x" by (intro a_rcos_self)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    67
  from ycarr have yself: "y \<in> I +> y" by (intro a_rcos_self)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    68
  show "\<exists>a\<in>I +> x. \<exists>b\<in>I +> y. z \<in> I +> a \<otimes> b"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    69
    using xself and yself and zrcos by fast
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    70
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    71
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    72
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    73
subsection {* Quotient Ring Definition *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    74
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    75
definition FactRing :: "[('a,'b) ring_scheme, 'a set] \<Rightarrow> ('a set) ring"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    76
    (infixl "Quot" 65)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    77
  where "FactRing R I =
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    78
    \<lparr>carrier = a_rcosets\<^bsub>R\<^esub> I, mult = rcoset_mult R I,
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    79
      one = (I +>\<^bsub>R\<^esub> \<one>\<^bsub>R\<^esub>), zero = I, add = set_add R\<rparr>"
20318
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
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    82
subsection {* Factorization over General Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    83
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    84
text {* The quotient is a ring *}
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    85
lemma (in ideal) quotient_is_ring: "ring (R Quot I)"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    86
apply (rule ringI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    87
   --{* abelian group *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    88
   apply (rule comm_group_abelian_groupI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    89
   apply (simp add: FactRing_def)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    90
   apply (rule a_factorgroup_is_comm_group[unfolded A_FactGroup_def'])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    91
  --{* mult monoid *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    92
  apply (rule monoidI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    93
      apply (simp_all add: FactRing_def A_RCOSETS_def RCOSETS_def
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    94
             a_r_coset_def[symmetric])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    95
      --{* mult closed *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    96
      apply (clarify)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    97
      apply (simp add: rcoset_mult_add, fast)
21502
7f3ea2b3bab6 prefer antiquotations over LaTeX macros;
wenzelm
parents: 20318
diff changeset
    98
     --{* mult @{text one_closed} *}
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    99
     apply force
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   100
    --{* mult assoc *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   101
    apply clarify
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   102
    apply (simp add: rcoset_mult_add m_assoc)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   103
   --{* mult one *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   104
   apply clarify
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   105
   apply (simp add: rcoset_mult_add)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   106
  apply clarify
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   107
  apply (simp add: rcoset_mult_add)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   108
 --{* distr *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   109
 apply clarify
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   110
 apply (simp add: rcoset_mult_add a_rcos_sum l_distr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   111
apply clarify
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   112
apply (simp add: rcoset_mult_add a_rcos_sum r_distr)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   113
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   114
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   115
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   116
text {* This is a ring homomorphism *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   117
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   118
lemma (in ideal) rcos_ring_hom: "(op +> I) \<in> ring_hom R (R Quot I)"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   119
apply (rule ring_hom_memI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   120
   apply (simp add: FactRing_def a_rcosetsI[OF a_subset])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   121
  apply (simp add: FactRing_def rcoset_mult_add)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   122
 apply (simp add: FactRing_def a_rcos_sum)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   123
apply (simp add: FactRing_def)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   124
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   125
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   126
lemma (in ideal) rcos_ring_hom_ring: "ring_hom_ring R (R Quot I) (op +> I)"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   127
apply (rule ring_hom_ringI)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   128
     apply (rule is_ring, rule quotient_is_ring)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   129
   apply (simp add: FactRing_def a_rcosetsI[OF a_subset])
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   130
  apply (simp add: FactRing_def rcoset_mult_add)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   131
 apply (simp add: FactRing_def a_rcos_sum)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   132
apply (simp add: FactRing_def)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   133
done
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   134
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   135
text {* The quotient of a cring is also commutative *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   136
lemma (in ideal) quotient_is_cring:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   137
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   138
  shows "cring (R Quot I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   139
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   140
  interpret cring R by fact
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   141
  show ?thesis
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   142
    apply (intro cring.intro comm_monoid.intro comm_monoid_axioms.intro)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   143
      apply (rule quotient_is_ring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   144
     apply (rule ring.axioms[OF quotient_is_ring])
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   145
    apply (simp add: FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric])
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   146
    apply clarify
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   147
    apply (simp add: rcoset_mult_add m_comm)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   148
    done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   149
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   150
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   151
text {* Cosets as a ring homomorphism on crings *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   152
lemma (in ideal) rcos_ring_hom_cring:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   153
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   154
  shows "ring_hom_cring R (R Quot I) (op +> I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   155
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   156
  interpret cring R by fact
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   157
  show ?thesis
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   158
    apply (rule ring_hom_cringI)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   159
      apply (rule rcos_ring_hom_ring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   160
     apply (rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   161
    apply (rule quotient_is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   162
   apply (rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   163
   done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   164
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   165
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
   166
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   167
subsection {* Factorization over Prime Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   168
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   169
text {* The quotient ring generated by a prime ideal is a domain *}
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   170
lemma (in primeideal) quotient_is_domain: "domain (R Quot I)"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   171
  apply (rule domain.intro)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   172
   apply (rule quotient_is_cring, rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   173
  apply (rule domain_axioms.intro)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   174
   apply (simp add: FactRing_def) defer 1
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   175
    apply (simp add: FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric], clarify)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   176
    apply (simp add: rcoset_mult_add) defer 1
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   177
proof (rule ccontr, clarsimp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   178
  assume "I +> \<one> = I"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   179
  then have "\<one> \<in> I" by (simp only: a_coset_join1 one_closed a_subgroup)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   180
  then have "carrier R \<subseteq> I" by (subst one_imp_carrier, simp, fast)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   181
  with a_subset have "I = carrier R" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   182
  with I_notcarr show False by fast
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   183
next
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   184
  fix x y
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   185
  assume carr: "x \<in> carrier R" "y \<in> carrier R"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   186
    and a: "I +> x \<otimes> y = I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   187
    and b: "I +> y \<noteq> I"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   188
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   189
  have ynI: "y \<notin> I"
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   190
  proof (rule ccontr, simp)
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   191
    assume "y \<in> I"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   192
    then have "I +> y = I" by (rule a_rcos_const)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   193
    with b show False by simp
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   194
  qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   195
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   196
  from carr have "x \<otimes> y \<in> I +> x \<otimes> y" by (simp add: a_rcos_self)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   197
  then have xyI: "x \<otimes> y \<in> I" by (simp add: a)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   198
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   199
  from xyI and carr have xI: "x \<in> I \<or> y \<in> I" by (simp add: I_prime)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   200
  with ynI have "x \<in> I" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   201
  then show "I +> x = I" by (rule a_rcos_const)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   202
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   203
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   204
text {* Generating right cosets of a prime ideal is a homomorphism
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   205
        on commutative rings *}
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   206
lemma (in primeideal) rcos_ring_hom_cring: "ring_hom_cring R (R Quot I) (op +> I)"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   207
  by (rule rcos_ring_hom_cring) (rule is_cring)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   208
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   209
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   210
subsection {* Factorization over Maximal Ideals *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   211
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   212
text {* In a commutative ring, the quotient ring over a maximal ideal
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   213
        is a field.
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   214
        The proof follows ``W. Adkins, S. Weintraub: Algebra --
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   215
        An Approach via Module Theory'' *}
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   216
lemma (in maximalideal) quotient_is_field:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   217
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   218
  shows "field (R Quot I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   219
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   220
  interpret cring R by fact
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   221
  show ?thesis
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   222
    apply (intro cring.cring_fieldI2)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   223
      apply (rule quotient_is_cring, rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   224
     defer 1
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   225
     apply (simp add: FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric], clarsimp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   226
     apply (simp add: rcoset_mult_add) defer 1
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   227
  proof (rule ccontr, simp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   228
    --{* Quotient is not empty *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   229
    assume "\<zero>\<^bsub>R Quot I\<^esub> = \<one>\<^bsub>R Quot I\<^esub>"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   230
    then have II1: "I = I +> \<one>" by (simp add: FactRing_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   231
    from a_rcos_self[OF one_closed] have "\<one> \<in> I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   232
      by (simp add: II1[symmetric])
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   233
    then have "I = carrier R" by (rule one_imp_carrier)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   234
    with I_notcarr show False by simp
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   235
  next
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   236
    --{* Existence of Inverse *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   237
    fix a
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   238
    assume IanI: "I +> a \<noteq> I" and acarr: "a \<in> carrier R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   239
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   240
    --{* Helper ideal @{text "J"} *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   241
    def J \<equiv> "(carrier R #> a) <+> I :: 'a set"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   242
    have idealJ: "ideal J R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   243
      apply (unfold J_def, rule add_ideals)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   244
       apply (simp only: cgenideal_eq_rcos[symmetric], rule cgenideal_ideal, rule acarr)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   245
      apply (rule is_ideal)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   246
      done
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   247
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   248
    --{* Showing @{term "J"} not smaller than @{term "I"} *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   249
    have IinJ: "I \<subseteq> J"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   250
    proof (rule, simp add: J_def r_coset_def set_add_defs)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   251
      fix x
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   252
      assume xI: "x \<in> I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   253
      have Zcarr: "\<zero> \<in> carrier R" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   254
      from xI[THEN a_Hcarr] acarr
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   255
      have "x = \<zero> \<otimes> a \<oplus> x" by algebra
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   256
      with Zcarr and xI show "\<exists>xa\<in>carrier R. \<exists>k\<in>I. x = xa \<otimes> a \<oplus> k" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   257
    qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   258
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   259
    --{* Showing @{term "J \<noteq> I"} *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   260
    have anI: "a \<notin> I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   261
    proof (rule ccontr, simp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   262
      assume "a \<in> I"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   263
      then have "I +> a = I" by (rule a_rcos_const)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   264
      with IanI show False by simp
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   265
    qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   266
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   267
    have aJ: "a \<in> J"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   268
    proof (simp add: J_def r_coset_def set_add_defs)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   269
      from acarr
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   270
      have "a = \<one> \<otimes> a \<oplus> \<zero>" by algebra
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   271
      with one_closed and additive_subgroup.zero_closed[OF is_additive_subgroup]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   272
      show "\<exists>x\<in>carrier R. \<exists>k\<in>I. a = x \<otimes> a \<oplus> k" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   273
    qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   274
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   275
    from aJ and anI have JnI: "J \<noteq> I" by fast
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   276
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   277
    --{* Deducing @{term "J = carrier R"} because @{term "I"} is maximal *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   278
    from idealJ and IinJ have "J = I \<or> J = carrier R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   279
    proof (rule I_maximal, unfold J_def)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   280
      have "carrier R #> a \<subseteq> carrier R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   281
        using subset_refl acarr by (rule r_coset_subset_G)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   282
      then show "carrier R #> a <+> I \<subseteq> carrier R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   283
        using a_subset by (rule set_add_closed)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   284
    qed
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   285
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   286
    with JnI have Jcarr: "J = carrier R" by simp
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   287
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   288
    --{* Calculating an inverse for @{term "a"} *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   289
    from one_closed[folded Jcarr]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   290
    have "\<exists>r\<in>carrier R. \<exists>i\<in>I. \<one> = r \<otimes> a \<oplus> i"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   291
      by (simp add: J_def r_coset_def set_add_defs)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   292
    then obtain r i where rcarr: "r \<in> carrier R"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   293
      and iI: "i \<in> I" and one: "\<one> = r \<otimes> a \<oplus> i" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   294
    from one and rcarr and acarr and iI[THEN a_Hcarr]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   295
    have rai1: "a \<otimes> r = \<ominus>i \<oplus> \<one>" by algebra
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   296
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   297
    --{* Lifting to cosets *}
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   298
    from iI have "\<ominus>i \<oplus> \<one> \<in> I +> \<one>"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   299
      by (intro a_rcosI, simp, intro a_subset, simp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   300
    with rai1 have "a \<otimes> r \<in> I +> \<one>" by simp
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   301
    then have "I +> \<one> = I +> a \<otimes> r"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   302
      by (rule a_repr_independence, simp) (rule a_subgroup)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   303
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   304
    from rcarr and this[symmetric]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   305
    show "\<exists>r\<in>carrier R. I +> a \<otimes> r = I +> \<one>" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   306
  qed
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   307
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   308
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   309
end