author | ballarin |
Tue, 01 Apr 2003 16:08:34 +0200 | |
changeset 13889 | 6676ac2527fa |
parent 13864 | f44f121dd275 |
child 13936 | d3671b878828 |
permissions | -rw-r--r-- |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
1 |
(* |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
2 |
Title: The algebraic hierarchy of rings |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
3 |
Id: $Id$ |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
4 |
Author: Clemens Ballarin, started 9 December 1996 |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
5 |
Copyright: Clemens Ballarin |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
6 |
*) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
7 |
|
13864 | 8 |
theory CRing = Summation |
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
9 |
files ("ringsimp.ML"): |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
10 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
11 |
section {* The Algebraic Hierarchy of Rings *} |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
12 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
13 |
subsection {* Basic Definitions *} |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
14 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
15 |
record 'a ring = "'a group" + |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
16 |
zero :: 'a ("\<zero>\<index>") |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
17 |
add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
18 |
a_inv :: "'a => 'a" ("\<ominus>\<index> _" [81] 80) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
19 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
20 |
locale cring = abelian_monoid R + |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
21 |
assumes a_abelian_group: "abelian_group (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
22 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
23 |
and m_inv_def: "[| EX y. y \<in> carrier R & x \<otimes> y = \<one>; x \<in> carrier R |] |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
24 |
==> inv x = (THE y. y \<in> carrier R & x \<otimes> y = \<one>)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
25 |
and l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
26 |
==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
27 |
|
13889
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
28 |
text {* Derived operation. *} |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
29 |
|
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
30 |
constdefs |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
31 |
minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65) |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
32 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> minus R x y == add R x (a_inv R y)" |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
33 |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
34 |
(* |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
35 |
-- {* Definition of derived operations *} |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
36 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
37 |
minus_def: "a - b = a + (-b)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
38 |
inverse_def: "inverse a = (if a dvd 1 then THE x. a*x = 1 else 0)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
39 |
divide_def: "a / b = a * inverse b" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
40 |
power_def: "a ^ n = nat_rec 1 (%u b. b * a) n" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
41 |
*) |
13864 | 42 |
|
43 |
locale "domain" = cring + |
|
44 |
assumes one_not_zero [simp]: "\<one> ~= \<zero>" |
|
45 |
and integral: "[| a \<otimes> b = \<zero>; a \<in> carrier R; b \<in> carrier R |] ==> |
|
46 |
a = \<zero> | b = \<zero>" |
|
47 |
||
48 |
subsection {* Basic Facts of Rings *} |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
49 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
50 |
lemma (in cring) a_magma [simp, intro]: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
51 |
"magma (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
52 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
53 |
using a_abelian_group by (simp only: abelian_group_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
54 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
55 |
lemma (in cring) a_l_one [simp, intro]: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
56 |
"l_one (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
57 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
58 |
using a_abelian_group by (simp only: abelian_group_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
59 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
60 |
lemma (in cring) a_abelian_group_parts [simp, intro]: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
61 |
"semigroup_axioms (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
62 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
63 |
"group_axioms (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
64 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
65 |
"abelian_semigroup_axioms (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
66 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
67 |
using a_abelian_group by (simp_all only: abelian_group_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
68 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
69 |
lemma (in cring) a_semigroup: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
70 |
"semigroup (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
71 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
72 |
by (simp add: semigroup_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
73 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
74 |
lemma (in cring) a_group: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
75 |
"group (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
76 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
77 |
by (simp add: group_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
78 |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
79 |
lemma (in cring) a_abelian_semigroup: |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
80 |
"abelian_semigroup (| carrier = carrier R, |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
81 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
82 |
by (simp add: abelian_semigroup_def) |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
83 |
|
13864 | 84 |
lemmas group_record_simps = semigroup.simps monoid.simps group.simps |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
85 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
86 |
lemmas (in cring) a_closed [intro, simp] = |
13864 | 87 |
magma.m_closed [OF a_magma, simplified group_record_simps] |
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
88 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
89 |
lemmas (in cring) zero_closed [intro, simp] = |
13864 | 90 |
l_one.one_closed [OF a_l_one, simplified group_record_simps] |
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
91 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
92 |
lemmas (in cring) a_inv_closed [intro, simp] = |
13864 | 93 |
group.inv_closed [OF a_group, simplified group_record_simps] |
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
94 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
95 |
lemma (in cring) minus_closed [intro, simp]: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
96 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus> y \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
97 |
by (simp add: minus_def) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
98 |
|
13864 | 99 |
lemmas (in cring) a_l_cancel [simp] = |
100 |
group.l_cancel [OF a_group, simplified group_record_simps] |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
101 |
|
13864 | 102 |
lemmas (in cring) a_r_cancel [simp] = |
103 |
group.r_cancel [OF a_group, simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
104 |
|
13864 | 105 |
lemmas (in cring) a_assoc = |
106 |
semigroup.m_assoc [OF a_semigroup, simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
107 |
|
13864 | 108 |
lemmas (in cring) l_zero [simp] = |
109 |
l_one.l_one [OF a_l_one, simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
110 |
|
13864 | 111 |
lemmas (in cring) l_neg = |
112 |
group.l_inv [OF a_group, simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
113 |
|
13864 | 114 |
lemmas (in cring) a_comm = |
115 |
abelian_semigroup.m_comm [OF a_abelian_semigroup, |
|
116 |
simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
117 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
118 |
lemmas (in cring) a_lcomm = |
13864 | 119 |
abelian_semigroup.m_lcomm [OF a_abelian_semigroup, simplified group_record_simps] |
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
120 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
121 |
lemma (in cring) r_zero [simp]: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
122 |
"x \<in> carrier R ==> x \<oplus> \<zero> = x" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
123 |
using group.r_one [OF a_group] |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
124 |
by simp |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
125 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
126 |
lemma (in cring) r_neg: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
127 |
"x \<in> carrier R ==> x \<oplus> (\<ominus> x) = \<zero>" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
128 |
using group.r_inv [OF a_group] |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
129 |
by simp |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
130 |
|
13864 | 131 |
lemmas (in cring) minus_zero [simp] = |
132 |
group.inv_one [OF a_group, simplified group_record_simps] |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
133 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
134 |
lemma (in cring) minus_minus [simp]: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
135 |
"x \<in> carrier R ==> \<ominus> (\<ominus> x) = x" |
13864 | 136 |
using group.inv_inv [OF a_group, simplified group_record_simps] |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
137 |
by simp |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
138 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
139 |
lemma (in cring) minus_add: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
140 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> \<ominus> (x \<oplus> y) = \<ominus> x \<oplus> \<ominus> y" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
141 |
using abelian_group.inv_mult [OF a_abelian_group] |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
142 |
by simp |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
143 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
144 |
lemmas (in cring) a_ac = a_assoc a_comm a_lcomm |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
145 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
146 |
subsection {* Normaliser for Commutative Rings *} |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
147 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
148 |
lemma (in cring) r_neg2: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
149 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
150 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
151 |
assume G: "x \<in> carrier R" "y \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
152 |
then have "(x \<oplus> \<ominus> x) \<oplus> y = y" by (simp only: r_neg l_zero) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
153 |
with G show ?thesis by (simp add: a_ac) |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
154 |
qed |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
155 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
156 |
lemma (in cring) r_neg1: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
157 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> \<ominus> x \<oplus> (x \<oplus> y) = y" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
158 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
159 |
assume G: "x \<in> carrier R" "y \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
160 |
then have "(\<ominus> x \<oplus> x) \<oplus> y = y" by (simp only: l_neg l_zero) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
161 |
with G show ?thesis by (simp add: a_ac) |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
162 |
qed |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
163 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
164 |
lemma (in cring) r_distr: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
165 |
"[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
166 |
==> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
167 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
168 |
assume G: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
169 |
then have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z" by (simp add: m_comm) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
170 |
also from G have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
171 |
also from G have "... = z \<otimes> x \<oplus> z \<otimes> y" by (simp add: m_comm) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
172 |
finally show ?thesis . |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
173 |
qed |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
174 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
175 |
text {* |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
176 |
The following proofs are from Jacobson, Basic Algebra I, pp.~88--89 |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
177 |
*} |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
178 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
179 |
lemma (in cring) l_null [simp]: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
180 |
"x \<in> carrier R ==> \<zero> \<otimes> x = \<zero>" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
181 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
182 |
assume R: "x \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
183 |
then have "\<zero> \<otimes> x \<oplus> \<zero> \<otimes> x = (\<zero> \<oplus> \<zero>) \<otimes> x" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
184 |
by (simp add: l_distr del: l_zero r_zero) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
185 |
also from R have "... = \<zero> \<otimes> x \<oplus> \<zero>" by simp |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
186 |
finally have "\<zero> \<otimes> x \<oplus> \<zero> \<otimes> x = \<zero> \<otimes> x \<oplus> \<zero>" . |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
187 |
with R show ?thesis by (simp del: r_zero) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
188 |
qed |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
189 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
190 |
lemma (in cring) r_null [simp]: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
191 |
"x \<in> carrier R ==> x \<otimes> \<zero> = \<zero>" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
192 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
193 |
assume R: "x \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
194 |
then have "x \<otimes> \<zero> = \<zero> \<otimes> x" by (simp add: ac) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
195 |
also from R have "... = \<zero>" by simp |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
196 |
finally show ?thesis . |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
197 |
qed |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
198 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
199 |
lemma (in cring) l_minus: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
200 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> \<ominus> x \<otimes> y = \<ominus> (x \<otimes> y)" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
201 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
202 |
assume R: "x \<in> carrier R" "y \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
203 |
then have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y = (\<ominus> x \<oplus> x) \<otimes> y" by (simp add: l_distr) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
204 |
also from R have "... = \<zero>" by (simp add: l_neg l_null) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
205 |
finally have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y = \<zero>" . |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
206 |
with R have "(\<ominus> x) \<otimes> y \<oplus> x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) = \<zero> \<oplus> \<ominus> (x \<otimes> y)" by simp |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
207 |
with R show ?thesis by (simp add: a_assoc r_neg ) |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
208 |
qed |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
209 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
210 |
lemma (in cring) r_minus: |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
211 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> x \<otimes> \<ominus> y = \<ominus> (x \<otimes> y)" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
212 |
proof - |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
213 |
assume R: "x \<in> carrier R" "y \<in> carrier R" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
214 |
then have "x \<otimes> \<ominus> y = \<ominus> y \<otimes> x" by (simp add: ac) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
215 |
also from R have "... = \<ominus> (y \<otimes> x)" by (simp add: l_minus) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
216 |
also from R have "... = \<ominus> (x \<otimes> y)" by (simp add: ac) |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
217 |
finally show ?thesis . |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
218 |
qed |
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
219 |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
220 |
lemmas (in cring) cring_simprules = |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
221 |
a_closed zero_closed a_inv_closed minus_closed m_closed one_closed |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
222 |
a_assoc l_zero l_neg a_comm m_assoc l_one l_distr m_comm minus_def |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
223 |
r_zero r_neg r_neg2 r_neg1 minus_add minus_minus minus_zero |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
224 |
a_lcomm m_lcomm r_distr l_null r_null l_minus r_minus |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
225 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
226 |
use "ringsimp.ML" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
227 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
228 |
method_setup algebra = |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
229 |
{* Method.ctxt_args cring_normalise *} |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
230 |
{* computes distributive normal form in commutative rings (locales version) *} |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
231 |
|
13864 | 232 |
text {* Two examples for use of method algebra *} |
233 |
||
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
234 |
lemma |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
235 |
includes cring R + cring S |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
236 |
shows "[| a \<in> carrier R; b \<in> carrier R; c \<in> carrier S; d \<in> carrier S |] ==> |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
237 |
a \<oplus> \<ominus> (a \<oplus> \<ominus> b) = b & c \<otimes>\<^sub>2 d = d \<otimes>\<^sub>2 c" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
238 |
by algebra |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
239 |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
240 |
lemma |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
241 |
includes cring |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
242 |
shows "[| a \<in> carrier R; b \<in> carrier R |] ==> a \<ominus> (a \<ominus> b) = b" |
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
243 |
by algebra |
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
244 |
|
13864 | 245 |
subsection {* Sums over Finite Sets *} |
246 |
||
247 |
text {* |
|
248 |
This definition makes it easy to lift lemmas from @{term finprod}. |
|
249 |
*} |
|
250 |
||
251 |
constdefs |
|
252 |
finsum :: "[('b, 'm) ring_scheme, 'a => 'b, 'a set] => 'b" |
|
253 |
"finsum R f A == finprod (| carrier = carrier R, |
|
254 |
mult = add R, one = zero R, m_inv = a_inv R |) f A" |
|
255 |
||
256 |
lemma (in cring) a_abelian_monoid: |
|
257 |
"abelian_monoid (| carrier = carrier R, |
|
258 |
mult = add R, one = zero R, m_inv = a_inv R |)" |
|
259 |
by (simp add: abelian_monoid_def) |
|
260 |
||
261 |
(* |
|
262 |
lemmas (in cring) finsum_empty [simp] = |
|
263 |
abelian_monoid.finprod_empty [OF a_abelian_monoid, simplified] |
|
264 |
is dangeous, because attributes (like simplified) are applied upon opening |
|
265 |
the locale, simplified refers to the simpset at that time!!! |
|
266 |
*) |
|
267 |
||
268 |
lemmas (in cring) finsum_empty [simp] = |
|
269 |
abelian_monoid.finprod_empty [OF a_abelian_monoid, folded finsum_def, |
|
270 |
simplified group_record_simps] |
|
271 |
||
272 |
lemmas (in cring) finsum_insert [simp] = |
|
273 |
abelian_monoid.finprod_insert [OF a_abelian_monoid, folded finsum_def, |
|
274 |
simplified group_record_simps] |
|
275 |
||
276 |
lemmas (in cring) finsum_zero = |
|
277 |
abelian_monoid.finprod_one [OF a_abelian_monoid, folded finsum_def, |
|
278 |
simplified group_record_simps] |
|
279 |
||
280 |
lemmas (in cring) finsum_closed [simp] = |
|
281 |
abelian_monoid.finprod_closed [OF a_abelian_monoid, folded finsum_def, |
|
282 |
simplified group_record_simps] |
|
283 |
||
284 |
lemmas (in cring) finsum_Un_Int = |
|
285 |
abelian_monoid.finprod_Un_Int [OF a_abelian_monoid, folded finsum_def, |
|
286 |
simplified group_record_simps] |
|
287 |
||
288 |
lemmas (in cring) finsum_Un_disjoint = |
|
289 |
abelian_monoid.finprod_Un_disjoint [OF a_abelian_monoid, folded finsum_def, |
|
290 |
simplified group_record_simps] |
|
291 |
||
292 |
lemmas (in cring) finsum_addf = |
|
293 |
abelian_monoid.finprod_multf [OF a_abelian_monoid, folded finsum_def, |
|
294 |
simplified group_record_simps] |
|
295 |
||
13889
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
296 |
lemmas (in cring) finsum_cong' = |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
297 |
abelian_monoid.finprod_cong' [OF a_abelian_monoid, folded finsum_def, |
13864 | 298 |
simplified group_record_simps] |
299 |
||
300 |
lemmas (in cring) finsum_0 [simp] = |
|
301 |
abelian_monoid.finprod_0 [OF a_abelian_monoid, folded finsum_def, |
|
302 |
simplified group_record_simps] |
|
303 |
||
304 |
lemmas (in cring) finsum_Suc [simp] = |
|
305 |
abelian_monoid.finprod_Suc [OF a_abelian_monoid, folded finsum_def, |
|
306 |
simplified group_record_simps] |
|
307 |
||
308 |
lemmas (in cring) finsum_Suc2 = |
|
309 |
abelian_monoid.finprod_Suc2 [OF a_abelian_monoid, folded finsum_def, |
|
310 |
simplified group_record_simps] |
|
311 |
||
312 |
lemmas (in cring) finsum_add [simp] = |
|
313 |
abelian_monoid.finprod_mult [OF a_abelian_monoid, folded finsum_def, |
|
314 |
simplified group_record_simps] |
|
315 |
||
13889
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
316 |
lemmas (in cring) finsum_cong = |
6676ac2527fa
Fixed Coset.thy (proved theorem factorgroup_is_group).
ballarin
parents:
13864
diff
changeset
|
317 |
abelian_monoid.finprod_cong [OF a_abelian_monoid, folded finsum_def, |
13864 | 318 |
simplified group_record_simps] |
319 |
||
320 |
text {*Usually, if this rule causes a failed congruence proof error, |
|
321 |
the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown. |
|
322 |
Adding @{thm [source] Pi_def} to the simpset is often useful. *} |
|
323 |
||
324 |
lemma (in cring) finsum_ldistr: |
|
325 |
"[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==> |
|
326 |
finsum R f A \<otimes> a = finsum R (%i. f i \<otimes> a) A" |
|
327 |
proof (induct set: Finites) |
|
328 |
case empty then show ?case by simp |
|
329 |
next |
|
330 |
case (insert F x) then show ?case by (simp add: Pi_def l_distr) |
|
331 |
qed |
|
332 |
||
333 |
lemma (in cring) finsum_rdistr: |
|
334 |
"[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==> |
|
335 |
a \<otimes> finsum R f A = finsum R (%i. a \<otimes> f i) A" |
|
336 |
proof (induct set: Finites) |
|
337 |
case empty then show ?case by simp |
|
338 |
next |
|
339 |
case (insert F x) then show ?case by (simp add: Pi_def r_distr) |
|
340 |
qed |
|
341 |
||
342 |
subsection {* Facts of Integral Domains *} |
|
343 |
||
344 |
lemma (in "domain") zero_not_one [simp]: |
|
345 |
"\<zero> ~= \<one>" |
|
346 |
by (rule not_sym) simp |
|
347 |
||
348 |
lemma (in "domain") integral_iff: (* not by default a simp rule! *) |
|
349 |
"[| a \<in> carrier R; b \<in> carrier R |] ==> (a \<otimes> b = \<zero>) = (a = \<zero> | b = \<zero>)" |
|
350 |
proof |
|
351 |
assume "a \<in> carrier R" "b \<in> carrier R" "a \<otimes> b = \<zero>" |
|
352 |
then show "a = \<zero> | b = \<zero>" by (simp add: integral) |
|
353 |
next |
|
354 |
assume "a \<in> carrier R" "b \<in> carrier R" "a = \<zero> | b = \<zero>" |
|
355 |
then show "a \<otimes> b = \<zero>" by auto |
|
356 |
qed |
|
357 |
||
358 |
lemma (in "domain") m_lcancel: |
|
359 |
assumes prem: "a ~= \<zero>" |
|
360 |
and R: "a \<in> carrier R" "b \<in> carrier R" "c \<in> carrier R" |
|
361 |
shows "(a \<otimes> b = a \<otimes> c) = (b = c)" |
|
362 |
proof |
|
363 |
assume eq: "a \<otimes> b = a \<otimes> c" |
|
364 |
with R have "a \<otimes> (b \<ominus> c) = \<zero>" by algebra |
|
365 |
with R have "a = \<zero> | (b \<ominus> c) = \<zero>" by (simp add: integral_iff) |
|
366 |
with prem and R have "b \<ominus> c = \<zero>" by auto |
|
367 |
with R have "b = b \<ominus> (b \<ominus> c)" by algebra |
|
368 |
also from R have "b \<ominus> (b \<ominus> c) = c" by algebra |
|
369 |
finally show "b = c" . |
|
370 |
next |
|
371 |
assume "b = c" then show "a \<otimes> b = a \<otimes> c" by simp |
|
372 |
qed |
|
373 |
||
374 |
lemma (in "domain") m_rcancel: |
|
375 |
assumes prem: "a ~= \<zero>" |
|
376 |
and R: "a \<in> carrier R" "b \<in> carrier R" "c \<in> carrier R" |
|
377 |
shows conc: "(b \<otimes> a = c \<otimes> a) = (b = c)" |
|
378 |
proof - |
|
379 |
from prem and R have "(a \<otimes> b = a \<otimes> c) = (b = c)" by (rule m_lcancel) |
|
380 |
with R show ?thesis by algebra |
|
381 |
qed |
|
382 |
||
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
383 |
end |