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