| 1 |
%< |
| 2 |
FILE: zet_fns.ml |
| 3 |
|
| 4 |
DESCRIPTION: tactics for integers |
| 5 |
|
| 6 |
AUTHOR: Ton Kalker |
| 7 |
|
| 8 |
DATE: 22-09-89 |
| 9 |
>% |
| 10 |
|
| 11 |
let ZET_INDUCT0_TAC (A,t) = |
| 12 |
(let th = ZET_INDUCTION0 in |
| 13 |
let x,body = dest_forall t in |
| 14 |
let tyi = snd(match (fst(dest_forall (concl th))) "\^x.T") in |
| 15 |
let spec = SPEC (mk_abs(x,body)) (INST_TYPE tyi th) in |
| 16 |
let spec' = DISCH_ALL (CONV_RULE (GEN_ALPHA_CONV x) (UNDISCH spec)) in |
| 17 |
let thm = CONV_RULE(RAND_CONV(BINDER_CONV BETA_CONV)) spec' in |
| 18 |
let tac = |
| 19 |
(MATCH_MP_TAC thm THEN |
| 20 |
CONJ_TAC THEN |
| 21 |
FIRST[CONV_TAC (BINDER_CONV((RAND_CONV BETA_CONV) THENC |
| 22 |
(LHS_CONV(RAND_CONV BETA_CONV)))); |
| 23 |
CONV_TAC (BINDER_CONV(RAND_CONV BETA_CONV))] )in |
| 24 |
tac (A,t));; |
| 25 |
|
| 26 |
%<The parameter k in the tactic below determines the |
| 27 |
point where induction really starts>% |
| 28 |
|
| 29 |
|
| 30 |
let ZET_INDUCT1_TAC k (A,t) = |
| 31 |
(let th = SPEC k ZET_INDUCTION1 in |
| 32 |
let x,body = dest_forall t in |
| 33 |
let tyi = snd(match (fst(dest_forall (concl th))) "\^x.T") in |
| 34 |
let spec = SPEC (mk_abs(x,body)) (INST_TYPE tyi th) in |
| 35 |
let spec' = DISCH_ALL (CONV_RULE (GEN_ALPHA_CONV x) (UNDISCH spec)) in |
| 36 |
let thm = CONV_RULE(RAND_CONV(BINDER_CONV BETA_CONV)) spec' in |
| 37 |
let PART_MATCH' partfn th = |
| 38 |
(let pth = GSPEC th in |
| 39 |
let pat = partfn(concl pth) in |
| 40 |
let matchfn = match pat in |
| 41 |
\tm. INST_TY_TERM (matchfn tm) pth) in |
| 42 |
let MATCH_MP_TAC' thm:tactic (gl,g) = |
| 43 |
(let imp = ((PART_MATCH' (snd o dest_imp) thm) g) ? |
| 44 |
failwith `MATCH_MP_TAC` in |
| 45 |
|
| 46 |
([gl,(fst(dest_imp(concl imp)))], \thl. MP imp (hd thl))) in |
| 47 |
let tac = |
| 48 |
(MATCH_MP_TAC' thm THEN |
| 49 |
REPEAT CONJ_TAC THEN |
| 50 |
GEN_TAC THENL |
| 51 |
[CONV_TAC (RAND_CONV BETA_CONV); |
| 52 |
CONV_TAC ((RAND_CONV BETA_CONV) THENC |
| 53 |
(LHS_CONV(RAND_CONV BETA_CONV)))] THEN |
| 54 |
REPEAT STRIP_TAC) in |
| 55 |
tac (A,t));; |
| 56 |
|
| 57 |
%<The parameter k in the tactic below determines the |
| 58 |
point where induction really starts>% |
| 59 |
|
| 60 |
let ZET_INDUCT2_TAC k (A,t) = |
| 61 |
(let th = SPEC k ZET_INDUCTION2 in |
| 62 |
let x,body = dest_forall t in |
| 63 |
let tyi = snd(match (fst(dest_forall (concl th))) "\^x.T") in |
| 64 |
let spec = SPEC (mk_abs(x,body)) (INST_TYPE tyi th) in |
| 65 |
let spec' = DISCH_ALL (CONV_RULE (GEN_ALPHA_CONV x) (UNDISCH spec)) in |
| 66 |
let thm = CONV_RULE(RAND_CONV(BINDER_CONV BETA_CONV)) spec' in |
| 67 |
let PART_MATCH' partfn th = |
| 68 |
(let pth = GSPEC th in |
| 69 |
let pat = partfn(concl pth) in |
| 70 |
let matchfn = match pat in |
| 71 |
\tm. INST_TY_TERM (matchfn tm) pth) in |
| 72 |
let MATCH_MP_TAC' thm:tactic (gl,g) = |
| 73 |
(let imp = ((PART_MATCH' (snd o dest_imp) thm) g) ? |
| 74 |
failwith `MATCH_MP_TAC` in |
| 75 |
|
| 76 |
([gl,(fst(dest_imp(concl imp)))], \thl. MP imp (hd thl))) in |
| 77 |
let tac = |
| 78 |
(MATCH_MP_TAC' thm THEN |
| 79 |
REPEAT CONJ_TAC THENL |
| 80 |
[ALL_TAC;GEN_TAC;GEN_TAC] THENL |
| 81 |
[CONV_TAC BETA_CONV; |
| 82 |
CONV_TAC ((RAND_CONV BETA_CONV) THENC |
| 83 |
(LHS_CONV(RAND_CONV BETA_CONV))); |
| 84 |
CONV_TAC ((RAND_CONV BETA_CONV) THENC |
| 85 |
(LHS_CONV(RAND_CONV BETA_CONV)))] THEN |
| 86 |
REPEAT STRIP_TAC) in |
| 87 |
tac (A,t));; |
| 88 |
|