src/HOL/Integ/IntDiv_setup.ML
changeset 13517 42efec18f5b2
child 14387 e96d5c42c4b0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/HOL/Integ/IntDiv_setup.ML	Fri Aug 23 07:41:05 2002 +0200
     1.3 @@ -0,0 +1,37 @@
     1.4 +(*  Title:      HOL/Integ/IntDiv_setup.ML
     1.5 +    ID:         $Id$
     1.6 +    Author:     Tobias Nipkow, Informatik, TU Muenchen
     1.7 +    Copyright   2002  TU Muenchen
     1.8 +
     1.9 +Simproc for cancelling div and mod
    1.10 +*)
    1.11 +
    1.12 +
    1.13 +structure CancelDivModData =
    1.14 +struct
    1.15 +
    1.16 +val div_name = "Divides.op div";
    1.17 +val mod_name = "Divides.op mod";
    1.18 +val mk_binop = HOLogic.mk_binop;
    1.19 +val mk_sum = Int_Numeral_Simprocs.mk_sum;
    1.20 +val dest_sum = Int_Numeral_Simprocs.dest_sum;
    1.21 +
    1.22 +(*logic*)
    1.23 +
    1.24 +val div_mod_eqs =
    1.25 +  map mk_meta_eq [thm"zdiv_zmod_equality",thm"zdiv_zmod_equality2"]
    1.26 +
    1.27 +val trans = trans
    1.28 +
    1.29 +val prove_eq_sums =
    1.30 +  let val simps = zdiff_def :: Int_Numeral_Simprocs.add_0s @ zadd_ac
    1.31 +  in NatArithUtils.prove_conv all_tac (NatArithUtils.simp_all simps) end
    1.32 +
    1.33 +end;
    1.34 +
    1.35 +structure CancelDivMod = CancelDivModFun(CancelDivModData);
    1.36 +
    1.37 +val cancel_zdiv_zmod_proc = NatArithUtils.prep_simproc
    1.38 +      ("cancel_zdiv_zmod", ["(m::int) + n"], CancelDivMod.proc);
    1.39 +
    1.40 +Addsimprocs[cancel_zdiv_zmod_proc];