author | wenzelm |
Wed, 03 Feb 1999 16:42:40 +0100 | |
changeset 6188 | c40e5ac04e3e |
parent 5610 | 377acd99d74c |
child 6917 | eba301caceea |
permissions | -rw-r--r-- |
5501 | 1 |
(* Title: HOL/Integ/simproc |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1998 University of Cambridge |
|
5 |
||
5595 | 6 |
Apply Abel_Cancel to the integers |
5501 | 7 |
*) |
8 |
||
9 |
||
5595 | 10 |
(*** Two lemmas needed for the simprocs ***) |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
11 |
|
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
12 |
(*Deletion of other terms in the formula, seeking the -x at the front of z*) |
5595 | 13 |
val zadd_cancel_21 = prove_goal IntDef.thy |
14 |
"((x::int) + (y + z) = y + u) = ((x + z) = u)" |
|
15 |
(fn _ => [stac zadd_left_commute 1, |
|
16 |
rtac zadd_left_cancel 1]); |
|
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
17 |
|
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
18 |
(*A further rule to deal with the case that |
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
19 |
everything gets cancelled on the right.*) |
5595 | 20 |
val zadd_cancel_end = prove_goal IntDef.thy |
21 |
"((x::int) + (y + z) = y) = (x = -z)" |
|
22 |
(fn _ => [stac zadd_left_commute 1, |
|
23 |
res_inst_tac [("t", "y")] (zadd_nat0_right RS subst) 1, |
|
24 |
stac zadd_left_cancel 1, |
|
25 |
simp_tac (simpset() addsimps [eq_zdiff_eq RS sym]) 1]); |
|
5501 | 26 |
|
27 |
||
5595 | 28 |
structure Int_Cancel_Data = |
29 |
struct |
|
30 |
val ss = HOL_ss |
|
5610 | 31 |
val eq_reflection = eq_reflection |
5501 | 32 |
|
5595 | 33 |
val thy = IntDef.thy |
34 |
val T = Type ("IntDef.int", []) |
|
35 |
val zero = Const ("IntDef.int", HOLogic.natT --> T) $ HOLogic.zero |
|
36 |
val add_cancel_21 = zadd_cancel_21 |
|
37 |
val add_cancel_end = zadd_cancel_end |
|
38 |
val add_left_cancel = zadd_left_cancel |
|
39 |
val add_assoc = zadd_assoc |
|
40 |
val add_commute = zadd_commute |
|
41 |
val add_left_commute = zadd_left_commute |
|
42 |
val add_0 = zadd_nat0 |
|
43 |
val add_0_right = zadd_nat0_right |
|
44 |
||
45 |
val eq_diff_eq = eq_zdiff_eq |
|
46 |
val eqI_rules = [zless_eqI, zeq_eqI, zle_eqI] |
|
47 |
fun dest_eqI th = |
|
48 |
#1 (HOLogic.dest_bin "op =" HOLogic.boolT |
|
49 |
(HOLogic.dest_Trueprop (concl_of th))) |
|
50 |
||
51 |
val diff_def = zdiff_def |
|
52 |
val minus_add_distrib = zminus_zadd_distrib |
|
53 |
val minus_minus = zminus_zminus |
|
54 |
val minus_0 = zminus_nat0 |
|
55 |
val add_inverses = [zadd_zminus_inverse, zadd_zminus_inverse2]; |
|
56 |
val cancel_simps = [zadd_zminus_cancel, zminus_zadd_cancel] |
|
5501 | 57 |
end; |
58 |
||
5595 | 59 |
structure Int_Cancel = Abel_Cancel (Int_Cancel_Data); |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
60 |
|
5595 | 61 |
Addsimprocs [Int_Cancel.sum_conv, Int_Cancel.rel_conv]; |
5582
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
62 |
|
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
63 |