author | paulson |
Wed, 05 Nov 1997 13:14:15 +0100 | |
changeset 4152 | 451104c223e2 |
parent 4091 | 771b1f6422a8 |
child 5068 | fb28eaa07e01 |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: Reduction.ML |
1048 | 2 |
ID: $Id$ |
1461 | 3 |
Author: Ole Rasmussen |
1048 | 4 |
Copyright 1995 University of Cambridge |
5 |
Logic Image: ZF |
|
6 |
*) |
|
7 |
||
8 |
open Reduction; |
|
9 |
||
10 |
||
11 |
(* ------------------------------------------------------------------------- *) |
|
12 |
(* Setting up rulelists for reduction *) |
|
13 |
(* ------------------------------------------------------------------------- *) |
|
14 |
||
15 |
val red1D1 = Sred1.dom_subset RS subsetD RS SigmaD1; |
|
16 |
val red1D2 = Sred1.dom_subset RS subsetD RS SigmaD2; |
|
17 |
val redD1 = Sred.dom_subset RS subsetD RS SigmaD1; |
|
18 |
val redD2 = Sred.dom_subset RS subsetD RS SigmaD2; |
|
19 |
val par_red1D1 = Spar_red1.dom_subset RS subsetD RS SigmaD1; |
|
20 |
val par_red1D2 = Spar_red1.dom_subset RS subsetD RS SigmaD2; |
|
21 |
val par_redD1 = Spar_red.dom_subset RS subsetD RS SigmaD1; |
|
22 |
val par_redD2 = Spar_red.dom_subset RS subsetD RS SigmaD2; |
|
23 |
||
24 |
||
2469 | 25 |
AddIs (Sred1.intrs@[Sred.one_step, Sred.refl]@Spar_red1.intrs@ |
26 |
[Spar_red.one_step, lambda.dom_subset RS subsetD, |
|
27 |
unmark_type]@lambda.intrs@bool_typechecks); |
|
28 |
AddSEs [Spar_red1.mk_cases redexes.con_defs "Fun(t) =1=> Fun(u)"]; |
|
1048 | 29 |
|
2469 | 30 |
Addsimps (Sred1.intrs@[Sred.one_step, Sred.refl]@Spar_red1.intrs@ |
31 |
[Spar_red.one_step, substL_type, redD1, redD2, par_redD1, |
|
32 |
par_redD2, par_red1D2, unmark_type]); |
|
1048 | 33 |
|
4152 | 34 |
val reducL_ss = simpset() setloop (SELECT_GOAL Safe_tac); |
1048 | 35 |
|
36 |
(* ------------------------------------------------------------------------- *) |
|
37 |
(* Lemmas for reduction *) |
|
38 |
(* ------------------------------------------------------------------------- *) |
|
39 |
||
40 |
goal Reduction.thy "!!u. m--->n ==> Fun(m) ---> Fun(n)"; |
|
1732 | 41 |
by (etac Sred.induct 1); |
1048 | 42 |
by (resolve_tac [Sred.trans] 3); |
2469 | 43 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
44 |
qed "red_Fun"; |
1048 | 45 |
|
46 |
goal Reduction.thy |
|
47 |
"!!u.[|n:lambda; m ---> m'|]==> Apl(m,n)--->Apl(m',n)"; |
|
1732 | 48 |
by (etac Sred.induct 1); |
1048 | 49 |
by (resolve_tac [Sred.trans] 3); |
2469 | 50 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
51 |
qed "red_Apll"; |
1048 | 52 |
|
53 |
goal Reduction.thy |
|
54 |
"!!u.[|n:lambda; m ---> m'|]==> Apl(n,m)--->Apl(n,m')"; |
|
1732 | 55 |
by (etac Sred.induct 1); |
1048 | 56 |
by (resolve_tac [Sred.trans] 3); |
2469 | 57 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
58 |
qed "red_Aplr"; |
1048 | 59 |
|
60 |
goal Reduction.thy |
|
61 |
"!!u.[|m ---> m'; n--->n'|]==> Apl(m,n)--->Apl(m',n')"; |
|
62 |
by (res_inst_tac [("n","Apl(m',n)")] Sred.trans 1); |
|
4091 | 63 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [red_Apll,red_Aplr]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
64 |
qed "red_Apl"; |
1048 | 65 |
|
66 |
goal Reduction.thy |
|
67 |
"!!u.[|m:lambda; m':lambda; n:lambda; n':lambda; m ---> m'; n--->n'|]==> \ |
|
68 |
\ Apl(Fun(m),n)---> n'/m'"; |
|
69 |
by (res_inst_tac [("n","Apl(Fun(m'),n')")] Sred.trans 1); |
|
4091 | 70 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [red_Apl,red_Fun]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
71 |
qed "red_beta"; |
1048 | 72 |
|
73 |
||
74 |
(* ------------------------------------------------------------------------- *) |
|
75 |
(* Lemmas for parallel reduction *) |
|
76 |
(* ------------------------------------------------------------------------- *) |
|
77 |
||
78 |
||
3840 | 79 |
goal Reduction.thy "!!u. m:lambda==> m =1=> m"; |
1048 | 80 |
by (eresolve_tac [lambda.induct] 1); |
2469 | 81 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
82 |
qed "refl_par_red1"; |
1048 | 83 |
|
3840 | 84 |
goal Reduction.thy "!!u. m-1->n ==> m=1=>n"; |
1732 | 85 |
by (etac Sred1.induct 1); |
4091 | 86 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [refl_par_red1]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
87 |
qed "red1_par_red1"; |
1048 | 88 |
|
3840 | 89 |
goal Reduction.thy "!!u. m--->n ==> m===>n"; |
1732 | 90 |
by (etac Sred.induct 1); |
1048 | 91 |
by (resolve_tac [Spar_red.trans] 3); |
4091 | 92 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [refl_par_red1,red1_par_red1]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
93 |
qed "red_par_red"; |
1048 | 94 |
|
3840 | 95 |
goal Reduction.thy "!!u. m===>n ==> m--->n"; |
1732 | 96 |
by (etac Spar_red.induct 1); |
97 |
by (etac Spar_red1.induct 1); |
|
1048 | 98 |
by (resolve_tac [Sred.trans] 5); |
4091 | 99 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [red_Fun,red_beta,red_Apl]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
100 |
qed "par_red_red"; |
1048 | 101 |
|
102 |
||
103 |
(* ------------------------------------------------------------------------- *) |
|
104 |
(* Simulation *) |
|
105 |
(* ------------------------------------------------------------------------- *) |
|
106 |
||
107 |
goal Reduction.thy |
|
3840 | 108 |
"!!u. m=1=>n ==> EX v. m|>v = n & m~v & regular(v)"; |
1732 | 109 |
by (etac Spar_red1.induct 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
110 |
by Safe_tac; |
1048 | 111 |
by (ALLGOALS (REPEAT o (resolve_tac [exI,conjI]))); |
112 |
by (TRYALL(resolve_tac [res_redex,res_App,res_Fun,res_Var])); |
|
4091 | 113 |
by (ALLGOALS (asm_simp_tac (simpset()))); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
114 |
qed "simulation"; |
1048 | 115 |
|
116 |
||
117 |
(* ------------------------------------------------------------------------- *) |
|
118 |
(* commuting of unmark and subst *) |
|
119 |
(* ------------------------------------------------------------------------- *) |
|
120 |
||
121 |
goal Reduction.thy |
|
3840 | 122 |
"!!u. u:redexes ==> \ |
1048 | 123 |
\ ALL k:nat. unmark(lift_rec(u,k)) = lift_rec(unmark(u),k)"; |
124 |
by (eresolve_tac [redexes.induct] 1); |
|
4091 | 125 |
by (ALLGOALS (asm_full_simp_tac (addsplit (simpset())))); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
126 |
qed "unmmark_lift_rec"; |
1048 | 127 |
|
128 |
goal Reduction.thy |
|
3840 | 129 |
"!!u. v:redexes ==> ALL k:nat. ALL u:redexes. \ |
1048 | 130 |
\ unmark(subst_rec(u,v,k)) = subst_rec(unmark(u),unmark(v),k)"; |
131 |
by (eresolve_tac [redexes.induct] 1); |
|
132 |
by (ALLGOALS (asm_full_simp_tac |
|
4091 | 133 |
((addsplit (simpset())) addsimps [unmmark_lift_rec]))); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
134 |
qed "unmmark_subst_rec"; |
1048 | 135 |
|
136 |
||
137 |
(* ------------------------------------------------------------------------- *) |
|
138 |
(* Completeness *) |
|
139 |
(* ------------------------------------------------------------------------- *) |
|
140 |
||
141 |
goal Reduction.thy |
|
3840 | 142 |
"!!u. u~v ==> regular(v) --> unmark(u) =1=> unmark(u|>v)"; |
1732 | 143 |
by (etac Scomp.induct 1); |
1048 | 144 |
by (ALLGOALS (asm_full_simp_tac (reducL_ss addsimps [unmmark_subst_rec]) )); |
145 |
by (dres_inst_tac [("psi", "Fun(?u) =1=> ?w")] asm_rl 1); |
|
146 |
by (asm_full_simp_tac reducL_ss 1); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
147 |
qed_spec_mp "completeness_l"; |
1048 | 148 |
|
149 |
goal Reduction.thy |
|
150 |
"!!u.[|u:lambda; u~v; regular(v)|]==> u =1=> unmark(u|>v)"; |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
151 |
by (dtac completeness_l 1); |
4091 | 152 |
by (ALLGOALS (asm_full_simp_tac (simpset() addsimps [lambda_unmark]) )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
153 |
qed "completeness"; |
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
154 |