3071
|
1 |
(* Title: HOLCF/IOA/meta_theory/RefCorrectness.ML
|
3275
|
2 |
ID: $Id$
|
3071
|
3 |
Author: Olaf Mueller
|
|
4 |
Copyright 1996 TU Muenchen
|
|
5 |
|
|
6 |
Correctness of Refinement Mappings in HOLCF/IOA
|
|
7 |
*)
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
(* -------------------------------------------------------------------------------- *)
|
|
12 |
|
|
13 |
section "corresp_ex";
|
|
14 |
|
|
15 |
|
|
16 |
(* ---------------------------------------------------------------- *)
|
|
17 |
(* corresp_ex2 *)
|
|
18 |
(* ---------------------------------------------------------------- *)
|
|
19 |
|
|
20 |
|
|
21 |
goal thy "corresp_ex2 A f = (LAM ex. (%s. case ex of \
|
|
22 |
\ nil => nil \
|
|
23 |
\ | x##xs => (flift1 (%pr. (snd(@cex. move A cex s (fst pr) (f (snd pr)))) \
|
|
24 |
\ @@ ((corresp_ex2 A f `xs) (f (snd pr)))) \
|
|
25 |
\ `x) ))";
|
|
26 |
by (rtac trans 1);
|
|
27 |
br fix_eq2 1;
|
|
28 |
br corresp_ex2_def 1;
|
|
29 |
br beta_cfun 1;
|
|
30 |
by (simp_tac (!simpset addsimps [flift1_def]) 1);
|
|
31 |
qed"corresp_ex2_unfold";
|
|
32 |
|
|
33 |
goal thy "(corresp_ex2 A f`UU) s=UU";
|
|
34 |
by (stac corresp_ex2_unfold 1);
|
|
35 |
by (Simp_tac 1);
|
|
36 |
qed"corresp_ex2_UU";
|
|
37 |
|
|
38 |
goal thy "(corresp_ex2 A f`nil) s = nil";
|
|
39 |
by (stac corresp_ex2_unfold 1);
|
|
40 |
by (Simp_tac 1);
|
|
41 |
qed"corresp_ex2_nil";
|
|
42 |
|
|
43 |
goal thy "(corresp_ex2 A f`(at>>xs)) s = \
|
|
44 |
\ (snd(@cex. move A cex s (fst at) (f (snd at)))) \
|
|
45 |
\ @@ ((corresp_ex2 A f`xs) (f (snd at)))";
|
|
46 |
br trans 1;
|
|
47 |
by (stac corresp_ex2_unfold 1);
|
|
48 |
by (asm_full_simp_tac (!simpset addsimps [Cons_def,flift1_def]) 1);
|
|
49 |
by (Simp_tac 1);
|
|
50 |
qed"corresp_ex2_cons";
|
|
51 |
|
|
52 |
|
|
53 |
Addsimps [corresp_ex2_UU,corresp_ex2_nil,corresp_ex2_cons];
|
|
54 |
|
|
55 |
|
|
56 |
|
|
57 |
(* ------------------------------------------------------------------ *)
|
|
58 |
(* The following lemmata describe the definition *)
|
|
59 |
(* of move in more detail *)
|
|
60 |
(* ------------------------------------------------------------------ *)
|
|
61 |
|
|
62 |
section"properties of move";
|
|
63 |
|
|
64 |
goalw thy [is_ref_map_def]
|
|
65 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
66 |
\ move A (@x. move A x (f s) a (f t)) (f s) a (f t)";
|
|
67 |
|
|
68 |
by (subgoal_tac "? ex.move A ex (f s) a (f t)" 1);
|
|
69 |
by (Asm_full_simp_tac 2);
|
|
70 |
by (etac exE 1);
|
|
71 |
by (rtac selectI 1);
|
|
72 |
by (assume_tac 1);
|
|
73 |
qed"move_is_move";
|
|
74 |
|
|
75 |
goal thy
|
|
76 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
77 |
\ is_execution_fragment A (@x. move A x (f s) a (f t))";
|
|
78 |
by (cut_inst_tac [] move_is_move 1);
|
|
79 |
by (REPEAT (assume_tac 1));
|
|
80 |
by (asm_full_simp_tac (!simpset addsimps [move_def]) 1);
|
|
81 |
qed"move_subprop1";
|
|
82 |
|
|
83 |
goal thy
|
|
84 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
85 |
\ Finite (snd (@x. move A x (f s) a (f t)))";
|
|
86 |
by (cut_inst_tac [] move_is_move 1);
|
|
87 |
by (REPEAT (assume_tac 1));
|
|
88 |
by (asm_full_simp_tac (!simpset addsimps [move_def]) 1);
|
|
89 |
qed"move_subprop2";
|
|
90 |
|
|
91 |
goal thy
|
|
92 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
93 |
\ fst (@x. move A x (f s) a (f t)) = (f s)";
|
|
94 |
by (cut_inst_tac [] move_is_move 1);
|
|
95 |
by (REPEAT (assume_tac 1));
|
|
96 |
by (asm_full_simp_tac (!simpset addsimps [move_def]) 1);
|
|
97 |
qed"move_subprop3";
|
|
98 |
|
|
99 |
goal thy
|
|
100 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
101 |
\ laststate (@x. move A x (f s) a (f t)) = (f t)";
|
|
102 |
by (cut_inst_tac [] move_is_move 1);
|
|
103 |
by (REPEAT (assume_tac 1));
|
|
104 |
by (asm_full_simp_tac (!simpset addsimps [move_def]) 1);
|
|
105 |
qed"move_subprop4";
|
|
106 |
|
|
107 |
goal thy
|
|
108 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
109 |
\ mk_trace A`(snd(@x. move A x (f s) a (f t))) = \
|
|
110 |
\ (if a:ext A then a>>nil else nil)";
|
|
111 |
|
|
112 |
by (cut_inst_tac [] move_is_move 1);
|
|
113 |
by (REPEAT (assume_tac 1));
|
|
114 |
by (asm_full_simp_tac (!simpset addsimps [move_def]) 1);
|
|
115 |
qed"move_subprop5";
|
|
116 |
|
|
117 |
goal thy
|
|
118 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
119 |
\ (is_execution_fragment A (f s,(snd (@x. move A x (f s) a (f t)))))";
|
|
120 |
by (cut_inst_tac [] move_subprop3 1);
|
|
121 |
by (REPEAT (assume_tac 1));
|
|
122 |
by (cut_inst_tac [] move_subprop1 1);
|
|
123 |
by (REPEAT (assume_tac 1));
|
|
124 |
by (res_inst_tac [("s","fst (@x. move A x (f s) a (f t))")] subst 1);
|
|
125 |
back();
|
|
126 |
back();
|
|
127 |
back();
|
|
128 |
ba 1;
|
|
129 |
by (simp_tac (HOL_basic_ss addsimps [surjective_pairing RS sym]) 1);
|
|
130 |
qed"move_subprop_1and3";
|
|
131 |
|
|
132 |
goal thy
|
|
133 |
"!!f. [|is_ref_map f C A; reachable C s; (s,a,t):trans_of C|] ==>\
|
|
134 |
\ (case Last`(snd (@x. move A x (f s) a (f t))) of \
|
|
135 |
\ Undef => (f s) \
|
|
136 |
\ | Def p => snd p) = (f t)";
|
|
137 |
by (cut_inst_tac [] move_subprop3 1);
|
|
138 |
by (REPEAT (assume_tac 1));
|
|
139 |
by (cut_inst_tac [] move_subprop4 1);
|
|
140 |
by (REPEAT (assume_tac 1));
|
|
141 |
by (asm_full_simp_tac (!simpset addsimps [laststate_def]) 1);
|
|
142 |
qed"move_subprop_4and3";
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
(* ------------------------------------------------------------------ *)
|
|
147 |
(* The following lemmata contribute to *)
|
|
148 |
(* TRACE INCLUSION Part 1: Traces coincide *)
|
|
149 |
(* ------------------------------------------------------------------ *)
|
|
150 |
|
|
151 |
section "Lemmata for <==";
|
|
152 |
|
|
153 |
(* --------------------------------------------------- *)
|
|
154 |
(* Lemma 1.1: Distribution of mk_trace and @@ *)
|
|
155 |
(* --------------------------------------------------- *)
|
|
156 |
|
|
157 |
|
|
158 |
goal thy "mk_trace C`(ex1 @@ ex2)= (mk_trace C`ex1) @@ (mk_trace C`ex2)";
|
|
159 |
by (simp_tac (!simpset addsimps [mk_trace_def,filter_act_def,
|
|
160 |
FilterConc,MapConc]) 1);
|
|
161 |
qed"mk_traceConc";
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
(* ------------------------------------------------------
|
|
166 |
Lemma 1 :Traces coincide
|
|
167 |
------------------------------------------------------- *)
|
|
168 |
|
|
169 |
goalw thy [corresp_ex_def]
|
|
170 |
"!!f.[|is_ref_map f C A; ext C = ext A|] ==> \
|
|
171 |
\ !s. reachable C s & is_execution_fragment C (s,xs) --> \
|
|
172 |
\ mk_trace C`xs = mk_trace A`(snd (corresp_ex A f (s,xs)))";
|
|
173 |
|
|
174 |
by (pair_induct_tac "xs" [is_execution_fragment_def] 1);
|
|
175 |
(* cons case *)
|
|
176 |
by (safe_tac set_cs);
|
|
177 |
by (asm_full_simp_tac (!simpset addsimps [mk_traceConc]) 1);
|
|
178 |
by (forward_tac [reachable.reachable_n] 1);
|
|
179 |
ba 1;
|
|
180 |
by (eres_inst_tac [("x","y")] allE 1);
|
|
181 |
by (Asm_full_simp_tac 1);
|
|
182 |
by (asm_full_simp_tac (!simpset addsimps [move_subprop5]
|
|
183 |
setloop split_tac [expand_if] ) 1);
|
|
184 |
qed"lemma_1";
|
|
185 |
|
|
186 |
|
|
187 |
(* ------------------------------------------------------------------ *)
|
|
188 |
(* The following lemmata contribute to *)
|
|
189 |
(* TRACE INCLUSION Part 2: corresp_ex is execution *)
|
|
190 |
(* ------------------------------------------------------------------ *)
|
|
191 |
|
|
192 |
section "Lemmata for ==>";
|
|
193 |
|
|
194 |
(* -------------------------------------------------- *)
|
|
195 |
(* Lemma 2.1 *)
|
|
196 |
(* -------------------------------------------------- *)
|
|
197 |
|
|
198 |
goal thy
|
|
199 |
"Finite xs --> \
|
|
200 |
\(!s .is_execution_fragment A (s,xs) & is_execution_fragment A (t,ys) & \
|
|
201 |
\ t = laststate (s,xs) \
|
|
202 |
\ --> is_execution_fragment A (s,xs @@ ys))";
|
|
203 |
|
|
204 |
br impI 1;
|
|
205 |
by (Seq_Finite_induct_tac 1);
|
|
206 |
(* base_case *)
|
|
207 |
by (fast_tac HOL_cs 1);
|
|
208 |
(* main case *)
|
|
209 |
by (safe_tac set_cs);
|
|
210 |
by (pair_tac "a" 1);
|
|
211 |
qed"lemma_2_1";
|
|
212 |
|
|
213 |
|
|
214 |
(* ----------------------------------------------------------- *)
|
|
215 |
(* Lemma 2 : corresp_ex is execution *)
|
|
216 |
(* ----------------------------------------------------------- *)
|
|
217 |
|
|
218 |
|
|
219 |
|
|
220 |
goalw thy [corresp_ex_def]
|
|
221 |
"!!f.[| is_ref_map f C A |] ==>\
|
|
222 |
\ !s. reachable C s & is_execution_fragment C (s,xs) \
|
|
223 |
\ --> is_execution_fragment A (corresp_ex A f (s,xs))";
|
|
224 |
|
|
225 |
by (Asm_full_simp_tac 1);
|
|
226 |
by (pair_induct_tac "xs" [is_execution_fragment_def] 1);
|
|
227 |
(* main case *)
|
|
228 |
by (safe_tac set_cs);
|
|
229 |
by (res_inst_tac [("t3","f y")] (lemma_2_1 RS mp RS spec RS mp) 1);
|
|
230 |
|
|
231 |
(* Finite *)
|
|
232 |
be move_subprop2 1;
|
|
233 |
by (REPEAT (atac 1));
|
|
234 |
by (rtac conjI 1);
|
|
235 |
|
|
236 |
(* is_execution_fragment *)
|
|
237 |
be move_subprop_1and3 1;
|
|
238 |
by (REPEAT (atac 1));
|
|
239 |
by (rtac conjI 1);
|
|
240 |
|
|
241 |
(* Induction hypothesis *)
|
|
242 |
(* reachable_n looping, therefore apply it manually *)
|
|
243 |
by (eres_inst_tac [("x","y")] allE 1);
|
|
244 |
by (Asm_full_simp_tac 1);
|
|
245 |
by (forward_tac [reachable.reachable_n] 1);
|
|
246 |
ba 1;
|
|
247 |
by (Asm_full_simp_tac 1);
|
|
248 |
(* laststate *)
|
|
249 |
by (simp_tac (!simpset addsimps [laststate_def]) 1);
|
|
250 |
be (move_subprop_4and3 RS sym) 1;
|
|
251 |
by (REPEAT (atac 1));
|
|
252 |
qed"lemma_2";
|
|
253 |
|
|
254 |
|
|
255 |
(* -------------------------------------------------------------------------------- *)
|
|
256 |
|
|
257 |
section "Main Theorem: T R A C E - I N C L U S I O N";
|
|
258 |
|
|
259 |
(* -------------------------------------------------------------------------------- *)
|
|
260 |
|
|
261 |
|
|
262 |
goalw thy [traces_def]
|
|
263 |
"!!f. [| IOA C; IOA A; ext C = ext A; is_ref_map f C A |] \
|
|
264 |
\ ==> traces C <= traces A";
|
|
265 |
|
|
266 |
by (simp_tac(!simpset addsimps [has_trace_def2])1);
|
|
267 |
by (safe_tac set_cs);
|
|
268 |
|
|
269 |
(* give execution of abstract automata *)
|
|
270 |
by (res_inst_tac[("x","corresp_ex A f ex")] bexI 1);
|
|
271 |
|
|
272 |
(* Traces coincide, Lemma 1 *)
|
|
273 |
by (pair_tac "ex" 1);
|
|
274 |
by (etac (lemma_1 RS spec RS mp) 1);
|
|
275 |
by (REPEAT (atac 1));
|
|
276 |
by (asm_full_simp_tac (!simpset addsimps [executions_def,reachable.reachable_0]) 1);
|
|
277 |
|
|
278 |
(* corresp_ex is execution, Lemma 2 *)
|
|
279 |
by (pair_tac "ex" 1);
|
|
280 |
by (asm_full_simp_tac (!simpset addsimps [executions_def]) 1);
|
|
281 |
(* start state *)
|
|
282 |
by (rtac conjI 1);
|
|
283 |
by (asm_full_simp_tac (!simpset addsimps [is_ref_map_def,corresp_ex_def]) 1);
|
|
284 |
(* is-execution-fragment *)
|
|
285 |
by (etac (lemma_2 RS spec RS mp) 1);
|
|
286 |
by (asm_full_simp_tac (!simpset addsimps [reachable.reachable_0]) 1);
|
|
287 |
qed"trace_inclusion";
|
|
288 |
|
|
289 |
|
|
290 |
|
|
291 |
|
|
292 |
|