author | haftmann |
Fri, 30 Nov 2007 20:13:06 +0100 | |
changeset 25512 | 4134f7c782e2 |
parent 25450 | c3b26e533b21 |
child 25564 | 4ca31a3706a4 |
permissions | -rw-r--r-- |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
1 |
(* Title: HOL/Ring_and_Field.thy |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
2 |
ID: $Id$ |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
3 |
Author: Gertrud Bauer, Steven Obua, Tobias Nipkow, Lawrence C Paulson, and Markus Wenzel, |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
4 |
with contributions by Jeremy Avigad |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
5 |
*) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
6 |
|
14738 | 7 |
header {* (Ordered) Rings and Fields *} |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
8 |
|
15229 | 9 |
theory Ring_and_Field |
15140 | 10 |
imports OrderedGroup |
15131 | 11 |
begin |
14504 | 12 |
|
14738 | 13 |
text {* |
14 |
The theory of partially ordered rings is taken from the books: |
|
15 |
\begin{itemize} |
|
16 |
\item \emph{Lattice Theory} by Garret Birkhoff, American Mathematical Society 1979 |
|
17 |
\item \emph{Partially Ordered Algebraic Systems}, Pergamon Press 1963 |
|
18 |
\end{itemize} |
|
19 |
Most of the used notions can also be looked up in |
|
20 |
\begin{itemize} |
|
14770 | 21 |
\item \url{http://www.mathworld.com} by Eric Weisstein et. al. |
14738 | 22 |
\item \emph{Algebra I} by van der Waerden, Springer. |
23 |
\end{itemize} |
|
24 |
*} |
|
14504 | 25 |
|
22390 | 26 |
class semiring = ab_semigroup_add + semigroup_mult + |
25062 | 27 |
assumes left_distrib: "(a + b) * c = a * c + b * c" |
28 |
assumes right_distrib: "a * (b + c) = a * b + a * c" |
|
25152 | 29 |
begin |
30 |
||
31 |
text{*For the @{text combine_numerals} simproc*} |
|
32 |
lemma combine_common_factor: |
|
33 |
"a * e + (b * e + c) = (a + b) * e + c" |
|
34 |
by (simp add: left_distrib add_ac) |
|
35 |
||
36 |
end |
|
14504 | 37 |
|
22390 | 38 |
class mult_zero = times + zero + |
25062 | 39 |
assumes mult_zero_left [simp]: "0 * a = 0" |
40 |
assumes mult_zero_right [simp]: "a * 0 = 0" |
|
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
41 |
|
22390 | 42 |
class semiring_0 = semiring + comm_monoid_add + mult_zero |
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
43 |
|
22390 | 44 |
class semiring_0_cancel = semiring + comm_monoid_add + cancel_ab_semigroup_add |
25186 | 45 |
begin |
14504 | 46 |
|
25186 | 47 |
subclass semiring_0 |
48 |
proof unfold_locales |
|
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
49 |
fix a :: 'a |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
50 |
have "0 * a + 0 * a = 0 * a + 0" |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
51 |
by (simp add: left_distrib [symmetric]) |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
52 |
thus "0 * a = 0" |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
53 |
by (simp only: add_left_cancel) |
25152 | 54 |
next |
55 |
fix a :: 'a |
|
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
56 |
have "a * 0 + a * 0 = a * 0 + 0" |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
57 |
by (simp add: right_distrib [symmetric]) |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
58 |
thus "a * 0 = 0" |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
59 |
by (simp only: add_left_cancel) |
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
60 |
qed |
14940 | 61 |
|
25186 | 62 |
end |
25152 | 63 |
|
22390 | 64 |
class comm_semiring = ab_semigroup_add + ab_semigroup_mult + |
25062 | 65 |
assumes distrib: "(a + b) * c = a * c + b * c" |
25152 | 66 |
begin |
14504 | 67 |
|
25152 | 68 |
subclass semiring |
69 |
proof unfold_locales |
|
14738 | 70 |
fix a b c :: 'a |
71 |
show "(a + b) * c = a * c + b * c" by (simp add: distrib) |
|
72 |
have "a * (b + c) = (b + c) * a" by (simp add: mult_ac) |
|
73 |
also have "... = b * a + c * a" by (simp only: distrib) |
|
74 |
also have "... = a * b + a * c" by (simp add: mult_ac) |
|
75 |
finally show "a * (b + c) = a * b + a * c" by blast |
|
14504 | 76 |
qed |
77 |
||
25152 | 78 |
end |
14504 | 79 |
|
25152 | 80 |
class comm_semiring_0 = comm_semiring + comm_monoid_add + mult_zero |
81 |
begin |
|
82 |
||
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
83 |
subclass semiring_0 by intro_locales |
25152 | 84 |
|
85 |
end |
|
14504 | 86 |
|
22390 | 87 |
class comm_semiring_0_cancel = comm_semiring + comm_monoid_add + cancel_ab_semigroup_add |
25186 | 88 |
begin |
14940 | 89 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
90 |
subclass semiring_0_cancel by intro_locales |
14940 | 91 |
|
25186 | 92 |
end |
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
93 |
|
22390 | 94 |
class zero_neq_one = zero + one + |
25062 | 95 |
assumes zero_neq_one [simp]: "0 \<noteq> 1" |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
96 |
|
22390 | 97 |
class semiring_1 = zero_neq_one + semiring_0 + monoid_mult |
14504 | 98 |
|
22390 | 99 |
class comm_semiring_1 = zero_neq_one + comm_semiring_0 + comm_monoid_mult |
100 |
(*previously almost_semiring*) |
|
25152 | 101 |
begin |
14738 | 102 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
103 |
subclass semiring_1 by intro_locales |
25152 | 104 |
|
105 |
end |
|
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
106 |
|
22390 | 107 |
class no_zero_divisors = zero + times + |
25062 | 108 |
assumes no_zero_divisors: "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> a * b \<noteq> 0" |
14504 | 109 |
|
22390 | 110 |
class semiring_1_cancel = semiring + comm_monoid_add + zero_neq_one |
111 |
+ cancel_ab_semigroup_add + monoid_mult |
|
25267 | 112 |
begin |
14940 | 113 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
114 |
subclass semiring_0_cancel by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
115 |
|
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
116 |
subclass semiring_1 by intro_locales |
25267 | 117 |
|
118 |
end |
|
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
119 |
|
22390 | 120 |
class comm_semiring_1_cancel = comm_semiring + comm_monoid_add + comm_monoid_mult |
121 |
+ zero_neq_one + cancel_ab_semigroup_add |
|
25267 | 122 |
begin |
14738 | 123 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
124 |
subclass semiring_1_cancel by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
125 |
subclass comm_semiring_0_cancel by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
126 |
subclass comm_semiring_1 by intro_locales |
25267 | 127 |
|
128 |
end |
|
25152 | 129 |
|
22390 | 130 |
class ring = semiring + ab_group_add |
25267 | 131 |
begin |
25152 | 132 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
133 |
subclass semiring_0_cancel by intro_locales |
25152 | 134 |
|
135 |
text {* Distribution rules *} |
|
136 |
||
137 |
lemma minus_mult_left: "- (a * b) = - a * b" |
|
138 |
by (rule equals_zero_I) (simp add: left_distrib [symmetric]) |
|
139 |
||
140 |
lemma minus_mult_right: "- (a * b) = a * - b" |
|
141 |
by (rule equals_zero_I) (simp add: right_distrib [symmetric]) |
|
142 |
||
143 |
lemma minus_mult_minus [simp]: "- a * - b = a * b" |
|
144 |
by (simp add: minus_mult_left [symmetric] minus_mult_right [symmetric]) |
|
145 |
||
146 |
lemma minus_mult_commute: "- a * b = a * - b" |
|
147 |
by (simp add: minus_mult_left [symmetric] minus_mult_right [symmetric]) |
|
148 |
||
149 |
lemma right_diff_distrib: "a * (b - c) = a * b - a * c" |
|
150 |
by (simp add: right_distrib diff_minus |
|
151 |
minus_mult_left [symmetric] minus_mult_right [symmetric]) |
|
152 |
||
153 |
lemma left_diff_distrib: "(a - b) * c = a * c - b * c" |
|
154 |
by (simp add: left_distrib diff_minus |
|
155 |
minus_mult_left [symmetric] minus_mult_right [symmetric]) |
|
156 |
||
157 |
lemmas ring_distribs = |
|
158 |
right_distrib left_distrib left_diff_distrib right_diff_distrib |
|
159 |
||
25230 | 160 |
lemmas ring_simps = |
161 |
add_ac |
|
162 |
add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2 |
|
163 |
diff_eq_eq eq_diff_eq diff_minus [symmetric] uminus_add_conv_diff |
|
164 |
ring_distribs |
|
165 |
||
166 |
lemma eq_add_iff1: |
|
167 |
"a * e + c = b * e + d \<longleftrightarrow> (a - b) * e + c = d" |
|
168 |
by (simp add: ring_simps) |
|
169 |
||
170 |
lemma eq_add_iff2: |
|
171 |
"a * e + c = b * e + d \<longleftrightarrow> c = (b - a) * e + d" |
|
172 |
by (simp add: ring_simps) |
|
173 |
||
25152 | 174 |
end |
175 |
||
176 |
lemmas ring_distribs = |
|
177 |
right_distrib left_distrib left_diff_distrib right_diff_distrib |
|
178 |
||
22390 | 179 |
class comm_ring = comm_semiring + ab_group_add |
25267 | 180 |
begin |
14738 | 181 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
182 |
subclass ring by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
183 |
subclass comm_semiring_0 by intro_locales |
25267 | 184 |
|
185 |
end |
|
14738 | 186 |
|
22390 | 187 |
class ring_1 = ring + zero_neq_one + monoid_mult |
25267 | 188 |
begin |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
189 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
190 |
subclass semiring_1_cancel by intro_locales |
25267 | 191 |
|
192 |
end |
|
25152 | 193 |
|
22390 | 194 |
class comm_ring_1 = comm_ring + zero_neq_one + comm_monoid_mult |
195 |
(*previously ring*) |
|
25267 | 196 |
begin |
14738 | 197 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
198 |
subclass ring_1 by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
199 |
subclass comm_semiring_1_cancel by intro_locales |
25267 | 200 |
|
201 |
end |
|
25152 | 202 |
|
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
203 |
class ring_no_zero_divisors = ring + no_zero_divisors |
25230 | 204 |
begin |
205 |
||
206 |
lemma mult_eq_0_iff [simp]: |
|
207 |
shows "a * b = 0 \<longleftrightarrow> (a = 0 \<or> b = 0)" |
|
208 |
proof (cases "a = 0 \<or> b = 0") |
|
209 |
case False then have "a \<noteq> 0" and "b \<noteq> 0" by auto |
|
210 |
then show ?thesis using no_zero_divisors by simp |
|
211 |
next |
|
212 |
case True then show ?thesis by auto |
|
213 |
qed |
|
214 |
||
215 |
end |
|
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
216 |
|
23544 | 217 |
class ring_1_no_zero_divisors = ring_1 + ring_no_zero_divisors |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
218 |
|
22390 | 219 |
class idom = comm_ring_1 + no_zero_divisors |
25186 | 220 |
begin |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
221 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
222 |
subclass ring_1_no_zero_divisors by intro_locales |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
223 |
|
25186 | 224 |
end |
25152 | 225 |
|
22390 | 226 |
class division_ring = ring_1 + inverse + |
25062 | 227 |
assumes left_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
228 |
assumes right_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> a * inverse a = 1" |
|
25186 | 229 |
begin |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
230 |
|
25186 | 231 |
subclass ring_1_no_zero_divisors |
232 |
proof unfold_locales |
|
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
233 |
fix a b :: 'a |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
234 |
assume a: "a \<noteq> 0" and b: "b \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
235 |
show "a * b \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
236 |
proof |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
237 |
assume ab: "a * b = 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
238 |
hence "0 = inverse a * (a * b) * inverse b" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
239 |
by simp |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
240 |
also have "\<dots> = (inverse a * a) * (b * inverse b)" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
241 |
by (simp only: mult_assoc) |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
242 |
also have "\<dots> = 1" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
243 |
using a b by simp |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
244 |
finally show False |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
245 |
by simp |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
246 |
qed |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
247 |
qed |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
248 |
|
25186 | 249 |
end |
25152 | 250 |
|
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
251 |
class field = comm_ring_1 + inverse + |
25062 | 252 |
assumes field_inverse: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
253 |
assumes divide_inverse: "a / b = a * inverse b" |
|
25267 | 254 |
begin |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
255 |
|
25267 | 256 |
subclass division_ring |
25186 | 257 |
proof unfold_locales |
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
258 |
fix a :: 'a |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
259 |
assume "a \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
260 |
thus "inverse a * a = 1" by (rule field_inverse) |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
261 |
thus "a * inverse a = 1" by (simp only: mult_commute) |
14738 | 262 |
qed |
25230 | 263 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
264 |
subclass idom by intro_locales |
25230 | 265 |
|
266 |
lemma right_inverse_eq: "b \<noteq> 0 \<Longrightarrow> a / b = 1 \<longleftrightarrow> a = b" |
|
267 |
proof |
|
268 |
assume neq: "b \<noteq> 0" |
|
269 |
{ |
|
270 |
hence "a = (a / b) * b" by (simp add: divide_inverse mult_ac) |
|
271 |
also assume "a / b = 1" |
|
272 |
finally show "a = b" by simp |
|
273 |
next |
|
274 |
assume "a = b" |
|
275 |
with neq show "a / b = 1" by (simp add: divide_inverse) |
|
276 |
} |
|
277 |
qed |
|
278 |
||
279 |
lemma nonzero_inverse_eq_divide: "a \<noteq> 0 \<Longrightarrow> inverse a = 1 / a" |
|
280 |
by (simp add: divide_inverse) |
|
281 |
||
282 |
lemma divide_self [simp]: "a \<noteq> 0 \<Longrightarrow> a / a = 1" |
|
283 |
by (simp add: divide_inverse) |
|
284 |
||
285 |
lemma divide_zero_left [simp]: "0 / a = 0" |
|
286 |
by (simp add: divide_inverse) |
|
287 |
||
288 |
lemma inverse_eq_divide: "inverse a = 1 / a" |
|
289 |
by (simp add: divide_inverse) |
|
290 |
||
291 |
lemma add_divide_distrib: "(a+b) / c = a/c + b/c" |
|
292 |
by (simp add: divide_inverse ring_distribs) |
|
293 |
||
294 |
end |
|
295 |
||
22390 | 296 |
class division_by_zero = zero + inverse + |
25062 | 297 |
assumes inverse_zero [simp]: "inverse 0 = 0" |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
298 |
|
25230 | 299 |
lemma divide_zero [simp]: |
300 |
"a / 0 = (0::'a::{field,division_by_zero})" |
|
301 |
by (simp add: divide_inverse) |
|
302 |
||
303 |
lemma divide_self_if [simp]: |
|
304 |
"a / (a::'a::{field,division_by_zero}) = (if a=0 then 0 else 1)" |
|
305 |
by (simp add: divide_self) |
|
306 |
||
22390 | 307 |
class mult_mono = times + zero + ord + |
25062 | 308 |
assumes mult_left_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b" |
309 |
assumes mult_right_mono: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a * c \<le> b * c" |
|
14267
b963e9cee2a0
More refinements to Ring_and_Field and numerics. Conversion of Divides_lemmas
paulson
parents:
14266
diff
changeset
|
310 |
|
22390 | 311 |
class pordered_semiring = mult_mono + semiring_0 + pordered_ab_semigroup_add |
25230 | 312 |
begin |
313 |
||
314 |
lemma mult_mono: |
|
315 |
"a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> c |
|
316 |
\<Longrightarrow> a * c \<le> b * d" |
|
317 |
apply (erule mult_right_mono [THEN order_trans], assumption) |
|
318 |
apply (erule mult_left_mono, assumption) |
|
319 |
done |
|
320 |
||
321 |
lemma mult_mono': |
|
322 |
"a \<le> b \<Longrightarrow> c \<le> d \<Longrightarrow> 0 \<le> a \<Longrightarrow> 0 \<le> c |
|
323 |
\<Longrightarrow> a * c \<le> b * d" |
|
324 |
apply (rule mult_mono) |
|
325 |
apply (fast intro: order_trans)+ |
|
326 |
done |
|
327 |
||
328 |
end |
|
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
329 |
|
22390 | 330 |
class pordered_cancel_semiring = mult_mono + pordered_ab_semigroup_add |
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
331 |
+ semiring + comm_monoid_add + cancel_ab_semigroup_add |
25267 | 332 |
begin |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
333 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
334 |
subclass semiring_0_cancel by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
335 |
subclass pordered_semiring by intro_locales |
23521 | 336 |
|
25230 | 337 |
lemma mult_nonneg_nonneg: "0 \<le> a \<Longrightarrow> 0 \<le> b \<Longrightarrow> 0 \<le> a * b" |
338 |
by (drule mult_left_mono [of zero b], auto) |
|
339 |
||
340 |
lemma mult_nonneg_nonpos: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> a * b \<le> 0" |
|
341 |
by (drule mult_left_mono [of b zero], auto) |
|
342 |
||
343 |
lemma mult_nonneg_nonpos2: "0 \<le> a \<Longrightarrow> b \<le> 0 \<Longrightarrow> b * a \<le> 0" |
|
344 |
by (drule mult_right_mono [of b zero], auto) |
|
345 |
||
346 |
lemma split_mult_neg_le: "(0 \<le> a & b \<le> 0) | (a \<le> 0 & 0 \<le> b) \<Longrightarrow> a * b \<le> (0::_::pordered_cancel_semiring)" |
|
347 |
by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2) |
|
348 |
||
349 |
end |
|
350 |
||
351 |
class ordered_semiring = semiring + comm_monoid_add + ordered_cancel_ab_semigroup_add + mult_mono |
|
25267 | 352 |
begin |
25230 | 353 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
354 |
subclass pordered_cancel_semiring by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
355 |
|
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
356 |
subclass pordered_comm_monoid_add by intro_locales |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
357 |
|
25230 | 358 |
lemma mult_left_less_imp_less: |
359 |
"c * a < c * b \<Longrightarrow> 0 \<le> c \<Longrightarrow> a < b" |
|
360 |
by (force simp add: mult_left_mono not_le [symmetric]) |
|
361 |
||
362 |
lemma mult_right_less_imp_less: |
|
363 |
"a * c < b * c \<Longrightarrow> 0 \<le> c \<Longrightarrow> a < b" |
|
364 |
by (force simp add: mult_right_mono not_le [symmetric]) |
|
23521 | 365 |
|
25186 | 366 |
end |
25152 | 367 |
|
22390 | 368 |
class ordered_semiring_strict = semiring + comm_monoid_add + ordered_cancel_ab_semigroup_add + |
25062 | 369 |
assumes mult_strict_left_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b" |
370 |
assumes mult_strict_right_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> a * c < b * c" |
|
25267 | 371 |
begin |
14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset
|
372 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
373 |
subclass semiring_0_cancel by intro_locales |
14940 | 374 |
|
25267 | 375 |
subclass ordered_semiring |
25186 | 376 |
proof unfold_locales |
23550 | 377 |
fix a b c :: 'a |
378 |
assume A: "a \<le> b" "0 \<le> c" |
|
379 |
from A show "c * a \<le> c * b" |
|
25186 | 380 |
unfolding le_less |
381 |
using mult_strict_left_mono by (cases "c = 0") auto |
|
23550 | 382 |
from A show "a * c \<le> b * c" |
25152 | 383 |
unfolding le_less |
25186 | 384 |
using mult_strict_right_mono by (cases "c = 0") auto |
25152 | 385 |
qed |
386 |
||
25230 | 387 |
lemma mult_left_le_imp_le: |
388 |
"c * a \<le> c * b \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b" |
|
389 |
by (force simp add: mult_strict_left_mono _not_less [symmetric]) |
|
390 |
||
391 |
lemma mult_right_le_imp_le: |
|
392 |
"a * c \<le> b * c \<Longrightarrow> 0 < c \<Longrightarrow> a \<le> b" |
|
393 |
by (force simp add: mult_strict_right_mono not_less [symmetric]) |
|
394 |
||
395 |
lemma mult_pos_pos: |
|
396 |
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> 0 < a * b" |
|
397 |
by (drule mult_strict_left_mono [of zero b], auto) |
|
398 |
||
399 |
lemma mult_pos_neg: |
|
400 |
"0 < a \<Longrightarrow> b < 0 \<Longrightarrow> a * b < 0" |
|
401 |
by (drule mult_strict_left_mono [of b zero], auto) |
|
402 |
||
403 |
lemma mult_pos_neg2: |
|
404 |
"0 < a \<Longrightarrow> b < 0 \<Longrightarrow> b * a < 0" |
|
405 |
by (drule mult_strict_right_mono [of b zero], auto) |
|
406 |
||
407 |
lemma zero_less_mult_pos: |
|
408 |
"0 < a * b \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
|
409 |
apply (cases "b\<le>0") |
|
410 |
apply (auto simp add: le_less not_less) |
|
411 |
apply (drule_tac mult_pos_neg [of a b]) |
|
412 |
apply (auto dest: less_not_sym) |
|
413 |
done |
|
414 |
||
415 |
lemma zero_less_mult_pos2: |
|
416 |
"0 < b * a \<Longrightarrow> 0 < a \<Longrightarrow> 0 < b" |
|
417 |
apply (cases "b\<le>0") |
|
418 |
apply (auto simp add: le_less not_less) |
|
419 |
apply (drule_tac mult_pos_neg2 [of a b]) |
|
420 |
apply (auto dest: less_not_sym) |
|
421 |
done |
|
422 |
||
423 |
end |
|
424 |
||
22390 | 425 |
class mult_mono1 = times + zero + ord + |
25230 | 426 |
assumes mult_mono1: "a \<le> b \<Longrightarrow> 0 \<le> c \<Longrightarrow> c * a \<le> c * b" |
14270 | 427 |
|
22390 | 428 |
class pordered_comm_semiring = comm_semiring_0 |
429 |
+ pordered_ab_semigroup_add + mult_mono1 |
|
25186 | 430 |
begin |
25152 | 431 |
|
25267 | 432 |
subclass pordered_semiring |
25186 | 433 |
proof unfold_locales |
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
434 |
fix a b c :: 'a |
23550 | 435 |
assume "a \<le> b" "0 \<le> c" |
25230 | 436 |
thus "c * a \<le> c * b" by (rule mult_mono1) |
23550 | 437 |
thus "a * c \<le> b * c" by (simp only: mult_commute) |
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset
|
438 |
qed |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
439 |
|
25267 | 440 |
end |
441 |
||
442 |
class pordered_cancel_comm_semiring = comm_semiring_0_cancel |
|
443 |
+ pordered_ab_semigroup_add + mult_mono1 |
|
444 |
begin |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
445 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
446 |
subclass pordered_comm_semiring by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
447 |
subclass pordered_cancel_semiring by intro_locales |
25267 | 448 |
|
449 |
end |
|
450 |
||
451 |
class ordered_comm_semiring_strict = comm_semiring_0 + ordered_cancel_ab_semigroup_add + |
|
452 |
assumes mult_strict_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b" |
|
453 |
begin |
|
454 |
||
455 |
subclass ordered_semiring_strict |
|
25186 | 456 |
proof unfold_locales |
23550 | 457 |
fix a b c :: 'a |
458 |
assume "a < b" "0 < c" |
|
459 |
thus "c * a < c * b" by (rule mult_strict_mono) |
|
460 |
thus "a * c < b * c" by (simp only: mult_commute) |
|
461 |
qed |
|
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset
|
462 |
|
25267 | 463 |
subclass pordered_cancel_comm_semiring |
25186 | 464 |
proof unfold_locales |
23550 | 465 |
fix a b c :: 'a |
466 |
assume "a \<le> b" "0 \<le> c" |
|
467 |
thus "c * a \<le> c * b" |
|
25186 | 468 |
unfolding le_less |
469 |
using mult_strict_mono by (cases "c = 0") auto |
|
23550 | 470 |
qed |
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset
|
471 |
|
25267 | 472 |
end |
25230 | 473 |
|
25267 | 474 |
class pordered_ring = ring + pordered_cancel_semiring |
475 |
begin |
|
25230 | 476 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
477 |
subclass pordered_ab_group_add by intro_locales |
14270 | 478 |
|
25230 | 479 |
lemmas ring_simps = ring_simps group_simps |
480 |
||
481 |
lemma less_add_iff1: |
|
482 |
"a * e + c < b * e + d \<longleftrightarrow> (a - b) * e + c < d" |
|
483 |
by (simp add: ring_simps) |
|
484 |
||
485 |
lemma less_add_iff2: |
|
486 |
"a * e + c < b * e + d \<longleftrightarrow> c < (b - a) * e + d" |
|
487 |
by (simp add: ring_simps) |
|
488 |
||
489 |
lemma le_add_iff1: |
|
490 |
"a * e + c \<le> b * e + d \<longleftrightarrow> (a - b) * e + c \<le> d" |
|
491 |
by (simp add: ring_simps) |
|
492 |
||
493 |
lemma le_add_iff2: |
|
494 |
"a * e + c \<le> b * e + d \<longleftrightarrow> c \<le> (b - a) * e + d" |
|
495 |
by (simp add: ring_simps) |
|
496 |
||
497 |
lemma mult_left_mono_neg: |
|
498 |
"b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> c * a \<le> c * b" |
|
499 |
apply (drule mult_left_mono [of _ _ "uminus c"]) |
|
500 |
apply (simp_all add: minus_mult_left [symmetric]) |
|
501 |
done |
|
502 |
||
503 |
lemma mult_right_mono_neg: |
|
504 |
"b \<le> a \<Longrightarrow> c \<le> 0 \<Longrightarrow> a * c \<le> b * c" |
|
505 |
apply (drule mult_right_mono [of _ _ "uminus c"]) |
|
506 |
apply (simp_all add: minus_mult_right [symmetric]) |
|
507 |
done |
|
508 |
||
509 |
lemma mult_nonpos_nonpos: |
|
510 |
"a \<le> 0 \<Longrightarrow> b \<le> 0 \<Longrightarrow> 0 \<le> a * b" |
|
511 |
by (drule mult_right_mono_neg [of a zero b]) auto |
|
512 |
||
513 |
lemma split_mult_pos_le: |
|
514 |
"(0 \<le> a \<and> 0 \<le> b) \<or> (a \<le> 0 \<and> b \<le> 0) \<Longrightarrow> 0 \<le> a * b" |
|
515 |
by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos) |
|
25186 | 516 |
|
517 |
end |
|
14270 | 518 |
|
23879 | 519 |
class abs_if = minus + ord + zero + abs + |
25186 | 520 |
assumes abs_if: "\<bar>a\<bar> = (if a < 0 then (- a) else a)" |
14270 | 521 |
|
24506 | 522 |
class sgn_if = sgn + zero + one + minus + ord + |
25186 | 523 |
assumes sgn_if: "sgn x = (if x = 0 then 0 else if 0 < x then 1 else - 1)" |
24506 | 524 |
|
25230 | 525 |
class ordered_ring = ring + ordered_semiring |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
526 |
+ ordered_ab_group_add + abs_if |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
527 |
begin |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
528 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
529 |
subclass pordered_ring by intro_locales |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
530 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
531 |
subclass pordered_ab_group_add_abs |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
532 |
proof unfold_locales |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
533 |
fix a b |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
534 |
show "\<bar>a + b\<bar> \<le> \<bar>a\<bar> + \<bar>b\<bar>" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
535 |
by (auto simp add: abs_if not_less neg_less_eq_nonneg less_eq_neg_nonpos) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
536 |
(auto simp del: minus_add_distrib simp add: minus_add_distrib [symmetric] |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
537 |
neg_less_eq_nonneg less_eq_neg_nonpos, auto intro: add_nonneg_nonneg, |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
538 |
auto intro!: less_imp_le add_neg_neg) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
539 |
qed (auto simp add: abs_if less_eq_neg_nonpos neg_equal_zero) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
540 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
541 |
end |
23521 | 542 |
|
25230 | 543 |
(* The "strict" suffix can be seen as describing the combination of ordered_ring and no_zero_divisors. |
544 |
Basically, ordered_ring + no_zero_divisors = ordered_ring_strict. |
|
545 |
*) |
|
546 |
class ordered_ring_strict = ring + ordered_semiring_strict |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
547 |
+ ordered_ab_group_add + abs_if |
25230 | 548 |
begin |
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset
|
549 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
550 |
subclass ordered_ring by intro_locales |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
551 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
552 |
lemma mult_strict_left_mono_neg: |
25230 | 553 |
"b < a \<Longrightarrow> c < 0 \<Longrightarrow> c * a < c * b" |
554 |
apply (drule mult_strict_left_mono [of _ _ "uminus c"]) |
|
555 |
apply (simp_all add: minus_mult_left [symmetric]) |
|
556 |
done |
|
14738 | 557 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
558 |
lemma mult_strict_right_mono_neg: |
25230 | 559 |
"b < a \<Longrightarrow> c < 0 \<Longrightarrow> a * c < b * c" |
560 |
apply (drule mult_strict_right_mono [of _ _ "uminus c"]) |
|
561 |
apply (simp_all add: minus_mult_right [symmetric]) |
|
562 |
done |
|
14738 | 563 |
|
25230 | 564 |
lemma mult_neg_neg: |
565 |
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> 0 < a * b" |
|
566 |
by (drule mult_strict_right_mono_neg, auto) |
|
14738 | 567 |
|
25230 | 568 |
end |
14738 | 569 |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
570 |
instance ordered_ring_strict \<subseteq> ring_no_zero_divisors |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
571 |
apply intro_classes |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
572 |
apply (auto simp add: linorder_not_less order_le_less linorder_neq_iff) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
573 |
apply (force dest: mult_strict_right_mono_neg mult_strict_right_mono)+ |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
574 |
done |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
575 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
576 |
lemma zero_less_mult_iff: |
25230 | 577 |
fixes a :: "'a::ordered_ring_strict" |
578 |
shows "0 < a * b \<longleftrightarrow> 0 < a \<and> 0 < b \<or> a < 0 \<and> b < 0" |
|
579 |
apply (auto simp add: le_less not_less mult_pos_pos mult_neg_neg) |
|
580 |
apply (blast dest: zero_less_mult_pos) |
|
581 |
apply (blast dest: zero_less_mult_pos2) |
|
582 |
done |
|
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
583 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
584 |
lemma zero_le_mult_iff: |
14738 | 585 |
"((0::'a::ordered_ring_strict) \<le> a*b) = (0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)" |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
586 |
by (auto simp add: eq_commute [of 0] order_le_less linorder_not_less |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
587 |
zero_less_mult_iff) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
588 |
|
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
589 |
lemma mult_less_0_iff: |
14738 | 590 |
"(a*b < (0::'a::ordered_ring_strict)) = (0 < a & b < 0 | a < 0 & 0 < b)" |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
591 |
apply (insert zero_less_mult_iff [of "-a" b]) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
592 |
apply (force simp add: minus_mult_left[symmetric]) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
593 |
done |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
594 |
|
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
595 |
lemma mult_le_0_iff: |
14738 | 596 |
"(a*b \<le> (0::'a::ordered_ring_strict)) = (0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)" |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
597 |
apply (insert zero_le_mult_iff [of "-a" b]) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
598 |
apply (force simp add: minus_mult_left[symmetric]) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
599 |
done |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
600 |
|
23095 | 601 |
lemma zero_le_square[simp]: "(0::'a::ordered_ring_strict) \<le> a*a" |
602 |
by (simp add: zero_le_mult_iff linorder_linear) |
|
603 |
||
604 |
lemma not_square_less_zero[simp]: "\<not> (a * a < (0::'a::ordered_ring_strict))" |
|
605 |
by (simp add: not_less) |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
606 |
|
25230 | 607 |
text{*This list of rewrites simplifies ring terms by multiplying |
608 |
everything out and bringing sums and products into a canonical form |
|
609 |
(by ordered rewriting). As a result it decides ring equalities but |
|
610 |
also helps with inequalities. *} |
|
611 |
lemmas ring_simps = group_simps ring_distribs |
|
612 |
||
613 |
||
614 |
class pordered_comm_ring = comm_ring + pordered_comm_semiring |
|
25267 | 615 |
begin |
25230 | 616 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
617 |
subclass pordered_ring by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
618 |
subclass pordered_cancel_comm_semiring by intro_locales |
25230 | 619 |
|
25267 | 620 |
end |
25230 | 621 |
|
622 |
class ordered_semidom = comm_semiring_1_cancel + ordered_comm_semiring_strict + |
|
623 |
(*previously ordered_semiring*) |
|
624 |
assumes zero_less_one [simp]: "0 < 1" |
|
625 |
begin |
|
626 |
||
627 |
lemma pos_add_strict: |
|
628 |
shows "0 < a \<Longrightarrow> b < c \<Longrightarrow> b < a + c" |
|
629 |
using add_strict_mono [of zero a b c] by simp |
|
630 |
||
631 |
end |
|
632 |
||
633 |
class ordered_idom = |
|
634 |
comm_ring_1 + |
|
635 |
ordered_comm_semiring_strict + |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
636 |
ordered_ab_group_add + |
25230 | 637 |
abs_if + sgn_if |
638 |
(*previously ordered_ring*) |
|
639 |
||
640 |
instance ordered_idom \<subseteq> ordered_ring_strict .. |
|
641 |
||
642 |
instance ordered_idom \<subseteq> pordered_comm_ring .. |
|
643 |
||
644 |
class ordered_field = field + ordered_idom |
|
645 |
||
646 |
lemma linorder_neqE_ordered_idom: |
|
647 |
fixes x y :: "'a :: ordered_idom" |
|
648 |
assumes "x \<noteq> y" obtains "x < y" | "y < x" |
|
649 |
using assms by (rule linorder_neqE) |
|
650 |
||
651 |
||
14738 | 652 |
text{*Proving axiom @{text zero_less_one} makes all @{text ordered_semidom} |
653 |
theorems available to members of @{term ordered_idom} *} |
|
654 |
||
655 |
instance ordered_idom \<subseteq> ordered_semidom |
|
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
656 |
proof |
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
657 |
have "(0::'a) \<le> 1*1" by (rule zero_le_square) |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
658 |
thus "(0::'a) < 1" by (simp add: order_le_less) |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
659 |
qed |
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
660 |
|
14738 | 661 |
instance ordered_idom \<subseteq> idom .. |
662 |
||
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
663 |
text{*All three types of comparision involving 0 and 1 are covered.*} |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
664 |
|
17085 | 665 |
lemmas one_neq_zero = zero_neq_one [THEN not_sym] |
666 |
declare one_neq_zero [simp] |
|
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
667 |
|
14738 | 668 |
lemma zero_le_one [simp]: "(0::'a::ordered_semidom) \<le> 1" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
669 |
by (rule zero_less_one [THEN order_less_imp_le]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
670 |
|
14738 | 671 |
lemma not_one_le_zero [simp]: "~ (1::'a::ordered_semidom) \<le> 0" |
672 |
by (simp add: linorder_not_le) |
|
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
673 |
|
14738 | 674 |
lemma not_one_less_zero [simp]: "~ (1::'a::ordered_semidom) < 0" |
675 |
by (simp add: linorder_not_less) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
676 |
|
23389 | 677 |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
678 |
subsection{*More Monotonicity*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
679 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
680 |
text{*Strict monotonicity in both arguments*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
681 |
lemma mult_strict_mono: |
14738 | 682 |
"[|a<b; c<d; 0<b; 0\<le>c|] ==> a * c < b * (d::'a::ordered_semiring_strict)" |
21328 | 683 |
apply (cases "c=0") |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
684 |
apply (simp add: mult_pos_pos) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
685 |
apply (erule mult_strict_right_mono [THEN order_less_trans]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
686 |
apply (force simp add: order_le_less) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
687 |
apply (erule mult_strict_left_mono, assumption) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
688 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
689 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
690 |
text{*This weaker variant has more natural premises*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
691 |
lemma mult_strict_mono': |
14738 | 692 |
"[| a<b; c<d; 0 \<le> a; 0 \<le> c|] ==> a * c < b * (d::'a::ordered_semiring_strict)" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
693 |
apply (rule mult_strict_mono) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
694 |
apply (blast intro: order_le_less_trans)+ |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
695 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
696 |
|
14738 | 697 |
lemma less_1_mult: "[| 1 < m; 1 < n |] ==> 1 < m*(n::'a::ordered_semidom)" |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
698 |
apply (insert mult_strict_mono [of 1 m 1 n]) |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
699 |
apply (simp add: order_less_trans [OF zero_less_one]) |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
700 |
done |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
701 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
702 |
lemma mult_less_le_imp_less: "(a::'a::ordered_semiring_strict) < b ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
703 |
c <= d ==> 0 <= a ==> 0 < c ==> a * c < b * d" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
704 |
apply (subgoal_tac "a * c < b * c") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
705 |
apply (erule order_less_le_trans) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
706 |
apply (erule mult_left_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
707 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
708 |
apply (erule mult_strict_right_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
709 |
apply assumption |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
710 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
711 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
712 |
lemma mult_le_less_imp_less: "(a::'a::ordered_semiring_strict) <= b ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
713 |
c < d ==> 0 < a ==> 0 <= c ==> a * c < b * d" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
714 |
apply (subgoal_tac "a * c <= b * c") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
715 |
apply (erule order_le_less_trans) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
716 |
apply (erule mult_strict_left_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
717 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
718 |
apply (erule mult_right_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
719 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
720 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
721 |
|
23389 | 722 |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
723 |
subsection{*Cancellation Laws for Relationships With a Common Factor*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
724 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
725 |
text{*Cancellation laws for @{term "c*a < c*b"} and @{term "a*c < b*c"}, |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
726 |
also with the relations @{text "\<le>"} and equality.*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
727 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
728 |
text{*These ``disjunction'' versions produce two cases when the comparison is |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
729 |
an assumption, but effectively four when the comparison is a goal.*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
730 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
731 |
lemma mult_less_cancel_right_disj: |
14738 | 732 |
"(a*c < b*c) = ((0 < c & a < b) | (c < 0 & b < (a::'a::ordered_ring_strict)))" |
21328 | 733 |
apply (cases "c = 0") |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
734 |
apply (auto simp add: linorder_neq_iff mult_strict_right_mono |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
735 |
mult_strict_right_mono_neg) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
736 |
apply (auto simp add: linorder_not_less |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
737 |
linorder_not_le [symmetric, of "a*c"] |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
738 |
linorder_not_le [symmetric, of a]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
739 |
apply (erule_tac [!] notE) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
740 |
apply (auto simp add: order_less_imp_le mult_right_mono |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
741 |
mult_right_mono_neg) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
742 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
743 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
744 |
lemma mult_less_cancel_left_disj: |
14738 | 745 |
"(c*a < c*b) = ((0 < c & a < b) | (c < 0 & b < (a::'a::ordered_ring_strict)))" |
21328 | 746 |
apply (cases "c = 0") |
14738 | 747 |
apply (auto simp add: linorder_neq_iff mult_strict_left_mono |
748 |
mult_strict_left_mono_neg) |
|
749 |
apply (auto simp add: linorder_not_less |
|
750 |
linorder_not_le [symmetric, of "c*a"] |
|
751 |
linorder_not_le [symmetric, of a]) |
|
752 |
apply (erule_tac [!] notE) |
|
753 |
apply (auto simp add: order_less_imp_le mult_left_mono |
|
754 |
mult_left_mono_neg) |
|
755 |
done |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
756 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
757 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
758 |
text{*The ``conjunction of implication'' lemmas produce two cases when the |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
759 |
comparison is a goal, but give four when the comparison is an assumption.*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
760 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
761 |
lemma mult_less_cancel_right: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
762 |
fixes c :: "'a :: ordered_ring_strict" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
763 |
shows "(a*c < b*c) = ((0 \<le> c --> a < b) & (c \<le> 0 --> b < a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
764 |
by (insert mult_less_cancel_right_disj [of a c b], auto) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
765 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
766 |
lemma mult_less_cancel_left: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
767 |
fixes c :: "'a :: ordered_ring_strict" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
768 |
shows "(c*a < c*b) = ((0 \<le> c --> a < b) & (c \<le> 0 --> b < a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
769 |
by (insert mult_less_cancel_left_disj [of c a b], auto) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
770 |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
771 |
lemma mult_le_cancel_right: |
14738 | 772 |
"(a*c \<le> b*c) = ((0<c --> a\<le>b) & (c<0 --> b \<le> (a::'a::ordered_ring_strict)))" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
773 |
by (simp add: linorder_not_less [symmetric] mult_less_cancel_right_disj) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
774 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
775 |
lemma mult_le_cancel_left: |
14738 | 776 |
"(c*a \<le> c*b) = ((0<c --> a\<le>b) & (c<0 --> b \<le> (a::'a::ordered_ring_strict)))" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
777 |
by (simp add: linorder_not_less [symmetric] mult_less_cancel_left_disj) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
778 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
779 |
lemma mult_less_imp_less_left: |
14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset
|
780 |
assumes less: "c*a < c*b" and nonneg: "0 \<le> c" |
14738 | 781 |
shows "a < (b::'a::ordered_semiring_strict)" |
14377 | 782 |
proof (rule ccontr) |
783 |
assume "~ a < b" |
|
784 |
hence "b \<le> a" by (simp add: linorder_not_less) |
|
23389 | 785 |
hence "c*b \<le> c*a" using nonneg by (rule mult_left_mono) |
14377 | 786 |
with this and less show False |
787 |
by (simp add: linorder_not_less [symmetric]) |
|
788 |
qed |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
789 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
790 |
lemma mult_less_imp_less_right: |
14738 | 791 |
assumes less: "a*c < b*c" and nonneg: "0 <= c" |
792 |
shows "a < (b::'a::ordered_semiring_strict)" |
|
793 |
proof (rule ccontr) |
|
794 |
assume "~ a < b" |
|
795 |
hence "b \<le> a" by (simp add: linorder_not_less) |
|
23389 | 796 |
hence "b*c \<le> a*c" using nonneg by (rule mult_right_mono) |
14738 | 797 |
with this and less show False |
798 |
by (simp add: linorder_not_less [symmetric]) |
|
799 |
qed |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
800 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
801 |
text{*Cancellation of equalities with a common factor*} |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
802 |
lemma mult_cancel_right [simp,noatp]: |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
803 |
fixes a b c :: "'a::ring_no_zero_divisors" |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
804 |
shows "(a * c = b * c) = (c = 0 \<or> a = b)" |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
805 |
proof - |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
806 |
have "(a * c = b * c) = ((a - b) * c = 0)" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
807 |
by (simp add: ring_distribs) |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
808 |
thus ?thesis |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
809 |
by (simp add: disj_commute) |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
810 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
811 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
812 |
lemma mult_cancel_left [simp,noatp]: |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
813 |
fixes a b c :: "'a::ring_no_zero_divisors" |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
814 |
shows "(c * a = c * b) = (c = 0 \<or> a = b)" |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
815 |
proof - |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
816 |
have "(c * a = c * b) = (c * (a - b) = 0)" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
817 |
by (simp add: ring_distribs) |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
818 |
thus ?thesis |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
819 |
by simp |
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
820 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
821 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
822 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
823 |
subsubsection{*Special Cancellation Simprules for Multiplication*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
824 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
825 |
text{*These also produce two cases when the comparison is a goal.*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
826 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
827 |
lemma mult_le_cancel_right1: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
828 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
829 |
shows "(c \<le> b*c) = ((0<c --> 1\<le>b) & (c<0 --> b \<le> 1))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
830 |
by (insert mult_le_cancel_right [of 1 c b], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
831 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
832 |
lemma mult_le_cancel_right2: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
833 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
834 |
shows "(a*c \<le> c) = ((0<c --> a\<le>1) & (c<0 --> 1 \<le> a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
835 |
by (insert mult_le_cancel_right [of a c 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
836 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
837 |
lemma mult_le_cancel_left1: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
838 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
839 |
shows "(c \<le> c*b) = ((0<c --> 1\<le>b) & (c<0 --> b \<le> 1))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
840 |
by (insert mult_le_cancel_left [of c 1 b], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
841 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
842 |
lemma mult_le_cancel_left2: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
843 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
844 |
shows "(c*a \<le> c) = ((0<c --> a\<le>1) & (c<0 --> 1 \<le> a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
845 |
by (insert mult_le_cancel_left [of c a 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
846 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
847 |
lemma mult_less_cancel_right1: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
848 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
849 |
shows "(c < b*c) = ((0 \<le> c --> 1<b) & (c \<le> 0 --> b < 1))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
850 |
by (insert mult_less_cancel_right [of 1 c b], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
851 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
852 |
lemma mult_less_cancel_right2: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
853 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
854 |
shows "(a*c < c) = ((0 \<le> c --> a<1) & (c \<le> 0 --> 1 < a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
855 |
by (insert mult_less_cancel_right [of a c 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
856 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
857 |
lemma mult_less_cancel_left1: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
858 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
859 |
shows "(c < c*b) = ((0 \<le> c --> 1<b) & (c \<le> 0 --> b < 1))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
860 |
by (insert mult_less_cancel_left [of c 1 b], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
861 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
862 |
lemma mult_less_cancel_left2: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
863 |
fixes c :: "'a :: ordered_idom" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
864 |
shows "(c*a < c) = ((0 \<le> c --> a<1) & (c \<le> 0 --> 1 < a))" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
865 |
by (insert mult_less_cancel_left [of c a 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
866 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
867 |
lemma mult_cancel_right1 [simp]: |
23544 | 868 |
fixes c :: "'a :: ring_1_no_zero_divisors" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
869 |
shows "(c = b*c) = (c = 0 | b=1)" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
870 |
by (insert mult_cancel_right [of 1 c b], force) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
871 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
872 |
lemma mult_cancel_right2 [simp]: |
23544 | 873 |
fixes c :: "'a :: ring_1_no_zero_divisors" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
874 |
shows "(a*c = c) = (c = 0 | a=1)" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
875 |
by (insert mult_cancel_right [of a c 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
876 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
877 |
lemma mult_cancel_left1 [simp]: |
23544 | 878 |
fixes c :: "'a :: ring_1_no_zero_divisors" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
879 |
shows "(c = c*b) = (c = 0 | b=1)" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
880 |
by (insert mult_cancel_left [of c 1 b], force) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
881 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
882 |
lemma mult_cancel_left2 [simp]: |
23544 | 883 |
fixes c :: "'a :: ring_1_no_zero_divisors" |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
884 |
shows "(c*a = c) = (c = 0 | a=1)" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
885 |
by (insert mult_cancel_left [of c a 1], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
886 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
887 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
888 |
text{*Simprules for comparisons where common factors can be cancelled.*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
889 |
lemmas mult_compare_simps = |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
890 |
mult_le_cancel_right mult_le_cancel_left |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
891 |
mult_le_cancel_right1 mult_le_cancel_right2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
892 |
mult_le_cancel_left1 mult_le_cancel_left2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
893 |
mult_less_cancel_right mult_less_cancel_left |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
894 |
mult_less_cancel_right1 mult_less_cancel_right2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
895 |
mult_less_cancel_left1 mult_less_cancel_left2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
896 |
mult_cancel_right mult_cancel_left |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
897 |
mult_cancel_right1 mult_cancel_right2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
898 |
mult_cancel_left1 mult_cancel_left2 |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
899 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
900 |
|
23482 | 901 |
(* what ordering?? this is a straight instance of mult_eq_0_iff |
14270 | 902 |
text{*Compared with @{text mult_eq_0_iff}, this version removes the requirement |
903 |
of an ordering.*} |
|
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
904 |
lemma field_mult_eq_0_iff [simp]: |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
905 |
"(a*b = (0::'a::division_ring)) = (a = 0 | b = 0)" |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
906 |
by simp |
23482 | 907 |
*) |
23496 | 908 |
(* subsumed by mult_cancel lemmas on ring_no_zero_divisors |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
909 |
text{*Cancellation of equalities with a common factor*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
910 |
lemma field_mult_cancel_right_lemma: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
911 |
assumes cnz: "c \<noteq> (0::'a::division_ring)" |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
912 |
and eq: "a*c = b*c" |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
913 |
shows "a=b" |
14377 | 914 |
proof - |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
915 |
have "(a * c) * inverse c = (b * c) * inverse c" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
916 |
by (simp add: eq) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
917 |
thus "a=b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
918 |
by (simp add: mult_assoc cnz) |
14377 | 919 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
920 |
|
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset
|
921 |
lemma field_mult_cancel_right [simp]: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
922 |
"(a*c = b*c) = (c = (0::'a::division_ring) | a=b)" |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
923 |
by simp |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
924 |
|
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset
|
925 |
lemma field_mult_cancel_left [simp]: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
926 |
"(c*a = c*b) = (c = (0::'a::division_ring) | a=b)" |
22990
775e9de3db48
added classes ring_no_zero_divisors and dom (non-commutative version of idom);
huffman
parents:
22987
diff
changeset
|
927 |
by simp |
23496 | 928 |
*) |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
929 |
lemma nonzero_imp_inverse_nonzero: |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
930 |
"a \<noteq> 0 ==> inverse a \<noteq> (0::'a::division_ring)" |
14377 | 931 |
proof |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
932 |
assume ianz: "inverse a = 0" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
933 |
assume "a \<noteq> 0" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
934 |
hence "1 = a * inverse a" by simp |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
935 |
also have "... = 0" by (simp add: ianz) |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
936 |
finally have "1 = (0::'a::division_ring)" . |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
937 |
thus False by (simp add: eq_commute) |
14377 | 938 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
939 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
940 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
941 |
subsection{*Basic Properties of @{term inverse}*} |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
942 |
|
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
943 |
lemma inverse_zero_imp_zero: "inverse a = 0 ==> a = (0::'a::division_ring)" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
944 |
apply (rule ccontr) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
945 |
apply (blast dest: nonzero_imp_inverse_nonzero) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
946 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
947 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
948 |
lemma inverse_nonzero_imp_nonzero: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
949 |
"inverse a = 0 ==> a = (0::'a::division_ring)" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
950 |
apply (rule ccontr) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
951 |
apply (blast dest: nonzero_imp_inverse_nonzero) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
952 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
953 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
954 |
lemma inverse_nonzero_iff_nonzero [simp]: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
955 |
"(inverse a = 0) = (a = (0::'a::{division_ring,division_by_zero}))" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
956 |
by (force dest: inverse_nonzero_imp_nonzero) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
957 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
958 |
lemma nonzero_inverse_minus_eq: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
959 |
assumes [simp]: "a\<noteq>0" |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
960 |
shows "inverse(-a) = -inverse(a::'a::division_ring)" |
14377 | 961 |
proof - |
962 |
have "-a * inverse (- a) = -a * - inverse a" |
|
963 |
by simp |
|
964 |
thus ?thesis |
|
23496 | 965 |
by (simp only: mult_cancel_left, simp) |
14377 | 966 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
967 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
968 |
lemma inverse_minus_eq [simp]: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
969 |
"inverse(-a) = -inverse(a::'a::{division_ring,division_by_zero})" |
14377 | 970 |
proof cases |
971 |
assume "a=0" thus ?thesis by (simp add: inverse_zero) |
|
972 |
next |
|
973 |
assume "a\<noteq>0" |
|
974 |
thus ?thesis by (simp add: nonzero_inverse_minus_eq) |
|
975 |
qed |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
976 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
977 |
lemma nonzero_inverse_eq_imp_eq: |
14269 | 978 |
assumes inveq: "inverse a = inverse b" |
979 |
and anz: "a \<noteq> 0" |
|
980 |
and bnz: "b \<noteq> 0" |
|
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
981 |
shows "a = (b::'a::division_ring)" |
14377 | 982 |
proof - |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
983 |
have "a * inverse b = a * inverse a" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
984 |
by (simp add: inveq) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
985 |
hence "(a * inverse b) * b = (a * inverse a) * b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
986 |
by simp |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
987 |
thus "a = b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
988 |
by (simp add: mult_assoc anz bnz) |
14377 | 989 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
990 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
991 |
lemma inverse_eq_imp_eq: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
992 |
"inverse a = inverse b ==> a = (b::'a::{division_ring,division_by_zero})" |
21328 | 993 |
apply (cases "a=0 | b=0") |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
994 |
apply (force dest!: inverse_zero_imp_zero |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
995 |
simp add: eq_commute [of "0::'a"]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
996 |
apply (force dest!: nonzero_inverse_eq_imp_eq) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
997 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
998 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
999 |
lemma inverse_eq_iff_eq [simp]: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1000 |
"(inverse a = inverse b) = (a = (b::'a::{division_ring,division_by_zero}))" |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1001 |
by (force dest!: inverse_eq_imp_eq) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1002 |
|
14270 | 1003 |
lemma nonzero_inverse_inverse_eq: |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1004 |
assumes [simp]: "a \<noteq> 0" |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1005 |
shows "inverse(inverse (a::'a::division_ring)) = a" |
14270 | 1006 |
proof - |
1007 |
have "(inverse (inverse a) * inverse a) * a = a" |
|
1008 |
by (simp add: nonzero_imp_inverse_nonzero) |
|
1009 |
thus ?thesis |
|
1010 |
by (simp add: mult_assoc) |
|
1011 |
qed |
|
1012 |
||
1013 |
lemma inverse_inverse_eq [simp]: |
|
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1014 |
"inverse(inverse (a::'a::{division_ring,division_by_zero})) = a" |
14270 | 1015 |
proof cases |
1016 |
assume "a=0" thus ?thesis by simp |
|
1017 |
next |
|
1018 |
assume "a\<noteq>0" |
|
1019 |
thus ?thesis by (simp add: nonzero_inverse_inverse_eq) |
|
1020 |
qed |
|
1021 |
||
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1022 |
lemma inverse_1 [simp]: "inverse 1 = (1::'a::division_ring)" |
14270 | 1023 |
proof - |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1024 |
have "inverse 1 * 1 = (1::'a::division_ring)" |
14270 | 1025 |
by (rule left_inverse [OF zero_neq_one [symmetric]]) |
1026 |
thus ?thesis by simp |
|
1027 |
qed |
|
1028 |
||
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1029 |
lemma inverse_unique: |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1030 |
assumes ab: "a*b = 1" |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1031 |
shows "inverse a = (b::'a::division_ring)" |
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1032 |
proof - |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1033 |
have "a \<noteq> 0" using ab by auto |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1034 |
moreover have "inverse a * (a * b) = inverse a" by (simp add: ab) |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1035 |
ultimately show ?thesis by (simp add: mult_assoc [symmetric]) |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1036 |
qed |
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset
|
1037 |
|
14270 | 1038 |
lemma nonzero_inverse_mult_distrib: |
1039 |
assumes anz: "a \<noteq> 0" |
|
1040 |
and bnz: "b \<noteq> 0" |
|
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1041 |
shows "inverse(a*b) = inverse(b) * inverse(a::'a::division_ring)" |
14270 | 1042 |
proof - |
1043 |
have "inverse(a*b) * (a * b) * inverse(b) = inverse(b)" |
|
23482 | 1044 |
by (simp add: anz bnz) |
14270 | 1045 |
hence "inverse(a*b) * a = inverse(b)" |
1046 |
by (simp add: mult_assoc bnz) |
|
1047 |
hence "inverse(a*b) * a * inverse(a) = inverse(b) * inverse(a)" |
|
1048 |
by simp |
|
1049 |
thus ?thesis |
|
1050 |
by (simp add: mult_assoc anz) |
|
1051 |
qed |
|
1052 |
||
1053 |
text{*This version builds in division by zero while also re-orienting |
|
1054 |
the right-hand side.*} |
|
1055 |
lemma inverse_mult_distrib [simp]: |
|
1056 |
"inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_by_zero})" |
|
1057 |
proof cases |
|
1058 |
assume "a \<noteq> 0 & b \<noteq> 0" |
|
22993 | 1059 |
thus ?thesis |
1060 |
by (simp add: nonzero_inverse_mult_distrib mult_commute) |
|
14270 | 1061 |
next |
1062 |
assume "~ (a \<noteq> 0 & b \<noteq> 0)" |
|
22993 | 1063 |
thus ?thesis |
1064 |
by force |
|
14270 | 1065 |
qed |
1066 |
||
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1067 |
lemma division_ring_inverse_add: |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1068 |
"[|(a::'a::division_ring) \<noteq> 0; b \<noteq> 0|] |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1069 |
==> inverse a + inverse b = inverse a * (a+b) * inverse b" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1070 |
by (simp add: ring_simps) |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1071 |
|
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1072 |
lemma division_ring_inverse_diff: |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1073 |
"[|(a::'a::division_ring) \<noteq> 0; b \<noteq> 0|] |
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1074 |
==> inverse a - inverse b = inverse a * (b-a) * inverse b" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1075 |
by (simp add: ring_simps) |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1076 |
|
14270 | 1077 |
text{*There is no slick version using division by zero.*} |
1078 |
lemma inverse_add: |
|
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1079 |
"[|a \<noteq> 0; b \<noteq> 0|] |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1080 |
==> inverse a + inverse b = (a+b) * inverse a * inverse (b::'a::field)" |
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset
|
1081 |
by (simp add: division_ring_inverse_add mult_ac) |
14270 | 1082 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1083 |
lemma inverse_divide [simp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1084 |
"inverse (a/b) = b / (a::'a::{field,division_by_zero})" |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1085 |
by (simp add: divide_inverse mult_commute) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1086 |
|
23389 | 1087 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1088 |
subsection {* Calculations with fractions *} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1089 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1090 |
text{* There is a whole bunch of simp-rules just for class @{text |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1091 |
field} but none for class @{text field} and @{text nonzero_divides} |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1092 |
because the latter are covered by a simproc. *} |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1093 |
|
24427 | 1094 |
lemma nonzero_mult_divide_mult_cancel_left[simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1095 |
assumes [simp]: "b\<noteq>0" and [simp]: "c\<noteq>0" shows "(c*a)/(c*b) = a/(b::'a::field)" |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1096 |
proof - |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1097 |
have "(c*a)/(c*b) = c * a * (inverse b * inverse c)" |
23482 | 1098 |
by (simp add: divide_inverse nonzero_inverse_mult_distrib) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1099 |
also have "... = a * inverse b * (inverse c * c)" |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1100 |
by (simp only: mult_ac) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1101 |
also have "... = a * inverse b" |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1102 |
by simp |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1103 |
finally show ?thesis |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1104 |
by (simp add: divide_inverse) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1105 |
qed |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1106 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1107 |
lemma mult_divide_mult_cancel_left: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1108 |
"c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_by_zero})" |
21328 | 1109 |
apply (cases "b = 0") |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1110 |
apply (simp_all add: nonzero_mult_divide_mult_cancel_left) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1111 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1112 |
|
24427 | 1113 |
lemma nonzero_mult_divide_mult_cancel_right [noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1114 |
"[|b\<noteq>0; c\<noteq>0|] ==> (a*c) / (b*c) = a/(b::'a::field)" |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1115 |
by (simp add: mult_commute [of _ c] nonzero_mult_divide_mult_cancel_left) |
14321 | 1116 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1117 |
lemma mult_divide_mult_cancel_right: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1118 |
"c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_by_zero})" |
21328 | 1119 |
apply (cases "b = 0") |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1120 |
apply (simp_all add: nonzero_mult_divide_mult_cancel_right) |
14321 | 1121 |
done |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1122 |
|
14284
f1abe67c448a
re-organisation of Real/RealArith0.ML; more `Isar scripts
paulson
parents:
14277
diff
changeset
|
1123 |
lemma divide_1 [simp]: "a/1 = (a::'a::field)" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1124 |
by (simp add: divide_inverse) |
14284
f1abe67c448a
re-organisation of Real/RealArith0.ML; more `Isar scripts
paulson
parents:
14277
diff
changeset
|
1125 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1126 |
lemma times_divide_eq_right: "a * (b/c) = (a*b) / (c::'a::field)" |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1127 |
by (simp add: divide_inverse mult_assoc) |
14288 | 1128 |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1129 |
lemma times_divide_eq_left: "(b/c) * a = (b*a) / (c::'a::field)" |
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1130 |
by (simp add: divide_inverse mult_ac) |
14288 | 1131 |
|
23482 | 1132 |
lemmas times_divide_eq = times_divide_eq_right times_divide_eq_left |
1133 |
||
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1134 |
lemma divide_divide_eq_right [simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1135 |
"a / (b/c) = (a*c) / (b::'a::{field,division_by_zero})" |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1136 |
by (simp add: divide_inverse mult_ac) |
14288 | 1137 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1138 |
lemma divide_divide_eq_left [simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1139 |
"(a / b) / (c::'a::{field,division_by_zero}) = a / (b*c)" |
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1140 |
by (simp add: divide_inverse mult_assoc) |
14288 | 1141 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1142 |
lemma add_frac_eq: "(y::'a::field) ~= 0 ==> z ~= 0 ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1143 |
x / y + w / z = (x * z + w * y) / (y * z)" |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1144 |
apply (subgoal_tac "x / y = (x * z) / (y * z)") |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1145 |
apply (erule ssubst) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1146 |
apply (subgoal_tac "w / z = (w * y) / (y * z)") |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1147 |
apply (erule ssubst) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1148 |
apply (rule add_divide_distrib [THEN sym]) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1149 |
apply (subst mult_commute) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1150 |
apply (erule nonzero_mult_divide_mult_cancel_left [THEN sym]) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1151 |
apply assumption |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1152 |
apply (erule nonzero_mult_divide_mult_cancel_right [THEN sym]) |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1153 |
apply assumption |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1154 |
done |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1155 |
|
23389 | 1156 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1157 |
subsubsection{*Special Cancellation Simprules for Division*} |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1158 |
|
24427 | 1159 |
lemma mult_divide_mult_cancel_left_if[simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1160 |
fixes c :: "'a :: {field,division_by_zero}" |
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1161 |
shows "(c*a) / (c*b) = (if c=0 then 0 else a/b)" |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1162 |
by (simp add: mult_divide_mult_cancel_left) |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1163 |
|
24427 | 1164 |
lemma nonzero_mult_divide_cancel_right[simp,noatp]: |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1165 |
"b \<noteq> 0 \<Longrightarrow> a * b / b = (a::'a::field)" |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1166 |
using nonzero_mult_divide_mult_cancel_right[of 1 b a] by simp |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1167 |
|
24427 | 1168 |
lemma nonzero_mult_divide_cancel_left[simp,noatp]: |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1169 |
"a \<noteq> 0 \<Longrightarrow> a * b / a = (b::'a::field)" |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1170 |
using nonzero_mult_divide_mult_cancel_left[of 1 a b] by simp |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1171 |
|
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1172 |
|
24427 | 1173 |
lemma nonzero_divide_mult_cancel_right[simp,noatp]: |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1174 |
"\<lbrakk> a\<noteq>0; b\<noteq>0 \<rbrakk> \<Longrightarrow> b / (a * b) = 1/(a::'a::field)" |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1175 |
using nonzero_mult_divide_mult_cancel_right[of a b 1] by simp |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1176 |
|
24427 | 1177 |
lemma nonzero_divide_mult_cancel_left[simp,noatp]: |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1178 |
"\<lbrakk> a\<noteq>0; b\<noteq>0 \<rbrakk> \<Longrightarrow> a / (a * b) = 1/(b::'a::field)" |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1179 |
using nonzero_mult_divide_mult_cancel_left[of b a 1] by simp |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1180 |
|
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1181 |
|
24427 | 1182 |
lemma nonzero_mult_divide_mult_cancel_left2[simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1183 |
"[|b\<noteq>0; c\<noteq>0|] ==> (c*a) / (b*c) = a/(b::'a::field)" |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1184 |
using nonzero_mult_divide_mult_cancel_left[of b c a] by(simp add:mult_ac) |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1185 |
|
24427 | 1186 |
lemma nonzero_mult_divide_mult_cancel_right2[simp,noatp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1187 |
"[|b\<noteq>0; c\<noteq>0|] ==> (a*c) / (c*b) = a/(b::'a::field)" |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1188 |
using nonzero_mult_divide_mult_cancel_right[of b c a] by(simp add:mult_ac) |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
1189 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1190 |
|
14293 | 1191 |
subsection {* Division and Unary Minus *} |
1192 |
||
1193 |
lemma nonzero_minus_divide_left: "b \<noteq> 0 ==> - (a/b) = (-a) / (b::'a::field)" |
|
1194 |
by (simp add: divide_inverse minus_mult_left) |
|
1195 |
||
1196 |
lemma nonzero_minus_divide_right: "b \<noteq> 0 ==> - (a/b) = a / -(b::'a::field)" |
|
1197 |
by (simp add: divide_inverse nonzero_inverse_minus_eq minus_mult_right) |
|
1198 |
||
1199 |
lemma nonzero_minus_divide_divide: "b \<noteq> 0 ==> (-a)/(-b) = a / (b::'a::field)" |
|
1200 |
by (simp add: divide_inverse nonzero_inverse_minus_eq) |
|
1201 |
||
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1202 |
lemma minus_divide_left: "- (a/b) = (-a) / (b::'a::field)" |
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1203 |
by (simp add: divide_inverse minus_mult_left [symmetric]) |
14293 | 1204 |
|
1205 |
lemma minus_divide_right: "- (a/b) = a / -(b::'a::{field,division_by_zero})" |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1206 |
by (simp add: divide_inverse minus_mult_right [symmetric]) |
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1207 |
|
14293 | 1208 |
|
1209 |
text{*The effect is to extract signs from divisions*} |
|
17085 | 1210 |
lemmas divide_minus_left = minus_divide_left [symmetric] |
1211 |
lemmas divide_minus_right = minus_divide_right [symmetric] |
|
1212 |
declare divide_minus_left [simp] divide_minus_right [simp] |
|
14293 | 1213 |
|
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
1214 |
text{*Also, extract signs from products*} |
17085 | 1215 |
lemmas mult_minus_left = minus_mult_left [symmetric] |
1216 |
lemmas mult_minus_right = minus_mult_right [symmetric] |
|
1217 |
declare mult_minus_left [simp] mult_minus_right [simp] |
|
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
1218 |
|
14293 | 1219 |
lemma minus_divide_divide [simp]: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
1220 |
"(-a)/(-b) = a / (b::'a::{field,division_by_zero})" |
21328 | 1221 |
apply (cases "b=0", simp) |
14293 | 1222 |
apply (simp add: nonzero_minus_divide_divide) |
1223 |
done |
|
1224 |
||
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
1225 |
lemma diff_divide_distrib: "(a-b)/(c::'a::field) = a/c - b/c" |
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
1226 |
by (simp add: diff_minus add_divide_distrib) |
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset
|
1227 |
|
23482 | 1228 |
lemma add_divide_eq_iff: |
1229 |
"(z::'a::field) \<noteq> 0 \<Longrightarrow> x + y/z = (z*x + y)/z" |
|
1230 |
by(simp add:add_divide_distrib nonzero_mult_divide_cancel_left) |
|
1231 |
||
1232 |
lemma divide_add_eq_iff: |
|
1233 |
"(z::'a::field) \<noteq> 0 \<Longrightarrow> x/z + y = (x + z*y)/z" |
|
1234 |
by(simp add:add_divide_distrib nonzero_mult_divide_cancel_left) |
|
1235 |
||
1236 |
lemma diff_divide_eq_iff: |
|
1237 |
"(z::'a::field) \<noteq> 0 \<Longrightarrow> x - y/z = (z*x - y)/z" |
|
1238 |
by(simp add:diff_divide_distrib nonzero_mult_divide_cancel_left) |
|
1239 |
||
1240 |
lemma divide_diff_eq_iff: |
|
1241 |
"(z::'a::field) \<noteq> 0 \<Longrightarrow> x/z - y = (x - z*y)/z" |
|
1242 |
by(simp add:diff_divide_distrib nonzero_mult_divide_cancel_left) |
|
1243 |
||
1244 |
lemma nonzero_eq_divide_eq: "c\<noteq>0 ==> ((a::'a::field) = b/c) = (a*c = b)" |
|
1245 |
proof - |
|
1246 |
assume [simp]: "c\<noteq>0" |
|
23496 | 1247 |
have "(a = b/c) = (a*c = (b/c)*c)" by simp |
1248 |
also have "... = (a*c = b)" by (simp add: divide_inverse mult_assoc) |
|
23482 | 1249 |
finally show ?thesis . |
1250 |
qed |
|
1251 |
||
1252 |
lemma nonzero_divide_eq_eq: "c\<noteq>0 ==> (b/c = (a::'a::field)) = (b = a*c)" |
|
1253 |
proof - |
|
1254 |
assume [simp]: "c\<noteq>0" |
|
23496 | 1255 |
have "(b/c = a) = ((b/c)*c = a*c)" by simp |
1256 |
also have "... = (b = a*c)" by (simp add: divide_inverse mult_assoc) |
|
23482 | 1257 |
finally show ?thesis . |
1258 |
qed |
|
1259 |
||
1260 |
lemma eq_divide_eq: |
|
1261 |
"((a::'a::{field,division_by_zero}) = b/c) = (if c\<noteq>0 then a*c = b else a=0)" |
|
1262 |
by (simp add: nonzero_eq_divide_eq) |
|
1263 |
||
1264 |
lemma divide_eq_eq: |
|
1265 |
"(b/c = (a::'a::{field,division_by_zero})) = (if c\<noteq>0 then b = a*c else a=0)" |
|
1266 |
by (force simp add: nonzero_divide_eq_eq) |
|
1267 |
||
1268 |
lemma divide_eq_imp: "(c::'a::{division_by_zero,field}) ~= 0 ==> |
|
1269 |
b = a * c ==> b / c = a" |
|
1270 |
by (subst divide_eq_eq, simp) |
|
1271 |
||
1272 |
lemma eq_divide_imp: "(c::'a::{division_by_zero,field}) ~= 0 ==> |
|
1273 |
a * c = b ==> a = b / c" |
|
1274 |
by (subst eq_divide_eq, simp) |
|
1275 |
||
1276 |
||
1277 |
lemmas field_eq_simps = ring_simps |
|
1278 |
(* pull / out*) |
|
1279 |
add_divide_eq_iff divide_add_eq_iff |
|
1280 |
diff_divide_eq_iff divide_diff_eq_iff |
|
1281 |
(* multiply eqn *) |
|
1282 |
nonzero_eq_divide_eq nonzero_divide_eq_eq |
|
1283 |
(* is added later: |
|
1284 |
times_divide_eq_left times_divide_eq_right |
|
1285 |
*) |
|
1286 |
||
1287 |
text{*An example:*} |
|
1288 |
lemma fixes a b c d e f :: "'a::field" |
|
1289 |
shows "\<lbrakk>a\<noteq>b; c\<noteq>d; e\<noteq>f \<rbrakk> \<Longrightarrow> ((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) = 1" |
|
1290 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b) \<noteq> 0") |
|
1291 |
apply(simp add:field_eq_simps) |
|
1292 |
apply(simp) |
|
1293 |
done |
|
1294 |
||
1295 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1296 |
lemma diff_frac_eq: "(y::'a::field) ~= 0 ==> z ~= 0 ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1297 |
x / y - w / z = (x * z - w * y) / (y * z)" |
23482 | 1298 |
by (simp add:field_eq_simps times_divide_eq) |
1299 |
||
1300 |
lemma frac_eq_eq: "(y::'a::field) ~= 0 ==> z ~= 0 ==> |
|
1301 |
(x / y = w / z) = (x * z = w * y)" |
|
1302 |
by (simp add:field_eq_simps times_divide_eq) |
|
14293 | 1303 |
|
23389 | 1304 |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1305 |
subsection {* Ordered Fields *} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1306 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1307 |
lemma positive_imp_inverse_positive: |
23482 | 1308 |
assumes a_gt_0: "0 < a" shows "0 < inverse (a::'a::ordered_field)" |
1309 |
proof - |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1310 |
have "0 < a * inverse a" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1311 |
by (simp add: a_gt_0 [THEN order_less_imp_not_eq2] zero_less_one) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1312 |
thus "0 < inverse a" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1313 |
by (simp add: a_gt_0 [THEN order_less_not_sym] zero_less_mult_iff) |
23482 | 1314 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1315 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1316 |
lemma negative_imp_inverse_negative: |
23482 | 1317 |
"a < 0 ==> inverse a < (0::'a::ordered_field)" |
1318 |
by (insert positive_imp_inverse_positive [of "-a"], |
|
1319 |
simp add: nonzero_inverse_minus_eq order_less_imp_not_eq) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1320 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1321 |
lemma inverse_le_imp_le: |
23482 | 1322 |
assumes invle: "inverse a \<le> inverse b" and apos: "0 < a" |
1323 |
shows "b \<le> (a::'a::ordered_field)" |
|
1324 |
proof (rule classical) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1325 |
assume "~ b \<le> a" |
23482 | 1326 |
hence "a < b" by (simp add: linorder_not_le) |
1327 |
hence bpos: "0 < b" by (blast intro: apos order_less_trans) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1328 |
hence "a * inverse a \<le> a * inverse b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1329 |
by (simp add: apos invle order_less_imp_le mult_left_mono) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1330 |
hence "(a * inverse a) * b \<le> (a * inverse b) * b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1331 |
by (simp add: bpos order_less_imp_le mult_right_mono) |
23482 | 1332 |
thus "b \<le> a" by (simp add: mult_assoc apos bpos order_less_imp_not_eq2) |
1333 |
qed |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1334 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1335 |
lemma inverse_positive_imp_positive: |
23482 | 1336 |
assumes inv_gt_0: "0 < inverse a" and nz: "a \<noteq> 0" |
1337 |
shows "0 < (a::'a::ordered_field)" |
|
23389 | 1338 |
proof - |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1339 |
have "0 < inverse (inverse a)" |
23389 | 1340 |
using inv_gt_0 by (rule positive_imp_inverse_positive) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1341 |
thus "0 < a" |
23389 | 1342 |
using nz by (simp add: nonzero_inverse_inverse_eq) |
1343 |
qed |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1344 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1345 |
lemma inverse_positive_iff_positive [simp]: |
23482 | 1346 |
"(0 < inverse a) = (0 < (a::'a::{ordered_field,division_by_zero}))" |
21328 | 1347 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1348 |
apply (blast intro: inverse_positive_imp_positive positive_imp_inverse_positive) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1349 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1350 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1351 |
lemma inverse_negative_imp_negative: |
23482 | 1352 |
assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0" |
1353 |
shows "a < (0::'a::ordered_field)" |
|
23389 | 1354 |
proof - |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1355 |
have "inverse (inverse a) < 0" |
23389 | 1356 |
using inv_less_0 by (rule negative_imp_inverse_negative) |
23482 | 1357 |
thus "a < 0" using nz by (simp add: nonzero_inverse_inverse_eq) |
23389 | 1358 |
qed |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1359 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1360 |
lemma inverse_negative_iff_negative [simp]: |
23482 | 1361 |
"(inverse a < 0) = (a < (0::'a::{ordered_field,division_by_zero}))" |
21328 | 1362 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1363 |
apply (blast intro: inverse_negative_imp_negative negative_imp_inverse_negative) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1364 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1365 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1366 |
lemma inverse_nonnegative_iff_nonnegative [simp]: |
23482 | 1367 |
"(0 \<le> inverse a) = (0 \<le> (a::'a::{ordered_field,division_by_zero}))" |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1368 |
by (simp add: linorder_not_less [symmetric]) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1369 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1370 |
lemma inverse_nonpositive_iff_nonpositive [simp]: |
23482 | 1371 |
"(inverse a \<le> 0) = (a \<le> (0::'a::{ordered_field,division_by_zero}))" |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1372 |
by (simp add: linorder_not_less [symmetric]) |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1373 |
|
23406
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1374 |
lemma ordered_field_no_lb: "\<forall> x. \<exists>y. y < (x::'a::ordered_field)" |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1375 |
proof |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1376 |
fix x::'a |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1377 |
have m1: "- (1::'a) < 0" by simp |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1378 |
from add_strict_right_mono[OF m1, where c=x] |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1379 |
have "(- 1) + x < x" by simp |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1380 |
thus "\<exists>y. y < x" by blast |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1381 |
qed |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1382 |
|
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1383 |
lemma ordered_field_no_ub: "\<forall> x. \<exists>y. y > (x::'a::ordered_field)" |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1384 |
proof |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1385 |
fix x::'a |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1386 |
have m1: " (1::'a) > 0" by simp |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1387 |
from add_strict_right_mono[OF m1, where c=x] |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1388 |
have "1 + x > x" by simp |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1389 |
thus "\<exists>y. y > x" by blast |
167b53019d6f
added theorems nonzero_mult_divide_cancel_right' nonzero_mult_divide_cancel_left' ordered_field_no_lb ordered_field_no_ub
chaieb
parents:
23400
diff
changeset
|
1390 |
qed |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1391 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1392 |
subsection{*Anti-Monotonicity of @{term inverse}*} |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1393 |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1394 |
lemma less_imp_inverse_less: |
23482 | 1395 |
assumes less: "a < b" and apos: "0 < a" |
1396 |
shows "inverse b < inverse (a::'a::ordered_field)" |
|
1397 |
proof (rule ccontr) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1398 |
assume "~ inverse b < inverse a" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1399 |
hence "inverse a \<le> inverse b" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1400 |
by (simp add: linorder_not_less) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1401 |
hence "~ (a < b)" |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1402 |
by (simp add: linorder_not_less inverse_le_imp_le [OF _ apos]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1403 |
thus False |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1404 |
by (rule notE [OF _ less]) |
23482 | 1405 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1406 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1407 |
lemma inverse_less_imp_less: |
23482 | 1408 |
"[|inverse a < inverse b; 0 < a|] ==> b < (a::'a::ordered_field)" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1409 |
apply (simp add: order_less_le [of "inverse a"] order_less_le [of "b"]) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1410 |
apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1411 |
done |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1412 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1413 |
text{*Both premises are essential. Consider -1 and 1.*} |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1414 |
lemma inverse_less_iff_less [simp,noatp]: |
23482 | 1415 |
"[|0 < a; 0 < b|] ==> (inverse a < inverse b) = (b < (a::'a::ordered_field))" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1416 |
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1417 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1418 |
lemma le_imp_inverse_le: |
23482 | 1419 |
"[|a \<le> b; 0 < a|] ==> inverse b \<le> inverse (a::'a::ordered_field)" |
1420 |
by (force simp add: order_le_less less_imp_inverse_less) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1421 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1422 |
lemma inverse_le_iff_le [simp,noatp]: |
23482 | 1423 |
"[|0 < a; 0 < b|] ==> (inverse a \<le> inverse b) = (b \<le> (a::'a::ordered_field))" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1424 |
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1425 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1426 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1427 |
text{*These results refer to both operands being negative. The opposite-sign |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1428 |
case is trivial, since inverse preserves signs.*} |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1429 |
lemma inverse_le_imp_le_neg: |
23482 | 1430 |
"[|inverse a \<le> inverse b; b < 0|] ==> b \<le> (a::'a::ordered_field)" |
1431 |
apply (rule classical) |
|
1432 |
apply (subgoal_tac "a < 0") |
|
1433 |
prefer 2 apply (force simp add: linorder_not_le intro: order_less_trans) |
|
1434 |
apply (insert inverse_le_imp_le [of "-b" "-a"]) |
|
1435 |
apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) |
|
1436 |
done |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1437 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1438 |
lemma less_imp_inverse_less_neg: |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1439 |
"[|a < b; b < 0|] ==> inverse b < inverse (a::'a::ordered_field)" |
23482 | 1440 |
apply (subgoal_tac "a < 0") |
1441 |
prefer 2 apply (blast intro: order_less_trans) |
|
1442 |
apply (insert less_imp_inverse_less [of "-b" "-a"]) |
|
1443 |
apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) |
|
1444 |
done |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1445 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1446 |
lemma inverse_less_imp_less_neg: |
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1447 |
"[|inverse a < inverse b; b < 0|] ==> b < (a::'a::ordered_field)" |
23482 | 1448 |
apply (rule classical) |
1449 |
apply (subgoal_tac "a < 0") |
|
1450 |
prefer 2 |
|
1451 |
apply (force simp add: linorder_not_less intro: order_le_less_trans) |
|
1452 |
apply (insert inverse_less_imp_less [of "-b" "-a"]) |
|
1453 |
apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) |
|
1454 |
done |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1455 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1456 |
lemma inverse_less_iff_less_neg [simp,noatp]: |
23482 | 1457 |
"[|a < 0; b < 0|] ==> (inverse a < inverse b) = (b < (a::'a::ordered_field))" |
1458 |
apply (insert inverse_less_iff_less [of "-b" "-a"]) |
|
1459 |
apply (simp del: inverse_less_iff_less |
|
1460 |
add: order_less_imp_not_eq nonzero_inverse_minus_eq) |
|
1461 |
done |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1462 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1463 |
lemma le_imp_inverse_le_neg: |
23482 | 1464 |
"[|a \<le> b; b < 0|] ==> inverse b \<le> inverse (a::'a::ordered_field)" |
1465 |
by (force simp add: order_le_less less_imp_inverse_less_neg) |
|
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1466 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1467 |
lemma inverse_le_iff_le_neg [simp,noatp]: |
23482 | 1468 |
"[|a < 0; b < 0|] ==> (inverse a \<le> inverse b) = (b \<le> (a::'a::ordered_field))" |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
1469 |
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
1470 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1471 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1472 |
subsection{*Inverses and the Number One*} |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1473 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1474 |
lemma one_less_inverse_iff: |
23482 | 1475 |
"(1 < inverse x) = (0 < x & x < (1::'a::{ordered_field,division_by_zero}))" |
1476 |
proof cases |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1477 |
assume "0 < x" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1478 |
with inverse_less_iff_less [OF zero_less_one, of x] |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1479 |
show ?thesis by simp |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1480 |
next |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1481 |
assume notless: "~ (0 < x)" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1482 |
have "~ (1 < inverse x)" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1483 |
proof |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1484 |
assume "1 < inverse x" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1485 |
also with notless have "... \<le> 0" by (simp add: linorder_not_less) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1486 |
also have "... < 1" by (rule zero_less_one) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1487 |
finally show False by auto |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1488 |
qed |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1489 |
with notless show ?thesis by simp |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1490 |
qed |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1491 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1492 |
lemma inverse_eq_1_iff [simp]: |
23482 | 1493 |
"(inverse x = 1) = (x = (1::'a::{field,division_by_zero}))" |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1494 |
by (insert inverse_eq_iff_eq [of x 1], simp) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1495 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1496 |
lemma one_le_inverse_iff: |
23482 | 1497 |
"(1 \<le> inverse x) = (0 < x & x \<le> (1::'a::{ordered_field,division_by_zero}))" |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1498 |
by (force simp add: order_le_less one_less_inverse_iff zero_less_one |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1499 |
eq_commute [of 1]) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1500 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1501 |
lemma inverse_less_1_iff: |
23482 | 1502 |
"(inverse x < 1) = (x \<le> 0 | 1 < (x::'a::{ordered_field,division_by_zero}))" |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1503 |
by (simp add: linorder_not_le [symmetric] one_le_inverse_iff) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1504 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1505 |
lemma inverse_le_1_iff: |
23482 | 1506 |
"(inverse x \<le> 1) = (x \<le> 0 | 1 \<le> (x::'a::{ordered_field,division_by_zero}))" |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1507 |
by (simp add: linorder_not_less [symmetric] one_less_inverse_iff) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1508 |
|
23389 | 1509 |
|
14288 | 1510 |
subsection{*Simplification of Inequalities Involving Literal Divisors*} |
1511 |
||
1512 |
lemma pos_le_divide_eq: "0 < (c::'a::ordered_field) ==> (a \<le> b/c) = (a*c \<le> b)" |
|
1513 |
proof - |
|
1514 |
assume less: "0<c" |
|
1515 |
hence "(a \<le> b/c) = (a*c \<le> (b/c)*c)" |
|
1516 |
by (simp add: mult_le_cancel_right order_less_not_sym [OF less]) |
|
1517 |
also have "... = (a*c \<le> b)" |
|
1518 |
by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
|
1519 |
finally show ?thesis . |
|
1520 |
qed |
|
1521 |
||
1522 |
lemma neg_le_divide_eq: "c < (0::'a::ordered_field) ==> (a \<le> b/c) = (b \<le> a*c)" |
|
1523 |
proof - |
|
1524 |
assume less: "c<0" |
|
1525 |
hence "(a \<le> b/c) = ((b/c)*c \<le> a*c)" |
|
1526 |
by (simp add: mult_le_cancel_right order_less_not_sym [OF less]) |
|
1527 |
also have "... = (b \<le> a*c)" |
|
1528 |
by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) |
|
1529 |
finally show ?thesis . |
|
1530 |
qed |
|
1531 |
||
1532 |
lemma le_divide_eq: |
|
1533 |
"(a \<le> b/c) = |
|
1534 |
(if 0 < c then a*c \<le> b |
|
1535 |
else if c < 0 then b \<le> a*c |
|
1536 |
else a \<le> (0::'a::{ordered_field,division_by_zero}))" |
|
21328 | 1537 |
apply (cases "c=0", simp) |
14288 | 1538 |
apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) |
1539 |
done |
|
1540 |
||
1541 |
lemma pos_divide_le_eq: "0 < (c::'a::ordered_field) ==> (b/c \<le> a) = (b \<le> a*c)" |
|
1542 |
proof - |
|
1543 |
assume less: "0<c" |
|
1544 |
hence "(b/c \<le> a) = ((b/c)*c \<le> a*c)" |
|
1545 |
by (simp add: mult_le_cancel_right order_less_not_sym [OF less]) |
|
1546 |
also have "... = (b \<le> a*c)" |
|
1547 |
by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
|
1548 |
finally show ?thesis . |
|
1549 |
qed |
|
1550 |
||
1551 |
lemma neg_divide_le_eq: "c < (0::'a::ordered_field) ==> (b/c \<le> a) = (a*c \<le> b)" |
|
1552 |
proof - |
|
1553 |
assume less: "c<0" |
|
1554 |
hence "(b/c \<le> a) = (a*c \<le> (b/c)*c)" |
|
1555 |
by (simp add: mult_le_cancel_right order_less_not_sym [OF less]) |
|
1556 |
also have "... = (a*c \<le> b)" |
|
1557 |
by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) |
|
1558 |
finally show ?thesis . |
|
1559 |
qed |
|
1560 |
||
1561 |
lemma divide_le_eq: |
|
1562 |
"(b/c \<le> a) = |
|
1563 |
(if 0 < c then b \<le> a*c |
|
1564 |
else if c < 0 then a*c \<le> b |
|
1565 |
else 0 \<le> (a::'a::{ordered_field,division_by_zero}))" |
|
21328 | 1566 |
apply (cases "c=0", simp) |
14288 | 1567 |
apply (force simp add: pos_divide_le_eq neg_divide_le_eq linorder_neq_iff) |
1568 |
done |
|
1569 |
||
1570 |
lemma pos_less_divide_eq: |
|
1571 |
"0 < (c::'a::ordered_field) ==> (a < b/c) = (a*c < b)" |
|
1572 |
proof - |
|
1573 |
assume less: "0<c" |
|
1574 |
hence "(a < b/c) = (a*c < (b/c)*c)" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1575 |
by (simp add: mult_less_cancel_right_disj order_less_not_sym [OF less]) |
14288 | 1576 |
also have "... = (a*c < b)" |
1577 |
by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
|
1578 |
finally show ?thesis . |
|
1579 |
qed |
|
1580 |
||
1581 |
lemma neg_less_divide_eq: |
|
1582 |
"c < (0::'a::ordered_field) ==> (a < b/c) = (b < a*c)" |
|
1583 |
proof - |
|
1584 |
assume less: "c<0" |
|
1585 |
hence "(a < b/c) = ((b/c)*c < a*c)" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1586 |
by (simp add: mult_less_cancel_right_disj order_less_not_sym [OF less]) |
14288 | 1587 |
also have "... = (b < a*c)" |
1588 |
by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) |
|
1589 |
finally show ?thesis . |
|
1590 |
qed |
|
1591 |
||
1592 |
lemma less_divide_eq: |
|
1593 |
"(a < b/c) = |
|
1594 |
(if 0 < c then a*c < b |
|
1595 |
else if c < 0 then b < a*c |
|
1596 |
else a < (0::'a::{ordered_field,division_by_zero}))" |
|
21328 | 1597 |
apply (cases "c=0", simp) |
14288 | 1598 |
apply (force simp add: pos_less_divide_eq neg_less_divide_eq linorder_neq_iff) |
1599 |
done |
|
1600 |
||
1601 |
lemma pos_divide_less_eq: |
|
1602 |
"0 < (c::'a::ordered_field) ==> (b/c < a) = (b < a*c)" |
|
1603 |
proof - |
|
1604 |
assume less: "0<c" |
|
1605 |
hence "(b/c < a) = ((b/c)*c < a*c)" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1606 |
by (simp add: mult_less_cancel_right_disj order_less_not_sym [OF less]) |
14288 | 1607 |
also have "... = (b < a*c)" |
1608 |
by (simp add: order_less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
|
1609 |
finally show ?thesis . |
|
1610 |
qed |
|
1611 |
||
1612 |
lemma neg_divide_less_eq: |
|
1613 |
"c < (0::'a::ordered_field) ==> (b/c < a) = (a*c < b)" |
|
1614 |
proof - |
|
1615 |
assume less: "c<0" |
|
1616 |
hence "(b/c < a) = (a*c < (b/c)*c)" |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1617 |
by (simp add: mult_less_cancel_right_disj order_less_not_sym [OF less]) |
14288 | 1618 |
also have "... = (a*c < b)" |
1619 |
by (simp add: order_less_imp_not_eq [OF less] divide_inverse mult_assoc) |
|
1620 |
finally show ?thesis . |
|
1621 |
qed |
|
1622 |
||
1623 |
lemma divide_less_eq: |
|
1624 |
"(b/c < a) = |
|
1625 |
(if 0 < c then b < a*c |
|
1626 |
else if c < 0 then a*c < b |
|
1627 |
else 0 < (a::'a::{ordered_field,division_by_zero}))" |
|
21328 | 1628 |
apply (cases "c=0", simp) |
14288 | 1629 |
apply (force simp add: pos_divide_less_eq neg_divide_less_eq linorder_neq_iff) |
1630 |
done |
|
1631 |
||
23482 | 1632 |
|
1633 |
subsection{*Field simplification*} |
|
1634 |
||
1635 |
text{* Lemmas @{text field_simps} multiply with denominators in |
|
1636 |
in(equations) if they can be proved to be non-zero (for equations) or |
|
1637 |
positive/negative (for inequations). *} |
|
14288 | 1638 |
|
23482 | 1639 |
lemmas field_simps = field_eq_simps |
1640 |
(* multiply ineqn *) |
|
1641 |
pos_divide_less_eq neg_divide_less_eq |
|
1642 |
pos_less_divide_eq neg_less_divide_eq |
|
1643 |
pos_divide_le_eq neg_divide_le_eq |
|
1644 |
pos_le_divide_eq neg_le_divide_eq |
|
14288 | 1645 |
|
23482 | 1646 |
text{* Lemmas @{text sign_simps} is a first attempt to automate proofs |
23483 | 1647 |
of positivity/negativity needed for @{text field_simps}. Have not added @{text |
23482 | 1648 |
sign_simps} to @{text field_simps} because the former can lead to case |
1649 |
explosions. *} |
|
14288 | 1650 |
|
23482 | 1651 |
lemmas sign_simps = group_simps |
1652 |
zero_less_mult_iff mult_less_0_iff |
|
14288 | 1653 |
|
23482 | 1654 |
(* Only works once linear arithmetic is installed: |
1655 |
text{*An example:*} |
|
1656 |
lemma fixes a b c d e f :: "'a::ordered_field" |
|
1657 |
shows "\<lbrakk>a>b; c<d; e<f; 0 < u \<rbrakk> \<Longrightarrow> |
|
1658 |
((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) < |
|
1659 |
((e-f)*(a-b)*(c-d))/((e-f)*(a-b)*(c-d)) + u" |
|
1660 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b) > 0") |
|
1661 |
prefer 2 apply(simp add:sign_simps) |
|
1662 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b)*u > 0") |
|
1663 |
prefer 2 apply(simp add:sign_simps) |
|
1664 |
apply(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1665 |
done |
23482 | 1666 |
*) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1667 |
|
23389 | 1668 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1669 |
subsection{*Division and Signs*} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1670 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1671 |
lemma zero_less_divide_iff: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1672 |
"((0::'a::{ordered_field,division_by_zero}) < a/b) = (0 < a & 0 < b | a < 0 & b < 0)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1673 |
by (simp add: divide_inverse zero_less_mult_iff) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1674 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1675 |
lemma divide_less_0_iff: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1676 |
"(a/b < (0::'a::{ordered_field,division_by_zero})) = |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1677 |
(0 < a & b < 0 | a < 0 & 0 < b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1678 |
by (simp add: divide_inverse mult_less_0_iff) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1679 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1680 |
lemma zero_le_divide_iff: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1681 |
"((0::'a::{ordered_field,division_by_zero}) \<le> a/b) = |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1682 |
(0 \<le> a & 0 \<le> b | a \<le> 0 & b \<le> 0)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1683 |
by (simp add: divide_inverse zero_le_mult_iff) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1684 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1685 |
lemma divide_le_0_iff: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1686 |
"(a/b \<le> (0::'a::{ordered_field,division_by_zero})) = |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1687 |
(0 \<le> a & b \<le> 0 | a \<le> 0 & 0 \<le> b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1688 |
by (simp add: divide_inverse mult_le_0_iff) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1689 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1690 |
lemma divide_eq_0_iff [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1691 |
"(a/b = 0) = (a=0 | b=(0::'a::{field,division_by_zero}))" |
23482 | 1692 |
by (simp add: divide_inverse) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1693 |
|
23482 | 1694 |
lemma divide_pos_pos: |
1695 |
"0 < (x::'a::ordered_field) ==> 0 < y ==> 0 < x / y" |
|
1696 |
by(simp add:field_simps) |
|
1697 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1698 |
|
23482 | 1699 |
lemma divide_nonneg_pos: |
1700 |
"0 <= (x::'a::ordered_field) ==> 0 < y ==> 0 <= x / y" |
|
1701 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1702 |
|
23482 | 1703 |
lemma divide_neg_pos: |
1704 |
"(x::'a::ordered_field) < 0 ==> 0 < y ==> x / y < 0" |
|
1705 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1706 |
|
23482 | 1707 |
lemma divide_nonpos_pos: |
1708 |
"(x::'a::ordered_field) <= 0 ==> 0 < y ==> x / y <= 0" |
|
1709 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1710 |
|
23482 | 1711 |
lemma divide_pos_neg: |
1712 |
"0 < (x::'a::ordered_field) ==> y < 0 ==> x / y < 0" |
|
1713 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1714 |
|
23482 | 1715 |
lemma divide_nonneg_neg: |
1716 |
"0 <= (x::'a::ordered_field) ==> y < 0 ==> x / y <= 0" |
|
1717 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1718 |
|
23482 | 1719 |
lemma divide_neg_neg: |
1720 |
"(x::'a::ordered_field) < 0 ==> y < 0 ==> 0 < x / y" |
|
1721 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1722 |
|
23482 | 1723 |
lemma divide_nonpos_neg: |
1724 |
"(x::'a::ordered_field) <= 0 ==> y < 0 ==> 0 <= x / y" |
|
1725 |
by(simp add:field_simps) |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1726 |
|
23389 | 1727 |
|
14288 | 1728 |
subsection{*Cancellation Laws for Division*} |
1729 |
||
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1730 |
lemma divide_cancel_right [simp,noatp]: |
14288 | 1731 |
"(a/c = b/c) = (c = 0 | a = (b::'a::{field,division_by_zero}))" |
23482 | 1732 |
apply (cases "c=0", simp) |
23496 | 1733 |
apply (simp add: divide_inverse) |
14288 | 1734 |
done |
1735 |
||
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1736 |
lemma divide_cancel_left [simp,noatp]: |
14288 | 1737 |
"(c/a = c/b) = (c = 0 | a = (b::'a::{field,division_by_zero}))" |
23482 | 1738 |
apply (cases "c=0", simp) |
23496 | 1739 |
apply (simp add: divide_inverse) |
14288 | 1740 |
done |
1741 |
||
23389 | 1742 |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1743 |
subsection {* Division and the Number One *} |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1744 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1745 |
text{*Simplify expressions equated with 1*} |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1746 |
lemma divide_eq_1_iff [simp,noatp]: |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1747 |
"(a/b = 1) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))" |
23482 | 1748 |
apply (cases "b=0", simp) |
1749 |
apply (simp add: right_inverse_eq) |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1750 |
done |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1751 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1752 |
lemma one_eq_divide_iff [simp,noatp]: |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1753 |
"(1 = a/b) = (b \<noteq> 0 & a = (b::'a::{field,division_by_zero}))" |
23482 | 1754 |
by (simp add: eq_commute [of 1]) |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1755 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1756 |
lemma zero_eq_1_divide_iff [simp,noatp]: |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1757 |
"((0::'a::{ordered_field,division_by_zero}) = 1/a) = (a = 0)" |
23482 | 1758 |
apply (cases "a=0", simp) |
1759 |
apply (auto simp add: nonzero_eq_divide_eq) |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1760 |
done |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1761 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1762 |
lemma one_divide_eq_0_iff [simp,noatp]: |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1763 |
"(1/a = (0::'a::{ordered_field,division_by_zero})) = (a = 0)" |
23482 | 1764 |
apply (cases "a=0", simp) |
1765 |
apply (insert zero_neq_one [THEN not_sym]) |
|
1766 |
apply (auto simp add: nonzero_divide_eq_eq) |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1767 |
done |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1768 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1769 |
text{*Simplify expressions such as @{text "0 < 1/x"} to @{text "0 < x"}*} |
18623 | 1770 |
lemmas zero_less_divide_1_iff = zero_less_divide_iff [of 1, simplified] |
1771 |
lemmas divide_less_0_1_iff = divide_less_0_iff [of 1, simplified] |
|
1772 |
lemmas zero_le_divide_1_iff = zero_le_divide_iff [of 1, simplified] |
|
1773 |
lemmas divide_le_0_1_iff = divide_le_0_iff [of 1, simplified] |
|
17085 | 1774 |
|
1775 |
declare zero_less_divide_1_iff [simp] |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1776 |
declare divide_less_0_1_iff [simp,noatp] |
17085 | 1777 |
declare zero_le_divide_1_iff [simp] |
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1778 |
declare divide_le_0_1_iff [simp,noatp] |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1779 |
|
23389 | 1780 |
|
14293 | 1781 |
subsection {* Ordering Rules for Division *} |
1782 |
||
1783 |
lemma divide_strict_right_mono: |
|
1784 |
"[|a < b; 0 < c|] ==> a / c < b / (c::'a::ordered_field)" |
|
1785 |
by (simp add: order_less_imp_not_eq2 divide_inverse mult_strict_right_mono |
|
23482 | 1786 |
positive_imp_inverse_positive) |
14293 | 1787 |
|
1788 |
lemma divide_right_mono: |
|
1789 |
"[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/(c::'a::{ordered_field,division_by_zero})" |
|
23482 | 1790 |
by (force simp add: divide_strict_right_mono order_le_less) |
14293 | 1791 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1792 |
lemma divide_right_mono_neg: "(a::'a::{division_by_zero,ordered_field}) <= b |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1793 |
==> c <= 0 ==> b / c <= a / c" |
23482 | 1794 |
apply (drule divide_right_mono [of _ _ "- c"]) |
1795 |
apply auto |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1796 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1797 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1798 |
lemma divide_strict_right_mono_neg: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1799 |
"[|b < a; c < 0|] ==> a / c < b / (c::'a::ordered_field)" |
23482 | 1800 |
apply (drule divide_strict_right_mono [of _ _ "-c"], simp) |
1801 |
apply (simp add: order_less_imp_not_eq nonzero_minus_divide_right [symmetric]) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1802 |
done |
14293 | 1803 |
|
1804 |
text{*The last premise ensures that @{term a} and @{term b} |
|
1805 |
have the same sign*} |
|
1806 |
lemma divide_strict_left_mono: |
|
23482 | 1807 |
"[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / (b::'a::ordered_field)" |
1808 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_strict_right_mono) |
|
14293 | 1809 |
|
1810 |
lemma divide_left_mono: |
|
23482 | 1811 |
"[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / (b::'a::ordered_field)" |
1812 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_right_mono) |
|
14293 | 1813 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1814 |
lemma divide_left_mono_neg: "(a::'a::{division_by_zero,ordered_field}) <= b |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1815 |
==> c <= 0 ==> 0 < a * b ==> c / a <= c / b" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1816 |
apply (drule divide_left_mono [of _ _ "- c"]) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1817 |
apply (auto simp add: mult_commute) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1818 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1819 |
|
14293 | 1820 |
lemma divide_strict_left_mono_neg: |
23482 | 1821 |
"[|a < b; c < 0; 0 < a*b|] ==> c / a < c / (b::'a::ordered_field)" |
1822 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_strict_right_mono_neg) |
|
1823 |
||
14293 | 1824 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1825 |
text{*Simplify quotients that are compared with the value 1.*} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1826 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1827 |
lemma le_divide_eq_1 [noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1828 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1829 |
shows "(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1830 |
by (auto simp add: le_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1831 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1832 |
lemma divide_le_eq_1 [noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1833 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1834 |
shows "(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1835 |
by (auto simp add: divide_le_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1836 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1837 |
lemma less_divide_eq_1 [noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1838 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1839 |
shows "(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1840 |
by (auto simp add: less_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1841 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1842 |
lemma divide_less_eq_1 [noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1843 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1844 |
shows "(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1845 |
by (auto simp add: divide_less_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1846 |
|
23389 | 1847 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1848 |
subsection{*Conditional Simplification Rules: No Case Splits*} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1849 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1850 |
lemma le_divide_eq_1_pos [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1851 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1852 |
shows "0 < a \<Longrightarrow> (1 \<le> b/a) = (a \<le> b)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1853 |
by (auto simp add: le_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1854 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1855 |
lemma le_divide_eq_1_neg [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1856 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1857 |
shows "a < 0 \<Longrightarrow> (1 \<le> b/a) = (b \<le> a)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1858 |
by (auto simp add: le_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1859 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1860 |
lemma divide_le_eq_1_pos [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1861 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1862 |
shows "0 < a \<Longrightarrow> (b/a \<le> 1) = (b \<le> a)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1863 |
by (auto simp add: divide_le_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1864 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1865 |
lemma divide_le_eq_1_neg [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1866 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1867 |
shows "a < 0 \<Longrightarrow> (b/a \<le> 1) = (a \<le> b)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1868 |
by (auto simp add: divide_le_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1869 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1870 |
lemma less_divide_eq_1_pos [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1871 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1872 |
shows "0 < a \<Longrightarrow> (1 < b/a) = (a < b)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1873 |
by (auto simp add: less_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1874 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1875 |
lemma less_divide_eq_1_neg [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1876 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1877 |
shows "a < 0 \<Longrightarrow> (1 < b/a) = (b < a)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1878 |
by (auto simp add: less_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1879 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1880 |
lemma divide_less_eq_1_pos [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1881 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1882 |
shows "0 < a \<Longrightarrow> (b/a < 1) = (b < a)" |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1883 |
by (auto simp add: divide_less_eq) |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1884 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1885 |
lemma divide_less_eq_1_neg [simp,noatp]: |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1886 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1887 |
shows "a < 0 \<Longrightarrow> b/a < 1 <-> a < b" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1888 |
by (auto simp add: divide_less_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1889 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1890 |
lemma eq_divide_eq_1 [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1891 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1892 |
shows "(1 = b/a) = ((a \<noteq> 0 & a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1893 |
by (auto simp add: eq_divide_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1894 |
|
24286
7619080e49f0
ATP blacklisting is now in theory data, attribute noatp
paulson
parents:
23879
diff
changeset
|
1895 |
lemma divide_eq_eq_1 [simp,noatp]: |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1896 |
fixes a :: "'a :: {ordered_field,division_by_zero}" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1897 |
shows "(b/a = 1) = ((a \<noteq> 0 & a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1898 |
by (auto simp add: divide_eq_eq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1899 |
|
23389 | 1900 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1901 |
subsection {* Reasoning about inequalities with division *} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1902 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1903 |
lemma mult_right_le_one_le: "0 <= (x::'a::ordered_idom) ==> 0 <= y ==> y <= 1 |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1904 |
==> x * y <= x" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1905 |
by (auto simp add: mult_compare_simps); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1906 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1907 |
lemma mult_left_le_one_le: "0 <= (x::'a::ordered_idom) ==> 0 <= y ==> y <= 1 |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1908 |
==> y * x <= x" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1909 |
by (auto simp add: mult_compare_simps); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1910 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1911 |
lemma mult_imp_div_pos_le: "0 < (y::'a::ordered_field) ==> x <= z * y ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1912 |
x / y <= z"; |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1913 |
by (subst pos_divide_le_eq, assumption+); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1914 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1915 |
lemma mult_imp_le_div_pos: "0 < (y::'a::ordered_field) ==> z * y <= x ==> |
23482 | 1916 |
z <= x / y" |
1917 |
by(simp add:field_simps) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1918 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1919 |
lemma mult_imp_div_pos_less: "0 < (y::'a::ordered_field) ==> x < z * y ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1920 |
x / y < z" |
23482 | 1921 |
by(simp add:field_simps) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1922 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1923 |
lemma mult_imp_less_div_pos: "0 < (y::'a::ordered_field) ==> z * y < x ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1924 |
z < x / y" |
23482 | 1925 |
by(simp add:field_simps) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1926 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1927 |
lemma frac_le: "(0::'a::ordered_field) <= x ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1928 |
x <= y ==> 0 < w ==> w <= z ==> x / z <= y / w" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1929 |
apply (rule mult_imp_div_pos_le) |
25230 | 1930 |
apply simp |
1931 |
apply (subst times_divide_eq_left) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1932 |
apply (rule mult_imp_le_div_pos, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1933 |
apply (rule mult_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1934 |
apply simp_all |
14293 | 1935 |
done |
1936 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1937 |
lemma frac_less: "(0::'a::ordered_field) <= x ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1938 |
x < y ==> 0 < w ==> w <= z ==> x / z < y / w" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1939 |
apply (rule mult_imp_div_pos_less) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1940 |
apply simp; |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1941 |
apply (subst times_divide_eq_left); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1942 |
apply (rule mult_imp_less_div_pos, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1943 |
apply (erule mult_less_le_imp_less) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1944 |
apply simp_all |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1945 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1946 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1947 |
lemma frac_less2: "(0::'a::ordered_field) < x ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1948 |
x <= y ==> 0 < w ==> w < z ==> x / z < y / w" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1949 |
apply (rule mult_imp_div_pos_less) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1950 |
apply simp_all |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1951 |
apply (subst times_divide_eq_left); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1952 |
apply (rule mult_imp_less_div_pos, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1953 |
apply (erule mult_le_less_imp_less) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1954 |
apply simp_all |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1955 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1956 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1957 |
text{*It's not obvious whether these should be simprules or not. |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1958 |
Their effect is to gather terms into one big fraction, like |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1959 |
a*b*c / x*y*z. The rationale for that is unclear, but many proofs |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1960 |
seem to need them.*} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1961 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1962 |
declare times_divide_eq [simp] |
14293 | 1963 |
|
23389 | 1964 |
|
14293 | 1965 |
subsection {* Ordered Fields are Dense *} |
1966 |
||
25193 | 1967 |
context ordered_semidom |
1968 |
begin |
|
1969 |
||
1970 |
lemma less_add_one: "a < a + 1" |
|
14293 | 1971 |
proof - |
25193 | 1972 |
have "a + 0 < a + 1" |
23482 | 1973 |
by (blast intro: zero_less_one add_strict_left_mono) |
14293 | 1974 |
thus ?thesis by simp |
1975 |
qed |
|
1976 |
||
25193 | 1977 |
lemma zero_less_two: "0 < 1 + 1" |
1978 |
by (blast intro: less_trans zero_less_one less_add_one) |
|
1979 |
||
1980 |
end |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1981 |
|
14293 | 1982 |
lemma less_half_sum: "a < b ==> a < (a+b) / (1+1::'a::ordered_field)" |
23482 | 1983 |
by (simp add: field_simps zero_less_two) |
14293 | 1984 |
|
1985 |
lemma gt_half_sum: "a < b ==> (a+b)/(1+1::'a::ordered_field) < b" |
|
23482 | 1986 |
by (simp add: field_simps zero_less_two) |
14293 | 1987 |
|
24422 | 1988 |
instance ordered_field < dense_linear_order |
1989 |
proof |
|
1990 |
fix x y :: 'a |
|
1991 |
have "x < x + 1" by simp |
|
1992 |
then show "\<exists>y. x < y" .. |
|
1993 |
have "x - 1 < x" by simp |
|
1994 |
then show "\<exists>y. y < x" .. |
|
1995 |
show "x < y \<Longrightarrow> \<exists>z>x. z < y" by (blast intro!: less_half_sum gt_half_sum) |
|
1996 |
qed |
|
14293 | 1997 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1998 |
|
14293 | 1999 |
subsection {* Absolute Value *} |
2000 |
||
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2001 |
context ordered_idom |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2002 |
begin |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2003 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2004 |
lemma mult_sgn_abs: "sgn x * abs x = x" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2005 |
unfolding abs_if sgn_if by auto |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2006 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2007 |
end |
24491 | 2008 |
|
14738 | 2009 |
lemma abs_one [simp]: "abs 1 = (1::'a::ordered_idom)" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2010 |
by (simp add: abs_if zero_less_one [THEN order_less_not_sym]) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2011 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2012 |
class pordered_ring_abs = pordered_ring + pordered_ab_group_add_abs + |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2013 |
assumes abs_eq_mult: |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2014 |
"(0 \<le> a \<or> a \<le> 0) \<and> (0 \<le> b \<or> b \<le> 0) \<Longrightarrow> \<bar>a * b\<bar> = \<bar>a\<bar> * \<bar>b\<bar>" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2015 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2016 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2017 |
class lordered_ring = pordered_ring + lordered_ab_group_add_abs |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2018 |
begin |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2019 |
|
25512
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
2020 |
subclass lordered_ab_group_add_meet by intro_locales |
4134f7c782e2
using intro_locales instead of unfold_locales if appropriate
haftmann
parents:
25450
diff
changeset
|
2021 |
subclass lordered_ab_group_add_join by intro_locales |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2022 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2023 |
end |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2024 |
|
14738 | 2025 |
lemma abs_le_mult: "abs (a * b) \<le> (abs a) * (abs (b::'a::lordered_ring))" |
2026 |
proof - |
|
2027 |
let ?x = "pprt a * pprt b - pprt a * nprt b - nprt a * pprt b + nprt a * nprt b" |
|
2028 |
let ?y = "pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b" |
|
2029 |
have a: "(abs a) * (abs b) = ?x" |
|
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
2030 |
by (simp only: abs_prts[of a] abs_prts[of b] ring_simps) |
14738 | 2031 |
{ |
2032 |
fix u v :: 'a |
|
15481 | 2033 |
have bh: "\<lbrakk>u = a; v = b\<rbrakk> \<Longrightarrow> |
2034 |
u * v = pprt a * pprt b + pprt a * nprt b + |
|
2035 |
nprt a * pprt b + nprt a * nprt b" |
|
14738 | 2036 |
apply (subst prts[of u], subst prts[of v]) |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
2037 |
apply (simp add: ring_simps) |
14738 | 2038 |
done |
2039 |
} |
|
2040 |
note b = this[OF refl[of a] refl[of b]] |
|
2041 |
note addm = add_mono[of "0::'a" _ "0::'a", simplified] |
|
2042 |
note addm2 = add_mono[of _ "0::'a" _ "0::'a", simplified] |
|
2043 |
have xy: "- ?x <= ?y" |
|
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
2044 |
apply (simp) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
2045 |
apply (rule_tac y="0::'a" in order_trans) |
16568 | 2046 |
apply (rule addm2) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2047 |
apply (simp_all add: mult_nonneg_nonneg mult_nonpos_nonpos) |
16568 | 2048 |
apply (rule addm) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2049 |
apply (simp_all add: mult_nonneg_nonneg mult_nonpos_nonpos) |
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
2050 |
done |
14738 | 2051 |
have yx: "?y <= ?x" |
16568 | 2052 |
apply (simp add:diff_def) |
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
2053 |
apply (rule_tac y=0 in order_trans) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2054 |
apply (rule addm2, (simp add: mult_nonneg_nonpos mult_nonneg_nonpos2)+) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2055 |
apply (rule addm, (simp add: mult_nonneg_nonpos mult_nonneg_nonpos2)+) |
14738 | 2056 |
done |
2057 |
have i1: "a*b <= abs a * abs b" by (simp only: a b yx) |
|
2058 |
have i2: "- (abs a * abs b) <= a*b" by (simp only: a b xy) |
|
2059 |
show ?thesis |
|
2060 |
apply (rule abs_leI) |
|
2061 |
apply (simp add: i1) |
|
2062 |
apply (simp add: i2[simplified minus_le_iff]) |
|
2063 |
done |
|
2064 |
qed |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2065 |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2066 |
instance lordered_ring \<subseteq> pordered_ring_abs |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2067 |
proof |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2068 |
fix a b :: "'a\<Colon> lordered_ring" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2069 |
assume "(0 \<le> a \<or> a \<le> 0) \<and> (0 \<le> b \<or> b \<le> 0)" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2070 |
show "abs (a*b) = abs a * abs b" |
14738 | 2071 |
proof - |
2072 |
have s: "(0 <= a*b) | (a*b <= 0)" |
|
2073 |
apply (auto) |
|
2074 |
apply (rule_tac split_mult_pos_le) |
|
2075 |
apply (rule_tac contrapos_np[of "a*b <= 0"]) |
|
2076 |
apply (simp) |
|
2077 |
apply (rule_tac split_mult_neg_le) |
|
2078 |
apply (insert prems) |
|
2079 |
apply (blast) |
|
2080 |
done |
|
2081 |
have mulprts: "a * b = (pprt a + nprt a) * (pprt b + nprt b)" |
|
2082 |
by (simp add: prts[symmetric]) |
|
2083 |
show ?thesis |
|
2084 |
proof cases |
|
2085 |
assume "0 <= a * b" |
|
2086 |
then show ?thesis |
|
2087 |
apply (simp_all add: mulprts abs_prts) |
|
2088 |
apply (insert prems) |
|
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
2089 |
apply (auto simp add: |
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
2090 |
ring_simps |
25078 | 2091 |
iffD1[OF zero_le_iff_zero_nprt] iffD1[OF le_zero_iff_zero_pprt] |
2092 |
iffD1[OF le_zero_iff_pprt_id] iffD1[OF zero_le_iff_nprt_id]) |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2093 |
apply(drule (1) mult_nonneg_nonpos[of a b], simp) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2094 |
apply(drule (1) mult_nonneg_nonpos2[of b a], simp) |
14738 | 2095 |
done |
2096 |
next |
|
2097 |
assume "~(0 <= a*b)" |
|
2098 |
with s have "a*b <= 0" by simp |
|
2099 |
then show ?thesis |
|
2100 |
apply (simp_all add: mulprts abs_prts) |
|
2101 |
apply (insert prems) |
|
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
2102 |
apply (auto simp add: ring_simps) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2103 |
apply(drule (1) mult_nonneg_nonneg[of a b],simp) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2104 |
apply(drule (1) mult_nonpos_nonpos[of a b],simp) |
14738 | 2105 |
done |
2106 |
qed |
|
2107 |
qed |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2108 |
qed |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2109 |
|
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2110 |
instance ordered_idom \<subseteq> pordered_ring_abs |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2111 |
by default (auto simp add: abs_if not_less |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2112 |
equal_neg_zero neg_equal_zero mult_less_0_iff) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2113 |
|
14738 | 2114 |
lemma abs_mult: "abs (a * b) = abs a * abs (b::'a::ordered_idom)" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2115 |
by (simp add: abs_eq_mult linorder_linear) |
14293 | 2116 |
|
14738 | 2117 |
lemma abs_mult_self: "abs a * abs a = a * (a::'a::ordered_idom)" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2118 |
by (simp add: abs_if) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2119 |
|
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2120 |
lemma nonzero_abs_inverse: |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2121 |
"a \<noteq> 0 ==> abs (inverse (a::'a::ordered_field)) = inverse (abs a)" |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2122 |
apply (auto simp add: linorder_neq_iff abs_if nonzero_inverse_minus_eq |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2123 |
negative_imp_inverse_negative) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2124 |
apply (blast intro: positive_imp_inverse_positive elim: order_less_asym) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2125 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2126 |
|
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2127 |
lemma abs_inverse [simp]: |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2128 |
"abs (inverse (a::'a::{ordered_field,division_by_zero})) = |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2129 |
inverse (abs a)" |
21328 | 2130 |
apply (cases "a=0", simp) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2131 |
apply (simp add: nonzero_abs_inverse) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2132 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2133 |
|
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2134 |
lemma nonzero_abs_divide: |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2135 |
"b \<noteq> 0 ==> abs (a / (b::'a::ordered_field)) = abs a / abs b" |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2136 |
by (simp add: divide_inverse abs_mult nonzero_abs_inverse) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2137 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
2138 |
lemma abs_divide [simp]: |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2139 |
"abs (a / (b::'a::{ordered_field,division_by_zero})) = abs a / abs b" |
21328 | 2140 |
apply (cases "b=0", simp) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2141 |
apply (simp add: nonzero_abs_divide) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2142 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2143 |
|
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2144 |
lemma abs_mult_less: |
14738 | 2145 |
"[| abs a < c; abs b < d |] ==> abs a * abs b < c*(d::'a::ordered_idom)" |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2146 |
proof - |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2147 |
assume ac: "abs a < c" |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2148 |
hence cpos: "0<c" by (blast intro: order_le_less_trans abs_ge_zero) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2149 |
assume "abs b < d" |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2150 |
thus ?thesis by (simp add: ac cpos mult_strict_mono) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
2151 |
qed |
14293 | 2152 |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2153 |
lemmas eq_minus_self_iff = equal_neg_zero |
14738 | 2154 |
|
2155 |
lemma less_minus_self_iff: "(a < -a) = (a < (0::'a::ordered_idom))" |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2156 |
unfolding order_less_le less_eq_neg_nonpos equal_neg_zero .. |
14738 | 2157 |
|
2158 |
lemma abs_less_iff: "(abs a < b) = (a < b & -a < (b::'a::ordered_idom))" |
|
2159 |
apply (simp add: order_less_le abs_le_iff) |
|
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2160 |
apply (auto simp add: abs_if neg_less_eq_nonneg less_eq_neg_nonpos) |
14738 | 2161 |
done |
2162 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2163 |
lemma abs_mult_pos: "(0::'a::ordered_idom) <= x ==> |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2164 |
(abs y) * x = abs (y * x)" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2165 |
apply (subst abs_mult) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2166 |
apply simp |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2167 |
done |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2168 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2169 |
lemma abs_div_pos: "(0::'a::{division_by_zero,ordered_field}) < y ==> |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2170 |
abs x / y = abs (x / y)" |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2171 |
apply (subst abs_divide) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2172 |
apply (simp add: order_less_imp_le) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
2173 |
done |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
2174 |
|
23389 | 2175 |
|
19404 | 2176 |
subsection {* Bounds of products via negative and positive Part *} |
15178 | 2177 |
|
15580 | 2178 |
lemma mult_le_prts: |
2179 |
assumes |
|
2180 |
"a1 <= (a::'a::lordered_ring)" |
|
2181 |
"a <= a2" |
|
2182 |
"b1 <= b" |
|
2183 |
"b <= b2" |
|
2184 |
shows |
|
2185 |
"a * b <= pprt a2 * pprt b2 + pprt a1 * nprt b2 + nprt a2 * pprt b1 + nprt a1 * nprt b1" |
|
2186 |
proof - |
|
2187 |
have "a * b = (pprt a + nprt a) * (pprt b + nprt b)" |
|
2188 |
apply (subst prts[symmetric])+ |
|
2189 |
apply simp |
|
2190 |
done |
|
2191 |
then have "a * b = pprt a * pprt b + pprt a * nprt b + nprt a * pprt b + nprt a * nprt b" |
|
23477
f4b83f03cac9
tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents:
23413
diff
changeset
|
2192 |
by (simp add: ring_simps) |
15580 | 2193 |
moreover have "pprt a * pprt b <= pprt a2 * pprt b2" |
2194 |
by (simp_all add: prems mult_mono) |
|
2195 |
moreover have "pprt a * nprt b <= pprt a1 * nprt b2" |
|
2196 |
proof - |
|
2197 |
have "pprt a * nprt b <= pprt a * nprt b2" |
|
2198 |
by (simp add: mult_left_mono prems) |
|
2199 |
moreover have "pprt a * nprt b2 <= pprt a1 * nprt b2" |
|
2200 |
by (simp add: mult_right_mono_neg prems) |
|
2201 |
ultimately show ?thesis |
|
2202 |
by simp |
|
2203 |
qed |
|
2204 |
moreover have "nprt a * pprt b <= nprt a2 * pprt b1" |
|
2205 |
proof - |
|
2206 |
have "nprt a * pprt b <= nprt a2 * pprt b" |
|
2207 |
by (simp add: mult_right_mono prems) |
|
2208 |
moreover have "nprt a2 * pprt b <= nprt a2 * pprt b1" |
|
2209 |
by (simp add: mult_left_mono_neg prems) |
|
2210 |
ultimately show ?thesis |
|
2211 |
by simp |
|
2212 |
qed |
|
2213 |
moreover have "nprt a * nprt b <= nprt a1 * nprt b1" |
|
2214 |
proof - |
|
2215 |
have "nprt a * nprt b <= nprt a * nprt b1" |
|
2216 |
by (simp add: mult_left_mono_neg prems) |
|
2217 |
moreover have "nprt a * nprt b1 <= nprt a1 * nprt b1" |
|
2218 |
by (simp add: mult_right_mono_neg prems) |
|
2219 |
ultimately show ?thesis |
|
2220 |
by simp |
|
2221 |
qed |
|
2222 |
ultimately show ?thesis |
|
2223 |
by - (rule add_mono | simp)+ |
|
2224 |
qed |
|
19404 | 2225 |
|
2226 |
lemma mult_ge_prts: |
|
15178 | 2227 |
assumes |
19404 | 2228 |
"a1 <= (a::'a::lordered_ring)" |
2229 |
"a <= a2" |
|
2230 |
"b1 <= b" |
|
2231 |
"b <= b2" |
|
15178 | 2232 |
shows |
19404 | 2233 |
"a * b >= nprt a1 * pprt b2 + nprt a2 * nprt b2 + pprt a1 * pprt b1 + pprt a2 * nprt b1" |
2234 |
proof - |
|
2235 |
from prems have a1:"- a2 <= -a" by auto |
|
2236 |
from prems have a2: "-a <= -a1" by auto |
|
2237 |
from mult_le_prts[of "-a2" "-a" "-a1" "b1" b "b2", OF a1 a2 prems(3) prems(4), simplified nprt_neg pprt_neg] |
|
2238 |
have le: "- (a * b) <= - nprt a1 * pprt b2 + - nprt a2 * nprt b2 + - pprt a1 * pprt b1 + - pprt a2 * nprt b1" by simp |
|
2239 |
then have "-(- nprt a1 * pprt b2 + - nprt a2 * nprt b2 + - pprt a1 * pprt b1 + - pprt a2 * nprt b1) <= a * b" |
|
2240 |
by (simp only: minus_le_iff) |
|
2241 |
then show ?thesis by simp |
|
15178 | 2242 |
qed |
2243 |
||
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
2244 |
end |