author | wenzelm |
Sun, 19 Nov 2006 23:48:55 +0100 | |
changeset 21423 | 6cdd0589aa73 |
parent 21416 | f23e4e75dfd3 |
child 21588 | cd0dc678a205 |
permissions | -rw-r--r-- |
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
1 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
2 |
Title: The algebraic hierarchy of rings as axiomatic classes |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
3 |
Id: $Id$ |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
4 |
Author: Clemens Ballarin, started 9 December 1996 |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
5 |
Copyright: Clemens Ballarin |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
6 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
7 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
8 |
header {* The algebraic hierarchy of rings as axiomatic classes *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
9 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
10 |
theory Ring2 imports Main |
21423 | 11 |
begin |
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
12 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
13 |
section {* Constants *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
14 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
15 |
text {* Most constants are already declared by HOL. *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
16 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
17 |
consts |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
18 |
assoc :: "['a::times, 'a] => bool" (infixl 50) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
19 |
irred :: "'a::{zero, one, times} => bool" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
20 |
prime :: "'a::{zero, one, times} => bool" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
21 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
22 |
section {* Axioms *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
23 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
24 |
subsection {* Ring axioms *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
25 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
26 |
axclass ring < zero, one, plus, minus, times, inverse, power |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
27 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
28 |
a_assoc: "(a + b) + c = a + (b + c)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
29 |
l_zero: "0 + a = a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
30 |
l_neg: "(-a) + a = 0" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
31 |
a_comm: "a + b = b + a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
32 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
33 |
m_assoc: "(a * b) * c = a * (b * c)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
34 |
l_one: "1 * a = a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
35 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
36 |
l_distr: "(a + b) * c = a * c + b * c" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
37 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
38 |
m_comm: "a * b = b * a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
39 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
40 |
-- {* Definition of derived operations *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
41 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
42 |
minus_def: "a - b = a + (-b)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
43 |
inverse_def: "inverse a = (if a dvd 1 then THE x. a*x = 1 else 0)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
44 |
divide_def: "a / b = a * inverse b" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
45 |
power_def: "a ^ n = nat_rec 1 (%u b. b * a) n" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
46 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
47 |
defs |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
48 |
assoc_def: "a assoc b == a dvd b & b dvd a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
49 |
irred_def: "irred a == a ~= 0 & ~ a dvd 1 |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
50 |
& (ALL d. d dvd a --> d dvd 1 | a dvd d)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
51 |
prime_def: "prime p == p ~= 0 & ~ p dvd 1 |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
52 |
& (ALL a b. p dvd (a*b) --> p dvd a | p dvd b)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
53 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
54 |
subsection {* Integral domains *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
55 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
56 |
axclass |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
57 |
"domain" < ring |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
58 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
59 |
one_not_zero: "1 ~= 0" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
60 |
integral: "a * b = 0 ==> a = 0 | b = 0" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
61 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
62 |
subsection {* Factorial domains *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
63 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
64 |
axclass |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
65 |
factorial < "domain" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
66 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
67 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
68 |
Proper definition using divisor chain condition currently not supported. |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
69 |
factorial_divisor: "wf {(a, b). a dvd b & ~ (b dvd a)}" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
70 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
71 |
factorial_divisor: "True" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
72 |
factorial_prime: "irred a ==> prime a" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
73 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
74 |
subsection {* Euclidean domains *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
75 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
76 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
77 |
axclass |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
78 |
euclidean < "domain" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
79 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
80 |
euclidean_ax: "b ~= 0 ==> Ex (% (q, r, e_size::('a::ringS)=>nat). |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
81 |
a = b * q + r & e_size r < e_size b)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
82 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
83 |
Nothing has been proved about Euclidean domains, yet. |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
84 |
Design question: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
85 |
Fix quo, rem and e_size as constants that are axiomatised with |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
86 |
euclidean_ax? |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
87 |
- advantage: more pragmatic and easier to use |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
88 |
- disadvantage: for every type, one definition of quo and rem will |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
89 |
be fixed, users may want to use differing ones; |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
90 |
also, it seems not possible to prove that fields are euclidean |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
91 |
domains, because that would require generic (type-independent) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
92 |
definitions of quo and rem. |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
93 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
94 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
95 |
subsection {* Fields *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
96 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
97 |
axclass |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
98 |
field < ring |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
99 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
100 |
field_one_not_zero: "1 ~= 0" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
101 |
(* Avoid a common superclass as the first thing we will |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
102 |
prove about fields is that they are domains. *) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
103 |
field_ax: "a ~= 0 ==> a dvd 1" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
104 |
|
21423 | 105 |
|
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
106 |
section {* Basic facts *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
107 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
108 |
subsection {* Normaliser for rings *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
109 |
|
21423 | 110 |
(* derived rewrite rules *) |
111 |
||
112 |
lemma a_lcomm: "(a::'a::ring)+(b+c) = b+(a+c)" |
|
113 |
apply (rule a_comm [THEN trans]) |
|
114 |
apply (rule a_assoc [THEN trans]) |
|
115 |
apply (rule a_comm [THEN arg_cong]) |
|
116 |
done |
|
117 |
||
118 |
lemma r_zero: "(a::'a::ring) + 0 = a" |
|
119 |
apply (rule a_comm [THEN trans]) |
|
120 |
apply (rule l_zero) |
|
121 |
done |
|
122 |
||
123 |
lemma r_neg: "(a::'a::ring) + (-a) = 0" |
|
124 |
apply (rule a_comm [THEN trans]) |
|
125 |
apply (rule l_neg) |
|
126 |
done |
|
127 |
||
128 |
lemma r_neg2: "(a::'a::ring) + (-a + b) = b" |
|
129 |
apply (rule a_assoc [symmetric, THEN trans]) |
|
130 |
apply (simp add: r_neg l_zero) |
|
131 |
done |
|
132 |
||
133 |
lemma r_neg1: "-(a::'a::ring) + (a + b) = b" |
|
134 |
apply (rule a_assoc [symmetric, THEN trans]) |
|
135 |
apply (simp add: l_neg l_zero) |
|
136 |
done |
|
137 |
||
138 |
||
139 |
(* auxiliary *) |
|
140 |
||
141 |
lemma a_lcancel: "!! a::'a::ring. a + b = a + c ==> b = c" |
|
142 |
apply (rule box_equals) |
|
143 |
prefer 2 |
|
144 |
apply (rule l_zero) |
|
145 |
prefer 2 |
|
146 |
apply (rule l_zero) |
|
147 |
apply (rule_tac a1 = a in l_neg [THEN subst]) |
|
148 |
apply (simp add: a_assoc) |
|
149 |
done |
|
150 |
||
151 |
lemma minus_add: "-((a::'a::ring) + b) = (-a) + (-b)" |
|
152 |
apply (rule_tac a = "a + b" in a_lcancel) |
|
153 |
apply (simp add: r_neg l_neg l_zero a_assoc a_comm a_lcomm) |
|
154 |
done |
|
155 |
||
156 |
lemma minus_minus: "-(-(a::'a::ring)) = a" |
|
157 |
apply (rule a_lcancel) |
|
158 |
apply (rule r_neg [THEN trans]) |
|
159 |
apply (rule l_neg [symmetric]) |
|
160 |
done |
|
161 |
||
162 |
lemma minus0: "- 0 = (0::'a::ring)" |
|
163 |
apply (rule a_lcancel) |
|
164 |
apply (rule r_neg [THEN trans]) |
|
165 |
apply (rule l_zero [symmetric]) |
|
166 |
done |
|
167 |
||
168 |
||
169 |
(* derived rules for multiplication *) |
|
170 |
||
171 |
lemma m_lcomm: "(a::'a::ring)*(b*c) = b*(a*c)" |
|
172 |
apply (rule m_comm [THEN trans]) |
|
173 |
apply (rule m_assoc [THEN trans]) |
|
174 |
apply (rule m_comm [THEN arg_cong]) |
|
175 |
done |
|
176 |
||
177 |
lemma r_one: "(a::'a::ring) * 1 = a" |
|
178 |
apply (rule m_comm [THEN trans]) |
|
179 |
apply (rule l_one) |
|
180 |
done |
|
181 |
||
182 |
lemma r_distr: "(a::'a::ring) * (b + c) = a * b + a * c" |
|
183 |
apply (rule m_comm [THEN trans]) |
|
184 |
apply (rule l_distr [THEN trans]) |
|
185 |
apply (simp add: m_comm) |
|
186 |
done |
|
187 |
||
188 |
||
189 |
(* the following proof is from Jacobson, Basic Algebra I, pp. 88-89 *) |
|
190 |
lemma l_null: "0 * (a::'a::ring) = 0" |
|
191 |
apply (rule a_lcancel) |
|
192 |
apply (rule l_distr [symmetric, THEN trans]) |
|
193 |
apply (simp add: r_zero) |
|
194 |
done |
|
195 |
||
196 |
lemma r_null: "(a::'a::ring) * 0 = 0" |
|
197 |
apply (rule m_comm [THEN trans]) |
|
198 |
apply (rule l_null) |
|
199 |
done |
|
200 |
||
201 |
lemma l_minus: "(-(a::'a::ring)) * b = - (a * b)" |
|
202 |
apply (rule a_lcancel) |
|
203 |
apply (rule r_neg [symmetric, THEN [2] trans]) |
|
204 |
apply (rule l_distr [symmetric, THEN trans]) |
|
205 |
apply (simp add: l_null r_neg) |
|
206 |
done |
|
207 |
||
208 |
lemma r_minus: "(a::'a::ring) * (-b) = - (a * b)" |
|
209 |
apply (rule a_lcancel) |
|
210 |
apply (rule r_neg [symmetric, THEN [2] trans]) |
|
211 |
apply (rule r_distr [symmetric, THEN trans]) |
|
212 |
apply (simp add: r_null r_neg) |
|
213 |
done |
|
214 |
||
215 |
(*** Term order for commutative rings ***) |
|
216 |
||
217 |
ML {* |
|
218 |
fun ring_ord (Const (a, _)) = |
|
219 |
find_index (fn a' => a = a') |
|
220 |
["HOL.zero", "HOL.plus", "HOL.uminus", "HOL.minus", "HOL.one", "HOL.times"] |
|
221 |
| ring_ord _ = ~1; |
|
222 |
||
223 |
fun termless_ring (a, b) = (Term.term_lpo ring_ord (a, b) = LESS); |
|
224 |
||
225 |
val ring_ss = HOL_basic_ss settermless termless_ring addsimps |
|
226 |
[thm "a_assoc", thm "l_zero", thm "l_neg", thm "a_comm", thm "m_assoc", |
|
227 |
thm "l_one", thm "l_distr", thm "m_comm", thm "minus_def", |
|
228 |
thm "r_zero", thm "r_neg", thm "r_neg2", thm "r_neg1", thm "minus_add", |
|
229 |
thm "minus_minus", thm "minus0", thm "a_lcomm", thm "m_lcomm", (*thm "r_one",*) |
|
230 |
thm "r_distr", thm "l_null", thm "r_null", thm "l_minus", thm "r_minus"]; |
|
231 |
*} (* Note: r_one is not necessary in ring_ss *) |
|
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
232 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
233 |
method_setup ring = |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
234 |
{* Method.no_args (Method.SIMPLE_METHOD' HEADGOAL (full_simp_tac ring_ss)) *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
235 |
{* computes distributive normal form in rings *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
236 |
|
21423 | 237 |
lemmas ring_simps = |
238 |
l_zero r_zero l_neg r_neg minus_minus minus0 |
|
239 |
l_one r_one l_null r_null l_minus r_minus |
|
240 |
||
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
241 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
242 |
subsection {* Rings and the summation operator *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
243 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
244 |
(* Basic facts --- move to HOL!!! *) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
245 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
246 |
(* needed because natsum_cong (below) disables atMost_0 *) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
247 |
lemma natsum_0 [simp]: "setsum f {..(0::nat)} = (f 0::'a::comm_monoid_add)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
248 |
by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
249 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
250 |
lemma natsum_Suc [simp]: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
251 |
"setsum f {..Suc n} = (f (Suc n) + setsum f {..n}::'a::comm_monoid_add)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
252 |
by (simp add: atMost_Suc) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
253 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
254 |
lemma natsum_Suc2: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
255 |
"setsum f {..Suc n} = (f 0::'a::comm_monoid_add) + (setsum (%i. f (Suc i)) {..n})" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
256 |
proof (induct n) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
257 |
case 0 show ?case by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
258 |
next |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
259 |
case Suc thus ?case by (simp add: semigroup_add_class.add_assoc) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
260 |
qed |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
261 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
262 |
lemma natsum_cong [cong]: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
263 |
"!!k. [| j = k; !!i::nat. i <= k ==> f i = (g i::'a::comm_monoid_add) |] ==> |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
264 |
setsum f {..j} = setsum g {..k}" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
265 |
by (induct j) auto |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
266 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
267 |
lemma natsum_zero [simp]: "setsum (%i. 0) {..n::nat} = (0::'a::comm_monoid_add)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
268 |
by (induct n) simp_all |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
269 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
270 |
lemma natsum_add [simp]: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
271 |
"!!f::nat=>'a::comm_monoid_add. |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
272 |
setsum (%i. f i + g i) {..n::nat} = setsum f {..n} + setsum g {..n}" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
273 |
by (induct n) (simp_all add: add_ac) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
274 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
275 |
(* Facts specific to rings *) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
276 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
277 |
instance ring < comm_monoid_add |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
278 |
proof |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
279 |
fix x y z |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
280 |
show "(x::'a::ring) + y = y + x" by (rule a_comm) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
281 |
show "((x::'a::ring) + y) + z = x + (y + z)" by (rule a_assoc) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
282 |
show "0 + (x::'a::ring) = x" by (rule l_zero) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
283 |
qed |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
284 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
285 |
ML {* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
286 |
local |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
287 |
val lhss = |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
288 |
["t + u::'a::ring", |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
289 |
"t - u::'a::ring", |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
290 |
"t * u::'a::ring", |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
291 |
"- t::'a::ring"]; |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
292 |
fun proc ss t = |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
293 |
let val rew = Goal.prove (Simplifier.the_context ss) [] [] |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
294 |
(HOLogic.mk_Trueprop |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
295 |
(HOLogic.mk_eq (t, Var (("x", Term.maxidx_of_term t + 1), fastype_of t)))) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
296 |
(fn _ => simp_tac (Simplifier.inherit_context ss ring_ss) 1) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
297 |
|> mk_meta_eq; |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
298 |
val (t', u) = Logic.dest_equals (Thm.prop_of rew); |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
299 |
in if t' aconv u |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
300 |
then NONE |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
301 |
else SOME rew |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
302 |
end; |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
303 |
in |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
304 |
val ring_simproc = Simplifier.simproc (the_context ()) "ring" lhss (K proc); |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
305 |
end; |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
306 |
*} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
307 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
308 |
ML_setup {* Addsimprocs [ring_simproc] *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
309 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
310 |
lemma natsum_ldistr: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
311 |
"!!a::'a::ring. setsum f {..n::nat} * a = setsum (%i. f i * a) {..n}" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
312 |
by (induct n) simp_all |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
313 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
314 |
lemma natsum_rdistr: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
315 |
"!!a::'a::ring. a * setsum f {..n::nat} = setsum (%i. a * f i) {..n}" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
316 |
by (induct n) simp_all |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
317 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
318 |
subsection {* Integral Domains *} |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
319 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
320 |
declare one_not_zero [simp] |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
321 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
322 |
lemma zero_not_one [simp]: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
323 |
"0 ~= (1::'a::domain)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
324 |
by (rule not_sym) simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
325 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
326 |
lemma integral_iff: (* not by default a simp rule! *) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
327 |
"(a * b = (0::'a::domain)) = (a = 0 | b = 0)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
328 |
proof |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
329 |
assume "a * b = 0" then show "a = 0 | b = 0" by (simp add: integral) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
330 |
next |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
331 |
assume "a = 0 | b = 0" then show "a * b = 0" by auto |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
332 |
qed |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
333 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
334 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
335 |
lemma "(a::'a::ring) - (a - b) = b" apply simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
336 |
simproc seems to fail on this example (fixed with new term order) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
337 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
338 |
(* |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
339 |
lemma bug: "(b::'a::ring) - (b - a) = a" by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
340 |
simproc for rings cannot prove "(a::'a::ring) - (a - b) = b" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
341 |
*) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
342 |
lemma m_lcancel: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
343 |
assumes prem: "(a::'a::domain) ~= 0" shows conc: "(a * b = a * c) = (b = c)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
344 |
proof |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
345 |
assume eq: "a * b = a * c" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
346 |
then have "a * (b - c) = 0" by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
347 |
then have "a = 0 | (b - c) = 0" by (simp only: integral_iff) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
348 |
with prem have "b - c = 0" by auto |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
349 |
then have "b = b - (b - c)" by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
350 |
also have "b - (b - c) = c" by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
351 |
finally show "b = c" . |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
352 |
next |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
353 |
assume "b = c" then show "a * b = a * c" by simp |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
354 |
qed |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
355 |
|
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
356 |
lemma m_rcancel: |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
357 |
"(a::'a::domain) ~= 0 ==> (b * a = c * a) = (b = c)" |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
358 |
by (simp add: m_lcancel) |
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
359 |
|
21416 | 360 |
lemma power_0 [simp]: |
361 |
"(a::'a::ring) ^ 0 = 1" unfolding power_def by simp |
|
362 |
||
363 |
lemma power_Suc [simp]: |
|
364 |
"(a::'a::ring) ^ Suc n = a ^ n * a" unfolding power_def by simp |
|
365 |
||
366 |
lemma power_one [simp]: |
|
367 |
"1 ^ n = (1::'a::ring)" by (induct n) simp_all |
|
368 |
||
369 |
lemma power_zero [simp]: |
|
370 |
"n \<noteq> 0 \<Longrightarrow> 0 ^ n = (0::'a::ring)" by (induct n) simp_all |
|
371 |
||
372 |
lemma power_mult [simp]: |
|
373 |
"(a::'a::ring) ^ m * a ^ n = a ^ (m + n)" |
|
374 |
by (induct m) simp_all |
|
375 |
||
376 |
||
377 |
section "Divisibility" |
|
378 |
||
379 |
lemma dvd_zero_right [simp]: |
|
380 |
"(a::'a::ring) dvd 0" |
|
381 |
proof |
|
382 |
show "0 = a * 0" by simp |
|
383 |
qed |
|
384 |
||
385 |
lemma dvd_zero_left: |
|
386 |
"0 dvd (a::'a::ring) \<Longrightarrow> a = 0" unfolding dvd_def by simp |
|
387 |
||
388 |
lemma dvd_refl_ring [simp]: |
|
389 |
"(a::'a::ring) dvd a" |
|
390 |
proof |
|
391 |
show "a = a * 1" by simp |
|
392 |
qed |
|
393 |
||
394 |
lemma dvd_trans_ring: |
|
395 |
fixes a b c :: "'a::ring" |
|
396 |
assumes a_dvd_b: "a dvd b" |
|
397 |
and b_dvd_c: "b dvd c" |
|
398 |
shows "a dvd c" |
|
399 |
proof - |
|
400 |
from a_dvd_b obtain l where "b = a * l" using dvd_def by blast |
|
401 |
moreover from b_dvd_c obtain j where "c = b * j" using dvd_def by blast |
|
402 |
ultimately have "c = a * (l * j)" by simp |
|
403 |
then have "\<exists>k. c = a * k" .. |
|
404 |
then show ?thesis using dvd_def by blast |
|
405 |
qed |
|
406 |
||
21423 | 407 |
|
408 |
lemma unit_mult: |
|
409 |
"!!a::'a::ring. [| a dvd 1; b dvd 1 |] ==> a * b dvd 1" |
|
410 |
apply (unfold dvd_def) |
|
411 |
apply clarify |
|
412 |
apply (rule_tac x = "k * ka" in exI) |
|
413 |
apply simp |
|
414 |
done |
|
415 |
||
416 |
lemma unit_power: "!!a::'a::ring. a dvd 1 ==> a^n dvd 1" |
|
417 |
apply (induct_tac n) |
|
418 |
apply simp |
|
419 |
apply (simp add: unit_mult) |
|
420 |
done |
|
421 |
||
422 |
lemma dvd_add_right [simp]: |
|
423 |
"!! a::'a::ring. [| a dvd b; a dvd c |] ==> a dvd b + c" |
|
424 |
apply (unfold dvd_def) |
|
425 |
apply clarify |
|
426 |
apply (rule_tac x = "k + ka" in exI) |
|
427 |
apply (simp add: r_distr) |
|
428 |
done |
|
429 |
||
430 |
lemma dvd_uminus_right [simp]: |
|
431 |
"!! a::'a::ring. a dvd b ==> a dvd -b" |
|
432 |
apply (unfold dvd_def) |
|
433 |
apply clarify |
|
434 |
apply (rule_tac x = "-k" in exI) |
|
435 |
apply (simp add: r_minus) |
|
436 |
done |
|
437 |
||
438 |
lemma dvd_l_mult_right [simp]: |
|
439 |
"!! a::'a::ring. a dvd b ==> a dvd c*b" |
|
440 |
apply (unfold dvd_def) |
|
441 |
apply clarify |
|
442 |
apply (rule_tac x = "c * k" in exI) |
|
443 |
apply simp |
|
444 |
done |
|
445 |
||
446 |
lemma dvd_r_mult_right [simp]: |
|
447 |
"!! a::'a::ring. a dvd b ==> a dvd b*c" |
|
448 |
apply (unfold dvd_def) |
|
449 |
apply clarify |
|
450 |
apply (rule_tac x = "k * c" in exI) |
|
451 |
apply simp |
|
452 |
done |
|
453 |
||
454 |
||
455 |
(* Inverse of multiplication *) |
|
456 |
||
457 |
section "inverse" |
|
458 |
||
459 |
lemma inverse_unique: "!! a::'a::ring. [| a * x = 1; a * y = 1 |] ==> x = y" |
|
460 |
apply (rule_tac a = "(a*y) * x" and b = "y * (a*x)" in box_equals) |
|
461 |
apply (simp (no_asm)) |
|
462 |
apply auto |
|
463 |
done |
|
464 |
||
465 |
lemma r_inverse_ring: "!! a::'a::ring. a dvd 1 ==> a * inverse a = 1" |
|
466 |
apply (unfold inverse_def dvd_def) |
|
467 |
apply (tactic {* asm_full_simp_tac (simpset () delsimprocs [ring_simproc]) 1 *}) |
|
468 |
apply clarify |
|
469 |
apply (rule theI) |
|
470 |
apply assumption |
|
471 |
apply (rule inverse_unique) |
|
472 |
apply assumption |
|
473 |
apply assumption |
|
474 |
done |
|
475 |
||
476 |
lemma l_inverse_ring: "!! a::'a::ring. a dvd 1 ==> inverse a * a = 1" |
|
477 |
by (simp add: r_inverse_ring) |
|
478 |
||
479 |
||
480 |
(* Fields *) |
|
481 |
||
482 |
section "Fields" |
|
483 |
||
484 |
lemma field_unit [simp]: "!! a::'a::field. (a dvd 1) = (a ~= 0)" |
|
485 |
by (auto dest: field_ax dvd_zero_left simp add: field_one_not_zero) |
|
486 |
||
487 |
lemma r_inverse [simp]: "!! a::'a::field. a ~= 0 ==> a * inverse a = 1" |
|
488 |
by (simp add: r_inverse_ring) |
|
489 |
||
490 |
lemma l_inverse [simp]: "!! a::'a::field. a ~= 0 ==> inverse a * a= 1" |
|
491 |
by (simp add: l_inverse_ring) |
|
492 |
||
493 |
||
494 |
(* fields are integral domains *) |
|
495 |
||
496 |
lemma field_integral: "!! a::'a::field. a * b = 0 ==> a = 0 | b = 0" |
|
497 |
apply (tactic "Step_tac 1") |
|
498 |
apply (rule_tac a = " (a*b) * inverse b" in box_equals) |
|
499 |
apply (rule_tac [3] refl) |
|
500 |
prefer 2 |
|
501 |
apply (simp (no_asm)) |
|
502 |
apply auto |
|
503 |
done |
|
504 |
||
505 |
||
506 |
(* fields are factorial domains *) |
|
507 |
||
508 |
lemma field_fact_prime: "!! a::'a::field. irred a ==> prime a" |
|
509 |
unfolding prime_def irred_def by (blast intro: field_ax) |
|
21416 | 510 |
|
20318
0e0ea63fe768
Restructured algebra library, added ideals and quotient rings.
ballarin
parents:
diff
changeset
|
511 |
end |