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