author | paulson |
Thu, 29 Jun 2000 12:16:43 +0200 | |
changeset 9188 | 379b0c3f7c85 |
parent 6141 | a6922171b396 |
child 11319 | 8b84ee2cc79c |
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 |
(* ------------------------------------------------------------------------- *) |
|
9 |
(* Setting up rulelists for reduction *) |
|
10 |
(* ------------------------------------------------------------------------- *) |
|
11 |
||
12 |
val red1D1 = Sred1.dom_subset RS subsetD RS SigmaD1; |
|
13 |
val red1D2 = Sred1.dom_subset RS subsetD RS SigmaD2; |
|
14 |
val redD1 = Sred.dom_subset RS subsetD RS SigmaD1; |
|
15 |
val redD2 = Sred.dom_subset RS subsetD RS SigmaD2; |
|
16 |
val par_red1D1 = Spar_red1.dom_subset RS subsetD RS SigmaD1; |
|
17 |
val par_red1D2 = Spar_red1.dom_subset RS subsetD RS SigmaD2; |
|
18 |
val par_redD1 = Spar_red.dom_subset RS subsetD RS SigmaD1; |
|
19 |
val par_redD2 = Spar_red.dom_subset RS subsetD RS SigmaD2; |
|
20 |
||
21 |
||
2469 | 22 |
AddIs (Sred1.intrs@[Sred.one_step, Sred.refl]@Spar_red1.intrs@ |
23 |
[Spar_red.one_step, lambda.dom_subset RS subsetD, |
|
24 |
unmark_type]@lambda.intrs@bool_typechecks); |
|
6141 | 25 |
AddSEs [Spar_red1.mk_cases "Fun(t) =1=> Fun(u)"]; |
1048 | 26 |
|
2469 | 27 |
Addsimps (Sred1.intrs@[Sred.one_step, Sred.refl]@Spar_red1.intrs@ |
28 |
[Spar_red.one_step, substL_type, redD1, redD2, par_redD1, |
|
29 |
par_redD2, par_red1D2, unmark_type]); |
|
1048 | 30 |
|
31 |
||
32 |
(* ------------------------------------------------------------------------- *) |
|
33 |
(* Lemmas for reduction *) |
|
34 |
(* ------------------------------------------------------------------------- *) |
|
35 |
||
5137 | 36 |
Goal "m--->n ==> Fun(m) ---> Fun(n)"; |
1732 | 37 |
by (etac Sred.induct 1); |
1048 | 38 |
by (resolve_tac [Sred.trans] 3); |
2469 | 39 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
40 |
qed "red_Fun"; |
1048 | 41 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
42 |
Goal "[|n:lambda; m ---> m'|]==> Apl(m,n)--->Apl(m',n)"; |
1732 | 43 |
by (etac Sred.induct 1); |
1048 | 44 |
by (resolve_tac [Sred.trans] 3); |
2469 | 45 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
46 |
qed "red_Apll"; |
1048 | 47 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
48 |
Goal "[|n:lambda; m ---> m'|]==> Apl(n,m)--->Apl(n,m')"; |
1732 | 49 |
by (etac Sred.induct 1); |
1048 | 50 |
by (resolve_tac [Sred.trans] 3); |
2469 | 51 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
52 |
qed "red_Aplr"; |
1048 | 53 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
54 |
Goal "[|m ---> m'; n--->n'|]==> Apl(m,n)--->Apl(m',n')"; |
1048 | 55 |
by (res_inst_tac [("n","Apl(m',n)")] Sred.trans 1); |
4091 | 56 |
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
|
57 |
qed "red_Apl"; |
1048 | 58 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
59 |
Goal "[|m:lambda; m':lambda; n:lambda; n':lambda; m ---> m'; n--->n'|]==> \ |
1048 | 60 |
\ Apl(Fun(m),n)---> n'/m'"; |
61 |
by (res_inst_tac [("n","Apl(Fun(m'),n')")] Sred.trans 1); |
|
4091 | 62 |
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
|
63 |
qed "red_beta"; |
1048 | 64 |
|
65 |
||
66 |
(* ------------------------------------------------------------------------- *) |
|
67 |
(* Lemmas for parallel reduction *) |
|
68 |
(* ------------------------------------------------------------------------- *) |
|
69 |
||
70 |
||
5137 | 71 |
Goal "m:lambda==> m =1=> m"; |
5527 | 72 |
by (etac lambda.induct 1); |
2469 | 73 |
by (ALLGOALS (Asm_simp_tac )); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
74 |
qed "refl_par_red1"; |
1048 | 75 |
|
5137 | 76 |
Goal "m-1->n ==> m=1=>n"; |
1732 | 77 |
by (etac Sred1.induct 1); |
4091 | 78 |
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
|
79 |
qed "red1_par_red1"; |
1048 | 80 |
|
5137 | 81 |
Goal "m--->n ==> m===>n"; |
1732 | 82 |
by (etac Sred.induct 1); |
1048 | 83 |
by (resolve_tac [Spar_red.trans] 3); |
4091 | 84 |
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
|
85 |
qed "red_par_red"; |
1048 | 86 |
|
5137 | 87 |
Goal "m===>n ==> m--->n"; |
1732 | 88 |
by (etac Spar_red.induct 1); |
89 |
by (etac Spar_red1.induct 1); |
|
1048 | 90 |
by (resolve_tac [Sred.trans] 5); |
4091 | 91 |
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
|
92 |
qed "par_red_red"; |
1048 | 93 |
|
94 |
||
95 |
(* ------------------------------------------------------------------------- *) |
|
96 |
(* Simulation *) |
|
97 |
(* ------------------------------------------------------------------------- *) |
|
98 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
99 |
Goal "m=1=>n ==> EX v. m|>v = n & m~v & regular(v)"; |
1732 | 100 |
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
|
101 |
by Safe_tac; |
1048 | 102 |
by (ALLGOALS (REPEAT o (resolve_tac [exI,conjI]))); |
103 |
by (TRYALL(resolve_tac [res_redex,res_App,res_Fun,res_Var])); |
|
4091 | 104 |
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
|
105 |
qed "simulation"; |
1048 | 106 |
|
107 |
||
108 |
(* ------------------------------------------------------------------------- *) |
|
109 |
(* commuting of unmark and subst *) |
|
110 |
(* ------------------------------------------------------------------------- *) |
|
111 |
||
5527 | 112 |
Goal "u:redexes ==> ALL k:nat. unmark(lift_rec(u,k)) = lift_rec(unmark(u),k)"; |
113 |
by (etac redexes.induct 1); |
|
114 |
by (ALLGOALS (asm_simp_tac (simpset() addsimps [lift_rec_Var]))); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
115 |
qed "unmmark_lift_rec"; |
1048 | 116 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
117 |
Goal "v:redexes ==> ALL k:nat. ALL u:redexes. \ |
1048 | 118 |
\ unmark(subst_rec(u,v,k)) = subst_rec(unmark(u),unmark(v),k)"; |
5527 | 119 |
by (etac redexes.induct 1); |
120 |
by (ALLGOALS (asm_simp_tac |
|
121 |
(simpset() addsimps [unmmark_lift_rec, subst_Var]))); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
122 |
qed "unmmark_subst_rec"; |
1048 | 123 |
|
124 |
||
125 |
(* ------------------------------------------------------------------------- *) |
|
126 |
(* Completeness *) |
|
127 |
(* ------------------------------------------------------------------------- *) |
|
128 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
129 |
Goal "u~v ==> regular(v) --> unmark(u) =1=> unmark(u|>v)"; |
1732 | 130 |
by (etac Scomp.induct 1); |
5527 | 131 |
by (auto_tac (claset(), |
132 |
simpset() addsimps [unmmark_subst_rec])); |
|
1048 | 133 |
by (dres_inst_tac [("psi", "Fun(?u) =1=> ?w")] asm_rl 1); |
5527 | 134 |
by Auto_tac; |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
135 |
qed_spec_mp "completeness_l"; |
1048 | 136 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5137
diff
changeset
|
137 |
Goal "[|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
|
138 |
by (dtac completeness_l 1); |
4091 | 139 |
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
|
140 |
qed "completeness"; |
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
141 |