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