src/HOL/Algebra/QuotRing.thy
author paulson <lp15@cam.ac.uk>
Sun, 22 Jul 2018 13:29:24 +0200
changeset 68673 22d10f94811e
parent 68604 57721285d4ef
child 69122 1b5178abaf97
permissions -rw-r--r--
de-applying
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
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
     3
    Author:     Paulo Emílio de Vilhena
20318
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
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     6
theory QuotRing
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     7
imports RingHom
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     8
begin
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
     9
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    10
section \<open>Quotient Rings\<close>
27717
21bbd410ba04 Generalised polynomial lemmas from cring to ring.
ballarin
parents: 27611
diff changeset
    11
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    12
subsection \<open>Multiplication on Cosets\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    13
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    14
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
    15
    ("[mod _:] _ \<Otimes>\<index> _" [81,81,81] 80)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    16
  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
    17
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    18
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    19
text \<open>@{const "rcoset_mult"} fulfils the properties required by congruences\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    20
lemma (in ideal) rcoset_mult_add:
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    21
  assumes "x \<in> carrier R" "y \<in> carrier R"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    22
  shows "[mod I:] (I +> x) \<Otimes> (I +> y) = I +> (x \<otimes> y)"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    23
proof -
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    24
  have 1: "z \<in> I +> x \<otimes> y" 
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    25
    if x'rcos: "x' \<in> I +> x" and y'rcos: "y' \<in> I +> y" and zrcos: "z \<in> I +> x' \<otimes> y'" for z x' y'
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    26
  proof -
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    27
    from that
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    28
    obtain hx hy hz where hxI: "hx \<in> I" and x': "x' = hx \<oplus> x" and hyI: "hy \<in> I" and y': "y' = hy \<oplus> y"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    29
      and hzI: "hz \<in> I" and z: "z = hz \<oplus> (x' \<otimes> y')"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    30
      by (auto simp: a_r_coset_def r_coset_def)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    31
    note carr = assms hxI[THEN a_Hcarr] hyI[THEN a_Hcarr] hzI[THEN a_Hcarr]
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    32
    from z  x' y' have "z = hz \<oplus> ((hx \<oplus> x) \<otimes> (hy \<oplus> y))" by simp
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    33
    also from carr have "\<dots> = (hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy) \<oplus> x \<otimes> y" by algebra
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    34
    finally have z2: "z = (hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy) \<oplus> x \<otimes> y" .
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    35
    from hxI hyI hzI carr have "hz \<oplus> (hx \<otimes> (hy \<oplus> y)) \<oplus> x \<otimes> hy \<in> I"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    36
      by (simp add: I_l_closed I_r_closed)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    37
    with z2 show ?thesis
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    38
      by (auto simp add: a_r_coset_def r_coset_def)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    39
  qed
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    40
  have 2: "\<exists>a\<in>I +> x. \<exists>b\<in>I +> y. z \<in> I +> a \<otimes> b" if "z \<in> I +> x \<otimes> y" for z
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    41
    using assms a_rcos_self that by blast
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    42
  show ?thesis
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    43
    unfolding rcoset_mult_def using assms
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    44
    by (auto simp: intro!: 1 2)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    45
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    46
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    47
subsection \<open>Quotient Ring Definition\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    48
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    49
definition FactRing :: "[('a,'b) ring_scheme, 'a set] \<Rightarrow> ('a set) ring"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    50
    (infixl "Quot" 65)
35848
5443079512ea slightly more uniform definitions -- eliminated old-style meta-equality;
wenzelm
parents: 35847
diff changeset
    51
  where "FactRing R I =
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    52
    \<lparr>carrier = a_rcosets\<^bsub>R\<^esub> I, mult = rcoset_mult R I,
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    53
      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
    54
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    55
lemmas FactRing_simps = FactRing_def A_RCOSETS_defs a_r_coset_def[symmetric]
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    56
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    57
subsection \<open>Factorization over General Ideals\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    58
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    59
text \<open>The quotient is a ring\<close>
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    60
lemma (in ideal) quotient_is_ring: "ring (R Quot I)"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    61
proof (rule ringI)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    62
  show "abelian_group (R Quot I)"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    63
    apply (rule comm_group_abelian_groupI)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    64
    apply (simp add: FactRing_def a_factorgroup_is_comm_group[unfolded A_FactGroup_def'])
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    65
    done
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    66
  show "Group.monoid (R Quot I)"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    67
    by (rule monoidI)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    68
      (auto simp add: FactRing_simps rcoset_mult_add m_assoc)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    69
qed (auto simp: FactRing_simps rcoset_mult_add a_rcos_sum l_distr r_distr)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    70
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    71
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    72
text \<open>This is a ring homomorphism\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    73
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63167
diff changeset
    74
lemma (in ideal) rcos_ring_hom: "((+>) I) \<in> ring_hom R (R Quot I)"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    75
  by (simp add: ring_hom_memI FactRing_def a_rcosetsI[OF a_subset] rcoset_mult_add a_rcos_sum)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    76
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63167
diff changeset
    77
lemma (in ideal) rcos_ring_hom_ring: "ring_hom_ring R (R Quot I) ((+>) I)"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    78
  by (simp add: local.ring_axioms quotient_is_ring rcos_ring_hom ring_hom_ringI2)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    79
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    80
text \<open>The quotient of a cring is also commutative\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    81
lemma (in ideal) quotient_is_cring:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
    82
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    83
  shows "cring (R Quot I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
    84
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    85
  interpret cring R by fact
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    86
  show ?thesis
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    87
    apply (intro cring.intro comm_monoid.intro comm_monoid_axioms.intro quotient_is_ring)
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    88
     apply (rule ring.axioms[OF quotient_is_ring])
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
    89
    apply (auto simp add: FactRing_simps rcoset_mult_add m_comm)
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    90
    done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
    91
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    92
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
    93
text \<open>Cosets as a ring homomorphism on crings\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
    94
lemma (in ideal) rcos_ring_hom_cring:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
    95
  assumes "cring R"
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63167
diff changeset
    96
  shows "ring_hom_cring R (R Quot I) ((+>) I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
    97
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
    98
  interpret cring R by fact
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
    99
  show ?thesis
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   100
    apply (rule ring_hom_cringI)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   101
      apply (rule rcos_ring_hom_ring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   102
     apply (rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   103
    apply (rule quotient_is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   104
   apply (rule is_cring)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   105
   done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   106
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   107
35849
b5522b51cb1e standard headers;
wenzelm
parents: 35848
diff changeset
   108
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
   109
subsection \<open>Factorization over Prime Ideals\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   110
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
   111
text \<open>The quotient ring generated by a prime ideal is a domain\<close>
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   112
lemma (in primeideal) quotient_is_domain: "domain (R Quot I)"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   113
proof -
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   114
  have 1: "I +> \<one> = I \<Longrightarrow> False"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   115
    using I_notcarr a_rcos_self one_imp_carrier by blast
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   116
  have 2: "I +> x = I"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   117
    if  carr: "x \<in> carrier R" "y \<in> carrier R"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   118
    and a: "I +> x \<otimes> y = I"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   119
    and b: "I +> y \<noteq> I" for x y
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   120
    by (metis I_prime a a_rcos_const a_rcos_self b m_closed that)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   121
  show ?thesis
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   122
    apply (intro domain.intro quotient_is_cring is_cring domain_axioms.intro)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   123
     apply (metis "1" FactRing_def monoid.simps(2) ring.simps(1))
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   124
    apply (simp add: FactRing_simps)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   125
    by (metis "2" rcoset_mult_add)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   126
qed
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   127
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
   128
text \<open>Generating right cosets of a prime ideal is a homomorphism
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
   129
        on commutative rings\<close>
67399
eab6ce8368fa ran isabelle update_op on all sources
nipkow
parents: 63167
diff changeset
   130
lemma (in primeideal) rcos_ring_hom_cring: "ring_hom_cring R (R Quot I) ((+>) I)"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   131
  by (rule rcos_ring_hom_cring) (rule is_cring)
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   132
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   133
61382
efac889fccbc isabelle update_cartouches;
wenzelm
parents: 45005
diff changeset
   134
subsection \<open>Factorization over Maximal Ideals\<close>
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   135
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   136
text \<open>In a commutative ring, the quotient ring over a maximal ideal is a field.
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   137
        The proof follows ``W. Adkins, S. Weintraub: Algebra -- An Approach via Module Theory''\<close>
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   138
proposition (in maximalideal) quotient_is_field:
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   139
  assumes "cring R"
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   140
  shows "field (R Quot I)"
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   141
proof -
29237
e90d9d51106b More porting to new locales.
ballarin
parents: 27717
diff changeset
   142
  interpret cring R by fact
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   143
  have 1: "\<zero>\<^bsub>R Quot I\<^esub> \<noteq> \<one>\<^bsub>R Quot I\<^esub>"  \<comment> \<open>Quotient is not empty\<close>
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   144
  proof
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   145
    assume "\<zero>\<^bsub>R Quot I\<^esub> = \<one>\<^bsub>R Quot I\<^esub>"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   146
    then have II1: "I = I +> \<one>" by (simp add: FactRing_def)
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   147
    then have "I = carrier R"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   148
      using a_rcos_self one_imp_carrier by blast 
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   149
    with I_notcarr show False by simp
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   150
  qed
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   151
  have 2: "\<exists>y\<in>carrier R. I +> a \<otimes> y = I +> \<one>" if IanI: "I +> a \<noteq> I" and acarr: "a \<in> carrier R" for a
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
   152
    \<comment> \<open>Existence of Inverse\<close>
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   153
  proof -
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
   154
    \<comment> \<open>Helper ideal \<open>J\<close>\<close>
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 61382
diff changeset
   155
    define J :: "'a set" where "J = (carrier R #> a) <+> I"
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   156
    have idealJ: "ideal J R"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   157
      using J_def acarr add_ideals cgenideal_eq_rcos cgenideal_ideal is_ideal by auto
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   158
    have IinJ: "I \<subseteq> J"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   159
    proof (clarsimp simp: J_def r_coset_def set_add_defs)
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   160
      fix x
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   161
      assume xI: "x \<in> I"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   162
      have "x = \<zero> \<otimes> a \<oplus> x"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   163
        by (simp add: acarr xI)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   164
      with xI show "\<exists>xa\<in>carrier R. \<exists>k\<in>I. x = xa \<otimes> a \<oplus> k" by fast
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   165
    qed
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   166
    have JnI: "J \<noteq> I" 
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   167
    proof -
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   168
      have "a \<notin> I"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   169
        using IanI a_rcos_const by blast
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   170
      moreover have "a \<in> J"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   171
      proof (simp add: J_def r_coset_def set_add_defs)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   172
        from acarr
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   173
        have "a = \<one> \<otimes> a \<oplus> \<zero>" by algebra
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   174
        with one_closed and additive_subgroup.zero_closed[OF is_additive_subgroup]
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   175
        show "\<exists>x\<in>carrier R. \<exists>k\<in>I. a = x \<otimes> a \<oplus> k" by fast
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   176
      qed
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   177
      ultimately show ?thesis by blast
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   178
    qed
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   179
    then have Jcarr: "J = carrier R"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   180
      using I_maximal IinJ additive_subgroup.a_subset idealJ ideal_def by blast
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   181
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
   182
    \<comment> \<open>Calculating an inverse for @{term "a"}\<close>
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   183
    from one_closed[folded Jcarr]
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   184
    obtain r i where rcarr: "r \<in> carrier R"
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   185
      and iI: "i \<in> I" and one: "\<one> = r \<otimes> a \<oplus> i" 
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   186
      by (auto simp add: J_def r_coset_def set_add_defs)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   187
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   188
    from one and rcarr and acarr and iI[THEN a_Hcarr]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   189
    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
   190
67443
3abf6a722518 standardized towards new-style formal comments: isabelle update_comments;
wenzelm
parents: 67399
diff changeset
   191
    \<comment> \<open>Lifting to cosets\<close>
45005
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   192
    from iI have "\<ominus>i \<oplus> \<one> \<in> I +> \<one>"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   193
      by (intro a_rcosI, simp, intro a_subset, simp)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   194
    with rai1 have "a \<otimes> r \<in> I +> \<one>" by simp
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   195
    then have "I +> \<one> = I +> a \<otimes> r"
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   196
      by (rule a_repr_independence, simp) (rule a_subgroup)
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   197
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   198
    from rcarr and this[symmetric]
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   199
    show "\<exists>r\<in>carrier R. I +> a \<otimes> r = I +> \<one>" by fast
0d2d59525912 tuned proofs;
wenzelm
parents: 35849
diff changeset
   200
  qed
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   201
  show ?thesis
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   202
    apply (intro cring.cring_fieldI2 quotient_is_cring is_cring 1)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   203
     apply (clarsimp simp add: FactRing_simps rcoset_mult_add 2)
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   204
    done
27611
2c01c0bdb385 Removed uses of context element includes.
ballarin
parents: 23463
diff changeset
   205
qed
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
   206
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   207
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   208
lemma (in ring_hom_ring) trivial_hom_iff:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   209
  "(h ` (carrier R) = { \<zero>\<^bsub>S\<^esub> }) = (a_kernel R S h = carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   210
  using group_hom.trivial_hom_iff[OF a_group_hom] by (simp add: a_kernel_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   211
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   212
lemma (in ring_hom_ring) trivial_ker_imp_inj:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   213
  assumes "a_kernel R S h = { \<zero> }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   214
  shows "inj_on h (carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   215
  using group_hom.trivial_ker_imp_inj[OF a_group_hom] assms a_kernel_def[of R S h] by simp 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   216
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   217
lemma (in ring_hom_ring) non_trivial_field_hom_imp_inj:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   218
  assumes "field R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   219
  shows "h ` (carrier R) \<noteq> { \<zero>\<^bsub>S\<^esub> } \<Longrightarrow> inj_on h (carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   220
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   221
  assume "h ` (carrier R) \<noteq> { \<zero>\<^bsub>S\<^esub> }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   222
  hence "a_kernel R S h \<noteq> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   223
    using trivial_hom_iff by linarith
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   224
  hence "a_kernel R S h = { \<zero> }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   225
    using field.all_ideals[OF assms] kernel_is_ideal by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   226
  thus "inj_on h (carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   227
    using trivial_ker_imp_inj by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   228
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   229
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   230
lemma (in ring_hom_ring) img_is_add_subgroup:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   231
  assumes "subgroup H (add_monoid R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   232
  shows "subgroup (h ` H) (add_monoid S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   233
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   234
  have "group ((add_monoid R) \<lparr> carrier := H \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   235
    using assms R.add.subgroup_imp_group by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   236
  moreover have "H \<subseteq> carrier R" by (simp add: R.add.subgroupE(1) assms)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   237
  hence "h \<in> hom ((add_monoid R) \<lparr> carrier := H \<rparr>) (add_monoid S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   238
    unfolding hom_def by (auto simp add: subsetD)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   239
  ultimately have "subgroup (h ` carrier ((add_monoid R) \<lparr> carrier := H \<rparr>)) (add_monoid S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   240
    using group_hom.img_is_subgroup[of "(add_monoid R) \<lparr> carrier := H \<rparr>" "add_monoid S" h]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   241
    using a_group_hom group_hom_axioms.intro group_hom_def by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   242
  thus "subgroup (h ` H) (add_monoid S)" by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   243
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   244
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   245
lemma (in ring) ring_ideal_imp_quot_ideal:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   246
  assumes "ideal I R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   247
  shows "ideal J R \<Longrightarrow> ideal ((+>) I ` J) (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   248
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   249
  assume A: "ideal J R" show "ideal (((+>) I) ` J) (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   250
  proof (rule idealI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   251
    show "ring (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   252
      by (simp add: assms(1) ideal.quotient_is_ring) 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   253
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   254
    have "subgroup J (add_monoid R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   255
      by (simp add: additive_subgroup.a_subgroup A ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   256
    moreover have "((+>) I) \<in> ring_hom R (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   257
      by (simp add: assms(1) ideal.rcos_ring_hom)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   258
    ultimately show "subgroup ((+>) I ` J) (add_monoid (R Quot I))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   259
      using assms(1) ideal.rcos_ring_hom_ring ring_hom_ring.img_is_add_subgroup by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   260
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   261
    fix a x assume "a \<in> (+>) I ` J" "x \<in> carrier (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   262
    then obtain i j where i: "i \<in> carrier R" "x = I +> i"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   263
                      and j: "j \<in> J" "a = I +> j"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   264
      unfolding FactRing_def using A_RCOSETS_def'[of R I] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   265
    hence "a \<otimes>\<^bsub>R Quot I\<^esub> x = [mod I:] (I +> j) \<Otimes> (I +> i)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   266
      unfolding FactRing_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   267
    hence "a \<otimes>\<^bsub>R Quot I\<^esub> x = I +> (j \<otimes> i)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   268
      using ideal.rcoset_mult_add[OF assms(1), of j i] i(1) j(1) A ideal.Icarr by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   269
    thus "a \<otimes>\<^bsub>R Quot I\<^esub> x \<in> (+>) I ` J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   270
      using A i(1) j(1) by (simp add: ideal.I_r_closed)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   271
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   272
    have "x \<otimes>\<^bsub>R Quot I\<^esub> a = [mod I:] (I +> i) \<Otimes> (I +> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   273
      unfolding FactRing_def i j by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   274
    hence "x \<otimes>\<^bsub>R Quot I\<^esub> a = I +> (i \<otimes> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   275
      using ideal.rcoset_mult_add[OF assms(1), of i j] i(1) j(1) A ideal.Icarr by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   276
    thus "x \<otimes>\<^bsub>R Quot I\<^esub> a \<in> (+>) I ` J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   277
      using A i(1) j(1) by (simp add: ideal.I_l_closed)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   278
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   279
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   280
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   281
lemma (in ring_hom_ring) ideal_vimage:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   282
  assumes "ideal I S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   283
  shows "ideal { r \<in> carrier R. h r \<in> I } R" (* or (carrier R) \<inter> (h -` I) *)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   284
proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   285
  show "{ r \<in> carrier R. h r \<in> I } \<subseteq> carrier (add_monoid R)" by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   286
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   287
  show "\<one>\<^bsub>add_monoid R\<^esub> \<in> { r \<in> carrier R. h r \<in> I }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   288
    by (simp add: additive_subgroup.zero_closed assms ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   289
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   290
  fix a b
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   291
  assume "a \<in> { r \<in> carrier R. h r \<in> I }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   292
     and "b \<in> { r \<in> carrier R. h r \<in> I }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   293
  hence a: "a \<in> carrier R" "h a \<in> I"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   294
    and b: "b \<in> carrier R" "h b \<in> I" by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   295
  hence "h (a \<oplus> b) = (h a) \<oplus>\<^bsub>S\<^esub> (h b)" using hom_add by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   296
  moreover have "(h a) \<oplus>\<^bsub>S\<^esub> (h b) \<in> I" using a b assms
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   297
    by (simp add: additive_subgroup.a_closed ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   298
  ultimately show "a \<otimes>\<^bsub>add_monoid R\<^esub> b \<in> { r \<in> carrier R. h r \<in> I }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   299
    using a(1) b (1) by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   300
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   301
  have "h (\<ominus> a) = \<ominus>\<^bsub>S\<^esub> (h a)" by (simp add: a)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   302
  moreover have "\<ominus>\<^bsub>S\<^esub> (h a) \<in> I"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   303
    by (simp add: a(2) additive_subgroup.a_inv_closed assms ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   304
  ultimately show "inv\<^bsub>add_monoid R\<^esub> a \<in> { r \<in> carrier R. h r \<in> I }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   305
    using a by (simp add: a_inv_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   306
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   307
  fix a r
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   308
  assume "a \<in> { r \<in> carrier R. h r \<in> I }" and r: "r \<in> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   309
  hence a: "a \<in> carrier R" "h a \<in> I" by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   310
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   311
  have "h a \<otimes>\<^bsub>S\<^esub> h r \<in> I"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   312
    using assms a r by (simp add: ideal.I_r_closed)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   313
  thus "a \<otimes> r \<in> { r \<in> carrier R. h r \<in> I }" by (simp add: a(1) r)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   314
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   315
  have "h r \<otimes>\<^bsub>S\<^esub> h a \<in> I"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   316
    using assms a r by (simp add: ideal.I_l_closed)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   317
  thus "r \<otimes> a \<in> { r \<in> carrier R. h r \<in> I }" by (simp add: a(1) r)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   318
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   319
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   320
lemma (in ring) canonical_proj_vimage_in_carrier:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   321
  assumes "ideal I R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   322
  shows "J \<subseteq> carrier (R Quot I) \<Longrightarrow> \<Union> J \<subseteq> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   323
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   324
  assume A: "J \<subseteq> carrier (R Quot I)" show "\<Union> J \<subseteq> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   325
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   326
    fix j assume j: "j \<in> \<Union> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   327
    then obtain j' where j': "j' \<in> J" "j \<in> j'" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   328
    then obtain r where r: "r \<in> carrier R" "j' = I +> r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   329
      using A j' unfolding FactRing_def using A_RCOSETS_def'[of R I] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   330
    thus "j \<in> carrier R" using j' assms
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   331
      by (meson a_r_coset_subset_G additive_subgroup.a_subset contra_subsetD ideal.axioms(1)) 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   332
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   333
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   334
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   335
lemma (in ring) canonical_proj_vimage_mem_iff:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   336
  assumes "ideal I R" "J \<subseteq> carrier (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   337
  shows "\<And>a. a \<in> carrier R \<Longrightarrow> (a \<in> (\<Union> J)) = (I +> a \<in> J)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   338
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   339
  fix a assume a: "a \<in> carrier R" show "(a \<in> (\<Union> J)) = (I +> a \<in> J)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   340
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   341
    assume "a \<in> \<Union> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   342
    then obtain j where j: "j \<in> J" "a \<in> j" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   343
    then obtain r where r: "r \<in> carrier R" "j = I +> r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   344
      using assms j unfolding FactRing_def using A_RCOSETS_def'[of R I] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   345
    hence "I +> r = I +> a"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   346
      using add.repr_independence[of a I r] j r
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   347
      by (metis a_r_coset_def additive_subgroup.a_subgroup assms(1) ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   348
    thus "I +> a \<in> J" using r j by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   349
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   350
    assume "I +> a \<in> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   351
    hence "\<zero> \<oplus> a \<in> I +> a"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   352
      using additive_subgroup.zero_closed[OF ideal.axioms(1)[OF assms(1)]]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   353
            a_r_coset_def'[of R I a] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   354
    thus "a \<in> \<Union> J" using a \<open>I +> a \<in> J\<close> by auto 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   355
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   356
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   357
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   358
corollary (in ring) quot_ideal_imp_ring_ideal:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   359
  assumes "ideal I R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   360
  shows "ideal J (R Quot I) \<Longrightarrow> ideal (\<Union> J) R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   361
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   362
  assume A: "ideal J (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   363
  have "\<Union> J = { r \<in> carrier R. I +> r \<in> J }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   364
    using canonical_proj_vimage_in_carrier[OF assms, of J]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   365
          canonical_proj_vimage_mem_iff[OF assms, of J]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   366
          additive_subgroup.a_subset[OF ideal.axioms(1)[OF A]] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   367
  thus "ideal (\<Union> J) R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   368
    using ring_hom_ring.ideal_vimage[OF ideal.rcos_ring_hom_ring[OF assms] A] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   369
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   370
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   371
lemma (in ring) ideal_incl_iff:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   372
  assumes "ideal I R" "ideal J R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   373
  shows "(I \<subseteq> J) = (J = (\<Union> j \<in> J. I +> j))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   374
proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   375
  assume A: "J = (\<Union> j \<in> J. I +> j)" hence "I +> \<zero> \<subseteq> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   376
    using additive_subgroup.zero_closed[OF ideal.axioms(1)[OF assms(2)]] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   377
  thus "I \<subseteq> J" using additive_subgroup.a_subset[OF ideal.axioms(1)[OF assms(1)]] by simp 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   378
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   379
  assume A: "I \<subseteq> J" show "J = (\<Union>j\<in>J. I +> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   380
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   381
    show "J \<subseteq> (\<Union> j \<in> J. I +> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   382
    proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   383
      fix j assume j: "j \<in> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   384
      have "\<zero> \<in> I" by (simp add: additive_subgroup.zero_closed assms(1) ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   385
      hence "\<zero> \<oplus> j \<in> I +> j"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   386
        using a_r_coset_def'[of R I j] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   387
      thus "j \<in> (\<Union>j\<in>J. I +> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   388
        using assms(2) j additive_subgroup.a_Hcarr ideal.axioms(1) by fastforce 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   389
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   390
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   391
    show "(\<Union> j \<in> J. I +> j) \<subseteq> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   392
    proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   393
      fix x assume "x \<in> (\<Union> j \<in> J. I +> j)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   394
      then obtain j where j: "j \<in> J" "x \<in> I +> j" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   395
      then obtain i where i: "i \<in> I" "x = i \<oplus> j"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   396
        using a_r_coset_def'[of R I j] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   397
      thus "x \<in> J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   398
        using assms(2) j A additive_subgroup.a_closed[OF ideal.axioms(1)[OF assms(2)]] by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   399
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   400
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   401
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   402
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   403
theorem (in ring) quot_ideal_correspondence:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   404
  assumes "ideal I R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   405
  shows "bij_betw (\<lambda>J. (+>) I ` J) { J. ideal J R \<and> I \<subseteq> J } { J . ideal J (R Quot I) }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   406
proof (rule bij_betw_byWitness[where ?f' = "\<lambda>X. \<Union> X"])
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   407
  show "\<forall>J \<in> { J. ideal J R \<and> I \<subseteq> J }. (\<lambda>X. \<Union> X) ((+>) I ` J) = J"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   408
    using assms ideal_incl_iff by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   409
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   410
  show "(\<lambda>J. (+>) I ` J) ` { J. ideal J R \<and> I \<subseteq> J } \<subseteq> { J. ideal J (R Quot I) }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   411
    using assms ring_ideal_imp_quot_ideal by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   412
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   413
  show "(\<lambda>X. \<Union> X) ` { J. ideal J (R Quot I) } \<subseteq> { J. ideal J R \<and> I \<subseteq> J }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   414
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   415
    fix J assume "J \<in> ((\<lambda>X. \<Union> X) ` { J. ideal J (R Quot I) })"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   416
    then obtain J' where J': "ideal J' (R Quot I)" "J = \<Union> J'" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   417
    hence "ideal J R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   418
      using assms quot_ideal_imp_ring_ideal by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   419
    moreover have "I \<in> J'"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   420
      using additive_subgroup.zero_closed[OF ideal.axioms(1)[OF J'(1)]] unfolding FactRing_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   421
    ultimately show "J \<in> { J. ideal J R \<and> I \<subseteq> J }" using J'(2) by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   422
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   423
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   424
  show "\<forall>J' \<in> { J. ideal J (R Quot I) }. ((+>) I ` (\<Union> J')) = J'"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   425
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   426
    fix J' assume "J' \<in> { J. ideal J (R Quot I) }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   427
    hence subset: "J' \<subseteq> carrier (R Quot I) \<and> ideal J' (R Quot I)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   428
      using additive_subgroup.a_subset ideal_def by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   429
    hence "((+>) I ` (\<Union> J')) \<subseteq> J'"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   430
      using canonical_proj_vimage_in_carrier canonical_proj_vimage_mem_iff
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   431
      by (meson assms contra_subsetD image_subsetI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   432
    moreover have "J' \<subseteq> ((+>) I ` (\<Union> J'))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   433
    proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   434
      fix x assume "x \<in> J'"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   435
      then obtain r where r: "r \<in> carrier R" "x = I +> r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   436
        using subset unfolding FactRing_def A_RCOSETS_def'[of R I] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   437
      hence "r \<in> (\<Union> J')"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   438
        using \<open>x \<in> J'\<close> assms canonical_proj_vimage_mem_iff subset by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   439
      thus "x \<in> ((+>) I ` (\<Union> J'))" using r(2) by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   440
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   441
    ultimately show "((+>) I ` (\<Union> J')) = J'" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   442
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   443
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   444
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   445
lemma (in cring) quot_domain_imp_primeideal:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   446
  assumes "ideal P R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   447
  shows "domain (R Quot P) \<Longrightarrow> primeideal P R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   448
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   449
  assume A: "domain (R Quot P)" show "primeideal P R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   450
  proof (rule primeidealI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   451
    show "ideal P R" using assms .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   452
    show "cring R" using is_cring .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   453
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   454
    show "carrier R \<noteq> P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   455
    proof (rule ccontr)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   456
      assume "\<not> carrier R \<noteq> P" hence "carrier R = P" by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   457
      hence "\<And>I. I \<in> carrier (R Quot P) \<Longrightarrow> I = P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   458
        unfolding FactRing_def A_RCOSETS_def' apply simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   459
        using a_coset_join2 additive_subgroup.a_subgroup assms ideal.axioms(1) by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   460
      hence "\<one>\<^bsub>(R Quot P)\<^esub> = \<zero>\<^bsub>(R Quot P)\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   461
        by (metis assms ideal.quotient_is_ring ring.ring_simprules(2) ring.ring_simprules(6))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   462
      thus False using domain.one_not_zero[OF A] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   463
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   464
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   465
    fix a b assume a: "a \<in> carrier R" and b: "b \<in> carrier R" and ab: "a \<otimes> b \<in> P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   466
    hence "P +> (a \<otimes> b) = \<zero>\<^bsub>(R Quot P)\<^esub>" unfolding FactRing_def
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   467
      by (simp add: a_coset_join2 additive_subgroup.a_subgroup assms ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   468
    moreover have "(P +> a) \<otimes>\<^bsub>(R Quot P)\<^esub> (P +> b) = P +> (a \<otimes> b)" unfolding FactRing_def
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   469
      using a b by (simp add: assms ideal.rcoset_mult_add)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   470
    moreover have "P +> a \<in> carrier (R Quot P) \<and> P +> b \<in> carrier (R Quot P)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   471
      by (simp add: a b FactRing_def a_rcosetsI additive_subgroup.a_subset assms ideal.axioms(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   472
    ultimately have "P +> a = \<zero>\<^bsub>(R Quot P)\<^esub> \<or> P +> b = \<zero>\<^bsub>(R Quot P)\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   473
      using domain.integral[OF A, of "P +> a" "P +> b"] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   474
    thus "a \<in> P \<or> b \<in> P" unfolding FactRing_def apply simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   475
      using a b assms a_coset_join1 additive_subgroup.a_subgroup ideal.axioms(1) by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   476
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   477
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   478
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   479
lemma (in cring) quot_domain_iff_primeideal:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   480
  assumes "ideal P R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   481
  shows "domain (R Quot P) = primeideal P R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   482
  using quot_domain_imp_primeideal[OF assms] primeideal.quotient_is_domain[of P R] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   483
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   484
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   485
subsection \<open>Isomorphism\<close>
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   486
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   487
definition
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   488
  ring_iso :: "_ \<Rightarrow> _ \<Rightarrow> ('a \<Rightarrow> 'b) set"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   489
  where "ring_iso R S = { h. h \<in> ring_hom R S \<and> bij_betw h (carrier R) (carrier S) }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   490
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   491
definition
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   492
  is_ring_iso :: "_ \<Rightarrow> _ \<Rightarrow> bool" (infixr "\<simeq>" 60)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   493
  where "R \<simeq> S = (ring_iso R S \<noteq> {})"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   494
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   495
definition
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   496
  morphic_prop :: "_ \<Rightarrow> ('a \<Rightarrow> bool) \<Rightarrow> bool"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   497
  where "morphic_prop R P =
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   498
           ((P \<one>\<^bsub>R\<^esub>) \<and>
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   499
            (\<forall>r \<in> carrier R. P r) \<and>
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   500
            (\<forall>r1 \<in> carrier R. \<forall>r2 \<in> carrier R. P (r1 \<otimes>\<^bsub>R\<^esub> r2)) \<and>
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   501
            (\<forall>r1 \<in> carrier R. \<forall>r2 \<in> carrier R. P (r1 \<oplus>\<^bsub>R\<^esub> r2)))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   502
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   503
lemma ring_iso_memI:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   504
  fixes R (structure) and S (structure)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   505
  assumes "\<And>x. x \<in> carrier R \<Longrightarrow> h x \<in> carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   506
      and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   507
      and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   508
      and "h \<one> = \<one>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   509
      and "bij_betw h (carrier R) (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   510
  shows "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   511
  by (auto simp add: ring_hom_memI assms ring_iso_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   512
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   513
lemma ring_iso_memE:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   514
  fixes R (structure) and S (structure)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   515
  assumes "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   516
  shows "\<And>x. x \<in> carrier R \<Longrightarrow> h x \<in> carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   517
   and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   518
   and "\<And>x y. \<lbrakk> x \<in> carrier R; y \<in> carrier R \<rbrakk> \<Longrightarrow> h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   519
   and "h \<one> = \<one>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   520
   and "bij_betw h (carrier R) (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   521
  using assms unfolding ring_iso_def ring_hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   522
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   523
lemma morphic_propI:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   524
  fixes R (structure)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   525
  assumes "P \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   526
    and "\<And>r. r \<in> carrier R \<Longrightarrow> P r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   527
    and "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> P (r1 \<otimes> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   528
    and "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> P (r1 \<oplus> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   529
  shows "morphic_prop R P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   530
  unfolding morphic_prop_def using assms by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   531
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   532
lemma morphic_propE:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   533
  fixes R (structure)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   534
  assumes "morphic_prop R P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   535
  shows "P \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   536
    and "\<And>r. r \<in> carrier R \<Longrightarrow> P r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   537
    and "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> P (r1 \<otimes> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   538
    and "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> P (r1 \<oplus> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   539
  using assms unfolding morphic_prop_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   540
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   541
lemma ring_iso_restrict:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   542
  assumes "f \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   543
    and "\<And>r. r \<in> carrier R \<Longrightarrow> f r = g r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   544
    and "ring R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   545
  shows "g \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   546
proof (rule ring_iso_memI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   547
  show "bij_betw g (carrier R) (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   548
    using assms(1-2) bij_betw_cong ring_iso_memE(5) by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   549
  show "g \<one>\<^bsub>R\<^esub> = \<one>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   550
    using assms ring.ring_simprules(6) ring_iso_memE(4) by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   551
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   552
  fix x y assume x: "x \<in> carrier R" and y: "y \<in> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   553
  show "g x \<in> carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   554
    using assms(1-2) ring_iso_memE(1) x by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   555
  show "g (x \<otimes>\<^bsub>R\<^esub> y) = g x \<otimes>\<^bsub>S\<^esub> g y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   556
    by (metis assms ring.ring_simprules(5) ring_iso_memE(2) x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   557
  show "g (x \<oplus>\<^bsub>R\<^esub> y) = g x \<oplus>\<^bsub>S\<^esub> g y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   558
    by (metis assms ring.ring_simprules(1) ring_iso_memE(3) x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   559
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   560
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   561
lemma ring_iso_morphic_prop:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   562
  assumes "f \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   563
    and "morphic_prop R P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   564
    and "\<And>r. P r \<Longrightarrow> f r = g r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   565
  shows "g \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   566
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   567
  have eq0: "\<And>r. r \<in> carrier R \<Longrightarrow> f r = g r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   568
   and eq1: "f \<one>\<^bsub>R\<^esub> = g \<one>\<^bsub>R\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   569
   and eq2: "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> f (r1 \<otimes>\<^bsub>R\<^esub> r2) = g (r1 \<otimes>\<^bsub>R\<^esub> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   570
   and eq3: "\<And>r1 r2. \<lbrakk> r1 \<in> carrier R; r2 \<in> carrier R \<rbrakk> \<Longrightarrow> f (r1 \<oplus>\<^bsub>R\<^esub> r2) = g (r1 \<oplus>\<^bsub>R\<^esub> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   571
    using assms(2-3) unfolding morphic_prop_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   572
  show ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   573
    apply (rule ring_iso_memI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   574
    using assms(1) eq0 ring_iso_memE(1) apply fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   575
    apply (metis assms(1) eq0 eq2 ring_iso_memE(2))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   576
    apply (metis assms(1) eq0 eq3 ring_iso_memE(3))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   577
    using assms(1) eq1 ring_iso_memE(4) apply fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   578
    using assms(1) bij_betw_cong eq0 ring_iso_memE(5) by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   579
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   580
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   581
lemma (in ring) ring_hom_imp_img_ring:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   582
  assumes "h \<in> ring_hom R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   583
  shows "ring (S \<lparr> carrier := h ` (carrier R), one := h \<one>, zero := h \<zero> \<rparr>)" (is "ring ?h_img")
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   584
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   585
  have "h \<in> hom (add_monoid R) (add_monoid S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   586
    using assms unfolding hom_def ring_hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   587
  hence "comm_group ((add_monoid S) \<lparr>  carrier := h ` (carrier R), one := h \<zero> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   588
    using add.hom_imp_img_comm_group[of h "add_monoid S"] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   589
  hence comm_group: "comm_group (add_monoid ?h_img)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   590
    by (auto intro: comm_monoidI simp add: monoid.defs)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   591
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   592
  moreover have "h \<in> hom R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   593
    using assms unfolding ring_hom_def hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   594
  hence "monoid (S \<lparr>  carrier := h ` (carrier R), one := h \<one> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   595
    using hom_imp_img_monoid[of h S] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   596
  hence monoid: "monoid ?h_img"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   597
    unfolding monoid_def by (simp add: monoid.defs)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   598
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   599
  show ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   600
  proof (rule ringI, simp_all add: comm_group_abelian_groupI[OF comm_group] monoid)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   601
    fix x y z assume "x \<in> h ` carrier R" "y \<in> h ` carrier R" "z \<in> h ` carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   602
    then obtain r1 r2 r3
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   603
      where r1: "r1 \<in> carrier R" "x = h r1"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   604
        and r2: "r2 \<in> carrier R" "y = h r2"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   605
        and r3: "r3 \<in> carrier R" "z = h r3" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   606
    hence "(x \<oplus>\<^bsub>S\<^esub> y) \<otimes>\<^bsub>S\<^esub> z = h ((r1 \<oplus> r2) \<otimes> r3)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   607
      using ring_hom_memE[OF assms] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   608
    also have " ... = h ((r1 \<otimes> r3) \<oplus> (r2 \<otimes> r3))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   609
      using l_distr[OF r1(1) r2(1) r3(1)] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   610
    also have " ... = (x \<otimes>\<^bsub>S\<^esub> z) \<oplus>\<^bsub>S\<^esub> (y \<otimes>\<^bsub>S\<^esub> z)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   611
      using ring_hom_memE[OF assms] r1 r2 r3 by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   612
    finally show "(x \<oplus>\<^bsub>S\<^esub> y) \<otimes>\<^bsub>S\<^esub> z = (x \<otimes>\<^bsub>S\<^esub> z) \<oplus>\<^bsub>S\<^esub> (y \<otimes>\<^bsub>S\<^esub> z)" .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   613
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   614
    have "z \<otimes>\<^bsub>S\<^esub> (x \<oplus>\<^bsub>S\<^esub> y) = h (r3 \<otimes> (r1 \<oplus> r2))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   615
      using ring_hom_memE[OF assms] r1 r2 r3 by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   616
    also have " ... =  h ((r3 \<otimes> r1) \<oplus> (r3 \<otimes> r2))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   617
      using r_distr[OF r1(1) r2(1) r3(1)] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   618
    also have " ... = (z \<otimes>\<^bsub>S\<^esub> x) \<oplus>\<^bsub>S\<^esub> (z \<otimes>\<^bsub>S\<^esub> y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   619
      using ring_hom_memE[OF assms] r1 r2 r3 by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   620
    finally show "z \<otimes>\<^bsub>S\<^esub> (x \<oplus>\<^bsub>S\<^esub> y) = (z \<otimes>\<^bsub>S\<^esub> x) \<oplus>\<^bsub>S\<^esub> (z \<otimes>\<^bsub>S\<^esub> y)" .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   621
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   622
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   623
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   624
lemma (in ring) ring_iso_imp_img_ring:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   625
  assumes "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   626
  shows "ring (S \<lparr> one := h \<one>, zero := h \<zero> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   627
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   628
  have "ring (S \<lparr> carrier := h ` (carrier R), one := h \<one>, zero := h \<zero> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   629
    using ring_hom_imp_img_ring[of h S] assms unfolding ring_iso_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   630
  moreover have "h ` (carrier R) = carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   631
    using assms unfolding ring_iso_def bij_betw_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   632
  ultimately show ?thesis by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   633
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   634
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   635
lemma (in cring) ring_iso_imp_img_cring:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   636
  assumes "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   637
  shows "cring (S \<lparr> one := h \<one>, zero := h \<zero> \<rparr>)" (is "cring ?h_img")
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   638
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   639
  note m_comm
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   640
  interpret h_img?: ring ?h_img
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   641
    using ring_iso_imp_img_ring[OF assms] .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   642
  show ?thesis 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   643
  proof (unfold_locales)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   644
    fix x y assume "x \<in> carrier ?h_img" "y \<in> carrier ?h_img"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   645
    then obtain r1 r2
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   646
      where r1: "r1 \<in> carrier R" "x = h r1"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   647
        and r2: "r2 \<in> carrier R" "y = h r2"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   648
      using assms image_iff[where ?f = h and ?A = "carrier R"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   649
      unfolding ring_iso_def bij_betw_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   650
    have "x \<otimes>\<^bsub>(?h_img)\<^esub> y = h (r1 \<otimes> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   651
      using assms r1 r2 unfolding ring_iso_def ring_hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   652
    also have " ... = h (r2 \<otimes> r1)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   653
      using m_comm[OF r1(1) r2(1)] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   654
    also have " ... = y \<otimes>\<^bsub>(?h_img)\<^esub> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   655
      using assms r1 r2 unfolding ring_iso_def ring_hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   656
    finally show "x \<otimes>\<^bsub>(?h_img)\<^esub> y = y \<otimes>\<^bsub>(?h_img)\<^esub> x" .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   657
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   658
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   659
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   660
lemma (in domain) ring_iso_imp_img_domain:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   661
  assumes "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   662
  shows "domain (S \<lparr> one := h \<one>, zero := h \<zero> \<rparr>)" (is "domain ?h_img")
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   663
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   664
  note aux = m_closed integral one_not_zero one_closed zero_closed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   665
  interpret h_img?: cring ?h_img
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   666
    using ring_iso_imp_img_cring[OF assms] .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   667
  show ?thesis 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   668
  proof (unfold_locales)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   669
    show "\<one>\<^bsub>?h_img\<^esub> \<noteq> \<zero>\<^bsub>?h_img\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   670
      using ring_iso_memE(5)[OF assms] aux(3-4)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   671
      unfolding bij_betw_def inj_on_def by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   672
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   673
    fix a b
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   674
    assume A: "a \<otimes>\<^bsub>?h_img\<^esub> b = \<zero>\<^bsub>?h_img\<^esub>" "a \<in> carrier ?h_img" "b \<in> carrier ?h_img"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   675
    then obtain r1 r2
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   676
      where r1: "r1 \<in> carrier R" "a = h r1"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   677
        and r2: "r2 \<in> carrier R" "b = h r2"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   678
      using assms image_iff[where ?f = h and ?A = "carrier R"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   679
      unfolding ring_iso_def bij_betw_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   680
    hence "a \<otimes>\<^bsub>?h_img\<^esub> b = h (r1 \<otimes> r2)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   681
      using assms r1 r2 unfolding ring_iso_def ring_hom_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   682
    hence "h (r1 \<otimes> r2) = h \<zero>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   683
      using A(1) by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   684
    hence "r1 \<otimes> r2 = \<zero>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   685
      using ring_iso_memE(5)[OF assms] aux(1)[OF r1(1) r2(1)] aux(5)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   686
      unfolding bij_betw_def inj_on_def by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   687
    hence "r1 = \<zero> \<or> r2 = \<zero>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   688
      using aux(2)[OF _ r1(1) r2(1)] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   689
    thus "a = \<zero>\<^bsub>?h_img\<^esub> \<or> b = \<zero>\<^bsub>?h_img\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   690
      unfolding r1 r2 by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   691
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   692
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   693
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   694
lemma (in field) ring_iso_imp_img_field:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   695
  assumes "h \<in> ring_iso R S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   696
  shows "field (S \<lparr> one := h \<one>, zero := h \<zero> \<rparr>)" (is "field ?h_img")
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   697
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   698
  interpret h_img?: domain ?h_img
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   699
    using ring_iso_imp_img_domain[OF assms] .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   700
  show ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   701
  proof (unfold_locales, auto simp add: Units_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   702
    interpret field R using field_axioms .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   703
    fix a assume a: "a \<in> carrier S" "a \<otimes>\<^bsub>S\<^esub> h \<zero> = h \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   704
    then obtain r where r: "r \<in> carrier R" "a = h r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   705
      using assms image_iff[where ?f = h and ?A = "carrier R"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   706
      unfolding ring_iso_def bij_betw_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   707
    have "a \<otimes>\<^bsub>S\<^esub> h \<zero> = h (r \<otimes> \<zero>)" unfolding r(2)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   708
      using ring_iso_memE(2)[OF assms r(1)] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   709
    hence "h \<one> = h \<zero>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   710
      using r(1) a(2) by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   711
    thus False
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   712
      using ring_iso_memE(5)[OF assms]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   713
      unfolding bij_betw_def inj_on_def by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   714
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   715
    interpret field R using field_axioms .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   716
    fix s assume s: "s \<in> carrier S" "s \<noteq> h \<zero>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   717
    then obtain r where r: "r \<in> carrier R" "s = h r"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   718
      using assms image_iff[where ?f = h and ?A = "carrier R"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   719
      unfolding ring_iso_def bij_betw_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   720
    hence "r \<noteq> \<zero>" using s(2) by auto 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   721
    hence inv_r: "inv r \<in> carrier R" "inv r \<noteq> \<zero>" "r \<otimes> inv r = \<one>" "inv r \<otimes> r = \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   722
      using field_Units r(1) by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   723
    have "h (inv r) \<otimes>\<^bsub>S\<^esub> h r = h \<one>" and "h r \<otimes>\<^bsub>S\<^esub> h (inv r) = h \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   724
      using ring_iso_memE(2)[OF assms inv_r(1) r(1)] inv_r(3-4)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   725
            ring_iso_memE(2)[OF assms r(1) inv_r(1)] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   726
    thus "\<exists>s' \<in> carrier S. s' \<otimes>\<^bsub>S\<^esub> s = h \<one> \<and> s \<otimes>\<^bsub>S\<^esub> s' = h \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   727
      using ring_iso_memE(1)[OF assms inv_r(1)] r(2) by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   728
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   729
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   730
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   731
lemma ring_iso_same_card: "R \<simeq> S \<Longrightarrow> card (carrier R) = card (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   732
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   733
  assume "R \<simeq> S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   734
  then obtain h where "bij_betw h (carrier R) (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   735
    unfolding is_ring_iso_def ring_iso_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   736
  thus "card (carrier R) = card (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   737
    using bij_betw_same_card[of h "carrier R" "carrier S"] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   738
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   739
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   740
lemma ring_iso_set_refl: "id \<in> ring_iso R R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   741
  by (rule ring_iso_memI) (auto)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   742
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   743
corollary ring_iso_refl: "R \<simeq> R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   744
  using is_ring_iso_def ring_iso_set_refl by auto 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   745
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   746
lemma ring_iso_set_trans:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   747
  "\<lbrakk> f \<in> ring_iso R S; g \<in> ring_iso S Q \<rbrakk> \<Longrightarrow> (g \<circ> f) \<in> ring_iso R Q"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   748
  unfolding ring_iso_def using bij_betw_trans ring_hom_trans by fastforce 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   749
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   750
corollary ring_iso_trans: "\<lbrakk> R \<simeq> S; S \<simeq> Q \<rbrakk> \<Longrightarrow> R \<simeq> Q"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   751
  using ring_iso_set_trans unfolding is_ring_iso_def by blast 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   752
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   753
lemma ring_iso_set_sym:
68604
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   754
  assumes "ring R" and h: "h \<in> ring_iso R S"
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   755
  shows "(inv_into (carrier R) h) \<in> ring_iso S R"
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   756
proof -
68604
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   757
  have h_hom: "h \<in> ring_hom R S"
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   758
    and h_surj: "h ` (carrier R) = (carrier S)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   759
    and h_inj:  "\<And> x1 x2. \<lbrakk> x1 \<in> carrier R; x2 \<in> carrier R \<rbrakk> \<Longrightarrow>  h x1 = h x2 \<Longrightarrow> x1 = x2"
68604
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   760
    using h unfolding ring_iso_def bij_betw_def inj_on_def by auto
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   761
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   762
  have h_inv_bij: "bij_betw (inv_into (carrier R) h) (carrier S) (carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   763
      using bij_betw_inv_into h ring_iso_def by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   764
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   765
  show "inv_into (carrier R) h \<in> ring_iso S R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   766
    apply (rule ring_iso_memI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   767
    apply (simp add: h_surj inv_into_into)
68604
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   768
       apply (auto simp add: h_inv_bij)
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   769
    using ring_iso_memE [OF h] bij_betwE [OF h_inv_bij] 
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   770
    apply (simp_all add: \<open>ring R\<close> bij_betw_def bij_betw_inv_into_right inv_into_f_eq ring.ring_simprules(5))
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   771
    using ring_iso_memE [OF h] bij_betw_inv_into_right [of h "carrier R" "carrier S"]
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   772
    apply (simp add: \<open>ring R\<close> inv_into_f_eq ring.ring_simprules(1))
57721285d4ef elimination of some "smt"
paulson <lp15@cam.ac.uk>
parents: 68584
diff changeset
   773
    by (simp add: \<open>ring R\<close> inv_into_f_eq ring.ring_simprules(6))
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   774
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   775
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   776
corollary ring_iso_sym:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   777
  assumes "ring R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   778
  shows "R \<simeq> S \<Longrightarrow> S \<simeq> R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   779
  using assms ring_iso_set_sym unfolding is_ring_iso_def by auto 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   780
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   781
lemma (in ring_hom_ring) the_elem_simp [simp]:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   782
  "\<And>x. x \<in> carrier R \<Longrightarrow> the_elem (h ` ((a_kernel R S h) +> x)) = h x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   783
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   784
  fix x assume x: "x \<in> carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   785
  hence "h x \<in> h ` ((a_kernel R S h) +> x)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   786
    using homeq_imp_rcos by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   787
  thus "the_elem (h ` ((a_kernel R S h) +> x)) = h x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   788
    by (metis (no_types, lifting) x empty_iff homeq_imp_rcos rcos_imp_homeq the_elem_image_unique)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   789
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   790
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   791
lemma (in ring_hom_ring) the_elem_inj:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   792
  "\<And>X Y. \<lbrakk> X \<in> carrier (R Quot (a_kernel R S h)); Y \<in> carrier (R Quot (a_kernel R S h)) \<rbrakk> \<Longrightarrow>
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   793
           the_elem (h ` X) = the_elem (h ` Y) \<Longrightarrow> X = Y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   794
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   795
  fix X Y
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   796
  assume "X \<in> carrier (R Quot (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   797
     and "Y \<in> carrier (R Quot (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   798
     and Eq: "the_elem (h ` X) = the_elem (h ` Y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   799
  then obtain x y where x: "x \<in> carrier R" "X = (a_kernel R S h) +> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   800
                    and y: "y \<in> carrier R" "Y = (a_kernel R S h) +> y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   801
    unfolding FactRing_def A_RCOSETS_def' by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   802
  hence "h x = h y" using Eq by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   803
  hence "x \<ominus> y \<in> (a_kernel R S h)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   804
    by (simp add: a_minus_def abelian_subgroup.a_rcos_module_imp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   805
                  abelian_subgroup_a_kernel homeq_imp_rcos x(1) y(1))
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   806
  thus "X = Y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   807
    by (metis R.a_coset_add_inv1 R.minus_eq abelian_subgroup.a_rcos_const
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   808
        abelian_subgroup_a_kernel additive_subgroup.a_subset additive_subgroup_a_kernel x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   809
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   810
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   811
lemma (in ring_hom_ring) quot_mem:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   812
  "\<And>X. X \<in> carrier (R Quot (a_kernel R S h)) \<Longrightarrow> \<exists>x \<in> carrier R. X = (a_kernel R S h) +> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   813
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   814
  fix X assume "X \<in> carrier (R Quot (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   815
  thus "\<exists>x \<in> carrier R. X = (a_kernel R S h) +> x"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   816
    unfolding FactRing_simps by (simp add: a_r_coset_def)
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   817
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   818
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   819
lemma (in ring_hom_ring) the_elem_wf:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   820
  "\<And>X. X \<in> carrier (R Quot (a_kernel R S h)) \<Longrightarrow> \<exists>y \<in> carrier S. (h ` X) = { y }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   821
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   822
  fix X assume "X \<in> carrier (R Quot (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   823
  then obtain x where x: "x \<in> carrier R" and X: "X = (a_kernel R S h) +> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   824
    using quot_mem by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   825
  hence "\<And>x'. x' \<in> X \<Longrightarrow> h x' = h x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   826
  proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   827
    fix x' assume "x' \<in> X" hence "x' \<in> (a_kernel R S h) +> x" using X by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   828
    then obtain k where k: "k \<in> a_kernel R S h" "x' = k \<oplus> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   829
      by (metis R.add.inv_closed R.add.m_assoc R.l_neg R.r_zero
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   830
          abelian_subgroup.a_elemrcos_carrier
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   831
          abelian_subgroup.a_rcos_module_imp abelian_subgroup_a_kernel x)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   832
    hence "h x' = h k \<oplus>\<^bsub>S\<^esub> h x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   833
      by (meson additive_subgroup.a_Hcarr additive_subgroup_a_kernel hom_add x)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   834
    also have " ... =  h x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   835
      using k by (auto simp add: x)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   836
    finally show "h x' = h x" .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   837
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   838
  moreover have "h x \<in> h ` X"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   839
    by (simp add: X homeq_imp_rcos x)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   840
  ultimately have "(h ` X) = { h x }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   841
    by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   842
  thus "\<exists>y \<in> carrier S. (h ` X) = { y }" using x by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   843
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   844
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   845
corollary (in ring_hom_ring) the_elem_wf':
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   846
  "\<And>X. X \<in> carrier (R Quot (a_kernel R S h)) \<Longrightarrow> \<exists>r \<in> carrier R. (h ` X) = { h r }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   847
  using the_elem_wf by (metis quot_mem the_elem_eq the_elem_simp) 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   848
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   849
lemma (in ring_hom_ring) the_elem_hom:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   850
  "(\<lambda>X. the_elem (h ` X)) \<in> ring_hom (R Quot (a_kernel R S h)) S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   851
proof (rule ring_hom_memI)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   852
  show "\<And>x. x \<in> carrier (R Quot a_kernel R S h) \<Longrightarrow> the_elem (h ` x) \<in> carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   853
    using the_elem_wf by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   854
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   855
  show "the_elem (h ` \<one>\<^bsub>R Quot a_kernel R S h\<^esub>) = \<one>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   856
    unfolding FactRing_def  using the_elem_simp[of "\<one>\<^bsub>R\<^esub>"] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   857
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   858
  fix X Y
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   859
  assume "X \<in> carrier (R Quot a_kernel R S h)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   860
     and "Y \<in> carrier (R Quot a_kernel R S h)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   861
  then obtain x y where x: "x \<in> carrier R" "X = (a_kernel R S h) +> x"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   862
                    and y: "y \<in> carrier R" "Y = (a_kernel R S h) +> y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   863
    using quot_mem by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   864
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   865
  have "X \<otimes>\<^bsub>R Quot a_kernel R S h\<^esub> Y = (a_kernel R S h) +> (x \<otimes> y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   866
    by (simp add: FactRing_def ideal.rcoset_mult_add kernel_is_ideal x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   867
  thus "the_elem (h ` (X \<otimes>\<^bsub>R Quot a_kernel R S h\<^esub> Y)) = the_elem (h ` X) \<otimes>\<^bsub>S\<^esub> the_elem (h ` Y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   868
    by (simp add: x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   869
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   870
  have "X \<oplus>\<^bsub>R Quot a_kernel R S h\<^esub> Y = (a_kernel R S h) +> (x \<oplus> y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   871
    using ideal.rcos_ring_hom kernel_is_ideal ring_hom_add x y by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   872
  thus "the_elem (h ` (X \<oplus>\<^bsub>R Quot a_kernel R S h\<^esub> Y)) = the_elem (h ` X) \<oplus>\<^bsub>S\<^esub> the_elem (h ` Y)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   873
    by (simp add: x y)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   874
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   875
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   876
lemma (in ring_hom_ring) the_elem_surj:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   877
    "(\<lambda>X. (the_elem (h ` X))) ` carrier (R Quot (a_kernel R S h)) = (h ` (carrier R))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   878
proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   879
  show "(\<lambda>X. the_elem (h ` X)) ` carrier (R Quot a_kernel R S h) \<subseteq> h ` carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   880
    using the_elem_wf' by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   881
next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   882
  show "h ` carrier R \<subseteq> (\<lambda>X. the_elem (h ` X)) ` carrier (R Quot a_kernel R S h)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   883
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   884
    fix y assume "y \<in> h ` carrier R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   885
    then obtain x where x: "x \<in> carrier R" "h x = y"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   886
      by (metis image_iff)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   887
    hence "the_elem (h ` ((a_kernel R S h) +> x)) = y" by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   888
    moreover have "(a_kernel R S h) +> x \<in> carrier (R Quot (a_kernel R S h))"
68673
22d10f94811e de-applying
paulson <lp15@cam.ac.uk>
parents: 68604
diff changeset
   889
     unfolding FactRing_simps by (auto simp add: x a_r_coset_def)
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   890
    ultimately show "y \<in> (\<lambda>X. (the_elem (h ` X))) ` carrier (R Quot (a_kernel R S h))" by blast
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   891
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   892
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   893
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   894
proposition (in ring_hom_ring) FactRing_iso_set_aux:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   895
  "(\<lambda>X. the_elem (h ` X)) \<in> ring_iso (R Quot (a_kernel R S h)) (S \<lparr> carrier := h ` (carrier R) \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   896
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   897
  have "bij_betw (\<lambda>X. the_elem (h ` X)) (carrier (R Quot a_kernel R S h)) (h ` (carrier R))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   898
    unfolding bij_betw_def inj_on_def using the_elem_surj the_elem_inj by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   899
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   900
  moreover
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   901
  have "(\<lambda>X. the_elem (h ` X)): carrier (R Quot (a_kernel R S h)) \<rightarrow> h ` (carrier R)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   902
    using the_elem_wf' by fastforce
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   903
  hence "(\<lambda>X. the_elem (h ` X)) \<in> ring_hom (R Quot (a_kernel R S h)) (S \<lparr> carrier := h ` (carrier R) \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   904
    using the_elem_hom the_elem_wf' unfolding ring_hom_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   905
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   906
  ultimately show ?thesis unfolding ring_iso_def using the_elem_hom by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   907
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   908
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   909
theorem (in ring_hom_ring) FactRing_iso_set:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   910
  assumes "h ` carrier R = carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   911
  shows "(\<lambda>X. the_elem (h ` X)) \<in> ring_iso (R Quot (a_kernel R S h)) S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   912
  using FactRing_iso_set_aux assms by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   913
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   914
corollary (in ring_hom_ring) FactRing_iso:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   915
  assumes "h ` carrier R = carrier S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   916
  shows "R Quot (a_kernel R S h) \<simeq> S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   917
  using FactRing_iso_set assms is_ring_iso_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   918
68583
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   919
corollary (in ring) FactRing_zeroideal:
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   920
  shows "R Quot { \<zero> } \<simeq> R" and "R \<simeq> R Quot { \<zero> }"
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   921
proof -
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   922
  have "ring_hom_ring R R id"
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   923
    using ring_axioms by (auto intro: ring_hom_ringI)
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   924
  moreover have "a_kernel R R id = { \<zero> }"
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   925
    unfolding a_kernel_def' by auto
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   926
  ultimately show "R Quot { \<zero> } \<simeq> R" and "R \<simeq> R Quot { \<zero> }"
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   927
    using ring_hom_ring.FactRing_iso[of R R id]
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   928
          ring_iso_sym[OF ideal.quotient_is_ring[OF zeroideal], of R] by auto
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   929
qed
654e73d05495 even more from Paulo
paulson <lp15@cam.ac.uk>
parents: 68551
diff changeset
   930
68551
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   931
lemma (in ring_hom_ring) img_is_ring: "ring (S \<lparr> carrier := h ` (carrier R) \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   932
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   933
  let ?the_elem = "\<lambda>X. the_elem (h ` X)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   934
  have FactRing_is_ring: "ring (R Quot (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   935
    by (simp add: ideal.quotient_is_ring kernel_is_ideal)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   936
  have "ring ((S \<lparr> carrier := ?the_elem ` (carrier (R Quot (a_kernel R S h))) \<rparr>)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   937
                 \<lparr>     one := ?the_elem \<one>\<^bsub>(R Quot (a_kernel R S h))\<^esub>,
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   938
                      zero := ?the_elem \<zero>\<^bsub>(R Quot (a_kernel R S h))\<^esub> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   939
    using ring.ring_iso_imp_img_ring[OF FactRing_is_ring, of ?the_elem
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   940
          "S \<lparr> carrier := ?the_elem ` (carrier (R Quot (a_kernel R S h))) \<rparr>"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   941
          FactRing_iso_set_aux the_elem_surj by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   942
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   943
  moreover
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   944
  have "\<zero> \<in> (a_kernel R S h)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   945
    using a_kernel_def'[of R S h] by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   946
  hence "\<one> \<in> (a_kernel R S h) +> \<one>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   947
    using a_r_coset_def'[of R "a_kernel R S h" \<one>] by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   948
  hence "\<one>\<^bsub>S\<^esub> \<in> (h ` ((a_kernel R S h) +> \<one>))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   949
    using hom_one by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   950
  hence "?the_elem \<one>\<^bsub>(R Quot (a_kernel R S h))\<^esub> = \<one>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   951
    using the_elem_wf[of "(a_kernel R S h) +> \<one>"] by (simp add: FactRing_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   952
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   953
  moreover
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   954
  have "\<zero>\<^bsub>S\<^esub> \<in> (h ` (a_kernel R S h))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   955
    using a_kernel_def'[of R S h] hom_zero by force
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   956
  hence "\<zero>\<^bsub>S\<^esub> \<in> (h ` \<zero>\<^bsub>(R Quot (a_kernel R S h))\<^esub>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   957
    by (simp add: FactRing_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   958
  hence "?the_elem \<zero>\<^bsub>(R Quot (a_kernel R S h))\<^esub> = \<zero>\<^bsub>S\<^esub>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   959
    using the_elem_wf[OF ring.ring_simprules(2)[OF FactRing_is_ring]]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   960
    by (metis singletonD the_elem_eq) 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   961
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   962
  ultimately
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   963
  have "ring ((S \<lparr> carrier := h ` (carrier R) \<rparr>) \<lparr> one := \<one>\<^bsub>S\<^esub>, zero := \<zero>\<^bsub>S\<^esub> \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   964
    using the_elem_surj by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   965
  thus ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   966
    by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   967
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   968
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   969
lemma (in ring_hom_ring) img_is_cring:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   970
  assumes "cring S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   971
  shows "cring (S \<lparr> carrier := h ` (carrier R) \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   972
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   973
  interpret ring "S \<lparr> carrier := h ` (carrier R) \<rparr>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   974
    using img_is_ring .
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   975
  show ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   976
    apply unfold_locales
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   977
    using assms unfolding cring_def comm_monoid_def comm_monoid_axioms_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   978
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   979
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   980
lemma (in ring_hom_ring) img_is_domain:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   981
  assumes "domain S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   982
  shows "domain (S \<lparr> carrier := h ` (carrier R) \<rparr>)"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   983
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   984
  interpret cring "S \<lparr> carrier := h ` (carrier R) \<rparr>"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   985
    using img_is_cring assms unfolding domain_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   986
  show ?thesis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   987
    apply unfold_locales
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   988
    using assms unfolding domain_def domain_axioms_def apply auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   989
    using hom_closed by blast 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   990
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   991
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   992
proposition (in ring_hom_ring) primeideal_vimage:
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   993
  assumes "cring R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   994
  shows "primeideal P S \<Longrightarrow> primeideal { r \<in> carrier R. h r \<in> P } R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   995
proof -
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   996
  assume A: "primeideal P S"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   997
  hence is_ideal: "ideal P S" unfolding primeideal_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   998
  have "ring_hom_ring R (S Quot P) (((+>\<^bsub>S\<^esub>) P) \<circ> h)" (is "ring_hom_ring ?A ?B ?h")
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
   999
    using ring_hom_trans[OF homh, of "(+>\<^bsub>S\<^esub>) P" "S Quot P"]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1000
          ideal.rcos_ring_hom_ring[OF is_ideal] assms
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1001
    unfolding ring_hom_ring_def ring_hom_ring_axioms_def cring_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1002
  then interpret hom: ring_hom_ring R "S Quot P" "((+>\<^bsub>S\<^esub>) P) \<circ> h" by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1003
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1004
  have "inj_on (\<lambda>X. the_elem (?h ` X)) (carrier (R Quot (a_kernel R (S Quot P) ?h)))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1005
    using hom.the_elem_inj unfolding inj_on_def by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1006
  moreover
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1007
  have "ideal (a_kernel R (S Quot P) ?h) R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1008
    using hom.kernel_is_ideal by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1009
  have hom': "ring_hom_ring (R Quot (a_kernel R (S Quot P) ?h)) (S Quot P) (\<lambda>X. the_elem (?h ` X))"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1010
    using hom.the_elem_hom hom.kernel_is_ideal
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1011
    by (meson hom.ring_hom_ring_axioms ideal.rcos_ring_hom_ring ring_hom_ring_axioms_def ring_hom_ring_def)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1012
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1013
  ultimately
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1014
  have "primeideal (a_kernel R (S Quot P) ?h) R"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1015
    using ring_hom_ring.inj_on_domain[OF hom'] primeideal.quotient_is_domain[OF A]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1016
          cring.quot_domain_imp_primeideal[OF assms hom.kernel_is_ideal] by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1017
  
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1018
  moreover have "a_kernel R (S Quot P) ?h = { r \<in> carrier R. h r \<in> P }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1019
  proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1020
    show "a_kernel R (S Quot P) ?h \<subseteq> { r \<in> carrier R. h r \<in> P }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1021
    proof 
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1022
      fix r assume "r \<in> a_kernel R (S Quot P) ?h"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1023
      hence r: "r \<in> carrier R" "P +>\<^bsub>S\<^esub> (h r) = P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1024
        unfolding a_kernel_def kernel_def FactRing_def by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1025
      hence "h r \<in> P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1026
        using S.a_rcosI R.l_zero S.l_zero additive_subgroup.a_subset[OF ideal.axioms(1)[OF is_ideal]]
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1027
              additive_subgroup.zero_closed[OF ideal.axioms(1)[OF is_ideal]] hom_closed by metis
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1028
      thus "r \<in> { r \<in> carrier R. h r \<in> P }" using r by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1029
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1030
  next
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1031
    show "{ r \<in> carrier R. h r \<in> P } \<subseteq> a_kernel R (S Quot P) ?h"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1032
    proof
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1033
      fix r assume "r \<in> { r \<in> carrier R. h r \<in> P }"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1034
      hence r: "r \<in> carrier R" "h r \<in> P" by simp_all
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1035
      hence "?h r = P"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1036
        by (simp add: S.a_coset_join2 additive_subgroup.a_subgroup ideal.axioms(1) is_ideal)
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1037
      thus "r \<in> a_kernel R (S Quot P) ?h"
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1038
        unfolding a_kernel_def kernel_def FactRing_def using r(1) by auto
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1039
    qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1040
  qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1041
  ultimately show "primeideal { r \<in> carrier R. h r \<in> P } R" by simp
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1042
qed
b680e74eb6f2 More on Algebra by Paulo and Martin
paulson <lp15@cam.ac.uk>
parents: 67443
diff changeset
  1043
20318
0e0ea63fe768 Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff changeset
  1044
end