3 Id: $Id$ |
3 Id: $Id$ |
4 Author: Clemens Ballarin, started 9 December 1996 |
4 Author: Clemens Ballarin, started 9 December 1996 |
5 Copyright: Clemens Ballarin |
5 Copyright: Clemens Ballarin |
6 *) |
6 *) |
7 |
7 |
8 theory CRing = Summation |
8 theory CRing = FiniteProduct |
9 files ("ringsimp.ML"): |
9 files ("ringsimp.ML"): |
10 |
10 |
11 section {* The Algebraic Hierarchy of Rings *} |
11 section {* Abelian Groups *} |
12 |
12 |
13 subsection {* Basic Definitions *} |
13 record 'a ring = "'a monoid" + |
14 |
|
15 record 'a ring = "'a group" + |
|
16 zero :: 'a ("\<zero>\<index>") |
14 zero :: 'a ("\<zero>\<index>") |
17 add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65) |
15 add :: "['a, 'a] => 'a" (infixl "\<oplus>\<index>" 65) |
18 a_inv :: "'a => 'a" ("\<ominus>\<index> _" [81] 80) |
16 |
19 |
17 text {* Derived operations. *} |
20 locale cring = abelian_monoid R + |
|
21 assumes a_abelian_group: "abelian_group (| carrier = carrier R, |
|
22 mult = add R, one = zero R, m_inv = a_inv R |)" |
|
23 and m_inv_def: "[| EX y. y \<in> carrier R & x \<otimes> y = \<one>; x \<in> carrier R |] |
|
24 ==> inv x = (THE y. y \<in> carrier R & x \<otimes> y = \<one>)" |
|
25 and l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
26 ==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
|
27 |
|
28 text {* Derived operation. *} |
|
29 |
18 |
30 constdefs |
19 constdefs |
|
20 a_inv :: "[('a, 'm) ring_scheme, 'a ] => 'a" ("\<ominus>\<index> _" [81] 80) |
|
21 "a_inv R == m_inv (| carrier = carrier R, mult = add R, one = zero R |)" |
|
22 |
31 minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65) |
23 minus :: "[('a, 'm) ring_scheme, 'a, 'a] => 'a" (infixl "\<ominus>\<index>" 65) |
32 "[| x \<in> carrier R; y \<in> carrier R |] ==> minus R x y == add R x (a_inv R y)" |
24 "[| x \<in> carrier R; y \<in> carrier R |] ==> minus R x y == add R x (a_inv R y)" |
33 |
25 |
|
26 locale abelian_monoid = struct G + |
|
27 assumes a_comm_monoid: "comm_monoid (| carrier = carrier G, |
|
28 mult = add G, one = zero G |)" |
|
29 |
|
30 text {* |
|
31 The following definition is redundant but simple to use. |
|
32 *} |
|
33 |
|
34 locale abelian_group = abelian_monoid + |
|
35 assumes a_comm_group: "comm_group (| carrier = carrier G, |
|
36 mult = add G, one = zero G |)" |
|
37 |
|
38 subsection {* Basic Properties *} |
|
39 |
|
40 lemma abelian_monoidI: |
|
41 assumes a_closed: |
|
42 "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> add R x y \<in> carrier R" |
|
43 and zero_closed: "zero R \<in> carrier R" |
|
44 and a_assoc: |
|
45 "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] ==> |
|
46 add R (add R x y) z = add R x (add R y z)" |
|
47 and l_zero: "!!x. x \<in> carrier R ==> add R (zero R) x = x" |
|
48 and a_comm: |
|
49 "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> add R x y = add R y x" |
|
50 shows "abelian_monoid R" |
|
51 by (auto intro!: abelian_monoid.intro comm_monoidI intro: prems) |
|
52 |
|
53 lemma abelian_groupI: |
|
54 assumes a_closed: |
|
55 "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> add R x y \<in> carrier R" |
|
56 and zero_closed: "zero R \<in> carrier R" |
|
57 and a_assoc: |
|
58 "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] ==> |
|
59 add R (add R x y) z = add R x (add R y z)" |
|
60 and a_comm: |
|
61 "!!x y. [| x \<in> carrier R; y \<in> carrier R |] ==> add R x y = add R y x" |
|
62 and l_zero: "!!x. x \<in> carrier R ==> add R (zero R) x = x" |
|
63 and l_inv_ex: "!!x. x \<in> carrier R ==> EX y : carrier R. add R y x = zero R" |
|
64 shows "abelian_group R" |
|
65 by (auto intro!: abelian_group.intro abelian_monoidI |
|
66 abelian_group_axioms.intro comm_monoidI comm_groupI |
|
67 intro: prems) |
|
68 |
|
69 (* TODO: The following thms are probably unnecessary. *) |
|
70 |
|
71 lemma (in abelian_monoid) a_magma: |
|
72 "magma (| carrier = carrier G, mult = add G, one = zero G |)" |
|
73 by (rule comm_monoid.axioms) (rule a_comm_monoid) |
|
74 |
|
75 lemma (in abelian_monoid) a_semigroup: |
|
76 "semigroup (| carrier = carrier G, mult = add G, one = zero G |)" |
|
77 by (unfold semigroup_def) (fast intro: comm_monoid.axioms a_comm_monoid) |
|
78 |
|
79 lemma (in abelian_monoid) a_monoid: |
|
80 "monoid (| carrier = carrier G, mult = add G, one = zero G |)" |
|
81 by (unfold monoid_def) (fast intro: a_comm_monoid comm_monoid.axioms) |
|
82 |
|
83 lemma (in abelian_group) a_group: |
|
84 "group (| carrier = carrier G, mult = add G, one = zero G |)" |
|
85 by (unfold group_def semigroup_def) |
|
86 (fast intro: comm_group.axioms a_comm_group) |
|
87 |
|
88 lemma (in abelian_monoid) a_comm_semigroup: |
|
89 "comm_semigroup (| carrier = carrier G, mult = add G, one = zero G |)" |
|
90 by (unfold comm_semigroup_def semigroup_def) |
|
91 (fast intro: comm_monoid.axioms a_comm_monoid) |
|
92 |
|
93 lemmas monoid_record_simps = semigroup.simps monoid.simps |
|
94 |
|
95 lemma (in abelian_monoid) a_closed [intro, simp]: |
|
96 "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> y \<in> carrier G" |
|
97 by (rule magma.m_closed [OF a_magma, simplified monoid_record_simps]) |
|
98 |
|
99 lemma (in abelian_monoid) zero_closed [intro, simp]: |
|
100 "\<zero> \<in> carrier G" |
|
101 by (rule monoid.one_closed [OF a_monoid, simplified monoid_record_simps]) |
|
102 |
|
103 lemma (in abelian_group) a_inv_closed [intro, simp]: |
|
104 "x \<in> carrier G ==> \<ominus> x \<in> carrier G" |
|
105 by (simp add: a_inv_def |
|
106 group.inv_closed [OF a_group, simplified monoid_record_simps]) |
|
107 |
|
108 lemma (in abelian_group) minus_closed [intro, simp]: |
|
109 "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<ominus> y \<in> carrier G" |
|
110 by (simp add: minus_def) |
|
111 |
|
112 lemma (in abelian_group) a_l_cancel [simp]: |
|
113 "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
114 (x \<oplus> y = x \<oplus> z) = (y = z)" |
|
115 by (rule group.l_cancel [OF a_group, simplified monoid_record_simps]) |
|
116 |
|
117 lemma (in abelian_group) a_r_cancel [simp]: |
|
118 "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
119 (y \<oplus> x = z \<oplus> x) = (y = z)" |
|
120 by (rule group.r_cancel [OF a_group, simplified monoid_record_simps]) |
|
121 |
|
122 lemma (in abelian_monoid) a_assoc: |
|
123 "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
124 (x \<oplus> y) \<oplus> z = x \<oplus> (y \<oplus> z)" |
|
125 by (rule semigroup.m_assoc [OF a_semigroup, simplified monoid_record_simps]) |
|
126 |
|
127 lemma (in abelian_monoid) l_zero [simp]: |
|
128 "x \<in> carrier G ==> \<zero> \<oplus> x = x" |
|
129 by (rule monoid.l_one [OF a_monoid, simplified monoid_record_simps]) |
|
130 |
|
131 lemma (in abelian_group) l_neg: |
|
132 "x \<in> carrier G ==> \<ominus> x \<oplus> x = \<zero>" |
|
133 by (simp add: a_inv_def |
|
134 group.l_inv [OF a_group, simplified monoid_record_simps]) |
|
135 |
|
136 lemma (in abelian_monoid) a_comm: |
|
137 "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> y = y \<oplus> x" |
|
138 by (rule comm_semigroup.m_comm [OF a_comm_semigroup, |
|
139 simplified monoid_record_simps]) |
|
140 |
|
141 lemma (in abelian_monoid) a_lcomm: |
|
142 "[| x \<in> carrier G; y \<in> carrier G; z \<in> carrier G |] ==> |
|
143 x \<oplus> (y \<oplus> z) = y \<oplus> (x \<oplus> z)" |
|
144 by (rule comm_semigroup.m_lcomm [OF a_comm_semigroup, |
|
145 simplified monoid_record_simps]) |
|
146 |
|
147 lemma (in abelian_monoid) r_zero [simp]: |
|
148 "x \<in> carrier G ==> x \<oplus> \<zero> = x" |
|
149 using monoid.r_one [OF a_monoid] |
|
150 by simp |
|
151 |
|
152 lemma (in abelian_group) r_neg: |
|
153 "x \<in> carrier G ==> x \<oplus> (\<ominus> x) = \<zero>" |
|
154 using group.r_inv [OF a_group] |
|
155 by (simp add: a_inv_def) |
|
156 |
|
157 lemma (in abelian_group) minus_zero [simp]: |
|
158 "\<ominus> \<zero> = \<zero>" |
|
159 by (simp add: a_inv_def |
|
160 group.inv_one [OF a_group, simplified monoid_record_simps]) |
|
161 |
|
162 lemma (in abelian_group) minus_minus [simp]: |
|
163 "x \<in> carrier G ==> \<ominus> (\<ominus> x) = x" |
|
164 using group.inv_inv [OF a_group, simplified monoid_record_simps] |
|
165 by (simp add: a_inv_def) |
|
166 |
|
167 lemma (in abelian_group) a_inv_inj: |
|
168 "inj_on (a_inv G) (carrier G)" |
|
169 using group.inv_inj [OF a_group, simplified monoid_record_simps] |
|
170 by (simp add: a_inv_def) |
|
171 |
|
172 lemma (in abelian_group) minus_add: |
|
173 "[| x \<in> carrier G; y \<in> carrier G |] ==> \<ominus> (x \<oplus> y) = \<ominus> x \<oplus> \<ominus> y" |
|
174 using comm_group.inv_mult [OF a_comm_group] |
|
175 by (simp add: a_inv_def) |
|
176 |
|
177 lemmas (in abelian_monoid) a_ac = a_assoc a_comm a_lcomm |
|
178 |
|
179 subsection {* Sums over Finite Sets *} |
|
180 |
|
181 text {* |
|
182 This definition makes it easy to lift lemmas from @{term finprod}. |
|
183 *} |
|
184 |
|
185 constdefs |
|
186 finsum :: "[('b, 'm) ring_scheme, 'a => 'b, 'a set] => 'b" |
|
187 "finsum G f A == finprod (| carrier = carrier G, |
|
188 mult = add G, one = zero G |) f A" |
|
189 |
34 (* |
190 (* |
35 -- {* Definition of derived operations *} |
191 lemmas (in abelian_monoid) finsum_empty [simp] = |
36 |
192 comm_monoid.finprod_empty [OF a_comm_monoid, simplified] |
37 minus_def: "a - b = a + (-b)" |
193 is dangeous, because attributes (like simplified) are applied upon opening |
38 inverse_def: "inverse a = (if a dvd 1 then THE x. a*x = 1 else 0)" |
194 the locale, simplified refers to the simpset at that time!!! |
39 divide_def: "a / b = a * inverse b" |
195 |
40 power_def: "a ^ n = nat_rec 1 (%u b. b * a) n" |
196 lemmas (in abelian_monoid) finsum_empty [simp] = |
|
197 abelian_monoid.finprod_empty [OF a_abelian_monoid, folded finsum_def, |
|
198 simplified monoid_record_simps] |
|
199 makes the locale slow, because proofs are repeated for every |
|
200 "lemma (in abelian_monoid)" command. |
|
201 When lemma is used time in UnivPoly.thy from beginning to UP_cring goes down |
|
202 from 110 secs to 60 secs. |
41 *) |
203 *) |
|
204 |
|
205 lemma (in abelian_monoid) finsum_empty [simp]: |
|
206 "finsum G f {} = \<zero>" |
|
207 by (rule comm_monoid.finprod_empty [OF a_comm_monoid, |
|
208 folded finsum_def, simplified monoid_record_simps]) |
|
209 |
|
210 lemma (in abelian_monoid) finsum_insert [simp]: |
|
211 "[| finite F; a \<notin> F; f \<in> F -> carrier G; f a \<in> carrier G |] |
|
212 ==> finsum G f (insert a F) = f a \<oplus> finsum G f F" |
|
213 by (rule comm_monoid.finprod_insert [OF a_comm_monoid, |
|
214 folded finsum_def, simplified monoid_record_simps]) |
|
215 |
|
216 lemma (in abelian_monoid) finsum_zero [simp]: |
|
217 "finite A ==> finsum G (%i. \<zero>) A = \<zero>" |
|
218 by (rule comm_monoid.finprod_one [OF a_comm_monoid, folded finsum_def, |
|
219 simplified monoid_record_simps]) |
|
220 |
|
221 lemma (in abelian_monoid) finsum_closed [simp]: |
|
222 fixes A |
|
223 assumes fin: "finite A" and f: "f \<in> A -> carrier G" |
|
224 shows "finsum G f A \<in> carrier G" |
|
225 by (rule comm_monoid.finprod_closed [OF a_comm_monoid, |
|
226 folded finsum_def, simplified monoid_record_simps]) |
|
227 |
|
228 lemma (in abelian_monoid) finsum_Un_Int: |
|
229 "[| finite A; finite B; g \<in> A -> carrier G; g \<in> B -> carrier G |] ==> |
|
230 finsum G g (A Un B) \<oplus> finsum G g (A Int B) = |
|
231 finsum G g A \<oplus> finsum G g B" |
|
232 by (rule comm_monoid.finprod_Un_Int [OF a_comm_monoid, |
|
233 folded finsum_def, simplified monoid_record_simps]) |
|
234 |
|
235 lemma (in abelian_monoid) finsum_Un_disjoint: |
|
236 "[| finite A; finite B; A Int B = {}; |
|
237 g \<in> A -> carrier G; g \<in> B -> carrier G |] |
|
238 ==> finsum G g (A Un B) = finsum G g A \<oplus> finsum G g B" |
|
239 by (rule comm_monoid.finprod_Un_disjoint [OF a_comm_monoid, |
|
240 folded finsum_def, simplified monoid_record_simps]) |
|
241 |
|
242 lemma (in abelian_monoid) finsum_addf: |
|
243 "[| finite A; f \<in> A -> carrier G; g \<in> A -> carrier G |] ==> |
|
244 finsum G (%x. f x \<oplus> g x) A = (finsum G f A \<oplus> finsum G g A)" |
|
245 by (rule comm_monoid.finprod_multf [OF a_comm_monoid, |
|
246 folded finsum_def, simplified monoid_record_simps]) |
|
247 |
|
248 lemma (in abelian_monoid) finsum_cong': |
|
249 "[| A = B; g : B -> carrier G; |
|
250 !!i. i : B ==> f i = g i |] ==> finsum G f A = finsum G g B" |
|
251 by (rule comm_monoid.finprod_cong' [OF a_comm_monoid, |
|
252 folded finsum_def, simplified monoid_record_simps]) auto |
|
253 |
|
254 lemma (in abelian_monoid) finsum_0 [simp]: |
|
255 "f : {0::nat} -> carrier G ==> finsum G f {..0} = f 0" |
|
256 by (rule comm_monoid.finprod_0 [OF a_comm_monoid, folded finsum_def, |
|
257 simplified monoid_record_simps]) |
|
258 |
|
259 lemma (in abelian_monoid) finsum_Suc [simp]: |
|
260 "f : {..Suc n} -> carrier G ==> |
|
261 finsum G f {..Suc n} = (f (Suc n) \<oplus> finsum G f {..n})" |
|
262 by (rule comm_monoid.finprod_Suc [OF a_comm_monoid, folded finsum_def, |
|
263 simplified monoid_record_simps]) |
|
264 |
|
265 lemma (in abelian_monoid) finsum_Suc2: |
|
266 "f : {..Suc n} -> carrier G ==> |
|
267 finsum G f {..Suc n} = (finsum G (%i. f (Suc i)) {..n} \<oplus> f 0)" |
|
268 by (rule comm_monoid.finprod_Suc2 [OF a_comm_monoid, folded finsum_def, |
|
269 simplified monoid_record_simps]) |
|
270 |
|
271 lemma (in abelian_monoid) finsum_add [simp]: |
|
272 "[| f : {..n} -> carrier G; g : {..n} -> carrier G |] ==> |
|
273 finsum G (%i. f i \<oplus> g i) {..n::nat} = |
|
274 finsum G f {..n} \<oplus> finsum G g {..n}" |
|
275 by (rule comm_monoid.finprod_mult [OF a_comm_monoid, folded finsum_def, |
|
276 simplified monoid_record_simps]) |
|
277 |
|
278 lemma (in abelian_monoid) finsum_cong: |
|
279 "[| A = B; !!i. i : B ==> f i = g i; |
|
280 g : B -> carrier G = True |] ==> finsum G f A = finsum G g B" |
|
281 by (rule comm_monoid.finprod_cong [OF a_comm_monoid, folded finsum_def, |
|
282 simplified monoid_record_simps]) auto |
|
283 |
|
284 text {*Usually, if this rule causes a failed congruence proof error, |
|
285 the reason is that the premise @{text "g \<in> B -> carrier G"} cannot be shown. |
|
286 Adding @{thm [source] Pi_def} to the simpset is often useful. *} |
|
287 |
|
288 section {* The Algebraic Hierarchy of Rings *} |
|
289 |
|
290 subsection {* Basic Definitions *} |
|
291 |
|
292 locale cring = abelian_group R + comm_monoid R + |
|
293 assumes l_distr: "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
|
294 ==> (x \<oplus> y) \<otimes> z = x \<otimes> z \<oplus> y \<otimes> z" |
42 |
295 |
43 locale "domain" = cring + |
296 locale "domain" = cring + |
44 assumes one_not_zero [simp]: "\<one> ~= \<zero>" |
297 assumes one_not_zero [simp]: "\<one> ~= \<zero>" |
45 and integral: "[| a \<otimes> b = \<zero>; a \<in> carrier R; b \<in> carrier R |] ==> |
298 and integral: "[| a \<otimes> b = \<zero>; a \<in> carrier R; b \<in> carrier R |] ==> |
46 a = \<zero> | b = \<zero>" |
299 a = \<zero> | b = \<zero>" |
47 |
300 |
48 subsection {* Basic Facts of Rings *} |
301 subsection {* Basic Facts of Rings *} |
49 |
302 |
50 lemma (in cring) a_magma [simp, intro]: |
303 lemma cringI: |
51 "magma (| carrier = carrier R, |
304 assumes abelian_group: "abelian_group R" |
52 mult = add R, one = zero R, m_inv = a_inv R |)" |
305 and comm_monoid: "comm_monoid R" |
53 using a_abelian_group by (simp only: abelian_group_def) |
306 and l_distr: "!!x y z. [| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
54 |
307 ==> mult R (add R x y) z = add R (mult R x z) (mult R y z)" |
55 lemma (in cring) a_l_one [simp, intro]: |
308 shows "cring R" |
56 "l_one (| carrier = carrier R, |
309 by (auto intro: cring.intro |
57 mult = add R, one = zero R, m_inv = a_inv R |)" |
310 abelian_group.axioms comm_monoid.axioms cring_axioms.intro prems) |
58 using a_abelian_group by (simp only: abelian_group_def) |
311 |
59 |
312 lemma (in cring) is_abelian_group: |
60 lemma (in cring) a_abelian_group_parts [simp, intro]: |
313 "abelian_group R" |
61 "semigroup_axioms (| carrier = carrier R, |
314 by (auto intro!: abelian_groupI a_assoc a_comm l_neg) |
62 mult = add R, one = zero R, m_inv = a_inv R |)" |
315 |
63 "group_axioms (| carrier = carrier R, |
316 lemma (in cring) is_comm_monoid: |
64 mult = add R, one = zero R, m_inv = a_inv R |)" |
317 "comm_monoid R" |
65 "abelian_semigroup_axioms (| carrier = carrier R, |
318 by (auto intro!: comm_monoidI m_assoc m_comm) |
66 mult = add R, one = zero R, m_inv = a_inv R |)" |
|
67 using a_abelian_group by (simp_all only: abelian_group_def) |
|
68 |
|
69 lemma (in cring) a_semigroup: |
|
70 "semigroup (| carrier = carrier R, |
|
71 mult = add R, one = zero R, m_inv = a_inv R |)" |
|
72 by (simp add: semigroup_def) |
|
73 |
|
74 lemma (in cring) a_group: |
|
75 "group (| carrier = carrier R, |
|
76 mult = add R, one = zero R, m_inv = a_inv R |)" |
|
77 by (simp add: group_def) |
|
78 |
|
79 lemma (in cring) a_abelian_semigroup: |
|
80 "abelian_semigroup (| carrier = carrier R, |
|
81 mult = add R, one = zero R, m_inv = a_inv R |)" |
|
82 by (simp add: abelian_semigroup_def) |
|
83 |
|
84 lemmas group_record_simps = semigroup.simps monoid.simps group.simps |
|
85 |
|
86 lemmas (in cring) a_closed [intro, simp] = |
|
87 magma.m_closed [OF a_magma, simplified group_record_simps] |
|
88 |
|
89 lemmas (in cring) zero_closed [intro, simp] = |
|
90 l_one.one_closed [OF a_l_one, simplified group_record_simps] |
|
91 |
|
92 lemmas (in cring) a_inv_closed [intro, simp] = |
|
93 group.inv_closed [OF a_group, simplified group_record_simps] |
|
94 |
|
95 lemma (in cring) minus_closed [intro, simp]: |
|
96 "[| x \<in> carrier R; y \<in> carrier R |] ==> x \<ominus> y \<in> carrier R" |
|
97 by (simp add: minus_def) |
|
98 |
|
99 lemmas (in cring) a_l_cancel [simp] = |
|
100 group.l_cancel [OF a_group, simplified group_record_simps] |
|
101 |
|
102 lemmas (in cring) a_r_cancel [simp] = |
|
103 group.r_cancel [OF a_group, simplified group_record_simps] |
|
104 |
|
105 lemmas (in cring) a_assoc = |
|
106 semigroup.m_assoc [OF a_semigroup, simplified group_record_simps] |
|
107 |
|
108 lemmas (in cring) l_zero [simp] = |
|
109 l_one.l_one [OF a_l_one, simplified group_record_simps] |
|
110 |
|
111 lemmas (in cring) l_neg = |
|
112 group.l_inv [OF a_group, simplified group_record_simps] |
|
113 |
|
114 lemmas (in cring) a_comm = |
|
115 abelian_semigroup.m_comm [OF a_abelian_semigroup, |
|
116 simplified group_record_simps] |
|
117 |
|
118 lemmas (in cring) a_lcomm = |
|
119 abelian_semigroup.m_lcomm [OF a_abelian_semigroup, simplified group_record_simps] |
|
120 |
|
121 lemma (in cring) r_zero [simp]: |
|
122 "x \<in> carrier R ==> x \<oplus> \<zero> = x" |
|
123 using group.r_one [OF a_group] |
|
124 by simp |
|
125 |
|
126 lemma (in cring) r_neg: |
|
127 "x \<in> carrier R ==> x \<oplus> (\<ominus> x) = \<zero>" |
|
128 using group.r_inv [OF a_group] |
|
129 by simp |
|
130 |
|
131 lemmas (in cring) minus_zero [simp] = |
|
132 group.inv_one [OF a_group, simplified group_record_simps] |
|
133 |
|
134 lemma (in cring) minus_minus [simp]: |
|
135 "x \<in> carrier R ==> \<ominus> (\<ominus> x) = x" |
|
136 using group.inv_inv [OF a_group, simplified group_record_simps] |
|
137 by simp |
|
138 |
|
139 lemma (in cring) minus_add: |
|
140 "[| x \<in> carrier R; y \<in> carrier R |] ==> \<ominus> (x \<oplus> y) = \<ominus> x \<oplus> \<ominus> y" |
|
141 using abelian_group.inv_mult [OF a_abelian_group] |
|
142 by simp |
|
143 |
|
144 lemmas (in cring) a_ac = a_assoc a_comm a_lcomm |
|
145 |
319 |
146 subsection {* Normaliser for Commutative Rings *} |
320 subsection {* Normaliser for Commutative Rings *} |
147 |
321 |
148 lemma (in cring) r_neg2: |
322 lemma (in abelian_group) r_neg2: |
149 "[| x \<in> carrier R; y \<in> carrier R |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y" |
323 "[| x \<in> carrier G; y \<in> carrier G |] ==> x \<oplus> (\<ominus> x \<oplus> y) = y" |
150 proof - |
324 proof - |
151 assume G: "x \<in> carrier R" "y \<in> carrier R" |
325 assume G: "x \<in> carrier G" "y \<in> carrier G" |
152 then have "(x \<oplus> \<ominus> x) \<oplus> y = y" by (simp only: r_neg l_zero) |
326 then have "(x \<oplus> \<ominus> x) \<oplus> y = y" |
153 with G show ?thesis by (simp add: a_ac) |
327 by (simp only: r_neg l_zero) |
154 qed |
328 with G show ?thesis |
155 |
329 by (simp add: a_ac) |
156 lemma (in cring) r_neg1: |
330 qed |
157 "[| x \<in> carrier R; y \<in> carrier R |] ==> \<ominus> x \<oplus> (x \<oplus> y) = y" |
331 |
158 proof - |
332 lemma (in abelian_group) r_neg1: |
159 assume G: "x \<in> carrier R" "y \<in> carrier R" |
333 "[| x \<in> carrier G; y \<in> carrier G |] ==> \<ominus> x \<oplus> (x \<oplus> y) = y" |
160 then have "(\<ominus> x \<oplus> x) \<oplus> y = y" by (simp only: l_neg l_zero) |
334 proof - |
|
335 assume G: "x \<in> carrier G" "y \<in> carrier G" |
|
336 then have "(\<ominus> x \<oplus> x) \<oplus> y = y" |
|
337 by (simp only: l_neg l_zero) |
161 with G show ?thesis by (simp add: a_ac) |
338 with G show ?thesis by (simp add: a_ac) |
162 qed |
339 qed |
163 |
340 |
164 lemma (in cring) r_distr: |
341 lemma (in cring) r_distr: |
165 "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
342 "[| x \<in> carrier R; y \<in> carrier R; z \<in> carrier R |] |
166 ==> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" |
343 ==> z \<otimes> (x \<oplus> y) = z \<otimes> x \<oplus> z \<otimes> y" |
167 proof - |
344 proof - |
168 assume G: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R" |
345 assume R: "x \<in> carrier R" "y \<in> carrier R" "z \<in> carrier R" |
169 then have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z" by (simp add: m_comm) |
346 then have "z \<otimes> (x \<oplus> y) = (x \<oplus> y) \<otimes> z" by (simp add: m_comm) |
170 also from G have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr) |
347 also from R have "... = x \<otimes> z \<oplus> y \<otimes> z" by (simp add: l_distr) |
171 also from G have "... = z \<otimes> x \<oplus> z \<otimes> y" by (simp add: m_comm) |
348 also from R have "... = z \<otimes> x \<oplus> z \<otimes> y" by (simp add: m_comm) |
172 finally show ?thesis . |
349 finally show ?thesis . |
173 qed |
350 qed |
174 |
351 |
175 text {* |
352 text {* |
176 The following proofs are from Jacobson, Basic Algebra I, pp.~88--89 |
353 The following proofs are from Jacobson, Basic Algebra I, pp.~88--89 |