src/HOL/GroupTheory/Ring.thy
author ballarin
Thu, 28 Nov 2002 10:50:42 +0100
changeset 13735 7de9342aca7a
parent 13592 dfe0c7191125
permissions -rw-r--r--
HOL-Algebra partially ported to Isar.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11451
8abfb4f7bd02 partial restructuring to reduce dependence on Axiom of Choice
paulson
parents: 11448
diff changeset
     1
(*  Title:      HOL/GroupTheory/Ring
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
     2
    ID:         $Id$
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
     3
    Author:     Florian Kammueller, with new proofs by L C Paulson
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
     4
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
     5
*)
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
     6
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
     7
header{*Ring Theory*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
     8
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
     9
theory Ring = Bij + Coset:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    10
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    11
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    12
subsection{*Definition of a Ring*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    13
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    14
record 'a ring  = "'a group" +
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    15
  prod :: "'a \<Rightarrow> 'a \<Rightarrow> 'a"    (infixl "\<cdot>\<index>" 70)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    16
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    17
record 'a unit_ring  = "'a ring" +
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    18
  one :: 'a    ("\<one>\<index>")
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    19
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    20
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    21
text{*Abbrevations for the left and right distributive laws*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    22
constdefs
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    23
  distrib_l :: "['a set, ['a, 'a] => 'a, ['a, 'a] => 'a] => bool"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    24
    "distrib_l A f g ==
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    25
       (\<forall>x \<in> A. \<forall>y \<in> A. \<forall>z \<in> A. (f x (g y z) = g (f x y) (f x z)))"
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
    26
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    27
  distrib_r       :: "['a set, ['a, 'a] => 'a, ['a, 'a] => 'a] => bool"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    28
    "distrib_r A f g == 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    29
       (\<forall>x \<in> A. \<forall>y \<in> A. \<forall>z \<in> A. (f (g y z) x = g (f y x) (f z x)))"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    30
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    31
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    32
locale ring = abelian_group R +
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    33
  assumes prod_funcset: "prod R \<in> carrier R \<rightarrow> carrier R \<rightarrow> carrier R"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    34
      and prod_assoc:   
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    35
            "[|x \<in> carrier R; y \<in> carrier R; z \<in> carrier R|] 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    36
             ==> (x \<cdot> y) \<cdot> z = x \<cdot> (y \<cdot> z)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    37
      and left:  "distrib_l (carrier R) (prod R) (sum R)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    38
      and right: "distrib_r (carrier R) (prod R) (sum R)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    39
13592
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    40
constdefs
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    41
  Ring :: "('a,'b) ring_scheme set"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    42
   "Ring == Collect ring"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    43
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    44
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    45
lemma ring_is_abelian_group: "ring(R) ==> abelian_group(R)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    46
by (simp add: ring_def abelian_group_def)
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
    47
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    48
text{*Construction of a ring from a semigroup and an Abelian group*}
13592
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    49
lemma ringI:
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    50
     "[|abelian_group R; 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    51
        semigroup(|carrier = carrier R, sum = prod R|);
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    52
        distrib_l (carrier R) (prod R) (sum R);
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
    53
        distrib_r (carrier R) (prod R) (sum R)|] ==> ring R"
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    54
by (simp add: abelian_group_def ring_def ring_axioms_def semigroup_def) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    55
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    56
lemma (in ring) prod_closed [simp]:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    57
     "[| x \<in> carrier R; y \<in> carrier R |] ==>  x \<cdot> y \<in> carrier R"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    58
apply (insert prod_funcset) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    59
apply (blast dest: funcset_mem) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    60
done
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    61
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    62
declare ring.prod_closed [simp]
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    63
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    64
lemma (in ring) sum_closed:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    65
     "[| x \<in> carrier R; y \<in> carrier R |] ==>  x \<oplus> y \<in> carrier R"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    66
by simp 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    67
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    68
declare ring.sum_closed [simp]
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
    69
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    70
lemma (in ring) distrib_left:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    71
     "[|x \<in> carrier R; y \<in> carrier R; z \<in> carrier R|]  
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    72
      ==> x \<cdot> (y \<oplus> z) = (x \<cdot> y) \<oplus> (x \<cdot> z)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    73
apply (insert left) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    74
apply (simp add: distrib_l_def)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    75
done
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    76
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    77
lemma (in ring) distrib_right:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    78
     "[|x \<in> carrier R; y \<in> carrier R; z \<in> carrier R|]  
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    79
      ==> (y \<oplus> z) \<cdot> x = (y \<cdot> x) \<oplus> (z \<cdot> x)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    80
apply (insert right) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    81
apply (simp add: distrib_r_def)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    82
done
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    83
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    84
lemma (in ring) prod_zero_left: "x \<in> carrier R ==> \<zero> \<cdot> x = \<zero>"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    85
by (simp add: idempotent_imp_zero distrib_right [symmetric])
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    86
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    87
lemma (in ring) prod_zero_right: "x \<in> carrier R ==> x \<cdot> \<zero> = \<zero>"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    88
by (simp add: idempotent_imp_zero distrib_left [symmetric])
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    89
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    90
lemma (in ring) prod_minus_left:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    91
     "[|x \<in> carrier R; y \<in> carrier R|]  
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    92
      ==> (\<ominus>x) \<cdot> y = \<ominus> (x \<cdot> y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    93
by (simp add: minus_unique prod_zero_left distrib_right [symmetric]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    94
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    95
lemma (in ring) prod_minus_right:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    96
     "[|x \<in> carrier R; y \<in> carrier R|]  
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    97
      ==> x \<cdot> (\<ominus>y) = \<ominus> (x \<cdot> y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    98
by (simp add: minus_unique prod_zero_right distrib_left [symmetric]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
    99
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   100
13592
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   101
subsection {*Example: The Ring of Integers*}
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   102
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   103
constdefs
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   104
 integers :: "int ring"
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   105
  "integers == (|carrier = UNIV, 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   106
                 sum = op +,
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   107
                 gminus = (%x. -x),
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   108
                 zero = 0::int,
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   109
                 prod = op *|)"
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   110
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   111
theorem ring_integers: "ring (integers)"
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   112
by (simp add: integers_def ring_def ring_axioms_def 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   113
              distrib_l_def distrib_r_def 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   114
              zadd_zmult_distrib zadd_zmult_distrib2 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   115
              abelian_group_axioms_def group_axioms_def semigroup_def) 
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   116
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   117
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   118
subsection {*Ring Homomorphisms*}
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   119
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   120
constdefs
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   121
 ring_hom :: "[('a,'c)ring_scheme, ('b,'d)ring_scheme] => ('a => 'b)set"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   122
  "ring_hom R R' ==
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   123
   {h. h \<in> carrier R -> carrier R' & 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   124
       (\<forall>x \<in> carrier R. \<forall>y \<in> carrier R. h(sum R x y) = sum R' (h x) (h y)) &
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   125
       (\<forall>x \<in> carrier R. \<forall>y \<in> carrier R. h(prod R x y) = prod R' (h x) (h y))}"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   126
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   127
 ring_auto :: "('a,'b)ring_scheme => ('a => 'a)set"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   128
  "ring_auto R == ring_hom R R \<inter> Bij(carrier R)"
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   129
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   130
  RingAutoGroup :: "[('a,'c) ring_scheme] => ('a=>'a) group"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   131
  "RingAutoGroup R == BijGroup (carrier R) (|carrier := ring_auto R |)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   132
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   133
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   134
lemma ring_hom_subset_hom: "ring_hom R R' <= hom R R'"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   135
by (force simp add: ring_hom_def hom_def)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   136
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   137
subsection{*The Ring Automorphisms From a Group*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   138
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   139
lemma id_in_ring_auto: "ring R ==> (%x: carrier R. x) \<in> ring_auto R"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   140
by (simp add: ring_auto_def ring_hom_def restrictI ring.axioms id_Bij) 
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   141
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   142
lemma restrict_Inv_ring_hom:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   143
      "[|ring R; h \<in> ring_hom R R; h \<in> Bij (carrier R)|]
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   144
       ==> restrict (Inv (carrier R) h) (carrier R) \<in> ring_hom R R"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   145
by (simp add: ring.axioms group.axioms 
13592
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   146
              ring_hom_def Bij_Inv_mem restrictI 
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   147
              semigroup.sum_funcset ring.prod_funcset Bij_Inv_lemma)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   148
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   149
text{*Ring automorphisms are a subgroup of the group of bijections over the 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   150
   ring's carrier, and thus a group*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   151
lemma subgroup_ring_auto:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   152
      "ring R ==> subgroup (ring_auto R) (BijGroup (carrier R))"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   153
apply (rule group.subgroupI) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   154
    apply (rule group_BijGroup) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   155
   apply (force simp add: ring_auto_def BijGroup_def) 
13592
dfe0c7191125 new Ring example
paulson
parents: 13583
diff changeset
   156
  apply (blast dest: id_in_ring_auto) 
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   157
 apply (simp add: ring_auto_def BijGroup_def restrict_Inv_Bij
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   158
                  restrict_Inv_ring_hom) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   159
apply (simp add: ring_auto_def BijGroup_def compose_Bij)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   160
apply (simp add: ring_hom_def compose_def Pi_def)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   161
done
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   162
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   163
lemma ring_auto: "ring R ==> group (RingAutoGroup R)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   164
apply (drule subgroup_ring_auto) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   165
apply (simp add: subgroup_def RingAutoGroup_def) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   166
done
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   167
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   168
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   169
subsection{*A Locale for a Pair of Rings and a Homomorphism*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   170
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   171
locale ring_homomorphism = ring R + ring R' +
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   172
  fixes h
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   173
  assumes homh: "h \<in> ring_hom R R'"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   174
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   175
lemma ring_hom_sum:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   176
     "[|h \<in> ring_hom R R'; x \<in> carrier R; y \<in> carrier R|] 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   177
      ==> h(sum R x y) = sum R' (h x) (h y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   178
by (simp add: ring_hom_def) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   179
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   180
lemma ring_hom_prod:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   181
     "[|h \<in> ring_hom R R'; x \<in> carrier R; y \<in> carrier R|] 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   182
      ==> h(prod R x y) = prod R' (h x) (h y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   183
by (simp add: ring_hom_def) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   184
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   185
lemma ring_hom_closed:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   186
     "[|h \<in> ring_hom G G'; x \<in> carrier G|] ==> h x \<in> carrier G'"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   187
by (auto simp add: ring_hom_def funcset_mem)
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   188
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   189
lemma (in ring_homomorphism) ring_hom_sum [simp]:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   190
     "[|x \<in> carrier R; y \<in> carrier R|] ==> h (x \<oplus>\<^sub>1 y) = (h x) \<oplus>\<^sub>2 (h y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   191
by (simp add: ring_hom_sum [OF homh])
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   192
13583
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   193
lemma (in ring_homomorphism) ring_hom_prod [simp]:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   194
     "[|x \<in> carrier R; y \<in> carrier R|] ==> h (x \<cdot>\<^sub>1 y) = (h x) \<cdot>\<^sub>2 (h y)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   195
by (simp add: ring_hom_prod [OF homh])
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   196
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   197
lemma (in ring_homomorphism) group_homomorphism: "group_homomorphism R R' h"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   198
by (simp add: group_homomorphism_def group_homomorphism_axioms_def
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   199
              prems homh ring_hom_subset_hom [THEN subsetD])
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   200
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   201
lemma (in ring_homomorphism) hom_zero_closed [simp]: "h \<zero>\<^sub>1 \<in> carrier R'"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   202
by (simp add: ring_hom_closed [OF homh]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   203
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   204
lemma (in ring_homomorphism) hom_zero [simp]: "h \<zero>\<^sub>1 = \<zero>\<^sub>2"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   205
by (rule group_homomorphism.hom_zero [OF group_homomorphism]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   206
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   207
lemma (in ring_homomorphism) hom_minus_closed [simp]:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   208
     "x \<in> carrier R ==> h (\<ominus>x) \<in> carrier R'"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   209
by (rule group_homomorphism.hom_minus_closed [OF group_homomorphism]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   210
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   211
lemma (in ring_homomorphism) hom_minus [simp]:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   212
     "x \<in> carrier R ==> h (\<ominus>\<^sub>1 x) = \<ominus>\<^sub>2 (h x)"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   213
by (rule group_homomorphism.hom_minus [OF group_homomorphism]) 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   214
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   215
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   216
text{*Needed because the standard theorem @{text "ring_homomorphism.intro"} 
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   217
is unnatural.*}
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   218
lemma ring_homomorphismI:
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   219
    "[|ring R; ring R'; h \<in> ring_hom R R'|] ==> ring_homomorphism R R' h"
5fcc8bf538ee converted to Isar and using new "implicit structures" instead of Sigma, etc
paulson
parents: 12459
diff changeset
   220
by (simp add: ring_def ring_homomorphism_def ring_homomorphism_axioms_def)
11448
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   221
aa519e0cc050 Final version of Florian Kammueller's examples
paulson
parents:
diff changeset
   222
end