author  huffman 
Thu, 09 Nov 2006 00:43:12 +0100  
changeset 21258  62f25a96f0c1 
parent 21199  2d83f93c3580 
child 21328  73bb86d0f483 
permissions  rwrr 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

1 
(* Title: HOL/Ring_and_Field.thy 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

2 
ID: $Id$ 
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

3 
Author: Gertrud Bauer, Steven Obua, Lawrence C Paulson, and Markus Wenzel, 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

4 
with contributions by Jeremy Avigad 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

5 
*) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

6 

14738  7 
header {* (Ordered) Rings and Fields *} 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

8 

15229  9 
theory Ring_and_Field 
15140  10 
imports OrderedGroup 
15131  11 
begin 
14504  12 

14738  13 
text {* 
14 
The theory of partially ordered rings is taken from the books: 

15 
\begin{itemize} 

16 
\item \emph{Lattice Theory} by Garret Birkhoff, American Mathematical Society 1979 

17 
\item \emph{Partially Ordered Algebraic Systems}, Pergamon Press 1963 

18 
\end{itemize} 

19 
Most of the used notions can also be looked up in 

20 
\begin{itemize} 

14770  21 
\item \url{http://www.mathworld.com} by Eric Weisstein et. al. 
14738  22 
\item \emph{Algebra I} by van der Waerden, Springer. 
23 
\end{itemize} 

24 
*} 

14504  25 

14738  26 
axclass semiring \<subseteq> ab_semigroup_add, semigroup_mult 
27 
left_distrib: "(a + b) * c = a * c + b * c" 

28 
right_distrib: "a * (b + c) = a * b + a * c" 

14504  29 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

30 
axclass mult_zero \<subseteq> times, zero 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

31 
mult_zero_left [simp]: "0 * a = 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

32 
mult_zero_right [simp]: "a * 0 = 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

33 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

34 
axclass semiring_0 \<subseteq> semiring, comm_monoid_add, mult_zero 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

35 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

36 
axclass semiring_0_cancel \<subseteq> semiring, comm_monoid_add, cancel_ab_semigroup_add 
14504  37 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

38 
instance semiring_0_cancel \<subseteq> semiring_0 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

39 
proof 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

40 
fix a :: 'a 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

41 
have "0 * a + 0 * a = 0 * a + 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

42 
by (simp add: left_distrib [symmetric]) 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

43 
thus "0 * a = 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

44 
by (simp only: add_left_cancel) 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

45 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

46 
have "a * 0 + a * 0 = a * 0 + 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

47 
by (simp add: right_distrib [symmetric]) 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

48 
thus "a * 0 = 0" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

49 
by (simp only: add_left_cancel) 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

50 
qed 
14940  51 

14738  52 
axclass comm_semiring \<subseteq> ab_semigroup_add, ab_semigroup_mult 
53 
distrib: "(a + b) * c = a * c + b * c" 

14504  54 

14738  55 
instance comm_semiring \<subseteq> semiring 
56 
proof 

57 
fix a b c :: 'a 

58 
show "(a + b) * c = a * c + b * c" by (simp add: distrib) 

59 
have "a * (b + c) = (b + c) * a" by (simp add: mult_ac) 

60 
also have "... = b * a + c * a" by (simp only: distrib) 

61 
also have "... = a * b + a * c" by (simp add: mult_ac) 

62 
finally show "a * (b + c) = a * b + a * c" by blast 

14504  63 
qed 
64 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

65 
axclass comm_semiring_0 \<subseteq> comm_semiring, comm_monoid_add, mult_zero 
14504  66 

14738  67 
instance comm_semiring_0 \<subseteq> semiring_0 .. 
14504  68 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

69 
axclass comm_semiring_0_cancel \<subseteq> comm_semiring, comm_monoid_add, cancel_ab_semigroup_add 
14940  70 

71 
instance comm_semiring_0_cancel \<subseteq> semiring_0_cancel .. 

72 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

73 
instance comm_semiring_0_cancel \<subseteq> comm_semiring_0 .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

74 

20609  75 
axclass zero_neq_one \<subseteq> zero, one 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

76 
zero_neq_one [simp]: "0 \<noteq> 1" 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

77 

20609  78 
axclass semiring_1 \<subseteq> zero_neq_one, semiring_0, monoid_mult 
14504  79 

20609  80 
axclass comm_semiring_1 \<subseteq> zero_neq_one, comm_semiring_0, comm_monoid_mult (* previously almost_semiring *) 
14738  81 

82 
instance comm_semiring_1 \<subseteq> semiring_1 .. 

14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

83 

20609  84 
axclass no_zero_divisors \<subseteq> zero, times 
14738  85 
no_zero_divisors: "a \<noteq> 0 \<Longrightarrow> b \<noteq> 0 \<Longrightarrow> a * b \<noteq> 0" 
14504  86 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

87 
axclass semiring_1_cancel \<subseteq> semiring, comm_monoid_add, zero_neq_one, cancel_ab_semigroup_add, monoid_mult 
14940  88 

89 
instance semiring_1_cancel \<subseteq> semiring_0_cancel .. 

90 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

91 
instance semiring_1_cancel \<subseteq> semiring_1 .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

92 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

93 
axclass comm_semiring_1_cancel \<subseteq> 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

94 
comm_semiring, comm_monoid_add, comm_monoid_mult, 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

95 
zero_neq_one, cancel_ab_semigroup_add 
14738  96 

14940  97 
instance comm_semiring_1_cancel \<subseteq> semiring_1_cancel .. 
98 

99 
instance comm_semiring_1_cancel \<subseteq> comm_semiring_0_cancel .. 

100 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

101 
instance comm_semiring_1_cancel \<subseteq> comm_semiring_1 .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

102 

14738  103 
axclass ring \<subseteq> semiring, ab_group_add 
104 

14940  105 
instance ring \<subseteq> semiring_0_cancel .. 
14504  106 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

107 
axclass comm_ring \<subseteq> comm_semiring, ab_group_add 
14738  108 

109 
instance comm_ring \<subseteq> ring .. 

14504  110 

14940  111 
instance comm_ring \<subseteq> comm_semiring_0_cancel .. 
14738  112 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

113 
axclass ring_1 \<subseteq> ring, zero_neq_one, monoid_mult 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

114 

14940  115 
instance ring_1 \<subseteq> semiring_1_cancel .. 
116 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

117 
axclass comm_ring_1 \<subseteq> comm_ring, zero_neq_one, comm_monoid_mult (* previously ring *) 
14738  118 

119 
instance comm_ring_1 \<subseteq> ring_1 .. 

14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

120 

14738  121 
instance comm_ring_1 \<subseteq> comm_semiring_1_cancel .. 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

122 

20609  123 
axclass idom \<subseteq> comm_ring_1, no_zero_divisors 
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

124 

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

125 
axclass division_ring \<subseteq> ring_1, inverse 
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

126 
left_inverse [simp]: "a \<noteq> 0 ==> inverse a * a = 1" 
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

127 
right_inverse [simp]: "a \<noteq> 0 ==> a * inverse a = 1" 
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

128 

14738  129 
axclass field \<subseteq> comm_ring_1, inverse 
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

130 
field_left_inverse: "a \<noteq> 0 ==> inverse a * a = 1" 
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

131 
divide_inverse: "a / b = a * inverse b" 
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

132 

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

133 
lemma field_right_inverse: 
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

134 
assumes not0: "a \<noteq> 0" shows "a * inverse (a::'a::field) = 1" 
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

135 
proof  
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

136 
have "a * inverse a = inverse a * a" by (rule mult_commute) 
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

137 
also have "... = 1" using not0 by (rule field_left_inverse) 
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

138 
finally show ?thesis . 
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

139 
qed 
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

140 

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

141 
instance field \<subseteq> division_ring 
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

142 
by (intro_classes, erule field_left_inverse, erule field_right_inverse) 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

143 

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

144 
lemma field_mult_eq_0_iff [simp]: 
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

145 
"(a*b = (0::'a::division_ring)) = (a = 0  b = 0)" 
14738  146 
proof cases 
147 
assume "a=0" thus ?thesis by simp 

148 
next 

149 
assume anz [simp]: "a\<noteq>0" 

150 
{ assume "a * b = 0" 

151 
hence "inverse a * (a * b) = 0" by simp 

152 
hence "b = 0" by (simp (no_asm_use) add: mult_assoc [symmetric])} 

153 
thus ?thesis by force 

154 
qed 

155 

156 
instance field \<subseteq> idom 

157 
by (intro_classes, simp) 

20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

158 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

159 
axclass division_by_zero \<subseteq> zero, inverse 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

160 
inverse_zero [simp]: "inverse 0 = 0" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

161 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

162 
subsection {* Distribution rules *} 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

163 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

164 
theorems ring_distrib = right_distrib left_distrib 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

165 

14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

166 
text{*For the @{text combine_numerals} simproc*} 
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

167 
lemma combine_common_factor: 
14738  168 
"a*e + (b*e + c) = (a+b)*e + (c::'a::semiring)" 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

169 
by (simp add: left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

170 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

171 
lemma minus_mult_left: " (a * b) = (a) * (b::'a::ring)" 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

172 
apply (rule equals_zero_I) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

173 
apply (simp add: left_distrib [symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

174 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

175 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

176 
lemma minus_mult_right: " (a * b) = a * (b::'a::ring)" 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

177 
apply (rule equals_zero_I) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

178 
apply (simp add: right_distrib [symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

179 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

180 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

181 
lemma minus_mult_minus [simp]: "( a) * ( b) = a * (b::'a::ring)" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

182 
by (simp add: minus_mult_left [symmetric] minus_mult_right [symmetric]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

183 

14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

184 
lemma minus_mult_commute: "( a) * b = a * ( b::'a::ring)" 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

185 
by (simp add: minus_mult_left [symmetric] minus_mult_right [symmetric]) 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

186 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

187 
lemma right_diff_distrib: "a * (b  c) = a * b  a * (c::'a::ring)" 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

188 
by (simp add: right_distrib diff_minus 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

189 
minus_mult_left [symmetric] minus_mult_right [symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

190 

14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

191 
lemma left_diff_distrib: "(a  b) * c = a * c  b * (c::'a::ring)" 
14738  192 
by (simp add: left_distrib diff_minus 
193 
minus_mult_left [symmetric] minus_mult_right [symmetric]) 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

194 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

195 
axclass mult_mono \<subseteq> times, zero, ord 
14738  196 
mult_left_mono: "a <= b \<Longrightarrow> 0 <= c \<Longrightarrow> c * a <= c * b" 
197 
mult_right_mono: "a <= b \<Longrightarrow> 0 <= c \<Longrightarrow> a * c <= b * c" 

14267
b963e9cee2a0
More refinements to Ring_and_Field and numerics. Conversion of Divides_lemmas
paulson
parents:
14266
diff
changeset

198 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

199 
axclass pordered_semiring \<subseteq> mult_mono, semiring_0, pordered_ab_semigroup_add 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

200 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

201 
axclass pordered_cancel_semiring \<subseteq> 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

202 
mult_mono, pordered_ab_semigroup_add, 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

203 
semiring, comm_monoid_add, 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

204 
pordered_ab_semigroup_add, cancel_ab_semigroup_add 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

205 

14940  206 
instance pordered_cancel_semiring \<subseteq> semiring_0_cancel .. 
207 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

208 
instance pordered_cancel_semiring \<subseteq> pordered_semiring .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

209 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

210 
axclass ordered_semiring_strict \<subseteq> semiring, comm_monoid_add, ordered_cancel_ab_semigroup_add 
14738  211 
mult_strict_left_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b" 
212 
mult_strict_right_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> a * c < b * c" 

14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset

213 

14940  214 
instance ordered_semiring_strict \<subseteq> semiring_0_cancel .. 
215 

14738  216 
instance ordered_semiring_strict \<subseteq> pordered_cancel_semiring 
217 
apply intro_classes 

218 
apply (case_tac "a < b & 0 < c") 

219 
apply (auto simp add: mult_strict_left_mono order_less_le) 

220 
apply (auto simp add: mult_strict_left_mono order_le_less) 

221 
apply (simp add: mult_strict_right_mono) 

14270  222 
done 
223 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

224 
axclass mult_mono1 \<subseteq> times, zero, ord 
14738  225 
mult_mono: "a <= b \<Longrightarrow> 0 <= c \<Longrightarrow> c * a <= c * b" 
14270  226 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

227 
axclass pordered_comm_semiring \<subseteq> comm_semiring_0, pordered_ab_semigroup_add, mult_mono1 
14270  228 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

229 
axclass pordered_cancel_comm_semiring \<subseteq> 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

230 
comm_semiring_0_cancel, pordered_ab_semigroup_add, mult_mono1 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

231 

14738  232 
instance pordered_cancel_comm_semiring \<subseteq> pordered_comm_semiring .. 
14270  233 

14738  234 
axclass ordered_comm_semiring_strict \<subseteq> comm_semiring_0, ordered_cancel_ab_semigroup_add 
235 
mult_strict_mono: "a < b \<Longrightarrow> 0 < c \<Longrightarrow> c * a < c * b" 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

236 

14738  237 
instance pordered_comm_semiring \<subseteq> pordered_semiring 
21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

238 
proof 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

239 
fix a b c :: 'a 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

240 
assume A: "a <= b" "0 <= c" 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

241 
with mult_mono show "c * a <= c * b" . 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

242 

2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

243 
from mult_commute have "a * c = c * a" .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

244 
also from mult_mono A have "\<dots> <= c * b" . 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

245 
also from mult_commute have "c * b = b * c" .. 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

246 
finally show "a * c <= b * c" . 
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

247 
qed 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

248 

14738  249 
instance pordered_cancel_comm_semiring \<subseteq> pordered_cancel_semiring .. 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

250 

14738  251 
instance ordered_comm_semiring_strict \<subseteq> ordered_semiring_strict 
252 
by (intro_classes, insert mult_strict_mono, simp_all add: mult_commute, blast+) 

14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

253 

14738  254 
instance ordered_comm_semiring_strict \<subseteq> pordered_cancel_comm_semiring 
255 
apply (intro_classes) 

256 
apply (case_tac "a < b & 0 < c") 

257 
apply (auto simp add: mult_strict_left_mono order_less_le) 

258 
apply (auto simp add: mult_strict_left_mono order_le_less) 

14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

259 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

260 

21199
2d83f93c3580
* Added annihilation axioms ("x * 0 = 0") to axclass semiring_0.
krauss
parents:
20633
diff
changeset

261 
axclass pordered_ring \<subseteq> ring, pordered_cancel_semiring 
14270  262 

14738  263 
instance pordered_ring \<subseteq> pordered_ab_group_add .. 
14270  264 

14738  265 
axclass lordered_ring \<subseteq> pordered_ring, lordered_ab_group_abs 
14270  266 

14940  267 
instance lordered_ring \<subseteq> lordered_ab_group_meet .. 
268 

269 
instance lordered_ring \<subseteq> lordered_ab_group_join .. 

270 

20633  271 
axclass abs_if \<subseteq> minus, ord, zero 
14738  272 
abs_if: "abs a = (if (a < 0) then (a) else a)" 
14270  273 

20633  274 
axclass ordered_ring_strict \<subseteq> ring, ordered_semiring_strict, abs_if 
14270  275 

14738  276 
instance ordered_ring_strict \<subseteq> lordered_ab_group .. 
14270  277 

14738  278 
instance ordered_ring_strict \<subseteq> lordered_ring 
279 
by (intro_classes, simp add: abs_if join_eq_if) 

14270  280 

14738  281 
axclass pordered_comm_ring \<subseteq> comm_ring, pordered_comm_semiring 
14270  282 

14738  283 
axclass ordered_semidom \<subseteq> comm_semiring_1_cancel, ordered_comm_semiring_strict (* previously ordered_semiring *) 
284 
zero_less_one [simp]: "0 < 1" 

14270  285 

20633  286 
axclass ordered_idom \<subseteq> comm_ring_1, ordered_comm_semiring_strict, abs_if (* previously ordered_ring *) 
14270  287 

14738  288 
instance ordered_idom \<subseteq> ordered_ring_strict .. 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

289 

14738  290 
axclass ordered_field \<subseteq> field, ordered_idom 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

291 

15923  292 
lemmas linorder_neqE_ordered_idom = 
293 
linorder_neqE[where 'a = "?'b::ordered_idom"] 

294 

14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

295 
lemma eq_add_iff1: 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

296 
"(a*e + c = b*e + d) = ((ab)*e + c = (d::'a::ring))" 
14738  297 
apply (simp add: diff_minus left_distrib) 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

298 
apply (simp add: diff_minus left_distrib add_ac) 
14738  299 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

300 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

301 

5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

302 
lemma eq_add_iff2: 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

303 
"(a*e + c = b*e + d) = (c = (ba)*e + (d::'a::ring))" 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

304 
apply (simp add: diff_minus left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

305 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

306 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

307 

5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

308 
lemma less_add_iff1: 
14738  309 
"(a*e + c < b*e + d) = ((ab)*e + c < (d::'a::pordered_ring))" 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

310 
apply (simp add: diff_minus left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

311 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

312 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

313 

5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

314 
lemma less_add_iff2: 
14738  315 
"(a*e + c < b*e + d) = (c < (ba)*e + (d::'a::pordered_ring))" 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

316 
apply (simp add: diff_minus left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

317 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

318 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

319 

5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

320 
lemma le_add_iff1: 
14738  321 
"(a*e + c \<le> b*e + d) = ((ab)*e + c \<le> (d::'a::pordered_ring))" 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

322 
apply (simp add: diff_minus left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

323 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

324 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

325 

5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

326 
lemma le_add_iff2: 
14738  327 
"(a*e + c \<le> b*e + d) = (c \<le> (ba)*e + (d::'a::pordered_ring))" 
14272
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

328 
apply (simp add: diff_minus left_distrib add_ac) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

329 
apply (simp add: compare_rls minus_mult_left [symmetric]) 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

330 
done 
5efbb548107d
Tidying of the integer development; towards removing the
paulson
parents:
14270
diff
changeset

331 

14270  332 
subsection {* Ordering Rules for Multiplication *} 
333 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

334 
lemma mult_left_le_imp_le: 
14738  335 
"[c*a \<le> c*b; 0 < c] ==> a \<le> (b::'a::ordered_semiring_strict)" 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

336 
by (force simp add: mult_strict_left_mono linorder_not_less [symmetric]) 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

337 

744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

338 
lemma mult_right_le_imp_le: 
14738  339 
"[a*c \<le> b*c; 0 < c] ==> a \<le> (b::'a::ordered_semiring_strict)" 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

340 
by (force simp add: mult_strict_right_mono linorder_not_less [symmetric]) 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

341 

744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

342 
lemma mult_left_less_imp_less: 
14738  343 
"[c*a < c*b; 0 \<le> c] ==> a < (b::'a::ordered_semiring_strict)" 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

344 
by (force simp add: mult_left_mono linorder_not_le [symmetric]) 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

345 

744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

346 
lemma mult_right_less_imp_less: 
14738  347 
"[a*c < b*c; 0 \<le> c] ==> a < (b::'a::ordered_semiring_strict)" 
14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

348 
by (force simp add: mult_right_mono linorder_not_le [symmetric]) 
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

349 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

350 
lemma mult_strict_left_mono_neg: 
14738  351 
"[b < a; c < 0] ==> c * a < c * (b::'a::ordered_ring_strict)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

352 
apply (drule mult_strict_left_mono [of _ _ "c"]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

353 
apply (simp_all add: minus_mult_left [symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

354 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

355 

14738  356 
lemma mult_left_mono_neg: 
357 
"[b \<le> a; c \<le> 0] ==> c * a \<le> c * (b::'a::pordered_ring)" 

358 
apply (drule mult_left_mono [of _ _ "c"]) 

359 
apply (simp_all add: minus_mult_left [symmetric]) 

360 
done 

361 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

362 
lemma mult_strict_right_mono_neg: 
14738  363 
"[b < a; c < 0] ==> a * c < b * (c::'a::ordered_ring_strict)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

364 
apply (drule mult_strict_right_mono [of _ _ "c"]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

365 
apply (simp_all add: minus_mult_right [symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

366 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

367 

14738  368 
lemma mult_right_mono_neg: 
369 
"[b \<le> a; c \<le> 0] ==> a * c \<le> (b::'a::pordered_ring) * c" 

370 
apply (drule mult_right_mono [of _ _ "c"]) 

371 
apply (simp) 

372 
apply (simp_all add: minus_mult_right [symmetric]) 

373 
done 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

374 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

375 
subsection{* Products of Signs *} 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

376 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

377 
lemma mult_pos_pos: "[ (0::'a::ordered_semiring_strict) < a; 0 < b ] ==> 0 < a*b" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

378 
by (drule mult_strict_left_mono [of 0 b], auto) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

379 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

380 
lemma mult_nonneg_nonneg: "[ (0::'a::pordered_cancel_semiring) \<le> a; 0 \<le> b ] ==> 0 \<le> a*b" 
14738  381 
by (drule mult_left_mono [of 0 b], auto) 
382 

383 
lemma mult_pos_neg: "[ (0::'a::ordered_semiring_strict) < a; b < 0 ] ==> a*b < 0" 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

384 
by (drule mult_strict_left_mono [of b 0], auto) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

385 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

386 
lemma mult_nonneg_nonpos: "[ (0::'a::pordered_cancel_semiring) \<le> a; b \<le> 0 ] ==> a*b \<le> 0" 
14738  387 
by (drule mult_left_mono [of b 0], auto) 
388 

389 
lemma mult_pos_neg2: "[ (0::'a::ordered_semiring_strict) < a; b < 0 ] ==> b*a < 0" 

390 
by (drule mult_strict_right_mono[of b 0], auto) 

391 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

392 
lemma mult_nonneg_nonpos2: "[ (0::'a::pordered_cancel_semiring) \<le> a; b \<le> 0 ] ==> b*a \<le> 0" 
14738  393 
by (drule mult_right_mono[of b 0], auto) 
394 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

395 
lemma mult_neg_neg: "[ a < (0::'a::ordered_ring_strict); b < 0 ] ==> 0 < a*b" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

396 
by (drule mult_strict_right_mono_neg, auto) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

397 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

398 
lemma mult_nonpos_nonpos: "[ a \<le> (0::'a::pordered_ring); b \<le> 0 ] ==> 0 \<le> a*b" 
14738  399 
by (drule mult_right_mono_neg[of a 0 b ], auto) 
400 

14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset

401 
lemma zero_less_mult_pos: 
14738  402 
"[ 0 < a*b; 0 < a] ==> 0 < (b::'a::ordered_semiring_strict)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

403 
apply (case_tac "b\<le>0") 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

404 
apply (auto simp add: order_le_less linorder_not_less) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

405 
apply (drule_tac mult_pos_neg [of a b]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

406 
apply (auto dest: order_less_not_sym) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

407 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

408 

14738  409 
lemma zero_less_mult_pos2: 
410 
"[ 0 < b*a; 0 < a] ==> 0 < (b::'a::ordered_semiring_strict)" 

411 
apply (case_tac "b\<le>0") 

412 
apply (auto simp add: order_le_less linorder_not_less) 

413 
apply (drule_tac mult_pos_neg2 [of a b]) 

414 
apply (auto dest: order_less_not_sym) 

415 
done 

416 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

417 
lemma zero_less_mult_iff: 
14738  418 
"((0::'a::ordered_ring_strict) < 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

419 
apply (auto simp add: order_le_less linorder_not_less mult_pos_pos 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

420 
mult_neg_neg) 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

421 
apply (blast dest: zero_less_mult_pos) 
14738  422 
apply (blast dest: zero_less_mult_pos2) 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

423 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

424 

14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset

425 
text{*A field has no "zero divisors", and this theorem holds without the 
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

426 
assumption of an ordering. See @{text field_mult_eq_0_iff} below.*} 
14738  427 
lemma mult_eq_0_iff [simp]: "(a*b = (0::'a::ordered_ring_strict)) = (a = 0  b = 0)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

428 
apply (case_tac "a < 0") 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

429 
apply (auto simp add: linorder_not_less order_le_less linorder_neq_iff) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

430 
apply (force dest: mult_strict_right_mono_neg mult_strict_right_mono)+ 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

431 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

432 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

433 
lemma zero_le_mult_iff: 
14738  434 
"((0::'a::ordered_ring_strict) \<le> a*b) = (0 \<le> a & 0 \<le> b  a \<le> 0 & b \<le> 0)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

435 
by (auto simp add: eq_commute [of 0] order_le_less linorder_not_less 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

436 
zero_less_mult_iff) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

437 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

438 
lemma mult_less_0_iff: 
14738  439 
"(a*b < (0::'a::ordered_ring_strict)) = (0 < a & b < 0  a < 0 & 0 < b)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

440 
apply (insert zero_less_mult_iff [of "a" b]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

441 
apply (force simp add: minus_mult_left[symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

442 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

443 

95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

444 
lemma mult_le_0_iff: 
14738  445 
"(a*b \<le> (0::'a::ordered_ring_strict)) = (0 \<le> a & b \<le> 0  a \<le> 0 & 0 \<le> b)" 
14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

446 
apply (insert zero_le_mult_iff [of "a" b]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

447 
apply (force simp add: minus_mult_left[symmetric]) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

448 
done 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

449 

14738  450 
lemma split_mult_pos_le: "(0 \<le> a & 0 \<le> b)  (a \<le> 0 & b \<le> 0) \<Longrightarrow> 0 \<le> a * (b::_::pordered_ring)" 
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

451 
by (auto simp add: mult_nonneg_nonneg mult_nonpos_nonpos) 
14738  452 

453 
lemma split_mult_neg_le: "(0 \<le> a & b \<le> 0)  (a \<le> 0 & 0 \<le> b) \<Longrightarrow> a * b \<le> (0::_::pordered_cancel_semiring)" 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

454 
by (auto simp add: mult_nonneg_nonpos mult_nonneg_nonpos2) 
14738  455 

456 
lemma zero_le_square: "(0::'a::ordered_ring_strict) \<le> a*a" 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

457 
by (simp add: zero_le_mult_iff linorder_linear) 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

458 

14738  459 
text{*Proving axiom @{text zero_less_one} makes all @{text ordered_semidom} 
460 
theorems available to members of @{term ordered_idom} *} 

461 

462 
instance ordered_idom \<subseteq> ordered_semidom 

14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

463 
proof 
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

464 
have "(0::'a) \<le> 1*1" by (rule zero_le_square) 
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

465 
thus "(0::'a) < 1" by (simp add: order_le_less) 
14421
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

466 
qed 
ee97b6463cb4
new Ring_and_Field hierarchy, eliminating redundant axioms
paulson
parents:
14398
diff
changeset

467 

20609  468 
instance ordered_ring_strict \<subseteq> no_zero_divisors 
14738  469 
by (intro_classes, simp) 
470 

471 
instance ordered_idom \<subseteq> idom .. 

472 

14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

473 
text{*All three types of comparision involving 0 and 1 are covered.*} 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

474 

17085  475 
lemmas one_neq_zero = zero_neq_one [THEN not_sym] 
476 
declare one_neq_zero [simp] 

14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

477 

14738  478 
lemma zero_le_one [simp]: "(0::'a::ordered_semidom) \<le> 1" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

479 
by (rule zero_less_one [THEN order_less_imp_le]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

480 

14738  481 
lemma not_one_le_zero [simp]: "~ (1::'a::ordered_semidom) \<le> 0" 
482 
by (simp add: linorder_not_le) 

14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

483 

14738  484 
lemma not_one_less_zero [simp]: "~ (1::'a::ordered_semidom) < 0" 
485 
by (simp add: linorder_not_less) 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

486 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

487 
subsection{*More Monotonicity*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

488 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

489 
text{*Strict monotonicity in both arguments*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

490 
lemma mult_strict_mono: 
14738  491 
"[a<b; c<d; 0<b; 0\<le>c] ==> a * c < b * (d::'a::ordered_semiring_strict)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

492 
apply (case_tac "c=0") 
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

493 
apply (simp add: mult_pos_pos) 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

494 
apply (erule mult_strict_right_mono [THEN order_less_trans]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

495 
apply (force simp add: order_le_less) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

496 
apply (erule mult_strict_left_mono, assumption) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

497 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

498 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

499 
text{*This weaker variant has more natural premises*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

500 
lemma mult_strict_mono': 
14738  501 
"[ a<b; c<d; 0 \<le> a; 0 \<le> c] ==> a * c < b * (d::'a::ordered_semiring_strict)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

502 
apply (rule mult_strict_mono) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

503 
apply (blast intro: order_le_less_trans)+ 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

504 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

505 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

506 
lemma mult_mono: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

507 
"[a \<le> b; c \<le> d; 0 \<le> b; 0 \<le> c] 
14738  508 
==> a * c \<le> b * (d::'a::pordered_semiring)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

509 
apply (erule mult_right_mono [THEN order_trans], assumption) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

510 
apply (erule mult_left_mono, assumption) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

511 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

512 

21258  513 
lemma mult_mono': 
514 
"[a \<le> b; c \<le> d; 0 \<le> a; 0 \<le> c] 

515 
==> a * c \<le> b * (d::'a::pordered_semiring)" 

516 
apply (rule mult_mono) 

517 
apply (fast intro: order_trans)+ 

518 
done 

519 

14738  520 
lemma less_1_mult: "[ 1 < m; 1 < n ] ==> 1 < m*(n::'a::ordered_semidom)" 
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

521 
apply (insert mult_strict_mono [of 1 m 1 n]) 
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

522 
apply (simp add: order_less_trans [OF zero_less_one]) 
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

523 
done 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

524 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

525 
lemma mult_less_le_imp_less: "(a::'a::ordered_semiring_strict) < b ==> 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

526 
c <= d ==> 0 <= a ==> 0 < c ==> a * c < b * d" 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

527 
apply (subgoal_tac "a * c < b * c") 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

528 
apply (erule order_less_le_trans) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

529 
apply (erule mult_left_mono) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

530 
apply simp 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

531 
apply (erule mult_strict_right_mono) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

532 
apply assumption 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

533 
done 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

534 

c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

535 
lemma mult_le_less_imp_less: "(a::'a::ordered_semiring_strict) <= b ==> 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

536 
c < d ==> 0 < a ==> 0 <= c ==> a * c < b * d" 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

537 
apply (subgoal_tac "a * c <= b * c") 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

538 
apply (erule order_le_less_trans) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

539 
apply (erule mult_strict_left_mono) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

540 
apply simp 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

541 
apply (erule mult_right_mono) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

542 
apply simp 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

543 
done 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

544 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

545 
subsection{*Cancellation Laws for Relationships With a Common Factor*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

546 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

547 
text{*Cancellation laws for @{term "c*a < c*b"} and @{term "a*c < b*c"}, 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

548 
also with the relations @{text "\<le>"} and equality.*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

549 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

550 
text{*These ``disjunction'' versions produce two cases when the comparison is 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

551 
an assumption, but effectively four when the comparison is a goal.*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

552 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

553 
lemma mult_less_cancel_right_disj: 
14738  554 
"(a*c < b*c) = ((0 < c & a < b)  (c < 0 & b < (a::'a::ordered_ring_strict)))" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

555 
apply (case_tac "c = 0") 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

556 
apply (auto simp add: linorder_neq_iff mult_strict_right_mono 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

557 
mult_strict_right_mono_neg) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

558 
apply (auto simp add: linorder_not_less 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

559 
linorder_not_le [symmetric, of "a*c"] 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

560 
linorder_not_le [symmetric, of a]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

561 
apply (erule_tac [!] notE) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

562 
apply (auto simp add: order_less_imp_le mult_right_mono 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

563 
mult_right_mono_neg) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

564 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

565 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

566 
lemma mult_less_cancel_left_disj: 
14738  567 
"(c*a < c*b) = ((0 < c & a < b)  (c < 0 & b < (a::'a::ordered_ring_strict)))" 
568 
apply (case_tac "c = 0") 

569 
apply (auto simp add: linorder_neq_iff mult_strict_left_mono 

570 
mult_strict_left_mono_neg) 

571 
apply (auto simp add: linorder_not_less 

572 
linorder_not_le [symmetric, of "c*a"] 

573 
linorder_not_le [symmetric, of a]) 

574 
apply (erule_tac [!] notE) 

575 
apply (auto simp add: order_less_imp_le mult_left_mono 

576 
mult_left_mono_neg) 

577 
done 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

578 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

579 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

580 
text{*The ``conjunction of implication'' lemmas produce two cases when the 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

581 
comparison is a goal, but give four when the comparison is an assumption.*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

582 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

583 
lemma mult_less_cancel_right: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

584 
fixes c :: "'a :: ordered_ring_strict" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

585 
shows "(a*c < b*c) = ((0 \<le> c > a < b) & (c \<le> 0 > b < a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

586 
by (insert mult_less_cancel_right_disj [of a c b], auto) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

587 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

588 
lemma mult_less_cancel_left: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

589 
fixes c :: "'a :: ordered_ring_strict" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

590 
shows "(c*a < c*b) = ((0 \<le> c > a < b) & (c \<le> 0 > b < a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

591 
by (insert mult_less_cancel_left_disj [of c a b], auto) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

592 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

593 
lemma mult_le_cancel_right: 
14738  594 
"(a*c \<le> b*c) = ((0<c > a\<le>b) & (c<0 > b \<le> (a::'a::ordered_ring_strict)))" 
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

595 
by (simp add: linorder_not_less [symmetric] mult_less_cancel_right_disj) 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

596 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

597 
lemma mult_le_cancel_left: 
14738  598 
"(c*a \<le> c*b) = ((0<c > a\<le>b) & (c<0 > b \<le> (a::'a::ordered_ring_strict)))" 
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

599 
by (simp add: linorder_not_less [symmetric] mult_less_cancel_left_disj) 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

600 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

601 
lemma mult_less_imp_less_left: 
14341
a09441bd4f1e
Ring_and_Field now requires axiom add_left_imp_eq for semirings.
paulson
parents:
14334
diff
changeset

602 
assumes less: "c*a < c*b" and nonneg: "0 \<le> c" 
14738  603 
shows "a < (b::'a::ordered_semiring_strict)" 
14377  604 
proof (rule ccontr) 
605 
assume "~ a < b" 

606 
hence "b \<le> a" by (simp add: linorder_not_less) 

607 
hence "c*b \<le> c*a" by (rule mult_left_mono) 

608 
with this and less show False 

609 
by (simp add: linorder_not_less [symmetric]) 

610 
qed 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

611 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

612 
lemma mult_less_imp_less_right: 
14738  613 
assumes less: "a*c < b*c" and nonneg: "0 <= c" 
614 
shows "a < (b::'a::ordered_semiring_strict)" 

615 
proof (rule ccontr) 

616 
assume "~ a < b" 

617 
hence "b \<le> a" by (simp add: linorder_not_less) 

618 
hence "b*c \<le> a*c" by (rule mult_right_mono) 

619 
with this and less show False 

620 
by (simp add: linorder_not_less [symmetric]) 

621 
qed 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

622 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

623 
text{*Cancellation of equalities with a common factor*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

624 
lemma mult_cancel_right [simp]: 
14738  625 
"(a*c = b*c) = (c = (0::'a::ordered_ring_strict)  a=b)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

626 
apply (cut_tac linorder_less_linear [of 0 c]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

627 
apply (force dest: mult_strict_right_mono_neg mult_strict_right_mono 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

628 
simp add: linorder_neq_iff) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

629 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

630 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

631 
text{*These cancellation theorems require an ordering. Versions are proved 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

632 
below that work for fields without an ordering.*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

633 
lemma mult_cancel_left [simp]: 
14738  634 
"(c*a = c*b) = (c = (0::'a::ordered_ring_strict)  a=b)" 
635 
apply (cut_tac linorder_less_linear [of 0 c]) 

636 
apply (force dest: mult_strict_left_mono_neg mult_strict_left_mono 

637 
simp add: linorder_neq_iff) 

638 
done 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

639 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

640 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

641 
subsubsection{*Special Cancellation Simprules for Multiplication*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

642 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

643 
text{*These also produce two cases when the comparison is a goal.*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

644 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

645 
lemma mult_le_cancel_right1: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

646 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

647 
shows "(c \<le> b*c) = ((0<c > 1\<le>b) & (c<0 > b \<le> 1))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

648 
by (insert mult_le_cancel_right [of 1 c b], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

649 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

650 
lemma mult_le_cancel_right2: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

651 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

652 
shows "(a*c \<le> c) = ((0<c > a\<le>1) & (c<0 > 1 \<le> a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

653 
by (insert mult_le_cancel_right [of a c 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

654 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

655 
lemma mult_le_cancel_left1: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

656 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

657 
shows "(c \<le> c*b) = ((0<c > 1\<le>b) & (c<0 > b \<le> 1))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

658 
by (insert mult_le_cancel_left [of c 1 b], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

659 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

660 
lemma mult_le_cancel_left2: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

661 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

662 
shows "(c*a \<le> c) = ((0<c > a\<le>1) & (c<0 > 1 \<le> a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

663 
by (insert mult_le_cancel_left [of c a 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

664 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

665 
lemma mult_less_cancel_right1: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

666 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

667 
shows "(c < b*c) = ((0 \<le> c > 1<b) & (c \<le> 0 > b < 1))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

668 
by (insert mult_less_cancel_right [of 1 c b], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

669 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

670 
lemma mult_less_cancel_right2: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

671 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

672 
shows "(a*c < c) = ((0 \<le> c > a<1) & (c \<le> 0 > 1 < a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

673 
by (insert mult_less_cancel_right [of a c 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

674 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

675 
lemma mult_less_cancel_left1: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

676 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

677 
shows "(c < c*b) = ((0 \<le> c > 1<b) & (c \<le> 0 > b < 1))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

678 
by (insert mult_less_cancel_left [of c 1 b], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

679 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

680 
lemma mult_less_cancel_left2: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

681 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

682 
shows "(c*a < c) = ((0 \<le> c > a<1) & (c \<le> 0 > 1 < a))" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

683 
by (insert mult_less_cancel_left [of c a 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

684 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

685 
lemma mult_cancel_right1 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

686 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

687 
shows "(c = b*c) = (c = 0  b=1)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

688 
by (insert mult_cancel_right [of 1 c b], force) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

689 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

690 
lemma mult_cancel_right2 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

691 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

692 
shows "(a*c = c) = (c = 0  a=1)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

693 
by (insert mult_cancel_right [of a c 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

694 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

695 
lemma mult_cancel_left1 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

696 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

697 
shows "(c = c*b) = (c = 0  b=1)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

698 
by (insert mult_cancel_left [of c 1 b], force) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

699 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

700 
lemma mult_cancel_left2 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

701 
fixes c :: "'a :: ordered_idom" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

702 
shows "(c*a = c) = (c = 0  a=1)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

703 
by (insert mult_cancel_left [of c a 1], simp) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

704 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

705 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

706 
text{*Simprules for comparisons where common factors can be cancelled.*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

707 
lemmas mult_compare_simps = 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

708 
mult_le_cancel_right mult_le_cancel_left 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

709 
mult_le_cancel_right1 mult_le_cancel_right2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

710 
mult_le_cancel_left1 mult_le_cancel_left2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

711 
mult_less_cancel_right mult_less_cancel_left 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

712 
mult_less_cancel_right1 mult_less_cancel_right2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

713 
mult_less_cancel_left1 mult_less_cancel_left2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

714 
mult_cancel_right mult_cancel_left 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

715 
mult_cancel_right1 mult_cancel_right2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

716 
mult_cancel_left1 mult_cancel_left2 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

717 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

718 

14738  719 
text{*This list of rewrites decides ring equalities by ordered rewriting.*} 
15178  720 
lemmas ring_eq_simps = 
721 
(* mult_ac*) 

14738  722 
left_distrib right_distrib left_diff_distrib right_diff_distrib 
15178  723 
group_eq_simps 
724 
(* add_ac 

14738  725 
add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2 
15178  726 
diff_eq_eq eq_diff_eq *) 
14738  727 

14265
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

728 
subsection {* Fields *} 
95b42e69436c
HOL: installation of Ring_and_Field as the basis for Naturals and Reals
paulson
parents:
diff
changeset

729 

14288  730 
lemma right_inverse_eq: "b \<noteq> 0 ==> (a / b = 1) = (a = (b::'a::field))" 
731 
proof 

732 
assume neq: "b \<noteq> 0" 

733 
{ 

734 
hence "a = (a / b) * b" by (simp add: divide_inverse mult_ac) 

735 
also assume "a / b = 1" 

736 
finally show "a = b" by simp 

737 
next 

738 
assume "a = b" 

739 
with neq show "a / b = 1" by (simp add: divide_inverse) 

740 
} 

741 
qed 

742 

743 
lemma nonzero_inverse_eq_divide: "a \<noteq> 0 ==> inverse (a::'a::field) = 1/a" 

744 
by (simp add: divide_inverse) 

745 

15228  746 
lemma divide_self: "a \<noteq> 0 ==> a / (a::'a::field) = 1" 
14288  747 
by (simp add: divide_inverse) 
748 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

749 
lemma divide_zero [simp]: "a / 0 = (0::'a::{field,division_by_zero})" 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

750 
by (simp add: divide_inverse) 
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

751 

15228  752 
lemma divide_self_if [simp]: 
753 
"a / (a::'a::{field,division_by_zero}) = (if a=0 then 0 else 1)" 

754 
by (simp add: divide_self) 

755 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

756 
lemma divide_zero_left [simp]: "0/a = (0::'a::field)" 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

757 
by (simp add: divide_inverse) 
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

758 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

759 
lemma inverse_eq_divide: "inverse (a::'a::field) = 1/a" 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

760 
by (simp add: divide_inverse) 
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

761 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

762 
lemma add_divide_distrib: "(a+b)/(c::'a::field) = a/c + b/c" 
14293  763 
by (simp add: divide_inverse left_distrib) 
764 

765 

14270  766 
text{*Compared with @{text mult_eq_0_iff}, this version removes the requirement 
767 
of an ordering.*} 

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

768 
lemma field_mult_eq_0_iff [simp]: 
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

769 
"(a*b = (0::'a::division_ring)) = (a = 0  b = 0)" 
14377  770 
proof cases 
771 
assume "a=0" thus ?thesis by simp 

772 
next 

773 
assume anz [simp]: "a\<noteq>0" 

774 
{ assume "a * b = 0" 

775 
hence "inverse a * (a * b) = 0" by simp 

776 
hence "b = 0" by (simp (no_asm_use) add: mult_assoc [symmetric])} 

777 
thus ?thesis by force 

778 
qed 

14270  779 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

780 
text{*Cancellation of equalities with a common factor*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

781 
lemma field_mult_cancel_right_lemma: 
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

782 
assumes cnz: "c \<noteq> (0::'a::division_ring)" 
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

783 
and eq: "a*c = b*c" 
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

784 
shows "a=b" 
14377  785 
proof  
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

786 
have "(a * c) * inverse c = (b * c) * inverse c" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

787 
by (simp add: eq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

788 
thus "a=b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

789 
by (simp add: mult_assoc cnz) 
14377  790 
qed 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

791 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

792 
lemma field_mult_cancel_right [simp]: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

793 
"(a*c = b*c) = (c = (0::'a::division_ring)  a=b)" 
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

794 
proof  
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

795 
have "(a*c = b*c) = (a*c  b*c = 0)" 
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

796 
by simp 
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

797 
also have "\<dots> = ((a  b)*c = 0)" 
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

798 
by (simp only: left_diff_distrib) 
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

799 
also have "\<dots> = (c = 0 \<or> a = b)" 
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

800 
by (simp add: disj_commute) 
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

801 
finally show ?thesis . 
14377  802 
qed 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

803 

14348
744c868ee0b7
Defining the type class "ringpower" and deleting superseded theorems for
paulson
parents:
14341
diff
changeset

804 
lemma field_mult_cancel_left [simp]: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

805 
"(c*a = c*b) = (c = (0::'a::division_ring)  a=b)" 
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

806 
proof  
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

807 
have "(c*a = c*b) = (c*a  c*b = 0)" 
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

808 
by simp 
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

809 
also have "\<dots> = (c*(a  b) = 0)" 
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

810 
by (simp only: right_diff_distrib) 
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

811 
also have "\<dots> = (c = 0 \<or> a = b)" 
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

812 
by simp 
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

813 
finally show ?thesis . 
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

814 
qed 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

815 

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

816 
lemma nonzero_imp_inverse_nonzero: 
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

817 
"a \<noteq> 0 ==> inverse a \<noteq> (0::'a::division_ring)" 
14377  818 
proof 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

819 
assume ianz: "inverse a = 0" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

820 
assume "a \<noteq> 0" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

821 
hence "1 = a * inverse a" by simp 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

822 
also have "... = 0" by (simp add: ianz) 
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

823 
finally have "1 = (0::'a::division_ring)" . 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

824 
thus False by (simp add: eq_commute) 
14377  825 
qed 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

826 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

827 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

828 
subsection{*Basic Properties of @{term inverse}*} 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

829 

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

830 
lemma inverse_zero_imp_zero: "inverse a = 0 ==> a = (0::'a::division_ring)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

831 
apply (rule ccontr) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

832 
apply (blast dest: nonzero_imp_inverse_nonzero) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

833 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

834 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

835 
lemma inverse_nonzero_imp_nonzero: 
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

836 
"inverse a = 0 ==> a = (0::'a::division_ring)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

837 
apply (rule ccontr) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

838 
apply (blast dest: nonzero_imp_inverse_nonzero) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

839 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

840 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

841 
lemma inverse_nonzero_iff_nonzero [simp]: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

842 
"(inverse a = 0) = (a = (0::'a::{division_ring,division_by_zero}))" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

843 
by (force dest: inverse_nonzero_imp_nonzero) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

844 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

845 
lemma nonzero_inverse_minus_eq: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

846 
assumes [simp]: "a\<noteq>0" 
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

847 
shows "inverse(a) = inverse(a::'a::division_ring)" 
14377  848 
proof  
849 
have "a * inverse ( a) = a *  inverse a" 

850 
by simp 

851 
thus ?thesis 

852 
by (simp only: field_mult_cancel_left, simp) 

853 
qed 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

854 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

855 
lemma inverse_minus_eq [simp]: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

856 
"inverse(a) = inverse(a::'a::{division_ring,division_by_zero})" 
14377  857 
proof cases 
858 
assume "a=0" thus ?thesis by (simp add: inverse_zero) 

859 
next 

860 
assume "a\<noteq>0" 

861 
thus ?thesis by (simp add: nonzero_inverse_minus_eq) 

862 
qed 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

863 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

864 
lemma nonzero_inverse_eq_imp_eq: 
14269  865 
assumes inveq: "inverse a = inverse b" 
866 
and anz: "a \<noteq> 0" 

867 
and bnz: "b \<noteq> 0" 

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

868 
shows "a = (b::'a::division_ring)" 
14377  869 
proof  
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

870 
have "a * inverse b = a * inverse a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

871 
by (simp add: inveq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

872 
hence "(a * inverse b) * b = (a * inverse a) * b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

873 
by simp 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

874 
thus "a = b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

875 
by (simp add: mult_assoc anz bnz) 
14377  876 
qed 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

877 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

878 
lemma inverse_eq_imp_eq: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

879 
"inverse a = inverse b ==> a = (b::'a::{division_ring,division_by_zero})" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

880 
apply (case_tac "a=0  b=0") 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

881 
apply (force dest!: inverse_zero_imp_zero 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

882 
simp add: eq_commute [of "0::'a"]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

883 
apply (force dest!: nonzero_inverse_eq_imp_eq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

884 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

885 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

886 
lemma inverse_eq_iff_eq [simp]: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

887 
"(inverse a = inverse b) = (a = (b::'a::{division_ring,division_by_zero}))" 
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

888 
by (force dest!: inverse_eq_imp_eq) 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

889 

14270  890 
lemma nonzero_inverse_inverse_eq: 
20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

891 
assumes [simp]: "a \<noteq> 0" 
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

892 
shows "inverse(inverse (a::'a::division_ring)) = a" 
14270  893 
proof  
894 
have "(inverse (inverse a) * inverse a) * a = a" 

895 
by (simp add: nonzero_imp_inverse_nonzero) 

896 
thus ?thesis 

897 
by (simp add: mult_assoc) 

898 
qed 

899 

900 
lemma inverse_inverse_eq [simp]: 

20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

901 
"inverse(inverse (a::'a::{division_ring,division_by_zero})) = a" 
14270  902 
proof cases 
903 
assume "a=0" thus ?thesis by simp 

904 
next 

905 
assume "a\<noteq>0" 

906 
thus ?thesis by (simp add: nonzero_inverse_inverse_eq) 

907 
qed 

908 

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

909 
lemma inverse_1 [simp]: "inverse 1 = (1::'a::division_ring)" 
14270  910 
proof  
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

911 
have "inverse 1 * 1 = (1::'a::division_ring)" 
14270  912 
by (rule left_inverse [OF zero_neq_one [symmetric]]) 
913 
thus ?thesis by simp 

914 
qed 

915 

15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

916 
lemma inverse_unique: 
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

917 
assumes ab: "a*b = 1" 
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

918 
shows "inverse a = (b::'a::division_ring)" 
15077
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

919 
proof  
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

920 
have "a \<noteq> 0" using ab by auto 
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

921 
moreover have "inverse a * (a * b) = inverse a" by (simp add: ab) 
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

922 
ultimately show ?thesis by (simp add: mult_assoc [symmetric]) 
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

923 
qed 
89840837108e
converting Hyperreal/Transcendental to Isar script
paulson
parents:
15010
diff
changeset

924 

14270  925 
lemma nonzero_inverse_mult_distrib: 
926 
assumes anz: "a \<noteq> 0" 

927 
and bnz: "b \<noteq> 0" 

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

928 
shows "inverse(a*b) = inverse(b) * inverse(a::'a::division_ring)" 
14270  929 
proof  
930 
have "inverse(a*b) * (a * b) * inverse(b) = inverse(b)" 

931 
by (simp add: field_mult_eq_0_iff anz bnz) 

932 
hence "inverse(a*b) * a = inverse(b)" 

933 
by (simp add: mult_assoc bnz) 

934 
hence "inverse(a*b) * a * inverse(a) = inverse(b) * inverse(a)" 

935 
by simp 

936 
thus ?thesis 

937 
by (simp add: mult_assoc anz) 

938 
qed 

939 

940 
text{*This version builds in division by zero while also reorienting 

941 
the righthand side.*} 

942 
lemma inverse_mult_distrib [simp]: 

943 
"inverse(a*b) = inverse(a) * inverse(b::'a::{field,division_by_zero})" 

944 
proof cases 

945 
assume "a \<noteq> 0 & b \<noteq> 0" 

946 
thus ?thesis by (simp add: nonzero_inverse_mult_distrib mult_commute) 

947 
next 

948 
assume "~ (a \<noteq> 0 & b \<noteq> 0)" 

949 
thus ?thesis by force 

950 
qed 

951 

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

952 
lemma division_ring_inverse_add: 
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

953 
"[(a::'a::division_ring) \<noteq> 0; b \<noteq> 0] 
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

954 
==> inverse a + inverse b = inverse a * (a+b) * inverse b" 
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

955 
by (simp add: right_distrib left_distrib mult_assoc) 
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

956 

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

957 
lemma division_ring_inverse_diff: 
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

958 
"[(a::'a::division_ring) \<noteq> 0; b \<noteq> 0] 
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

959 
==> inverse a  inverse b = inverse a * (ba) * inverse b" 
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

960 
by (simp add: right_diff_distrib left_diff_distrib mult_assoc) 
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

961 

14270  962 
text{*There is no slick version using division by zero.*} 
963 
lemma inverse_add: 

964 
"[a \<noteq> 0; b \<noteq> 0] 

965 
==> inverse a + inverse b = (a+b) * inverse a * inverse (b::'a::field)" 

20496
23eb6034c06d
added axclass division_ring (like field without commutativity; includes e.g. quaternions) and generalized some theorems from field to division_ring
huffman
parents:
19404
diff
changeset

966 
by (simp add: division_ring_inverse_add mult_ac) 
14270  967 

14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

968 
lemma inverse_divide [simp]: 
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

969 
"inverse (a/b) = b / (a::'a::{field,division_by_zero})" 
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

970 
by (simp add: divide_inverse mult_commute) 
14365
3d4df8c166ae
replacing HOL/Real/PRat, PNat by the rational number development
paulson
parents:
14353
diff
changeset

971 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

972 
subsection {* Calculations with fractions *} 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

973 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

974 
lemma nonzero_mult_divide_cancel_left: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

975 
assumes [simp]: "b\<noteq>0" and [simp]: "c\<noteq>0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

976 
shows "(c*a)/(c*b) = a/(b::'a::field)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

977 
proof  
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

978 
have "(c*a)/(c*b) = c * a * (inverse b * inverse c)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

979 
by (simp add: field_mult_eq_0_iff divide_inverse 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

980 
nonzero_inverse_mult_distrib) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

981 
also have "... = a * inverse b * (inverse c * c)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

982 
by (simp only: mult_ac) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

983 
also have "... = a * inverse b" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

984 
by simp 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

985 
finally show ?thesis 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

986 
by (simp add: divide_inverse) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

987 
qed 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

988 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

989 
lemma mult_divide_cancel_left: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

990 
"c\<noteq>0 ==> (c*a) / (c*b) = a / (b::'a::{field,division_by_zero})" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

991 
apply (case_tac "b = 0") 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

992 
apply (simp_all add: nonzero_mult_divide_cancel_left) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

993 
done 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

994 

14321  995 
lemma nonzero_mult_divide_cancel_right: 
996 
"[b\<noteq>0; c\<noteq>0] ==> (a*c) / (b*c) = a/(b::'a::field)" 

997 
by (simp add: mult_commute [of _ c] nonzero_mult_divide_cancel_left) 

998 

999 
lemma mult_divide_cancel_right: 

1000 
"c\<noteq>0 ==> (a*c) / (b*c) = a / (b::'a::{field,division_by_zero})" 

1001 
apply (case_tac "b = 0") 

1002 
apply (simp_all add: nonzero_mult_divide_cancel_right) 

1003 
done 

1004 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1005 
(*For ExtractCommonTerm*) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1006 
lemma mult_divide_cancel_eq_if: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1007 
"(c*a) / (c*b) = 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1008 
(if c=0 then 0 else a / (b::'a::{field,division_by_zero}))" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1009 
by (simp add: mult_divide_cancel_left) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1010 

14284
f1abe67c448a
reorganisation of Real/RealArith0.ML; more `Isar scripts
paulson
parents:
14277
diff
changeset

1011 
lemma divide_1 [simp]: "a/1 = (a::'a::field)" 
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1012 
by (simp add: divide_inverse) 
14284
f1abe67c448a
reorganisation of Real/RealArith0.ML; more `Isar scripts
paulson
parents:
14277
diff
changeset

1013 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1014 
lemma times_divide_eq_right: "a * (b/c) = (a*b) / (c::'a::field)" 
14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1015 
by (simp add: divide_inverse mult_assoc) 
14288  1016 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1017 
lemma times_divide_eq_left: "(b/c) * a = (b*a) / (c::'a::field)" 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1018 
by (simp add: divide_inverse mult_ac) 
14288  1019 

1020 
lemma divide_divide_eq_right [simp]: 

1021 
"a / (b/c) = (a*c) / (b::'a::{field,division_by_zero})" 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1022 
by (simp add: divide_inverse mult_ac) 
14288  1023 

1024 
lemma divide_divide_eq_left [simp]: 

1025 
"(a / b) / (c::'a::{field,division_by_zero}) = a / (b*c)" 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1026 
by (simp add: divide_inverse mult_assoc) 
14288  1027 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1028 
lemma add_frac_eq: "(y::'a::field) ~= 0 ==> z ~= 0 ==> 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1029 
x / y + w / z = (x * z + w * y) / (y * z)" 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1030 
apply (subgoal_tac "x / y = (x * z) / (y * z)") 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1031 
apply (erule ssubst) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1032 
apply (subgoal_tac "w / z = (w * y) / (y * z)") 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1033 
apply (erule ssubst) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1034 
apply (rule add_divide_distrib [THEN sym]) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1035 
apply (subst mult_commute) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1036 
apply (erule nonzero_mult_divide_cancel_left [THEN sym]) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1037 
apply assumption 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1038 
apply (erule nonzero_mult_divide_cancel_right [THEN sym]) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1039 
apply assumption 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1040 
done 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1041 

15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1042 
subsubsection{*Special Cancellation Simprules for Division*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1043 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1044 
lemma mult_divide_cancel_left_if [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1045 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1046 
shows "(c*a) / (c*b) = (if c=0 then 0 else a/b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1047 
by (simp add: mult_divide_cancel_left) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1048 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1049 
lemma mult_divide_cancel_right_if [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1050 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1051 
shows "(a*c) / (b*c) = (if c=0 then 0 else a/b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1052 
by (simp add: mult_divide_cancel_right) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1053 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1054 
lemma mult_divide_cancel_left_if1 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1055 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1056 
shows "c / (c*b) = (if c=0 then 0 else 1/b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1057 
apply (insert mult_divide_cancel_left_if [of c 1 b]) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1058 
apply (simp del: mult_divide_cancel_left_if) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1059 
done 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1060 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1061 
lemma mult_divide_cancel_left_if2 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1062 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1063 
shows "(c*a) / c = (if c=0 then 0 else a)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1064 
apply (insert mult_divide_cancel_left_if [of c a 1]) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1065 
apply (simp del: mult_divide_cancel_left_if) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1066 
done 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1067 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1068 
lemma mult_divide_cancel_right_if1 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1069 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1070 
shows "c / (b*c) = (if c=0 then 0 else 1/b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1071 
apply (insert mult_divide_cancel_right_if [of 1 c b]) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1072 
apply (simp del: mult_divide_cancel_right_if) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1073 
done 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1074 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1075 
lemma mult_divide_cancel_right_if2 [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1076 
fixes c :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1077 
shows "(a*c) / c = (if c=0 then 0 else a)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1078 
apply (insert mult_divide_cancel_right_if [of a c 1]) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1079 
apply (simp del: mult_divide_cancel_right_if) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1080 
done 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1081 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1082 
text{*Two lemmas for cancelling the denominator*} 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1083 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1084 
lemma times_divide_self_right [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1085 
fixes a :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1086 
shows "a * (b/a) = (if a=0 then 0 else b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1087 
by (simp add: times_divide_eq_right) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1088 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1089 
lemma times_divide_self_left [simp]: 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1090 
fixes a :: "'a :: {field,division_by_zero}" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1091 
shows "(b/a) * a = (if a=0 then 0 else b)" 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1092 
by (simp add: times_divide_eq_left) 
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1093 

ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset

1094 

14293  1095 
subsection {* Division and Unary Minus *} 
1096 

1097 
lemma nonzero_minus_divide_left: "b \<noteq> 0 ==>  (a/b) = (a) / (b::'a::field)" 

1098 
by (simp add: divide_inverse minus_mult_left) 

1099 

1100 
lemma nonzero_minus_divide_right: "b \<noteq> 0 ==>  (a/b) = a / (b::'a::field)" 

1101 
by (simp add: divide_inverse nonzero_inverse_minus_eq minus_mult_right) 

1102 

1103 
lemma nonzero_minus_divide_divide: "b \<noteq> 0 ==> (a)/(b) = a / (b::'a::field)" 

1104 
by (simp add: divide_inverse nonzero_inverse_minus_eq) 

1105 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1106 
lemma minus_divide_left: " (a/b) = (a) / (b::'a::field)" 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1107 
by (simp add: divide_inverse minus_mult_left [symmetric]) 
14293  1108 

1109 
lemma minus_divide_right: " (a/b) = a / (b::'a::{field,division_by_zero})" 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1110 
by (simp add: divide_inverse minus_mult_right [symmetric]) 
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1111 

14293  1112 

1113 
text{*The effect is to extract signs from divisions*} 

17085  1114 
lemmas divide_minus_left = minus_divide_left [symmetric] 
1115 
lemmas divide_minus_right = minus_divide_right [symmetric] 

1116 
declare divide_minus_left [simp] divide_minus_right [simp] 

14293  1117 

14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

1118 
text{*Also, extract signs from products*} 
17085  1119 
lemmas mult_minus_left = minus_mult_left [symmetric] 
1120 
lemmas mult_minus_right = minus_mult_right [symmetric] 

1121 
declare mult_minus_left [simp] mult_minus_right [simp] 

14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

1122 

14293  1123 
lemma minus_divide_divide [simp]: 
1124 
"(a)/(b) = a / (b::'a::{field,division_by_zero})" 

1125 
apply (case_tac "b=0", simp) 

1126 
apply (simp add: nonzero_minus_divide_divide) 

1127 
done 

1128 

14430
5cb24165a2e1
new material from Avigad, and simplified treatment of division by 0
paulson
parents:
14421
diff
changeset

1129 
lemma diff_divide_distrib: "(ab)/(c::'a::field) = a/c  b/c" 
14387
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

1130 
by (simp add: diff_minus add_divide_distrib) 
e96d5c42c4b0
Polymorphic treatment of binary arithmetic using axclasses
paulson
parents:
14377
diff
changeset

1131 

16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1132 
lemma diff_frac_eq: "(y::'a::field) ~= 0 ==> z ~= 0 ==> 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1133 
x / y  w / z = (x * z  w * y) / (y * z)" 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1134 
apply (subst diff_def)+ 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1135 
apply (subst minus_divide_left) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1136 
apply (subst add_frac_eq) 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1137 
apply simp_all 
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16568
diff
changeset

1138 
done 
14293  1139 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1140 
subsection {* Ordered Fields *} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1141 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1142 
lemma positive_imp_inverse_positive: 
14269  1143 
assumes a_gt_0: "0 < a" shows "0 < inverse (a::'a::ordered_field)" 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1144 
proof  
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1145 
have "0 < a * inverse a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1146 
by (simp add: a_gt_0 [THEN order_less_imp_not_eq2] zero_less_one) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1147 
thus "0 < inverse a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1148 
by (simp add: a_gt_0 [THEN order_less_not_sym] zero_less_mult_iff) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1149 
qed 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1150 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1151 
lemma negative_imp_inverse_negative: 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1152 
"a < 0 ==> inverse a < (0::'a::ordered_field)" 
14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1153 
by (insert positive_imp_inverse_positive [of "a"], 
14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1154 
simp add: nonzero_inverse_minus_eq order_less_imp_not_eq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1155 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1156 
lemma inverse_le_imp_le: 
14269  1157 
assumes invle: "inverse a \<le> inverse b" 
1158 
and apos: "0 < a" 

1159 
shows "b \<le> (a::'a::ordered_field)" 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1160 
proof (rule classical) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1161 
assume "~ b \<le> a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1162 
hence "a < b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1163 
by (simp add: linorder_not_le) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1164 
hence bpos: "0 < b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1165 
by (blast intro: apos order_less_trans) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1166 
hence "a * inverse a \<le> a * inverse b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1167 
by (simp add: apos invle order_less_imp_le mult_left_mono) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1168 
hence "(a * inverse a) * b \<le> (a * inverse b) * b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1169 
by (simp add: bpos order_less_imp_le mult_right_mono) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1170 
thus "b \<le> a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1171 
by (simp add: mult_assoc apos bpos order_less_imp_not_eq2) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1172 
qed 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1173 

14277
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1174 
lemma inverse_positive_imp_positive: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1175 
assumes inv_gt_0: "0 < inverse a" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1176 
and [simp]: "a \<noteq> 0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1177 
shows "0 < (a::'a::ordered_field)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1178 
proof  
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1179 
have "0 < inverse (inverse a)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1180 
by (rule positive_imp_inverse_positive) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1181 
thus "0 < a" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1182 
by (simp add: nonzero_inverse_inverse_eq) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1183 
qed 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1184 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1185 
lemma inverse_positive_iff_positive [simp]: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1186 
"(0 < inverse a) = (0 < (a::'a::{ordered_field,division_by_zero}))" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1187 
apply (case_tac "a = 0", simp) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1188 
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

1189 
done 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1190 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1191 
lemma inverse_negative_imp_negative: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1192 
assumes inv_less_0: "inverse a < 0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1193 
and [simp]: "a \<noteq> 0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1194 
shows "a < (0::'a::ordered_field)" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1195 
proof  
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1196 
have "inverse (inverse a) < 0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1197 
by (rule negative_imp_inverse_negative) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1198 
thus "a < 0" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1199 
by (simp add: nonzero_inverse_inverse_eq) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1200 
qed 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1201 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1202 
lemma inverse_negative_iff_negative [simp]: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1203 
"(inverse a < 0) = (a < (0::'a::{ordered_field,division_by_zero}))" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1204 
apply (case_tac "a = 0", simp) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1205 
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

1206 
done 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1207 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1208 
lemma inverse_nonnegative_iff_nonnegative [simp]: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1209 
"(0 \<le> inverse a) = (0 \<le> (a::'a::{ordered_field,division_by_zero}))" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1210 
by (simp add: linorder_not_less [symmetric]) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1211 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1212 
lemma inverse_nonpositive_iff_nonpositive [simp]: 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1213 
"(inverse a \<le> 0) = (a \<le> (0::'a::{ordered_field,division_by_zero}))" 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1214 
by (simp add: linorder_not_less [symmetric]) 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1215 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1216 

ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1217 
subsection{*AntiMonotonicity of @{term inverse}*} 
ad66687ece6e
more field division lemmas transferred from Real to Ring_and_Field
paulson
parents:
14272
diff
changeset

1218 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1219 
lemma less_imp_inverse_less: 
14269  1220 
assumes less: "a < b" 
1221 
and apos: "0 < a" 

1222 
shows "inverse b < inverse (a::'a::ordered_field)" 

14268
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1223 
proof (rule ccontr) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1224 
assume "~ inverse b < inverse a" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1225 
hence "inverse a \<le> inverse b" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1226 
by (simp add: linorder_not_less) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1227 
hence "~ (a < b)" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1228 
by (simp add: linorder_not_less inverse_le_imp_le [OF _ apos]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1229 
thus False 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1230 
by (rule notE [OF _ less]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1231 
qed 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1232 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1233 
lemma inverse_less_imp_less: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1234 
"[inverse a < inverse b; 0 < a] ==> b < (a::'a::ordered_field)" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1235 
apply (simp add: order_less_le [of "inverse a"] order_less_le [of "b"]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1236 
apply (force dest!: inverse_le_imp_le nonzero_inverse_eq_imp_eq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1237 
done 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1238 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1239 
text{*Both premises are essential. Consider 1 and 1.*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1240 
lemma inverse_less_iff_less [simp]: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1241 
"[0 < a; 0 < b] 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1242 
==> (inverse a < inverse b) = (b < (a::'a::ordered_field))" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1243 
by (blast intro: less_imp_inverse_less dest: inverse_less_imp_less) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1244 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1245 
lemma le_imp_inverse_le: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1246 
"[a \<le> b; 0 < a] ==> inverse b \<le> inverse (a::'a::ordered_field)" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1247 
by (force simp add: order_le_less less_imp_inverse_less) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1248 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1249 
lemma inverse_le_iff_le [simp]: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1250 
"[0 < a; 0 < b] 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1251 
==> (inverse a \<le> inverse b) = (b \<le> (a::'a::ordered_field))" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1252 
by (blast intro: le_imp_inverse_le dest: inverse_le_imp_le) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1253 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1254 

5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1255 
text{*These results refer to both operands being negative. The oppositesign 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1256 
case is trivial, since inverse preserves signs.*} 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1257 
lemma inverse_le_imp_le_neg: 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1258 
"[inverse a \<le> inverse b; b < 0] ==> b \<le> (a::'a::ordered_field)" 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1259 
apply (rule classical) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1260 
apply (subgoal_tac "a < 0") 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1261 
prefer 2 apply (force simp add: linorder_not_le intro: order_less_trans) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1262 
apply (insert inverse_le_imp_le [of "b" "a"]) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
14267
diff
changeset

1263 
apply (simp add: order_less_imp_not_eq nonzero_inverse_minus_eq) 
5cf13e80be0e
Removal of Hyperreal/ExtraThms2.ML, sending the material to the correct files.
paulson
parents:
