src/HOL/Integ/int_arith1.ML
author nipkow
Mon Dec 18 14:59:05 2000 +0100 (2000-12-18)
changeset 10693 9e4a0e84d0d6
parent 10574 8f98f0301d67
child 10713 69c9fc1d11f2
permissions -rw-r--r--
moved mk_bin from Numerals to HOLogic
first steps towards rational lin arith
     1 (*  Title:      HOL/Integ/int_arith1.ML
     2     ID:         $Id$
     3     Authors:    Larry Paulson and Tobias Nipkow
     4 
     5 Simprocs and decision procedure for linear arithmetic.
     6 *)
     7 
     8 (*** Simprocs for numeric literals ***)
     9 
    10 (** Combining of literal coefficients in sums of products **)
    11 
    12 Goal "(x < y) = (x-y < (#0::int))";
    13 by (simp_tac (simpset() addsimps zcompare_rls) 1);
    14 qed "zless_iff_zdiff_zless_0";
    15 
    16 Goal "(x = y) = (x-y = (#0::int))";
    17 by (simp_tac (simpset() addsimps zcompare_rls) 1);
    18 qed "eq_iff_zdiff_eq_0";
    19 
    20 Goal "(x <= y) = (x-y <= (#0::int))";
    21 by (simp_tac (simpset() addsimps zcompare_rls) 1);
    22 qed "zle_iff_zdiff_zle_0";
    23 
    24 
    25 (** For combine_numerals **)
    26 
    27 Goal "i*u + (j*u + k) = (i+j)*u + (k::int)";
    28 by (asm_simp_tac (simpset() addsimps [zadd_zmult_distrib]) 1);
    29 qed "left_zadd_zmult_distrib";
    30 
    31 
    32 (** For cancel_numerals **)
    33 
    34 val rel_iff_rel_0_rls = map (inst "y" "?u+?v")
    35                           [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
    36 			   zle_iff_zdiff_zle_0] @
    37 		        map (inst "y" "n")
    38                           [zless_iff_zdiff_zless_0, eq_iff_zdiff_eq_0, 
    39 			   zle_iff_zdiff_zle_0];
    40 
    41 Goal "!!i::int. (i*u + m = j*u + n) = ((i-j)*u + m = n)";
    42 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
    43 		                     zadd_ac@rel_iff_rel_0_rls) 1);
    44 qed "eq_add_iff1";
    45 
    46 Goal "!!i::int. (i*u + m = j*u + n) = (m = (j-i)*u + n)";
    47 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
    48                                      zadd_ac@rel_iff_rel_0_rls) 1);
    49 qed "eq_add_iff2";
    50 
    51 Goal "!!i::int. (i*u + m < j*u + n) = ((i-j)*u + m < n)";
    52 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
    53                                      zadd_ac@rel_iff_rel_0_rls) 1);
    54 qed "less_add_iff1";
    55 
    56 Goal "!!i::int. (i*u + m < j*u + n) = (m < (j-i)*u + n)";
    57 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
    58                                      zadd_ac@rel_iff_rel_0_rls) 1);
    59 qed "less_add_iff2";
    60 
    61 Goal "!!i::int. (i*u + m <= j*u + n) = ((i-j)*u + m <= n)";
    62 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]@
    63                                      zadd_ac@rel_iff_rel_0_rls) 1);
    64 qed "le_add_iff1";
    65 
    66 Goal "!!i::int. (i*u + m <= j*u + n) = (m <= (j-i)*u + n)";
    67 by (asm_simp_tac (simpset() addsimps [zdiff_def, zadd_zmult_distrib]
    68                                      @zadd_ac@rel_iff_rel_0_rls) 1);
    69 qed "le_add_iff2";
    70 
    71 (*To tidy up the result of a simproc.  Only the RHS will be simplified.*)
    72 Goal "u = u' ==> (t==u) == (t==u')";
    73 by Auto_tac;
    74 qed "eq_cong2";
    75 
    76 
    77 structure Int_Numeral_Simprocs =
    78 struct
    79 
    80 (*Utilities*)
    81 
    82 fun mk_numeral n = HOLogic.number_of_const HOLogic.intT $ HOLogic.mk_bin n;
    83 
    84 (*Decodes a binary INTEGER*)
    85 fun dest_numeral (Const("Numeral.number_of", _) $ w) = 
    86      (NumeralSyntax.dest_bin w
    87       handle Match => raise TERM("Int_Numeral_Simprocs.dest_numeral:1", [w]))
    88   | dest_numeral t = raise TERM("Int_Numeral_Simprocs.dest_numeral:2", [t]);
    89 
    90 fun find_first_numeral past (t::terms) =
    91 	((dest_numeral t, rev past @ terms)
    92 	 handle TERM _ => find_first_numeral (t::past) terms)
    93   | find_first_numeral past [] = raise TERM("find_first_numeral", []);
    94 
    95 val zero = mk_numeral 0;
    96 val mk_plus = HOLogic.mk_binop "op +";
    97 
    98 val uminus_const = Const ("uminus", HOLogic.intT --> HOLogic.intT);
    99 
   100 (*Thus mk_sum[t] yields t+#0; longer sums don't have a trailing zero*)
   101 fun mk_sum []        = zero
   102   | mk_sum [t,u]     = mk_plus (t, u)
   103   | mk_sum (t :: ts) = mk_plus (t, mk_sum ts);
   104 
   105 (*this version ALWAYS includes a trailing zero*)
   106 fun long_mk_sum []        = zero
   107   | long_mk_sum (t :: ts) = mk_plus (t, mk_sum ts);
   108 
   109 val dest_plus = HOLogic.dest_bin "op +" HOLogic.intT;
   110 
   111 (*decompose additions AND subtractions as a sum*)
   112 fun dest_summing (pos, Const ("op +", _) $ t $ u, ts) =
   113         dest_summing (pos, t, dest_summing (pos, u, ts))
   114   | dest_summing (pos, Const ("op -", _) $ t $ u, ts) =
   115         dest_summing (pos, t, dest_summing (not pos, u, ts))
   116   | dest_summing (pos, t, ts) =
   117 	if pos then t::ts else uminus_const$t :: ts;
   118 
   119 fun dest_sum t = dest_summing (true, t, []);
   120 
   121 val mk_diff = HOLogic.mk_binop "op -";
   122 val dest_diff = HOLogic.dest_bin "op -" HOLogic.intT;
   123 
   124 val one = mk_numeral 1;
   125 val mk_times = HOLogic.mk_binop "op *";
   126 
   127 fun mk_prod [] = one
   128   | mk_prod [t] = t
   129   | mk_prod (t :: ts) = if t = one then mk_prod ts
   130                         else mk_times (t, mk_prod ts);
   131 
   132 val dest_times = HOLogic.dest_bin "op *" HOLogic.intT;
   133 
   134 fun dest_prod t =
   135       let val (t,u) = dest_times t 
   136       in  dest_prod t @ dest_prod u  end
   137       handle TERM _ => [t];
   138 
   139 (*DON'T do the obvious simplifications; that would create special cases*) 
   140 fun mk_coeff (k, ts) = mk_times (mk_numeral k, ts);
   141 
   142 (*Express t as a product of (possibly) a numeral with other sorted terms*)
   143 fun dest_coeff sign (Const ("uminus", _) $ t) = dest_coeff (~sign) t
   144   | dest_coeff sign t =
   145     let val ts = sort Term.term_ord (dest_prod t)
   146 	val (n, ts') = find_first_numeral [] ts
   147                           handle TERM _ => (1, ts)
   148     in (sign*n, mk_prod ts') end;
   149 
   150 (*Find first coefficient-term THAT MATCHES u*)
   151 fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
   152   | find_first_coeff past u (t::terms) =
   153 	let val (n,u') = dest_coeff 1 t
   154 	in  if u aconv u' then (n, rev past @ terms)
   155 			  else find_first_coeff (t::past) u terms
   156 	end
   157 	handle TERM _ => find_first_coeff (t::past) u terms;
   158 
   159 
   160 (*Simplify #1*n and n*#1 to n*)
   161 val add_0s = [zadd_0, zadd_0_right];
   162 val mult_1s = [zmult_1, zmult_1_right, zmult_minus1, zmult_minus1_right];
   163 
   164 (*To perform binary arithmetic*)
   165 val bin_simps = [add_number_of_left] @ bin_arith_simps @ bin_rel_simps;
   166 
   167 (*To evaluate binary negations of coefficients*)
   168 val zminus_simps = NCons_simps @
   169                    [number_of_minus RS sym, 
   170 		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
   171 		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
   172 
   173 (*To let us treat subtraction as addition*)
   174 val diff_simps = [zdiff_def, zminus_zadd_distrib, zminus_zminus];
   175 
   176 (*Apply the given rewrite (if present) just once*)
   177 fun trans_tac None      = all_tac
   178   | trans_tac (Some th) = ALLGOALS (rtac (th RS trans));
   179 
   180 fun prove_conv name tacs sg (hyps: thm list) (t,u) =
   181   if t aconv u then None
   182   else
   183   let val ct = cterm_of sg (HOLogic.mk_Trueprop (HOLogic.mk_eq (t, u)))
   184   in Some
   185      (prove_goalw_cterm [] ct (K tacs)
   186       handle ERROR => error 
   187 	  ("The error(s) above occurred while trying to prove " ^
   188 	   string_of_cterm ct ^ "\nInternal failure of simproc " ^ name))
   189   end;
   190 
   191 (*version without the hyps argument*)
   192 fun prove_conv_nohyps name tacs sg = prove_conv name tacs sg [];
   193 
   194 fun simplify_meta_eq rules =
   195     mk_meta_eq o
   196     simplify (HOL_basic_ss addeqcongs[eq_cong2] addsimps rules)
   197 
   198 fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
   199 fun prep_pat s = Thm.read_cterm (Theory.sign_of (the_context())) (s, HOLogic.termT);
   200 val prep_pats = map prep_pat;
   201 
   202 structure CancelNumeralsCommon =
   203   struct
   204   val mk_sum    	= mk_sum
   205   val dest_sum		= dest_sum
   206   val mk_coeff		= mk_coeff
   207   val dest_coeff	= dest_coeff 1
   208   val find_first_coeff	= find_first_coeff []
   209   val trans_tac         = trans_tac
   210   val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   211                                                      zminus_simps@zadd_ac))
   212                  THEN ALLGOALS
   213                     (simp_tac (HOL_ss addsimps [zmult_zminus_right RS sym]@
   214                                                bin_simps@zadd_ac@zmult_ac))
   215   val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   216   val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
   217   end;
   218 
   219 
   220 structure EqCancelNumerals = CancelNumeralsFun
   221  (open CancelNumeralsCommon
   222   val prove_conv = prove_conv "inteq_cancel_numerals"
   223   val mk_bal   = HOLogic.mk_eq
   224   val dest_bal = HOLogic.dest_bin "op =" HOLogic.intT
   225   val bal_add1 = eq_add_iff1 RS trans
   226   val bal_add2 = eq_add_iff2 RS trans
   227 );
   228 
   229 structure LessCancelNumerals = CancelNumeralsFun
   230  (open CancelNumeralsCommon
   231   val prove_conv = prove_conv "intless_cancel_numerals"
   232   val mk_bal   = HOLogic.mk_binrel "op <"
   233   val dest_bal = HOLogic.dest_bin "op <" HOLogic.intT
   234   val bal_add1 = less_add_iff1 RS trans
   235   val bal_add2 = less_add_iff2 RS trans
   236 );
   237 
   238 structure LeCancelNumerals = CancelNumeralsFun
   239  (open CancelNumeralsCommon
   240   val prove_conv = prove_conv "intle_cancel_numerals"
   241   val mk_bal   = HOLogic.mk_binrel "op <="
   242   val dest_bal = HOLogic.dest_bin "op <=" HOLogic.intT
   243   val bal_add1 = le_add_iff1 RS trans
   244   val bal_add2 = le_add_iff2 RS trans
   245 );
   246 
   247 val cancel_numerals = 
   248   map prep_simproc
   249    [("inteq_cancel_numerals",
   250      prep_pats ["(l::int) + m = n", "(l::int) = m + n", 
   251 		"(l::int) - m = n", "(l::int) = m - n", 
   252 		"(l::int) * m = n", "(l::int) = m * n"], 
   253      EqCancelNumerals.proc),
   254     ("intless_cancel_numerals", 
   255      prep_pats ["(l::int) + m < n", "(l::int) < m + n", 
   256 		"(l::int) - m < n", "(l::int) < m - n", 
   257 		"(l::int) * m < n", "(l::int) < m * n"], 
   258      LessCancelNumerals.proc),
   259     ("intle_cancel_numerals", 
   260      prep_pats ["(l::int) + m <= n", "(l::int) <= m + n", 
   261 		"(l::int) - m <= n", "(l::int) <= m - n", 
   262 		"(l::int) * m <= n", "(l::int) <= m * n"], 
   263      LeCancelNumerals.proc)];
   264 
   265 
   266 structure CombineNumeralsData =
   267   struct
   268   val add		= op + : int*int -> int 
   269   val mk_sum    	= long_mk_sum    (*to work for e.g. #2*x + #3*x *)
   270   val dest_sum		= dest_sum
   271   val mk_coeff		= mk_coeff
   272   val dest_coeff	= dest_coeff 1
   273   val left_distrib	= left_zadd_zmult_distrib RS trans
   274   val prove_conv        = prove_conv_nohyps "int_combine_numerals"
   275   val trans_tac          = trans_tac
   276   val norm_tac = ALLGOALS
   277                    (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   278                                               zminus_simps@zadd_ac))
   279                  THEN ALLGOALS
   280                     (simp_tac (HOL_ss addsimps [zmult_zminus_right RS sym]@
   281                                                bin_simps@zadd_ac@zmult_ac))
   282   val numeral_simp_tac	= ALLGOALS 
   283                     (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   284   val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
   285   end;
   286 
   287 structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
   288   
   289 val combine_numerals = 
   290     prep_simproc ("int_combine_numerals",
   291 		  prep_pats ["(i::int) + j", "(i::int) - j"],
   292 		  CombineNumerals.proc);
   293 
   294 end;
   295 
   296 Addsimprocs Int_Numeral_Simprocs.cancel_numerals;
   297 Addsimprocs [Int_Numeral_Simprocs.combine_numerals];
   298 
   299 (*The Abel_Cancel simprocs are now obsolete*)
   300 Delsimprocs [Int_Cancel.sum_conv, Int_Cancel.rel_conv];
   301 
   302 (*examples:
   303 print_depth 22;
   304 set timing;
   305 set trace_simp;
   306 fun test s = (Goal s; by (Simp_tac 1)); 
   307 
   308 test "l + #2 + #2 + #2 + (l + #2) + (oo + #2) = (uu::int)";
   309 
   310 test "#2*u = (u::int)";
   311 test "(i + j + #12 + (k::int)) - #15 = y";
   312 test "(i + j + #12 + (k::int)) - #5 = y";
   313 
   314 test "y - b < (b::int)";
   315 test "y - (#3*b + c) < (b::int) - #2*c";
   316 
   317 test "(#2*x - (u*v) + y) - v*#3*u = (w::int)";
   318 test "(#2*x*u*v + (u*v)*#4 + y) - v*u*#4 = (w::int)";
   319 test "(#2*x*u*v + (u*v)*#4 + y) - v*u = (w::int)";
   320 test "u*v - (x*u*v + (u*v)*#4 + y) = (w::int)";
   321 
   322 test "(i + j + #12 + (k::int)) = u + #15 + y";
   323 test "(i + j*#2 + #12 + (k::int)) = j + #5 + y";
   324 
   325 test "#2*y + #3*z + #6*w + #2*y + #3*z + #2*u = #2*y' + #3*z' + #6*w' + #2*y' + #3*z' + u + (vv::int)";
   326 
   327 test "a + -(b+c) + b = (d::int)";
   328 test "a + -(b+c) - b = (d::int)";
   329 
   330 (*negative numerals*)
   331 test "(i + j + #-2 + (k::int)) - (u + #5 + y) = zz";
   332 test "(i + j + #-3 + (k::int)) < u + #5 + y";
   333 test "(i + j + #3 + (k::int)) < u + #-6 + y";
   334 test "(i + j + #-12 + (k::int)) - #15 = y";
   335 test "(i + j + #12 + (k::int)) - #-15 = y";
   336 test "(i + j + #-12 + (k::int)) - #-15 = y";
   337 *)
   338 
   339 
   340 (** Constant folding for integer plus and times **)
   341 
   342 (*We do not need
   343     structure Nat_Plus_Assoc = Assoc_Fold (Nat_Plus_Assoc_Data);
   344     structure Int_Plus_Assoc = Assoc_Fold (Int_Plus_Assoc_Data);
   345   because combine_numerals does the same thing*)
   346 
   347 structure Int_Times_Assoc_Data : ASSOC_FOLD_DATA =
   348 struct
   349   val ss		= HOL_ss
   350   val eq_reflection	= eq_reflection
   351   val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
   352   val T	     = HOLogic.intT
   353   val plus   = Const ("op *", [HOLogic.intT,HOLogic.intT] ---> HOLogic.intT);
   354   val add_ac = zmult_ac
   355 end;
   356 
   357 structure Int_Times_Assoc = Assoc_Fold (Int_Times_Assoc_Data);
   358 
   359 Addsimprocs [Int_Times_Assoc.conv];
   360 
   361 
   362 (** The same for the naturals **)
   363 
   364 structure Nat_Times_Assoc_Data : ASSOC_FOLD_DATA =
   365 struct
   366   val ss		= HOL_ss
   367   val eq_reflection	= eq_reflection
   368   val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
   369   val T	     = HOLogic.natT
   370   val plus   = Const ("op *", [HOLogic.natT,HOLogic.natT] ---> HOLogic.natT);
   371   val add_ac = mult_ac
   372 end;
   373 
   374 structure Nat_Times_Assoc = Assoc_Fold (Nat_Times_Assoc_Data);
   375 
   376 Addsimprocs [Nat_Times_Assoc.conv];
   377 
   378 
   379 (*** decision procedure for linear arithmetic ***)
   380 
   381 (*---------------------------------------------------------------------------*)
   382 (* Linear arithmetic                                                         *)
   383 (*---------------------------------------------------------------------------*)
   384 
   385 (*
   386 Instantiation of the generic linear arithmetic package for int.
   387 *)
   388 
   389 (* Update parameters of arithmetic prover *)
   390 local
   391 
   392 (* reduce contradictory <= to False *)
   393 val add_rules = simp_thms @ bin_arith_simps @ bin_rel_simps @
   394                 [zadd_0, zadd_0_right, zdiff_def,
   395 		 zadd_zminus_inverse, zadd_zminus_inverse2, 
   396 		 zmult_0, zmult_0_right, 
   397 		 zmult_1, zmult_1_right, 
   398 		 zmult_minus1, zmult_minus1_right,
   399 		 zminus_zadd_distrib, zminus_zminus,
   400                  int_0, zadd_int RS sym, int_Suc];
   401 
   402 val simprocs = [Int_Times_Assoc.conv, Int_Numeral_Simprocs.combine_numerals]@
   403                Int_Numeral_Simprocs.cancel_numerals;
   404 
   405 val add_mono_thms_int =
   406   map (fn s => prove_goal (the_context ()) s
   407                  (fn prems => [cut_facts_tac prems 1,
   408                       asm_simp_tac (simpset() addsimps [zadd_zle_mono]) 1]))
   409     ["(i <= j) & (k <= l) ==> i + k <= j + (l::int)",
   410      "(i  = j) & (k <= l) ==> i + k <= j + (l::int)",
   411      "(i <= j) & (k  = l) ==> i + k <= j + (l::int)",
   412      "(i  = j) & (k  = l) ==> i + k  = j + (l::int)"
   413     ];
   414 
   415 in
   416 
   417 val int_arith_setup =
   418  [Fast_Arith.map_data (fn {add_mono_thms, mult_mono_thms, inj_thms, lessD, simpset} =>
   419    {add_mono_thms = add_mono_thms @ add_mono_thms_int,
   420     mult_mono_thms = mult_mono_thms,
   421     inj_thms = [zle_int RS iffD2,int_int_eq RS iffD2] @ inj_thms,
   422     lessD = lessD @ [add1_zle_eq RS iffD2],
   423     simpset = simpset addsimps add_rules
   424                       addsimprocs simprocs
   425                       addcongs [if_weak_cong]}),
   426   arith_inj_const ("IntDef.int", HOLogic.natT --> Type("IntDef.int",[])),
   427   arith_discrete ("IntDef.int", true)];
   428 
   429 end;
   430 
   431 let
   432 val int_arith_simproc_pats =
   433   map (fn s => Thm.read_cterm (Theory.sign_of (the_context())) (s, HOLogic.boolT))
   434       ["(m::int) < n","(m::int) <= n", "(m::int) = n"];
   435 
   436 val fast_int_arith_simproc = mk_simproc
   437   "fast_int_arith" int_arith_simproc_pats Fast_Arith.lin_arith_prover;
   438 in
   439 Addsimprocs [fast_int_arith_simproc]
   440 end;
   441 
   442 (* Some test data
   443 Goal "!!a::int. [| a <= b; c <= d; x+y<z |] ==> a+c <= b+d";
   444 by (fast_arith_tac 1);
   445 Goal "!!a::int. [| a < b; c < d |] ==> a-d+ #2 <= b+(-c)";
   446 by (fast_arith_tac 1);
   447 Goal "!!a::int. [| a < b; c < d |] ==> a+c+ #1 < b+d";
   448 by (fast_arith_tac 1);
   449 Goal "!!a::int. [| a <= b; b+b <= c |] ==> a+a <= c";
   450 by (fast_arith_tac 1);
   451 Goal "!!a::int. [| a+b <= i+j; a<=b; i<=j |] \
   452 \     ==> a+a <= j+j";
   453 by (fast_arith_tac 1);
   454 Goal "!!a::int. [| a+b < i+j; a<b; i<j |] \
   455 \     ==> a+a - - #-1 < j+j - #3";
   456 by (fast_arith_tac 1);
   457 Goal "!!a::int. a+b+c <= i+j+k & a<=b & b<=c & i<=j & j<=k --> a+a+a <= k+k+k";
   458 by (arith_tac 1);
   459 Goal "!!a::int. [| a+b+c+d <= i+j+k+l; a<=b; b<=c; c<=d; i<=j; j<=k; k<=l |] \
   460 \     ==> a <= l";
   461 by (fast_arith_tac 1);
   462 Goal "!!a::int. [| a+b+c+d <= i+j+k+l; a<=b; b<=c; c<=d; i<=j; j<=k; k<=l |] \
   463 \     ==> a+a+a+a <= l+l+l+l";
   464 by (fast_arith_tac 1);
   465 Goal "!!a::int. [| a+b+c+d <= i+j+k+l; a<=b; b<=c; c<=d; i<=j; j<=k; k<=l |] \
   466 \     ==> a+a+a+a+a <= l+l+l+l+i";
   467 by (fast_arith_tac 1);
   468 Goal "!!a::int. [| a+b+c+d <= i+j+k+l; a<=b; b<=c; c<=d; i<=j; j<=k; k<=l |] \
   469 \     ==> a+a+a+a+a+a <= l+l+l+l+i+l";
   470 by (fast_arith_tac 1);
   471 Goal "!!a::int. [| a+b+c+d <= i+j+k+l; a<=b; b<=c; c<=d; i<=j; j<=k; k<=l |] \
   472 \     ==> #6*a <= #5*l+i";
   473 by (fast_arith_tac 1);
   474 *)