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