src/HOL/Tools/nat_arith.ML
changeset 48561 12aa0cb2b447
parent 48560 e0875d956a6b
child 48571 d68b74435605
     1.1 --- a/src/HOL/Tools/nat_arith.ML	Fri Jul 27 17:59:18 2012 +0200
     1.2 +++ b/src/HOL/Tools/nat_arith.ML	Fri Jul 27 19:27:21 2012 +0200
     1.3 @@ -10,40 +10,11 @@
     1.4    val cancel_eq_conv: conv
     1.5    val cancel_le_conv: conv
     1.6    val cancel_less_conv: conv
     1.7 -  (* legacy functions: *)
     1.8 -  val mk_sum: term list -> term
     1.9 -  val mk_norm_sum: term list -> term
    1.10 -  val dest_sum: term -> term list
    1.11  end;
    1.12  
    1.13  structure Nat_Arith: NAT_ARITH =
    1.14  struct
    1.15  
    1.16 -(** abstract syntax of structure nat: 0, Suc, + **)
    1.17 -
    1.18 -val mk_plus = HOLogic.mk_binop @{const_name Groups.plus};
    1.19 -val dest_plus = HOLogic.dest_bin @{const_name Groups.plus} HOLogic.natT;
    1.20 -
    1.21 -fun mk_sum [] = HOLogic.zero
    1.22 -  | mk_sum [t] = t
    1.23 -  | mk_sum (t :: ts) = mk_plus (t, mk_sum ts);
    1.24 -
    1.25 -(*normal form of sums: Suc (... (Suc (a + (b + ...))))*)
    1.26 -fun mk_norm_sum ts =
    1.27 -  let val (ones, sums) = List.partition (equal HOLogic.Suc_zero) ts in
    1.28 -    funpow (length ones) HOLogic.mk_Suc (mk_sum sums)
    1.29 -  end;
    1.30 -
    1.31 -fun dest_sum tm =
    1.32 -  if HOLogic.is_zero tm then []
    1.33 -  else
    1.34 -    (case try HOLogic.dest_Suc tm of
    1.35 -      SOME t => HOLogic.Suc_zero :: dest_sum t
    1.36 -    | NONE =>
    1.37 -        (case try dest_plus tm of
    1.38 -          SOME (t, u) => dest_sum t @ dest_sum u
    1.39 -        | NONE => [tm]));
    1.40 -
    1.41  val add1 = @{lemma "(A::'a::comm_monoid_add) == k + a ==> A + b == k + (a + b)"
    1.42        by (simp only: add_ac)}
    1.43  val add2 = @{lemma "(B::'a::comm_monoid_add) == k + b ==> a + B == k + (a + b)"