src/HOL/Integ/int_arith1.ML
author nipkow
Fri Dec 01 19:53:29 2000 +0100 (2000-12-01)
changeset 10574 8f98f0301d67
parent 9571 c869d1886a32
child 10693 9e4a0e84d0d6
permissions -rw-r--r--
Linear arithmetic now copes with mixed nat/int formulae.
     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 $ 
    83                    NumeralSyntax.mk_bin n;
    84 
    85 (*Decodes a binary INTEGER*)
    86 fun dest_numeral (Const("Numeral.number_of", _) $ w) = 
    87      (NumeralSyntax.dest_bin w
    88       handle Match => raise TERM("Int_Numeral_Simprocs.dest_numeral:1", [w]))
    89   | dest_numeral t = raise TERM("Int_Numeral_Simprocs.dest_numeral:2", [t]);
    90 
    91 fun find_first_numeral past (t::terms) =
    92 	((dest_numeral t, rev past @ terms)
    93 	 handle TERM _ => find_first_numeral (t::past) terms)
    94   | find_first_numeral past [] = raise TERM("find_first_numeral", []);
    95 
    96 val zero = mk_numeral 0;
    97 val mk_plus = HOLogic.mk_binop "op +";
    98 
    99 val uminus_const = Const ("uminus", HOLogic.intT --> HOLogic.intT);
   100 
   101 (*Thus mk_sum[t] yields t+#0; longer sums don't have a trailing zero*)
   102 fun mk_sum []        = zero
   103   | mk_sum [t,u]     = mk_plus (t, u)
   104   | mk_sum (t :: ts) = mk_plus (t, mk_sum ts);
   105 
   106 (*this version ALWAYS includes a trailing zero*)
   107 fun long_mk_sum []        = zero
   108   | long_mk_sum (t :: ts) = mk_plus (t, mk_sum ts);
   109 
   110 val dest_plus = HOLogic.dest_bin "op +" HOLogic.intT;
   111 
   112 (*decompose additions AND subtractions as a sum*)
   113 fun dest_summing (pos, Const ("op +", _) $ t $ u, ts) =
   114         dest_summing (pos, t, dest_summing (pos, u, ts))
   115   | dest_summing (pos, Const ("op -", _) $ t $ u, ts) =
   116         dest_summing (pos, t, dest_summing (not pos, u, ts))
   117   | dest_summing (pos, t, ts) =
   118 	if pos then t::ts else uminus_const$t :: ts;
   119 
   120 fun dest_sum t = dest_summing (true, t, []);
   121 
   122 val mk_diff = HOLogic.mk_binop "op -";
   123 val dest_diff = HOLogic.dest_bin "op -" HOLogic.intT;
   124 
   125 val one = mk_numeral 1;
   126 val mk_times = HOLogic.mk_binop "op *";
   127 
   128 fun mk_prod [] = one
   129   | mk_prod [t] = t
   130   | mk_prod (t :: ts) = if t = one then mk_prod ts
   131                         else mk_times (t, mk_prod ts);
   132 
   133 val dest_times = HOLogic.dest_bin "op *" HOLogic.intT;
   134 
   135 fun dest_prod t =
   136       let val (t,u) = dest_times t 
   137       in  dest_prod t @ dest_prod u  end
   138       handle TERM _ => [t];
   139 
   140 (*DON'T do the obvious simplifications; that would create special cases*) 
   141 fun mk_coeff (k, ts) = mk_times (mk_numeral k, ts);
   142 
   143 (*Express t as a product of (possibly) a numeral with other sorted terms*)
   144 fun dest_coeff sign (Const ("uminus", _) $ t) = dest_coeff (~sign) t
   145   | dest_coeff sign t =
   146     let val ts = sort Term.term_ord (dest_prod t)
   147 	val (n, ts') = find_first_numeral [] ts
   148                           handle TERM _ => (1, ts)
   149     in (sign*n, mk_prod ts') end;
   150 
   151 (*Find first coefficient-term THAT MATCHES u*)
   152 fun find_first_coeff past u [] = raise TERM("find_first_coeff", []) 
   153   | find_first_coeff past u (t::terms) =
   154 	let val (n,u') = dest_coeff 1 t
   155 	in  if u aconv u' then (n, rev past @ terms)
   156 			  else find_first_coeff (t::past) u terms
   157 	end
   158 	handle TERM _ => find_first_coeff (t::past) u terms;
   159 
   160 
   161 (*Simplify #1*n and n*#1 to n*)
   162 val add_0s = [zadd_0, zadd_0_right];
   163 val mult_1s = [zmult_1, zmult_1_right, zmult_minus1, zmult_minus1_right];
   164 
   165 (*To perform binary arithmetic*)
   166 val bin_simps = [add_number_of_left] @ bin_arith_simps @ bin_rel_simps;
   167 
   168 (*To evaluate binary negations of coefficients*)
   169 val zminus_simps = NCons_simps @
   170                    [number_of_minus RS sym, 
   171 		    bin_minus_1, bin_minus_0, bin_minus_Pls, bin_minus_Min,
   172 		    bin_pred_1, bin_pred_0, bin_pred_Pls, bin_pred_Min];
   173 
   174 (*To let us treat subtraction as addition*)
   175 val diff_simps = [zdiff_def, zminus_zadd_distrib, zminus_zminus];
   176 
   177 (*Apply the given rewrite (if present) just once*)
   178 fun trans_tac None      = all_tac
   179   | trans_tac (Some th) = ALLGOALS (rtac (th RS trans));
   180 
   181 fun prove_conv name tacs sg (hyps: thm list) (t,u) =
   182   if t aconv u then None
   183   else
   184   let val ct = cterm_of sg (HOLogic.mk_Trueprop (HOLogic.mk_eq (t, u)))
   185   in Some
   186      (prove_goalw_cterm [] ct (K tacs)
   187       handle ERROR => error 
   188 	  ("The error(s) above occurred while trying to prove " ^
   189 	   string_of_cterm ct ^ "\nInternal failure of simproc " ^ name))
   190   end;
   191 
   192 (*version without the hyps argument*)
   193 fun prove_conv_nohyps name tacs sg = prove_conv name tacs sg [];
   194 
   195 fun simplify_meta_eq rules =
   196     mk_meta_eq o
   197     simplify (HOL_basic_ss addeqcongs[eq_cong2] addsimps rules)
   198 
   199 fun prep_simproc (name, pats, proc) = Simplifier.mk_simproc name pats proc;
   200 fun prep_pat s = Thm.read_cterm (Theory.sign_of (the_context())) (s, HOLogic.termT);
   201 val prep_pats = map prep_pat;
   202 
   203 structure CancelNumeralsCommon =
   204   struct
   205   val mk_sum    	= mk_sum
   206   val dest_sum		= dest_sum
   207   val mk_coeff		= mk_coeff
   208   val dest_coeff	= dest_coeff 1
   209   val find_first_coeff	= find_first_coeff []
   210   val trans_tac         = trans_tac
   211   val norm_tac = ALLGOALS (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   212                                                      zminus_simps@zadd_ac))
   213                  THEN ALLGOALS
   214                     (simp_tac (HOL_ss addsimps [zmult_zminus_right RS sym]@
   215                                                bin_simps@zadd_ac@zmult_ac))
   216   val numeral_simp_tac	= ALLGOALS (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   217   val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
   218   end;
   219 
   220 
   221 structure EqCancelNumerals = CancelNumeralsFun
   222  (open CancelNumeralsCommon
   223   val prove_conv = prove_conv "inteq_cancel_numerals"
   224   val mk_bal   = HOLogic.mk_eq
   225   val dest_bal = HOLogic.dest_bin "op =" HOLogic.intT
   226   val bal_add1 = eq_add_iff1 RS trans
   227   val bal_add2 = eq_add_iff2 RS trans
   228 );
   229 
   230 structure LessCancelNumerals = CancelNumeralsFun
   231  (open CancelNumeralsCommon
   232   val prove_conv = prove_conv "intless_cancel_numerals"
   233   val mk_bal   = HOLogic.mk_binrel "op <"
   234   val dest_bal = HOLogic.dest_bin "op <" HOLogic.intT
   235   val bal_add1 = less_add_iff1 RS trans
   236   val bal_add2 = less_add_iff2 RS trans
   237 );
   238 
   239 structure LeCancelNumerals = CancelNumeralsFun
   240  (open CancelNumeralsCommon
   241   val prove_conv = prove_conv "intle_cancel_numerals"
   242   val mk_bal   = HOLogic.mk_binrel "op <="
   243   val dest_bal = HOLogic.dest_bin "op <=" HOLogic.intT
   244   val bal_add1 = le_add_iff1 RS trans
   245   val bal_add2 = le_add_iff2 RS trans
   246 );
   247 
   248 val cancel_numerals = 
   249   map prep_simproc
   250    [("inteq_cancel_numerals",
   251      prep_pats ["(l::int) + m = n", "(l::int) = m + n", 
   252 		"(l::int) - m = n", "(l::int) = m - n", 
   253 		"(l::int) * m = n", "(l::int) = m * n"], 
   254      EqCancelNumerals.proc),
   255     ("intless_cancel_numerals", 
   256      prep_pats ["(l::int) + m < n", "(l::int) < m + n", 
   257 		"(l::int) - m < n", "(l::int) < m - n", 
   258 		"(l::int) * m < n", "(l::int) < m * n"], 
   259      LessCancelNumerals.proc),
   260     ("intle_cancel_numerals", 
   261      prep_pats ["(l::int) + m <= n", "(l::int) <= m + n", 
   262 		"(l::int) - m <= n", "(l::int) <= m - n", 
   263 		"(l::int) * m <= n", "(l::int) <= m * n"], 
   264      LeCancelNumerals.proc)];
   265 
   266 
   267 structure CombineNumeralsData =
   268   struct
   269   val add		= op + : int*int -> int 
   270   val mk_sum    	= long_mk_sum    (*to work for e.g. #2*x + #3*x *)
   271   val dest_sum		= dest_sum
   272   val mk_coeff		= mk_coeff
   273   val dest_coeff	= dest_coeff 1
   274   val left_distrib	= left_zadd_zmult_distrib RS trans
   275   val prove_conv        = prove_conv_nohyps "int_combine_numerals"
   276   val trans_tac          = trans_tac
   277   val norm_tac = ALLGOALS
   278                    (simp_tac (HOL_ss addsimps add_0s@mult_1s@diff_simps@
   279                                               zminus_simps@zadd_ac))
   280                  THEN ALLGOALS
   281                     (simp_tac (HOL_ss addsimps [zmult_zminus_right RS sym]@
   282                                                bin_simps@zadd_ac@zmult_ac))
   283   val numeral_simp_tac	= ALLGOALS 
   284                     (simp_tac (HOL_ss addsimps add_0s@bin_simps))
   285   val simplify_meta_eq  = simplify_meta_eq (add_0s@mult_1s)
   286   end;
   287 
   288 structure CombineNumerals = CombineNumeralsFun(CombineNumeralsData);
   289   
   290 val combine_numerals = 
   291     prep_simproc ("int_combine_numerals",
   292 		  prep_pats ["(i::int) + j", "(i::int) - j"],
   293 		  CombineNumerals.proc);
   294 
   295 end;
   296 
   297 Addsimprocs Int_Numeral_Simprocs.cancel_numerals;
   298 Addsimprocs [Int_Numeral_Simprocs.combine_numerals];
   299 
   300 (*The Abel_Cancel simprocs are now obsolete*)
   301 Delsimprocs [Int_Cancel.sum_conv, Int_Cancel.rel_conv];
   302 
   303 (*examples:
   304 print_depth 22;
   305 set timing;
   306 set trace_simp;
   307 fun test s = (Goal s; by (Simp_tac 1)); 
   308 
   309 test "l + #2 + #2 + #2 + (l + #2) + (oo + #2) = (uu::int)";
   310 
   311 test "#2*u = (u::int)";
   312 test "(i + j + #12 + (k::int)) - #15 = y";
   313 test "(i + j + #12 + (k::int)) - #5 = y";
   314 
   315 test "y - b < (b::int)";
   316 test "y - (#3*b + c) < (b::int) - #2*c";
   317 
   318 test "(#2*x - (u*v) + y) - v*#3*u = (w::int)";
   319 test "(#2*x*u*v + (u*v)*#4 + y) - v*u*#4 = (w::int)";
   320 test "(#2*x*u*v + (u*v)*#4 + y) - v*u = (w::int)";
   321 test "u*v - (x*u*v + (u*v)*#4 + y) = (w::int)";
   322 
   323 test "(i + j + #12 + (k::int)) = u + #15 + y";
   324 test "(i + j*#2 + #12 + (k::int)) = j + #5 + y";
   325 
   326 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)";
   327 
   328 test "a + -(b+c) + b = (d::int)";
   329 test "a + -(b+c) - b = (d::int)";
   330 
   331 (*negative numerals*)
   332 test "(i + j + #-2 + (k::int)) - (u + #5 + y) = zz";
   333 test "(i + j + #-3 + (k::int)) < u + #5 + y";
   334 test "(i + j + #3 + (k::int)) < u + #-6 + y";
   335 test "(i + j + #-12 + (k::int)) - #15 = y";
   336 test "(i + j + #12 + (k::int)) - #-15 = y";
   337 test "(i + j + #-12 + (k::int)) - #-15 = y";
   338 *)
   339 
   340 
   341 (** Constant folding for integer plus and times **)
   342 
   343 (*We do not need
   344     structure Nat_Plus_Assoc = Assoc_Fold (Nat_Plus_Assoc_Data);
   345     structure Int_Plus_Assoc = Assoc_Fold (Int_Plus_Assoc_Data);
   346   because combine_numerals does the same thing*)
   347 
   348 structure Int_Times_Assoc_Data : ASSOC_FOLD_DATA =
   349 struct
   350   val ss		= HOL_ss
   351   val eq_reflection	= eq_reflection
   352   val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
   353   val T	     = HOLogic.intT
   354   val plus   = Const ("op *", [HOLogic.intT,HOLogic.intT] ---> HOLogic.intT);
   355   val add_ac = zmult_ac
   356 end;
   357 
   358 structure Int_Times_Assoc = Assoc_Fold (Int_Times_Assoc_Data);
   359 
   360 Addsimprocs [Int_Times_Assoc.conv];
   361 
   362 
   363 (** The same for the naturals **)
   364 
   365 structure Nat_Times_Assoc_Data : ASSOC_FOLD_DATA =
   366 struct
   367   val ss		= HOL_ss
   368   val eq_reflection	= eq_reflection
   369   val sg_ref = Sign.self_ref (Theory.sign_of (the_context ()))
   370   val T	     = HOLogic.natT
   371   val plus   = Const ("op *", [HOLogic.natT,HOLogic.natT] ---> HOLogic.natT);
   372   val add_ac = mult_ac
   373 end;
   374 
   375 structure Nat_Times_Assoc = Assoc_Fold (Nat_Times_Assoc_Data);
   376 
   377 Addsimprocs [Nat_Times_Assoc.conv];
   378 
   379 
   380 (*** decision procedure for linear arithmetic ***)
   381 
   382 (*---------------------------------------------------------------------------*)
   383 (* Linear arithmetic                                                         *)
   384 (*---------------------------------------------------------------------------*)
   385 
   386 (*
   387 Instantiation of the generic linear arithmetic package for int.
   388 *)
   389 
   390 (* Update parameters of arithmetic prover *)
   391 local
   392 
   393 (* reduce contradictory <= to False *)
   394 val add_rules = simp_thms @ bin_arith_simps @ bin_rel_simps @
   395                 [zadd_0, zadd_0_right, zdiff_def,
   396 		 zadd_zminus_inverse, zadd_zminus_inverse2, 
   397 		 zmult_0, zmult_0_right, 
   398 		 zmult_1, zmult_1_right, 
   399 		 zmult_minus1, zmult_minus1_right,
   400 		 zminus_zadd_distrib, zminus_zminus,
   401                  int_0, zadd_int RS sym, int_Suc];
   402 
   403 val simprocs = [Int_Times_Assoc.conv, Int_Numeral_Simprocs.combine_numerals]@
   404                Int_Numeral_Simprocs.cancel_numerals;
   405 
   406 val add_mono_thms_int =
   407   map (fn s => prove_goal (the_context ()) s
   408                  (fn prems => [cut_facts_tac prems 1,
   409                       asm_simp_tac (simpset() addsimps [zadd_zle_mono]) 1]))
   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      "(i  = j) & (k  = l) ==> i + k  = j + (l::int)"
   414     ];
   415 
   416 in
   417 
   418 val int_arith_setup =
   419  [Fast_Arith.map_data (fn {add_mono_thms, inj_thms, lessD, simpset} =>
   420    {add_mono_thms = add_mono_thms @ add_mono_thms_int,
   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 *)