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