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