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