| author | nipkow |
| Tue, 06 Jun 2006 19:24:05 +0200 | |
| changeset 19795 | 746274ca400b |
| parent 19783 | 82f365a14960 |
| child 19931 | fb32b43e7f80 |
| 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 |
|
| 14577 | 8 |
header {* Abelian Groups *}
|
9 |
||
| 16417 | 10 |
theory CRing imports FiniteProduct |
11 |
uses ("ringsimp.ML") begin
|
|
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
12 |
|
| 13936 | 13 |
record 'a ring = "'a monoid" + |
14 |
zero :: 'a ("\<zero>\<index>")
|
|
15 |
add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65) |
|
16 |
||
17 |
text {* Derived operations. *}
|
|
18 |
||
| 14651 | 19 |
constdefs (structure R) |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
20 |
a_inv :: "[('a, 'm) ring_scheme, 'a ] => 'a" ("\<ominus>\<index> _" [81] 80)
|
| 13936 | 21 |
"a_inv R == m_inv (| carrier = carrier R, mult = add R, one = zero R |)" |
22 |
||
|
19233
77ca20b0ed77
renamed HOL + - * etc. to HOL.plus HOL.minus HOL.times etc.
haftmann
parents:
16637
diff
changeset
|
23 |
a_minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65)
|
| 14651 | 24 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus> y == x \<oplus> (\<ominus> y)" |
| 13936 | 25 |
|
| 19783 | 26 |
locale abelian_monoid = |
27 |
fixes G (structure) |
|
| 14963 | 28 |
assumes a_comm_monoid: |
29 |
"comm_monoid (| carrier = carrier G, mult = add G, one = zero G |)" |
|
30 |
||
| 13936 | 31 |
|
32 |
text {*
|
|
33 |
The following definition is redundant but simple to use. |
|
34 |
*} |
|
35 |
||
36 |
locale abelian_group = abelian_monoid + |
|
| 14963 | 37 |
assumes a_comm_group: |
38 |
"comm_group (| carrier = carrier G, mult = add G, one = zero G |)" |
|
39 |
||
| 13936 | 40 |
|
41 |
subsection {* Basic Properties *}
|
|
42 |
||
43 |
lemma abelian_monoidI: |
|
| 19783 | 44 |
fixes R (structure) |
| 13936 | 45 |
assumes a_closed: |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
46 |
"!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> y \<in> carrier R" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
47 |
and zero_closed: "\<zero> \<in> carrier R" |
| 13936 | 48 |
and a_assoc: |
49 |
"!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] ==> |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
50 |
(x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
51 |
and l_zero: "!!x. x \<in> carrier R ==> \<zero> \<oplus> x = x" |
| 13936 | 52 |
and a_comm: |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
53 |
"!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> y = y \<oplus> x" |
| 13936 | 54 |
shows "abelian_monoid R" |
55 |
by (auto intro!: abelian_monoid.intro comm_monoidI intro: prems) |
|
56 |
||
57 |
lemma abelian_groupI: |
|
| 19783 | 58 |
(* |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
59 |
includes struct R |
| 19783 | 60 |
*) |
61 |
fixes R (structure) |
|
| 13936 | 62 |
assumes a_closed: |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
63 |
"!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> y \<in> carrier R" |
| 13936 | 64 |
and zero_closed: "zero R \<in> carrier R" |
65 |
and a_assoc: |
|
66 |
"!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] ==> |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
67 |
(x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)" |
| 13936 | 68 |
and a_comm: |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
69 |
"!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> y = y \<oplus> x" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
70 |
and l_zero: "!!x. x \<in> carrier R ==> \<zero> \<oplus> x = x" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
71 |
and l_inv_ex: "!!x. x \<in> carrier R ==> EX y : carrier R. y \<oplus> x = \<zero>" |
| 13936 | 72 |
shows "abelian_group R" |
73 |
by (auto intro!: abelian_group.intro abelian_monoidI |
|
74 |
abelian_group_axioms.intro comm_monoidI comm_groupI |
|
75 |
intro: prems) |
|
76 |
||
77 |
lemma (in abelian_monoid) a_monoid: |
|
78 |
"monoid (| carrier = carrier G, mult = add G, one = zero G |)" |
|
| 14963 | 79 |
by (rule comm_monoid.axioms, rule a_comm_monoid) |
| 13936 | 80 |
|
81 |
lemma (in abelian_group) a_group: |
|
82 |
"group (| carrier = carrier G, mult = add G, one = zero G |)" |
|
| 14963 | 83 |
by (simp add: group_def a_monoid comm_group.axioms a_comm_group) |
| 13936 | 84 |
|
| 14963 | 85 |
lemmas monoid_record_simps = partial_object.simps monoid.simps |
| 13936 | 86 |
|
87 |
lemma (in abelian_monoid) a_closed [intro, simp]: |
|
| 14963 | 88 |
"\<lbrakk> x \<in> carrier G; y \<in> carrier G \<rbrakk> \<Longrightarrow> x \<oplus> y \<in> carrier G" |
89 |
by (rule monoid.m_closed [OF a_monoid, simplified monoid_record_simps]) |
|
| 13936 | 90 |
|
91 |
lemma (in abelian_monoid) zero_closed [intro, simp]: |
|
92 |
"\<zero> \<in> carrier G" |
|
93 |
by (rule monoid.one_closed [OF a_monoid, simplified monoid_record_simps]) |
|
94 |
||
95 |
lemma (in abelian_group) a_inv_closed [intro, simp]: |
|
96 |
"x \<in> carrier G ==> \<ominus> x \<in> carrier G" |
|
97 |
by (simp add: a_inv_def |
|
98 |
group.inv_closed [OF a_group, simplified monoid_record_simps]) |
|
99 |
||
100 |
lemma (in abelian_group) minus_closed [intro, simp]: |
|
101 |
"[| x \<in> carrier G; y \<in> carrier G |] ==> x \<ominus> y \<in> carrier G" |
|
|
19233
77ca20b0ed77
renamed HOL + - * etc. to HOL.plus HOL.minus HOL.times etc.
haftmann
parents:
16637
diff
changeset
|
102 |
by (simp add: a_minus_def) |
| 13936 | 103 |
|
104 |
lemma (in abelian_group) a_l_cancel [simp]: |
|
105 |
"[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
106 |
(x \<oplus> y = x \<oplus> z) = (y = z)" |
|
107 |
by (rule group.l_cancel [OF a_group, simplified monoid_record_simps]) |
|
108 |
||
109 |
lemma (in abelian_group) a_r_cancel [simp]: |
|
110 |
"[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
111 |
(y \<oplus> x = z \<oplus> x) = (y = z)" |
|
112 |
by (rule group.r_cancel [OF a_group, simplified monoid_record_simps]) |
|
113 |
||
114 |
lemma (in abelian_monoid) a_assoc: |
|
| 14963 | 115 |
"\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow> |
| 13936 | 116 |
(x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)" |
| 14963 | 117 |
by (rule monoid.m_assoc [OF a_monoid, simplified monoid_record_simps]) |
| 13936 | 118 |
|
119 |
lemma (in abelian_monoid) l_zero [simp]: |
|
120 |
"x \<in> carrier G ==> \<zero> \<oplus> x = x" |
|
121 |
by (rule monoid.l_one [OF a_monoid, simplified monoid_record_simps]) |
|
122 |
||
123 |
lemma (in abelian_group) l_neg: |
|
124 |
"x \<in> carrier G ==> \<ominus> x \<oplus> x = \<zero>" |
|
125 |
by (simp add: a_inv_def |
|
126 |
group.l_inv [OF a_group, simplified monoid_record_simps]) |
|
127 |
||
128 |
lemma (in abelian_monoid) a_comm: |
|
| 14963 | 129 |
"\<lbrakk>x \<in> carrier G; y \<in> carrier G\<rbrakk> \<Longrightarrow> x \<oplus> y = y \<oplus> x" |
130 |
by (rule comm_monoid.m_comm [OF a_comm_monoid, |
|
| 13936 | 131 |
simplified monoid_record_simps]) |
132 |
||
133 |
lemma (in abelian_monoid) a_lcomm: |
|
| 14963 | 134 |
"\<lbrakk>x \<in> carrier G; y \<in> carrier G; z \<in> carrier G\<rbrakk> \<Longrightarrow> |
| 13936 | 135 |
x \<oplus> (y \<oplus> z) = y \<oplus> (x \<oplus> z)" |
| 14963 | 136 |
by (rule comm_monoid.m_lcomm [OF a_comm_monoid, |
137 |
simplified monoid_record_simps]) |
|
| 13936 | 138 |
|
139 |
lemma (in abelian_monoid) r_zero [simp]: |
|
140 |
"x \<in> carrier G ==> x \<oplus> \<zero> = x" |
|
141 |
using monoid.r_one [OF a_monoid] |
|
142 |
by simp |
|
143 |
||
144 |
lemma (in abelian_group) r_neg: |
|
145 |
"x \<in> carrier G ==> x \<oplus> (\<ominus> x) = \<zero>" |
|
146 |
using group.r_inv [OF a_group] |
|
147 |
by (simp add: a_inv_def) |
|
148 |
||
149 |
lemma (in abelian_group) minus_zero [simp]: |
|
150 |
"\<ominus> \<zero> = \<zero>" |
|
151 |
by (simp add: a_inv_def |
|
152 |
group.inv_one [OF a_group, simplified monoid_record_simps]) |
|
153 |
||
154 |
lemma (in abelian_group) minus_minus [simp]: |
|
155 |
"x \<in> carrier G ==> \<ominus> (\<ominus> x) = x" |
|
156 |
using group.inv_inv [OF a_group, simplified monoid_record_simps] |
|
157 |
by (simp add: a_inv_def) |
|
158 |
||
159 |
lemma (in abelian_group) a_inv_inj: |
|
160 |
"inj_on (a_inv G) (carrier G)" |
|
161 |
using group.inv_inj [OF a_group, simplified monoid_record_simps] |
|
162 |
by (simp add: a_inv_def) |
|
163 |
||
164 |
lemma (in abelian_group) minus_add: |
|
165 |
"[| x \<in> carrier G; y \<in> carrier G |] ==> \<ominus> (x \<oplus> y) = \<ominus> x \<oplus> \<ominus> y" |
|
166 |
using comm_group.inv_mult [OF a_comm_group] |
|
167 |
by (simp add: a_inv_def) |
|
168 |
||
169 |
lemmas (in abelian_monoid) a_ac = a_assoc a_comm a_lcomm |
|
170 |
||
171 |
subsection {* Sums over Finite Sets *}
|
|
172 |
||
173 |
text {*
|
|
174 |
This definition makes it easy to lift lemmas from @{term finprod}.
|
|
175 |
*} |
|
176 |
||
177 |
constdefs |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
178 |
finsum :: "[('b, 'm) ring_scheme, 'a => 'b, 'a set] => 'b"
|
| 13936 | 179 |
"finsum G f A == finprod (| carrier = carrier G, |
180 |
mult = add G, one = zero G |) f A" |
|
181 |
||
| 14651 | 182 |
syntax |
183 |
"_finsum" :: "index => idt => 'a set => 'b => 'b" |
|
| 14666 | 184 |
("(3\<Oplus>__:_. _)" [1000, 0, 51, 10] 10)
|
| 14651 | 185 |
syntax (xsymbols) |
186 |
"_finsum" :: "index => idt => 'a set => 'b => 'b" |
|
| 14666 | 187 |
("(3\<Oplus>__\<in>_. _)" [1000, 0, 51, 10] 10)
|
| 14651 | 188 |
syntax (HTML output) |
189 |
"_finsum" :: "index => idt => 'a set => 'b => 'b" |
|
| 14666 | 190 |
("(3\<Oplus>__\<in>_. _)" [1000, 0, 51, 10] 10)
|
| 14651 | 191 |
translations |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
192 |
"\<Oplus>\<index>i:A. b" == "finsum \<struct>\<index> (%i. b) A" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
193 |
-- {* Beware of argument permutation! *}
|
| 14651 | 194 |
|
| 13936 | 195 |
(* |
196 |
lemmas (in abelian_monoid) finsum_empty [simp] = |
|
197 |
comm_monoid.finprod_empty [OF a_comm_monoid, simplified] |
|
198 |
is dangeous, because attributes (like simplified) are applied upon opening |
|
199 |
the locale, simplified refers to the simpset at that time!!! |
|
200 |
||
201 |
lemmas (in abelian_monoid) finsum_empty [simp] = |
|
202 |
abelian_monoid.finprod_empty [OF a_abelian_monoid, folded finsum_def, |
|
203 |
simplified monoid_record_simps] |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
204 |
makes the locale slow, because proofs are repeated for every |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
205 |
"lemma (in abelian_monoid)" command. |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
206 |
When lemma is used time in UnivPoly.thy from beginning to UP_cring goes down |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
207 |
from 110 secs to 60 secs. |
| 13936 | 208 |
*) |
209 |
||
210 |
lemma (in abelian_monoid) finsum_empty [simp]: |
|
211 |
"finsum G f {} = \<zero>"
|
|
212 |
by (rule comm_monoid.finprod_empty [OF a_comm_monoid, |
|
213 |
folded finsum_def, simplified monoid_record_simps]) |
|
214 |
||
215 |
lemma (in abelian_monoid) finsum_insert [simp]: |
|
216 |
"[| finite F; a \<notin> F; f \<in> F -> carrier G; f a \<in> carrier G |] |
|
217 |
==> finsum G f (insert a F) = f a \<oplus> finsum G f F" |
|
218 |
by (rule comm_monoid.finprod_insert [OF a_comm_monoid, |
|
219 |
folded finsum_def, simplified monoid_record_simps]) |
|
220 |
||
221 |
lemma (in abelian_monoid) finsum_zero [simp]: |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
222 |
"finite A ==> (\<Oplus>i\<in>A. \<zero>) = \<zero>" |
| 13936 | 223 |
by (rule comm_monoid.finprod_one [OF a_comm_monoid, folded finsum_def, |
224 |
simplified monoid_record_simps]) |
|
225 |
||
226 |
lemma (in abelian_monoid) finsum_closed [simp]: |
|
227 |
fixes A |
|
228 |
assumes fin: "finite A" and f: "f \<in> A -> carrier G" |
|
229 |
shows "finsum G f A \<in> carrier G" |
|
230 |
by (rule comm_monoid.finprod_closed [OF a_comm_monoid, |
|
231 |
folded finsum_def, simplified monoid_record_simps]) |
|
232 |
||
233 |
lemma (in abelian_monoid) finsum_Un_Int: |
|
234 |
"[| finite A; finite B; g \<in> A -> carrier G; g \<in> B -> carrier G |] ==> |
|
235 |
finsum G g (A Un B) \<oplus> finsum G g (A Int B) = |
|
236 |
finsum G g A \<oplus> finsum G g B" |
|
237 |
by (rule comm_monoid.finprod_Un_Int [OF a_comm_monoid, |
|
238 |
folded finsum_def, simplified monoid_record_simps]) |
|
239 |
||
240 |
lemma (in abelian_monoid) finsum_Un_disjoint: |
|
241 |
"[| finite A; finite B; A Int B = {};
|
|
242 |
g \<in> A -> carrier G; g \<in> B -> carrier G |] |
|
243 |
==> finsum G g (A Un B) = finsum G g A \<oplus> finsum G g B" |
|
244 |
by (rule comm_monoid.finprod_Un_disjoint [OF a_comm_monoid, |
|
245 |
folded finsum_def, simplified monoid_record_simps]) |
|
246 |
||
247 |
lemma (in abelian_monoid) finsum_addf: |
|
248 |
"[| finite A; f \<in> A -> carrier G; g \<in> A -> carrier G |] ==> |
|
249 |
finsum G (%x. f x \<oplus> g x) A = (finsum G f A \<oplus> finsum G g A)" |
|
250 |
by (rule comm_monoid.finprod_multf [OF a_comm_monoid, |
|
251 |
folded finsum_def, simplified monoid_record_simps]) |
|
252 |
||
253 |
lemma (in abelian_monoid) finsum_cong': |
|
254 |
"[| A = B; g : B -> carrier G; |
|
255 |
!!i. i : B ==> f i = g i |] ==> finsum G f A = finsum G g B" |
|
256 |
by (rule comm_monoid.finprod_cong' [OF a_comm_monoid, |
|
257 |
folded finsum_def, simplified monoid_record_simps]) auto |
|
258 |
||
259 |
lemma (in abelian_monoid) finsum_0 [simp]: |
|
260 |
"f : {0::nat} -> carrier G ==> finsum G f {..0} = f 0"
|
|
261 |
by (rule comm_monoid.finprod_0 [OF a_comm_monoid, folded finsum_def, |
|
262 |
simplified monoid_record_simps]) |
|
263 |
||
264 |
lemma (in abelian_monoid) finsum_Suc [simp]: |
|
265 |
"f : {..Suc n} -> carrier G ==>
|
|
266 |
finsum G f {..Suc n} = (f (Suc n) \<oplus> finsum G f {..n})"
|
|
267 |
by (rule comm_monoid.finprod_Suc [OF a_comm_monoid, folded finsum_def, |
|
268 |
simplified monoid_record_simps]) |
|
269 |
||
270 |
lemma (in abelian_monoid) finsum_Suc2: |
|
271 |
"f : {..Suc n} -> carrier G ==>
|
|
272 |
finsum G f {..Suc n} = (finsum G (%i. f (Suc i)) {..n} \<oplus> f 0)"
|
|
273 |
by (rule comm_monoid.finprod_Suc2 [OF a_comm_monoid, folded finsum_def, |
|
274 |
simplified monoid_record_simps]) |
|
275 |
||
276 |
lemma (in abelian_monoid) finsum_add [simp]: |
|
277 |
"[| f : {..n} -> carrier G; g : {..n} -> carrier G |] ==>
|
|
278 |
finsum G (%i. f i \<oplus> g i) {..n::nat} =
|
|
279 |
finsum G f {..n} \<oplus> finsum G g {..n}"
|
|
280 |
by (rule comm_monoid.finprod_mult [OF a_comm_monoid, folded finsum_def, |
|
281 |
simplified monoid_record_simps]) |
|
282 |
||
283 |
lemma (in abelian_monoid) finsum_cong: |
|
|
16637
62dff56b43d3
Tuned finsum_cong to allow that premises are simplified more eagerly.
berghofe
parents:
16417
diff
changeset
|
284 |
"[| A = B; f : B -> carrier G; |
|
62dff56b43d3
Tuned finsum_cong to allow that premises are simplified more eagerly.
berghofe
parents:
16417
diff
changeset
|
285 |
!!i. i : B =simp=> f i = g i |] ==> finsum G f A = finsum G g B" |
| 13936 | 286 |
by (rule comm_monoid.finprod_cong [OF a_comm_monoid, folded finsum_def, |
|
16637
62dff56b43d3
Tuned finsum_cong to allow that premises are simplified more eagerly.
berghofe
parents:
16417
diff
changeset
|
287 |
simplified monoid_record_simps]) (auto simp add: simp_implies_def) |
| 13936 | 288 |
|
289 |
text {*Usually, if this rule causes a failed congruence proof error,
|
|
290 |
the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown.
|
|
291 |
Adding @{thm [source] Pi_def} to the simpset is often useful. *}
|
|
292 |
||
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
293 |
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
|
294 |
|
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
295 |
subsection {* Basic Definitions *}
|
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
296 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
297 |
locale ring = abelian_group R + monoid R + |
| 13936 | 298 |
assumes l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
299 |
==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
300 |
and r_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
301 |
==> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
302 |
|
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
303 |
locale cring = ring + comm_monoid R |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
304 |
|
| 13864 | 305 |
locale "domain" = cring + |
306 |
assumes one_not_zero [simp]: "\<one> ~= \<zero>" |
|
307 |
and integral: "[| a \<otimes> b = \<zero>; a \<in> carrier R; b \<in> carrier R |] ==> |
|
308 |
a = \<zero> | b = \<zero>" |
|
309 |
||
| 14551 | 310 |
locale field = "domain" + |
311 |
assumes field_Units: "Units R = carrier R - {\<zero>}"
|
|
312 |
||
| 13864 | 313 |
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
|
314 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
315 |
lemma ringI: |
| 19783 | 316 |
(* |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
317 |
includes struct R |
| 19783 | 318 |
*) |
319 |
fixes R (structure) |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
320 |
assumes abelian_group: "abelian_group R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
321 |
and monoid: "monoid R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
322 |
and l_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
323 |
==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
324 |
and r_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
325 |
==> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
326 |
shows "ring R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
327 |
by (auto intro: ring.intro |
| 14963 | 328 |
abelian_group.axioms ring_axioms.intro prems) |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
329 |
|
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
330 |
lemma (in ring) is_abelian_group: |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
331 |
"abelian_group R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
332 |
by (auto intro!: abelian_groupI a_assoc a_comm l_neg) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
333 |
|
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
334 |
lemma (in ring) is_monoid: |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
335 |
"monoid R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
336 |
by (auto intro!: monoidI m_assoc) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
337 |
|
| 13936 | 338 |
lemma cringI: |
| 19783 | 339 |
(* |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
340 |
includes struct R |
| 19783 | 341 |
*) |
342 |
fixes R (structure) |
|
| 13936 | 343 |
assumes abelian_group: "abelian_group R" |
344 |
and comm_monoid: "comm_monoid R" |
|
345 |
and l_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
346 |
==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
| 13936 | 347 |
shows "cring R" |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
348 |
proof (rule cring.intro) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
349 |
show "ring_axioms R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
350 |
-- {* Right-distributivity follows from left-distributivity and
|
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
351 |
commutativity. *} |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
352 |
proof (rule ring_axioms.intro) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
353 |
fix x y z |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
354 |
assume R: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
355 |
note [simp]= comm_monoid.axioms [OF comm_monoid] |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
356 |
abelian_group.axioms [OF abelian_group] |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
357 |
abelian_monoid.a_closed |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
358 |
|
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
359 |
from R have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z" |
| 14963 | 360 |
by (simp add: comm_monoid.m_comm [OF comm_monoid.intro]) |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
361 |
also from R have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
362 |
also from R have "... = z \<otimes> x \<oplus> z \<otimes> y" |
| 14963 | 363 |
by (simp add: comm_monoid.m_comm [OF comm_monoid.intro]) |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
364 |
finally show "z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" . |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
365 |
qed |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
366 |
qed (auto intro: cring.intro |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
367 |
abelian_group.axioms comm_monoid.axioms ring_axioms.intro prems) |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
368 |
|
| 13936 | 369 |
lemma (in cring) is_comm_monoid: |
370 |
"comm_monoid R" |
|
371 |
by (auto intro!: comm_monoidI m_assoc m_comm) |
|
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
372 |
|
| 14551 | 373 |
subsection {* Normaliser for Rings *}
|
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
374 |
|
| 13936 | 375 |
lemma (in abelian_group) r_neg2: |
376 |
"[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y" |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
377 |
proof - |
| 13936 | 378 |
assume G: "x \<in> carrier G" "y \<in> carrier G" |
379 |
then have "(x \<oplus> \<ominus> x) \<oplus> y = y" |
|
380 |
by (simp only: r_neg l_zero) |
|
381 |
with G show ?thesis |
|
382 |
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
|
383 |
qed |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
384 |
|
| 13936 | 385 |
lemma (in abelian_group) r_neg1: |
386 |
"[| x \<in> carrier G; y \<in> carrier G |] ==> \<ominus> x \<oplus> (x \<oplus> y) = y" |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
387 |
proof - |
| 13936 | 388 |
assume G: "x \<in> carrier G" "y \<in> carrier G" |
389 |
then have "(\<ominus> x \<oplus> x) \<oplus> y = y" |
|
390 |
by (simp only: l_neg l_zero) |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
391 |
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
|
392 |
qed |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
393 |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
394 |
text {*
|
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
395 |
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
|
396 |
*} |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
397 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
398 |
lemma (in ring) l_null [simp]: |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
399 |
"x \<in> carrier R ==> \<zero> \<otimes> x = \<zero>" |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
400 |
proof - |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
401 |
assume R: "x \<in> carrier R" |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
402 |
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
|
403 |
by (simp add: l_distr del: l_zero r_zero) |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
404 |
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
|
405 |
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
|
406 |
with R show ?thesis by (simp del: r_zero) |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
407 |
qed |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
408 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
409 |
lemma (in ring) r_null [simp]: |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
410 |
"x \<in> carrier R ==> x \<otimes> \<zero> = \<zero>" |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
411 |
proof - |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
412 |
assume R: "x \<in> carrier R" |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
413 |
then have "x \<otimes> \<zero> \<oplus> x \<otimes> \<zero> = x \<otimes> (\<zero> \<oplus> \<zero>)" |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
414 |
by (simp add: r_distr del: l_zero r_zero) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
415 |
also from R have "... = x \<otimes> \<zero> \<oplus> \<zero>" by simp |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
416 |
finally have "x \<otimes> \<zero> \<oplus> x \<otimes> \<zero> = x \<otimes> \<zero> \<oplus> \<zero>" . |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
417 |
with R show ?thesis by (simp del: r_zero) |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
418 |
qed |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
419 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
420 |
lemma (in ring) l_minus: |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
421 |
"[| 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
|
422 |
proof - |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
423 |
assume R: "x \<in> carrier R" "y \<in> carrier R" |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
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
|
429 |
qed |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
430 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
431 |
lemma (in ring) r_minus: |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
432 |
"[| 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
|
433 |
proof - |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
434 |
assume R: "x \<in> carrier R" "y \<in> carrier R" |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
435 |
then have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y = x \<otimes> (\<ominus> y \<oplus> y)" by (simp add: r_distr) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
436 |
also from R have "... = \<zero>" by (simp add: l_neg r_null) |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
437 |
finally have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y = \<zero>" . |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
438 |
with R have "x \<otimes> (\<ominus> y) \<oplus> x \<otimes> y \<oplus> \<ominus> (x \<otimes> y) = \<zero> \<oplus> \<ominus> (x \<otimes> y)" by simp |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
439 |
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
|
440 |
qed |
|
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
441 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
442 |
lemma (in ring) minus_eq: |
| 13936 | 443 |
"[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus> y = x \<oplus> \<ominus> y" |
|
19233
77ca20b0ed77
renamed HOL + - * etc. to HOL.plus HOL.minus HOL.times etc.
haftmann
parents:
16637
diff
changeset
|
444 |
by (simp only: a_minus_def) |
| 13936 | 445 |
|
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
446 |
lemmas (in ring) ring_simprules = |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
447 |
a_closed zero_closed a_inv_closed minus_closed m_closed one_closed |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
448 |
a_assoc l_zero l_neg a_comm m_assoc l_one l_distr minus_eq |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
449 |
r_zero r_neg r_neg2 r_neg1 minus_add minus_minus minus_zero |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
450 |
a_lcomm r_distr l_null r_null l_minus r_minus |
|
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
451 |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
452 |
lemmas (in cring) cring_simprules = |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
453 |
a_closed zero_closed a_inv_closed minus_closed m_closed one_closed |
| 13936 | 454 |
a_assoc l_zero l_neg a_comm m_assoc l_one l_distr m_comm minus_eq |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
455 |
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
|
456 |
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
|
457 |
|
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
458 |
use "ringsimp.ML" |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
459 |
|
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
460 |
method_setup algebra = |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
461 |
{* Method.ctxt_args cring_normalise *}
|
| 13936 | 462 |
{* computes distributive normal form in locale context cring *}
|
463 |
||
464 |
lemma (in cring) nat_pow_zero: |
|
465 |
"(n::nat) ~= 0 ==> \<zero> (^) n = \<zero>" |
|
466 |
by (induct n) simp_all |
|
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
467 |
|
| 13864 | 468 |
text {* Two examples for use of method algebra *}
|
469 |
||
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
470 |
lemma |
|
14399
dc677b35e54f
New lemmas about inversion of restricted functions.
ballarin
parents:
14286
diff
changeset
|
471 |
includes ring R + cring S |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
472 |
shows "[| a \<in> carrier R; b \<in> carrier R; c \<in> carrier S; d \<in> carrier S |] ==> |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
473 |
a \<oplus> \<ominus> (a \<oplus> \<ominus> b) = b & c \<otimes>\<^bsub>S\<^esub> d = d \<otimes>\<^bsub>S\<^esub> c" |
|
13854
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
474 |
by algebra |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
475 |
|
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
476 |
lemma |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
477 |
includes cring |
|
91c9ab25fece
First distributed version of Group and Ring theory.
ballarin
parents:
13835
diff
changeset
|
478 |
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
|
479 |
by algebra |
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
480 |
|
| 13864 | 481 |
subsection {* Sums over Finite Sets *}
|
482 |
||
483 |
lemma (in cring) finsum_ldistr: |
|
484 |
"[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==> |
|
485 |
finsum R f A \<otimes> a = finsum R (%i. f i \<otimes> a) A" |
|
486 |
proof (induct set: Finites) |
|
487 |
case empty then show ?case by simp |
|
488 |
next |
|
| 15328 | 489 |
case (insert x F) then show ?case by (simp add: Pi_def l_distr) |
| 13864 | 490 |
qed |
491 |
||
492 |
lemma (in cring) finsum_rdistr: |
|
493 |
"[| finite A; a \<in> carrier R; f \<in> A -> carrier R |] ==> |
|
494 |
a \<otimes> finsum R f A = finsum R (%i. a \<otimes> f i) A" |
|
495 |
proof (induct set: Finites) |
|
496 |
case empty then show ?case by simp |
|
497 |
next |
|
| 15328 | 498 |
case (insert x F) then show ?case by (simp add: Pi_def r_distr) |
| 13864 | 499 |
qed |
500 |
||
501 |
subsection {* Facts of Integral Domains *}
|
|
502 |
||
503 |
lemma (in "domain") zero_not_one [simp]: |
|
504 |
"\<zero> ~= \<one>" |
|
505 |
by (rule not_sym) simp |
|
506 |
||
507 |
lemma (in "domain") integral_iff: (* not by default a simp rule! *) |
|
508 |
"[| a \<in> carrier R; b \<in> carrier R |] ==> (a \<otimes> b = \<zero>) = (a = \<zero> | b = \<zero>)" |
|
509 |
proof |
|
510 |
assume "a \<in> carrier R" "b \<in> carrier R" "a \<otimes> b = \<zero>" |
|
511 |
then show "a = \<zero> | b = \<zero>" by (simp add: integral) |
|
512 |
next |
|
513 |
assume "a \<in> carrier R" "b \<in> carrier R" "a = \<zero> | b = \<zero>" |
|
514 |
then show "a \<otimes> b = \<zero>" by auto |
|
515 |
qed |
|
516 |
||
517 |
lemma (in "domain") m_lcancel: |
|
518 |
assumes prem: "a ~= \<zero>" |
|
519 |
and R: "a \<in> carrier R" "b \<in> carrier R" "c \<in> carrier R" |
|
520 |
shows "(a \<otimes> b = a \<otimes> c) = (b = c)" |
|
521 |
proof |
|
522 |
assume eq: "a \<otimes> b = a \<otimes> c" |
|
523 |
with R have "a \<otimes> (b \<ominus> c) = \<zero>" by algebra |
|
524 |
with R have "a = \<zero> | (b \<ominus> c) = \<zero>" by (simp add: integral_iff) |
|
525 |
with prem and R have "b \<ominus> c = \<zero>" by auto |
|
526 |
with R have "b = b \<ominus> (b \<ominus> c)" by algebra |
|
527 |
also from R have "b \<ominus> (b \<ominus> c) = c" by algebra |
|
528 |
finally show "b = c" . |
|
529 |
next |
|
530 |
assume "b = c" then show "a \<otimes> b = a \<otimes> c" by simp |
|
531 |
qed |
|
532 |
||
533 |
lemma (in "domain") m_rcancel: |
|
534 |
assumes prem: "a ~= \<zero>" |
|
535 |
and R: "a \<in> carrier R" "b \<in> carrier R" "c \<in> carrier R" |
|
536 |
shows conc: "(b \<otimes> a = c \<otimes> a) = (b = c)" |
|
537 |
proof - |
|
538 |
from prem and R have "(a \<otimes> b = a \<otimes> c) = (b = c)" by (rule m_lcancel) |
|
539 |
with R show ?thesis by algebra |
|
540 |
qed |
|
541 |
||
| 13936 | 542 |
subsection {* Morphisms *}
|
543 |
||
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
544 |
constdefs (structure R S) |
| 13936 | 545 |
ring_hom :: "[('a, 'm) ring_scheme, ('b, 'n) ring_scheme] => ('a => 'b) set"
|
546 |
"ring_hom R S == {h. h \<in> carrier R -> carrier S &
|
|
547 |
(ALL x y. x \<in> carrier R & y \<in> carrier R --> |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
548 |
h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y & h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y) & |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
549 |
h \<one> = \<one>\<^bsub>S\<^esub>}" |
| 13936 | 550 |
|
551 |
lemma ring_hom_memI: |
|
| 19783 | 552 |
(* |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
553 |
includes struct R + struct S |
| 19783 | 554 |
*) |
555 |
fixes R (structure) and S (structure) |
|
| 13936 | 556 |
assumes hom_closed: "!!x. x \<in> carrier R ==> h x \<in> carrier S" |
557 |
and hom_mult: "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
558 |
h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y" |
| 13936 | 559 |
and hom_add: "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
560 |
h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
561 |
and hom_one: "h \<one> = \<one>\<^bsub>S\<^esub>" |
| 13936 | 562 |
shows "h \<in> ring_hom R S" |
563 |
by (auto simp add: ring_hom_def prems Pi_def) |
|
564 |
||
565 |
lemma ring_hom_closed: |
|
566 |
"[| h \<in> ring_hom R S; x \<in> carrier R |] ==> h x \<in> carrier S" |
|
567 |
by (auto simp add: ring_hom_def funcset_mem) |
|
568 |
||
569 |
lemma ring_hom_mult: |
|
| 19783 | 570 |
fixes R (structure) and S (structure) |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
571 |
shows |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
572 |
"[| h \<in> ring_hom R S; x \<in> carrier R; y \<in> carrier R |] ==> |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
573 |
h (x \<otimes> y) = h x \<otimes>\<^bsub>S\<^esub> h y" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
574 |
by (simp add: ring_hom_def) |
| 13936 | 575 |
|
576 |
lemma ring_hom_add: |
|
| 19783 | 577 |
fixes R (structure) and S (structure) |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
578 |
shows |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
579 |
"[| h \<in> ring_hom R S; x \<in> carrier R; y \<in> carrier R |] ==> |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
580 |
h (x \<oplus> y) = h x \<oplus>\<^bsub>S\<^esub> h y" |
|
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
581 |
by (simp add: ring_hom_def) |
| 13936 | 582 |
|
583 |
lemma ring_hom_one: |
|
| 19783 | 584 |
fixes R (structure) and S (structure) |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
585 |
shows "h \<in> ring_hom R S ==> h \<one> = \<one>\<^bsub>S\<^esub>" |
| 13936 | 586 |
by (simp add: ring_hom_def) |
587 |
||
| 19783 | 588 |
locale ring_hom_cring = cring R + cring S + |
589 |
fixes h |
|
| 13936 | 590 |
assumes homh [simp, intro]: "h \<in> ring_hom R S" |
591 |
notes hom_closed [simp, intro] = ring_hom_closed [OF homh] |
|
592 |
and hom_mult [simp] = ring_hom_mult [OF homh] |
|
593 |
and hom_add [simp] = ring_hom_add [OF homh] |
|
594 |
and hom_one [simp] = ring_hom_one [OF homh] |
|
595 |
||
596 |
lemma (in ring_hom_cring) hom_zero [simp]: |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
597 |
"h \<zero> = \<zero>\<^bsub>S\<^esub>" |
| 13936 | 598 |
proof - |
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
599 |
have "h \<zero> \<oplus>\<^bsub>S\<^esub> h \<zero> = h \<zero> \<oplus>\<^bsub>S\<^esub> \<zero>\<^bsub>S\<^esub>" |
| 13936 | 600 |
by (simp add: hom_add [symmetric] del: hom_add) |
601 |
then show ?thesis by (simp del: S.r_zero) |
|
602 |
qed |
|
603 |
||
604 |
lemma (in ring_hom_cring) hom_a_inv [simp]: |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
605 |
"x \<in> carrier R ==> h (\<ominus> x) = \<ominus>\<^bsub>S\<^esub> h x" |
| 13936 | 606 |
proof - |
607 |
assume R: "x \<in> carrier R" |
|
|
15095
63f5f4c265dd
Theories now take advantage of recent syntax improvements with (structure).
ballarin
parents:
14963
diff
changeset
|
608 |
then have "h x \<oplus>\<^bsub>S\<^esub> h (\<ominus> x) = h x \<oplus>\<^bsub>S\<^esub> (\<ominus>\<^bsub>S\<^esub> h x)" |
| 13936 | 609 |
by (simp add: hom_add [symmetric] R.r_neg S.r_neg del: hom_add) |
610 |
with R show ?thesis by simp |
|
611 |
qed |
|
612 |
||
613 |
lemma (in ring_hom_cring) hom_finsum [simp]: |
|
614 |
"[| finite A; f \<in> A -> carrier R |] ==> |
|
615 |
h (finsum R f A) = finsum S (h o f) A" |
|
616 |
proof (induct set: Finites) |
|
617 |
case empty then show ?case by simp |
|
618 |
next |
|
619 |
case insert then show ?case by (simp add: Pi_def) |
|
620 |
qed |
|
621 |
||
622 |
lemma (in ring_hom_cring) hom_finprod: |
|
623 |
"[| finite A; f \<in> A -> carrier R |] ==> |
|
624 |
h (finprod R f A) = finprod S (h o f) A" |
|
625 |
proof (induct set: Finites) |
|
626 |
case empty then show ?case by simp |
|
627 |
next |
|
628 |
case insert then show ?case by (simp add: Pi_def) |
|
629 |
qed |
|
630 |
||
631 |
declare ring_hom_cring.hom_finprod [simp] |
|
632 |
||
633 |
lemma id_ring_hom [simp]: |
|
634 |
"id \<in> ring_hom R R" |
|
635 |
by (auto intro!: ring_hom_memI) |
|
636 |
||
|
13835
12b2ffbe543a
Change to meta simplifier: congruence rules may now have frees as head of term.
ballarin
parents:
diff
changeset
|
637 |
end |