author | haftmann |
Fri, 09 Mar 2007 08:45:50 +0100 | |
changeset 22422 | ee19cdb07528 |
parent 22390 | 378f34b1e380 |
child 22452 | 8a86fd2a1bf0 |
permissions | -rw-r--r-- |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1 |
|
14770 | 2 |
(* Title: HOL/OrderedGroup.thy |
14738 | 3 |
ID: $Id$ |
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
4 |
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:
16417
diff
changeset
|
5 |
with contributions by Jeremy Avigad |
14738 | 6 |
*) |
7 |
||
8 |
header {* Ordered Groups *} |
|
9 |
||
15131 | 10 |
theory OrderedGroup |
21382 | 11 |
imports LOrder |
19798 | 12 |
uses "~~/src/Provers/Arith/abel_cancel.ML" |
15131 | 13 |
begin |
14738 | 14 |
|
15 |
text {* |
|
16 |
The theory of partially ordered groups is taken from the books: |
|
17 |
\begin{itemize} |
|
18 |
\item \emph{Lattice Theory} by Garret Birkhoff, American Mathematical Society 1979 |
|
19 |
\item \emph{Partially Ordered Algebraic Systems}, Pergamon Press 1963 |
|
20 |
\end{itemize} |
|
21 |
Most of the used notions can also be looked up in |
|
22 |
\begin{itemize} |
|
14770 | 23 |
\item \url{http://www.mathworld.com} by Eric Weisstein et. al. |
14738 | 24 |
\item \emph{Algebra I} by van der Waerden, Springer. |
25 |
\end{itemize} |
|
26 |
*} |
|
27 |
||
28 |
subsection {* Semigroups, Groups *} |
|
29 |
||
22390 | 30 |
class semigroup_add = plus + |
31 |
assumes add_assoc: "(a \<^loc>+ b) \<^loc>+ c = a \<^loc>+ (b \<^loc>+ c)" |
|
32 |
||
33 |
class ab_semigroup_add = semigroup_add + |
|
34 |
assumes add_commute: "a \<^loc>+ b = b \<^loc>+ a" |
|
14738 | 35 |
|
36 |
lemma add_left_commute: "a + (b + c) = b + (a + (c::'a::ab_semigroup_add))" |
|
37 |
by (rule mk_left_commute [of "op +", OF add_assoc add_commute]) |
|
38 |
||
39 |
theorems add_ac = add_assoc add_commute add_left_commute |
|
40 |
||
22390 | 41 |
class semigroup_mult = times + |
42 |
assumes mult_assoc: "(a \<^loc>* b) \<^loc>* c = a \<^loc>* (b \<^loc>* c)" |
|
14738 | 43 |
|
22390 | 44 |
class ab_semigroup_mult = semigroup_mult + |
45 |
assumes mult_commute: "a \<^loc>* b = b \<^loc>* a" |
|
14738 | 46 |
|
47 |
lemma mult_left_commute: "a * (b * c) = b * (a * (c::'a::ab_semigroup_mult))" |
|
48 |
by (rule mk_left_commute [of "op *", OF mult_assoc mult_commute]) |
|
49 |
||
50 |
theorems mult_ac = mult_assoc mult_commute mult_left_commute |
|
51 |
||
22390 | 52 |
class comm_monoid_add = zero + ab_semigroup_add + |
53 |
assumes add_0 [simp]: "\<^loc>0 \<^loc>+ a = a" |
|
14738 | 54 |
|
22390 | 55 |
class monoid_mult = one + semigroup_mult + |
56 |
assumes mult_1_left [simp]: "\<^loc>1 \<^loc>* a = a" |
|
57 |
assumes mult_1_right [simp]: "a \<^loc>* \<^loc>1 = a" |
|
14738 | 58 |
|
22390 | 59 |
class comm_monoid_mult = one + ab_semigroup_mult + |
60 |
assumes mult_1: "\<^loc>1 \<^loc>* a = a" |
|
14738 | 61 |
|
62 |
instance comm_monoid_mult \<subseteq> monoid_mult |
|
22390 | 63 |
by intro_classes (insert mult_1, simp_all add: mult_commute, auto) |
14738 | 64 |
|
22390 | 65 |
class cancel_semigroup_add = semigroup_add + |
66 |
assumes add_left_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c" |
|
67 |
assumes add_right_imp_eq: "b \<^loc>+ a = c \<^loc>+ a \<Longrightarrow> b = c" |
|
14738 | 68 |
|
22390 | 69 |
class cancel_ab_semigroup_add = ab_semigroup_add + |
70 |
assumes add_imp_eq: "a \<^loc>+ b = a \<^loc>+ c \<Longrightarrow> b = c" |
|
14738 | 71 |
|
72 |
instance cancel_ab_semigroup_add \<subseteq> cancel_semigroup_add |
|
22390 | 73 |
proof intro_classes |
74 |
fix a b c :: 'a |
|
75 |
assume "a + b = a + c" |
|
76 |
then show "b = c" by (rule add_imp_eq) |
|
77 |
next |
|
14738 | 78 |
fix a b c :: 'a |
79 |
assume "b + a = c + a" |
|
22390 | 80 |
then have "a + b = a + c" by (simp only: add_commute) |
81 |
then show "b = c" by (rule add_imp_eq) |
|
14738 | 82 |
qed |
83 |
||
22390 | 84 |
class ab_group_add = minus + comm_monoid_add + |
85 |
assumes left_minus [simp]: "uminus a \<^loc>+ a = \<^loc>0" |
|
86 |
assumes diff_minus: "a \<^loc>- b = a \<^loc>+ (uminus b)" |
|
14738 | 87 |
|
88 |
instance ab_group_add \<subseteq> cancel_ab_semigroup_add |
|
22390 | 89 |
proof intro_classes |
14738 | 90 |
fix a b c :: 'a |
91 |
assume "a + b = a + c" |
|
22390 | 92 |
then have "uminus a + a + b = uminus a + a + c" unfolding add_assoc by simp |
93 |
then show "b = c" by simp |
|
14738 | 94 |
qed |
95 |
||
96 |
lemma add_0_right [simp]: "a + 0 = (a::'a::comm_monoid_add)" |
|
97 |
proof - |
|
98 |
have "a + 0 = 0 + a" by (simp only: add_commute) |
|
99 |
also have "... = a" by simp |
|
100 |
finally show ?thesis . |
|
101 |
qed |
|
102 |
||
21245 | 103 |
lemmas add_zero_left = add_0 |
104 |
and add_zero_right = add_0_right |
|
105 |
||
14738 | 106 |
lemma add_left_cancel [simp]: |
22390 | 107 |
"a + b = a + c \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)" |
108 |
by (blast dest: add_left_imp_eq) |
|
14738 | 109 |
|
110 |
lemma add_right_cancel [simp]: |
|
22390 | 111 |
"b + a = c + a \<longleftrightarrow> b = (c \<Colon> 'a\<Colon>cancel_semigroup_add)" |
14738 | 112 |
by (blast dest: add_right_imp_eq) |
113 |
||
114 |
lemma right_minus [simp]: "a + -(a::'a::ab_group_add) = 0" |
|
115 |
proof - |
|
116 |
have "a + -a = -a + a" by (simp add: add_ac) |
|
117 |
also have "... = 0" by simp |
|
118 |
finally show ?thesis . |
|
119 |
qed |
|
120 |
||
121 |
lemma right_minus_eq: "(a - b = 0) = (a = (b::'a::ab_group_add))" |
|
122 |
proof |
|
123 |
have "a = a - b + b" by (simp add: diff_minus add_ac) |
|
124 |
also assume "a - b = 0" |
|
125 |
finally show "a = b" by simp |
|
126 |
next |
|
127 |
assume "a = b" |
|
128 |
thus "a - b = 0" by (simp add: diff_minus) |
|
129 |
qed |
|
130 |
||
131 |
lemma minus_minus [simp]: "- (- (a::'a::ab_group_add)) = a" |
|
132 |
proof (rule add_left_cancel [of "-a", THEN iffD1]) |
|
133 |
show "(-a + -(-a) = -a + a)" |
|
134 |
by simp |
|
135 |
qed |
|
136 |
||
137 |
lemma equals_zero_I: "a+b = 0 ==> -a = (b::'a::ab_group_add)" |
|
138 |
apply (rule right_minus_eq [THEN iffD1, symmetric]) |
|
139 |
apply (simp add: diff_minus add_commute) |
|
140 |
done |
|
141 |
||
142 |
lemma minus_zero [simp]: "- 0 = (0::'a::ab_group_add)" |
|
143 |
by (simp add: equals_zero_I) |
|
144 |
||
145 |
lemma diff_self [simp]: "a - (a::'a::ab_group_add) = 0" |
|
146 |
by (simp add: diff_minus) |
|
147 |
||
148 |
lemma diff_0 [simp]: "(0::'a::ab_group_add) - a = -a" |
|
149 |
by (simp add: diff_minus) |
|
150 |
||
151 |
lemma diff_0_right [simp]: "a - (0::'a::ab_group_add) = a" |
|
152 |
by (simp add: diff_minus) |
|
153 |
||
154 |
lemma diff_minus_eq_add [simp]: "a - - b = a + (b::'a::ab_group_add)" |
|
155 |
by (simp add: diff_minus) |
|
156 |
||
157 |
lemma neg_equal_iff_equal [simp]: "(-a = -b) = (a = (b::'a::ab_group_add))" |
|
158 |
proof |
|
159 |
assume "- a = - b" |
|
160 |
hence "- (- a) = - (- b)" |
|
161 |
by simp |
|
162 |
thus "a=b" by simp |
|
163 |
next |
|
164 |
assume "a=b" |
|
165 |
thus "-a = -b" by simp |
|
166 |
qed |
|
167 |
||
168 |
lemma neg_equal_0_iff_equal [simp]: "(-a = 0) = (a = (0::'a::ab_group_add))" |
|
169 |
by (subst neg_equal_iff_equal [symmetric], simp) |
|
170 |
||
171 |
lemma neg_0_equal_iff_equal [simp]: "(0 = -a) = (0 = (a::'a::ab_group_add))" |
|
172 |
by (subst neg_equal_iff_equal [symmetric], simp) |
|
173 |
||
174 |
text{*The next two equations can make the simplifier loop!*} |
|
175 |
||
176 |
lemma equation_minus_iff: "(a = - b) = (b = - (a::'a::ab_group_add))" |
|
177 |
proof - |
|
178 |
have "(- (-a) = - b) = (- a = b)" by (rule neg_equal_iff_equal) |
|
179 |
thus ?thesis by (simp add: eq_commute) |
|
180 |
qed |
|
181 |
||
182 |
lemma minus_equation_iff: "(- a = b) = (- (b::'a::ab_group_add) = a)" |
|
183 |
proof - |
|
184 |
have "(- a = - (-b)) = (a = -b)" by (rule neg_equal_iff_equal) |
|
185 |
thus ?thesis by (simp add: eq_commute) |
|
186 |
qed |
|
187 |
||
188 |
lemma minus_add_distrib [simp]: "- (a + b) = -a + -(b::'a::ab_group_add)" |
|
189 |
apply (rule equals_zero_I) |
|
190 |
apply (simp add: add_ac) |
|
191 |
done |
|
192 |
||
193 |
lemma minus_diff_eq [simp]: "- (a - b) = b - (a::'a::ab_group_add)" |
|
194 |
by (simp add: diff_minus add_commute) |
|
195 |
||
196 |
subsection {* (Partially) Ordered Groups *} |
|
197 |
||
22390 | 198 |
class pordered_ab_semigroup_add = order + ab_semigroup_add + |
199 |
assumes add_left_mono: "a \<sqsubseteq> b \<Longrightarrow> c \<^loc>+ a \<sqsubseteq> c \<^loc>+ b" |
|
14738 | 200 |
|
22390 | 201 |
class pordered_cancel_ab_semigroup_add = |
202 |
pordered_ab_semigroup_add + cancel_ab_semigroup_add |
|
14738 | 203 |
|
204 |
instance pordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add .. |
|
205 |
||
22390 | 206 |
class pordered_ab_semigroup_add_imp_le = pordered_cancel_ab_semigroup_add + |
207 |
assumes add_le_imp_le_left: "c \<^loc>+ a \<sqsubseteq> c + b \<Longrightarrow> a \<sqsubseteq> b" |
|
14738 | 208 |
|
22390 | 209 |
class pordered_ab_group_add = ab_group_add + pordered_ab_semigroup_add |
14738 | 210 |
|
211 |
instance pordered_ab_group_add \<subseteq> pordered_ab_semigroup_add_imp_le |
|
212 |
proof |
|
213 |
fix a b c :: 'a |
|
214 |
assume "c + a \<le> c + b" |
|
215 |
hence "(-c) + (c + a) \<le> (-c) + (c + b)" by (rule add_left_mono) |
|
216 |
hence "((-c) + c) + a \<le> ((-c) + c) + b" by (simp only: add_assoc) |
|
217 |
thus "a \<le> b" by simp |
|
218 |
qed |
|
219 |
||
22390 | 220 |
class ordered_cancel_ab_semigroup_add = pordered_cancel_ab_semigroup_add + linorder |
14738 | 221 |
|
222 |
instance ordered_cancel_ab_semigroup_add \<subseteq> pordered_ab_semigroup_add_imp_le |
|
223 |
proof |
|
224 |
fix a b c :: 'a |
|
225 |
assume le: "c + a <= c + b" |
|
226 |
show "a <= b" |
|
227 |
proof (rule ccontr) |
|
228 |
assume w: "~ a \<le> b" |
|
229 |
hence "b <= a" by (simp add: linorder_not_le) |
|
230 |
hence le2: "c+b <= c+a" by (rule add_left_mono) |
|
231 |
have "a = b" |
|
232 |
apply (insert le) |
|
233 |
apply (insert le2) |
|
234 |
apply (drule order_antisym, simp_all) |
|
235 |
done |
|
236 |
with w show False |
|
237 |
by (simp add: linorder_not_le [symmetric]) |
|
238 |
qed |
|
239 |
qed |
|
240 |
||
241 |
lemma add_right_mono: "a \<le> (b::'a::pordered_ab_semigroup_add) ==> a + c \<le> b + c" |
|
22390 | 242 |
by (simp add: add_commute [of _ c] add_left_mono) |
14738 | 243 |
|
244 |
text {* non-strict, in both arguments *} |
|
245 |
lemma add_mono: |
|
246 |
"[|a \<le> b; c \<le> d|] ==> a + c \<le> b + (d::'a::pordered_ab_semigroup_add)" |
|
247 |
apply (erule add_right_mono [THEN order_trans]) |
|
248 |
apply (simp add: add_commute add_left_mono) |
|
249 |
done |
|
250 |
||
251 |
lemma add_strict_left_mono: |
|
252 |
"a < b ==> c + a < c + (b::'a::pordered_cancel_ab_semigroup_add)" |
|
253 |
by (simp add: order_less_le add_left_mono) |
|
254 |
||
255 |
lemma add_strict_right_mono: |
|
256 |
"a < b ==> a + c < b + (c::'a::pordered_cancel_ab_semigroup_add)" |
|
257 |
by (simp add: add_commute [of _ c] add_strict_left_mono) |
|
258 |
||
259 |
text{*Strict monotonicity in both arguments*} |
|
260 |
lemma add_strict_mono: "[|a<b; c<d|] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)" |
|
261 |
apply (erule add_strict_right_mono [THEN order_less_trans]) |
|
262 |
apply (erule add_strict_left_mono) |
|
263 |
done |
|
264 |
||
265 |
lemma add_less_le_mono: |
|
266 |
"[| a<b; c\<le>d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)" |
|
267 |
apply (erule add_strict_right_mono [THEN order_less_le_trans]) |
|
268 |
apply (erule add_left_mono) |
|
269 |
done |
|
270 |
||
271 |
lemma add_le_less_mono: |
|
272 |
"[| a\<le>b; c<d |] ==> a + c < b + (d::'a::pordered_cancel_ab_semigroup_add)" |
|
273 |
apply (erule add_right_mono [THEN order_le_less_trans]) |
|
274 |
apply (erule add_strict_left_mono) |
|
275 |
done |
|
276 |
||
277 |
lemma add_less_imp_less_left: |
|
278 |
assumes less: "c + a < c + b" shows "a < (b::'a::pordered_ab_semigroup_add_imp_le)" |
|
279 |
proof - |
|
280 |
from less have le: "c + a <= c + b" by (simp add: order_le_less) |
|
281 |
have "a <= b" |
|
282 |
apply (insert le) |
|
283 |
apply (drule add_le_imp_le_left) |
|
284 |
by (insert le, drule add_le_imp_le_left, assumption) |
|
285 |
moreover have "a \<noteq> b" |
|
286 |
proof (rule ccontr) |
|
287 |
assume "~(a \<noteq> b)" |
|
288 |
then have "a = b" by simp |
|
289 |
then have "c + a = c + b" by simp |
|
290 |
with less show "False"by simp |
|
291 |
qed |
|
292 |
ultimately show "a < b" by (simp add: order_le_less) |
|
293 |
qed |
|
294 |
||
295 |
lemma add_less_imp_less_right: |
|
296 |
"a + c < b + c ==> a < (b::'a::pordered_ab_semigroup_add_imp_le)" |
|
297 |
apply (rule add_less_imp_less_left [of c]) |
|
298 |
apply (simp add: add_commute) |
|
299 |
done |
|
300 |
||
301 |
lemma add_less_cancel_left [simp]: |
|
302 |
"(c+a < c+b) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))" |
|
303 |
by (blast intro: add_less_imp_less_left add_strict_left_mono) |
|
304 |
||
305 |
lemma add_less_cancel_right [simp]: |
|
306 |
"(a+c < b+c) = (a < (b::'a::pordered_ab_semigroup_add_imp_le))" |
|
307 |
by (blast intro: add_less_imp_less_right add_strict_right_mono) |
|
308 |
||
309 |
lemma add_le_cancel_left [simp]: |
|
310 |
"(c+a \<le> c+b) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))" |
|
311 |
by (auto, drule add_le_imp_le_left, simp_all add: add_left_mono) |
|
312 |
||
313 |
lemma add_le_cancel_right [simp]: |
|
314 |
"(a+c \<le> b+c) = (a \<le> (b::'a::pordered_ab_semigroup_add_imp_le))" |
|
315 |
by (simp add: add_commute[of a c] add_commute[of b c]) |
|
316 |
||
317 |
lemma add_le_imp_le_right: |
|
318 |
"a + c \<le> b + c ==> a \<le> (b::'a::pordered_ab_semigroup_add_imp_le)" |
|
319 |
by simp |
|
320 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
321 |
lemma add_increasing: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
322 |
fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
323 |
shows "[|0\<le>a; b\<le>c|] ==> b \<le> a + c" |
14738 | 324 |
by (insert add_mono [of 0 a b c], simp) |
325 |
||
15539 | 326 |
lemma add_increasing2: |
327 |
fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}" |
|
328 |
shows "[|0\<le>c; b\<le>a|] ==> b \<le> a + c" |
|
329 |
by (simp add:add_increasing add_commute[of a]) |
|
330 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
331 |
lemma add_strict_increasing: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
332 |
fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
333 |
shows "[|0<a; b\<le>c|] ==> b < a + c" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
334 |
by (insert add_less_le_mono [of 0 a b c], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
335 |
|
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
336 |
lemma add_strict_increasing2: |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
337 |
fixes c :: "'a::{pordered_ab_semigroup_add_imp_le, comm_monoid_add}" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
338 |
shows "[|0\<le>a; b<c|] ==> b < a + c" |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
339 |
by (insert add_le_less_mono [of 0 a b c], simp) |
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
340 |
|
19527 | 341 |
lemma max_add_distrib_left: |
342 |
fixes z :: "'a::pordered_ab_semigroup_add_imp_le" |
|
343 |
shows "(max x y) + z = max (x+z) (y+z)" |
|
344 |
by (rule max_of_mono [THEN sym], rule add_le_cancel_right) |
|
345 |
||
346 |
lemma min_add_distrib_left: |
|
347 |
fixes z :: "'a::pordered_ab_semigroup_add_imp_le" |
|
348 |
shows "(min x y) + z = min (x+z) (y+z)" |
|
349 |
by (rule min_of_mono [THEN sym], rule add_le_cancel_right) |
|
350 |
||
351 |
lemma max_diff_distrib_left: |
|
352 |
fixes z :: "'a::pordered_ab_group_add" |
|
353 |
shows "(max x y) - z = max (x-z) (y-z)" |
|
354 |
by (simp add: diff_minus, rule max_add_distrib_left) |
|
355 |
||
356 |
lemma min_diff_distrib_left: |
|
357 |
fixes z :: "'a::pordered_ab_group_add" |
|
358 |
shows "(min x y) - z = min (x-z) (y-z)" |
|
359 |
by (simp add: diff_minus, rule min_add_distrib_left) |
|
360 |
||
15234
ec91a90c604e
simplification tweaks for better arithmetic reasoning
paulson
parents:
15229
diff
changeset
|
361 |
|
14738 | 362 |
subsection {* Ordering Rules for Unary Minus *} |
363 |
||
364 |
lemma le_imp_neg_le: |
|
365 |
assumes "a \<le> (b::'a::{pordered_ab_semigroup_add_imp_le, ab_group_add})" shows "-b \<le> -a" |
|
366 |
proof - |
|
367 |
have "-a+a \<le> -a+b" |
|
368 |
by (rule add_left_mono) |
|
369 |
hence "0 \<le> -a+b" |
|
370 |
by simp |
|
371 |
hence "0 + (-b) \<le> (-a + b) + (-b)" |
|
372 |
by (rule add_right_mono) |
|
373 |
thus ?thesis |
|
374 |
by (simp add: add_assoc) |
|
375 |
qed |
|
376 |
||
377 |
lemma neg_le_iff_le [simp]: "(-b \<le> -a) = (a \<le> (b::'a::pordered_ab_group_add))" |
|
378 |
proof |
|
379 |
assume "- b \<le> - a" |
|
380 |
hence "- (- a) \<le> - (- b)" |
|
381 |
by (rule le_imp_neg_le) |
|
382 |
thus "a\<le>b" by simp |
|
383 |
next |
|
384 |
assume "a\<le>b" |
|
385 |
thus "-b \<le> -a" by (rule le_imp_neg_le) |
|
386 |
qed |
|
387 |
||
388 |
lemma neg_le_0_iff_le [simp]: "(-a \<le> 0) = (0 \<le> (a::'a::pordered_ab_group_add))" |
|
389 |
by (subst neg_le_iff_le [symmetric], simp) |
|
390 |
||
391 |
lemma neg_0_le_iff_le [simp]: "(0 \<le> -a) = (a \<le> (0::'a::pordered_ab_group_add))" |
|
392 |
by (subst neg_le_iff_le [symmetric], simp) |
|
393 |
||
394 |
lemma neg_less_iff_less [simp]: "(-b < -a) = (a < (b::'a::pordered_ab_group_add))" |
|
395 |
by (force simp add: order_less_le) |
|
396 |
||
397 |
lemma neg_less_0_iff_less [simp]: "(-a < 0) = (0 < (a::'a::pordered_ab_group_add))" |
|
398 |
by (subst neg_less_iff_less [symmetric], simp) |
|
399 |
||
400 |
lemma neg_0_less_iff_less [simp]: "(0 < -a) = (a < (0::'a::pordered_ab_group_add))" |
|
401 |
by (subst neg_less_iff_less [symmetric], simp) |
|
402 |
||
403 |
text{*The next several equations can make the simplifier loop!*} |
|
404 |
||
405 |
lemma less_minus_iff: "(a < - b) = (b < - (a::'a::pordered_ab_group_add))" |
|
406 |
proof - |
|
407 |
have "(- (-a) < - b) = (b < - a)" by (rule neg_less_iff_less) |
|
408 |
thus ?thesis by simp |
|
409 |
qed |
|
410 |
||
411 |
lemma minus_less_iff: "(- a < b) = (- b < (a::'a::pordered_ab_group_add))" |
|
412 |
proof - |
|
413 |
have "(- a < - (-b)) = (- b < a)" by (rule neg_less_iff_less) |
|
414 |
thus ?thesis by simp |
|
415 |
qed |
|
416 |
||
417 |
lemma le_minus_iff: "(a \<le> - b) = (b \<le> - (a::'a::pordered_ab_group_add))" |
|
418 |
proof - |
|
419 |
have mm: "!! a (b::'a). (-(-a)) < -b \<Longrightarrow> -(-b) < -a" by (simp only: minus_less_iff) |
|
420 |
have "(- (- a) <= -b) = (b <= - a)" |
|
421 |
apply (auto simp only: order_le_less) |
|
422 |
apply (drule mm) |
|
423 |
apply (simp_all) |
|
424 |
apply (drule mm[simplified], assumption) |
|
425 |
done |
|
426 |
then show ?thesis by simp |
|
427 |
qed |
|
428 |
||
429 |
lemma minus_le_iff: "(- a \<le> b) = (- b \<le> (a::'a::pordered_ab_group_add))" |
|
430 |
by (auto simp add: order_le_less minus_less_iff) |
|
431 |
||
432 |
lemma add_diff_eq: "a + (b - c) = (a + b) - (c::'a::ab_group_add)" |
|
433 |
by (simp add: diff_minus add_ac) |
|
434 |
||
435 |
lemma diff_add_eq: "(a - b) + c = (a + c) - (b::'a::ab_group_add)" |
|
436 |
by (simp add: diff_minus add_ac) |
|
437 |
||
438 |
lemma diff_eq_eq: "(a-b = c) = (a = c + (b::'a::ab_group_add))" |
|
439 |
by (auto simp add: diff_minus add_assoc) |
|
440 |
||
441 |
lemma eq_diff_eq: "(a = c-b) = (a + (b::'a::ab_group_add) = c)" |
|
442 |
by (auto simp add: diff_minus add_assoc) |
|
443 |
||
444 |
lemma diff_diff_eq: "(a - b) - c = a - (b + (c::'a::ab_group_add))" |
|
445 |
by (simp add: diff_minus add_ac) |
|
446 |
||
447 |
lemma diff_diff_eq2: "a - (b - c) = (a + c) - (b::'a::ab_group_add)" |
|
448 |
by (simp add: diff_minus add_ac) |
|
449 |
||
450 |
lemma diff_add_cancel: "a - b + b = (a::'a::ab_group_add)" |
|
451 |
by (simp add: diff_minus add_ac) |
|
452 |
||
453 |
lemma add_diff_cancel: "a + b - b = (a::'a::ab_group_add)" |
|
454 |
by (simp add: diff_minus add_ac) |
|
455 |
||
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
456 |
text{*Further subtraction laws*} |
14738 | 457 |
|
458 |
lemma less_iff_diff_less_0: "(a < b) = (a - b < (0::'a::pordered_ab_group_add))" |
|
459 |
proof - |
|
460 |
have "(a < b) = (a + (- b) < b + (-b))" |
|
461 |
by (simp only: add_less_cancel_right) |
|
462 |
also have "... = (a - b < 0)" by (simp add: diff_minus) |
|
463 |
finally show ?thesis . |
|
464 |
qed |
|
465 |
||
466 |
lemma diff_less_eq: "(a-b < c) = (a < c + (b::'a::pordered_ab_group_add))" |
|
15481 | 467 |
apply (subst less_iff_diff_less_0 [of a]) |
14738 | 468 |
apply (rule less_iff_diff_less_0 [of _ c, THEN ssubst]) |
469 |
apply (simp add: diff_minus add_ac) |
|
470 |
done |
|
471 |
||
472 |
lemma less_diff_eq: "(a < c-b) = (a + (b::'a::pordered_ab_group_add) < c)" |
|
15481 | 473 |
apply (subst less_iff_diff_less_0 [of "a+b"]) |
474 |
apply (subst less_iff_diff_less_0 [of a]) |
|
14738 | 475 |
apply (simp add: diff_minus add_ac) |
476 |
done |
|
477 |
||
478 |
lemma diff_le_eq: "(a-b \<le> c) = (a \<le> c + (b::'a::pordered_ab_group_add))" |
|
479 |
by (auto simp add: order_le_less diff_less_eq diff_add_cancel add_diff_cancel) |
|
480 |
||
481 |
lemma le_diff_eq: "(a \<le> c-b) = (a + (b::'a::pordered_ab_group_add) \<le> c)" |
|
482 |
by (auto simp add: order_le_less less_diff_eq diff_add_cancel add_diff_cancel) |
|
483 |
||
484 |
text{*This list of rewrites simplifies (in)equalities by bringing subtractions |
|
485 |
to the top and then moving negative terms to the other side. |
|
486 |
Use with @{text add_ac}*} |
|
487 |
lemmas compare_rls = |
|
488 |
diff_minus [symmetric] |
|
489 |
add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2 |
|
490 |
diff_less_eq less_diff_eq diff_le_eq le_diff_eq |
|
491 |
diff_eq_eq eq_diff_eq |
|
492 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
493 |
subsection {* Support for reasoning about signs *} |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
494 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
495 |
lemma add_pos_pos: "0 < |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
496 |
(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
497 |
==> 0 < y ==> 0 < x + y" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
498 |
apply (subgoal_tac "0 + 0 < x + y") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
499 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
500 |
apply (erule add_less_le_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
501 |
apply (erule order_less_imp_le) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
502 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
503 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
504 |
lemma add_pos_nonneg: "0 < |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
505 |
(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
506 |
==> 0 <= y ==> 0 < x + y" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
507 |
apply (subgoal_tac "0 + 0 < x + y") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
508 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
509 |
apply (erule add_less_le_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
510 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
511 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
512 |
lemma add_nonneg_pos: "0 <= |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
513 |
(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
514 |
==> 0 < y ==> 0 < x + y" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
515 |
apply (subgoal_tac "0 + 0 < x + y") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
516 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
517 |
apply (erule add_le_less_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
518 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
519 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
520 |
lemma add_nonneg_nonneg: "0 <= |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
521 |
(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
522 |
==> 0 <= y ==> 0 <= x + y" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
523 |
apply (subgoal_tac "0 + 0 <= x + y") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
524 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
525 |
apply (erule add_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
526 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
527 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
528 |
lemma add_neg_neg: "(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
529 |
< 0 ==> y < 0 ==> x + y < 0" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
530 |
apply (subgoal_tac "x + y < 0 + 0") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
531 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
532 |
apply (erule add_less_le_mono) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
533 |
apply (erule order_less_imp_le) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
534 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
535 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
536 |
lemma add_neg_nonpos: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
537 |
"(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) < 0 |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
538 |
==> y <= 0 ==> x + y < 0" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
539 |
apply (subgoal_tac "x + y < 0 + 0") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
540 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
541 |
apply (erule add_less_le_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
542 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
543 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
544 |
lemma add_nonpos_neg: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
545 |
"(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) <= 0 |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
546 |
==> y < 0 ==> x + y < 0" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
547 |
apply (subgoal_tac "x + y < 0 + 0") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
548 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
549 |
apply (erule add_le_less_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
550 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
551 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
552 |
lemma add_nonpos_nonpos: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
553 |
"(x::'a::{comm_monoid_add,pordered_cancel_ab_semigroup_add}) <= 0 |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
554 |
==> y <= 0 ==> x + y <= 0" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
555 |
apply (subgoal_tac "x + y <= 0 + 0") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
556 |
apply simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
557 |
apply (erule add_mono, assumption) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
558 |
done |
14738 | 559 |
|
560 |
subsection{*Lemmas for the @{text cancel_numerals} simproc*} |
|
561 |
||
562 |
lemma eq_iff_diff_eq_0: "(a = b) = (a-b = (0::'a::ab_group_add))" |
|
563 |
by (simp add: compare_rls) |
|
564 |
||
565 |
lemma le_iff_diff_le_0: "(a \<le> b) = (a-b \<le> (0::'a::pordered_ab_group_add))" |
|
566 |
by (simp add: compare_rls) |
|
567 |
||
568 |
subsection {* Lattice Ordered (Abelian) Groups *} |
|
569 |
||
570 |
axclass lordered_ab_group_meet < pordered_ab_group_add, meet_semilorder |
|
571 |
||
572 |
axclass lordered_ab_group_join < pordered_ab_group_add, join_semilorder |
|
573 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
574 |
lemma add_inf_distrib_left: "a + (inf b c) = inf (a + b) (a + (c::'a::{pordered_ab_group_add, meet_semilorder}))" |
14738 | 575 |
apply (rule order_antisym) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
576 |
apply (simp_all add: le_infI) |
14738 | 577 |
apply (rule add_le_imp_le_left [of "-a"]) |
578 |
apply (simp only: add_assoc[symmetric], simp) |
|
21312 | 579 |
apply rule |
580 |
apply (rule add_le_imp_le_left[of "a"], simp only: add_assoc[symmetric], simp)+ |
|
14738 | 581 |
done |
582 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
583 |
lemma add_sup_distrib_left: "a + (sup b c) = sup (a + b) (a+ (c::'a::{pordered_ab_group_add, join_semilorder}))" |
14738 | 584 |
apply (rule order_antisym) |
585 |
apply (rule add_le_imp_le_left [of "-a"]) |
|
586 |
apply (simp only: add_assoc[symmetric], simp) |
|
21312 | 587 |
apply rule |
588 |
apply (rule add_le_imp_le_left [of "a"], simp only: add_assoc[symmetric], simp)+ |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
589 |
apply (rule le_supI) |
21312 | 590 |
apply (simp_all) |
14738 | 591 |
done |
592 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
593 |
lemma is_join_neg_inf: "is_join (% (a::'a::{pordered_ab_group_add, meet_semilorder}) b. - (inf (-a) (-b)))" |
14738 | 594 |
apply (auto simp add: is_join_def) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
595 |
apply (rule_tac c="inf (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_inf_distrib_left) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
596 |
apply (rule_tac c="inf (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_inf_distrib_left) |
14738 | 597 |
apply (subst neg_le_iff_le[symmetric]) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
598 |
apply (simp add: le_infI) |
14738 | 599 |
done |
600 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
601 |
lemma is_meet_neg_sup: "is_meet (% (a::'a::{pordered_ab_group_add, join_semilorder}) b. - (sup (-a) (-b)))" |
14738 | 602 |
apply (auto simp add: is_meet_def) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
603 |
apply (rule_tac c="sup (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_sup_distrib_left) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
604 |
apply (rule_tac c="sup (-a) (-b)" in add_le_imp_le_right, simp, simp add: add_sup_distrib_left) |
14738 | 605 |
apply (subst neg_le_iff_le[symmetric]) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
606 |
apply (simp add: le_supI) |
14738 | 607 |
done |
608 |
||
609 |
axclass lordered_ab_group \<subseteq> pordered_ab_group_add, lorder |
|
610 |
||
611 |
instance lordered_ab_group_join \<subseteq> lordered_ab_group |
|
612 |
proof |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
613 |
show "? m. is_meet (m::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_join))" by (blast intro: is_meet_neg_sup) |
14738 | 614 |
qed |
615 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
616 |
instance lordered_ab_group_meet \<subseteq> lordered_ab_group |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
617 |
proof |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
618 |
show "? j. is_join (j::'a\<Rightarrow>'a\<Rightarrow>('a::lordered_ab_group_meet))" by (blast intro: is_join_neg_inf) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
619 |
qed |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
620 |
|
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
621 |
lemma add_inf_distrib_right: "(inf a b) + (c::'a::lordered_ab_group) = inf (a+c) (b+c)" |
14738 | 622 |
proof - |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
623 |
have "c + (inf a b) = inf (c+a) (c+b)" by (simp add: add_inf_distrib_left) |
14738 | 624 |
thus ?thesis by (simp add: add_commute) |
625 |
qed |
|
626 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
627 |
lemma add_sup_distrib_right: "(sup a b) + (c::'a::lordered_ab_group) = sup (a+c) (b+c)" |
14738 | 628 |
proof - |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
629 |
have "c + (sup a b) = sup (c+a) (c+b)" by (simp add: add_sup_distrib_left) |
14738 | 630 |
thus ?thesis by (simp add: add_commute) |
631 |
qed |
|
632 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
633 |
lemmas add_sup_inf_distribs = add_inf_distrib_right add_inf_distrib_left add_sup_distrib_right add_sup_distrib_left |
14738 | 634 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
635 |
lemma sup_eq_neg_inf: "sup a (b::'a::lordered_ab_group) = - inf (-a) (-b)" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
636 |
by (simp add: is_join_unique[OF is_join_join is_join_neg_inf]) |
14738 | 637 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
638 |
lemma inf_eq_neg_sup: "inf a (b::'a::lordered_ab_group) = - sup (-a) (-b)" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
639 |
by (simp add: is_meet_unique[OF is_meet_meet is_meet_neg_sup]) |
14738 | 640 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
641 |
lemma add_eq_inf_sup: "a + b = (sup a b) + (inf a (b::'a::lordered_ab_group))" |
14738 | 642 |
proof - |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
643 |
have "0 = - inf 0 (a-b) + inf (a-b) 0" by (simp add: inf_commute) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
644 |
hence "0 = sup 0 (b-a) + inf (a-b) 0" by (simp add: inf_eq_neg_sup) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
645 |
hence "0 = (-a + sup a b) + (inf a b + (-b))" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
646 |
apply (simp add: add_sup_distrib_left add_inf_distrib_right) |
14738 | 647 |
by (simp add: diff_minus add_commute) |
648 |
thus ?thesis |
|
649 |
apply (simp add: compare_rls) |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
650 |
apply (subst add_left_cancel[symmetric, of "a+b" "sup a b + inf a b" "-a"]) |
14738 | 651 |
apply (simp only: add_assoc, simp add: add_assoc[symmetric]) |
652 |
done |
|
653 |
qed |
|
654 |
||
655 |
subsection {* Positive Part, Negative Part, Absolute Value *} |
|
656 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
657 |
definition |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
658 |
nprt :: "'a \<Rightarrow> ('a::lordered_ab_group)" where |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
659 |
"nprt x = inf x 0" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
660 |
|
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
661 |
definition |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
662 |
pprt :: "'a \<Rightarrow> ('a::lordered_ab_group)" where |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
663 |
"pprt x = sup x 0" |
14738 | 664 |
|
665 |
lemma prts: "a = pprt a + nprt a" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
666 |
by (simp add: pprt_def nprt_def add_eq_inf_sup[symmetric]) |
14738 | 667 |
|
668 |
lemma zero_le_pprt[simp]: "0 \<le> pprt a" |
|
21312 | 669 |
by (simp add: pprt_def) |
14738 | 670 |
|
671 |
lemma nprt_le_zero[simp]: "nprt a \<le> 0" |
|
21312 | 672 |
by (simp add: nprt_def) |
14738 | 673 |
|
674 |
lemma le_eq_neg: "(a \<le> -b) = (a + b \<le> (0::_::lordered_ab_group))" (is "?l = ?r") |
|
675 |
proof - |
|
676 |
have a: "?l \<longrightarrow> ?r" |
|
677 |
apply (auto) |
|
678 |
apply (rule add_le_imp_le_right[of _ "-b" _]) |
|
679 |
apply (simp add: add_assoc) |
|
680 |
done |
|
681 |
have b: "?r \<longrightarrow> ?l" |
|
682 |
apply (auto) |
|
683 |
apply (rule add_le_imp_le_right[of _ "b" _]) |
|
684 |
apply (simp) |
|
685 |
done |
|
686 |
from a b show ?thesis by blast |
|
687 |
qed |
|
688 |
||
15580 | 689 |
lemma pprt_0[simp]: "pprt 0 = 0" by (simp add: pprt_def) |
690 |
lemma nprt_0[simp]: "nprt 0 = 0" by (simp add: nprt_def) |
|
691 |
||
692 |
lemma pprt_eq_id[simp]: "0 <= x \<Longrightarrow> pprt x = x" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
693 |
by (simp add: pprt_def le_iff_sup sup_aci) |
15580 | 694 |
|
695 |
lemma nprt_eq_id[simp]: "x <= 0 \<Longrightarrow> nprt x = x" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
696 |
by (simp add: nprt_def le_iff_inf inf_aci) |
15580 | 697 |
|
698 |
lemma pprt_eq_0[simp]: "x <= 0 \<Longrightarrow> pprt x = 0" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
699 |
by (simp add: pprt_def le_iff_sup sup_aci) |
15580 | 700 |
|
701 |
lemma nprt_eq_0[simp]: "0 <= x \<Longrightarrow> nprt x = 0" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
702 |
by (simp add: nprt_def le_iff_inf inf_aci) |
15580 | 703 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
704 |
lemma sup_0_imp_0: "sup a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)" |
14738 | 705 |
proof - |
706 |
{ |
|
707 |
fix a::'a |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
708 |
assume hyp: "sup a (-a) = 0" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
709 |
hence "sup a (-a) + a = a" by (simp) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
710 |
hence "sup (a+a) 0 = a" by (simp add: add_sup_distrib_right) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
711 |
hence "sup (a+a) 0 <= a" by (simp) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
712 |
hence "0 <= a" by (blast intro: order_trans inf_sup_ord) |
14738 | 713 |
} |
714 |
note p = this |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
715 |
assume hyp:"sup a (-a) = 0" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
716 |
hence hyp2:"sup (-a) (-(-a)) = 0" by (simp add: sup_commute) |
14738 | 717 |
from p[OF hyp] p[OF hyp2] show "a = 0" by simp |
718 |
qed |
|
719 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
720 |
lemma inf_0_imp_0: "inf a (-a) = 0 \<Longrightarrow> a = (0::'a::lordered_ab_group)" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
721 |
apply (simp add: inf_eq_neg_sup) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
722 |
apply (simp add: sup_commute) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
723 |
apply (erule sup_0_imp_0) |
15481 | 724 |
done |
14738 | 725 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
726 |
lemma inf_0_eq_0[simp]: "(inf a (-a) = 0) = (a = (0::'a::lordered_ab_group))" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
727 |
by (auto, erule inf_0_imp_0) |
14738 | 728 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
729 |
lemma sup_0_eq_0[simp]: "(sup a (-a) = 0) = (a = (0::'a::lordered_ab_group))" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
730 |
by (auto, erule sup_0_imp_0) |
14738 | 731 |
|
732 |
lemma zero_le_double_add_iff_zero_le_single_add[simp]: "(0 \<le> a + a) = (0 \<le> (a::'a::lordered_ab_group))" |
|
733 |
proof |
|
734 |
assume "0 <= a + a" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
735 |
hence a:"inf (a+a) 0 = 0" by (simp add: le_iff_inf inf_commute) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
736 |
have "(inf a 0)+(inf a 0) = inf (inf (a+a) 0) a" (is "?l=_") by (simp add: add_sup_inf_distribs inf_aci) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
737 |
hence "?l = 0 + inf a 0" by (simp add: a, simp add: inf_commute) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
738 |
hence "inf a 0 = 0" by (simp only: add_right_cancel) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
739 |
then show "0 <= a" by (simp add: le_iff_inf inf_commute) |
14738 | 740 |
next |
741 |
assume a: "0 <= a" |
|
742 |
show "0 <= a + a" by (simp add: add_mono[OF a a, simplified]) |
|
743 |
qed |
|
744 |
||
745 |
lemma double_add_le_zero_iff_single_add_le_zero[simp]: "(a + a <= 0) = ((a::'a::lordered_ab_group) <= 0)" |
|
746 |
proof - |
|
747 |
have "(a + a <= 0) = (0 <= -(a+a))" by (subst le_minus_iff, simp) |
|
748 |
moreover have "\<dots> = (a <= 0)" by (simp add: zero_le_double_add_iff_zero_le_single_add) |
|
749 |
ultimately show ?thesis by blast |
|
750 |
qed |
|
751 |
||
752 |
lemma double_add_less_zero_iff_single_less_zero[simp]: "(a+a<0) = ((a::'a::{pordered_ab_group_add,linorder}) < 0)" (is ?s) |
|
753 |
proof cases |
|
754 |
assume a: "a < 0" |
|
755 |
thus ?s by (simp add: add_strict_mono[OF a a, simplified]) |
|
756 |
next |
|
757 |
assume "~(a < 0)" |
|
758 |
hence a:"0 <= a" by (simp) |
|
759 |
hence "0 <= a+a" by (simp add: add_mono[OF a a, simplified]) |
|
760 |
hence "~(a+a < 0)" by simp |
|
761 |
with a show ?thesis by simp |
|
762 |
qed |
|
763 |
||
764 |
axclass lordered_ab_group_abs \<subseteq> lordered_ab_group |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
765 |
abs_lattice: "abs x = sup x (-x)" |
14738 | 766 |
|
767 |
lemma abs_zero[simp]: "abs 0 = (0::'a::lordered_ab_group_abs)" |
|
768 |
by (simp add: abs_lattice) |
|
769 |
||
770 |
lemma abs_eq_0[simp]: "(abs a = 0) = (a = (0::'a::lordered_ab_group_abs))" |
|
771 |
by (simp add: abs_lattice) |
|
772 |
||
773 |
lemma abs_0_eq[simp]: "(0 = abs a) = (a = (0::'a::lordered_ab_group_abs))" |
|
774 |
proof - |
|
775 |
have "(0 = abs a) = (abs a = 0)" by (simp only: eq_ac) |
|
776 |
thus ?thesis by simp |
|
777 |
qed |
|
778 |
||
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
779 |
lemma neg_inf_eq_sup[simp]: "- inf a (b::_::lordered_ab_group) = sup (-a) (-b)" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
780 |
by (simp add: inf_eq_neg_sup) |
14738 | 781 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
782 |
lemma neg_sup_eq_inf[simp]: "- sup a (b::_::lordered_ab_group) = inf (-a) (-b)" |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
783 |
by (simp del: neg_inf_eq_sup add: sup_eq_neg_inf) |
14738 | 784 |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
785 |
lemma sup_eq_if: "sup a (-a) = (if a < 0 then -a else (a::'a::{lordered_ab_group, linorder}))" |
14738 | 786 |
proof - |
787 |
note b = add_le_cancel_right[of a a "-a",symmetric,simplified] |
|
788 |
have c: "a + a = 0 \<Longrightarrow> -a = a" by (rule add_right_imp_eq[of _ a], simp) |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
789 |
show ?thesis by (auto simp add: max_def b linorder_not_less join_max) |
14738 | 790 |
qed |
791 |
||
792 |
lemma abs_if_lattice: "\<bar>a\<bar> = (if a < 0 then -a else (a::'a::{lordered_ab_group_abs, linorder}))" |
|
793 |
proof - |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
794 |
show ?thesis by (simp add: abs_lattice sup_eq_if) |
14738 | 795 |
qed |
796 |
||
797 |
lemma abs_ge_zero[simp]: "0 \<le> abs (a::'a::lordered_ab_group_abs)" |
|
798 |
proof - |
|
21312 | 799 |
have a:"a <= abs a" and b:"-a <= abs a" by (auto simp add: abs_lattice) |
14738 | 800 |
show ?thesis by (rule add_mono[OF a b, simplified]) |
801 |
qed |
|
802 |
||
803 |
lemma abs_le_zero_iff [simp]: "(abs a \<le> (0::'a::lordered_ab_group_abs)) = (a = 0)" |
|
804 |
proof |
|
805 |
assume "abs a <= 0" |
|
806 |
hence "abs a = 0" by (auto dest: order_antisym) |
|
807 |
thus "a = 0" by simp |
|
808 |
next |
|
809 |
assume "a = 0" |
|
810 |
thus "abs a <= 0" by simp |
|
811 |
qed |
|
812 |
||
813 |
lemma zero_less_abs_iff [simp]: "(0 < abs a) = (a \<noteq> (0::'a::lordered_ab_group_abs))" |
|
814 |
by (simp add: order_less_le) |
|
815 |
||
816 |
lemma abs_not_less_zero [simp]: "~ abs a < (0::'a::lordered_ab_group_abs)" |
|
817 |
proof - |
|
818 |
have a:"!! x (y::_::order). x <= y \<Longrightarrow> ~(y < x)" by auto |
|
819 |
show ?thesis by (simp add: a) |
|
820 |
qed |
|
821 |
||
822 |
lemma abs_ge_self: "a \<le> abs (a::'a::lordered_ab_group_abs)" |
|
21312 | 823 |
by (simp add: abs_lattice) |
14738 | 824 |
|
825 |
lemma abs_ge_minus_self: "-a \<le> abs (a::'a::lordered_ab_group_abs)" |
|
21312 | 826 |
by (simp add: abs_lattice) |
14738 | 827 |
|
828 |
lemma abs_prts: "abs (a::_::lordered_ab_group_abs) = pprt a - nprt a" |
|
829 |
apply (simp add: pprt_def nprt_def diff_minus) |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
830 |
apply (simp add: add_sup_inf_distribs sup_aci abs_lattice[symmetric]) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
831 |
apply (subst sup_absorb2, auto) |
14738 | 832 |
done |
833 |
||
834 |
lemma abs_minus_cancel [simp]: "abs (-a) = abs(a::'a::lordered_ab_group_abs)" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
835 |
by (simp add: abs_lattice sup_commute) |
14738 | 836 |
|
837 |
lemma abs_idempotent [simp]: "abs (abs a) = abs (a::'a::lordered_ab_group_abs)" |
|
838 |
apply (simp add: abs_lattice[of "abs a"]) |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
839 |
apply (subst sup_absorb1) |
14738 | 840 |
apply (rule order_trans[of _ 0]) |
841 |
by auto |
|
842 |
||
15093
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
843 |
lemma abs_minus_commute: |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
844 |
fixes a :: "'a::lordered_ab_group_abs" |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
845 |
shows "abs (a-b) = abs(b-a)" |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
846 |
proof - |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
847 |
have "abs (a-b) = abs (- (a-b))" by (simp only: abs_minus_cancel) |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
848 |
also have "... = abs(b-a)" by simp |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
849 |
finally show ?thesis . |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
850 |
qed |
49ede01e9ee6
conversion of Integration and NSPrimes to Isar scripts
paulson
parents:
15010
diff
changeset
|
851 |
|
14738 | 852 |
lemma zero_le_iff_zero_nprt: "(0 \<le> a) = (nprt a = 0)" |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
853 |
by (simp add: le_iff_inf nprt_def inf_commute) |
14738 | 854 |
|
855 |
lemma le_zero_iff_zero_pprt: "(a \<le> 0) = (pprt a = 0)" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
856 |
by (simp add: le_iff_sup pprt_def sup_commute) |
14738 | 857 |
|
858 |
lemma le_zero_iff_pprt_id: "(0 \<le> a) = (pprt a = a)" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
859 |
by (simp add: le_iff_sup pprt_def sup_commute) |
14738 | 860 |
|
861 |
lemma zero_le_iff_nprt_id: "(a \<le> 0) = (nprt a = a)" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
862 |
by (simp add: le_iff_inf nprt_def inf_commute) |
14738 | 863 |
|
15580 | 864 |
lemma pprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> pprt a <= pprt b" |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
865 |
by (simp add: le_iff_sup pprt_def sup_aci) |
15580 | 866 |
|
867 |
lemma nprt_mono[simp]: "(a::_::lordered_ab_group) <= b \<Longrightarrow> nprt a <= nprt b" |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
868 |
by (simp add: le_iff_inf nprt_def inf_aci) |
15580 | 869 |
|
19404 | 870 |
lemma pprt_neg: "pprt (-x) = - nprt x" |
871 |
by (simp add: pprt_def nprt_def) |
|
872 |
||
873 |
lemma nprt_neg: "nprt (-x) = - pprt x" |
|
874 |
by (simp add: pprt_def nprt_def) |
|
875 |
||
14738 | 876 |
lemma iff2imp: "(A=B) \<Longrightarrow> (A \<Longrightarrow> B)" |
877 |
by (simp) |
|
878 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
879 |
lemma abs_of_nonneg [simp]: "0 \<le> a \<Longrightarrow> abs a = (a::'a::lordered_ab_group_abs)" |
14738 | 880 |
by (simp add: iff2imp[OF zero_le_iff_zero_nprt] iff2imp[OF le_zero_iff_pprt_id] abs_prts) |
881 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
882 |
lemma abs_of_pos: "0 < (x::'a::lordered_ab_group_abs) ==> abs x = x"; |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
883 |
by (rule abs_of_nonneg, rule order_less_imp_le); |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
884 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
885 |
lemma abs_of_nonpos [simp]: "a \<le> 0 \<Longrightarrow> abs a = -(a::'a::lordered_ab_group_abs)" |
14738 | 886 |
by (simp add: iff2imp[OF le_zero_iff_zero_pprt] iff2imp[OF zero_le_iff_nprt_id] abs_prts) |
887 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
888 |
lemma abs_of_neg: "(x::'a::lordered_ab_group_abs) < 0 ==> |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
889 |
abs x = - x" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
890 |
by (rule abs_of_nonpos, rule order_less_imp_le) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
891 |
|
14738 | 892 |
lemma abs_leI: "[|a \<le> b; -a \<le> b|] ==> abs a \<le> (b::'a::lordered_ab_group_abs)" |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
893 |
by (simp add: abs_lattice le_supI) |
14738 | 894 |
|
895 |
lemma le_minus_self_iff: "(a \<le> -a) = (a \<le> (0::'a::lordered_ab_group))" |
|
896 |
proof - |
|
897 |
from add_le_cancel_left[of "-a" "a+a" "0"] have "(a <= -a) = (a+a <= 0)" |
|
898 |
by (simp add: add_assoc[symmetric]) |
|
899 |
thus ?thesis by simp |
|
900 |
qed |
|
901 |
||
902 |
lemma minus_le_self_iff: "(-a \<le> a) = (0 \<le> (a::'a::lordered_ab_group))" |
|
903 |
proof - |
|
904 |
from add_le_cancel_left[of "-a" "0" "a+a"] have "(-a <= a) = (0 <= a+a)" |
|
905 |
by (simp add: add_assoc[symmetric]) |
|
906 |
thus ?thesis by simp |
|
907 |
qed |
|
908 |
||
909 |
lemma abs_le_D1: "abs a \<le> b ==> a \<le> (b::'a::lordered_ab_group_abs)" |
|
910 |
by (insert abs_ge_self, blast intro: order_trans) |
|
911 |
||
912 |
lemma abs_le_D2: "abs a \<le> b ==> -a \<le> (b::'a::lordered_ab_group_abs)" |
|
913 |
by (insert abs_le_D1 [of "-a"], simp) |
|
914 |
||
915 |
lemma abs_le_iff: "(abs a \<le> b) = (a \<le> b & -a \<le> (b::'a::lordered_ab_group_abs))" |
|
916 |
by (blast intro: abs_leI dest: abs_le_D1 abs_le_D2) |
|
917 |
||
15539 | 918 |
lemma abs_triangle_ineq: "abs(a+b) \<le> abs a + abs(b::'a::lordered_ab_group_abs)" |
14738 | 919 |
proof - |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
920 |
have g:"abs a + abs b = sup (a+b) (sup (-a-b) (sup (-a+b) (a + (-b))))" (is "_=sup ?m ?n") |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
921 |
by (simp add: abs_lattice add_sup_inf_distribs sup_aci diff_minus) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
922 |
have a:"a+b <= sup ?m ?n" by (simp) |
21312 | 923 |
have b:"-a-b <= ?n" by (simp) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
924 |
have c:"?n <= sup ?m ?n" by (simp) |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
925 |
from b c have d: "-a-b <= sup ?m ?n" by(rule order_trans) |
14738 | 926 |
have e:"-a-b = -(a+b)" by (simp add: diff_minus) |
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
927 |
from a d e have "abs(a+b) <= sup ?m ?n" |
14738 | 928 |
by (drule_tac abs_leI, auto) |
929 |
with g[symmetric] show ?thesis by simp |
|
930 |
qed |
|
931 |
||
16775
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
932 |
lemma abs_triangle_ineq2: "abs (a::'a::lordered_ab_group_abs) - |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
933 |
abs b <= abs (a - b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
934 |
apply (simp add: compare_rls) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
935 |
apply (subgoal_tac "abs a = abs (a - b + b)") |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
936 |
apply (erule ssubst) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
937 |
apply (rule abs_triangle_ineq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
938 |
apply (rule arg_cong);back; |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
939 |
apply (simp add: compare_rls) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
940 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
941 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
942 |
lemma abs_triangle_ineq3: |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
943 |
"abs(abs (a::'a::lordered_ab_group_abs) - abs b) <= abs (a - b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
944 |
apply (subst abs_le_iff) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
945 |
apply auto |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
946 |
apply (rule abs_triangle_ineq2) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
947 |
apply (subst abs_minus_commute) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
948 |
apply (rule abs_triangle_ineq2) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
949 |
done |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
950 |
|
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
951 |
lemma abs_triangle_ineq4: "abs ((a::'a::lordered_ab_group_abs) - b) <= |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
952 |
abs a + abs b" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
953 |
proof -; |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
954 |
have "abs(a - b) = abs(a + - b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
955 |
by (subst diff_minus, rule refl) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
956 |
also have "... <= abs a + abs (- b)" |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
957 |
by (rule abs_triangle_ineq) |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
958 |
finally show ?thesis |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
959 |
by simp |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
960 |
qed |
c1b87ef4a1c3
added lemmas to OrderedGroup.thy (reasoning about signs, absolute value, triangle inequalities)
avigad
parents:
16417
diff
changeset
|
961 |
|
14738 | 962 |
lemma abs_diff_triangle_ineq: |
963 |
"\<bar>(a::'a::lordered_ab_group_abs) + b - (c+d)\<bar> \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>" |
|
964 |
proof - |
|
965 |
have "\<bar>a + b - (c+d)\<bar> = \<bar>(a-c) + (b-d)\<bar>" by (simp add: diff_minus add_ac) |
|
966 |
also have "... \<le> \<bar>a-c\<bar> + \<bar>b-d\<bar>" by (rule abs_triangle_ineq) |
|
967 |
finally show ?thesis . |
|
968 |
qed |
|
969 |
||
15539 | 970 |
lemma abs_add_abs[simp]: |
971 |
fixes a:: "'a::{lordered_ab_group_abs}" |
|
972 |
shows "abs(abs a + abs b) = abs a + abs b" (is "?L = ?R") |
|
973 |
proof (rule order_antisym) |
|
974 |
show "?L \<ge> ?R" by(rule abs_ge_self) |
|
975 |
next |
|
976 |
have "?L \<le> \<bar>\<bar>a\<bar>\<bar> + \<bar>\<bar>b\<bar>\<bar>" by(rule abs_triangle_ineq) |
|
977 |
also have "\<dots> = ?R" by simp |
|
978 |
finally show "?L \<le> ?R" . |
|
979 |
qed |
|
980 |
||
14754
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
981 |
text {* Needed for abelian cancellation simprocs: *} |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
982 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
983 |
lemma add_cancel_21: "((x::'a::ab_group_add) + (y + z) = y + u) = (x + z = u)" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
984 |
apply (subst add_left_commute) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
985 |
apply (subst add_left_cancel) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
986 |
apply simp |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
987 |
done |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
988 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
989 |
lemma add_cancel_end: "(x + (y + z) = y) = (x = - (z::'a::ab_group_add))" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
990 |
apply (subst add_cancel_21[of _ _ _ 0, simplified]) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
991 |
apply (simp add: add_right_cancel[symmetric, of "x" "-z" "z", simplified]) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
992 |
done |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
993 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
994 |
lemma less_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (x < y) = (x' < y')" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
995 |
by (simp add: less_iff_diff_less_0[of x y] less_iff_diff_less_0[of x' y']) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
996 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
997 |
lemma le_eqI: "(x::'a::pordered_ab_group_add) - y = x' - y' \<Longrightarrow> (y <= x) = (y' <= x')" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
998 |
apply (simp add: le_iff_diff_le_0[of y x] le_iff_diff_le_0[of y' x']) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
999 |
apply (simp add: neg_le_iff_le[symmetric, of "y-x" 0] neg_le_iff_le[symmetric, of "y'-x'" 0]) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1000 |
done |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1001 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1002 |
lemma eq_eqI: "(x::'a::ab_group_add) - y = x' - y' \<Longrightarrow> (x = y) = (x' = y')" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1003 |
by (simp add: eq_iff_diff_eq_0[of x y] eq_iff_diff_eq_0[of x' y']) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1004 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1005 |
lemma diff_def: "(x::'a::ab_group_add) - y == x + (-y)" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1006 |
by (simp add: diff_minus) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1007 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1008 |
lemma add_minus_cancel: "(a::'a::ab_group_add) + (-a + b) = b" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1009 |
by (simp add: add_assoc[symmetric]) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1010 |
|
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1011 |
lemma minus_add_cancel: "-(a::'a::ab_group_add) + (a + b) = b" |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1012 |
by (simp add: add_assoc[symmetric]) |
a080eeeaec14
Modification / Installation of Provers/Arith/abel_cancel.ML for OrderedGroup.thy
obua
parents:
14738
diff
changeset
|
1013 |
|
15178 | 1014 |
lemma le_add_right_mono: |
1015 |
assumes |
|
1016 |
"a <= b + (c::'a::pordered_ab_group_add)" |
|
1017 |
"c <= d" |
|
1018 |
shows "a <= b + d" |
|
1019 |
apply (rule_tac order_trans[where y = "b+c"]) |
|
1020 |
apply (simp_all add: prems) |
|
1021 |
done |
|
1022 |
||
1023 |
lemmas group_eq_simps = |
|
1024 |
mult_ac |
|
1025 |
add_ac |
|
1026 |
add_diff_eq diff_add_eq diff_diff_eq diff_diff_eq2 |
|
1027 |
diff_eq_eq eq_diff_eq |
|
1028 |
||
1029 |
lemma estimate_by_abs: |
|
1030 |
"a + b <= (c::'a::lordered_ab_group_abs) \<Longrightarrow> a <= c + abs b" |
|
1031 |
proof - |
|
1032 |
assume 1: "a+b <= c" |
|
1033 |
have 2: "a <= c+(-b)" |
|
1034 |
apply (insert 1) |
|
1035 |
apply (drule_tac add_right_mono[where c="-b"]) |
|
1036 |
apply (simp add: group_eq_simps) |
|
1037 |
done |
|
1038 |
have 3: "(-b) <= abs b" by (rule abs_ge_minus_self) |
|
1039 |
show ?thesis by (rule le_add_right_mono[OF 2 3]) |
|
1040 |
qed |
|
1041 |
||
17085 | 1042 |
text{*Simplification of @{term "x-y < 0"}, etc.*} |
1043 |
lemmas diff_less_0_iff_less = less_iff_diff_less_0 [symmetric] |
|
1044 |
lemmas diff_eq_0_iff_eq = eq_iff_diff_eq_0 [symmetric] |
|
1045 |
lemmas diff_le_0_iff_le = le_iff_diff_le_0 [symmetric] |
|
1046 |
declare diff_less_0_iff_less [simp] |
|
1047 |
declare diff_eq_0_iff_eq [simp] |
|
1048 |
declare diff_le_0_iff_le [simp] |
|
1049 |
||
1050 |
||
14738 | 1051 |
ML {* |
1052 |
val add_assoc = thm "add_assoc"; |
|
1053 |
val add_commute = thm "add_commute"; |
|
1054 |
val add_left_commute = thm "add_left_commute"; |
|
1055 |
val add_ac = thms "add_ac"; |
|
1056 |
val mult_assoc = thm "mult_assoc"; |
|
1057 |
val mult_commute = thm "mult_commute"; |
|
1058 |
val mult_left_commute = thm "mult_left_commute"; |
|
1059 |
val mult_ac = thms "mult_ac"; |
|
1060 |
val add_0 = thm "add_0"; |
|
1061 |
val mult_1_left = thm "mult_1_left"; |
|
1062 |
val mult_1_right = thm "mult_1_right"; |
|
1063 |
val mult_1 = thm "mult_1"; |
|
1064 |
val add_left_imp_eq = thm "add_left_imp_eq"; |
|
1065 |
val add_right_imp_eq = thm "add_right_imp_eq"; |
|
1066 |
val add_imp_eq = thm "add_imp_eq"; |
|
1067 |
val left_minus = thm "left_minus"; |
|
1068 |
val diff_minus = thm "diff_minus"; |
|
1069 |
val add_0_right = thm "add_0_right"; |
|
1070 |
val add_left_cancel = thm "add_left_cancel"; |
|
1071 |
val add_right_cancel = thm "add_right_cancel"; |
|
1072 |
val right_minus = thm "right_minus"; |
|
1073 |
val right_minus_eq = thm "right_minus_eq"; |
|
1074 |
val minus_minus = thm "minus_minus"; |
|
1075 |
val equals_zero_I = thm "equals_zero_I"; |
|
1076 |
val minus_zero = thm "minus_zero"; |
|
1077 |
val diff_self = thm "diff_self"; |
|
1078 |
val diff_0 = thm "diff_0"; |
|
1079 |
val diff_0_right = thm "diff_0_right"; |
|
1080 |
val diff_minus_eq_add = thm "diff_minus_eq_add"; |
|
1081 |
val neg_equal_iff_equal = thm "neg_equal_iff_equal"; |
|
1082 |
val neg_equal_0_iff_equal = thm "neg_equal_0_iff_equal"; |
|
1083 |
val neg_0_equal_iff_equal = thm "neg_0_equal_iff_equal"; |
|
1084 |
val equation_minus_iff = thm "equation_minus_iff"; |
|
1085 |
val minus_equation_iff = thm "minus_equation_iff"; |
|
1086 |
val minus_add_distrib = thm "minus_add_distrib"; |
|
1087 |
val minus_diff_eq = thm "minus_diff_eq"; |
|
1088 |
val add_left_mono = thm "add_left_mono"; |
|
1089 |
val add_le_imp_le_left = thm "add_le_imp_le_left"; |
|
1090 |
val add_right_mono = thm "add_right_mono"; |
|
1091 |
val add_mono = thm "add_mono"; |
|
1092 |
val add_strict_left_mono = thm "add_strict_left_mono"; |
|
1093 |
val add_strict_right_mono = thm "add_strict_right_mono"; |
|
1094 |
val add_strict_mono = thm "add_strict_mono"; |
|
1095 |
val add_less_le_mono = thm "add_less_le_mono"; |
|
1096 |
val add_le_less_mono = thm "add_le_less_mono"; |
|
1097 |
val add_less_imp_less_left = thm "add_less_imp_less_left"; |
|
1098 |
val add_less_imp_less_right = thm "add_less_imp_less_right"; |
|
1099 |
val add_less_cancel_left = thm "add_less_cancel_left"; |
|
1100 |
val add_less_cancel_right = thm "add_less_cancel_right"; |
|
1101 |
val add_le_cancel_left = thm "add_le_cancel_left"; |
|
1102 |
val add_le_cancel_right = thm "add_le_cancel_right"; |
|
1103 |
val add_le_imp_le_right = thm "add_le_imp_le_right"; |
|
1104 |
val add_increasing = thm "add_increasing"; |
|
1105 |
val le_imp_neg_le = thm "le_imp_neg_le"; |
|
1106 |
val neg_le_iff_le = thm "neg_le_iff_le"; |
|
1107 |
val neg_le_0_iff_le = thm "neg_le_0_iff_le"; |
|
1108 |
val neg_0_le_iff_le = thm "neg_0_le_iff_le"; |
|
1109 |
val neg_less_iff_less = thm "neg_less_iff_less"; |
|
1110 |
val neg_less_0_iff_less = thm "neg_less_0_iff_less"; |
|
1111 |
val neg_0_less_iff_less = thm "neg_0_less_iff_less"; |
|
1112 |
val less_minus_iff = thm "less_minus_iff"; |
|
1113 |
val minus_less_iff = thm "minus_less_iff"; |
|
1114 |
val le_minus_iff = thm "le_minus_iff"; |
|
1115 |
val minus_le_iff = thm "minus_le_iff"; |
|
1116 |
val add_diff_eq = thm "add_diff_eq"; |
|
1117 |
val diff_add_eq = thm "diff_add_eq"; |
|
1118 |
val diff_eq_eq = thm "diff_eq_eq"; |
|
1119 |
val eq_diff_eq = thm "eq_diff_eq"; |
|
1120 |
val diff_diff_eq = thm "diff_diff_eq"; |
|
1121 |
val diff_diff_eq2 = thm "diff_diff_eq2"; |
|
1122 |
val diff_add_cancel = thm "diff_add_cancel"; |
|
1123 |
val add_diff_cancel = thm "add_diff_cancel"; |
|
1124 |
val less_iff_diff_less_0 = thm "less_iff_diff_less_0"; |
|
1125 |
val diff_less_eq = thm "diff_less_eq"; |
|
1126 |
val less_diff_eq = thm "less_diff_eq"; |
|
1127 |
val diff_le_eq = thm "diff_le_eq"; |
|
1128 |
val le_diff_eq = thm "le_diff_eq"; |
|
1129 |
val compare_rls = thms "compare_rls"; |
|
1130 |
val eq_iff_diff_eq_0 = thm "eq_iff_diff_eq_0"; |
|
1131 |
val le_iff_diff_le_0 = thm "le_iff_diff_le_0"; |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1132 |
val add_inf_distrib_left = thm "add_inf_distrib_left"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1133 |
val add_sup_distrib_left = thm "add_sup_distrib_left"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1134 |
val is_join_neg_inf = thm "is_join_neg_inf"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1135 |
val is_meet_neg_sup = thm "is_meet_neg_sup"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1136 |
val add_sup_distrib_right = thm "add_sup_distrib_right"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1137 |
val add_inf_distrib_right = thm "add_inf_distrib_right"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1138 |
val add_sup_inf_distribs = thms "add_sup_inf_distribs"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1139 |
val sup_eq_neg_inf = thm "sup_eq_neg_inf"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1140 |
val inf_eq_neg_sup = thm "inf_eq_neg_sup"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1141 |
val add_eq_inf_sup = thm "add_eq_inf_sup"; |
14738 | 1142 |
val prts = thm "prts"; |
1143 |
val zero_le_pprt = thm "zero_le_pprt"; |
|
1144 |
val nprt_le_zero = thm "nprt_le_zero"; |
|
1145 |
val le_eq_neg = thm "le_eq_neg"; |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1146 |
val sup_0_imp_0 = thm "sup_0_imp_0"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1147 |
val inf_0_imp_0 = thm "inf_0_imp_0"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1148 |
val sup_0_eq_0 = thm "sup_0_eq_0"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1149 |
val inf_0_eq_0 = thm "inf_0_eq_0"; |
14738 | 1150 |
val zero_le_double_add_iff_zero_le_single_add = thm "zero_le_double_add_iff_zero_le_single_add"; |
1151 |
val double_add_le_zero_iff_single_add_le_zero = thm "double_add_le_zero_iff_single_add_le_zero"; |
|
1152 |
val double_add_less_zero_iff_single_less_zero = thm "double_add_less_zero_iff_single_less_zero"; |
|
1153 |
val abs_lattice = thm "abs_lattice"; |
|
1154 |
val abs_zero = thm "abs_zero"; |
|
1155 |
val abs_eq_0 = thm "abs_eq_0"; |
|
1156 |
val abs_0_eq = thm "abs_0_eq"; |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1157 |
val neg_inf_eq_sup = thm "neg_inf_eq_sup"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1158 |
val neg_sup_eq_inf = thm "neg_sup_eq_inf"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1159 |
val sup_eq_if = thm "sup_eq_if"; |
14738 | 1160 |
val abs_if_lattice = thm "abs_if_lattice"; |
1161 |
val abs_ge_zero = thm "abs_ge_zero"; |
|
1162 |
val abs_le_zero_iff = thm "abs_le_zero_iff"; |
|
1163 |
val zero_less_abs_iff = thm "zero_less_abs_iff"; |
|
1164 |
val abs_not_less_zero = thm "abs_not_less_zero"; |
|
1165 |
val abs_ge_self = thm "abs_ge_self"; |
|
1166 |
val abs_ge_minus_self = thm "abs_ge_minus_self"; |
|
22422
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1167 |
val le_imp_join_eq = thm "sup_absorb2"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1168 |
val ge_imp_join_eq = thm "sup_absorb1"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1169 |
val le_imp_meet_eq = thm "inf_absorb1"; |
ee19cdb07528
stepping towards uniform lattice theory development in HOL
haftmann
parents:
22390
diff
changeset
|
1170 |
val ge_imp_meet_eq = thm "inf_absorb2"; |
14738 | 1171 |
val abs_prts = thm "abs_prts"; |
1172 |
val abs_minus_cancel = thm "abs_minus_cancel"; |
|
1173 |
val abs_idempotent = thm "abs_idempotent"; |
|
1174 |
val zero_le_iff_zero_nprt = thm "zero_le_iff_zero_nprt"; |
|
1175 |
val le_zero_iff_zero_pprt = thm "le_zero_iff_zero_pprt"; |
|
1176 |
val le_zero_iff_pprt_id = thm "le_zero_iff_pprt_id"; |
|
1177 |
val zero_le_iff_nprt_id = thm "zero_le_iff_nprt_id"; |
|
1178 |
val iff2imp = thm "iff2imp"; |
|
1179 |
val abs_leI = thm "abs_leI"; |
|
1180 |
val le_minus_self_iff = thm "le_minus_self_iff"; |
|
1181 |
val minus_le_self_iff = thm "minus_le_self_iff"; |
|
1182 |
val abs_le_D1 = thm "abs_le_D1"; |
|
1183 |
val abs_le_D2 = thm "abs_le_D2"; |
|
1184 |
val abs_le_iff = thm "abs_le_iff"; |
|
1185 |
val abs_triangle_ineq = thm "abs_triangle_ineq"; |
|
1186 |
val abs_diff_triangle_ineq = thm "abs_diff_triangle_ineq"; |
|
1187 |
*} |
|
1188 |
||
1189 |
end |