src/HOL/Arith.ML
 author paulson Wed Nov 05 13:29:47 1997 +0100 (1997-11-05) changeset 4158 47c7490c74fe parent 4089 96fba19bcbe2 child 4297 5defc2105cc8 permissions -rw-r--r--
Expandshort; new theorem le_square
1 (*  Title:      HOL/Arith.ML
2     ID:         \$Id\$
3     Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
4     Copyright   1993  University of Cambridge
7 Some from the Hoare example from Norbert Galm
8 *)
10 (*** Basic rewrite rules for the arithmetic operators ***)
12 goalw Arith.thy [pred_def] "pred 0 = 0";
13 by (Simp_tac 1);
14 qed "pred_0";
16 goalw Arith.thy [pred_def] "pred(Suc n) = n";
17 by (Simp_tac 1);
18 qed "pred_Suc";
22 (** pred **)
24 val prems = goal Arith.thy "n ~= 0 ==> Suc(pred n) = n";
25 by (res_inst_tac [("n","n")] natE 1);
26 by (cut_facts_tac prems 1);
27 by (ALLGOALS Asm_full_simp_tac);
28 qed "Suc_pred";
31 goal Arith.thy "pred(n) <= (n::nat)";
32 by (res_inst_tac [("n","n")] natE 1);
33 by (ALLGOALS Asm_simp_tac);
34 qed "pred_le";
37 goalw Arith.thy [pred_def] "m<=n --> pred(m) <= pred(n)";
38 by (simp_tac (simpset() addsplits [expand_nat_case]) 1);
39 qed_spec_mp "pred_le_mono";
41 goal Arith.thy "!!n. n ~= 0 ==> pred n < n";
42 by (exhaust_tac "n" 1);
43 by (ALLGOALS Asm_full_simp_tac);
44 qed "pred_less";
47 (** Difference **)
49 qed_goalw "diff_0_eq_0" Arith.thy [pred_def]
50     "0 - n = 0"
51  (fn _ => [induct_tac "n" 1,  ALLGOALS Asm_simp_tac]);
53 (*Must simplify BEFORE the induction!!  (Else we get a critical pair)
54   Suc(m) - Suc(n)   rewrites to   pred(Suc(m) - n)  *)
55 qed_goalw "diff_Suc_Suc" Arith.thy [pred_def]
56     "Suc(m) - Suc(n) = m - n"
57  (fn _ =>
58   [Simp_tac 1, induct_tac "n" 1, ALLGOALS Asm_simp_tac]);
63 (**** Inductive properties of the operators ****)
67 qed_goal "add_0_right" Arith.thy "m + 0 = m"
68  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
70 qed_goal "add_Suc_right" Arith.thy "m + Suc(n) = Suc(m+n)"
71  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
76 qed_goal "add_assoc" Arith.thy "(m + n) + k = m + ((n + k)::nat)"
77  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
80 qed_goal "add_commute" Arith.thy "m + n = n + (m::nat)"
81  (fn _ =>  [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
84  (fn _ => [rtac (add_commute RS trans) 1, rtac (add_assoc RS trans) 1,
85            rtac (add_commute RS arg_cong) 1]);
90 goal Arith.thy "!!k::nat. (k + m = k + n) = (m=n)";
91 by (induct_tac "k" 1);
92 by (Simp_tac 1);
93 by (Asm_simp_tac 1);
96 goal Arith.thy "!!k::nat. (m + k = n + k) = (m=n)";
97 by (induct_tac "k" 1);
98 by (Simp_tac 1);
99 by (Asm_simp_tac 1);
102 goal Arith.thy "!!k::nat. (k + m <= k + n) = (m<=n)";
103 by (induct_tac "k" 1);
104 by (Simp_tac 1);
105 by (Asm_simp_tac 1);
108 goal Arith.thy "!!k::nat. (k + m < k + n) = (m<n)";
109 by (induct_tac "k" 1);
110 by (Simp_tac 1);
111 by (Asm_simp_tac 1);
117 (** Reasoning about m+0=0, etc. **)
119 goal Arith.thy "(m+n = 0) = (m=0 & n=0)";
120 by (induct_tac "m" 1);
121 by (ALLGOALS Asm_simp_tac);
125 goal Arith.thy "(pred (m+n) = 0) = (m=0 & pred n = 0 | pred m = 0 & n=0)";
126 by (induct_tac "m" 1);
127 by (ALLGOALS (fast_tac (claset() addss (simpset()))));
131 goal Arith.thy "!!n. n ~= 0 ==> m + pred n = pred(m+n)";
132 by (induct_tac "m" 1);
133 by (ALLGOALS Asm_simp_tac);
140 goal Arith.thy "i<j --> (EX k. j = Suc(i+k))";
141 by (induct_tac "j" 1);
142 by (Simp_tac 1);
143 by (blast_tac (claset() addSEs [less_SucE]
145 val lemma = result();
147 (* [| i<j;  !!x. j = Suc(i+x) ==> Q |] ==> Q *)
148 bind_thm ("less_natE", lemma RS mp RS exE);
150 goal Arith.thy "!!m. m<n --> (? k. n=Suc(m+k))";
151 by (induct_tac "n" 1);
152 by (ALLGOALS (simp_tac (simpset() addsimps [less_Suc_eq])));
153 by (blast_tac (claset() addSEs [less_SucE]
157 goal Arith.thy "n <= ((m + n)::nat)";
158 by (induct_tac "m" 1);
159 by (ALLGOALS Simp_tac);
160 by (etac le_trans 1);
161 by (rtac (lessI RS less_imp_le) 1);
164 goal Arith.thy "n <= ((n + m)::nat)";
172 (*"i <= j ==> i <= j+m"*)
175 (*"i <= j ==> i <= m+j"*)
178 (*"i < j ==> i < j+m"*)
181 (*"i < j ==> i < m+j"*)
184 goal Arith.thy "!!i. i+j < (k::nat) ==> i<k";
185 by (etac rev_mp 1);
186 by (induct_tac "j" 1);
187 by (ALLGOALS Asm_simp_tac);
188 by (blast_tac (claset() addDs [Suc_lessD]) 1);
191 goal Arith.thy "!!i::nat. ~ (i+j < i)";
192 by (rtac notI 1);
193 by (etac (add_lessD1 RS less_irrefl) 1);
196 goal Arith.thy "!!i::nat. ~ (j+i < i)";
201 goal Arith.thy "!!k::nat. m <= n ==> m <= n+k";
202 by (etac le_trans 1);
206 goal Arith.thy "!!k::nat. m < n ==> m < n+k";
207 by (etac less_le_trans 1);
211 goal Arith.thy "m+k<=n --> m<=(n::nat)";
212 by (induct_tac "k" 1);
213 by (ALLGOALS Asm_simp_tac);
214 by (blast_tac (claset() addDs [Suc_leD]) 1);
217 goal Arith.thy "!!n::nat. m+k<=n ==> k<=n";
222 goal Arith.thy "!!n::nat. m+k<=n ==> m<=n & k<=n";
224 bind_thm ("add_leE", result() RS conjE);
226 goal Arith.thy "!!k l::nat. [| k<l; m+l = k+n |] ==> m<n";
228 by (asm_full_simp_tac
231 by (etac subst 1);
236 (*** Monotonicity of Addition ***)
238 (*strict, in 1st argument*)
239 goal Arith.thy "!!i j k::nat. i < j ==> i + k < j + k";
240 by (induct_tac "k" 1);
241 by (ALLGOALS Asm_simp_tac);
244 (*strict, in both arguments*)
245 goal Arith.thy "!!i j k::nat. [|i < j; k < l|] ==> i + k < j + l";
246 by (rtac (add_less_mono1 RS less_trans) 1);
247 by (REPEAT (assume_tac 1));
248 by (induct_tac "j" 1);
249 by (ALLGOALS Asm_simp_tac);
252 (*A [clumsy] way of lifting < monotonicity to <= monotonicity *)
253 val [lt_mono,le] = goal Arith.thy
254      "[| !!i j::nat. i<j ==> f(i) < f(j);       \
255 \        i <= j                                 \
256 \     |] ==> f(i) <= (f(j)::nat)";
257 by (cut_facts_tac [le] 1);
258 by (asm_full_simp_tac (simpset() addsimps [le_eq_less_or_eq]) 1);
259 by (blast_tac (claset() addSIs [lt_mono]) 1);
260 qed "less_mono_imp_le_mono";
262 (*non-strict, in 1st argument*)
263 goal Arith.thy "!!i j k::nat. i<=j ==> i + k <= j + k";
264 by (res_inst_tac [("f", "%j. j+k")] less_mono_imp_le_mono 1);
266 by (assume_tac 1);
269 (*non-strict, in both arguments*)
270 goal Arith.thy "!!k l::nat. [|i<=j;  k<=l |] ==> i + k <= j + l";
271 by (etac (add_le_mono1 RS le_trans) 1);
273 (*j moves to the end because it is free while k, l are bound*)
278 (*** Multiplication ***)
280 (*right annihilation in product*)
281 qed_goal "mult_0_right" Arith.thy "m * 0 = 0"
282  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
284 (*right successor law for multiplication*)
285 qed_goal "mult_Suc_right" Arith.thy  "m * Suc(n) = m + (m * n)"
286  (fn _ => [induct_tac "m" 1,
291 goal Arith.thy "1 * n = n";
292 by (Asm_simp_tac 1);
293 qed "mult_1";
295 goal Arith.thy "n * 1 = n";
296 by (Asm_simp_tac 1);
297 qed "mult_1_right";
299 (*Commutative law for multiplication*)
300 qed_goal "mult_commute" Arith.thy "m * n = n * (m::nat)"
301  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
304 qed_goal "add_mult_distrib" Arith.thy "(m + n)*k = (m*k) + ((n*k)::nat)"
305  (fn _ => [induct_tac "m" 1,
308 qed_goal "add_mult_distrib2" Arith.thy "k*(m + n) = (k*m) + ((k*n)::nat)"
309  (fn _ => [induct_tac "m" 1,
312 (*Associative law for multiplication*)
313 qed_goal "mult_assoc" Arith.thy "(m * n) * k = m * ((n * k)::nat)"
314   (fn _ => [induct_tac "m" 1,
317 qed_goal "mult_left_commute" Arith.thy "x*(y*z) = y*((x*z)::nat)"
318  (fn _ => [rtac trans 1, rtac mult_commute 1, rtac trans 1,
319            rtac mult_assoc 1, rtac (mult_commute RS arg_cong) 1]);
321 val mult_ac = [mult_assoc,mult_commute,mult_left_commute];
323 goal Arith.thy "(m*n = 0) = (m=0 | n=0)";
324 by (induct_tac "m" 1);
325 by (induct_tac "n" 2);
326 by (ALLGOALS Asm_simp_tac);
327 qed "mult_is_0";
330 goal Arith.thy "!!m::nat. m <= m*m";
331 by (induct_tac "m" 1);
333 by (etac (le_add2 RSN (2,le_trans)) 1);
334 qed "le_square";
337 (*** Difference ***)
339 qed_goal "pred_Suc_diff" Arith.thy "pred(Suc m - n) = m - n"
340  (fn _ => [induct_tac "n" 1, ALLGOALS Asm_simp_tac]);
343 qed_goal "diff_self_eq_0" Arith.thy "m - m = 0"
344  (fn _ => [induct_tac "m" 1, ALLGOALS Asm_simp_tac]);
347 (*Addition is the inverse of subtraction: if n<=m then n+(m-n) = m. *)
348 goal Arith.thy "~ m<n --> n+(m-n) = (m::nat)";
349 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
350 by (ALLGOALS Asm_simp_tac);
353 goal Arith.thy "!!m. n<=m ==> n+(m-n) = (m::nat)";
357 goal Arith.thy "!!m. n<=m ==> (m-n)+n = (m::nat)";
362 Delsimps  [diff_Suc];
365 (*** More results about difference ***)
367 val [prem] = goal Arith.thy "n < Suc(m) ==> Suc(m)-n = Suc(m-n)";
368 by (rtac (prem RS rev_mp) 1);
369 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
370 by (ALLGOALS Asm_simp_tac);
371 qed "Suc_diff_n";
373 goal Arith.thy "m - n < Suc(m)";
374 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
375 by (etac less_SucE 3);
376 by (ALLGOALS (asm_simp_tac (simpset() addsimps [less_Suc_eq])));
377 qed "diff_less_Suc";
379 goal Arith.thy "!!m::nat. m - n <= m";
380 by (res_inst_tac [("m","m"), ("n","n")] diff_induct 1);
381 by (ALLGOALS Asm_simp_tac);
382 qed "diff_le_self";
385 goal Arith.thy "!!i::nat. i-j-k = i - (j+k)";
386 by (res_inst_tac [("m","i"),("n","j")] diff_induct 1);
387 by (ALLGOALS Asm_simp_tac);
388 qed "diff_diff_left";
390 (*This and the next few suggested by Florian Kammueller*)
391 goal Arith.thy "!!i::nat. i-j-k = i-k-j";
393 qed "diff_commute";
395 goal Arith.thy "!!i j k:: nat. k<=j --> j<=i --> i - (j - k) = i - j + k";
396 by (res_inst_tac [("m","i"),("n","j")] diff_induct 1);
397 by (ALLGOALS Asm_simp_tac);
398 by (asm_simp_tac
399     (simpset() addsimps [Suc_diff_n, le_imp_less_Suc, le_Suc_eq]) 1);
400 qed_spec_mp "diff_diff_right";
402 goal Arith.thy "!!i j k:: nat. k<=j --> (i + j) - k = i + (j - k)";
403 by (res_inst_tac [("m","j"),("n","k")] diff_induct 1);
404 by (ALLGOALS Asm_simp_tac);
407 goal Arith.thy "!!n::nat. (n+m) - n = m";
408 by (induct_tac "n" 1);
409 by (ALLGOALS Asm_simp_tac);
413 goal Arith.thy "!!n::nat.(m+n) - n = m";
418 goal Arith.thy "!!i j k::nat. i<=j ==> (j-i=k) = (j=k+i)";
419 by Safe_tac;
420 by (ALLGOALS Asm_simp_tac);
423 val [prem] = goal Arith.thy "m < Suc(n) ==> m-n = 0";
424 by (rtac (prem RS rev_mp) 1);
425 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
426 by (asm_simp_tac (simpset() addsimps [less_Suc_eq]) 1);
427 by (ALLGOALS Asm_simp_tac);
428 qed "less_imp_diff_is_0";
430 val prems = goal Arith.thy "m-n = 0  -->  n-m = 0  -->  m=n";
431 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
432 by (REPEAT(Simp_tac 1 THEN TRY(atac 1)));
433 qed_spec_mp "diffs0_imp_equal";
435 val [prem] = goal Arith.thy "m<n ==> 0<n-m";
436 by (rtac (prem RS rev_mp) 1);
437 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
438 by (ALLGOALS Asm_simp_tac);
439 qed "less_imp_diff_positive";
441 goal Arith.thy "Suc(m)-n = (if m<n then 0 else Suc(m-n))";
442 by (simp_tac (simpset() addsimps [less_imp_diff_is_0, not_less_eq, Suc_diff_n]
444 qed "if_Suc_diff_n";
446 goal Arith.thy "P(k) --> (!n. P(Suc(n))--> P(n)) --> P(k-i)";
447 by (res_inst_tac [("m","k"),("n","i")] diff_induct 1);
448 by (ALLGOALS (Clarify_tac THEN' Simp_tac THEN' TRY o Blast_tac));
449 qed "zero_induct_lemma";
451 val prems = goal Arith.thy "[| P(k);  !!n. P(Suc(n)) ==> P(n) |] ==> P(0)";
452 by (rtac (diff_self_eq_0 RS subst) 1);
453 by (rtac (zero_induct_lemma RS mp RS mp) 1);
454 by (REPEAT (ares_tac ([impI,allI]@prems) 1));
455 qed "zero_induct";
457 goal Arith.thy "!!k::nat. (k+m) - (k+n) = m - n";
458 by (induct_tac "k" 1);
459 by (ALLGOALS Asm_simp_tac);
460 qed "diff_cancel";
463 goal Arith.thy "!!m::nat. (m+k) - (n+k) = m - n";
466 qed "diff_cancel2";
469 (*From Clemens Ballarin*)
470 goal Arith.thy "!!n::nat. [| k<=n; n<=m |] ==> (m-k) - (n-k) = m-n";
471 by (subgoal_tac "k<=n --> n<=m --> (m-k) - (n-k) = m-n" 1);
472 by (Asm_full_simp_tac 1);
473 by (induct_tac "k" 1);
474 by (Simp_tac 1);
475 (* Induction step *)
476 by (subgoal_tac "Suc na <= m --> n <= m --> Suc na <= n --> \
477 \                Suc (m - Suc na) - Suc (n - Suc na) = m-n" 1);
478 by (Asm_full_simp_tac 1);
479 by (blast_tac (claset() addIs [le_trans]) 1);
480 by (auto_tac (claset() addIs [Suc_leD], simpset() delsimps [diff_Suc_Suc]));
481 by (asm_full_simp_tac (simpset() delsimps [Suc_less_eq]
482 		       addsimps [Suc_diff_n RS sym, le_eq_less_Suc]) 1);
483 qed "diff_right_cancel";
485 goal Arith.thy "!!n::nat. n - (n+m) = 0";
486 by (induct_tac "n" 1);
487 by (ALLGOALS Asm_simp_tac);
491 (** Difference distributes over multiplication **)
493 goal Arith.thy "!!m::nat. (m - n) * k = (m * k) - (n * k)";
494 by (res_inst_tac [("m","m"),("n","n")] diff_induct 1);
495 by (ALLGOALS Asm_simp_tac);
496 qed "diff_mult_distrib" ;
498 goal Arith.thy "!!m::nat. k * (m - n) = (k * m) - (k * n)";
499 val mult_commute_k = read_instantiate [("m","k")] mult_commute;
500 by (simp_tac (simpset() addsimps [diff_mult_distrib, mult_commute_k]) 1);
501 qed "diff_mult_distrib2" ;
502 (*NOT added as rewrites, since sometimes they are used from right-to-left*)
505 (*** Monotonicity of Multiplication ***)
507 goal Arith.thy "!!i::nat. i<=j ==> i*k<=j*k";
508 by (induct_tac "k" 1);
510 qed "mult_le_mono1";
512 (*<=monotonicity, BOTH arguments*)
513 goal Arith.thy "!!i::nat. [| i<=j; k<=l |] ==> i*k<=j*l";
514 by (etac (mult_le_mono1 RS le_trans) 1);
515 by (rtac le_trans 1);
516 by (stac mult_commute 2);
517 by (etac mult_le_mono1 2);
518 by (simp_tac (simpset() addsimps [mult_commute]) 1);
519 qed "mult_le_mono";
521 (*strict, in 1st argument; proof is by induction on k>0*)
522 goal Arith.thy "!!i::nat. [| i<j; 0<k |] ==> k*i < k*j";
523 by (eres_inst_tac [("i","0")] less_natE 1);
524 by (Asm_simp_tac 1);
525 by (induct_tac "x" 1);
527 qed "mult_less_mono2";
529 goal Arith.thy "!!i::nat. [| i<j; 0<k |] ==> i*k < j*k";
530 by (dtac mult_less_mono2 1);
531 by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [mult_commute])));
532 qed "mult_less_mono1";
534 goal Arith.thy "(0 < m*n) = (0<m & 0<n)";
535 by (induct_tac "m" 1);
536 by (induct_tac "n" 2);
537 by (ALLGOALS Asm_simp_tac);
538 qed "zero_less_mult_iff";
540 goal Arith.thy "(m*n = 1) = (m=1 & n=1)";
541 by (induct_tac "m" 1);
542 by (Simp_tac 1);
543 by (induct_tac "n" 1);
544 by (Simp_tac 1);
545 by (fast_tac (claset() addss simpset()) 1);
546 qed "mult_eq_1_iff";
548 goal Arith.thy "!!k. 0<k ==> (m*k < n*k) = (m<n)";
549 by (safe_tac (claset() addSIs [mult_less_mono1]));
550 by (cut_facts_tac [less_linear] 1);
552 qed "mult_less_cancel2";
554 goal Arith.thy "!!k. 0<k ==> (k*m < k*n) = (m<n)";
555 by (dtac mult_less_cancel2 1);
556 by (asm_full_simp_tac (simpset() addsimps [mult_commute]) 1);
557 qed "mult_less_cancel1";
560 goal Arith.thy "!!k. 0<k ==> (m*k = n*k) = (m=n)";
561 by (cut_facts_tac [less_linear] 1);
562 by Safe_tac;
563 by (assume_tac 2);
564 by (ALLGOALS (dtac mult_less_mono1 THEN' assume_tac));
565 by (ALLGOALS Asm_full_simp_tac);
566 qed "mult_cancel2";
568 goal Arith.thy "!!k. 0<k ==> (k*m = k*n) = (m=n)";
569 by (dtac mult_cancel2 1);
570 by (asm_full_simp_tac (simpset() addsimps [mult_commute]) 1);
571 qed "mult_cancel1";
575 (** Lemma for gcd **)
577 goal Arith.thy "!!m n. m = m*n ==> n=1 | m=0";
578 by (dtac sym 1);
579 by (rtac disjCI 1);
580 by (rtac nat_less_cases 1 THEN assume_tac 2);
582 by (best_tac (claset() addDs [mult_less_mono2]
584 qed "mult_eq_self_implies_10";
587 (*** Subtraction laws -- from Clemens Ballarin ***)
589 goal Arith.thy "!! a b c::nat. [| a < b; c <= a |] ==> a-c < b-c";
590 by (subgoal_tac "c+(a-c) < c+(b-c)" 1);
591 by (Full_simp_tac 1);
592 by (subgoal_tac "c <= b" 1);
593 by (blast_tac (claset() addIs [less_imp_le, le_trans]) 2);
594 by (Asm_simp_tac 1);
595 qed "diff_less_mono";
597 goal Arith.thy "!! a b c::nat. a+b < c ==> a < c-b";
598 by (dtac diff_less_mono 1);
600 by (Asm_full_simp_tac 1);
603 goal Arith.thy "!! n. n <= m ==> Suc m - n = Suc (m - n)";
604 by (rtac Suc_diff_n 1);
605 by (asm_full_simp_tac (simpset() addsimps [le_eq_less_Suc]) 1);
606 qed "Suc_diff_le";
608 goal Arith.thy "!! n. Suc i <= n ==> Suc (n - Suc i) = n - i";
609 by (asm_full_simp_tac
610     (simpset() addsimps [Suc_diff_n RS sym, le_eq_less_Suc]) 1);
611 qed "Suc_diff_Suc";
613 goal Arith.thy "!! i::nat. i <= n ==> n - (n - i) = i";
614 by (etac rev_mp 1);
615 by (res_inst_tac [("m","n"),("n","i")] diff_induct 1);
616 by (ALLGOALS (asm_simp_tac  (simpset() addsimps [Suc_diff_le])));
617 qed "diff_diff_cancel";
620 goal Arith.thy "!!k::nat. k <= n ==> m <= n + m - k";
621 by (etac rev_mp 1);
622 by (res_inst_tac [("m", "k"), ("n", "n")] diff_induct 1);
623 by (Simp_tac 1);
625 by (Simp_tac 1);
629 (** (Anti)Monotonicity of subtraction -- by Stefan Merz **)
631 (* Monotonicity of subtraction in first argument *)
632 goal Arith.thy "!!n::nat. m<=n --> (m-l) <= (n-l)";
633 by (induct_tac "n" 1);
634 by (Simp_tac 1);
635 by (simp_tac (simpset() addsimps [le_Suc_eq]) 1);
636 by (rtac impI 1);
637 by (etac impE 1);
638 by (atac 1);
639 by (etac le_trans 1);
640 by (res_inst_tac [("m1","n")] (pred_Suc_diff RS subst) 1);
641 by (rtac pred_le 1);
642 qed_spec_mp "diff_le_mono";
644 goal Arith.thy "!!n::nat. m<=n ==> (l-n) <= (l-m)";
645 by (induct_tac "l" 1);
646 by (Simp_tac 1);
647 by (case_tac "n <= l" 1);
648 by (subgoal_tac "m <= l" 1);
649 by (asm_simp_tac (simpset() addsimps [Suc_diff_le]) 1);
650 by (fast_tac (claset() addEs [le_trans]) 1);
651 by (dtac not_leE 1);
652 by (asm_simp_tac (simpset() addsimps [if_Suc_diff_n]) 1);
653 qed_spec_mp "diff_le_mono2";