author | haftmann |
Tue, 09 Apr 2019 16:59:00 +0000 | |
changeset 70094 | a93e6472ac9c |
parent 69791 | 195aeee8b30a |
child 70147 | 1657688a6406 |
permissions | -rw-r--r-- |
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
1 |
(* Title: HOL/Fields.thy |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
2 |
Author: Gertrud Bauer |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
3 |
Author: Steven Obua |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
4 |
Author: Tobias Nipkow |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
5 |
Author: Lawrence C Paulson |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
6 |
Author: Markus Wenzel |
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
30961
diff
changeset
|
7 |
Author: Jeremy Avigad |
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
8 |
*) |
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
9 |
|
60758 | 10 |
section \<open>Fields\<close> |
25152 | 11 |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
12 |
theory Fields |
62481
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
13 |
imports Nat |
25186 | 14 |
begin |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
15 |
|
69502 | 16 |
context idom |
17 |
begin |
|
18 |
||
19 |
lemma inj_mult_left [simp]: \<open>inj ((*) a) \<longleftrightarrow> a \<noteq> 0\<close> (is \<open>?P \<longleftrightarrow> ?Q\<close>) |
|
20 |
proof |
|
21 |
assume ?P |
|
22 |
show ?Q |
|
23 |
proof |
|
24 |
assume \<open>a = 0\<close> |
|
25 |
with \<open>?P\<close> have "inj ((*) 0)" |
|
26 |
by simp |
|
27 |
moreover have "0 * 0 = 0 * 1" |
|
28 |
by simp |
|
29 |
ultimately have "0 = 1" |
|
30 |
by (rule injD) |
|
31 |
then show False |
|
32 |
by simp |
|
33 |
qed |
|
34 |
next |
|
35 |
assume ?Q then show ?P |
|
36 |
by (auto intro: injI) |
|
37 |
qed |
|
38 |
||
39 |
end |
|
40 |
||
41 |
||
60758 | 42 |
subsection \<open>Division rings\<close> |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
43 |
|
60758 | 44 |
text \<open> |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
45 |
A division ring is like a field, but without the commutativity requirement. |
60758 | 46 |
\<close> |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
47 |
|
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
59867
diff
changeset
|
48 |
class inverse = divide + |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
49 |
fixes inverse :: "'a \<Rightarrow> 'a" |
58776
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents:
58512
diff
changeset
|
50 |
begin |
60352
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
59867
diff
changeset
|
51 |
|
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
59867
diff
changeset
|
52 |
abbreviation inverse_divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "'/" 70) |
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
59867
diff
changeset
|
53 |
where |
d46de31a50c4
separate class for division operator, with particular syntax added in more specific classes
haftmann
parents:
59867
diff
changeset
|
54 |
"inverse_divide \<equiv> divide" |
58776
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents:
58512
diff
changeset
|
55 |
|
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents:
58512
diff
changeset
|
56 |
end |
95e58e04e534
use NO_MATCH-simproc for distribution rules in field_simps, otherwise field_simps on '(a / (c + d)) * (e + f)' can be non-terminating
hoelzl
parents:
58512
diff
changeset
|
57 |
|
62481
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
58 |
text \<open>Setup for linear arithmetic prover\<close> |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
59 |
|
69605 | 60 |
ML_file \<open>~~/src/Provers/Arith/fast_lin_arith.ML\<close> |
61 |
ML_file \<open>Tools/lin_arith.ML\<close> |
|
62481
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
62 |
setup \<open>Lin_Arith.global_setup\<close> |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
63 |
declaration \<open>K Lin_Arith.setup\<close> |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
64 |
|
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
65 |
simproc_setup fast_arith_nat ("(m::nat) < n" | "(m::nat) \<le> n" | "(m::nat) = n") = |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
66 |
\<open>K Lin_Arith.simproc\<close> |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
67 |
(* Because of this simproc, the arithmetic solver is really only |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
68 |
useful to detect inconsistencies among the premises for subgoals which are |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
69 |
*not* themselves (in)equalities, because the latter activate |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
70 |
fast_nat_arith_simproc anyway. However, it seems cheaper to activate the |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
71 |
solver all the time rather than add the additional check. *) |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
72 |
|
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
73 |
lemmas [arith_split] = nat_diff_split split_min split_max |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
74 |
|
67969
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
75 |
context linordered_nonzero_semiring |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
76 |
begin |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
77 |
lemma of_nat_max: "of_nat (max x y) = max (of_nat x) (of_nat y)" |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
78 |
by (auto simp: max_def) |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
79 |
|
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
80 |
lemma of_nat_min: "of_nat (min x y) = min (of_nat x) (of_nat y)" |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
81 |
by (auto simp: min_def) |
83c8cafdebe8
Syntax for the special cases Min(A`I) and Max (A`I)
paulson <lp15@cam.ac.uk>
parents:
67091
diff
changeset
|
82 |
end |
62481
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
83 |
|
61799 | 84 |
text\<open>Lemmas \<open>divide_simps\<close> move division to the outside and eliminates them on (in)equalities.\<close> |
56481 | 85 |
|
57950 | 86 |
named_theorems divide_simps "rewrite rules to eliminate divisions" |
56481 | 87 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
88 |
class division_ring = ring_1 + inverse + |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
89 |
assumes left_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
90 |
assumes right_inverse [simp]: "a \<noteq> 0 \<Longrightarrow> a * inverse a = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
91 |
assumes divide_inverse: "a / b = a * inverse b" |
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
92 |
assumes inverse_zero [simp]: "inverse 0 = 0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
93 |
begin |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
94 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
95 |
subclass ring_1_no_zero_divisors |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
96 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
97 |
fix a b :: 'a |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
98 |
assume a: "a \<noteq> 0" and b: "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
99 |
show "a * b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
100 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
101 |
assume ab: "a * b = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
102 |
hence "0 = inverse a * (a * b) * inverse b" by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
103 |
also have "\<dots> = (inverse a * a) * (b * inverse b)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
104 |
by (simp only: mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
105 |
also have "\<dots> = 1" using a b by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
106 |
finally show False by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
107 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
108 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
109 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
110 |
lemma nonzero_imp_inverse_nonzero: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
111 |
"a \<noteq> 0 \<Longrightarrow> inverse a \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
112 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
113 |
assume ianz: "inverse a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
114 |
assume "a \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
115 |
hence "1 = a * inverse a" by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
116 |
also have "... = 0" by (simp add: ianz) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
117 |
finally have "1 = 0" . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
118 |
thus False by (simp add: eq_commute) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
119 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
120 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
121 |
lemma inverse_zero_imp_zero: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
122 |
"inverse a = 0 \<Longrightarrow> a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
123 |
apply (rule classical) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
124 |
apply (drule nonzero_imp_inverse_nonzero) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
125 |
apply auto |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
126 |
done |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
127 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
128 |
lemma inverse_unique: |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
129 |
assumes ab: "a * b = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
130 |
shows "inverse a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
131 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
132 |
have "a \<noteq> 0" using ab by (cases "a = 0") simp_all |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
133 |
moreover have "inverse a * (a * b) = inverse a" by (simp add: ab) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
134 |
ultimately show ?thesis by (simp add: mult.assoc [symmetric]) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
135 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
136 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
137 |
lemma nonzero_inverse_minus_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
138 |
"a \<noteq> 0 \<Longrightarrow> inverse (- a) = - inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
139 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
140 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
141 |
lemma nonzero_inverse_inverse_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
142 |
"a \<noteq> 0 \<Longrightarrow> inverse (inverse a) = a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
143 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
144 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
145 |
lemma nonzero_inverse_eq_imp_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
146 |
assumes "inverse a = inverse b" and "a \<noteq> 0" and "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
147 |
shows "a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
148 |
proof - |
60758 | 149 |
from \<open>inverse a = inverse b\<close> |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
150 |
have "inverse (inverse a) = inverse (inverse b)" by (rule arg_cong) |
60758 | 151 |
with \<open>a \<noteq> 0\<close> and \<open>b \<noteq> 0\<close> show "a = b" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
152 |
by (simp add: nonzero_inverse_inverse_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
153 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
154 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
155 |
lemma inverse_1 [simp]: "inverse 1 = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
156 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
157 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
158 |
lemma nonzero_inverse_mult_distrib: |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
159 |
assumes "a \<noteq> 0" and "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
160 |
shows "inverse (a * b) = inverse b * inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
161 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
162 |
have "a * (b * inverse b) * inverse a = 1" using assms by simp |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
163 |
hence "a * b * (inverse b * inverse a) = 1" by (simp only: mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
164 |
thus ?thesis by (rule inverse_unique) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
165 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
166 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
167 |
lemma division_ring_inverse_add: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
168 |
"a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a + inverse b = inverse a * (a + b) * inverse b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
169 |
by (simp add: algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
170 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
171 |
lemma division_ring_inverse_diff: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
172 |
"a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a - inverse b = inverse a * (b - a) * inverse b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
173 |
by (simp add: algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
174 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
175 |
lemma right_inverse_eq: "b \<noteq> 0 \<Longrightarrow> a / b = 1 \<longleftrightarrow> a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
176 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
177 |
assume neq: "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
178 |
{ |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
179 |
hence "a = (a / b) * b" by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
180 |
also assume "a / b = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
181 |
finally show "a = b" by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
182 |
next |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
183 |
assume "a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
184 |
with neq show "a / b = 1" by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
185 |
} |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
186 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
187 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
188 |
lemma nonzero_inverse_eq_divide: "a \<noteq> 0 \<Longrightarrow> inverse a = 1 / a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
189 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
190 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
191 |
lemma divide_self [simp]: "a \<noteq> 0 \<Longrightarrow> a / a = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
192 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
193 |
|
56481 | 194 |
lemma inverse_eq_divide [field_simps, divide_simps]: "inverse a = 1 / a" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
195 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
196 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
197 |
lemma add_divide_distrib: "(a+b) / c = a/c + b/c" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
198 |
by (simp add: divide_inverse algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
199 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
200 |
lemma times_divide_eq_right [simp]: "a * (b / c) = (a * b) / c" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
201 |
by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
202 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
203 |
lemma minus_divide_left: "- (a / b) = (-a) / b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
204 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
205 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
206 |
lemma nonzero_minus_divide_right: "b \<noteq> 0 ==> - (a / b) = a / (- b)" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
207 |
by (simp add: divide_inverse nonzero_inverse_minus_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
208 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
209 |
lemma nonzero_minus_divide_divide: "b \<noteq> 0 ==> (-a) / (-b) = a / b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
210 |
by (simp add: divide_inverse nonzero_inverse_minus_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
211 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
212 |
lemma divide_minus_left [simp]: "(-a) / b = - (a / b)" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
213 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
214 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
215 |
lemma diff_divide_distrib: "(a - b) / c = a / c - b / c" |
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
216 |
using add_divide_distrib [of a "- b" c] by simp |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
217 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
218 |
lemma nonzero_eq_divide_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> a = b / c \<longleftrightarrow> a * c = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
219 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
220 |
assume [simp]: "c \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
221 |
have "a = b / c \<longleftrightarrow> a * c = (b / c) * c" by simp |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
222 |
also have "... \<longleftrightarrow> a * c = b" by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
223 |
finally show ?thesis . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
224 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
225 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
226 |
lemma nonzero_divide_eq_eq [field_simps]: "c \<noteq> 0 \<Longrightarrow> b / c = a \<longleftrightarrow> b = a * c" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
227 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
228 |
assume [simp]: "c \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
229 |
have "b / c = a \<longleftrightarrow> (b / c) * c = a * c" by simp |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
230 |
also have "... \<longleftrightarrow> b = a * c" by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
231 |
finally show ?thesis . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
232 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
233 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
234 |
lemma nonzero_neg_divide_eq_eq [field_simps]: "b \<noteq> 0 \<Longrightarrow> - (a / b) = c \<longleftrightarrow> - a = c * b" |
59535 | 235 |
using nonzero_divide_eq_eq[of b "-a" c] by simp |
56441 | 236 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
237 |
lemma nonzero_neg_divide_eq_eq2 [field_simps]: "b \<noteq> 0 \<Longrightarrow> c = - (a / b) \<longleftrightarrow> c * b = - a" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
238 |
using nonzero_neg_divide_eq_eq[of b a c] by auto |
56441 | 239 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
240 |
lemma divide_eq_imp: "c \<noteq> 0 \<Longrightarrow> b = a * c \<Longrightarrow> b / c = a" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
241 |
by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
242 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
243 |
lemma eq_divide_imp: "c \<noteq> 0 \<Longrightarrow> a * c = b \<Longrightarrow> a = b / c" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
244 |
by (drule sym) (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
245 |
|
56445 | 246 |
lemma add_divide_eq_iff [field_simps]: |
247 |
"z \<noteq> 0 \<Longrightarrow> x + y / z = (x * z + y) / z" |
|
248 |
by (simp add: add_divide_distrib nonzero_eq_divide_eq) |
|
249 |
||
250 |
lemma divide_add_eq_iff [field_simps]: |
|
251 |
"z \<noteq> 0 \<Longrightarrow> x / z + y = (x + y * z) / z" |
|
252 |
by (simp add: add_divide_distrib nonzero_eq_divide_eq) |
|
253 |
||
254 |
lemma diff_divide_eq_iff [field_simps]: |
|
255 |
"z \<noteq> 0 \<Longrightarrow> x - y / z = (x * z - y) / z" |
|
256 |
by (simp add: diff_divide_distrib nonzero_eq_divide_eq eq_diff_eq) |
|
257 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
258 |
lemma minus_divide_add_eq_iff [field_simps]: |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
259 |
"z \<noteq> 0 \<Longrightarrow> - (x / z) + y = (- x + y * z) / z" |
59535 | 260 |
by (simp add: add_divide_distrib diff_divide_eq_iff) |
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
261 |
|
56445 | 262 |
lemma divide_diff_eq_iff [field_simps]: |
263 |
"z \<noteq> 0 \<Longrightarrow> x / z - y = (x - y * z) / z" |
|
264 |
by (simp add: field_simps) |
|
265 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
266 |
lemma minus_divide_diff_eq_iff [field_simps]: |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
267 |
"z \<noteq> 0 \<Longrightarrow> - (x / z) - y = (- x - y * z) / z" |
59535 | 268 |
by (simp add: divide_diff_eq_iff[symmetric]) |
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
269 |
|
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
270 |
lemma division_ring_divide_zero [simp]: |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
271 |
"a / 0 = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
272 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
273 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
274 |
lemma divide_self_if [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
275 |
"a / a = (if a = 0 then 0 else 1)" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
276 |
by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
277 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
278 |
lemma inverse_nonzero_iff_nonzero [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
279 |
"inverse a = 0 \<longleftrightarrow> a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
280 |
by rule (fact inverse_zero_imp_zero, simp) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
281 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
282 |
lemma inverse_minus_eq [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
283 |
"inverse (- a) = - inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
284 |
proof cases |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
285 |
assume "a=0" thus ?thesis by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
286 |
next |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
287 |
assume "a\<noteq>0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
288 |
thus ?thesis by (simp add: nonzero_inverse_minus_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
289 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
290 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
291 |
lemma inverse_inverse_eq [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
292 |
"inverse (inverse a) = a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
293 |
proof cases |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
294 |
assume "a=0" thus ?thesis by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
295 |
next |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
296 |
assume "a\<noteq>0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
297 |
thus ?thesis by (simp add: nonzero_inverse_inverse_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
298 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
299 |
|
44680 | 300 |
lemma inverse_eq_imp_eq: |
301 |
"inverse a = inverse b \<Longrightarrow> a = b" |
|
302 |
by (drule arg_cong [where f="inverse"], simp) |
|
303 |
||
304 |
lemma inverse_eq_iff_eq [simp]: |
|
305 |
"inverse a = inverse b \<longleftrightarrow> a = b" |
|
306 |
by (force dest!: inverse_eq_imp_eq) |
|
307 |
||
69791
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
308 |
lemma mult_commute_imp_mult_inverse_commute: |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
309 |
assumes "y * x = x * y" |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
310 |
shows "inverse y * x = x * inverse y" |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
311 |
proof (cases "y=0") |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
312 |
case False |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
313 |
hence "x * inverse y = inverse y * y * x * inverse y" |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
314 |
by simp |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
315 |
also have "\<dots> = inverse y * (x * y * inverse y)" |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
316 |
by (simp add: mult.assoc assms) |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
317 |
finally show ?thesis by (simp add: mult.assoc False) |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
318 |
qed simp |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
319 |
|
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
320 |
lemmas mult_inverse_of_nat_commute = |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
321 |
mult_commute_imp_mult_inverse_commute[OF mult_of_nat_commute] |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
322 |
|
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
323 |
lemma divide_divide_eq_left': |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
324 |
"(a / b) / c = a / (c * b)" |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
325 |
by (cases "b = 0 \<or> c = 0") |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
326 |
(auto simp: divide_inverse mult.assoc nonzero_inverse_mult_distrib) |
195aeee8b30a
Formal Laurent series and overhaul of Formal power series (due to Jeremy Sylvestre)
Manuel Eberl <eberlm@in.tum.de>
parents:
69605
diff
changeset
|
327 |
|
56481 | 328 |
lemma add_divide_eq_if_simps [divide_simps]: |
329 |
"a + b / z = (if z = 0 then a else (a * z + b) / z)" |
|
330 |
"a / z + b = (if z = 0 then b else (a + b * z) / z)" |
|
331 |
"- (a / z) + b = (if z = 0 then b else (-a + b * z) / z)" |
|
332 |
"a - b / z = (if z = 0 then a else (a * z - b) / z)" |
|
333 |
"a / z - b = (if z = 0 then -b else (a - b * z) / z)" |
|
334 |
"- (a / z) - b = (if z = 0 then -b else (- a - b * z) / z)" |
|
335 |
by (simp_all add: add_divide_eq_iff divide_add_eq_iff diff_divide_eq_iff divide_diff_eq_iff |
|
336 |
minus_divide_diff_eq_iff) |
|
337 |
||
338 |
lemma [divide_simps]: |
|
339 |
shows divide_eq_eq: "b / c = a \<longleftrightarrow> (if c \<noteq> 0 then b = a * c else a = 0)" |
|
340 |
and eq_divide_eq: "a = b / c \<longleftrightarrow> (if c \<noteq> 0 then a * c = b else a = 0)" |
|
341 |
and minus_divide_eq_eq: "- (b / c) = a \<longleftrightarrow> (if c \<noteq> 0 then - b = a * c else a = 0)" |
|
342 |
and eq_minus_divide_eq: "a = - (b / c) \<longleftrightarrow> (if c \<noteq> 0 then a * c = - b else a = 0)" |
|
343 |
by (auto simp add: field_simps) |
|
344 |
||
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
345 |
end |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
346 |
|
60758 | 347 |
subsection \<open>Fields\<close> |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
348 |
|
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
349 |
class field = comm_ring_1 + inverse + |
35084 | 350 |
assumes field_inverse: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
351 |
assumes field_divide_inverse: "a / b = a * inverse b" |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
352 |
assumes field_inverse_zero: "inverse 0 = 0" |
25267 | 353 |
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
|
354 |
|
25267 | 355 |
subclass division_ring |
28823 | 356 |
proof |
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
357 |
fix a :: 'a |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
358 |
assume "a \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
359 |
thus "inverse a * a = 1" by (rule field_inverse) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
360 |
thus "a * inverse a = 1" by (simp only: mult.commute) |
35084 | 361 |
next |
362 |
fix a b :: 'a |
|
363 |
show "a / b = a * inverse b" by (rule field_divide_inverse) |
|
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
364 |
next |
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
365 |
show "inverse 0 = 0" |
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
366 |
by (fact field_inverse_zero) |
14738 | 367 |
qed |
25230 | 368 |
|
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
369 |
subclass idom_divide |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
370 |
proof |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
371 |
fix b a |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
372 |
assume "b \<noteq> 0" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
373 |
then show "a * b / b = a" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
374 |
by (simp add: divide_inverse ac_simps) |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
375 |
next |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
376 |
fix a |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
377 |
show "a / 0 = 0" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
378 |
by (simp add: divide_inverse) |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
379 |
qed |
25230 | 380 |
|
70094 | 381 |
subclass idom_divide_cancel |
382 |
proof |
|
383 |
fix a b c |
|
384 |
assume [simp]: "c \<noteq> 0" |
|
385 |
show "(c * a) / (c * b) = a / b" |
|
386 |
proof (cases "b = 0") |
|
387 |
case True then show ?thesis |
|
388 |
by simp |
|
389 |
next |
|
390 |
case False |
|
391 |
then have "(c * a) / (c * b) = c * a * (inverse b * inverse c)" |
|
392 |
by (simp add: divide_inverse nonzero_inverse_mult_distrib) |
|
393 |
also have "... = a * inverse b * (inverse c * c)" |
|
394 |
by (simp only: ac_simps) |
|
395 |
also have "... = a * inverse b" by simp |
|
396 |
finally show ?thesis by (simp add: divide_inverse) |
|
397 |
qed |
|
398 |
next |
|
399 |
fix a b c |
|
400 |
assume "b \<noteq> 0" |
|
401 |
have "((a * inverse b) * b + c * b) = (c + a * inverse b) * b" |
|
402 |
using distrib [of c "a * inverse b" b] by (simp add: ac_simps) |
|
403 |
also have "(a * inverse b) * b = a" |
|
404 |
using \<open>b \<noteq> 0\<close> by (simp add: ac_simps) |
|
405 |
finally show "(a + c * b) / b = c + a / b" |
|
406 |
using \<open>b \<noteq> 0\<close> by (simp add: ac_simps divide_inverse [symmetric]) |
|
407 |
qed |
|
408 |
||
409 |
lemmas nonzero_mult_divide_mult_cancel_left = div_mult_mult1 \<comment> \<open>duplicate\<close> |
|
410 |
lemmas nonzero_mult_divide_mult_cancel_right = div_mult_mult2 \<comment> \<open>duplicate\<close> |
|
411 |
||
60758 | 412 |
text\<open>There is no slick version using division by zero.\<close> |
30630 | 413 |
lemma inverse_add: |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
414 |
"a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> inverse a + inverse b = (a + b) * inverse a * inverse b" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
415 |
by (simp add: division_ring_inverse_add ac_simps) |
30630 | 416 |
|
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
417 |
lemma times_divide_eq_left [simp]: "(b / c) * a = (b * a) / c" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
418 |
by (simp add: divide_inverse ac_simps) |
30630 | 419 |
|
61238
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
420 |
lemma divide_inverse_commute: "a / b = inverse b * a" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
421 |
by (simp add: divide_inverse mult.commute) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
422 |
|
30630 | 423 |
lemma add_frac_eq: |
424 |
assumes "y \<noteq> 0" and "z \<noteq> 0" |
|
425 |
shows "x / y + w / z = (x * z + w * y) / (y * z)" |
|
426 |
proof - |
|
427 |
have "x / y + w / z = (x * z) / (y * z) + (y * w) / (y * z)" |
|
428 |
using assms by simp |
|
429 |
also have "\<dots> = (x * z + y * w) / (y * z)" |
|
430 |
by (simp only: add_divide_distrib) |
|
431 |
finally show ?thesis |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
432 |
by (simp only: mult.commute) |
30630 | 433 |
qed |
434 |
||
60758 | 435 |
text\<open>Special Cancellation Simprules for Division\<close> |
30630 | 436 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
437 |
lemma nonzero_divide_mult_cancel_right [simp]: |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
438 |
"b \<noteq> 0 \<Longrightarrow> b / (a * b) = 1 / a" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
439 |
using nonzero_mult_divide_mult_cancel_right [of b 1 a] by simp |
30630 | 440 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
441 |
lemma nonzero_divide_mult_cancel_left [simp]: |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
442 |
"a \<noteq> 0 \<Longrightarrow> a / (a * b) = 1 / b" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
443 |
using nonzero_mult_divide_mult_cancel_left [of a 1 b] by simp |
30630 | 444 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
445 |
lemma nonzero_mult_divide_mult_cancel_left2 [simp]: |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
446 |
"c \<noteq> 0 \<Longrightarrow> (c * a) / (b * c) = a / b" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
447 |
using nonzero_mult_divide_mult_cancel_left [of c a b] by (simp add: ac_simps) |
30630 | 448 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
449 |
lemma nonzero_mult_divide_mult_cancel_right2 [simp]: |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
450 |
"c \<noteq> 0 \<Longrightarrow> (a * c) / (c * b) = a / b" |
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
451 |
using nonzero_mult_divide_mult_cancel_right [of b c a] by (simp add: ac_simps) |
30630 | 452 |
|
453 |
lemma diff_frac_eq: |
|
454 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y - w / z = (x * z - w * y) / (y * z)" |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
455 |
by (simp add: field_simps) |
30630 | 456 |
|
457 |
lemma frac_eq_eq: |
|
458 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> (x / y = w / z) = (x * z = w * y)" |
|
36348
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
459 |
by (simp add: field_simps) |
89c54f51f55a
dropped group_simps, ring_simps, field_eq_simps; classes division_ring_inverse_zero, field_inverse_zero, linordered_field_inverse_zero
haftmann
parents:
36343
diff
changeset
|
460 |
|
58512
dc4d76dfa8f0
moved lemmas out of Int.thy which have nothing to do with int
haftmann
parents:
57950
diff
changeset
|
461 |
lemma divide_minus1 [simp]: "x / - 1 = - x" |
dc4d76dfa8f0
moved lemmas out of Int.thy which have nothing to do with int
haftmann
parents:
57950
diff
changeset
|
462 |
using nonzero_minus_divide_right [of "1" x] by simp |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
463 |
|
60758 | 464 |
text\<open>This version builds in division by zero while also re-orienting |
465 |
the right-hand side.\<close> |
|
14270 | 466 |
lemma inverse_mult_distrib [simp]: |
36409 | 467 |
"inverse (a * b) = inverse a * inverse b" |
468 |
proof cases |
|
67091 | 469 |
assume "a \<noteq> 0 \<and> b \<noteq> 0" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
470 |
thus ?thesis by (simp add: nonzero_inverse_mult_distrib ac_simps) |
36409 | 471 |
next |
67091 | 472 |
assume "\<not> (a \<noteq> 0 \<and> b \<noteq> 0)" |
36409 | 473 |
thus ?thesis by force |
474 |
qed |
|
14270 | 475 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
476 |
lemma inverse_divide [simp]: |
36409 | 477 |
"inverse (a / b) = b / a" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
478 |
by (simp add: divide_inverse mult.commute) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
479 |
|
23389 | 480 |
|
60758 | 481 |
text \<open>Calculations with fractions\<close> |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
482 |
|
61799 | 483 |
text\<open>There is a whole bunch of simp-rules just for class \<open>field\<close> but none for class \<open>field\<close> and \<open>nonzero_divides\<close> |
60758 | 484 |
because the latter are covered by a simproc.\<close> |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
485 |
|
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
486 |
lemmas mult_divide_mult_cancel_left = nonzero_mult_divide_mult_cancel_left |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
487 |
|
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
488 |
lemmas mult_divide_mult_cancel_right = nonzero_mult_divide_mult_cancel_right |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
489 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
490 |
lemma divide_divide_eq_right [simp]: |
36409 | 491 |
"a / (b / c) = (a * c) / b" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
492 |
by (simp add: divide_inverse ac_simps) |
14288 | 493 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
494 |
lemma divide_divide_eq_left [simp]: |
36409 | 495 |
"(a / b) / c = a / (b * c)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
496 |
by (simp add: divide_inverse mult.assoc) |
14288 | 497 |
|
56365
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
498 |
lemma divide_divide_times_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
499 |
"(x / y) / (z / w) = (x * w) / (y * z)" |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
500 |
by simp |
23389 | 501 |
|
60758 | 502 |
text \<open>Special Cancellation Simprules for Division\<close> |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
503 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
504 |
lemma mult_divide_mult_cancel_left_if [simp]: |
36409 | 505 |
shows "(c * a) / (c * b) = (if c = 0 then 0 else a / b)" |
60353
838025c6e278
implicit partial divison operation in integral domains
haftmann
parents:
60352
diff
changeset
|
506 |
by simp |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
507 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
508 |
|
60758 | 509 |
text \<open>Division and Unary Minus\<close> |
14293 | 510 |
|
36409 | 511 |
lemma minus_divide_right: |
512 |
"- (a / b) = a / - b" |
|
513 |
by (simp add: divide_inverse) |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
514 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
515 |
lemma divide_minus_right [simp]: |
36409 | 516 |
"a / - b = - (a / b)" |
517 |
by (simp add: divide_inverse) |
|
30630 | 518 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
519 |
lemma minus_divide_divide: |
36409 | 520 |
"(- a) / (- b) = a / b" |
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
521 |
by (cases "b=0") (simp_all add: nonzero_minus_divide_divide) |
14293 | 522 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
523 |
lemma inverse_eq_1_iff [simp]: |
36409 | 524 |
"inverse x = 1 \<longleftrightarrow> x = 1" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
525 |
by (insert inverse_eq_iff_eq [of x 1], simp) |
23389 | 526 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
527 |
lemma divide_eq_0_iff [simp]: |
36409 | 528 |
"a / b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" |
529 |
by (simp add: divide_inverse) |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
530 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
531 |
lemma divide_cancel_right [simp]: |
36409 | 532 |
"a / c = b / c \<longleftrightarrow> c = 0 \<or> a = b" |
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
533 |
by (cases "c=0") (simp_all add: divide_inverse) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
534 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
535 |
lemma divide_cancel_left [simp]: |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
536 |
"c / a = c / b \<longleftrightarrow> c = 0 \<or> a = b" |
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
537 |
by (cases "c=0") (simp_all add: divide_inverse) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
538 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
539 |
lemma divide_eq_1_iff [simp]: |
36409 | 540 |
"a / b = 1 \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
541 |
by (cases "b=0") (simp_all add: right_inverse_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
542 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
543 |
lemma one_eq_divide_iff [simp]: |
36409 | 544 |
"1 = a / b \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
545 |
by (simp add: eq_commute [of 1]) |
|
546 |
||
65057
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
64591
diff
changeset
|
547 |
lemma divide_eq_minus_1_iff: |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
64591
diff
changeset
|
548 |
"(a / b = - 1) \<longleftrightarrow> b \<noteq> 0 \<and> a = - b" |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
64591
diff
changeset
|
549 |
using divide_eq_1_iff by fastforce |
799bbbb3a395
Some new lemmas thanks to Lukas Bulwahn. Also, NEWS.
paulson <lp15@cam.ac.uk>
parents:
64591
diff
changeset
|
550 |
|
36719 | 551 |
lemma times_divide_times_eq: |
552 |
"(x / y) * (z / w) = (x * z) / (y * w)" |
|
553 |
by simp |
|
554 |
||
555 |
lemma add_frac_num: |
|
556 |
"y \<noteq> 0 \<Longrightarrow> x / y + z = (x + z * y) / y" |
|
557 |
by (simp add: add_divide_distrib) |
|
558 |
||
559 |
lemma add_num_frac: |
|
560 |
"y \<noteq> 0 \<Longrightarrow> z + x / y = (x + z * y) / y" |
|
561 |
by (simp add: add_divide_distrib add.commute) |
|
562 |
||
64591
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
563 |
lemma dvd_field_iff: |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
564 |
"a dvd b \<longleftrightarrow> (a = 0 \<longrightarrow> b = 0)" |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
565 |
proof (cases "a = 0") |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
566 |
case False |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
567 |
then have "b = a * (b / a)" |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
568 |
by (simp add: field_simps) |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
569 |
then have "a dvd b" .. |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
570 |
with False show ?thesis |
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
571 |
by simp |
68527
2f4e2aab190a
Generalising and renaming some basic results
paulson <lp15@cam.ac.uk>
parents:
67969
diff
changeset
|
572 |
qed simp |
64591
240a39af9ec4
restructured matter on polynomials and normalized fractions
haftmann
parents:
64329
diff
changeset
|
573 |
|
69502 | 574 |
lemma inj_divide_right [simp]: |
575 |
"inj (\<lambda>b. b / a) \<longleftrightarrow> a \<noteq> 0" |
|
576 |
proof - |
|
577 |
have "(\<lambda>b. b / a) = (*) (inverse a)" |
|
578 |
by (simp add: field_simps fun_eq_iff) |
|
579 |
then have "inj (\<lambda>y. y / a) \<longleftrightarrow> inj ((*) (inverse a))" |
|
580 |
by simp |
|
581 |
also have "\<dots> \<longleftrightarrow> inverse a \<noteq> 0" |
|
582 |
by simp |
|
583 |
also have "\<dots> \<longleftrightarrow> a \<noteq> 0" |
|
584 |
by simp |
|
585 |
finally show ?thesis |
|
586 |
by simp |
|
587 |
qed |
|
588 |
||
36409 | 589 |
end |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
590 |
|
62481
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
591 |
class field_char_0 = field + ring_char_0 |
b5d8e57826df
tuned bootstrap order to provide type classes in a more sensible order
haftmann
parents:
62347
diff
changeset
|
592 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
593 |
|
60758 | 594 |
subsection \<open>Ordered fields\<close> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
595 |
|
64290 | 596 |
class field_abs_sgn = field + idom_abs_sgn |
597 |
begin |
|
598 |
||
599 |
lemma sgn_inverse [simp]: |
|
600 |
"sgn (inverse a) = inverse (sgn a)" |
|
601 |
proof (cases "a = 0") |
|
602 |
case True then show ?thesis by simp |
|
603 |
next |
|
604 |
case False |
|
605 |
then have "a * inverse a = 1" |
|
606 |
by simp |
|
607 |
then have "sgn (a * inverse a) = sgn 1" |
|
608 |
by simp |
|
609 |
then have "sgn a * sgn (inverse a) = 1" |
|
610 |
by (simp add: sgn_mult) |
|
611 |
then have "inverse (sgn a) * (sgn a * sgn (inverse a)) = inverse (sgn a) * 1" |
|
612 |
by simp |
|
613 |
then have "(inverse (sgn a) * sgn a) * sgn (inverse a) = inverse (sgn a)" |
|
614 |
by (simp add: ac_simps) |
|
615 |
with False show ?thesis |
|
616 |
by (simp add: sgn_eq_0_iff) |
|
617 |
qed |
|
618 |
||
619 |
lemma abs_inverse [simp]: |
|
620 |
"\<bar>inverse a\<bar> = inverse \<bar>a\<bar>" |
|
621 |
proof - |
|
622 |
from sgn_mult_abs [of "inverse a"] sgn_mult_abs [of a] |
|
623 |
have "inverse (sgn a) * \<bar>inverse a\<bar> = inverse (sgn a * \<bar>a\<bar>)" |
|
624 |
by simp |
|
625 |
then show ?thesis by (auto simp add: sgn_eq_0_iff) |
|
626 |
qed |
|
627 |
||
628 |
lemma sgn_divide [simp]: |
|
629 |
"sgn (a / b) = sgn a / sgn b" |
|
630 |
unfolding divide_inverse sgn_mult by simp |
|
631 |
||
632 |
lemma abs_divide [simp]: |
|
633 |
"\<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
|
634 |
unfolding divide_inverse abs_mult by simp |
|
635 |
||
636 |
end |
|
637 |
||
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
638 |
class linordered_field = field + linordered_idom |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
639 |
begin |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
640 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
641 |
lemma positive_imp_inverse_positive: |
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
642 |
assumes a_gt_0: "0 < a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
643 |
shows "0 < inverse a" |
23482 | 644 |
proof - |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
645 |
have "0 < a * inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
646 |
by (simp add: a_gt_0 [THEN less_imp_not_eq2]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
647 |
thus "0 < inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
648 |
by (simp add: a_gt_0 [THEN less_not_sym] zero_less_mult_iff) |
23482 | 649 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
650 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
651 |
lemma negative_imp_inverse_negative: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
652 |
"a < 0 \<Longrightarrow> inverse a < 0" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
653 |
by (insert positive_imp_inverse_positive [of "-a"], |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
654 |
simp add: nonzero_inverse_minus_eq less_imp_not_eq) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
655 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
656 |
lemma inverse_le_imp_le: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
657 |
assumes invle: "inverse a \<le> inverse b" and apos: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
658 |
shows "b \<le> a" |
23482 | 659 |
proof (rule classical) |
67091 | 660 |
assume "\<not> b \<le> a" |
23482 | 661 |
hence "a < b" by (simp add: linorder_not_le) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
662 |
hence bpos: "0 < b" by (blast intro: apos less_trans) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
663 |
hence "a * inverse a \<le> a * inverse b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
664 |
by (simp add: apos invle less_imp_le mult_left_mono) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
665 |
hence "(a * inverse a) * b \<le> (a * inverse b) * b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
666 |
by (simp add: bpos less_imp_le mult_right_mono) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
667 |
thus "b \<le> a" by (simp add: mult.assoc apos bpos less_imp_not_eq2) |
23482 | 668 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
669 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
670 |
lemma inverse_positive_imp_positive: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
671 |
assumes inv_gt_0: "0 < inverse a" and nz: "a \<noteq> 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
672 |
shows "0 < a" |
23389 | 673 |
proof - |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
674 |
have "0 < inverse (inverse a)" |
23389 | 675 |
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
|
676 |
thus "0 < a" |
23389 | 677 |
using nz by (simp add: nonzero_inverse_inverse_eq) |
678 |
qed |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
679 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
680 |
lemma inverse_negative_imp_negative: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
681 |
assumes inv_less_0: "inverse a < 0" and nz: "a \<noteq> 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
682 |
shows "a < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
683 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
684 |
have "inverse (inverse a) < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
685 |
using inv_less_0 by (rule negative_imp_inverse_negative) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
686 |
thus "a < 0" using nz by (simp add: nonzero_inverse_inverse_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
687 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
688 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
689 |
lemma linordered_field_no_lb: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
690 |
"\<forall>x. \<exists>y. y < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
691 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
692 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
693 |
have m1: "- (1::'a) < 0" by simp |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
694 |
from add_strict_right_mono[OF m1, where c=x] |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
695 |
have "(- 1) + x < x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
696 |
thus "\<exists>y. y < x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
697 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
698 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
699 |
lemma linordered_field_no_ub: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
700 |
"\<forall> x. \<exists>y. y > x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
701 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
702 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
703 |
have m1: " (1::'a) > 0" by simp |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
704 |
from add_strict_right_mono[OF m1, where c=x] |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
705 |
have "1 + x > x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
706 |
thus "\<exists>y. y > x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
707 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
708 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
709 |
lemma less_imp_inverse_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
710 |
assumes less: "a < b" and apos: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
711 |
shows "inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
712 |
proof (rule ccontr) |
67091 | 713 |
assume "\<not> inverse b < inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
714 |
hence "inverse a \<le> inverse b" by simp |
67091 | 715 |
hence "\<not> (a < b)" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
716 |
by (simp add: not_less inverse_le_imp_le [OF _ apos]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
717 |
thus False by (rule notE [OF _ less]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
718 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
719 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
720 |
lemma inverse_less_imp_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
721 |
"inverse a < inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
722 |
apply (simp add: less_le [of "inverse a"] less_le [of "b"]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
723 |
apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
724 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
725 |
|
60758 | 726 |
text\<open>Both premises are essential. Consider -1 and 1.\<close> |
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
727 |
lemma inverse_less_iff_less [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
728 |
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
729 |
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
730 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
731 |
lemma le_imp_inverse_le: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
732 |
"a \<le> b \<Longrightarrow> 0 < a \<Longrightarrow> inverse b \<le> inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
733 |
by (force simp add: le_less less_imp_inverse_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
734 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
735 |
lemma inverse_le_iff_le [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
736 |
"0 < a \<Longrightarrow> 0 < b \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
737 |
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
738 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
739 |
|
60758 | 740 |
text\<open>These results refer to both operands being negative. The opposite-sign |
741 |
case is trivial, since inverse preserves signs.\<close> |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
742 |
lemma inverse_le_imp_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
743 |
"inverse a \<le> inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b \<le> a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
744 |
apply (rule classical) |
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
745 |
apply (subgoal_tac "a < 0") |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
746 |
prefer 2 apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
747 |
apply (insert inverse_le_imp_le [of "-b" "-a"]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
748 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
749 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
750 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
751 |
lemma less_imp_inverse_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
752 |
"a < b \<Longrightarrow> b < 0 \<Longrightarrow> inverse b < inverse a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
753 |
apply (subgoal_tac "a < 0") |
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
754 |
prefer 2 apply (blast intro: less_trans) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
755 |
apply (insert less_imp_inverse_less [of "-b" "-a"]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
756 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
757 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
758 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
759 |
lemma inverse_less_imp_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
760 |
"inverse a < inverse b \<Longrightarrow> b < 0 \<Longrightarrow> b < a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
761 |
apply (rule classical) |
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
762 |
apply (subgoal_tac "a < 0") |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
763 |
prefer 2 |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
764 |
apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
765 |
apply (insert inverse_less_imp_less [of "-b" "-a"]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
766 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
767 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
768 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
769 |
lemma inverse_less_iff_less_neg [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
770 |
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a < inverse b \<longleftrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
771 |
apply (insert inverse_less_iff_less [of "-b" "-a"]) |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
772 |
apply (simp del: inverse_less_iff_less |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
773 |
add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
774 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
775 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
776 |
lemma le_imp_inverse_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
777 |
"a \<le> b \<Longrightarrow> b < 0 ==> inverse b \<le> inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
778 |
by (force simp add: le_less less_imp_inverse_less_neg) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
779 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
780 |
lemma inverse_le_iff_le_neg [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
781 |
"a < 0 \<Longrightarrow> b < 0 \<Longrightarrow> inverse a \<le> inverse b \<longleftrightarrow> b \<le> a" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
782 |
by (blast intro: le_imp_inverse_le_neg dest: inverse_le_imp_le_neg) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
783 |
|
36774 | 784 |
lemma one_less_inverse: |
785 |
"0 < a \<Longrightarrow> a < 1 \<Longrightarrow> 1 < inverse a" |
|
786 |
using less_imp_inverse_less [of a 1, unfolded inverse_1] . |
|
787 |
||
788 |
lemma one_le_inverse: |
|
789 |
"0 < a \<Longrightarrow> a \<le> 1 \<Longrightarrow> 1 \<le> inverse a" |
|
790 |
using le_imp_inverse_le [of a 1, unfolded inverse_1] . |
|
791 |
||
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
792 |
lemma pos_le_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
793 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
794 |
shows "a \<le> b / c \<longleftrightarrow> a * c \<le> b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
795 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
796 |
from assms have "a \<le> b / c \<longleftrightarrow> a * c \<le> (b / c) * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
797 |
using mult_le_cancel_right [of a c "b * inverse c"] by (auto simp add: field_simps) |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
798 |
also have "... \<longleftrightarrow> a * c \<le> b" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
799 |
by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
800 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
801 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
802 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
803 |
lemma pos_less_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
804 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
805 |
shows "a < b / c \<longleftrightarrow> a * c < b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
806 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
807 |
from assms have "a < b / c \<longleftrightarrow> a * c < (b / c) * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
808 |
using mult_less_cancel_right [of a c "b / c"] by auto |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
809 |
also have "... = (a*c < b)" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
810 |
by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
811 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
812 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
813 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
814 |
lemma neg_less_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
815 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
816 |
shows "a < b / c \<longleftrightarrow> b < a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
817 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
818 |
from assms have "a < b / c \<longleftrightarrow> (b / c) * c < a * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
819 |
using mult_less_cancel_right [of "b / c" c a] by auto |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
820 |
also have "... \<longleftrightarrow> b < a * c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
821 |
by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
822 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
823 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
824 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
825 |
lemma neg_le_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
826 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
827 |
shows "a \<le> b / c \<longleftrightarrow> b \<le> a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
828 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
829 |
from assms have "a \<le> b / c \<longleftrightarrow> (b / c) * c \<le> a * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
830 |
using mult_le_cancel_right [of "b * inverse c" c a] by (auto simp add: field_simps) |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
831 |
also have "... \<longleftrightarrow> b \<le> a * c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
832 |
by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
833 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
834 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
835 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
836 |
lemma pos_divide_le_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
837 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
838 |
shows "b / c \<le> a \<longleftrightarrow> b \<le> a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
839 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
840 |
from assms have "b / c \<le> a \<longleftrightarrow> (b / c) * c \<le> a * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
841 |
using mult_le_cancel_right [of "b / c" c a] by auto |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
842 |
also have "... \<longleftrightarrow> b \<le> a * c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
843 |
by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
844 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
845 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
846 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
847 |
lemma pos_divide_less_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
848 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
849 |
shows "b / c < a \<longleftrightarrow> b < a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
850 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
851 |
from assms have "b / c < a \<longleftrightarrow> (b / c) * c < a * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
852 |
using mult_less_cancel_right [of "b / c" c a] by auto |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
853 |
also have "... \<longleftrightarrow> b < a * c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
854 |
by (simp add: less_imp_not_eq2 [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
855 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
856 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
857 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
858 |
lemma neg_divide_le_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
859 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
860 |
shows "b / c \<le> a \<longleftrightarrow> a * c \<le> b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
861 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
862 |
from assms have "b / c \<le> a \<longleftrightarrow> a * c \<le> (b / c) * c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
863 |
using mult_le_cancel_right [of a c "b / c"] by auto |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
864 |
also have "... \<longleftrightarrow> a * c \<le> b" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
865 |
by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
866 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
867 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
868 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
869 |
lemma neg_divide_less_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
870 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
871 |
shows "b / c < a \<longleftrightarrow> a * c < b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
872 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
873 |
from assms have "b / c < a \<longleftrightarrow> a * c < b / c * c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
874 |
using mult_less_cancel_right [of a c "b / c"] by auto |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
875 |
also have "... \<longleftrightarrow> a * c < b" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
876 |
by (simp add: less_imp_not_eq [OF assms] divide_inverse mult.assoc) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
877 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
878 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
879 |
|
61799 | 880 |
text\<open>The following \<open>field_simps\<close> rules are necessary, as minus is always moved atop of |
60758 | 881 |
division but we want to get rid of division.\<close> |
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
882 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
883 |
lemma pos_le_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> a * c \<le> - b" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
884 |
unfolding minus_divide_left by (rule pos_le_divide_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
885 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
886 |
lemma neg_le_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a \<le> - (b / c) \<longleftrightarrow> - b \<le> a * c" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
887 |
unfolding minus_divide_left by (rule neg_le_divide_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
888 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
889 |
lemma pos_less_minus_divide_eq [field_simps]: "0 < c \<Longrightarrow> a < - (b / c) \<longleftrightarrow> a * c < - b" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
890 |
unfolding minus_divide_left by (rule pos_less_divide_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
891 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
892 |
lemma neg_less_minus_divide_eq [field_simps]: "c < 0 \<Longrightarrow> a < - (b / c) \<longleftrightarrow> - b < a * c" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
893 |
unfolding minus_divide_left by (rule neg_less_divide_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
894 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
895 |
lemma pos_minus_divide_less_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) < a \<longleftrightarrow> - b < a * c" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
896 |
unfolding minus_divide_left by (rule pos_divide_less_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
897 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
898 |
lemma neg_minus_divide_less_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) < a \<longleftrightarrow> a * c < - b" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
899 |
unfolding minus_divide_left by (rule neg_divide_less_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
900 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
901 |
lemma pos_minus_divide_le_eq [field_simps]: "0 < c \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> - b \<le> a * c" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
902 |
unfolding minus_divide_left by (rule pos_divide_le_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
903 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
904 |
lemma neg_minus_divide_le_eq [field_simps]: "c < 0 \<Longrightarrow> - (b / c) \<le> a \<longleftrightarrow> a * c \<le> - b" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
905 |
unfolding minus_divide_left by (rule neg_divide_le_eq) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
906 |
|
56365
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
907 |
lemma frac_less_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
908 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y < w / z \<longleftrightarrow> (x * z - w * y) / (y * z) < 0" |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
909 |
by (subst less_iff_diff_less_0) (simp add: diff_frac_eq ) |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
910 |
|
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
911 |
lemma frac_le_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
912 |
"y \<noteq> 0 \<Longrightarrow> z \<noteq> 0 \<Longrightarrow> x / y \<le> w / z \<longleftrightarrow> (x * z - w * y) / (y * z) \<le> 0" |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
913 |
by (subst le_iff_diff_le_0) (simp add: diff_frac_eq ) |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
914 |
|
61799 | 915 |
text\<open>Lemmas \<open>sign_simps\<close> is a first attempt to automate proofs |
916 |
of positivity/negativity needed for \<open>field_simps\<close>. Have not added \<open>sign_simps\<close> to \<open>field_simps\<close> because the former can lead to case |
|
60758 | 917 |
explosions.\<close> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
918 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
919 |
(* Only works once linear arithmetic is installed: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
920 |
text{*An example:*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
921 |
lemma fixes a b c d e f :: "'a::linordered_field" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
922 |
shows "\<lbrakk>a>b; c<d; e<f; 0 < u \<rbrakk> \<Longrightarrow> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
923 |
((a-b)*(c-d)*(e-f))/((c-d)*(e-f)*(a-b)) < |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
924 |
((e-f)*(a-b)*(c-d))/((e-f)*(a-b)*(c-d)) + u" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
925 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b) > 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
926 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
927 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b)*u > 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
928 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
929 |
apply(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
930 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
931 |
*) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
932 |
|
56541 | 933 |
lemma divide_pos_pos[simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
934 |
"0 < x ==> 0 < y ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
935 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
936 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
937 |
lemma divide_nonneg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
938 |
"0 <= x ==> 0 < y ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
939 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
940 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
941 |
lemma divide_neg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
942 |
"x < 0 ==> 0 < y ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
943 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
944 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
945 |
lemma divide_nonpos_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
946 |
"x <= 0 ==> 0 < y ==> x / y <= 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
947 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
948 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
949 |
lemma divide_pos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
950 |
"0 < x ==> y < 0 ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
951 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
952 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
953 |
lemma divide_nonneg_neg: |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
954 |
"0 <= x ==> y < 0 ==> x / y <= 0" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
955 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
956 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
957 |
lemma divide_neg_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
958 |
"x < 0 ==> y < 0 ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
959 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
960 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
961 |
lemma divide_nonpos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
962 |
"x <= 0 ==> y < 0 ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
963 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
964 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
965 |
lemma divide_strict_right_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
966 |
"[|a < b; 0 < c|] ==> a / c < b / c" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
967 |
by (simp add: less_imp_not_eq2 divide_inverse mult_strict_right_mono |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
968 |
positive_imp_inverse_positive) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
969 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
970 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
971 |
lemma divide_strict_right_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
972 |
"[|b < a; c < 0|] ==> a / c < b / c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
973 |
apply (drule divide_strict_right_mono [of _ _ "-c"], simp) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
974 |
apply (simp add: less_imp_not_eq nonzero_minus_divide_right [symmetric]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
975 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
976 |
|
69593 | 977 |
text\<open>The last premise ensures that \<^term>\<open>a\<close> and \<^term>\<open>b\<close> |
60758 | 978 |
have the same sign\<close> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
979 |
lemma divide_strict_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
980 |
"[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / b" |
44921 | 981 |
by (auto simp: field_simps zero_less_mult_iff mult_strict_right_mono) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
982 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
983 |
lemma divide_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
984 |
"[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / b" |
44921 | 985 |
by (auto simp: field_simps zero_less_mult_iff mult_right_mono) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
986 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
987 |
lemma divide_strict_left_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
988 |
"[|a < b; c < 0; 0 < a*b|] ==> c / a < c / b" |
44921 | 989 |
by (auto simp: field_simps zero_less_mult_iff mult_strict_right_mono_neg) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
990 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
991 |
lemma mult_imp_div_pos_le: "0 < y ==> x <= z * y ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
992 |
x / y <= z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
993 |
by (subst pos_divide_le_eq, assumption+) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
994 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
995 |
lemma mult_imp_le_div_pos: "0 < y ==> z * y <= x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
996 |
z <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
997 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
998 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
999 |
lemma mult_imp_div_pos_less: "0 < y ==> x < z * y ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1000 |
x / y < z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1001 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1002 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1003 |
lemma mult_imp_less_div_pos: "0 < y ==> z * y < x ==> |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1004 |
z < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1005 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1006 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1007 |
lemma frac_le: "0 <= x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1008 |
x <= y ==> 0 < w ==> w <= z ==> x / z <= y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1009 |
apply (rule mult_imp_div_pos_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1010 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1011 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1012 |
apply (rule mult_imp_le_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1013 |
apply (rule mult_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1014 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1015 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1016 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1017 |
lemma frac_less: "0 <= x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1018 |
x < y ==> 0 < w ==> w <= z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1019 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1020 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1021 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1022 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1023 |
apply (erule mult_less_le_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1024 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1025 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1026 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1027 |
lemma frac_less2: "0 < x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1028 |
x <= y ==> 0 < w ==> w < z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1029 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1030 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1031 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1032 |
apply (erule mult_le_less_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1033 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1034 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1035 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1036 |
lemma less_half_sum: "a < b ==> a < (a+b) / (1+1)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1037 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1038 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1039 |
lemma gt_half_sum: "a < b ==> (a+b)/(1+1) < b" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1040 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1041 |
|
53215
5e47c31c6f7c
renamed typeclass dense_linorder to unbounded_dense_linorder
hoelzl
parents:
52435
diff
changeset
|
1042 |
subclass unbounded_dense_linorder |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1043 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1044 |
fix x y :: 'a |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1045 |
from less_add_one show "\<exists>y. x < y" .. |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1046 |
from less_add_one have "x + (- 1) < (x + 1) + (- 1)" by (rule add_strict_right_mono) |
54230
b1d955791529
more simplification rules on unary and binary minus
haftmann
parents:
54147
diff
changeset
|
1047 |
then have "x - 1 < x + 1 - 1" by simp |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1048 |
then have "x - 1 < x" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1049 |
then show "\<exists>y. y < x" .. |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1050 |
show "x < y \<Longrightarrow> \<exists>z>x. z < y" by (blast intro!: less_half_sum gt_half_sum) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1051 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1052 |
|
64290 | 1053 |
subclass field_abs_sgn .. |
1054 |
||
64329 | 1055 |
lemma inverse_sgn [simp]: |
1056 |
"inverse (sgn a) = sgn a" |
|
1057 |
by (cases a 0 rule: linorder_cases) simp_all |
|
1058 |
||
1059 |
lemma divide_sgn [simp]: |
|
1060 |
"a / sgn b = a * sgn b" |
|
1061 |
by (cases b 0 rule: linorder_cases) simp_all |
|
1062 |
||
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1063 |
lemma nonzero_abs_inverse: |
64290 | 1064 |
"a \<noteq> 0 ==> \<bar>inverse a\<bar> = inverse \<bar>a\<bar>" |
1065 |
by (rule abs_inverse) |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1066 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1067 |
lemma nonzero_abs_divide: |
64290 | 1068 |
"b \<noteq> 0 ==> \<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
1069 |
by (rule abs_divide) |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1070 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1071 |
lemma field_le_epsilon: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1072 |
assumes e: "\<And>e. 0 < e \<Longrightarrow> x \<le> y + e" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1073 |
shows "x \<le> y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1074 |
proof (rule dense_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1075 |
fix t assume "t < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1076 |
hence "0 < x - t" by (simp add: less_diff_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1077 |
from e [OF this] have "x + 0 \<le> x + (y - t)" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1078 |
then have "0 \<le> y - t" by (simp only: add_le_cancel_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1079 |
then show "t \<le> y" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1080 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1081 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1082 |
lemma inverse_positive_iff_positive [simp]: |
36409 | 1083 |
"(0 < inverse a) = (0 < a)" |
21328 | 1084 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1085 |
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
|
1086 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1087 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1088 |
lemma inverse_negative_iff_negative [simp]: |
36409 | 1089 |
"(inverse a < 0) = (a < 0)" |
21328 | 1090 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1091 |
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
|
1092 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1093 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1094 |
lemma inverse_nonnegative_iff_nonnegative [simp]: |
36409 | 1095 |
"0 \<le> inverse a \<longleftrightarrow> 0 \<le> a" |
1096 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1097 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1098 |
lemma inverse_nonpositive_iff_nonpositive [simp]: |
36409 | 1099 |
"inverse a \<le> 0 \<longleftrightarrow> a \<le> 0" |
1100 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
1101 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1102 |
lemma one_less_inverse_iff: "1 < inverse x \<longleftrightarrow> 0 < x \<and> x < 1" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1103 |
using less_trans[of 1 x 0 for x] |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1104 |
by (cases x 0 rule: linorder_cases) (auto simp add: field_simps) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1105 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1106 |
lemma one_le_inverse_iff: "1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1" |
36409 | 1107 |
proof (cases "x = 1") |
1108 |
case True then show ?thesis by simp |
|
1109 |
next |
|
1110 |
case False then have "inverse x \<noteq> 1" by simp |
|
1111 |
then have "1 \<noteq> inverse x" by blast |
|
1112 |
then have "1 \<le> inverse x \<longleftrightarrow> 1 < inverse x" by (simp add: le_less) |
|
1113 |
with False show ?thesis by (auto simp add: one_less_inverse_iff) |
|
1114 |
qed |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1115 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1116 |
lemma inverse_less_1_iff: "inverse x < 1 \<longleftrightarrow> x \<le> 0 \<or> 1 < x" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1117 |
by (simp add: not_le [symmetric] one_le_inverse_iff) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1118 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1119 |
lemma inverse_le_1_iff: "inverse x \<le> 1 \<longleftrightarrow> x \<le> 0 \<or> 1 \<le> x" |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1120 |
by (simp add: not_less [symmetric] one_less_inverse_iff) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
1121 |
|
56481 | 1122 |
lemma [divide_simps]: |
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1123 |
shows le_divide_eq: "a \<le> b / c \<longleftrightarrow> (if 0 < c then a * c \<le> b else if c < 0 then b \<le> a * c else a \<le> 0)" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1124 |
and divide_le_eq: "b / c \<le> a \<longleftrightarrow> (if 0 < c then b \<le> a * c else if c < 0 then a * c \<le> b else 0 \<le> a)" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1125 |
and less_divide_eq: "a < b / c \<longleftrightarrow> (if 0 < c then a * c < b else if c < 0 then b < a * c else a < 0)" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1126 |
and divide_less_eq: "b / c < a \<longleftrightarrow> (if 0 < c then b < a * c else if c < 0 then a * c < b else 0 < a)" |
56481 | 1127 |
and le_minus_divide_eq: "a \<le> - (b / c) \<longleftrightarrow> (if 0 < c then a * c \<le> - b else if c < 0 then - b \<le> a * c else a \<le> 0)" |
1128 |
and minus_divide_le_eq: "- (b / c) \<le> a \<longleftrightarrow> (if 0 < c then - b \<le> a * c else if c < 0 then a * c \<le> - b else 0 \<le> a)" |
|
1129 |
and less_minus_divide_eq: "a < - (b / c) \<longleftrightarrow> (if 0 < c then a * c < - b else if c < 0 then - b < a * c else a < 0)" |
|
1130 |
and minus_divide_less_eq: "- (b / c) < a \<longleftrightarrow> (if 0 < c then - b < a * c else if c < 0 then a * c < - b else 0 < a)" |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1131 |
by (auto simp: field_simps not_less dest: antisym) |
14288 | 1132 |
|
60758 | 1133 |
text \<open>Division and Signs\<close> |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1134 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1135 |
lemma |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1136 |
shows zero_less_divide_iff: "0 < a / b \<longleftrightarrow> 0 < a \<and> 0 < b \<or> a < 0 \<and> b < 0" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1137 |
and divide_less_0_iff: "a / b < 0 \<longleftrightarrow> 0 < a \<and> b < 0 \<or> a < 0 \<and> 0 < b" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1138 |
and zero_le_divide_iff: "0 \<le> a / b \<longleftrightarrow> 0 \<le> a \<and> 0 \<le> b \<or> a \<le> 0 \<and> b \<le> 0" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1139 |
and divide_le_0_iff: "a / b \<le> 0 \<longleftrightarrow> 0 \<le> a \<and> b \<le> 0 \<or> a \<le> 0 \<and> 0 \<le> b" |
56481 | 1140 |
by (auto simp add: divide_simps) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1141 |
|
60758 | 1142 |
text \<open>Division and the Number One\<close> |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1143 |
|
60758 | 1144 |
text\<open>Simplify expressions equated with 1\<close> |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1145 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1146 |
lemma zero_eq_1_divide_iff [simp]: "0 = 1 / a \<longleftrightarrow> a = 0" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1147 |
by (cases "a = 0") (auto simp: field_simps) |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1148 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1149 |
lemma one_divide_eq_0_iff [simp]: "1 / a = 0 \<longleftrightarrow> a = 0" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1150 |
using zero_eq_1_divide_iff[of a] by simp |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1151 |
|
61799 | 1152 |
text\<open>Simplify expressions such as \<open>0 < 1/x\<close> to \<open>0 < x\<close>\<close> |
36423 | 1153 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1154 |
lemma zero_le_divide_1_iff [simp]: |
36423 | 1155 |
"0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" |
1156 |
by (simp add: zero_le_divide_iff) |
|
17085 | 1157 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1158 |
lemma zero_less_divide_1_iff [simp]: |
36423 | 1159 |
"0 < 1 / a \<longleftrightarrow> 0 < a" |
1160 |
by (simp add: zero_less_divide_iff) |
|
1161 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1162 |
lemma divide_le_0_1_iff [simp]: |
36423 | 1163 |
"1 / a \<le> 0 \<longleftrightarrow> a \<le> 0" |
1164 |
by (simp add: divide_le_0_iff) |
|
1165 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1166 |
lemma divide_less_0_1_iff [simp]: |
36423 | 1167 |
"1 / a < 0 \<longleftrightarrow> a < 0" |
1168 |
by (simp add: divide_less_0_iff) |
|
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1169 |
|
14293 | 1170 |
lemma divide_right_mono: |
36409 | 1171 |
"[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/c" |
1172 |
by (force simp add: divide_strict_right_mono le_less) |
|
14293 | 1173 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1174 |
lemma divide_right_mono_neg: "a <= b |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1175 |
==> c <= 0 ==> b / c <= a / c" |
23482 | 1176 |
apply (drule divide_right_mono [of _ _ "- c"]) |
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
1177 |
apply auto |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1178 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1179 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1180 |
lemma divide_left_mono_neg: "a <= b |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1181 |
==> 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
|
1182 |
apply (drule divide_left_mono [of _ _ "- c"]) |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
1183 |
apply (auto simp add: mult.commute) |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1184 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1185 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1186 |
lemma inverse_le_iff: "inverse a \<le> inverse b \<longleftrightarrow> (0 < a * b \<longrightarrow> b \<le> a) \<and> (a * b \<le> 0 \<longrightarrow> a \<le> b)" |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1187 |
by (cases a 0 b 0 rule: linorder_cases[case_product linorder_cases]) |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1188 |
(auto simp add: field_simps zero_less_mult_iff mult_le_0_iff) |
42904 | 1189 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1190 |
lemma inverse_less_iff: "inverse a < inverse b \<longleftrightarrow> (0 < a * b \<longrightarrow> b < a) \<and> (a * b \<le> 0 \<longrightarrow> a < b)" |
42904 | 1191 |
by (subst less_le) (auto simp: inverse_le_iff) |
1192 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1193 |
lemma divide_le_cancel: "a / c \<le> b / c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)" |
42904 | 1194 |
by (simp add: divide_inverse mult_le_cancel_right) |
1195 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1196 |
lemma divide_less_cancel: "a / c < b / c \<longleftrightarrow> (0 < c \<longrightarrow> a < b) \<and> (c < 0 \<longrightarrow> b < a) \<and> c \<noteq> 0" |
42904 | 1197 |
by (auto simp add: divide_inverse mult_less_cancel_right) |
1198 |
||
60758 | 1199 |
text\<open>Simplify quotients that are compared with the value 1.\<close> |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1200 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1201 |
lemma le_divide_eq_1: |
67091 | 1202 |
"(1 \<le> b / a) = ((0 < a \<and> a \<le> b) \<or> (a < 0 \<and> b \<le> a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1203 |
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
|
1204 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1205 |
lemma divide_le_eq_1: |
67091 | 1206 |
"(b / a \<le> 1) = ((0 < a \<and> b \<le> a) \<or> (a < 0 \<and> a \<le> b) \<or> a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1207 |
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
|
1208 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1209 |
lemma less_divide_eq_1: |
67091 | 1210 |
"(1 < b / a) = ((0 < a \<and> a < b) \<or> (a < 0 \<and> b < a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1211 |
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
|
1212 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1213 |
lemma divide_less_eq_1: |
67091 | 1214 |
"(b / a < 1) = ((0 < a \<and> b < a) \<or> (a < 0 \<and> a < b) \<or> a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1215 |
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
|
1216 |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1217 |
lemma divide_nonneg_nonneg [simp]: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1218 |
"0 \<le> x \<Longrightarrow> 0 \<le> y \<Longrightarrow> 0 \<le> x / y" |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1219 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1220 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1221 |
lemma divide_nonpos_nonpos: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1222 |
"x \<le> 0 \<Longrightarrow> y \<le> 0 \<Longrightarrow> 0 \<le> x / y" |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1223 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1224 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1225 |
lemma divide_nonneg_nonpos: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1226 |
"0 \<le> x \<Longrightarrow> y \<le> 0 \<Longrightarrow> x / y \<le> 0" |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1227 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1228 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1229 |
lemma divide_nonpos_nonneg: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1230 |
"x \<le> 0 \<Longrightarrow> 0 \<le> y \<Longrightarrow> x / y \<le> 0" |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1231 |
by (auto simp add: divide_simps) |
23389 | 1232 |
|
60758 | 1233 |
text \<open>Conditional Simplification Rules: No Case Splits\<close> |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1234 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1235 |
lemma le_divide_eq_1_pos [simp]: |
36409 | 1236 |
"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
|
1237 |
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
|
1238 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1239 |
lemma le_divide_eq_1_neg [simp]: |
36409 | 1240 |
"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
|
1241 |
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
|
1242 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1243 |
lemma divide_le_eq_1_pos [simp]: |
36409 | 1244 |
"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
|
1245 |
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
|
1246 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1247 |
lemma divide_le_eq_1_neg [simp]: |
36409 | 1248 |
"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
|
1249 |
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
|
1250 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1251 |
lemma less_divide_eq_1_pos [simp]: |
36409 | 1252 |
"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
|
1253 |
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
|
1254 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1255 |
lemma less_divide_eq_1_neg [simp]: |
36409 | 1256 |
"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
|
1257 |
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
|
1258 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1259 |
lemma divide_less_eq_1_pos [simp]: |
36409 | 1260 |
"0 < a \<Longrightarrow> (b/a < 1) = (b < a)" |
18649
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1261 |
by (auto simp add: divide_less_eq) |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1262 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1263 |
lemma divide_less_eq_1_neg [simp]: |
61941 | 1264 |
"a < 0 \<Longrightarrow> b/a < 1 \<longleftrightarrow> a < b" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1265 |
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
|
1266 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1267 |
lemma eq_divide_eq_1 [simp]: |
67091 | 1268 |
"(1 = b/a) = ((a \<noteq> 0 \<and> a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1269 |
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
|
1270 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1271 |
lemma divide_eq_eq_1 [simp]: |
67091 | 1272 |
"(b/a = 1) = ((a \<noteq> 0 \<and> a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1273 |
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
|
1274 |
|
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1275 |
lemma abs_div_pos: "0 < y ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1276 |
\<bar>x\<bar> / y = \<bar>x / y\<bar>" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1277 |
apply (subst abs_divide) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1278 |
apply (simp add: order_less_imp_le) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1279 |
done |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1280 |
|
67091 | 1281 |
lemma zero_le_divide_abs_iff [simp]: "(0 \<le> a / \<bar>b\<bar>) = (0 \<le> a \<or> b = 0)" |
55718
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1282 |
by (auto simp: zero_le_divide_iff) |
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1283 |
|
67091 | 1284 |
lemma divide_le_0_abs_iff [simp]: "(a / \<bar>b\<bar> \<le> 0) = (a \<le> 0 \<or> b = 0)" |
55718
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1285 |
by (auto simp: divide_le_0_iff) |
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1286 |
|
35579
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1287 |
lemma field_le_mult_one_interval: |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1288 |
assumes *: "\<And>z. \<lbrakk> 0 < z ; z < 1 \<rbrakk> \<Longrightarrow> z * x \<le> y" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1289 |
shows "x \<le> y" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1290 |
proof (cases "0 < x") |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1291 |
assume "0 < x" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1292 |
thus ?thesis |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1293 |
using dense_le_bounded[of 0 1 "y/x"] * |
60758 | 1294 |
unfolding le_divide_eq if_P[OF \<open>0 < x\<close>] by simp |
35579
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1295 |
next |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1296 |
assume "\<not>0 < x" hence "x \<le> 0" by simp |
61076 | 1297 |
obtain s::'a where s: "0 < s" "s < 1" using dense[of 0 "1::'a"] by auto |
60758 | 1298 |
hence "x \<le> s * x" using mult_le_cancel_right[of 1 x s] \<open>x \<le> 0\<close> by auto |
35579
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1299 |
also note *[OF s] |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1300 |
finally show ?thesis . |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1301 |
qed |
35090
88cc65ae046e
moved lemma field_le_epsilon from Real.thy to Fields.thy
haftmann
parents:
35084
diff
changeset
|
1302 |
|
69593 | 1303 |
text\<open>For creating values between \<^term>\<open>u\<close> and \<^term>\<open>v\<close>.\<close> |
63952
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1304 |
lemma scaling_mono: |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1305 |
assumes "u \<le> v" "0 \<le> r" "r \<le> s" |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1306 |
shows "u + r * (v - u) / s \<le> v" |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1307 |
proof - |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1308 |
have "r/s \<le> 1" using assms |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1309 |
using divide_le_eq_1 by fastforce |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1310 |
then have "(r/s) * (v - u) \<le> 1 * (v - u)" |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1311 |
apply (rule mult_right_mono) |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1312 |
using assms by simp |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1313 |
then show ?thesis |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1314 |
by (simp add: field_simps) |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1315 |
qed |
354808e9f44b
new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents:
62481
diff
changeset
|
1316 |
|
36409 | 1317 |
end |
1318 |
||
61238
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1319 |
text \<open>Min/max Simplification Rules\<close> |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1320 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1321 |
lemma min_mult_distrib_left: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1322 |
fixes x::"'a::linordered_idom" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1323 |
shows "p * min x y = (if 0 \<le> p then min (p*x) (p*y) else max (p*x) (p*y))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1324 |
by (auto simp add: min_def max_def mult_le_cancel_left) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1325 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1326 |
lemma min_mult_distrib_right: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1327 |
fixes x::"'a::linordered_idom" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1328 |
shows "min x y * p = (if 0 \<le> p then min (x*p) (y*p) else max (x*p) (y*p))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1329 |
by (auto simp add: min_def max_def mult_le_cancel_right) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1330 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1331 |
lemma min_divide_distrib_right: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1332 |
fixes x::"'a::linordered_field" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1333 |
shows "min x y / p = (if 0 \<le> p then min (x/p) (y/p) else max (x/p) (y/p))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1334 |
by (simp add: min_mult_distrib_right divide_inverse) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1335 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1336 |
lemma max_mult_distrib_left: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1337 |
fixes x::"'a::linordered_idom" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1338 |
shows "p * max x y = (if 0 \<le> p then max (p*x) (p*y) else min (p*x) (p*y))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1339 |
by (auto simp add: min_def max_def mult_le_cancel_left) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1340 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1341 |
lemma max_mult_distrib_right: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1342 |
fixes x::"'a::linordered_idom" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1343 |
shows "max x y * p = (if 0 \<le> p then max (x*p) (y*p) else min (x*p) (y*p))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1344 |
by (auto simp add: min_def max_def mult_le_cancel_right) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1345 |
|
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1346 |
lemma max_divide_distrib_right: |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1347 |
fixes x::"'a::linordered_field" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1348 |
shows "max x y / p = (if 0 \<le> p then max (x/p) (y/p) else min (x/p) (y/p))" |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1349 |
by (simp add: max_mult_distrib_right divide_inverse) |
e3d8a313a649
Useful facts about min/max, etc.
paulson <lp15@cam.ac.uk>
parents:
61076
diff
changeset
|
1350 |
|
59557 | 1351 |
hide_fact (open) field_inverse field_divide_inverse field_inverse_zero |
1352 |
||
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
44921
diff
changeset
|
1353 |
code_identifier |
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
44921
diff
changeset
|
1354 |
code_module Fields \<rightharpoonup> (SML) Arith and (OCaml) Arith and (Haskell) Arith |
59667
651ea265d568
Removal of the file HOL/Number_Theory/Binomial!! And class field_char_0 now declared in Int.thy
paulson <lp15@cam.ac.uk>
parents:
59557
diff
changeset
|
1355 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
1356 |
end |