author | paulson |
Mon, 28 Dec 1998 16:54:01 +0100 | |
changeset 6046 | 2c8a8be36c94 |
parent 5758 | 27a2b36efd95 |
child 6141 | a6922171b396 |
permissions | -rw-r--r-- |
1461 | 1 |
(* Title: Residuals.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 rule lists *) |
|
10 |
(* ------------------------------------------------------------------------- *) |
|
11 |
||
5527 | 12 |
AddIs (Sres.intrs @ redexes.intrs @ Sreg.intrs @ [subst_type]); |
2469 | 13 |
AddSEs (redexes.free_SEs @ |
14 |
(map (Sres.mk_cases redexes.con_defs) |
|
15 |
["residuals(Var(n),Var(n),v)", |
|
16 |
"residuals(Fun(t),Fun(u),v)", |
|
17 |
"residuals(App(b, u1, u2), App(0, v1, v2),v)", |
|
18 |
"residuals(App(b, u1, u2), App(1, Fun(v1), v2),v)", |
|
19 |
"residuals(Var(n),u,v)", |
|
20 |
"residuals(Fun(t),u,v)", |
|
21 |
"residuals(App(b, u1, u2), w,v)", |
|
22 |
"residuals(u,Var(n),v)", |
|
23 |
"residuals(u,Fun(t),v)", |
|
24 |
"residuals(w,App(b, u1, u2),v)"]) @ |
|
25 |
(map (Ssub.mk_cases redexes.con_defs) |
|
26 |
["Var(n) <== u", |
|
27 |
"Fun(n) <== u", |
|
28 |
"u <== Fun(n)", |
|
29 |
"App(1,Fun(t),a) <== u", |
|
30 |
"App(0,t,a) <== u"]) @ |
|
31 |
[redexes.mk_cases redexes.con_defs "Fun(t):redexes"]); |
|
1048 | 32 |
|
2469 | 33 |
Addsimps Sres.intrs; |
1048 | 34 |
val resD1 =Sres.dom_subset RS subsetD RS SigmaD1; |
35 |
val resD2 =Sres.dom_subset RS subsetD RS SigmaD2 RS SigmaD1; |
|
36 |
val resD3 =Sres.dom_subset RS subsetD RS SigmaD2 RS SigmaD2; |
|
37 |
||
38 |
||
39 |
(* ------------------------------------------------------------------------- *) |
|
40 |
(* residuals is a partial function *) |
|
41 |
(* ------------------------------------------------------------------------- *) |
|
42 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
43 |
Goal "residuals(u,v,w) ==> ALL w1. residuals(u,v,w1) --> w1 = w"; |
1732 | 44 |
by (etac Sres.induct 1); |
2469 | 45 |
by (ALLGOALS Fast_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
46 |
qed_spec_mp "residuals_function"; |
1048 | 47 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
48 |
Goal "u~v ==> regular(v) --> (EX w. residuals(u,v,w))"; |
1732 | 49 |
by (etac Scomp.induct 1); |
2469 | 50 |
by (ALLGOALS Fast_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
51 |
qed "residuals_intro"; |
1048 | 52 |
|
6046 | 53 |
Goal "[| u~v; regular(v) |] ==> residuals(u,v,THE w. residuals(u, v, w))"; |
1048 | 54 |
by (resolve_tac [residuals_intro RS mp RS exE] 1); |
5505 | 55 |
by (stac the_equality 3); |
56 |
by (ALLGOALS (blast_tac (claset() addIs [residuals_function]))); |
|
6046 | 57 |
qed "comp_resfuncD"; |
1048 | 58 |
|
59 |
||
60 |
(* ------------------------------------------------------------------------- *) |
|
61 |
(* Residual function *) |
|
62 |
(* ------------------------------------------------------------------------- *) |
|
63 |
||
6046 | 64 |
Goalw [res_func_def] "n:nat ==> Var(n) |> Var(n) = Var(n)"; |
5505 | 65 |
by (Blast_tac 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
66 |
qed "res_Var"; |
1048 | 67 |
|
5068 | 68 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
69 |
"[|s~t; regular(t)|]==> Fun(s) |> Fun(t) = Fun(s |> t)"; |
6046 | 70 |
by (blast_tac (claset() addSDs [comp_resfuncD] |
5505 | 71 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
72 |
qed "res_Fun"; |
1048 | 73 |
|
5068 | 74 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
75 |
"[|s~u; regular(u); t~v; regular(v); b:bool|]==> \ |
1048 | 76 |
\ App(b,s,t) |> App(0,u,v) = App(b, s |> u, t |> v)"; |
6046 | 77 |
by (blast_tac (claset() addSDs [comp_resfuncD] |
5505 | 78 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
79 |
qed "res_App"; |
1048 | 80 |
|
5068 | 81 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
82 |
"[|s~u; regular(u); t~v; regular(v); b:bool|]==> \ |
1048 | 83 |
\ App(b,Fun(s),t) |> App(1,Fun(u),v) = (t |> v)/ (s |> u)"; |
6046 | 84 |
by (blast_tac (claset() addSDs [comp_resfuncD] |
5505 | 85 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
86 |
qed "res_redex"; |
1048 | 87 |
|
5268 | 88 |
Goal "[|s~t; regular(t)|]==> regular(t) --> s |> t:redexes"; |
1732 | 89 |
by (etac Scomp.induct 1); |
5527 | 90 |
by (auto_tac (claset(), |
91 |
simpset() addsimps [res_Var,res_Fun,res_App,res_redex])); |
|
1048 | 92 |
by (dres_inst_tac [("psi", "Fun(?u) |> ?v : redexes")] asm_rl 1); |
5527 | 93 |
by (auto_tac (claset(), |
94 |
simpset() addsimps [res_Fun])); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
95 |
qed "resfunc_type"; |
1048 | 96 |
|
6046 | 97 |
Addsimps [res_Var, res_Fun, res_App, res_redex, lift_rec_preserve_comp, |
2469 | 98 |
lift_rec_preserve_reg, subst_rec_preserve_comp, resfunc_type, |
6046 | 99 |
subst_rec_preserve_reg]; |
100 |
||
101 |
Addsimps redexes.free_iffs; |
|
1048 | 102 |
|
103 |
||
104 |
(* ------------------------------------------------------------------------- *) |
|
105 |
(* Commutation theorem *) |
|
106 |
(* ------------------------------------------------------------------------- *) |
|
107 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
108 |
Goal "u<==v ==> u~v"; |
1732 | 109 |
by (etac Ssub.induct 1); |
2469 | 110 |
by (ALLGOALS Asm_simp_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
111 |
qed "sub_comp"; |
1048 | 112 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
113 |
Goal "u<==v ==> regular(v) --> regular(u)"; |
1732 | 114 |
by (etac Ssub.induct 1); |
5527 | 115 |
by Auto_tac; |
116 |
qed_spec_mp "sub_preserve_reg"; |
|
1048 | 117 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
118 |
Goal "[|u~v; k:nat|]==> regular(v)--> (ALL n:nat. \ |
1048 | 119 |
\ lift_rec(u,n) |> lift_rec(v,n) = lift_rec(u |> v,n))"; |
1732 | 120 |
by (etac Scomp.induct 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
121 |
by Safe_tac; |
5527 | 122 |
by (ALLGOALS |
6046 | 123 |
(asm_full_simp_tac |
5527 | 124 |
(simpset() addsimps [lift_rec_Var,subst_Var,lift_subst]))); |
125 |
by (rotate_tac ~2 1); |
|
2469 | 126 |
by (Asm_full_simp_tac 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
127 |
qed "residuals_lift_rec"; |
1048 | 128 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
129 |
Goal "u1~u2 ==> ALL v1 v2. v1~v2 --> regular(v2) --> regular(u2) -->\ |
3840 | 130 |
\ (ALL n:nat. subst_rec(v1,u1,n) |> subst_rec(v2,u2,n) = \ |
1048 | 131 |
\ subst_rec(v1 |> v2, u1 |> u2,n))"; |
1732 | 132 |
by (etac Scomp.induct 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
133 |
by Safe_tac; |
1048 | 134 |
by (ALLGOALS |
5527 | 135 |
(asm_simp_tac |
136 |
(simpset() addsimps [lift_rec_Var,subst_Var,residuals_lift_rec]))); |
|
1048 | 137 |
by (dres_inst_tac [("psi", "ALL x.?P(x)")] asm_rl 1); |
5527 | 138 |
by (asm_full_simp_tac (simpset() addsimps [substitution]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
139 |
qed "residuals_subst_rec"; |
1048 | 140 |
|
141 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
142 |
Goal "[|u1~u2; v1~v2; regular(u2); regular(v2)|]==>\ |
1048 | 143 |
\ (v1/u1) |> (v2/u2) = (v1 |> v2)/(u1 |> u2)"; |
5527 | 144 |
by (asm_simp_tac (simpset() addsimps [residuals_subst_rec]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
145 |
qed "commutation"; |
1048 | 146 |
|
147 |
(* ------------------------------------------------------------------------- *) |
|
148 |
(* Residuals are comp and regular *) |
|
149 |
(* ------------------------------------------------------------------------- *) |
|
150 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
151 |
Goal "u~v ==> ALL w. u~w --> v~w --> regular(w) --> (u|>w) ~ (v|>w)"; |
1732 | 152 |
by (etac Scomp.induct 1); |
5758
27a2b36efd95
corrected auto_tac (applications of unsafe wrappers)
oheimb
parents:
5527
diff
changeset
|
153 |
by (ALLGOALS Force_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
154 |
qed_spec_mp "residuals_preserve_comp"; |
1048 | 155 |
|
156 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
157 |
Goal "u~v ==> regular(u) --> regular(v) --> regular(u|>v)"; |
1732 | 158 |
by (etac Scomp.induct 1); |
4152 | 159 |
by Safe_tac; |
1048 | 160 |
by (TRYALL (dres_inst_tac [("psi", "regular(Fun(?u) |> ?v)")] asm_rl)); |
5527 | 161 |
by Auto_tac; |
162 |
qed_spec_mp "residuals_preserve_reg"; |
|
1048 | 163 |
|
164 |
(* ------------------------------------------------------------------------- *) |
|
165 |
(* Preservation lemma *) |
|
166 |
(* ------------------------------------------------------------------------- *) |
|
167 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
168 |
Goal "u~v ==> v ~ (u un v)"; |
1732 | 169 |
by (etac Scomp.induct 1); |
5527 | 170 |
by (ALLGOALS Asm_simp_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
171 |
qed "union_preserve_comp"; |
1048 | 172 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
173 |
Goal "u ~ v ==> regular(v) --> u|>v = (u un v)|>v"; |
1732 | 174 |
by (etac Scomp.induct 1); |
4152 | 175 |
by Safe_tac; |
1048 | 176 |
by (dres_inst_tac [("psi", "Fun(?u) |> ?v = ?w")] asm_rl 3); |
5527 | 177 |
by (auto_tac (claset(), |
178 |
simpset() addsimps [union_preserve_comp,comp_sym_iff])); |
|
4091 | 179 |
by (asm_full_simp_tac (simpset() addsimps |
1461 | 180 |
[union_preserve_comp RS comp_sym, |
181 |
comp_sym RS union_preserve_comp RS comp_sym]) 1); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
182 |
qed_spec_mp "preservation"; |