55 Goal "h(x,y) = h(x',y') ==> x=x'"; |
66 Goal "h(x,y) = h(x',y') ==> x=x'"; |
56 by (dres_inst_tac [("f", "fst o inv h")] arg_cong 1); |
67 by (dres_inst_tac [("f", "fst o inv h")] arg_cong 1); |
57 (*FIXME: If locales worked properly we could put just "f" above*) |
68 (*FIXME: If locales worked properly we could put just "f" above*) |
58 by (full_simp_tac (simpset() addsimps [f_def, good_h RS conjunct2]) 1); |
69 by (full_simp_tac (simpset() addsimps [f_def, good_h RS conjunct2]) 1); |
59 qed "h_inject1"; |
70 qed "h_inject1"; |
60 AddSDs [h_inject1]; |
71 AddDs [h_inject1]; |
61 |
72 |
62 Goal "h(f z, g z) = z"; |
73 Goal "h(f z, g z) = z"; |
63 by (simp_tac (simpset() addsimps [f_def, g_def, surjective_pairing RS sym, |
74 by (simp_tac (simpset() addsimps [f_def, g_def, surjective_pairing RS sym, |
64 surj_h RS surj_f_inv_f]) 1); |
75 surj_h RS surj_f_inv_f]) 1); |
65 qed "h_f_g_eq"; |
76 qed "h_f_g_eq"; |
|
77 |
|
78 |
|
79 (** A sequence of proof steps borrowed from Provers/split_paired_all.ML **) |
|
80 |
|
81 val cT = TFree ("'c", ["term"]); |
|
82 |
|
83 (* "PROP P x == PROP P (h (f x, g x))" *) |
|
84 val lemma1 = Thm.combination |
|
85 (Thm.reflexive (cterm_of (sign_of thy) (Free ("P", cT --> propT)))) |
|
86 (Drule.unvarify (h_f_g_eq RS sym RS eq_reflection)); |
|
87 |
|
88 val prems = Goalw [lemma1] "(!!u y. PROP P (h (u, y))) ==> PROP P x"; |
|
89 by (resolve_tac prems 1); |
|
90 val lemma2 = result(); |
|
91 |
|
92 val prems = Goal "(!!u y. PROP P (h (u, y))) ==> (!!z. PROP P z)"; |
|
93 by (rtac lemma2 1); |
|
94 by (resolve_tac prems 1); |
|
95 val lemma3 = result(); |
|
96 |
|
97 val prems = Goal "(!!z. PROP P z) ==> (!!u y. PROP P (h (u, y)))"; |
|
98 (*not needed for proof, but prevents generalization over h, 'c, etc.*) |
|
99 by (cut_facts_tac [surj_h] 1); |
|
100 by (resolve_tac prems 1); |
|
101 val lemma4 = result(); |
|
102 |
|
103 val split_extended_all = Thm.equal_intr lemma4 lemma3; |
|
104 |
66 |
105 |
67 (*** extend_set: basic properties ***) |
106 (*** extend_set: basic properties ***) |
68 |
107 |
69 Goalw [extend_set_def] "A<=B ==> extend_set h A <= extend_set h B"; |
108 Goalw [extend_set_def] "A<=B ==> extend_set h A <= extend_set h B"; |
70 by (Blast_tac 1); |
109 by (Blast_tac 1); |
99 by (rtac inj_on_inverseI 1); |
138 by (rtac inj_on_inverseI 1); |
100 by (rtac extend_set_inverse 1); |
139 by (rtac extend_set_inverse 1); |
101 qed "inj_extend_set"; |
140 qed "inj_extend_set"; |
102 |
141 |
103 Goalw [extend_set_def] "extend_set h UNIV = UNIV"; |
142 Goalw [extend_set_def] "extend_set h UNIV = UNIV"; |
104 by Auto_tac; |
143 by (auto_tac (claset(), |
105 by (res_inst_tac [("y1", "x")] (surj_h RS surjD RS exE) 1); |
144 simpset() addsimps [split_extended_all])); |
106 by Auto_tac; |
|
107 qed "extend_set_UNIV_eq"; |
145 qed "extend_set_UNIV_eq"; |
108 Addsimps [standard extend_set_UNIV_eq]; |
146 Addsimps [standard extend_set_UNIV_eq]; |
109 |
147 |
110 (*** project_set: basic properties ***) |
148 (*** project_set: basic properties ***) |
111 |
149 |
112 (*project_set is simply image!*) |
150 (*project_set is simply image!*) |
113 Goalw [project_set_def] "project_set h C = f `` C"; |
151 Goalw [project_set_def] "project_set h C = f `` C"; |
114 by (auto_tac (claset() addIs [f_h_eq RS sym, h_f_g_eq RS ssubst], |
152 by (auto_tac (claset() addIs [f_h_eq RS sym], |
115 simpset())); |
153 simpset() addsimps [split_extended_all])); |
116 qed "project_set_eq"; |
154 qed "project_set_eq"; |
117 |
155 |
118 (*Converse appears to fail*) |
156 (*Converse appears to fail*) |
119 Goalw [project_set_def] "z : C ==> f z : project_set h C"; |
157 Goalw [project_set_def] "!!z. z : C ==> f z : project_set h C"; |
120 by (auto_tac (claset() addIs [h_f_g_eq RS ssubst], |
158 by (auto_tac (claset(), |
121 simpset())); |
159 simpset() addsimps [split_extended_all])); |
122 qed "project_set_I"; |
160 qed "project_set_I"; |
123 |
161 |
124 |
162 |
125 (*** More laws ***) |
163 (*** More laws ***) |
126 |
164 |
158 qed "extend_set_subset_Compl_eq"; |
196 qed "extend_set_subset_Compl_eq"; |
159 |
197 |
160 |
198 |
161 (*** extend_act ***) |
199 (*** extend_act ***) |
162 |
200 |
163 (*Actions could affect the g-part, so result Cannot be strengthened to |
|
164 ((z, z') : extend_act h act) = ((f z, f z') : act) |
|
165 *) |
|
166 Goalw [extend_act_def] |
201 Goalw [extend_act_def] |
167 "((h(s,y), h(s',y)) : extend_act h act) = ((s, s') : act)"; |
202 "((h(s,y), h(s',y)) : extend_act h act) = ((s, s') : act)"; |
168 by Auto_tac; |
203 by Auto_tac; |
169 qed "mem_extend_act_iff"; |
204 qed "mem_extend_act_iff"; |
170 AddIffs [mem_extend_act_iff]; |
205 AddIffs [mem_extend_act_iff]; |
171 |
206 |
|
207 (*Converse fails: (z,z') would include actions that changed the g-part*) |
172 Goalw [extend_act_def] |
208 Goalw [extend_act_def] |
173 "(z, z') : extend_act h act ==> (f z, f z') : act"; |
209 "(z, z') : extend_act h act ==> (f z, f z') : act"; |
174 by Auto_tac; |
210 by Auto_tac; |
175 qed "extend_act_D"; |
211 qed "extend_act_D"; |
176 |
212 |
|
213 Goalw [extend_act_def, project_act_def, project_set_def] |
|
214 "project_act h (Restrict C (extend_act h act)) = \ |
|
215 \ Restrict (project_set h C) act"; |
|
216 by (Blast_tac 1); |
|
217 qed "project_act_extend_act_restrict"; |
|
218 Addsimps [project_act_extend_act_restrict]; |
|
219 |
|
220 Goalw [extend_act_def, project_act_def, project_set_def] |
|
221 "(Restrict C (extend_act h act) = Restrict C (extend_act h act')) \ |
|
222 \ = (Restrict (project_set h C) act = Restrict (project_set h C) act')"; |
|
223 by Auto_tac; |
|
224 by (ALLGOALS (blast_tac (claset() addSEs [equalityE]))); |
|
225 qed "Restrict_extend_act_eq_Restrict_project_act"; |
|
226 |
177 (*Premise is still undesirably strong, since Domain act can include |
227 (*Premise is still undesirably strong, since Domain act can include |
178 non-reachable states, but it seems necessary for this result.*) |
228 non-reachable states, but it seems necessary for this result.*) |
179 Goalw [extend_act_def, project_set_def, project_act_def] |
229 Goal "Domain act <= project_set h C \ |
180 "Domain act <= project_set h C ==> project_act C h (extend_act h act) = act"; |
230 \ ==> project_act h (Restrict C (extend_act h act)) = act"; |
181 by (Force_tac 1); |
231 by (asm_simp_tac (simpset() addsimps [Restrict_triv]) 1); |
182 qed "extend_act_inverse"; |
232 qed "extend_act_inverse"; |
183 Addsimps [extend_act_inverse]; |
233 |
184 |
|
185 (*By subset_refl, a corollary is project_act C h (extend_act h act) <= act*) |
|
186 Goalw [extend_act_def, project_act_def] |
234 Goalw [extend_act_def, project_act_def] |
187 "act' <= extend_act h act ==> project_act C h act' <= act"; |
235 "act' <= extend_act h act ==> project_act h act' <= act"; |
188 by (Force_tac 1); |
236 by (Force_tac 1); |
189 qed "subset_extend_act_D"; |
237 qed "subset_extend_act_D"; |
190 |
238 |
191 Goal "inj (extend_act h)"; |
239 Goal "inj (extend_act h)"; |
192 by (rtac inj_on_inverseI 1); |
240 by (rtac inj_on_inverseI 1); |
216 "extend_act h Id = Id"; |
264 "extend_act h Id = Id"; |
217 by (force_tac (claset() addIs [h_f_g_eq RS sym], simpset()) 1); |
265 by (force_tac (claset() addIs [h_f_g_eq RS sym], simpset()) 1); |
218 qed "extend_act_Id"; |
266 qed "extend_act_Id"; |
219 |
267 |
220 Goalw [project_act_def] |
268 Goalw [project_act_def] |
221 "[| (z, z') : act; z: C |] \ |
269 "!!z z'. (z, z') : act ==> (f z, f z') : project_act h act"; |
222 \ ==> (f z, f z') : project_act C h act"; |
270 by (force_tac (claset(), |
223 by (auto_tac (claset() addSIs [exI] addIs [h_f_g_eq RS ssubst], |
271 simpset() addsimps [split_extended_all]) 1); |
224 simpset())); |
|
225 qed "project_act_I"; |
272 qed "project_act_I"; |
226 |
273 |
227 Goalw [project_set_def, project_act_def] |
274 Goalw [project_set_def, project_act_def] |
228 "UNIV <= project_set h C ==> project_act C h Id = Id"; |
275 "UNIV <= project_set h C ==> project_act h (Restrict C Id) = Id"; |
229 by (Force_tac 1); |
276 by (Force_tac 1); |
230 qed "project_act_Id"; |
277 qed "project_act_Id"; |
231 |
278 |
232 Goalw [project_set_def, project_act_def] |
279 Goalw [project_set_def, project_act_def] |
233 "Domain (project_act C h act) = project_set h (Domain act Int C)"; |
280 "Domain (project_act h (Restrict C act)) = project_set h (Domain act Int C)"; |
234 by Auto_tac; |
281 by (force_tac (claset(), |
235 by (res_inst_tac [("y1", "ya")] (surj_h RS surjD RS exE) 1); |
282 simpset() addsimps [split_extended_all]) 1); |
236 by Auto_tac; |
|
237 qed "Domain_project_act"; |
283 qed "Domain_project_act"; |
238 |
284 |
239 Addsimps [extend_act_Id, project_act_Id]; |
285 Addsimps [extend_act_Id, project_act_Id]; |
240 |
286 |
241 Goal "(extend_act h act = Id) = (act = Id)"; |
287 Goal "(extend_act h act = Id) = (act = Id)"; |
277 Goalw [SKIP_def] "extend h SKIP = SKIP"; |
323 Goalw [SKIP_def] "extend h SKIP = SKIP"; |
278 by (rtac program_equalityI 1); |
324 by (rtac program_equalityI 1); |
279 by Auto_tac; |
325 by Auto_tac; |
280 qed "extend_SKIP"; |
326 qed "extend_SKIP"; |
281 |
327 |
282 Goalw [project_set_def] "UNIV <= project_set h UNIV"; |
328 Goalw [project_set_def] "project_set h UNIV = UNIV"; |
283 by Auto_tac; |
329 by Auto_tac; |
284 qed "project_set_UNIV"; |
330 qed "project_set_UNIV"; |
|
331 Addsimps [project_set_UNIV]; |
285 |
332 |
286 (*ALL act: Acts F. Domain act is MUCH TOO STRONG since Domain Id = UNIV!*) |
333 (*ALL act: Acts F. Domain act is MUCH TOO STRONG since Domain Id = UNIV!*) |
287 Goal "UNIV <= project_set h C \ |
334 Goal "UNIV <= project_set h C \ |
288 \ ==> project C h (extend h F) = F"; |
335 \ ==> project C h (extend h F) = F"; |
289 by (simp_tac (simpset() addsimps [extend_def, project_def]) 1); |
336 by (simp_tac (simpset() addsimps [extend_def, project_def]) 1); |
290 by (rtac program_equalityI 1); |
337 by (rtac program_equalityI 1); |
291 by (asm_simp_tac (simpset() addsimps [image_image_eq_UN, |
338 by (asm_simp_tac (simpset() addsimps [image_image_eq_UN, image_UN, |
292 subset_UNIV RS subset_trans RS extend_act_inverse]) 2); |
339 subset_UNIV RS subset_trans RS Restrict_triv]) 2); |
293 by (Simp_tac 1); |
340 by (Simp_tac 1); |
294 qed "extend_inverse"; |
341 qed "extend_inverse"; |
295 Addsimps [extend_inverse]; |
342 Addsimps [extend_inverse]; |
296 |
343 |
297 Goal "inj (extend h)"; |
344 Goal "inj (extend h)"; |
352 qed "extend_constrains_project_set"; |
399 qed "extend_constrains_project_set"; |
353 |
400 |
354 |
401 |
355 (*** Diff, needed for localTo ***) |
402 (*** Diff, needed for localTo ***) |
356 |
403 |
357 Goal "(Diff (extend h G) (extend_act h `` acts)) = extend h (Diff G acts)"; |
404 Goal "Restrict (extend_set h C) (extend_act h act) = \ |
|
405 \ extend_act h (Restrict C act)"; |
|
406 by (auto_tac (claset(), |
|
407 simpset() addsimps [split_extended_all])); |
|
408 by (auto_tac (claset(), |
|
409 simpset() addsimps [extend_act_def])); |
|
410 qed "Restrict_extend_set"; |
|
411 |
|
412 Goal "(Diff (extend_set h C) (extend h G) (extend_act h `` acts)) = \ |
|
413 \ extend h (Diff C G acts)"; |
358 by (auto_tac (claset() addSIs [program_equalityI], |
414 by (auto_tac (claset() addSIs [program_equalityI], |
359 simpset() addsimps [Diff_def, |
415 simpset() addsimps [Diff_def, image_image_eq_UN, |
|
416 Restrict_extend_set, |
360 inj_extend_act RS image_set_diff])); |
417 inj_extend_act RS image_set_diff])); |
361 qed "Diff_extend_eq"; |
418 qed "Diff_extend_eq"; |
362 |
419 |
363 Goal "(Diff (extend h G) (extend_act h `` acts) \ |
420 (*Opposite inclusion fails; this inclusion's more general than that of |
|
421 Diff_extend_eq*) |
|
422 Goal "Diff (project_set h C) G acts \ |
|
423 \ <= project C h (Diff C (extend h G) (extend_act h `` acts))"; |
|
424 by (simp_tac |
|
425 (simpset() addsimps [component_eq_subset, Diff_def,image_UN, |
|
426 image_image, image_Diff_image_eq, |
|
427 Restrict_extend_act_eq_Restrict_project_act, |
|
428 vimage_image_eq]) 1); |
|
429 by (blast_tac (claset() addSEs [equalityE])1); |
|
430 qed "Diff_project_set_component"; |
|
431 |
|
432 Goal "(Diff (extend_set h C) (extend h G) (extend_act h `` acts) \ |
364 \ : (extend_set h A) co (extend_set h B)) \ |
433 \ : (extend_set h A) co (extend_set h B)) \ |
365 \ = (Diff G acts : A co B)"; |
434 \ = (Diff C G acts : A co B)"; |
366 by (simp_tac (simpset() addsimps [Diff_extend_eq, extend_constrains]) 1); |
435 by (simp_tac (simpset() addsimps [Diff_extend_eq, extend_constrains]) 1); |
367 qed "Diff_extend_constrains"; |
436 qed "Diff_extend_constrains"; |
368 |
437 |
369 Goal "(Diff (extend h G) (extend_act h `` acts) : stable (extend_set h A)) \ |
438 Goal "(Diff (extend_set h C) (extend h G) (extend_act h `` acts) \ |
370 \ = (Diff G acts : stable A)"; |
439 \ : stable (extend_set h A)) \ |
|
440 \ = (Diff C G acts : stable A)"; |
371 by (simp_tac (simpset() addsimps [Diff_extend_constrains, stable_def]) 1); |
441 by (simp_tac (simpset() addsimps [Diff_extend_constrains, stable_def]) 1); |
372 qed "Diff_extend_stable"; |
442 qed "Diff_extend_stable"; |
373 |
443 |
374 Goal "Diff (extend h G) (extend_act h `` acts) : A co B \ |
444 (*UNUSED!!*) |
375 \ ==> Diff G acts : (project_set h A) co (project_set h B)"; |
445 Goal "Diff (extend_set h C) (extend h G) (extend_act h `` acts) : A co B \ |
|
446 \ ==> Diff C G acts : (project_set h A) co (project_set h B)"; |
376 by (asm_full_simp_tac (simpset() addsimps [Diff_extend_eq, |
447 by (asm_full_simp_tac (simpset() addsimps [Diff_extend_eq, |
377 extend_constrains_project_set]) 1); |
448 extend_constrains_project_set]) 1); |
378 qed "Diff_extend_constrains_project_set"; |
449 qed "Diff_extend_constrains_project_set"; |
379 |
450 |
380 Goalw [localTo_def] |
451 Goalw [LOCALTO_def] |
381 "(extend h F : (v o f) localTo extend h H) = (F : v localTo H)"; |
452 "(extend h F : (v o f) localTo[extend_set h C] extend h H) = \ |
382 by (simp_tac (simpset() addsimps []) 1); |
453 \ (F : v localTo[C] H)"; |
|
454 by (Simp_tac 1); |
383 (*A trick to strip both quantifiers*) |
455 (*A trick to strip both quantifiers*) |
384 by (res_inst_tac [("f", "All")] (ext RS arg_cong) 1); |
456 by (res_inst_tac [("f", "All")] (ext RS arg_cong) 1); |
385 by (stac Collect_eq_extend_set 1); |
457 by (stac Collect_eq_extend_set 1); |
386 by (simp_tac (simpset() addsimps [Diff_extend_stable]) 1); |
458 by (simp_tac (simpset() addsimps [Diff_extend_stable]) 1); |
387 qed "extend_localTo_extend_eq"; |
459 qed "extend_localTo_extend_eq"; |
388 |
460 |
389 Goal "Disjoint (extend h F) (extend h G) = Disjoint F G"; |
461 (*USED?? opposite inclusion fails*) |
390 by (simp_tac (simpset() addsimps [Disjoint_def, |
462 Goal "Restrict C (extend_act h act) <= \ |
391 inj_extend_act RS image_Int RS sym]) 1); |
463 \ extend_act h (Restrict (project_set h C) act)"; |
392 by (simp_tac (simpset() addsimps [image_subset_iff, extend_act_Id_iff]) 1); |
464 by (auto_tac (claset(), |
393 by (blast_tac (claset() addEs [equalityE]) 1); |
465 simpset() addsimps [split_extended_all])); |
|
466 by (auto_tac (claset(), |
|
467 simpset() addsimps [extend_act_def, project_set_def])); |
|
468 qed "Restrict_extend_set_subset"; |
|
469 |
|
470 |
|
471 Goal "(extend_act h `` Acts F) - {Id} = extend_act h `` (Acts F - {Id})"; |
|
472 by (stac (extend_act_Id RS sym) 1); |
|
473 by (simp_tac (simpset() addsimps [inj_extend_act RS image_set_diff]) 1); |
|
474 qed "extend_act_image_Id_eq"; |
|
475 |
|
476 Goal "Disjoint C (extend h F) (extend h G) = Disjoint (project_set h C) F G"; |
|
477 by (simp_tac |
|
478 (simpset() addsimps [Disjoint_def, disjoint_iff_not_equal, |
|
479 image_Diff_image_eq, |
|
480 Restrict_extend_act_eq_Restrict_project_act, |
|
481 extend_act_Id_iff, vimage_def]) 1); |
394 qed "Disjoint_extend_eq"; |
482 qed "Disjoint_extend_eq"; |
395 Addsimps [Disjoint_extend_eq]; |
483 Addsimps [Disjoint_extend_eq]; |
396 |
484 |
397 (*** Weak safety primitives: Co, Stable ***) |
485 (*** Weak safety primitives: Co, Stable ***) |
398 |
486 |