author | paulson |
Thu, 11 Nov 1999 10:24:14 +0100 | |
changeset 8004 | 6273f58ea2c1 |
parent 6154 | 6a00a5baef2b |
child 11319 | 8b84ee2cc79c |
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 |
||
6154
6a00a5baef2b
automatic insertion of datatype intr rules into claset
paulson
parents:
6141
diff
changeset
|
12 |
AddIs (Sres.intrs @ Sreg.intrs @ [subst_type]); |
6141 | 13 |
AddSEs (map Sres.mk_cases |
2469 | 14 |
["residuals(Var(n),Var(n),v)", |
15 |
"residuals(Fun(t),Fun(u),v)", |
|
16 |
"residuals(App(b, u1, u2), App(0, v1, v2),v)", |
|
17 |
"residuals(App(b, u1, u2), App(1, Fun(v1), v2),v)", |
|
18 |
"residuals(Var(n),u,v)", |
|
19 |
"residuals(Fun(t),u,v)", |
|
20 |
"residuals(App(b, u1, u2), w,v)", |
|
21 |
"residuals(u,Var(n),v)", |
|
22 |
"residuals(u,Fun(t),v)", |
|
6141 | 23 |
"residuals(w,App(b, u1, u2),v)"]); |
24 |
||
25 |
AddSEs (map Ssub.mk_cases |
|
2469 | 26 |
["Var(n) <== u", |
27 |
"Fun(n) <== u", |
|
28 |
"u <== Fun(n)", |
|
29 |
"App(1,Fun(t),a) <== u", |
|
6141 | 30 |
"App(0,t,a) <== u"]); |
31 |
||
32 |
AddSEs [redexes.mk_cases "Fun(t):redexes"]; |
|
1048 | 33 |
|
2469 | 34 |
Addsimps Sres.intrs; |
6141 | 35 |
val resD1 = Sres.dom_subset RS subsetD RS SigmaD1; |
36 |
val resD2 = Sres.dom_subset RS subsetD RS SigmaD2 RS SigmaD1; |
|
37 |
val resD3 = Sres.dom_subset RS subsetD RS SigmaD2 RS SigmaD2; |
|
1048 | 38 |
|
39 |
||
40 |
(* ------------------------------------------------------------------------- *) |
|
41 |
(* residuals is a partial function *) |
|
42 |
(* ------------------------------------------------------------------------- *) |
|
43 |
||
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
44 |
Goal "residuals(u,v,w) ==> ALL w1. residuals(u,v,w1) --> w1 = w"; |
1732 | 45 |
by (etac Sres.induct 1); |
6141 | 46 |
by (ALLGOALS Force_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
47 |
qed_spec_mp "residuals_function"; |
1048 | 48 |
|
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
49 |
Goal "u~v ==> regular(v) --> (EX w. residuals(u,v,w))"; |
1732 | 50 |
by (etac Scomp.induct 1); |
2469 | 51 |
by (ALLGOALS Fast_tac); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
52 |
qed "residuals_intro"; |
1048 | 53 |
|
6046 | 54 |
Goal "[| u~v; regular(v) |] ==> residuals(u,v,THE w. residuals(u, v, w))"; |
1048 | 55 |
by (resolve_tac [residuals_intro RS mp RS exE] 1); |
5505 | 56 |
by (stac the_equality 3); |
57 |
by (ALLGOALS (blast_tac (claset() addIs [residuals_function]))); |
|
6046 | 58 |
qed "comp_resfuncD"; |
1048 | 59 |
|
60 |
||
61 |
(* ------------------------------------------------------------------------- *) |
|
62 |
(* Residual function *) |
|
63 |
(* ------------------------------------------------------------------------- *) |
|
64 |
||
6046 | 65 |
Goalw [res_func_def] "n:nat ==> Var(n) |> Var(n) = Var(n)"; |
5505 | 66 |
by (Blast_tac 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
67 |
qed "res_Var"; |
1048 | 68 |
|
5068 | 69 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
70 |
"[|s~t; regular(t)|]==> Fun(s) |> Fun(t) = Fun(s |> t)"; |
6046 | 71 |
by (blast_tac (claset() addSDs [comp_resfuncD] |
5505 | 72 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
73 |
qed "res_Fun"; |
1048 | 74 |
|
5068 | 75 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
76 |
"[|s~u; regular(u); t~v; regular(v); b:bool|]==> \ |
1048 | 77 |
\ App(b,s,t) |> App(0,u,v) = App(b, s |> u, t |> v)"; |
6046 | 78 |
by (blast_tac (claset() addSDs [comp_resfuncD] |
5505 | 79 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
80 |
qed "res_App"; |
1048 | 81 |
|
5068 | 82 |
Goalw [res_func_def] |
5147
825877190618
More tidying and removal of "\!\!... from Goal commands
paulson
parents:
5068
diff
changeset
|
83 |
"[|s~u; regular(u); t~v; regular(v); b:bool|]==> \ |
1048 | 84 |
\ App(b,Fun(s),t) |> App(1,Fun(u),v) = (t |> v)/ (s |> u)"; |
6141 | 85 |
by (blast_tac (claset() addSEs redexes.free_SEs |
86 |
addSDs [comp_resfuncD] |
|
5505 | 87 |
addIs [residuals_function]) 1); |
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
88 |
qed "res_redex"; |
1048 | 89 |
|
5268 | 90 |
Goal "[|s~t; regular(t)|]==> regular(t) --> s |> t:redexes"; |
1732 | 91 |
by (etac Scomp.induct 1); |
5527 | 92 |
by (auto_tac (claset(), |
93 |
simpset() addsimps [res_Var,res_Fun,res_App,res_redex])); |
|
1048 | 94 |
by (dres_inst_tac [("psi", "Fun(?u) |> ?v : redexes")] asm_rl 1); |
5527 | 95 |
by (auto_tac (claset(), |
96 |
simpset() addsimps [res_Fun])); |
|
3734
33f355f56f82
Much tidying including "qed" instead of result(), and even qed_spec_mp,
paulson
parents:
2469
diff
changeset
|
97 |
qed "resfunc_type"; |
1048 | 98 |
|
6046 | 99 |
Addsimps [res_Var, res_Fun, res_App, res_redex, lift_rec_preserve_comp, |
2469 | 100 |
lift_rec_preserve_reg, subst_rec_preserve_comp, resfunc_type, |
6046 | 101 |
subst_rec_preserve_reg]; |
102 |
||
1048 | 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"; |