author | paulson |
Thu, 23 Sep 1999 13:07:25 +0200 | |
changeset 7585 | dca904d4ce4c |
parent 7076 | a30e024791c6 |
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 |
||
7585 | 10 |
(*** 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*) |
7585 | 13 |
Goal "((x::int) + (y + z) = y + u) = ((x + z) = u)"; |
14 |
by (stac zadd_left_commute 1); |
|
15 |
by (rtac zadd_left_cancel 1); |
|
16 |
qed "zadd_cancel_21"; |
|
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.*) |
7585 | 20 |
Goal "((x::int) + (y + z) = y) = (x = -z)"; |
21 |
by (stac zadd_left_commute 1); |
|
22 |
by (res_inst_tac [("t", "y")] (zadd_int0_right RS subst) 1 |
|
23 |
THEN stac zadd_left_cancel 1); |
|
24 |
by (simp_tac (simpset() addsimps [eq_zdiff_eq RS sym]) 1); |
|
25 |
qed "zadd_cancel_end"; |
|
26 |
||
27 |
||
5501 | 28 |
|
29 |
||
5595 | 30 |
structure Int_Cancel_Data = |
31 |
struct |
|
32 |
val ss = HOL_ss |
|
5610 | 33 |
val eq_reflection = eq_reflection |
5501 | 34 |
|
5595 | 35 |
val thy = IntDef.thy |
7076 | 36 |
val T = HOLogic.intT |
5595 | 37 |
val zero = Const ("IntDef.int", HOLogic.natT --> T) $ HOLogic.zero |
7585 | 38 |
val restrict_to_left = restrict_to_left |
5595 | 39 |
val add_cancel_21 = zadd_cancel_21 |
40 |
val add_cancel_end = zadd_cancel_end |
|
41 |
val add_left_cancel = zadd_left_cancel |
|
42 |
val add_assoc = zadd_assoc |
|
43 |
val add_commute = zadd_commute |
|
44 |
val add_left_commute = zadd_left_commute |
|
6917 | 45 |
val add_0 = zadd_int0 |
46 |
val add_0_right = zadd_int0_right |
|
5595 | 47 |
|
48 |
val eq_diff_eq = eq_zdiff_eq |
|
49 |
val eqI_rules = [zless_eqI, zeq_eqI, zle_eqI] |
|
50 |
fun dest_eqI th = |
|
51 |
#1 (HOLogic.dest_bin "op =" HOLogic.boolT |
|
52 |
(HOLogic.dest_Trueprop (concl_of th))) |
|
53 |
||
54 |
val diff_def = zdiff_def |
|
55 |
val minus_add_distrib = zminus_zadd_distrib |
|
56 |
val minus_minus = zminus_zminus |
|
6917 | 57 |
val minus_0 = zminus_int0 |
5595 | 58 |
val add_inverses = [zadd_zminus_inverse, zadd_zminus_inverse2]; |
59 |
val cancel_simps = [zadd_zminus_cancel, zminus_zadd_cancel] |
|
5501 | 60 |
end; |
61 |
||
5595 | 62 |
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
|
63 |
|
5595 | 64 |
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
|
65 |
|
a356fb49e69e
many renamings and changes. Simproc for cancelling common terms in relations
paulson
parents:
5553
diff
changeset
|
66 |