author | haftmann |
Tue, 27 Apr 2010 11:52:41 +0200 | |
changeset 36423 | 63fc238a7430 |
parent 36414 | a19ba9bbc8dc |
child 36425 | a0297b98728c |
permissions | -rw-r--r-- |
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
1 |
(* Title: HOL/Fields.thy |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
2 |
Author: Gertrud Bauer |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
3 |
Author: Steven Obua |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
4 |
Author: Tobias Nipkow |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
5 |
Author: Lawrence C Paulson |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
6 |
Author: Markus Wenzel |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
7 |
Author: Jeremy Avigad |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
8 |
*) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
9 |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
10 |
header {* Fields *} |
25152 | 11 |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
12 |
theory Fields |
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
13 |
imports Rings |
25186 | 14 |
begin |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
15 |
|
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
16 |
class field = comm_ring_1 + inverse + |
35084 | 17 |
assumes field_inverse: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
18 |
assumes field_divide_inverse: "a / b = a * inverse b" |
|
25267 | 19 |
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
|
20 |
|
25267 | 21 |
subclass division_ring |
28823 | 22 |
proof |
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
23 |
fix a :: 'a |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
24 |
assume "a \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
25 |
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
|
26 |
thus "a * inverse a = 1" by (simp only: mult_commute) |
35084 | 27 |
next |
28 |
fix a b :: 'a |
|
29 |
show "a / b = a * inverse b" by (rule field_divide_inverse) |
|
14738 | 30 |
qed |
25230 | 31 |
|
27516 | 32 |
subclass idom .. |
25230 | 33 |
|
30630 | 34 |
text{*There is no slick version using division by zero.*} |
35 |
lemma inverse_add: |
|
36 |
"[| a \<noteq> 0; b \<noteq> 0 |] |
|
37 |
==> inverse a + inverse b = (a + b) * inverse a * inverse b" |
|
38 |
by (simp add: division_ring_inverse_add mult_ac) |
|
39 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
40 |
lemma nonzero_mult_divide_mult_cancel_left [simp, no_atp]: |
30630 | 41 |
assumes [simp]: "b\<noteq>0" and [simp]: "c\<noteq>0" shows "(c*a)/(c*b) = a/b" |
42 |
proof - |
|
43 |
have "(c*a)/(c*b) = c * a * (inverse b * inverse c)" |
|
44 |
by (simp add: divide_inverse nonzero_inverse_mult_distrib) |
|
45 |
also have "... = a * inverse b * (inverse c * c)" |
|
46 |
by (simp only: mult_ac) |
|
47 |
also have "... = a * inverse b" by simp |
|
48 |
finally show ?thesis by (simp add: divide_inverse) |
|
49 |
qed |
|
50 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
51 |
lemma nonzero_mult_divide_mult_cancel_right [simp, no_atp]: |
30630 | 52 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (a * c) / (b * c) = a / b" |
53 |
by (simp add: mult_commute [of _ c]) |
|
54 |
||
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
55 |
lemma times_divide_eq_left [simp]: "(b / c) * a = (b * a) / c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
56 |
by (simp add: divide_inverse mult_ac) |
30630 | 57 |
|
58 |
text {* These are later declared as simp rules. *} |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
59 |
lemmas times_divide_eq [no_atp] = times_divide_eq_right times_divide_eq_left |
30630 | 60 |
|
61 |
lemma add_frac_eq: |
|
62 |
assumes "y \<noteq> 0" and "z \<noteq> 0" |
|
63 |
shows "x / y + w / z = (x * z + w * y) / (y * z)" |
|
64 |
proof - |
|
65 |
have "x / y + w / z = (x * z) / (y * z) + (y * w) / (y * z)" |
|
66 |
using assms by simp |
|
67 |
also have "\<dots> = (x * z + y * w) / (y * z)" |
|
68 |
by (simp only: add_divide_distrib) |
|
69 |
finally show ?thesis |
|
70 |
by (simp only: mult_commute) |
|
71 |
qed |
|
72 |
||
73 |
text{*Special Cancellation Simprules for Division*} |
|
74 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
75 |
lemma nonzero_mult_divide_cancel_right [simp, no_atp]: |
30630 | 76 |
"b \<noteq> 0 \<Longrightarrow> a * b / b = a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
77 |
using nonzero_mult_divide_mult_cancel_right [of 1 b a] by simp |
30630 | 78 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
79 |
lemma nonzero_mult_divide_cancel_left [simp, no_atp]: |
30630 | 80 |
"a \<noteq> 0 \<Longrightarrow> a * b / a = b" |
81 |
using nonzero_mult_divide_mult_cancel_left [of 1 a b] by simp |
|
82 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
83 |
lemma nonzero_divide_mult_cancel_right [simp, no_atp]: |
30630 | 84 |
"\<lbrakk>a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> b / (a * b) = 1 / a" |
85 |
using nonzero_mult_divide_mult_cancel_right [of a b 1] by simp |
|
86 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
87 |
lemma nonzero_divide_mult_cancel_left [simp, no_atp]: |
30630 | 88 |
"\<lbrakk>a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> a / (a * b) = 1 / b" |
89 |
using nonzero_mult_divide_mult_cancel_left [of b a 1] by simp |
|
90 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
91 |
lemma nonzero_mult_divide_mult_cancel_left2 [simp, no_atp]: |
30630 | 92 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (c * a) / (b * c) = a / b" |
93 |
using nonzero_mult_divide_mult_cancel_left [of b c a] by (simp add: mult_ac) |
|
94 |
||
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
95 |
lemma nonzero_mult_divide_mult_cancel_right2 [simp, no_atp]: |
30630 | 96 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (a * c) / (c * b) = a / b" |
97 |
using nonzero_mult_divide_mult_cancel_right [of b c a] by (simp add: mult_ac) |
|
98 |
||
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
99 |
lemma add_divide_eq_iff [field_simps]: |
30630 | 100 |
"z \<noteq> 0 \<Longrightarrow> x + y / z = (z * x + y) / z" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
101 |
by (simp add: add_divide_distrib) |
30630 | 102 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
103 |
lemma divide_add_eq_iff [field_simps]: |
30630 | 104 |
"z \<noteq> 0 \<Longrightarrow> x / z + y = (x + z * y) / z" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
105 |
by (simp add: add_divide_distrib) |
30630 | 106 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
107 |
lemma diff_divide_eq_iff [field_simps]: |
30630 | 108 |
"z \<noteq> 0 \<Longrightarrow> x - y / z = (z * x - y) / z" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
109 |
by (simp add: diff_divide_distrib) |
30630 | 110 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
111 |
lemma divide_diff_eq_iff [field_simps]: |
30630 | 112 |
"z \<noteq> 0 \<Longrightarrow> x / z - y = (x - z * y) / z" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
113 |
by (simp add: diff_divide_distrib) |
30630 | 114 |
|
115 |
lemma diff_frac_eq: |
|
116 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y - w / z = (x * z - w * y) / (y * z)" |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
117 |
by (simp add: field_simps) |
30630 | 118 |
|
119 |
lemma frac_eq_eq: |
|
120 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (x / y = w / z) = (x * z = w * y)" |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
121 |
by (simp add: field_simps) |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
122 |
|
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
123 |
end |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
124 |
|
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
125 |
class field_inverse_zero = field + |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
126 |
assumes field_inverse_zero: "inverse 0 = 0" |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
127 |
begin |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
128 |
|
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
129 |
subclass division_ring_inverse_zero proof |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
130 |
qed (fact field_inverse_zero) |
25230 | 131 |
|
14270 | 132 |
text{*This version builds in division by zero while also re-orienting |
133 |
the right-hand side.*} |
|
134 |
lemma inverse_mult_distrib [simp]: |
|
36409 | 135 |
"inverse (a * b) = inverse a * inverse b" |
136 |
proof cases |
|
137 |
assume "a \<noteq> 0 & b \<noteq> 0" |
|
138 |
thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_ac) |
|
139 |
next |
|
140 |
assume "~ (a \<noteq> 0 & b \<noteq> 0)" |
|
141 |
thus ?thesis by force |
|
142 |
qed |
|
14270 | 143 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
144 |
lemma inverse_divide [simp]: |
36409 | 145 |
"inverse (a / b) = b / a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
146 |
by (simp add: divide_inverse mult_commute) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
147 |
|
23389 | 148 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
149 |
text {* Calculations with fractions *} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
150 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
151 |
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
|
152 |
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
|
153 |
because the latter are covered by a simproc. *} |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
154 |
|
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
155 |
lemma mult_divide_mult_cancel_left: |
36409 | 156 |
"c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" |
21328 | 157 |
apply (cases "b = 0") |
35216 | 158 |
apply simp_all |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
159 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
160 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
161 |
lemma mult_divide_mult_cancel_right: |
36409 | 162 |
"c \<noteq> 0 \<Longrightarrow> (a * c) / (b * c) = a / b" |
21328 | 163 |
apply (cases "b = 0") |
35216 | 164 |
apply simp_all |
14321 | 165 |
done |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
166 |
|
36409 | 167 |
lemma divide_divide_eq_right [simp, no_atp]: |
168 |
"a / (b / c) = (a * c) / b" |
|
169 |
by (simp add: divide_inverse mult_ac) |
|
14288 | 170 |
|
36409 | 171 |
lemma divide_divide_eq_left [simp, no_atp]: |
172 |
"(a / b) / c = a / (b * c)" |
|
173 |
by (simp add: divide_inverse mult_assoc) |
|
14288 | 174 |
|
23389 | 175 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
176 |
text {*Special Cancellation Simprules for Division*} |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
177 |
|
36409 | 178 |
lemma mult_divide_mult_cancel_left_if [simp,no_atp]: |
179 |
shows "(c * a) / (c * b) = (if c = 0 then 0 else a / b)" |
|
180 |
by (simp add: mult_divide_mult_cancel_left) |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
181 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
182 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
183 |
text {* Division and Unary Minus *} |
14293 | 184 |
|
36409 | 185 |
lemma minus_divide_right: |
186 |
"- (a / b) = a / - b" |
|
187 |
by (simp add: divide_inverse) |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
188 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
189 |
lemma divide_minus_right [simp, no_atp]: |
36409 | 190 |
"a / - b = - (a / b)" |
191 |
by (simp add: divide_inverse) |
|
30630 | 192 |
|
193 |
lemma minus_divide_divide: |
|
36409 | 194 |
"(- a) / (- b) = a / b" |
21328 | 195 |
apply (cases "b=0", simp) |
14293 | 196 |
apply (simp add: nonzero_minus_divide_divide) |
197 |
done |
|
198 |
||
23482 | 199 |
lemma eq_divide_eq: |
36409 | 200 |
"a = b / c \<longleftrightarrow> (if c \<noteq> 0 then a * c = b else a = 0)" |
201 |
by (simp add: nonzero_eq_divide_eq) |
|
23482 | 202 |
|
203 |
lemma divide_eq_eq: |
|
36409 | 204 |
"b / c = a \<longleftrightarrow> (if c \<noteq> 0 then b = a * c else a = 0)" |
205 |
by (force simp add: nonzero_divide_eq_eq) |
|
14293 | 206 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
207 |
lemma inverse_eq_1_iff [simp]: |
36409 | 208 |
"inverse x = 1 \<longleftrightarrow> x = 1" |
209 |
by (insert inverse_eq_iff_eq [of x 1], simp) |
|
23389 | 210 |
|
36409 | 211 |
lemma divide_eq_0_iff [simp, no_atp]: |
212 |
"a / b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" |
|
213 |
by (simp add: divide_inverse) |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
214 |
|
36409 | 215 |
lemma divide_cancel_right [simp, no_atp]: |
216 |
"a / c = b / c \<longleftrightarrow> c = 0 \<or> a = b" |
|
217 |
apply (cases "c=0", simp) |
|
218 |
apply (simp add: divide_inverse) |
|
219 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
220 |
|
36409 | 221 |
lemma divide_cancel_left [simp, no_atp]: |
222 |
"c / a = c / b \<longleftrightarrow> c = 0 \<or> a = b" |
|
223 |
apply (cases "c=0", simp) |
|
224 |
apply (simp add: divide_inverse) |
|
225 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
226 |
|
36409 | 227 |
lemma divide_eq_1_iff [simp, no_atp]: |
228 |
"a / b = 1 \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
|
229 |
apply (cases "b=0", simp) |
|
230 |
apply (simp add: right_inverse_eq) |
|
231 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
232 |
|
36409 | 233 |
lemma one_eq_divide_iff [simp, no_atp]: |
234 |
"1 = a / b \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
|
235 |
by (simp add: eq_commute [of 1]) |
|
236 |
||
237 |
end |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
238 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
239 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
240 |
text {* Ordered Fields *} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
241 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
242 |
class linordered_field = field + linordered_idom |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
243 |
begin |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
244 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
245 |
lemma positive_imp_inverse_positive: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
246 |
assumes a_gt_0: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
247 |
shows "0 < inverse a" |
23482 | 248 |
proof - |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
249 |
have "0 < a * inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
250 |
by (simp add: a_gt_0 [THEN less_imp_not_eq2]) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
251 |
thus "0 < inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
252 |
by (simp add: a_gt_0 [THEN less_not_sym] zero_less_mult_iff) |
23482 | 253 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
254 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
255 |
lemma negative_imp_inverse_negative: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
256 |
"a < 0 \<Longrightarrow> inverse a < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
257 |
by (insert positive_imp_inverse_positive [of "-a"], |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
258 |
simp add: nonzero_inverse_minus_eq less_imp_not_eq) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
259 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
260 |
lemma inverse_le_imp_le: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
261 |
assumes invle: "inverse a \<le> inverse b" and apos: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
262 |
shows "b \<le> a" |
23482 | 263 |
proof (rule classical) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
264 |
assume "~ b \<le> a" |
23482 | 265 |
hence "a < b" by (simp add: linorder_not_le) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
266 |
hence bpos: "0 < b" by (blast intro: apos less_trans) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
267 |
hence "a * inverse a \<le> a * inverse b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
268 |
by (simp add: apos invle less_imp_le mult_left_mono) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
269 |
hence "(a * inverse a) * b \<le> (a * inverse b) * b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
270 |
by (simp add: bpos less_imp_le mult_right_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
271 |
thus "b \<le> a" by (simp add: mult_assoc apos bpos less_imp_not_eq2) |
23482 | 272 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
273 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
274 |
lemma inverse_positive_imp_positive: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
275 |
assumes inv_gt_0: "0 < inverse a" and nz: "a \<noteq> 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
276 |
shows "0 < a" |
23389 | 277 |
proof - |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
278 |
have "0 < inverse (inverse a)" |
23389 | 279 |
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
|
280 |
thus "0 < a" |
23389 | 281 |
using nz by (simp add: nonzero_inverse_inverse_eq) |
282 |
qed |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
283 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
284 |
lemma inverse_negative_imp_negative: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
285 |
assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
286 |
shows "a < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
287 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
288 |
have "inverse (inverse a) < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
289 |
using inv_less_0 by (rule negative_imp_inverse_negative) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
290 |
thus "a < 0" using nz by (simp add: nonzero_inverse_inverse_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
291 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
292 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
293 |
lemma linordered_field_no_lb: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
294 |
"\<forall>x. \<exists>y. y < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
295 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
296 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
297 |
have m1: "- (1::'a) < 0" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
298 |
from add_strict_right_mono[OF m1, where c=x] |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
299 |
have "(- 1) + x < x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
300 |
thus "\<exists>y. y < x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
301 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
302 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
303 |
lemma linordered_field_no_ub: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
304 |
"\<forall> x. \<exists>y. y > x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
305 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
306 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
307 |
have m1: " (1::'a) > 0" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
308 |
from add_strict_right_mono[OF m1, where c=x] |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
309 |
have "1 + x > x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
310 |
thus "\<exists>y. y > x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
311 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
312 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
313 |
lemma less_imp_inverse_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
314 |
assumes less: "a < b" and apos: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
315 |
shows "inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
316 |
proof (rule ccontr) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
317 |
assume "~ inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
318 |
hence "inverse a \<le> inverse b" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
319 |
hence "~ (a < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
320 |
by (simp add: not_less inverse_le_imp_le [OF _ apos]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
321 |
thus False by (rule notE [OF _ less]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
322 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
323 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
324 |
lemma inverse_less_imp_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
325 |
"inverse a < inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
326 |
apply (simp add: less_le [of "inverse a"] less_le [of "b"]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
327 |
apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
328 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
329 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
330 |
text{*Both premises are essential. Consider -1 and 1.*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
331 |
lemma inverse_less_iff_less [simp,no_atp]: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
332 |
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
333 |
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
334 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
335 |
lemma le_imp_inverse_le: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
336 |
"a \<le> b \<Longrightarrow> 0 < a \<Longrightarrow> inverse b \<le> inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
337 |
by (force simp add: le_less less_imp_inverse_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
338 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
339 |
lemma inverse_le_iff_le [simp,no_atp]: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
340 |
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
341 |
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
342 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
343 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
344 |
text{*These results refer to both operands being negative. The opposite-sign |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
345 |
case is trivial, since inverse preserves signs.*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
346 |
lemma inverse_le_imp_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
347 |
"inverse a \<le> inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b \<le> a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
348 |
apply (rule classical) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
349 |
apply (subgoal_tac "a < 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
350 |
prefer 2 apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
351 |
apply (insert inverse_le_imp_le [of "-b" "-a"]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
352 |
apply (simp add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
353 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
354 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
355 |
lemma less_imp_inverse_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
356 |
"a < b \<Longrightarrow> b < 0 \<Longrightarrow> inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
357 |
apply (subgoal_tac "a < 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
358 |
prefer 2 apply (blast intro: less_trans) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
359 |
apply (insert less_imp_inverse_less [of "-b" "-a"]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
360 |
apply (simp add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
361 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
362 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
363 |
lemma inverse_less_imp_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
364 |
"inverse a < inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
365 |
apply (rule classical) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
366 |
apply (subgoal_tac "a < 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
367 |
prefer 2 |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
368 |
apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
369 |
apply (insert inverse_less_imp_less [of "-b" "-a"]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
370 |
apply (simp add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
371 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
372 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
373 |
lemma inverse_less_iff_less_neg [simp,no_atp]: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
374 |
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
375 |
apply (insert inverse_less_iff_less [of "-b" "-a"]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
376 |
apply (simp del: inverse_less_iff_less |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
377 |
add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
378 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
379 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
380 |
lemma le_imp_inverse_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
381 |
"a \<le> b \<Longrightarrow> b < 0 ==> inverse b \<le> inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
382 |
by (force simp add: le_less less_imp_inverse_less_neg) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
383 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
384 |
lemma inverse_le_iff_le_neg [simp,no_atp]: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
385 |
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
386 |
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
387 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
388 |
lemma pos_le_divide_eq [field_simps]: "0 < c ==> (a \<le> b/c) = (a*c \<le> b)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
389 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
390 |
assume less: "0<c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
391 |
hence "(a \<le> b/c) = (a*c \<le> (b/c)*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
392 |
by (simp add: mult_le_cancel_right less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
393 |
also have "... = (a*c \<le> b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
394 |
by (simp add: less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
395 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
396 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
397 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
398 |
lemma neg_le_divide_eq [field_simps]: "c < 0 ==> (a \<le> b/c) = (b \<le> a*c)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
399 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
400 |
assume less: "c<0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
401 |
hence "(a \<le> b/c) = ((b/c)*c \<le> a*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
402 |
by (simp add: mult_le_cancel_right less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
403 |
also have "... = (b \<le> a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
404 |
by (simp add: less_imp_not_eq [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
405 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
406 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
407 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
408 |
lemma pos_less_divide_eq [field_simps]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
409 |
"0 < c ==> (a < b/c) = (a*c < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
410 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
411 |
assume less: "0<c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
412 |
hence "(a < b/c) = (a*c < (b/c)*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
413 |
by (simp add: mult_less_cancel_right_disj less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
414 |
also have "... = (a*c < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
415 |
by (simp add: less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
416 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
417 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
418 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
419 |
lemma neg_less_divide_eq [field_simps]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
420 |
"c < 0 ==> (a < b/c) = (b < a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
421 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
422 |
assume less: "c<0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
423 |
hence "(a < b/c) = ((b/c)*c < a*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
424 |
by (simp add: mult_less_cancel_right_disj less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
425 |
also have "... = (b < a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
426 |
by (simp add: less_imp_not_eq [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
427 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
428 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
429 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
430 |
lemma pos_divide_less_eq [field_simps]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
431 |
"0 < c ==> (b/c < a) = (b < a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
432 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
433 |
assume less: "0<c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
434 |
hence "(b/c < a) = ((b/c)*c < a*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
435 |
by (simp add: mult_less_cancel_right_disj less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
436 |
also have "... = (b < a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
437 |
by (simp add: less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
438 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
439 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
440 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
441 |
lemma neg_divide_less_eq [field_simps]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
442 |
"c < 0 ==> (b/c < a) = (a*c < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
443 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
444 |
assume less: "c<0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
445 |
hence "(b/c < a) = (a*c < (b/c)*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
446 |
by (simp add: mult_less_cancel_right_disj less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
447 |
also have "... = (a*c < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
448 |
by (simp add: less_imp_not_eq [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
449 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
450 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
451 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
452 |
lemma pos_divide_le_eq [field_simps]: "0 < c ==> (b/c \<le> a) = (b \<le> a*c)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
453 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
454 |
assume less: "0<c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
455 |
hence "(b/c \<le> a) = ((b/c)*c \<le> a*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
456 |
by (simp add: mult_le_cancel_right less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
457 |
also have "... = (b \<le> a*c)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
458 |
by (simp add: less_imp_not_eq2 [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
459 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
460 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
461 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
462 |
lemma neg_divide_le_eq [field_simps]: "c < 0 ==> (b/c \<le> a) = (a*c \<le> b)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
463 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
464 |
assume less: "c<0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
465 |
hence "(b/c \<le> a) = (a*c \<le> (b/c)*c)" |
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
466 |
by (simp add: mult_le_cancel_right less_not_sym [OF less] del: times_divide_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
467 |
also have "... = (a*c \<le> b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
468 |
by (simp add: less_imp_not_eq [OF less] divide_inverse mult_assoc) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
469 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
470 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
471 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
472 |
text{* Lemmas @{text sign_simps} is a first attempt to automate proofs |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
473 |
of positivity/negativity needed for @{text field_simps}. Have not added @{text |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
474 |
sign_simps} to @{text field_simps} because the former can lead to case |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
475 |
explosions. *} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
476 |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
477 |
lemmas sign_simps [no_atp] = algebra_simps |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
478 |
zero_less_mult_iff mult_less_0_iff |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
479 |
|
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
480 |
lemmas (in -) sign_simps [no_atp] = algebra_simps |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
481 |
zero_less_mult_iff mult_less_0_iff |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
482 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
483 |
(* Only works once linear arithmetic is installed: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
484 |
text{*An example:*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
485 |
lemma fixes a b c d e f :: "'a::linordered_field" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
486 |
shows "\<lbrakk>a>b; c<d; e<f; 0 < u \<rbrakk> \<Longrightarrow> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
487 |
((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) < |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
488 |
((e-f)*(a-b)*(c-d))/((e-f)*(a-b)*(c-d)) + u" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
489 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b) > 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
490 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
491 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b)*u > 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
492 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
493 |
apply(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
494 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
495 |
*) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
496 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
497 |
lemma divide_pos_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
498 |
"0 < x ==> 0 < y ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
499 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
500 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
501 |
lemma divide_nonneg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
502 |
"0 <= x ==> 0 < y ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
503 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
504 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
505 |
lemma divide_neg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
506 |
"x < 0 ==> 0 < y ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
507 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
508 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
509 |
lemma divide_nonpos_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
510 |
"x <= 0 ==> 0 < y ==> x / y <= 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
511 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
512 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
513 |
lemma divide_pos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
514 |
"0 < x ==> y < 0 ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
515 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
516 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
517 |
lemma divide_nonneg_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
518 |
"0 <= x ==> y < 0 ==> x / y <= 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
519 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
520 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
521 |
lemma divide_neg_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
522 |
"x < 0 ==> y < 0 ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
523 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
524 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
525 |
lemma divide_nonpos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
526 |
"x <= 0 ==> y < 0 ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
527 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
528 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
529 |
lemma divide_strict_right_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
530 |
"[|a < b; 0 < c|] ==> a / c < b / c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
531 |
by (simp add: less_imp_not_eq2 divide_inverse mult_strict_right_mono |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
532 |
positive_imp_inverse_positive) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
533 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
534 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
535 |
lemma divide_strict_right_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
536 |
"[|b < a; c < 0|] ==> a / c < b / c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
537 |
apply (drule divide_strict_right_mono [of _ _ "-c"], simp) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
538 |
apply (simp add: less_imp_not_eq nonzero_minus_divide_right [symmetric]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
539 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
540 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
541 |
text{*The last premise ensures that @{term a} and @{term b} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
542 |
have the same sign*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
543 |
lemma divide_strict_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
544 |
"[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / b" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
545 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_strict_right_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
546 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
547 |
lemma divide_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
548 |
"[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / b" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
549 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_right_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
550 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
551 |
lemma divide_strict_left_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
552 |
"[|a < b; c < 0; 0 < a*b|] ==> c / a < c / b" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
553 |
by(auto simp: field_simps times_divide_eq zero_less_mult_iff mult_strict_right_mono_neg) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
554 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
555 |
lemma mult_imp_div_pos_le: "0 < y ==> x <= z * y ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
556 |
x / y <= z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
557 |
by (subst pos_divide_le_eq, assumption+) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
558 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
559 |
lemma mult_imp_le_div_pos: "0 < y ==> z * y <= x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
560 |
z <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
561 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
562 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
563 |
lemma mult_imp_div_pos_less: "0 < y ==> x < z * y ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
564 |
x / y < z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
565 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
566 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
567 |
lemma mult_imp_less_div_pos: "0 < y ==> z * y < x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
568 |
z < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
569 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
570 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
571 |
lemma frac_le: "0 <= x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
572 |
x <= y ==> 0 < w ==> w <= z ==> x / z <= y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
573 |
apply (rule mult_imp_div_pos_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
574 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
575 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
576 |
apply (rule mult_imp_le_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
577 |
apply (rule mult_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
578 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
579 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
580 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
581 |
lemma frac_less: "0 <= x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
582 |
x < y ==> 0 < w ==> w <= z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
583 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
584 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
585 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
586 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
587 |
apply (erule mult_less_le_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
588 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
589 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
590 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
591 |
lemma frac_less2: "0 < x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
592 |
x <= y ==> 0 < w ==> w < z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
593 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
594 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
595 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
596 |
apply (erule mult_le_less_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
597 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
598 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
599 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
600 |
text{*It's not obvious whether these should be simprules or not. |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
601 |
Their effect is to gather terms into one big fraction, like |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
602 |
a*b*c / x*y*z. The rationale for that is unclear, but many proofs |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
603 |
seem to need them.*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
604 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
605 |
lemma less_half_sum: "a < b ==> a < (a+b) / (1+1)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
606 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
607 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
608 |
lemma gt_half_sum: "a < b ==> (a+b)/(1+1) < b" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
609 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
610 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
611 |
subclass dense_linorder |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
612 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
613 |
fix x y :: 'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
614 |
from less_add_one show "\<exists>y. x < y" .. |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
615 |
from less_add_one have "x + (- 1) < (x + 1) + (- 1)" by (rule add_strict_right_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
616 |
then have "x - 1 < x + 1 - 1" by (simp only: diff_minus [symmetric]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
617 |
then have "x - 1 < x" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
618 |
then show "\<exists>y. y < x" .. |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
619 |
show "x < y \<Longrightarrow> \<exists>z>x. z < y" by (blast intro!: less_half_sum gt_half_sum) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
620 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
621 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
622 |
lemma nonzero_abs_inverse: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
623 |
"a \<noteq> 0 ==> \<bar>inverse a\<bar> = inverse \<bar>a\<bar>" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
624 |
apply (auto simp add: neq_iff abs_if nonzero_inverse_minus_eq |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
625 |
negative_imp_inverse_negative) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
626 |
apply (blast intro: positive_imp_inverse_positive elim: less_asym) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
627 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
628 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
629 |
lemma nonzero_abs_divide: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
630 |
"b \<noteq> 0 ==> \<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
631 |
by (simp add: divide_inverse abs_mult nonzero_abs_inverse) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
632 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
633 |
lemma field_le_epsilon: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
634 |
assumes e: "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
635 |
shows "x \<le> y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
636 |
proof (rule dense_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
637 |
fix t assume "t < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
638 |
hence "0 < x - t" by (simp add: less_diff_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
639 |
from e [OF this] have "x + 0 \<le> x + (y - t)" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
640 |
then have "0 \<le> y - t" by (simp only: add_le_cancel_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
641 |
then show "t \<le> y" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
642 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
643 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
644 |
end |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
645 |
|
36414 | 646 |
class linordered_field_inverse_zero = linordered_field + field_inverse_zero |
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
647 |
begin |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
648 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
649 |
lemma le_divide_eq: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
650 |
"(a \<le> b/c) = |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
651 |
(if 0 < c then a*c \<le> b |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
652 |
else if c < 0 then b \<le> a*c |
36409 | 653 |
else a \<le> 0)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
654 |
apply (cases "c=0", simp) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
655 |
apply (force simp add: pos_le_divide_eq neg_le_divide_eq linorder_neq_iff) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
656 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
657 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
658 |
lemma inverse_positive_iff_positive [simp]: |
36409 | 659 |
"(0 < inverse a) = (0 < a)" |
21328 | 660 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
661 |
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
|
662 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
663 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
664 |
lemma inverse_negative_iff_negative [simp]: |
36409 | 665 |
"(inverse a < 0) = (a < 0)" |
21328 | 666 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
667 |
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
|
668 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
669 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
670 |
lemma inverse_nonnegative_iff_nonnegative [simp]: |
36409 | 671 |
"0 \<le> inverse a \<longleftrightarrow> 0 \<le> a" |
672 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
673 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
674 |
lemma inverse_nonpositive_iff_nonpositive [simp]: |
36409 | 675 |
"inverse a \<le> 0 \<longleftrightarrow> a \<le> 0" |
676 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
677 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
678 |
lemma one_less_inverse_iff: |
36409 | 679 |
"1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1" |
23482 | 680 |
proof cases |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
681 |
assume "0 < x" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
682 |
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
|
683 |
show ?thesis by simp |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
684 |
next |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
685 |
assume notless: "~ (0 < x)" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
686 |
have "~ (1 < inverse x)" |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
687 |
proof |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
688 |
assume "1 < inverse x" |
36409 | 689 |
also with notless have "... \<le> 0" by simp |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
690 |
also have "... < 1" by (rule zero_less_one) |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
691 |
finally show False by auto |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
692 |
qed |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
693 |
with notless show ?thesis by simp |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
694 |
qed |
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
695 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
696 |
lemma one_le_inverse_iff: |
36409 | 697 |
"1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1" |
698 |
proof (cases "x = 1") |
|
699 |
case True then show ?thesis by simp |
|
700 |
next |
|
701 |
case False then have "inverse x \<noteq> 1" by simp |
|
702 |
then have "1 \<noteq> inverse x" by blast |
|
703 |
then have "1 \<le> inverse x \<longleftrightarrow> 1 < inverse x" by (simp add: le_less) |
|
704 |
with False show ?thesis by (auto simp add: one_less_inverse_iff) |
|
705 |
qed |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
706 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
707 |
lemma inverse_less_1_iff: |
36409 | 708 |
"inverse x < 1 \<longleftrightarrow> x \<le> 0 \<or> 1 < x" |
709 |
by (simp add: not_le [symmetric] one_le_inverse_iff) |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
710 |
|
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
711 |
lemma inverse_le_1_iff: |
36409 | 712 |
"inverse x \<le> 1 \<longleftrightarrow> x \<le> 0 \<or> 1 \<le> x" |
713 |
by (simp add: not_less [symmetric] one_less_inverse_iff) |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
714 |
|
14288 | 715 |
lemma divide_le_eq: |
716 |
"(b/c \<le> a) = |
|
717 |
(if 0 < c then b \<le> a*c |
|
718 |
else if c < 0 then a*c \<le> b |
|
36409 | 719 |
else 0 \<le> a)" |
21328 | 720 |
apply (cases "c=0", simp) |
36409 | 721 |
apply (force simp add: pos_divide_le_eq neg_divide_le_eq) |
14288 | 722 |
done |
723 |
||
724 |
lemma less_divide_eq: |
|
725 |
"(a < b/c) = |
|
726 |
(if 0 < c then a*c < b |
|
727 |
else if c < 0 then b < a*c |
|
36409 | 728 |
else a < 0)" |
21328 | 729 |
apply (cases "c=0", simp) |
36409 | 730 |
apply (force simp add: pos_less_divide_eq neg_less_divide_eq) |
14288 | 731 |
done |
732 |
||
733 |
lemma divide_less_eq: |
|
734 |
"(b/c < a) = |
|
735 |
(if 0 < c then b < a*c |
|
736 |
else if c < 0 then a*c < b |
|
36409 | 737 |
else 0 < a)" |
21328 | 738 |
apply (cases "c=0", simp) |
36409 | 739 |
apply (force simp add: pos_divide_less_eq neg_divide_less_eq) |
14288 | 740 |
done |
741 |
||
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
742 |
text {*Division and Signs*} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
743 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
744 |
lemma zero_less_divide_iff: |
36409 | 745 |
"(0 < a/b) = (0 < a & 0 < b | a < 0 & b < 0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
746 |
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
|
747 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
748 |
lemma divide_less_0_iff: |
36409 | 749 |
"(a/b < 0) = |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
750 |
(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
|
751 |
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
|
752 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
753 |
lemma zero_le_divide_iff: |
36409 | 754 |
"(0 \<le> a/b) = |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
755 |
(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
|
756 |
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
|
757 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
758 |
lemma divide_le_0_iff: |
36409 | 759 |
"(a/b \<le> 0) = |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
760 |
(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
|
761 |
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
|
762 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
763 |
text {* Division and the Number One *} |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
764 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
765 |
text{*Simplify expressions equated with 1*} |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
766 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
767 |
lemma zero_eq_1_divide_iff [simp,no_atp]: |
36409 | 768 |
"(0 = 1/a) = (a = 0)" |
23482 | 769 |
apply (cases "a=0", simp) |
770 |
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
|
771 |
done |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
772 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
773 |
lemma one_divide_eq_0_iff [simp,no_atp]: |
36409 | 774 |
"(1/a = 0) = (a = 0)" |
23482 | 775 |
apply (cases "a=0", simp) |
776 |
apply (insert zero_neq_one [THEN not_sym]) |
|
777 |
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
|
778 |
done |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
779 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
780 |
text{*Simplify expressions such as @{text "0 < 1/x"} to @{text "0 < x"}*} |
36423 | 781 |
|
782 |
lemma zero_le_divide_1_iff [simp, no_atp]: |
|
783 |
"0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" |
|
784 |
by (simp add: zero_le_divide_iff) |
|
17085 | 785 |
|
36423 | 786 |
lemma zero_less_divide_1_iff [simp, no_atp]: |
787 |
"0 < 1 / a \<longleftrightarrow> 0 < a" |
|
788 |
by (simp add: zero_less_divide_iff) |
|
789 |
||
790 |
lemma divide_le_0_1_iff [simp, no_atp]: |
|
791 |
"1 / a \<le> 0 \<longleftrightarrow> a \<le> 0" |
|
792 |
by (simp add: divide_le_0_iff) |
|
793 |
||
794 |
lemma divide_less_0_1_iff [simp, no_atp]: |
|
795 |
"1 / a < 0 \<longleftrightarrow> a < 0" |
|
796 |
by (simp add: divide_less_0_iff) |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
797 |
|
14293 | 798 |
lemma divide_right_mono: |
36409 | 799 |
"[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/c" |
800 |
by (force simp add: divide_strict_right_mono le_less) |
|
14293 | 801 |
|
36409 | 802 |
lemma divide_right_mono_neg: "a <= b |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
803 |
==> c <= 0 ==> b / c <= a / c" |
23482 | 804 |
apply (drule divide_right_mono [of _ _ "- c"]) |
805 |
apply auto |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
806 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
807 |
|
36409 | 808 |
lemma divide_left_mono_neg: "a <= b |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
809 |
==> 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
|
810 |
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
|
811 |
apply (auto simp add: mult_commute) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
812 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
813 |
|
23482 | 814 |
|
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
815 |
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
|
816 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
817 |
lemma le_divide_eq_1 [no_atp]: |
36409 | 818 |
"(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
819 |
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
|
820 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
821 |
lemma divide_le_eq_1 [no_atp]: |
36409 | 822 |
"(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
823 |
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
|
824 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
825 |
lemma less_divide_eq_1 [no_atp]: |
36409 | 826 |
"(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
827 |
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
|
828 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
829 |
lemma divide_less_eq_1 [no_atp]: |
36409 | 830 |
"(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
831 |
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
|
832 |
|
23389 | 833 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
834 |
text {*Conditional Simplification Rules: No Case Splits*} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
835 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
836 |
lemma le_divide_eq_1_pos [simp,no_atp]: |
36409 | 837 |
"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
|
838 |
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
|
839 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
840 |
lemma le_divide_eq_1_neg [simp,no_atp]: |
36409 | 841 |
"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
|
842 |
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
|
843 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
844 |
lemma divide_le_eq_1_pos [simp,no_atp]: |
36409 | 845 |
"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
|
846 |
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
|
847 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
848 |
lemma divide_le_eq_1_neg [simp,no_atp]: |
36409 | 849 |
"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
|
850 |
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
|
851 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
852 |
lemma less_divide_eq_1_pos [simp,no_atp]: |
36409 | 853 |
"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
|
854 |
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
|
855 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
856 |
lemma less_divide_eq_1_neg [simp,no_atp]: |
36409 | 857 |
"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
|
858 |
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
|
859 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
860 |
lemma divide_less_eq_1_pos [simp,no_atp]: |
36409 | 861 |
"0 < a \<Longrightarrow> (b/a < 1) = (b < a)" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
862 |
by (auto simp add: divide_less_eq) |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
863 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
864 |
lemma divide_less_eq_1_neg [simp,no_atp]: |
36409 | 865 |
"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
|
866 |
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
|
867 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
868 |
lemma eq_divide_eq_1 [simp,no_atp]: |
36409 | 869 |
"(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
|
870 |
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
|
871 |
|
35828
46cfc4b8112e
now use "Named_Thms" for "noatp", and renamed "noatp" to "no_atp"
blanchet
parents:
35579
diff
changeset
|
872 |
lemma divide_eq_eq_1 [simp,no_atp]: |
36409 | 873 |
"(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
|
874 |
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
|
875 |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
876 |
lemma abs_inverse [simp]: |
36409 | 877 |
"\<bar>inverse a\<bar> = |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
878 |
inverse \<bar>a\<bar>" |
21328 | 879 |
apply (cases "a=0", simp) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
880 |
apply (simp add: nonzero_abs_inverse) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
881 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
882 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
883 |
lemma abs_divide [simp]: |
36409 | 884 |
"\<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
21328 | 885 |
apply (cases "b=0", simp) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
886 |
apply (simp add: nonzero_abs_divide) |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
887 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
888 |
|
36409 | 889 |
lemma abs_div_pos: "0 < y ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
890 |
\<bar>x\<bar> / y = \<bar>x / y\<bar>" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
891 |
apply (subst abs_divide) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
892 |
apply (simp add: order_less_imp_le) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
893 |
done |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
894 |
|
35579
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
895 |
lemma field_le_mult_one_interval: |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
896 |
assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
897 |
shows "x \<le> y" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
898 |
proof (cases "0 < x") |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
899 |
assume "0 < x" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
900 |
thus ?thesis |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
901 |
using dense_le_bounded[of 0 1 "y/x"] * |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
902 |
unfolding le_divide_eq if_P[OF `0 < x`] by simp |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
903 |
next |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
904 |
assume "\<not>0 < x" hence "x \<le> 0" by simp |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
905 |
obtain s::'a where s: "0 < s" "s < 1" using dense[of 0 "1\<Colon>'a"] by auto |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
906 |
hence "x \<le> s * x" using mult_le_cancel_right[of 1 x s] `x \<le> 0` by auto |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
907 |
also note *[OF s] |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
908 |
finally show ?thesis . |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
909 |
qed |
35090
88cc65ae046e
moved lemma field_le_epsilon from Real.thy to Fields.thy
haftmann
parents:
35084
diff
changeset
|
910 |
|
36409 | 911 |
end |
912 |
||
33364 | 913 |
code_modulename SML |
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
914 |
Fields Arith |
33364 | 915 |
|
916 |
code_modulename OCaml |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
917 |
Fields Arith |
33364 | 918 |
|
919 |
code_modulename Haskell |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
920 |
Fields Arith |
33364 | 921 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
922 |
end |