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