src/HOL/Algebra/RingHom.thy
author ballarin
Tue Dec 16 21:10:53 2008 +0100 (2008-12-16)
changeset 29237 e90d9d51106b
parent 28823 dcbef866c9e2
child 29240 bb81c3709fb6
permissions -rw-r--r--
More porting to new locales.
ballarin@20318
     1
(*
ballarin@20318
     2
  Title:     HOL/Algebra/RingHom.thy
ballarin@20318
     3
  Author:    Stephan Hohe, TU Muenchen
ballarin@20318
     4
*)
ballarin@20318
     5
ballarin@20318
     6
theory RingHom
ballarin@20318
     7
imports Ideal
ballarin@20318
     8
begin
ballarin@20318
     9
ballarin@20318
    10
section {* Homomorphisms of Non-Commutative Rings *}
ballarin@20318
    11
wenzelm@21502
    12
text {* Lifting existing lemmas in a @{text ring_hom_ring} locale *}
ballarin@29237
    13
locale ring_hom_ring = R: ring R + S: ring S +
ballarin@29237
    14
  fixes h
ballarin@20318
    15
  assumes homh: "h \<in> ring_hom R S"
ballarin@20318
    16
  notes hom_mult [simp] = ring_hom_mult [OF homh]
ballarin@20318
    17
    and hom_one [simp] = ring_hom_one [OF homh]
ballarin@20318
    18
ballarin@29237
    19
sublocale ring_hom_cring \<subseteq> ring_hom_ring
haftmann@28823
    20
  proof qed (rule homh)
ballarin@20318
    21
ballarin@29237
    22
sublocale ring_hom_ring \<subseteq> abelian_group_hom R S
ballarin@20318
    23
apply (rule abelian_group_homI)
ballarin@20318
    24
  apply (rule R.is_abelian_group)
ballarin@20318
    25
 apply (rule S.is_abelian_group)
ballarin@20318
    26
apply (intro group_hom.intro group_hom_axioms.intro)
ballarin@20318
    27
  apply (rule R.a_group)
ballarin@20318
    28
 apply (rule S.a_group)
ballarin@20318
    29
apply (insert homh, unfold hom_def ring_hom_def)
ballarin@20318
    30
apply simp
ballarin@20318
    31
done
ballarin@20318
    32
ballarin@20318
    33
lemma (in ring_hom_ring) is_ring_hom_ring:
ballarin@27611
    34
  "ring_hom_ring R S h"
ballarin@27611
    35
  by (rule ring_hom_ring_axioms)
ballarin@20318
    36
ballarin@20318
    37
lemma ring_hom_ringI:
ballarin@27611
    38
  fixes R (structure) and S (structure)
ballarin@27611
    39
  assumes "ring R" "ring S"
ballarin@20318
    40
  assumes (* morphism: "h \<in> carrier R \<rightarrow> carrier S" *)
ballarin@20318
    41
          hom_closed: "!!x. x \<in> carrier R ==> h x \<in> carrier S"
ballarin@20318
    42
      and compatible_mult: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
ballarin@20318
    43
      and compatible_add: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y"
ballarin@20318
    44
      and compatible_one: "h \<one> = \<one>\<^bsub>S\<^esub>"
ballarin@20318
    45
  shows "ring_hom_ring R S h"
ballarin@27611
    46
proof -
ballarin@29237
    47
  interpret ring R by fact
ballarin@29237
    48
  interpret ring S by fact
ballarin@27611
    49
  show ?thesis apply unfold_locales
ballarin@20318
    50
apply (unfold ring_hom_def, safe)
wenzelm@23463
    51
   apply (simp add: hom_closed Pi_def)
wenzelm@23463
    52
  apply (erule (1) compatible_mult)
wenzelm@23463
    53
 apply (erule (1) compatible_add)
wenzelm@23463
    54
apply (rule compatible_one)
ballarin@20318
    55
done
ballarin@27611
    56
qed
ballarin@20318
    57
ballarin@20318
    58
lemma ring_hom_ringI2:
ballarin@27611
    59
  assumes "ring R" "ring S"
wenzelm@23350
    60
  assumes h: "h \<in> ring_hom R S"
ballarin@20318
    61
  shows "ring_hom_ring R S h"
ballarin@27611
    62
proof -
ballarin@29237
    63
  interpret R!: ring R by fact
ballarin@29237
    64
  interpret S!: ring S by fact
ballarin@27611
    65
  show ?thesis apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro)
ballarin@27611
    66
    apply (rule R.is_ring)
ballarin@27611
    67
    apply (rule S.is_ring)
ballarin@27611
    68
    apply (rule h)
ballarin@27611
    69
    done
ballarin@27611
    70
qed
ballarin@20318
    71
ballarin@20318
    72
lemma ring_hom_ringI3:
ballarin@27611
    73
  fixes R (structure) and S (structure)
ballarin@27611
    74
  assumes "abelian_group_hom R S h" "ring R" "ring S" 
ballarin@20318
    75
  assumes compatible_mult: "!!x y. [| x : carrier R; y : carrier R |] ==> h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y"
ballarin@20318
    76
      and compatible_one: "h \<one> = \<one>\<^bsub>S\<^esub>"
ballarin@20318
    77
  shows "ring_hom_ring R S h"
ballarin@27611
    78
proof -
ballarin@29237
    79
  interpret abelian_group_hom R S h by fact
ballarin@29237
    80
  interpret R!: ring R by fact
ballarin@29237
    81
  interpret S!: ring S by fact
ballarin@27611
    82
  show ?thesis apply (intro ring_hom_ring.intro ring_hom_ring_axioms.intro, rule R.is_ring, rule S.is_ring)
ballarin@27611
    83
    apply (insert group_hom.homh[OF a_group_hom])
ballarin@27611
    84
    apply (unfold hom_def ring_hom_def, simp)
ballarin@27611
    85
    apply safe
ballarin@27611
    86
    apply (erule (1) compatible_mult)
ballarin@27611
    87
    apply (rule compatible_one)
ballarin@27611
    88
    done
ballarin@27611
    89
qed
ballarin@20318
    90
ballarin@20318
    91
lemma ring_hom_cringI:
ballarin@27611
    92
  assumes "ring_hom_ring R S h" "cring R" "cring S"
ballarin@20318
    93
  shows "ring_hom_cring R S h"
ballarin@27611
    94
proof -
ballarin@29237
    95
  interpret ring_hom_ring R S h by fact
ballarin@29237
    96
  interpret R!: cring R by fact
ballarin@29237
    97
  interpret S!: cring S by fact
ballarin@27611
    98
  show ?thesis by (intro ring_hom_cring.intro ring_hom_cring_axioms.intro)
wenzelm@23463
    99
    (rule R.is_cring, rule S.is_cring, rule homh)
ballarin@27611
   100
qed
ballarin@20318
   101
ballarin@27717
   102
subsection {* The Kernel of a Ring Homomorphism *}
ballarin@20318
   103
ballarin@20318
   104
--"the kernel of a ring homomorphism is an ideal"
ballarin@20318
   105
lemma (in ring_hom_ring) kernel_is_ideal:
ballarin@20318
   106
  shows "ideal (a_kernel R S h) R"
ballarin@20318
   107
apply (rule idealI)
ballarin@20318
   108
   apply (rule R.is_ring)
ballarin@20318
   109
  apply (rule additive_subgroup.a_subgroup[OF additive_subgroup_a_kernel])
ballarin@20318
   110
 apply (unfold a_kernel_def', simp+)
ballarin@20318
   111
done
ballarin@20318
   112
ballarin@20318
   113
text {* Elements of the kernel are mapped to zero *}
ballarin@20318
   114
lemma (in abelian_group_hom) kernel_zero [simp]:
ballarin@20318
   115
  "i \<in> a_kernel R S h \<Longrightarrow> h i = \<zero>\<^bsub>S\<^esub>"
ballarin@20318
   116
by (simp add: a_kernel_defs)
ballarin@20318
   117
ballarin@20318
   118
ballarin@20318
   119
subsection {* Cosets *}
ballarin@20318
   120
ballarin@20318
   121
text {* Cosets of the kernel correspond to the elements of the image of the homomorphism *}
ballarin@20318
   122
lemma (in ring_hom_ring) rcos_imp_homeq:
ballarin@20318
   123
  assumes acarr: "a \<in> carrier R"
ballarin@20318
   124
      and xrcos: "x \<in> a_kernel R S h +> a"
ballarin@20318
   125
  shows "h x = h a"
ballarin@20318
   126
proof -
ballarin@29237
   127
  interpret ideal "a_kernel R S h" "R" by (rule kernel_is_ideal)
ballarin@20318
   128
ballarin@20318
   129
  from xrcos
ballarin@20318
   130
      have "\<exists>i \<in> a_kernel R S h. x = i \<oplus> a" by (simp add: a_r_coset_defs)
ballarin@20318
   131
  from this obtain i
ballarin@20318
   132
      where iker: "i \<in> a_kernel R S h"
ballarin@20318
   133
        and x: "x = i \<oplus> a"
ballarin@20318
   134
      by fast+
ballarin@20318
   135
  note carr = acarr iker[THEN a_Hcarr]
ballarin@20318
   136
ballarin@20318
   137
  from x
ballarin@20318
   138
      have "h x = h (i \<oplus> a)" by simp
ballarin@20318
   139
  also from carr
ballarin@20318
   140
      have "\<dots> = h i \<oplus>\<^bsub>S\<^esub> h a" by simp
ballarin@20318
   141
  also from iker
ballarin@20318
   142
      have "\<dots> = \<zero>\<^bsub>S\<^esub> \<oplus>\<^bsub>S\<^esub> h a" by simp
ballarin@20318
   143
  also from carr
ballarin@20318
   144
      have "\<dots> = h a" by simp
ballarin@20318
   145
  finally
ballarin@20318
   146
      show "h x = h a" .
ballarin@20318
   147
qed
ballarin@20318
   148
ballarin@20318
   149
lemma (in ring_hom_ring) homeq_imp_rcos:
ballarin@20318
   150
  assumes acarr: "a \<in> carrier R"
ballarin@20318
   151
      and xcarr: "x \<in> carrier R"
ballarin@20318
   152
      and hx: "h x = h a"
ballarin@20318
   153
  shows "x \<in> a_kernel R S h +> a"
ballarin@20318
   154
proof -
ballarin@29237
   155
  interpret ideal "a_kernel R S h" "R" by (rule kernel_is_ideal)
ballarin@20318
   156
 
ballarin@20318
   157
  note carr = acarr xcarr
ballarin@20318
   158
  note hcarr = acarr[THEN hom_closed] xcarr[THEN hom_closed]
ballarin@20318
   159
ballarin@20318
   160
  from hx and hcarr
ballarin@20318
   161
      have a: "h x \<oplus>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub>h a = \<zero>\<^bsub>S\<^esub>" by algebra
ballarin@20318
   162
  from carr
ballarin@20318
   163
      have "h x \<oplus>\<^bsub>S\<^esub> \<ominus>\<^bsub>S\<^esub>h a = h (x \<oplus> \<ominus>a)" by simp
ballarin@20318
   164
  from a and this
ballarin@20318
   165
      have b: "h (x \<oplus> \<ominus>a) = \<zero>\<^bsub>S\<^esub>" by simp
ballarin@20318
   166
ballarin@20318
   167
  from carr have "x \<oplus> \<ominus>a \<in> carrier R" by simp
ballarin@20318
   168
  from this and b
ballarin@20318
   169
      have "x \<oplus> \<ominus>a \<in> a_kernel R S h" 
ballarin@20318
   170
      unfolding a_kernel_def'
ballarin@20318
   171
      by fast
ballarin@20318
   172
ballarin@20318
   173
  from this and carr
ballarin@20318
   174
      show "x \<in> a_kernel R S h +> a" by (simp add: a_rcos_module_rev)
ballarin@20318
   175
qed
ballarin@20318
   176
ballarin@20318
   177
corollary (in ring_hom_ring) rcos_eq_homeq:
ballarin@20318
   178
  assumes acarr: "a \<in> carrier R"
ballarin@20318
   179
  shows "(a_kernel R S h) +> a = {x \<in> carrier R. h x = h a}"
ballarin@20318
   180
apply rule defer 1
ballarin@20318
   181
apply clarsimp defer 1
ballarin@20318
   182
proof
ballarin@29237
   183
  interpret ideal "a_kernel R S h" "R" by (rule kernel_is_ideal)
ballarin@20318
   184
ballarin@20318
   185
  fix x
ballarin@20318
   186
  assume xrcos: "x \<in> a_kernel R S h +> a"
ballarin@20318
   187
  from acarr and this
ballarin@20318
   188
      have xcarr: "x \<in> carrier R"
ballarin@20318
   189
      by (rule a_elemrcos_carrier)
ballarin@20318
   190
ballarin@20318
   191
  from xrcos
ballarin@20318
   192
      have "h x = h a" by (rule rcos_imp_homeq[OF acarr])
ballarin@20318
   193
  from xcarr and this
ballarin@20318
   194
      show "x \<in> {x \<in> carrier R. h x = h a}" by fast
ballarin@20318
   195
next
ballarin@29237
   196
  interpret ideal "a_kernel R S h" "R" by (rule kernel_is_ideal)
ballarin@20318
   197
ballarin@20318
   198
  fix x
ballarin@20318
   199
  assume xcarr: "x \<in> carrier R"
ballarin@20318
   200
     and hx: "h x = h a"
ballarin@20318
   201
  from acarr xcarr hx
ballarin@20318
   202
      show "x \<in> a_kernel R S h +> a" by (rule homeq_imp_rcos)
ballarin@20318
   203
qed
ballarin@20318
   204
ballarin@20318
   205
end