author | wenzelm |
Tue, 02 Jun 2015 09:10:05 +0200 | |
changeset 60357 | bc0827281dc1 |
parent 59867 | 58043346ca64 |
child 60352 | d46de31a50c4 |
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 |
|
58889 | 10 |
section {* Fields *} |
25152 | 11 |
|
35050
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
12 |
theory Fields |
9f841f20dca6
renamed OrderedGroup to Groups; split theory Ring_and_Field into Rings Fields
haftmann
parents:
35043
diff
changeset
|
13 |
imports Rings |
25186 | 14 |
begin |
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset
|
15 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
16 |
subsection {* Division rings *} |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
17 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
18 |
text {* |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
19 |
A division ring is like a field, but without the commutativity requirement. |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
20 |
*} |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
21 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
22 |
class inverse = |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
23 |
fixes inverse :: "'a \<Rightarrow> 'a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
24 |
and divide :: "'a \<Rightarrow> 'a \<Rightarrow> 'a" (infixl "'/" 70) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
25 |
|
58826 | 26 |
setup {* Sign.add_const_constraint (@{const_name "divide"}, SOME @{typ "'a \<Rightarrow> '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
|
27 |
|
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
|
28 |
|
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
|
29 |
context semiring |
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
|
30 |
begin |
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
|
31 |
|
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
|
32 |
lemma [field_simps]: |
59779 | 33 |
shows distrib_left_NO_MATCH: "NO_MATCH (x / y) a \<Longrightarrow> a * (b + c) = a * b + a * c" |
34 |
and distrib_right_NO_MATCH: "NO_MATCH (x / y) c \<Longrightarrow> (a + b) * c = a * c + b * c" |
|
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
|
35 |
by (rule distrib_left distrib_right)+ |
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
|
36 |
|
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
|
37 |
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
|
38 |
|
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
|
39 |
context ring |
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
|
40 |
begin |
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
|
41 |
|
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
|
42 |
lemma [field_simps]: |
59779 | 43 |
shows left_diff_distrib_NO_MATCH: "NO_MATCH (x / y) c \<Longrightarrow> (a - b) * c = a * c - b * c" |
44 |
and right_diff_distrib_NO_MATCH: "NO_MATCH (x / y) a \<Longrightarrow> a * (b - c) = a * b - a * c" |
|
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
|
45 |
by (rule left_diff_distrib right_diff_distrib)+ |
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
|
46 |
|
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
|
47 |
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
|
48 |
|
58826 | 49 |
setup {* Sign.add_const_constraint (@{const_name "divide"}, SOME @{typ "'a::inverse \<Rightarrow> '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 |
|
56481 | 51 |
text{* Lemmas @{text divide_simps} move division to the outside and eliminates them on (in)equalities. *} |
52 |
||
57950 | 53 |
named_theorems divide_simps "rewrite rules to eliminate divisions" |
56481 | 54 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
55 |
class division_ring = ring_1 + inverse + |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
56 |
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
|
57 |
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
|
58 |
assumes divide_inverse: "a / b = a * inverse b" |
59867
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
59 |
assumes inverse_zero [simp]: "inverse 0 = 0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
60 |
begin |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
61 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
62 |
subclass ring_1_no_zero_divisors |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
63 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
64 |
fix a b :: 'a |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
65 |
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
|
66 |
show "a * b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
67 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
68 |
assume ab: "a * b = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
69 |
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
|
70 |
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
|
71 |
by (simp only: mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
72 |
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
|
73 |
finally show False by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
74 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
75 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
76 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
77 |
lemma nonzero_imp_inverse_nonzero: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
78 |
"a \<noteq> 0 \<Longrightarrow> inverse a \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
79 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
80 |
assume ianz: "inverse a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
81 |
assume "a \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
82 |
hence "1 = a * inverse a" by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
83 |
also have "... = 0" by (simp add: ianz) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
84 |
finally have "1 = 0" . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
85 |
thus False by (simp add: eq_commute) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
86 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
87 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
88 |
lemma inverse_zero_imp_zero: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
89 |
"inverse a = 0 \<Longrightarrow> a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
90 |
apply (rule classical) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
91 |
apply (drule nonzero_imp_inverse_nonzero) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
92 |
apply auto |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
93 |
done |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
94 |
|
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
|
95 |
lemma inverse_unique: |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
96 |
assumes ab: "a * b = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
97 |
shows "inverse a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
98 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
99 |
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
|
100 |
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
|
101 |
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
|
102 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
103 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
104 |
lemma nonzero_inverse_minus_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
105 |
"a \<noteq> 0 \<Longrightarrow> inverse (- a) = - inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
106 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
107 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
108 |
lemma nonzero_inverse_inverse_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
109 |
"a \<noteq> 0 \<Longrightarrow> inverse (inverse a) = a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
110 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
111 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
112 |
lemma nonzero_inverse_eq_imp_eq: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
113 |
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
|
114 |
shows "a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
115 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
116 |
from `inverse a = inverse b` |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
117 |
have "inverse (inverse a) = inverse (inverse b)" by (rule arg_cong) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
118 |
with `a \<noteq> 0` and `b \<noteq> 0` show "a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
119 |
by (simp add: nonzero_inverse_inverse_eq) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
120 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
121 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
122 |
lemma inverse_1 [simp]: "inverse 1 = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
123 |
by (rule inverse_unique) simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
124 |
|
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
|
125 |
lemma nonzero_inverse_mult_distrib: |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
126 |
assumes "a \<noteq> 0" and "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
127 |
shows "inverse (a * b) = inverse b * inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
128 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
129 |
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
|
130 |
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
|
131 |
thus ?thesis by (rule inverse_unique) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
132 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
133 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
134 |
lemma division_ring_inverse_add: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
135 |
"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
|
136 |
by (simp add: algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
137 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
138 |
lemma division_ring_inverse_diff: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
139 |
"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
|
140 |
by (simp add: algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
141 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
142 |
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
|
143 |
proof |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
144 |
assume neq: "b \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
145 |
{ |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
146 |
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
|
147 |
also assume "a / b = 1" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
148 |
finally show "a = b" by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
149 |
next |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
150 |
assume "a = b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
151 |
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
|
152 |
} |
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 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
|
156 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
157 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
158 |
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
|
159 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
160 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
161 |
lemma divide_zero_left [simp]: "0 / a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
162 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
163 |
|
56481 | 164 |
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
|
165 |
by (simp add: divide_inverse) |
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 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
|
168 |
by (simp add: divide_inverse algebra_simps) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
169 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
170 |
lemma divide_1 [simp]: "a / 1 = a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
171 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
172 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
173 |
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
|
174 |
by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
175 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
176 |
lemma minus_divide_left: "- (a / b) = (-a) / b" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
177 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
178 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
179 |
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
|
180 |
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
|
181 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
182 |
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
|
183 |
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
|
184 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
185 |
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
|
186 |
by (simp add: divide_inverse) |
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 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
|
189 |
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
|
190 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
191 |
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
|
192 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
193 |
assume [simp]: "c \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
194 |
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
|
195 |
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
|
196 |
finally show ?thesis . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
197 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
198 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
199 |
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
|
200 |
proof - |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
201 |
assume [simp]: "c \<noteq> 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
202 |
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
|
203 |
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
|
204 |
finally show ?thesis . |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
205 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
206 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
207 |
lemma nonzero_neg_divide_eq_eq [field_simps]: "b \<noteq> 0 \<Longrightarrow> - (a / b) = c \<longleftrightarrow> - a = c * b" |
59535 | 208 |
using nonzero_divide_eq_eq[of b "-a" c] by simp |
56441 | 209 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
210 |
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
|
211 |
using nonzero_neg_divide_eq_eq[of b a c] by auto |
56441 | 212 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
213 |
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
|
214 |
by (simp add: divide_inverse mult.assoc) |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
215 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
216 |
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
|
217 |
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
|
218 |
|
56445 | 219 |
lemma add_divide_eq_iff [field_simps]: |
220 |
"z \<noteq> 0 \<Longrightarrow> x + y / z = (x * z + y) / z" |
|
221 |
by (simp add: add_divide_distrib nonzero_eq_divide_eq) |
|
222 |
||
223 |
lemma divide_add_eq_iff [field_simps]: |
|
224 |
"z \<noteq> 0 \<Longrightarrow> x / z + y = (x + y * z) / z" |
|
225 |
by (simp add: add_divide_distrib nonzero_eq_divide_eq) |
|
226 |
||
227 |
lemma diff_divide_eq_iff [field_simps]: |
|
228 |
"z \<noteq> 0 \<Longrightarrow> x - y / z = (x * z - y) / z" |
|
229 |
by (simp add: diff_divide_distrib nonzero_eq_divide_eq eq_diff_eq) |
|
230 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
231 |
lemma minus_divide_add_eq_iff [field_simps]: |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
232 |
"z \<noteq> 0 \<Longrightarrow> - (x / z) + y = (- x + y * z) / z" |
59535 | 233 |
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
|
234 |
|
56445 | 235 |
lemma divide_diff_eq_iff [field_simps]: |
236 |
"z \<noteq> 0 \<Longrightarrow> x / z - y = (x - y * z) / z" |
|
237 |
by (simp add: field_simps) |
|
238 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
239 |
lemma minus_divide_diff_eq_iff [field_simps]: |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
240 |
"z \<noteq> 0 \<Longrightarrow> - (x / z) - y = (- x - y * z) / z" |
59535 | 241 |
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
|
242 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
243 |
lemma divide_zero [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
244 |
"a / 0 = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
245 |
by (simp add: divide_inverse) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
246 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
247 |
lemma divide_self_if [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
248 |
"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
|
249 |
by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
250 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
251 |
lemma inverse_nonzero_iff_nonzero [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
252 |
"inverse a = 0 \<longleftrightarrow> a = 0" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
253 |
by rule (fact inverse_zero_imp_zero, simp) |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
254 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
255 |
lemma inverse_minus_eq [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
256 |
"inverse (- a) = - inverse a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
257 |
proof cases |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
258 |
assume "a=0" thus ?thesis by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
259 |
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
|
260 |
assume "a\<noteq>0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
261 |
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
|
262 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
263 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
264 |
lemma inverse_inverse_eq [simp]: |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
265 |
"inverse (inverse a) = a" |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
266 |
proof cases |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
267 |
assume "a=0" thus ?thesis by simp |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
268 |
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
|
269 |
assume "a\<noteq>0" |
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
270 |
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
|
271 |
qed |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
272 |
|
44680 | 273 |
lemma inverse_eq_imp_eq: |
274 |
"inverse a = inverse b \<Longrightarrow> a = b" |
|
275 |
by (drule arg_cong [where f="inverse"], simp) |
|
276 |
||
277 |
lemma inverse_eq_iff_eq [simp]: |
|
278 |
"inverse a = inverse b \<longleftrightarrow> a = b" |
|
279 |
by (force dest!: inverse_eq_imp_eq) |
|
280 |
||
56481 | 281 |
lemma add_divide_eq_if_simps [divide_simps]: |
282 |
"a + b / z = (if z = 0 then a else (a * z + b) / z)" |
|
283 |
"a / z + b = (if z = 0 then b else (a + b * z) / z)" |
|
284 |
"- (a / z) + b = (if z = 0 then b else (-a + b * z) / z)" |
|
285 |
"a - b / z = (if z = 0 then a else (a * z - b) / z)" |
|
286 |
"a / z - b = (if z = 0 then -b else (a - b * z) / z)" |
|
287 |
"- (a / z) - b = (if z = 0 then -b else (- a - b * z) / z)" |
|
288 |
by (simp_all add: add_divide_eq_iff divide_add_eq_iff diff_divide_eq_iff divide_diff_eq_iff |
|
289 |
minus_divide_diff_eq_iff) |
|
290 |
||
291 |
lemma [divide_simps]: |
|
292 |
shows divide_eq_eq: "b / c = a \<longleftrightarrow> (if c \<noteq> 0 then b = a * c else a = 0)" |
|
293 |
and eq_divide_eq: "a = b / c \<longleftrightarrow> (if c \<noteq> 0 then a * c = b else a = 0)" |
|
294 |
and minus_divide_eq_eq: "- (b / c) = a \<longleftrightarrow> (if c \<noteq> 0 then - b = a * c else a = 0)" |
|
295 |
and eq_minus_divide_eq: "a = - (b / c) \<longleftrightarrow> (if c \<noteq> 0 then a * c = - b else a = 0)" |
|
296 |
by (auto simp add: field_simps) |
|
297 |
||
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
298 |
end |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
299 |
|
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
300 |
subsection {* Fields *} |
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
301 |
|
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
302 |
class field = comm_ring_1 + inverse + |
35084 | 303 |
assumes field_inverse: "a \<noteq> 0 \<Longrightarrow> inverse a * a = 1" |
304 |
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
|
305 |
assumes field_inverse_zero: "inverse 0 = 0" |
25267 | 306 |
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
|
307 |
|
25267 | 308 |
subclass division_ring |
28823 | 309 |
proof |
22987
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
310 |
fix a :: 'a |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
311 |
assume "a \<noteq> 0" |
550709aa8e66
instance division_ring < no_zero_divisors; clean up field instance proofs
huffman
parents:
22842
diff
changeset
|
312 |
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
|
313 |
thus "a * inverse a = 1" by (simp only: mult.commute) |
35084 | 314 |
next |
315 |
fix a b :: 'a |
|
316 |
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
|
317 |
next |
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
318 |
show "inverse 0 = 0" |
58043346ca64
given up separate type classes demanding `inverse 0 = 0`
haftmann
parents:
59779
diff
changeset
|
319 |
by (fact field_inverse_zero) |
14738 | 320 |
qed |
25230 | 321 |
|
27516 | 322 |
subclass idom .. |
25230 | 323 |
|
30630 | 324 |
text{*There is no slick version using division by zero.*} |
325 |
lemma inverse_add: |
|
326 |
"[| a \<noteq> 0; b \<noteq> 0 |] |
|
327 |
==> inverse a + inverse b = (a + b) * inverse a * inverse b" |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
328 |
by (simp add: division_ring_inverse_add ac_simps) |
30630 | 329 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
330 |
lemma nonzero_mult_divide_mult_cancel_left [simp]: |
30630 | 331 |
assumes [simp]: "b\<noteq>0" and [simp]: "c\<noteq>0" shows "(c*a)/(c*b) = a/b" |
332 |
proof - |
|
333 |
have "(c*a)/(c*b) = c * a * (inverse b * inverse c)" |
|
334 |
by (simp add: divide_inverse nonzero_inverse_mult_distrib) |
|
335 |
also have "... = a * inverse b * (inverse c * c)" |
|
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
336 |
by (simp only: ac_simps) |
30630 | 337 |
also have "... = a * inverse b" by simp |
338 |
finally show ?thesis by (simp add: divide_inverse) |
|
339 |
qed |
|
340 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
341 |
lemma nonzero_mult_divide_mult_cancel_right [simp]: |
30630 | 342 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (a * c) / (b * c) = a / b" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
343 |
by (simp add: mult.commute [of _ c]) |
30630 | 344 |
|
36304
6984744e6b34
less special treatment of times_divide_eq [simp]
haftmann
parents:
36301
diff
changeset
|
345 |
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
|
346 |
by (simp add: divide_inverse ac_simps) |
30630 | 347 |
|
348 |
lemma add_frac_eq: |
|
349 |
assumes "y \<noteq> 0" and "z \<noteq> 0" |
|
350 |
shows "x / y + w / z = (x * z + w * y) / (y * z)" |
|
351 |
proof - |
|
352 |
have "x / y + w / z = (x * z) / (y * z) + (y * w) / (y * z)" |
|
353 |
using assms by simp |
|
354 |
also have "\<dots> = (x * z + y * w) / (y * z)" |
|
355 |
by (simp only: add_divide_distrib) |
|
356 |
finally show ?thesis |
|
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
357 |
by (simp only: mult.commute) |
30630 | 358 |
qed |
359 |
||
360 |
text{*Special Cancellation Simprules for Division*} |
|
361 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
362 |
lemma nonzero_mult_divide_cancel_right [simp]: |
30630 | 363 |
"b \<noteq> 0 \<Longrightarrow> a * b / b = a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
364 |
using nonzero_mult_divide_mult_cancel_right [of 1 b a] by simp |
30630 | 365 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
366 |
lemma nonzero_mult_divide_cancel_left [simp]: |
30630 | 367 |
"a \<noteq> 0 \<Longrightarrow> a * b / a = b" |
368 |
using nonzero_mult_divide_mult_cancel_left [of 1 a b] by simp |
|
369 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
370 |
lemma nonzero_divide_mult_cancel_right [simp]: |
30630 | 371 |
"\<lbrakk>a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> b / (a * b) = 1 / a" |
372 |
using nonzero_mult_divide_mult_cancel_right [of a b 1] by simp |
|
373 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
374 |
lemma nonzero_divide_mult_cancel_left [simp]: |
30630 | 375 |
"\<lbrakk>a \<noteq> 0; b \<noteq> 0\<rbrakk> \<Longrightarrow> a / (a * b) = 1 / b" |
376 |
using nonzero_mult_divide_mult_cancel_left [of b a 1] by simp |
|
377 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
378 |
lemma nonzero_mult_divide_mult_cancel_left2 [simp]: |
30630 | 379 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (c * a) / (b * c) = a / b" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
380 |
using nonzero_mult_divide_mult_cancel_left [of b c a] by (simp add: ac_simps) |
30630 | 381 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
382 |
lemma nonzero_mult_divide_mult_cancel_right2 [simp]: |
30630 | 383 |
"\<lbrakk>b \<noteq> 0; c \<noteq> 0\<rbrakk> \<Longrightarrow> (a * c) / (c * b) = a / b" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
384 |
using nonzero_mult_divide_mult_cancel_right [of b c a] by (simp add: ac_simps) |
30630 | 385 |
|
386 |
lemma diff_frac_eq: |
|
387 |
"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
|
388 |
by (simp add: field_simps) |
30630 | 389 |
|
390 |
lemma frac_eq_eq: |
|
391 |
"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
|
392 |
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
|
393 |
|
58512
dc4d76dfa8f0
moved lemmas out of Int.thy which have nothing to do with int
haftmann
parents:
57950
diff
changeset
|
394 |
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
|
395 |
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
|
396 |
|
14270 | 397 |
text{*This version builds in division by zero while also re-orienting |
398 |
the right-hand side.*} |
|
399 |
lemma inverse_mult_distrib [simp]: |
|
36409 | 400 |
"inverse (a * b) = inverse a * inverse b" |
401 |
proof cases |
|
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
|
402 |
assume "a \<noteq> 0 & b \<noteq> 0" |
57514
bdc2c6b40bf2
prefer ac_simps collections over separate name bindings for add and mult
haftmann
parents:
57512
diff
changeset
|
403 |
thus ?thesis by (simp add: nonzero_inverse_mult_distrib ac_simps) |
36409 | 404 |
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
|
405 |
assume "~ (a \<noteq> 0 & b \<noteq> 0)" |
36409 | 406 |
thus ?thesis by force |
407 |
qed |
|
14270 | 408 |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
409 |
lemma inverse_divide [simp]: |
36409 | 410 |
"inverse (a / b) = b / a" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
411 |
by (simp add: divide_inverse mult.commute) |
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
412 |
|
23389 | 413 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
414 |
text {* Calculations with fractions *} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
415 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
416 |
text{* There is a whole bunch of simp-rules just for class @{text |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
417 |
field} but none for class @{text field} and @{text nonzero_divides} |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
418 |
because the latter are covered by a simproc. *} |
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
419 |
|
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
420 |
lemma mult_divide_mult_cancel_left: |
36409 | 421 |
"c \<noteq> 0 \<Longrightarrow> (c * a) / (c * b) = a / b" |
21328 | 422 |
apply (cases "b = 0") |
35216 | 423 |
apply simp_all |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
424 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
425 |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
426 |
lemma mult_divide_mult_cancel_right: |
36409 | 427 |
"c \<noteq> 0 \<Longrightarrow> (a * c) / (b * c) = a / b" |
21328 | 428 |
apply (cases "b = 0") |
35216 | 429 |
apply simp_all |
14321 | 430 |
done |
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
431 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
432 |
lemma divide_divide_eq_right [simp]: |
36409 | 433 |
"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
|
434 |
by (simp add: divide_inverse ac_simps) |
14288 | 435 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
436 |
lemma divide_divide_eq_left [simp]: |
36409 | 437 |
"(a / b) / c = a / (b * c)" |
57512
cc97b347b301
reduced name variants for assoc and commute on plus and mult
haftmann
parents:
56571
diff
changeset
|
438 |
by (simp add: divide_inverse mult.assoc) |
14288 | 439 |
|
56365
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
440 |
lemma divide_divide_times_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
441 |
"(x / y) / (z / w) = (x * w) / (y * z)" |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
442 |
by simp |
23389 | 443 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
444 |
text {*Special Cancellation Simprules for Division*} |
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
445 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
446 |
lemma mult_divide_mult_cancel_left_if [simp]: |
36409 | 447 |
shows "(c * a) / (c * b) = (if c = 0 then 0 else a / b)" |
448 |
by (simp add: mult_divide_mult_cancel_left) |
|
23413
5caa2710dd5b
tuned laws for cancellation in divisions for fields.
nipkow
parents:
23406
diff
changeset
|
449 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
450 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
451 |
text {* Division and Unary Minus *} |
14293 | 452 |
|
36409 | 453 |
lemma minus_divide_right: |
454 |
"- (a / b) = a / - b" |
|
455 |
by (simp add: divide_inverse) |
|
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset
|
456 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
457 |
lemma divide_minus_right [simp]: |
36409 | 458 |
"a / - b = - (a / b)" |
459 |
by (simp add: divide_inverse) |
|
30630 | 460 |
|
56479
91958d4b30f7
revert c1bbd3e22226, a14831ac3023, and 36489d77c484: divide_minus_left/right are again simp rules
hoelzl
parents:
56445
diff
changeset
|
461 |
lemma minus_divide_divide: |
36409 | 462 |
"(- a) / (- b) = a / 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
|
463 |
apply (cases "b=0", simp) |
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
|
464 |
apply (simp add: nonzero_minus_divide_divide) |
14293 | 465 |
done |
466 |
||
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
467 |
lemma inverse_eq_1_iff [simp]: |
36409 | 468 |
"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
|
469 |
by (insert inverse_eq_iff_eq [of x 1], simp) |
23389 | 470 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
471 |
lemma divide_eq_0_iff [simp]: |
36409 | 472 |
"a / b = 0 \<longleftrightarrow> a = 0 \<or> b = 0" |
473 |
by (simp add: divide_inverse) |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
474 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
475 |
lemma divide_cancel_right [simp]: |
36409 | 476 |
"a / c = b / c \<longleftrightarrow> c = 0 \<or> a = b" |
477 |
apply (cases "c=0", simp) |
|
478 |
apply (simp add: divide_inverse) |
|
479 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
480 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
481 |
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
|
482 |
"c / a = c / b \<longleftrightarrow> c = 0 \<or> a = b" |
36409 | 483 |
apply (cases "c=0", simp) |
484 |
apply (simp add: divide_inverse) |
|
485 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
486 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
487 |
lemma divide_eq_1_iff [simp]: |
36409 | 488 |
"a / b = 1 \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
489 |
apply (cases "b=0", simp) |
|
490 |
apply (simp add: right_inverse_eq) |
|
491 |
done |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
492 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
493 |
lemma one_eq_divide_iff [simp]: |
36409 | 494 |
"1 = a / b \<longleftrightarrow> b \<noteq> 0 \<and> a = b" |
495 |
by (simp add: eq_commute [of 1]) |
|
496 |
||
36719 | 497 |
lemma times_divide_times_eq: |
498 |
"(x / y) * (z / w) = (x * z) / (y * w)" |
|
499 |
by simp |
|
500 |
||
501 |
lemma add_frac_num: |
|
502 |
"y \<noteq> 0 \<Longrightarrow> x / y + z = (x + z * y) / y" |
|
503 |
by (simp add: add_divide_distrib) |
|
504 |
||
505 |
lemma add_num_frac: |
|
506 |
"y \<noteq> 0 \<Longrightarrow> z + x / y = (x + z * y) / y" |
|
507 |
by (simp add: add_divide_distrib add.commute) |
|
508 |
||
36409 | 509 |
end |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
510 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
511 |
|
44064
5bce8ff0d9ae
moved division ring stuff from Rings.thy to Fields.thy
huffman
parents:
42904
diff
changeset
|
512 |
subsection {* Ordered fields *} |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
513 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
514 |
class linordered_field = field + linordered_idom |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
515 |
begin |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
516 |
|
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
|
517 |
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
|
518 |
assumes a_gt_0: "0 < a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
519 |
shows "0 < inverse a" |
23482 | 520 |
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
|
521 |
have "0 < a * inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
522 |
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
|
523 |
thus "0 < inverse a" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
524 |
by (simp add: a_gt_0 [THEN less_not_sym] zero_less_mult_iff) |
23482 | 525 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
526 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
527 |
lemma negative_imp_inverse_negative: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
528 |
"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
|
529 |
by (insert positive_imp_inverse_positive [of "-a"], |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
530 |
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
|
531 |
|
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
532 |
lemma inverse_le_imp_le: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
533 |
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
|
534 |
shows "b \<le> a" |
23482 | 535 |
proof (rule classical) |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
536 |
assume "~ b \<le> a" |
23482 | 537 |
hence "a < b" by (simp add: linorder_not_le) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
538 |
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
|
539 |
hence "a * inverse a \<le> a * inverse b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
540 |
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
|
541 |
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
|
542 |
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
|
543 |
thus "b \<le> a" by (simp add: mult.assoc apos bpos less_imp_not_eq2) |
23482 | 544 |
qed |
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset
|
545 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
546 |
lemma inverse_positive_imp_positive: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
547 |
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
|
548 |
shows "0 < a" |
23389 | 549 |
proof - |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
550 |
have "0 < inverse (inverse a)" |
23389 | 551 |
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
|
552 |
thus "0 < a" |
23389 | 553 |
using nz by (simp add: nonzero_inverse_inverse_eq) |
554 |
qed |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
555 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
556 |
lemma inverse_negative_imp_negative: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
557 |
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
|
558 |
shows "a < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
559 |
proof - |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
560 |
have "inverse (inverse a) < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
561 |
using inv_less_0 by (rule negative_imp_inverse_negative) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
562 |
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
|
563 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
564 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
565 |
lemma linordered_field_no_lb: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
566 |
"\<forall>x. \<exists>y. y < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
567 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
568 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
569 |
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
|
570 |
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
|
571 |
have "(- 1) + x < x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
572 |
thus "\<exists>y. y < x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
573 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
574 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
575 |
lemma linordered_field_no_ub: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
576 |
"\<forall> x. \<exists>y. y > x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
577 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
578 |
fix x::'a |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
579 |
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
|
580 |
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
|
581 |
have "1 + x > x" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
582 |
thus "\<exists>y. y > x" by blast |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
583 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
584 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
585 |
lemma less_imp_inverse_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
586 |
assumes less: "a < b" and apos: "0 < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
587 |
shows "inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
588 |
proof (rule ccontr) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
589 |
assume "~ inverse b < inverse a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
590 |
hence "inverse a \<le> inverse b" by simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
591 |
hence "~ (a < b)" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
592 |
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
|
593 |
thus False by (rule notE [OF _ less]) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
594 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
595 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
596 |
lemma inverse_less_imp_less: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
597 |
"inverse a < inverse b \<Longrightarrow> 0 < a \<Longrightarrow> b < a" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
598 |
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
|
599 |
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
|
600 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
601 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
602 |
text{*Both premises are essential. Consider -1 and 1.*} |
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
603 |
lemma inverse_less_iff_less [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
604 |
"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
|
605 |
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
|
606 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
607 |
lemma le_imp_inverse_le: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
608 |
"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
|
609 |
by (force simp add: le_less less_imp_inverse_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
610 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
611 |
lemma inverse_le_iff_le [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
612 |
"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
|
613 |
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
|
614 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
615 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
616 |
text{*These results refer to both operands being negative. The opposite-sign |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
617 |
case is trivial, since inverse preserves signs.*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
618 |
lemma inverse_le_imp_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
619 |
"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
|
620 |
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
|
621 |
apply (subgoal_tac "a < 0") |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
622 |
prefer 2 apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
623 |
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
|
624 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
625 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
626 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
627 |
lemma less_imp_inverse_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
628 |
"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
|
629 |
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
|
630 |
prefer 2 apply (blast intro: less_trans) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
631 |
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
|
632 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
633 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
634 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
635 |
lemma inverse_less_imp_less_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
636 |
"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
|
637 |
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
|
638 |
apply (subgoal_tac "a < 0") |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
639 |
prefer 2 |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
640 |
apply force |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
641 |
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
|
642 |
apply (simp add: nonzero_inverse_minus_eq) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
643 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
644 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
645 |
lemma inverse_less_iff_less_neg [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
646 |
"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
|
647 |
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
|
648 |
apply (simp del: inverse_less_iff_less |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
649 |
add: nonzero_inverse_minus_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
650 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
651 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
652 |
lemma le_imp_inverse_le_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
653 |
"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
|
654 |
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
|
655 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
656 |
lemma inverse_le_iff_le_neg [simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
657 |
"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
|
658 |
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
|
659 |
|
36774 | 660 |
lemma one_less_inverse: |
661 |
"0 < a \<Longrightarrow> a < 1 \<Longrightarrow> 1 < inverse a" |
|
662 |
using less_imp_inverse_less [of a 1, unfolded inverse_1] . |
|
663 |
||
664 |
lemma one_le_inverse: |
|
665 |
"0 < a \<Longrightarrow> a \<le> 1 \<Longrightarrow> 1 \<le> inverse a" |
|
666 |
using le_imp_inverse_le [of a 1, unfolded inverse_1] . |
|
667 |
||
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
668 |
lemma pos_le_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
669 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
670 |
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
|
671 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
672 |
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
|
673 |
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
|
674 |
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
|
675 |
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
|
676 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
677 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
678 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
679 |
lemma pos_less_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
680 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
681 |
shows "a < b / c \<longleftrightarrow> a * c < b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
682 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
683 |
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
|
684 |
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
|
685 |
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
|
686 |
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
|
687 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
688 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
689 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
690 |
lemma neg_less_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
691 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
692 |
shows "a < b / c \<longleftrightarrow> b < a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
693 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
694 |
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
|
695 |
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
|
696 |
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
|
697 |
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
|
698 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
699 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
700 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
701 |
lemma neg_le_divide_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
702 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
703 |
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
|
704 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
705 |
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
|
706 |
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
|
707 |
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
|
708 |
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
|
709 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
710 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
711 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
712 |
lemma pos_divide_le_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
713 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
714 |
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
|
715 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
716 |
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
|
717 |
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
|
718 |
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
|
719 |
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
|
720 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
721 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
722 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
723 |
lemma pos_divide_less_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
724 |
assumes "0 < c" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
725 |
shows "b / c < a \<longleftrightarrow> b < a * c" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
726 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
727 |
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
|
728 |
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
|
729 |
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
|
730 |
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
|
731 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
732 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
733 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
734 |
lemma neg_divide_le_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
735 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
736 |
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
|
737 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
738 |
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
|
739 |
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
|
740 |
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
|
741 |
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
|
742 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
743 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
744 |
|
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
745 |
lemma neg_divide_less_eq [field_simps]: |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
746 |
assumes "c < 0" |
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
747 |
shows "b / c < a \<longleftrightarrow> a * c < b" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
748 |
proof - |
59546
3850a2d20f19
times_divide_eq rules are already [simp] despite of comment
haftmann
parents:
59535
diff
changeset
|
749 |
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
|
750 |
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
|
751 |
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
|
752 |
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
|
753 |
finally show ?thesis . |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
754 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
755 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
756 |
text{* The following @{text field_simps} rules are necessary, as minus is always moved atop of |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
757 |
division but we want to get rid of division. *} |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
758 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
759 |
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
|
760 |
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
|
761 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
762 |
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
|
763 |
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
|
764 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
765 |
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
|
766 |
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
|
767 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
768 |
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
|
769 |
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
|
770 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
771 |
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
|
772 |
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
|
773 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
774 |
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
|
775 |
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
|
776 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
777 |
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
|
778 |
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
|
779 |
|
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
780 |
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
|
781 |
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
|
782 |
|
56365
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
783 |
lemma frac_less_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
784 |
"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
|
785 |
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
|
786 |
|
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
787 |
lemma frac_le_eq: |
713f9b9a7e51
New theorems for extracting quotients
paulson <lp15@cam.ac.uk>
parents:
55718
diff
changeset
|
788 |
"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
|
789 |
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
|
790 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
791 |
text{* Lemmas @{text sign_simps} is a first attempt to automate proofs |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
792 |
of positivity/negativity needed for @{text field_simps}. Have not added @{text |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
793 |
sign_simps} to @{text field_simps} because the former can lead to case |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
794 |
explosions. *} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
795 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
796 |
lemmas sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
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
|
797 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
798 |
lemmas (in -) sign_simps = algebra_simps zero_less_mult_iff mult_less_0_iff |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
799 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
800 |
(* Only works once linear arithmetic is installed: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
801 |
text{*An example:*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
802 |
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
|
803 |
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
|
804 |
((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
|
805 |
((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
|
806 |
apply(subgoal_tac "(c-d)*(e-f)*(a-b) > 0") |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
807 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
808 |
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
|
809 |
prefer 2 apply(simp add:sign_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
810 |
apply(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
811 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
812 |
*) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
813 |
|
56541 | 814 |
lemma divide_pos_pos[simp]: |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
815 |
"0 < x ==> 0 < y ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
816 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
817 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
818 |
lemma divide_nonneg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
819 |
"0 <= x ==> 0 < y ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
820 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
821 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
822 |
lemma divide_neg_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
823 |
"x < 0 ==> 0 < y ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
824 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
825 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
826 |
lemma divide_nonpos_pos: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
827 |
"x <= 0 ==> 0 < y ==> x / y <= 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
828 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
829 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
830 |
lemma divide_pos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
831 |
"0 < x ==> y < 0 ==> x / y < 0" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
832 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
833 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
834 |
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
|
835 |
"0 <= x ==> y < 0 ==> x / y <= 0" |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
836 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
837 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
838 |
lemma divide_neg_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
839 |
"x < 0 ==> y < 0 ==> 0 < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
840 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
841 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
842 |
lemma divide_nonpos_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
843 |
"x <= 0 ==> y < 0 ==> 0 <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
844 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
845 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
846 |
lemma divide_strict_right_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
847 |
"[|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
|
848 |
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
|
849 |
positive_imp_inverse_positive) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
850 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
851 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
852 |
lemma divide_strict_right_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
853 |
"[|b < a; c < 0|] ==> a / c < b / c" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
854 |
apply (drule divide_strict_right_mono [of _ _ "-c"], simp) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
855 |
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
|
856 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
857 |
|
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
|
858 |
text{*The last premise ensures that @{term a} and @{term b} |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
859 |
have the same sign*} |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
860 |
lemma divide_strict_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
861 |
"[|b < a; 0 < c; 0 < a*b|] ==> c / a < c / b" |
44921 | 862 |
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
|
863 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
864 |
lemma divide_left_mono: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
865 |
"[|b \<le> a; 0 \<le> c; 0 < a*b|] ==> c / a \<le> c / b" |
44921 | 866 |
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
|
867 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
868 |
lemma divide_strict_left_mono_neg: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
869 |
"[|a < b; c < 0; 0 < a*b|] ==> c / a < c / b" |
44921 | 870 |
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
|
871 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
872 |
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
|
873 |
x / y <= z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
874 |
by (subst pos_divide_le_eq, assumption+) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
875 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
876 |
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
|
877 |
z <= x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
878 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
879 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
880 |
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
|
881 |
x / y < z" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
882 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
883 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
884 |
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
|
885 |
z < x / y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
886 |
by(simp add:field_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
887 |
|
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
|
888 |
lemma frac_le: "0 <= x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
889 |
x <= y ==> 0 < w ==> w <= z ==> x / z <= y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
890 |
apply (rule mult_imp_div_pos_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
891 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
892 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
893 |
apply (rule mult_imp_le_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
894 |
apply (rule mult_mono) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
895 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
896 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
897 |
|
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
|
898 |
lemma frac_less: "0 <= x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
899 |
x < y ==> 0 < w ==> w <= z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
900 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
901 |
apply simp |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
902 |
apply (subst times_divide_eq_left) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
903 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
904 |
apply (erule mult_less_le_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
905 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
906 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
907 |
|
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
|
908 |
lemma frac_less2: "0 < x ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
909 |
x <= y ==> 0 < w ==> w < z ==> x / z < y / w" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
910 |
apply (rule mult_imp_div_pos_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
911 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
912 |
apply (rule mult_imp_less_div_pos, assumption) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
913 |
apply (erule mult_le_less_imp_less) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
914 |
apply simp_all |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
915 |
done |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
916 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
917 |
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
|
918 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
919 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
920 |
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
|
921 |
by (simp add: field_simps zero_less_two) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
922 |
|
53215
5e47c31c6f7c
renamed typeclass dense_linorder to unbounded_dense_linorder
hoelzl
parents:
52435
diff
changeset
|
923 |
subclass unbounded_dense_linorder |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
924 |
proof |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
925 |
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
|
926 |
from less_add_one show "\<exists>y. x < y" .. |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
927 |
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
|
928 |
then have "x - 1 < x + 1 - 1" by simp |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
929 |
then have "x - 1 < x" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
930 |
then show "\<exists>y. y < x" .. |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
931 |
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
|
932 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
933 |
|
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
934 |
lemma nonzero_abs_inverse: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
935 |
"a \<noteq> 0 ==> \<bar>inverse a\<bar> = inverse \<bar>a\<bar>" |
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
|
936 |
apply (auto simp add: neq_iff abs_if nonzero_inverse_minus_eq |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
937 |
negative_imp_inverse_negative) |
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
|
938 |
apply (blast intro: positive_imp_inverse_positive elim: less_asym) |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
939 |
done |
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 nonzero_abs_divide: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
942 |
"b \<noteq> 0 ==> \<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
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
|
943 |
by (simp add: divide_inverse abs_mult nonzero_abs_inverse) |
36301
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 field_le_epsilon: |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
946 |
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
|
947 |
shows "x \<le> y" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
948 |
proof (rule dense_le) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
949 |
fix t assume "t < x" |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
950 |
hence "0 < x - t" by (simp add: less_diff_eq) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
951 |
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
|
952 |
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
|
953 |
then show "t \<le> y" by (simp add: algebra_simps) |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
954 |
qed |
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
955 |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
956 |
lemma inverse_positive_iff_positive [simp]: |
36409 | 957 |
"(0 < inverse a) = (0 < a)" |
21328 | 958 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
959 |
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
|
960 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
961 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
962 |
lemma inverse_negative_iff_negative [simp]: |
36409 | 963 |
"(inverse a < 0) = (a < 0)" |
21328 | 964 |
apply (cases "a = 0", simp) |
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
965 |
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
|
966 |
done |
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
967 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
968 |
lemma inverse_nonnegative_iff_nonnegative [simp]: |
36409 | 969 |
"0 \<le> inverse a \<longleftrightarrow> 0 \<le> a" |
970 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
971 |
|
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
972 |
lemma inverse_nonpositive_iff_nonpositive [simp]: |
36409 | 973 |
"inverse a \<le> 0 \<longleftrightarrow> a \<le> 0" |
974 |
by (simp add: not_less [symmetric]) |
|
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset
|
975 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
976 |
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
|
977 |
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
|
978 |
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
|
979 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
980 |
lemma one_le_inverse_iff: "1 \<le> inverse x \<longleftrightarrow> 0 < x \<and> x \<le> 1" |
36409 | 981 |
proof (cases "x = 1") |
982 |
case True then show ?thesis by simp |
|
983 |
next |
|
984 |
case False then have "inverse x \<noteq> 1" by simp |
|
985 |
then have "1 \<noteq> inverse x" by blast |
|
986 |
then have "1 \<le> inverse x \<longleftrightarrow> 1 < inverse x" by (simp add: le_less) |
|
987 |
with False show ?thesis by (auto simp add: one_less_inverse_iff) |
|
988 |
qed |
|
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset
|
989 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
990 |
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
|
991 |
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
|
992 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
993 |
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
|
994 |
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
|
995 |
|
56481 | 996 |
lemma [divide_simps]: |
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
997 |
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
|
998 |
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
|
999 |
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
|
1000 |
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 | 1001 |
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)" |
1002 |
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)" |
|
1003 |
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)" |
|
1004 |
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
|
1005 |
by (auto simp: field_simps not_less dest: antisym) |
14288 | 1006 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1007 |
text {*Division and Signs*} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1008 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1009 |
lemma |
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1010 |
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
|
1011 |
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
|
1012 |
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
|
1013 |
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 | 1014 |
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
|
1015 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1016 |
text {* Division and the Number One *} |
14353
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1017 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1018 |
text{*Simplify expressions equated with 1*} |
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1019 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1020 |
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
|
1021 |
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
|
1022 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1023 |
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
|
1024 |
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
|
1025 |
|
79f9fbef9106
Added lemmas to Ring_and_Field with slightly modified simplification rules
paulson
parents:
14348
diff
changeset
|
1026 |
text{*Simplify expressions such as @{text "0 < 1/x"} to @{text "0 < x"}*} |
36423 | 1027 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1028 |
lemma zero_le_divide_1_iff [simp]: |
36423 | 1029 |
"0 \<le> 1 / a \<longleftrightarrow> 0 \<le> a" |
1030 |
by (simp add: zero_le_divide_iff) |
|
17085 | 1031 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1032 |
lemma zero_less_divide_1_iff [simp]: |
36423 | 1033 |
"0 < 1 / a \<longleftrightarrow> 0 < a" |
1034 |
by (simp add: zero_less_divide_iff) |
|
1035 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1036 |
lemma divide_le_0_1_iff [simp]: |
36423 | 1037 |
"1 / a \<le> 0 \<longleftrightarrow> a \<le> 0" |
1038 |
by (simp add: divide_le_0_iff) |
|
1039 |
||
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1040 |
lemma divide_less_0_1_iff [simp]: |
36423 | 1041 |
"1 / a < 0 \<longleftrightarrow> a < 0" |
1042 |
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
|
1043 |
|
14293 | 1044 |
lemma divide_right_mono: |
36409 | 1045 |
"[|a \<le> b; 0 \<le> c|] ==> a/c \<le> b/c" |
1046 |
by (force simp add: divide_strict_right_mono le_less) |
|
14293 | 1047 |
|
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
|
1048 |
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
|
1049 |
==> c <= 0 ==> b / c <= a / c" |
23482 | 1050 |
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
|
1051 |
apply auto |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1052 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1053 |
|
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
|
1054 |
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
|
1055 |
==> 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
|
1056 |
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
|
1057 |
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
|
1058 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1059 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1060 |
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
|
1061 |
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
|
1062 |
(auto simp add: field_simps zero_less_mult_iff mult_le_0_iff) |
42904 | 1063 |
|
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1064 |
lemma inverse_less_iff: "inverse a < inverse b \<longleftrightarrow> (0 < a * b \<longrightarrow> b < a) \<and> (a * b \<le> 0 \<longrightarrow> a < b)" |
42904 | 1065 |
by (subst less_le) (auto simp: inverse_le_iff) |
1066 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1067 |
lemma divide_le_cancel: "a / c \<le> b / c \<longleftrightarrow> (0 < c \<longrightarrow> a \<le> b) \<and> (c < 0 \<longrightarrow> b \<le> a)" |
42904 | 1068 |
by (simp add: divide_inverse mult_le_cancel_right) |
1069 |
||
56480
093ea91498e6
field_simps: better support for negation and division, and power
hoelzl
parents:
56479
diff
changeset
|
1070 |
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 | 1071 |
by (auto simp add: divide_inverse mult_less_cancel_right) |
1072 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1073 |
text{*Simplify quotients that are compared with the value 1.*} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1074 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1075 |
lemma le_divide_eq_1: |
36409 | 1076 |
"(1 \<le> b / a) = ((0 < a & a \<le> b) | (a < 0 & b \<le> a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1077 |
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
|
1078 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1079 |
lemma divide_le_eq_1: |
36409 | 1080 |
"(b / a \<le> 1) = ((0 < a & b \<le> a) | (a < 0 & a \<le> b) | a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1081 |
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
|
1082 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1083 |
lemma less_divide_eq_1: |
36409 | 1084 |
"(1 < b / a) = ((0 < a & a < b) | (a < 0 & b < a))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1085 |
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
|
1086 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1087 |
lemma divide_less_eq_1: |
36409 | 1088 |
"(b / a < 1) = ((0 < a & b < a) | (a < 0 & a < b) | a=0)" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1089 |
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
|
1090 |
|
56571
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1091 |
lemma divide_nonneg_nonneg [simp]: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1092 |
"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
|
1093 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1094 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1095 |
lemma divide_nonpos_nonpos: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1096 |
"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
|
1097 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1098 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1099 |
lemma divide_nonneg_nonpos: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1100 |
"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
|
1101 |
by (auto simp add: divide_simps) |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1102 |
|
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1103 |
lemma divide_nonpos_nonneg: |
f4635657d66f
added divide_nonneg_nonneg and co; made it a simp rule
hoelzl
parents:
56541
diff
changeset
|
1104 |
"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
|
1105 |
by (auto simp add: divide_simps) |
23389 | 1106 |
|
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1107 |
text {*Conditional Simplification Rules: No Case Splits*} |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1108 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1109 |
lemma le_divide_eq_1_pos [simp]: |
36409 | 1110 |
"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
|
1111 |
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
|
1112 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1113 |
lemma le_divide_eq_1_neg [simp]: |
36409 | 1114 |
"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
|
1115 |
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
|
1116 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1117 |
lemma divide_le_eq_1_pos [simp]: |
36409 | 1118 |
"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
|
1119 |
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
|
1120 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1121 |
lemma divide_le_eq_1_neg [simp]: |
36409 | 1122 |
"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
|
1123 |
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
|
1124 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1125 |
lemma less_divide_eq_1_pos [simp]: |
36409 | 1126 |
"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
|
1127 |
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
|
1128 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1129 |
lemma less_divide_eq_1_neg [simp]: |
36409 | 1130 |
"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
|
1131 |
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
|
1132 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1133 |
lemma divide_less_eq_1_pos [simp]: |
36409 | 1134 |
"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
|
1135 |
by (auto simp add: divide_less_eq) |
bb99c2e705ca
tidied, and added missing thm divide_less_eq_1_neg
paulson
parents:
18623
diff
changeset
|
1136 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1137 |
lemma divide_less_eq_1_neg [simp]: |
36409 | 1138 |
"a < 0 \<Longrightarrow> b/a < 1 <-> a < b" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1139 |
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
|
1140 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1141 |
lemma eq_divide_eq_1 [simp]: |
36409 | 1142 |
"(1 = b/a) = ((a \<noteq> 0 & a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1143 |
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
|
1144 |
|
54147
97a8ff4e4ac9
killed most "no_atp", to make Sledgehammer more complete
blanchet
parents:
53374
diff
changeset
|
1145 |
lemma divide_eq_eq_1 [simp]: |
36409 | 1146 |
"(b/a = 1) = ((a \<noteq> 0 & a = b))" |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1147 |
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
|
1148 |
|
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
1149 |
lemma abs_inverse [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
|
1150 |
"\<bar>inverse a\<bar> = |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1151 |
inverse \<bar>a\<bar>" |
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
|
1152 |
apply (cases "a=0", simp) |
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
|
1153 |
apply (simp add: nonzero_abs_inverse) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
1154 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
1155 |
|
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
1156 |
lemma abs_divide [simp]: |
36409 | 1157 |
"\<bar>a / b\<bar> = \<bar>a\<bar> / \<bar>b\<bar>" |
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
|
1158 |
apply (cases "b=0", simp) |
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
|
1159 |
apply (simp add: nonzero_abs_divide) |
14294
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
1160 |
done |
f4d806fd72ce
absolute value theorems moved to HOL/Ring_and_Field
paulson
parents:
14293
diff
changeset
|
1161 |
|
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
|
1162 |
lemma abs_div_pos: "0 < y ==> |
36301
72f4d079ebf8
more localization; factored out lemmas for division_ring
haftmann
parents:
35828
diff
changeset
|
1163 |
\<bar>x\<bar> / y = \<bar>x / y\<bar>" |
25304
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1164 |
apply (subst abs_divide) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1165 |
apply (simp add: order_less_imp_le) |
7491c00f0915
removed subclass edge ordered_ring < lordered_ring
haftmann
parents:
25267
diff
changeset
|
1166 |
done |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset
|
1167 |
|
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
|
1168 |
lemma zero_le_divide_abs_iff [simp]: "(0 \<le> a / abs b) = (0 \<le> a | b = 0)" |
55718
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1169 |
by (auto simp: zero_le_divide_iff) |
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1170 |
|
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
|
1171 |
lemma divide_le_0_abs_iff [simp]: "(a / abs b \<le> 0) = (a \<le> 0 | b = 0)" |
55718
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1172 |
by (auto simp: divide_le_0_iff) |
34618f031ba9
A few lemmas about summations, etc.
paulson <lp15@cam.ac.uk>
parents:
54230
diff
changeset
|
1173 |
|
35579
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1174 |
lemma field_le_mult_one_interval: |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1175 |
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
|
1176 |
shows "x \<le> y" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1177 |
proof (cases "0 < x") |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1178 |
assume "0 < x" |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1179 |
thus ?thesis |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1180 |
using dense_le_bounded[of 0 1 "y/x"] * |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1181 |
unfolding le_divide_eq if_P[OF `0 < x`] by simp |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1182 |
next |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1183 |
assume "\<not>0 < x" hence "x \<le> 0" by simp |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1184 |
obtain s::'a where s: "0 < s" "s < 1" using dense[of 0 "1\<Colon>'a"] by auto |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1185 |
hence "x \<le> s * x" using mult_le_cancel_right[of 1 x s] `x \<le> 0` by auto |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1186 |
also note *[OF s] |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1187 |
finally show ?thesis . |
cc9a5a0ab5ea
Add dense_le, dense_le_bounded, field_le_mult_one_interval.
hoelzl
parents:
35216
diff
changeset
|
1188 |
qed |
35090
88cc65ae046e
moved lemma field_le_epsilon from Real.thy to Fields.thy
haftmann
parents:
35084
diff
changeset
|
1189 |
|
36409 | 1190 |
end |
1191 |
||
59557 | 1192 |
hide_fact (open) field_inverse field_divide_inverse field_inverse_zero |
1193 |
||
52435
6646bb548c6b
migration from code_(const|type|class|instance) to code_printing and from code_module to code_identifier
haftmann
parents:
44921
diff
changeset
|
1194 |
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
|
1195 |
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
|
1196 |
|
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset
|
1197 |
end |