author | paulson |
Mon, 30 Aug 1999 11:20:42 +0200 | |
changeset 7387 | 5e74c23063de |
parent 7378 | ed9230a0a700 |
child 7399 | cf780c2bcccf |
permissions | -rw-r--r-- |
6297 | 1 |
(* Title: HOL/UNITY/Extend.ML |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1999 University of Cambridge |
|
5 |
||
6 |
Extending of state sets |
|
7 |
function f (forget) maps the extended state to the original state |
|
8 |
function g (forgotten) maps the extended state to the "extending part" |
|
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
9 |
|
6297 | 10 |
*) |
11 |
||
12 |
Open_locale "Extend"; |
|
13 |
||
14 |
val slice_def = thm "slice_def"; |
|
15 |
val f_act_def = thm "f_act_def"; |
|
16 |
||
17 |
(*** Trivial properties of f, g, h ***) |
|
18 |
||
7378 | 19 |
val inj_h = thm "bij_h" RS bij_is_inj; |
20 |
val surj_h = thm "bij_h" RS bij_is_surj; |
|
6297 | 21 |
Addsimps [inj_h, inj_h RS inj_eq, surj_h]; |
22 |
||
23 |
val f_def = thm "f_def"; |
|
24 |
val g_def = thm "g_def"; |
|
25 |
||
26 |
Goal "f(h(x,y)) = x"; |
|
27 |
by (simp_tac (simpset() addsimps [f_def]) 1); |
|
28 |
qed "f_h_eq"; |
|
29 |
Addsimps [f_h_eq]; |
|
30 |
||
31 |
Goal "g(h(x,y)) = y"; |
|
32 |
by (simp_tac (simpset() addsimps [g_def]) 1); |
|
33 |
qed "g_h_eq"; |
|
34 |
Addsimps [g_h_eq]; |
|
35 |
||
36 |
Goal "h(f z, g z) = z"; |
|
37 |
by (cut_inst_tac [("y", "z")] (surj_h RS surjD) 1); |
|
38 |
by Auto_tac; |
|
39 |
qed "h_f_g_eq"; |
|
40 |
||
41 |
||
42 |
(*** extend_set: basic properties ***) |
|
43 |
||
44 |
Goalw [extend_set_def] |
|
7341 | 45 |
"z : extend_set h A = (f z : A)"; |
46 |
by (force_tac (claset() addIs [h_f_g_eq RS sym], simpset()) 1); |
|
6297 | 47 |
qed "mem_extend_set_iff"; |
48 |
AddIffs [mem_extend_set_iff]; |
|
49 |
||
7378 | 50 |
Goal "{s. P (f s)} = extend_set h {s. P s}"; |
51 |
by Auto_tac; |
|
52 |
qed "Collect_eq_extend_set"; |
|
53 |
||
7341 | 54 |
(*Converse appears to fail*) |
55 |
Goalw [project_set_def] "z : C ==> f z : project_set h C"; |
|
56 |
by (auto_tac (claset() addIs [h_f_g_eq RS ssubst], |
|
57 |
simpset())); |
|
58 |
qed "project_set_I"; |
|
59 |
||
60 |
Goalw [extend_set_def, project_set_def] "project_set h (extend_set h F) = F"; |
|
61 |
by Auto_tac; |
|
62 |
qed "extend_set_inverse"; |
|
63 |
Addsimps [extend_set_inverse]; |
|
64 |
||
6297 | 65 |
Goal "inj (extend_set h)"; |
7341 | 66 |
by (rtac inj_on_inverseI 1); |
67 |
by (rtac extend_set_inverse 1); |
|
6297 | 68 |
qed "inj_extend_set"; |
69 |
||
7341 | 70 |
(*Because A and B could differ on the "other" part of the state, |
71 |
cannot generalize result to |
|
72 |
project_set h (A Int B) = project_set h A Int project_set h B |
|
73 |
*) |
|
74 |
Goalw [project_set_def] |
|
75 |
"project_set h ((extend_set h A) Int B) = A Int (project_set h B)"; |
|
76 |
by Auto_tac; |
|
77 |
qed "project_set_extend_set_Int"; |
|
78 |
||
79 |
Goal "extend_set h (A Un B) = extend_set h A Un extend_set h B"; |
|
6297 | 80 |
by Auto_tac; |
81 |
qed "extend_set_Un_distrib"; |
|
82 |
||
7341 | 83 |
Goal "extend_set h (A Int B) = extend_set h A Int extend_set h B"; |
6297 | 84 |
by Auto_tac; |
85 |
qed "extend_set_Int_distrib"; |
|
86 |
||
7341 | 87 |
Goal "extend_set h (INTER A B) = (INT x:A. extend_set h (B x))"; |
88 |
by Auto_tac; |
|
6834
44da4a2a9ef3
renamed UNION_... to UN_..., INTER_... to INT_... (to fit the convention)
paulson
parents:
6822
diff
changeset
|
89 |
qed "extend_set_INT_distrib"; |
6647 | 90 |
|
7341 | 91 |
Goal "extend_set h (A - B) = extend_set h A - extend_set h B"; |
6297 | 92 |
by Auto_tac; |
93 |
qed "extend_set_Diff_distrib"; |
|
94 |
||
7341 | 95 |
Goal "extend_set h (Union A) = (UN X:A. extend_set h X)"; |
6297 | 96 |
by (Blast_tac 1); |
97 |
qed "extend_set_Union"; |
|
98 |
||
7341 | 99 |
Goalw [extend_set_def] "(extend_set h A <= - extend_set h B) = (A <= - B)"; |
6297 | 100 |
by Auto_tac; |
101 |
qed "extend_set_subset_Compl_eq"; |
|
102 |
||
103 |
Goalw [extend_set_def] "f `` extend_set h A = A"; |
|
104 |
by Auto_tac; |
|
105 |
by (blast_tac (claset() addIs [f_h_eq RS sym]) 1); |
|
106 |
qed "f_image_extend_set"; |
|
107 |
Addsimps [f_image_extend_set]; |
|
108 |
||
109 |
||
7341 | 110 |
(*** project_set: basic properties ***) |
111 |
||
112 |
Goalw [project_set_def] "project_set h C = f `` C"; |
|
113 |
by (auto_tac (claset() addIs [f_h_eq RS sym, h_f_g_eq RS ssubst], |
|
114 |
simpset())); |
|
115 |
qed "project_set_eq"; |
|
116 |
||
117 |
||
6297 | 118 |
(*** extend_act ***) |
119 |
||
7341 | 120 |
(*Actions could affect the g-part, so result Cannot be strengthened to |
121 |
((z, z') : extend_act h act) = ((f z, f z') : act) |
|
122 |
*) |
|
6297 | 123 |
Goalw [extend_act_def] |
124 |
"((h(s,y), h(s',y)) : extend_act h act) = ((s, s') : act)"; |
|
125 |
by Auto_tac; |
|
126 |
qed "mem_extend_act_iff"; |
|
127 |
AddIffs [mem_extend_act_iff]; |
|
128 |
||
7341 | 129 |
Goalw [extend_act_def] |
130 |
"(z, z') : extend_act h act ==> (f z, f z') : act"; |
|
131 |
by Auto_tac; |
|
132 |
qed "extend_act_D"; |
|
133 |
||
134 |
Goalw [extend_act_def, project_act_def] |
|
135 |
"project_act h (extend_act h act) = act"; |
|
136 |
by Auto_tac; |
|
137 |
by (Blast_tac 1); |
|
138 |
qed "extend_act_inverse"; |
|
139 |
Addsimps [extend_act_inverse]; |
|
140 |
||
6297 | 141 |
Goal "inj (extend_act h)"; |
7341 | 142 |
by (rtac inj_on_inverseI 1); |
143 |
by (rtac extend_act_inverse 1); |
|
6297 | 144 |
qed "inj_extend_act"; |
145 |
||
146 |
Goalw [extend_set_def, extend_act_def] |
|
147 |
"extend_act h act ^^ (extend_set h A) = extend_set h (act ^^ A)"; |
|
148 |
by (Force_tac 1); |
|
149 |
qed "extend_act_Image"; |
|
150 |
Addsimps [extend_act_Image]; |
|
151 |
||
152 |
Goalw [extend_set_def, extend_act_def] |
|
153 |
"(extend_set h A <= extend_set h B) = (A <= B)"; |
|
154 |
by (Force_tac 1); |
|
155 |
qed "extend_set_strict_mono"; |
|
156 |
Addsimps [extend_set_strict_mono]; |
|
157 |
||
158 |
Goalw [extend_set_def, extend_act_def] |
|
159 |
"Domain (extend_act h act) = extend_set h (Domain act)"; |
|
160 |
by (Force_tac 1); |
|
161 |
qed "Domain_extend_act"; |
|
162 |
||
7341 | 163 |
Goalw [extend_act_def] |
6297 | 164 |
"extend_act h Id = Id"; |
165 |
by (force_tac (claset() addIs [h_f_g_eq RS sym], simpset()) 1); |
|
166 |
qed "extend_act_Id"; |
|
7341 | 167 |
|
168 |
Goalw [project_act_def] |
|
169 |
"(z, z') : act ==> (f z, f z') : project_act h act"; |
|
170 |
by (auto_tac (claset() addSIs [exI] addIs [h_f_g_eq RS ssubst], |
|
171 |
simpset())); |
|
172 |
qed "project_act_I"; |
|
173 |
||
174 |
Goalw [project_set_def, project_act_def] |
|
175 |
"project_act h Id = Id"; |
|
176 |
by (Force_tac 1); |
|
177 |
qed "project_act_Id"; |
|
178 |
||
179 |
Addsimps [extend_act_Id, project_act_Id]; |
|
6297 | 180 |
|
181 |
Goal "Id : extend_act h `` Acts F"; |
|
182 |
by (auto_tac (claset() addSIs [extend_act_Id RS sym], |
|
183 |
simpset() addsimps [image_iff])); |
|
184 |
qed "Id_mem_extend_act"; |
|
185 |
||
186 |
||
187 |
(**** extend ****) |
|
188 |
||
189 |
(*** Basic properties ***) |
|
190 |
||
7341 | 191 |
Goalw [extend_def] "Init (extend h F) = extend_set h (Init F)"; |
6297 | 192 |
by Auto_tac; |
193 |
qed "Init_extend"; |
|
194 |
||
7341 | 195 |
Goalw [project_def] "Init (project h F) = project_set h (Init F)"; |
196 |
by Auto_tac; |
|
197 |
qed "Init_project"; |
|
198 |
||
6297 | 199 |
Goal "Acts (extend h F) = (extend_act h `` Acts F)"; |
200 |
by (auto_tac (claset() addSIs [extend_act_Id RS sym], |
|
201 |
simpset() addsimps [extend_def, image_iff])); |
|
202 |
qed "Acts_extend"; |
|
203 |
||
7341 | 204 |
Goal "Acts (project h F) = (project_act h `` Acts F)"; |
205 |
by (auto_tac (claset() addSIs [project_act_Id RS sym], |
|
206 |
simpset() addsimps [project_def, image_iff])); |
|
207 |
qed "Acts_project"; |
|
208 |
||
209 |
Addsimps [Init_extend, Init_project, Acts_extend, Acts_project]; |
|
6297 | 210 |
|
211 |
Goalw [SKIP_def] "extend h SKIP = SKIP"; |
|
212 |
by (rtac program_equalityI 1); |
|
7341 | 213 |
by Auto_tac; |
214 |
qed "extend_SKIP"; |
|
215 |
||
216 |
Goalw [SKIP_def] "project h SKIP = SKIP"; |
|
217 |
by (rtac program_equalityI 1); |
|
6297 | 218 |
by (auto_tac (claset() addIs [h_f_g_eq RS sym], |
7341 | 219 |
simpset() addsimps [project_set_def])); |
220 |
qed "project_SKIP"; |
|
221 |
||
222 |
Goal "project h (extend h F) = F"; |
|
223 |
by (simp_tac (simpset() addsimps [extend_def, project_def]) 1); |
|
224 |
by (rtac program_equalityI 1); |
|
225 |
by (simp_tac (simpset() addsimps [image_compose RS sym, o_def]) 2); |
|
226 |
by (Simp_tac 1); |
|
227 |
qed "extend_inverse"; |
|
228 |
Addsimps [extend_inverse]; |
|
6297 | 229 |
|
230 |
Goal "inj (extend h)"; |
|
7341 | 231 |
by (rtac inj_on_inverseI 1); |
232 |
by (rtac extend_inverse 1); |
|
6297 | 233 |
qed "inj_extend"; |
234 |
||
235 |
Goal "extend h (F Join G) = extend h F Join extend h G"; |
|
236 |
by (rtac program_equalityI 1); |
|
237 |
by (simp_tac (simpset() addsimps [image_Un, Acts_Join]) 2); |
|
238 |
by (simp_tac (simpset() addsimps [extend_set_Int_distrib]) 1); |
|
239 |
qed "extend_Join"; |
|
240 |
Addsimps [extend_Join]; |
|
241 |
||
6647 | 242 |
Goal "extend h (JOIN I F) = (JN i:I. extend h (F i))"; |
243 |
by (rtac program_equalityI 1); |
|
6834
44da4a2a9ef3
renamed UNION_... to UN_..., INTER_... to INT_... (to fit the convention)
paulson
parents:
6822
diff
changeset
|
244 |
by (simp_tac (simpset() addsimps [image_UN, Acts_JN]) 2); |
44da4a2a9ef3
renamed UNION_... to UN_..., INTER_... to INT_... (to fit the convention)
paulson
parents:
6822
diff
changeset
|
245 |
by (simp_tac (simpset() addsimps [extend_set_INT_distrib]) 1); |
6647 | 246 |
qed "extend_JN"; |
247 |
Addsimps [extend_JN]; |
|
248 |
||
7387 | 249 |
Goal "project h ((extend h F) Join G) = F Join (project h G)"; |
250 |
by (rtac program_equalityI 1); |
|
251 |
by (simp_tac (simpset() addsimps [Acts_Join, image_Un, |
|
252 |
image_compose RS sym, o_def]) 2); |
|
253 |
by (simp_tac (simpset() addsimps [project_set_extend_set_Int]) 1); |
|
254 |
qed "project_extend_Join"; |
|
255 |
||
256 |
Goal "(extend h F) Join G = extend h H ==> H = F Join (project h G)"; |
|
257 |
by (dres_inst_tac [("f", "project h")] arg_cong 1); |
|
258 |
by (full_simp_tac (simpset() addsimps [project_extend_Join]) 1); |
|
259 |
by (etac sym 1); |
|
260 |
qed "extend_Join_eq_extend_D"; |
|
261 |
||
6297 | 262 |
|
6536 | 263 |
(*** Safety: co, stable ***) |
6297 | 264 |
|
6536 | 265 |
Goal "(extend h F : (extend_set h A) co (extend_set h B)) = \ |
266 |
\ (F : A co B)"; |
|
6297 | 267 |
by (simp_tac (simpset() addsimps [constrains_def]) 1); |
268 |
qed "extend_constrains"; |
|
269 |
||
270 |
Goal "(extend h F : stable (extend_set h A)) = (F : stable A)"; |
|
271 |
by (asm_simp_tac (simpset() addsimps [stable_def, extend_constrains]) 1); |
|
272 |
qed "extend_stable"; |
|
273 |
||
274 |
Goal "(extend h F : invariant (extend_set h A)) = (F : invariant A)"; |
|
275 |
by (asm_simp_tac (simpset() addsimps [invariant_def, extend_stable]) 1); |
|
276 |
qed "extend_invariant"; |
|
277 |
||
7341 | 278 |
(** Safety and project **) |
279 |
||
280 |
Goalw [constrains_def] |
|
281 |
"(project h F : A co B) = (F : (extend_set h A) co (extend_set h B))"; |
|
282 |
by Auto_tac; |
|
283 |
by (force_tac (claset(), simpset() addsimps [project_act_def]) 2); |
|
284 |
by (auto_tac (claset() addSIs [project_act_I], simpset())); |
|
285 |
qed "project_constrains"; |
|
286 |
||
287 |
Goal "(project h F : stable A) = (F : stable (extend_set h A))"; |
|
288 |
by (simp_tac (simpset() addsimps [stable_def, project_constrains]) 1); |
|
289 |
qed "project_stable"; |
|
290 |
||
7387 | 291 |
Goal "(project h F : increasing func) = (F : increasing (func o f))"; |
292 |
by (simp_tac (simpset() addsimps [increasing_def, project_stable, |
|
293 |
Collect_eq_extend_set RS sym]) 1); |
|
294 |
qed "project_increasing"; |
|
295 |
||
7341 | 296 |
|
297 |
(*** Diff, needed for localTo ***) |
|
298 |
||
7387 | 299 |
(** project versions **) |
300 |
||
301 |
(*Opposite direction fails because Diff in the extended state may remove |
|
302 |
fewer actions, i.e. those that affect other state variables.*) |
|
303 |
Goal "Diff (project h G) acts component \ |
|
304 |
\ project h (Diff G (extend_act h `` acts))"; |
|
305 |
by (force_tac (claset(), |
|
306 |
simpset() addsimps [component_eq_subset, Diff_def]) 1); |
|
307 |
qed "Diff_project_component_project_Diff"; |
|
308 |
||
309 |
Goal "Diff G (extend_act h `` acts) : (extend_set h A) co (extend_set h B) \ |
|
310 |
\ ==> Diff (project h G) acts : A co B"; |
|
311 |
br (Diff_project_component_project_Diff RS component_constrains) 1; |
|
312 |
be (project_constrains RS iffD2) 1; |
|
7341 | 313 |
qed "Diff_project_co"; |
314 |
||
315 |
Goalw [stable_def] |
|
7387 | 316 |
"Diff G (extend_act h `` acts) : stable (extend_set h A) \ |
317 |
\ ==> Diff (project h G) acts : stable A"; |
|
7341 | 318 |
by (etac Diff_project_co 1); |
319 |
qed "Diff_project_stable"; |
|
320 |
||
7387 | 321 |
(** extend versions **) |
322 |
||
323 |
Goal "(Diff (extend h G) (extend_act h `` acts)) = extend h (Diff G acts)"; |
|
324 |
by (auto_tac (claset() addSIs [program_equalityI], |
|
325 |
simpset() addsimps [Diff_def, |
|
326 |
inj_extend_act RS image_set_diff RS sym, |
|
327 |
image_compose RS sym, o_def])); |
|
328 |
qed "Diff_extend_eq"; |
|
329 |
||
330 |
Goal "(Diff (extend h G) (extend_act h `` acts) \ |
|
331 |
\ : (extend_set h A) co (extend_set h B)) \ |
|
332 |
\ = (Diff G acts : A co B)"; |
|
333 |
by (simp_tac (simpset() addsimps [Diff_extend_eq, extend_constrains]) 1); |
|
7341 | 334 |
qed "Diff_extend_co"; |
335 |
||
7387 | 336 |
Goal "(Diff (extend h G) (extend_act h `` acts) : stable (extend_set h A)) \ |
337 |
\ = (Diff G acts : stable A)"; |
|
338 |
by (simp_tac (simpset() addsimps [Diff_extend_co, stable_def]) 1); |
|
7341 | 339 |
qed "Diff_extend_stable"; |
340 |
||
7387 | 341 |
(*Converse appears to fail*) |
342 |
Goal "(H : (func o f) localTo extend h G) ==> (project h H : func localTo G)"; |
|
343 |
by (asm_full_simp_tac |
|
344 |
(simpset() addsimps [localTo_def, |
|
345 |
project_extend_Join RS sym, |
|
346 |
Diff_project_stable, |
|
347 |
Collect_eq_extend_set RS sym]) 1); |
|
348 |
qed "project_localTo_I"; |
|
349 |
||
7341 | 350 |
|
351 |
(*** Weak safety primitives: Co, Stable ***) |
|
6297 | 352 |
|
353 |
Goal "p : reachable (extend h F) ==> f p : reachable F"; |
|
354 |
by (etac reachable.induct 1); |
|
355 |
by (auto_tac |
|
356 |
(claset() addIs reachable.intrs, |
|
7341 | 357 |
simpset() addsimps [extend_act_def, image_iff])); |
6297 | 358 |
qed "reachable_extend_f"; |
359 |
||
360 |
Goal "h(s,y) : reachable (extend h F) ==> s : reachable F"; |
|
361 |
by (force_tac (claset() addSDs [reachable_extend_f], simpset()) 1); |
|
362 |
qed "h_reachable_extend"; |
|
363 |
||
364 |
Goalw [extend_set_def] |
|
365 |
"reachable (extend h F) = extend_set h (reachable F)"; |
|
366 |
by (rtac equalityI 1); |
|
367 |
by (force_tac (claset() addIs [h_f_g_eq RS sym] |
|
368 |
addSDs [reachable_extend_f], |
|
369 |
simpset()) 1); |
|
370 |
by (Clarify_tac 1); |
|
371 |
by (etac reachable.induct 1); |
|
372 |
by (ALLGOALS (force_tac (claset() addIs reachable.intrs, |
|
373 |
simpset()))); |
|
374 |
qed "reachable_extend_eq"; |
|
375 |
||
6536 | 376 |
Goal "(extend h F : (extend_set h A) Co (extend_set h B)) = \ |
377 |
\ (F : A Co B)"; |
|
6297 | 378 |
by (simp_tac |
379 |
(simpset() addsimps [Constrains_def, reachable_extend_eq, |
|
380 |
extend_constrains, extend_set_Int_distrib RS sym]) 1); |
|
381 |
qed "extend_Constrains"; |
|
382 |
||
383 |
Goal "(extend h F : Stable (extend_set h A)) = (F : Stable A)"; |
|
384 |
by (simp_tac (simpset() addsimps [Stable_def, extend_Constrains]) 1); |
|
385 |
qed "extend_Stable"; |
|
386 |
||
6647 | 387 |
Goal "(extend h F : Always (extend_set h A)) = (F : Always A)"; |
388 |
by (asm_simp_tac (simpset() addsimps [Always_def, extend_Stable]) 1); |
|
389 |
qed "extend_Always"; |
|
390 |
||
6297 | 391 |
|
7341 | 392 |
(** Reachability and project **) |
393 |
||
394 |
Goal "z : reachable F ==> f z : reachable (project h F)"; |
|
395 |
by (etac reachable.induct 1); |
|
396 |
by (force_tac (claset() addIs [reachable.Acts, project_act_I], |
|
397 |
simpset()) 2); |
|
398 |
by (force_tac (claset() addIs [reachable.Init, project_set_I], |
|
399 |
simpset()) 1); |
|
400 |
qed "reachable_imp_reachable_project"; |
|
401 |
||
402 |
(*Converse fails (?) *) |
|
403 |
Goalw [Constrains_def] |
|
404 |
"project h F : A Co B ==> F : (extend_set h A) Co (extend_set h B)"; |
|
405 |
by (full_simp_tac (simpset() addsimps [project_constrains]) 1); |
|
406 |
by (etac constrains_weaken_L 1); |
|
407 |
by (auto_tac (claset() addDs [reachable_imp_reachable_project], simpset())); |
|
408 |
qed "project_Constrains_D"; |
|
409 |
||
7378 | 410 |
Goalw [Stable_def] "project h F : Stable A ==> F : Stable (extend_set h A)"; |
7341 | 411 |
by (asm_simp_tac (simpset() addsimps [project_Constrains_D]) 1); |
412 |
qed "project_Stable_D"; |
|
413 |
||
7378 | 414 |
Goalw [Always_def] "project h F : Always A ==> F : Always (extend_set h A)"; |
415 |
by (force_tac (claset() addIs [reachable.Init, project_set_I], |
|
416 |
simpset() addsimps [project_Stable_D]) 1); |
|
417 |
qed "project_Always_D"; |
|
418 |
||
419 |
Goalw [Increasing_def] |
|
420 |
"project h F : Increasing func ==> F : Increasing (func o f)"; |
|
421 |
by Auto_tac; |
|
422 |
by (stac Collect_eq_extend_set 1); |
|
423 |
by (asm_simp_tac (simpset() addsimps [project_Stable_D]) 1); |
|
424 |
qed "project_Increasing_D"; |
|
425 |
||
7341 | 426 |
|
427 |
(*** Programs of the form ((extend h F) Join G) |
|
428 |
in other words programs containing an extended component ***) |
|
429 |
||
430 |
Goal "z : reachable (extend h F Join G) \ |
|
431 |
\ ==> f z : reachable (F Join project h G)"; |
|
432 |
by (etac reachable.induct 1); |
|
433 |
by (force_tac (claset() addIs [reachable.Init, project_set_I], simpset()) 1); |
|
434 |
(*By case analysis on whether the action is of extend h F or G*) |
|
435 |
by (rtac reachable.Acts 1); |
|
436 |
by (etac project_act_I 3); |
|
437 |
by (auto_tac (claset(), simpset() addsimps [Acts_Join])); |
|
438 |
qed "reachable_extend_Join_D"; |
|
439 |
||
440 |
(*Opposite inclusion fails, even for the initial state: extend_set h includes |
|
441 |
ALL functions determined only by their value at h.*) |
|
442 |
Goal "reachable (extend h F Join G) <= \ |
|
443 |
\ extend_set h (reachable (F Join project h G))"; |
|
444 |
by Auto_tac; |
|
445 |
by (etac reachable_extend_Join_D 1); |
|
446 |
qed "reachable_extend_Join_subset"; |
|
447 |
||
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
448 |
Goalw [Constrains_def] |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
449 |
"F Join project h G : A Co B \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
450 |
\ ==> extend h F Join G : (extend_set h A) Co (extend_set h B)"; |
7341 | 451 |
by (subgoal_tac |
452 |
"extend h F Join G : extend_set h (reachable (F Join project h G)) Int \ |
|
453 |
\ extend_set h A \ |
|
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
454 |
\ co extend_set h B" 1); |
7341 | 455 |
by (asm_full_simp_tac |
456 |
(simpset() addsimps [extend_set_Int_distrib RS sym, |
|
457 |
extend_constrains, |
|
458 |
project_constrains RS sym, |
|
459 |
project_extend_Join]) 2); |
|
7378 | 460 |
by (blast_tac (claset() addIs [constrains_weaken, reachable_extend_Join_D]) 1); |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
461 |
qed "extend_Join_Constrains"; |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
462 |
|
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
463 |
Goal "F Join project h G : Stable A \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
464 |
\ ==> extend h F Join G : Stable (extend_set h A)"; |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
465 |
by (asm_full_simp_tac (simpset() addsimps [Stable_def, |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
466 |
extend_Join_Constrains]) 1); |
7341 | 467 |
qed "extend_Join_Stable"; |
468 |
||
469 |
||
6297 | 470 |
(*** Progress: transient, ensures ***) |
471 |
||
472 |
Goal "(extend h F : transient (extend_set h A)) = (F : transient A)"; |
|
473 |
by (auto_tac (claset(), |
|
474 |
simpset() addsimps [transient_def, extend_set_subset_Compl_eq, |
|
475 |
Domain_extend_act])); |
|
476 |
qed "extend_transient"; |
|
477 |
||
6536 | 478 |
Goal "(extend h F : (extend_set h A) ensures (extend_set h B)) = \ |
479 |
\ (F : A ensures B)"; |
|
6297 | 480 |
by (simp_tac |
481 |
(simpset() addsimps [ensures_def, extend_constrains, extend_transient, |
|
482 |
extend_set_Un_distrib RS sym, |
|
483 |
extend_set_Diff_distrib RS sym]) 1); |
|
484 |
qed "extend_ensures"; |
|
485 |
||
6536 | 486 |
Goal "F : A leadsTo B \ |
487 |
\ ==> extend h F : (extend_set h A) leadsTo (extend_set h B)"; |
|
6297 | 488 |
by (etac leadsTo_induct 1); |
489 |
by (asm_simp_tac (simpset() addsimps [leadsTo_UN, extend_set_Union]) 3); |
|
490 |
by (blast_tac (claset() addIs [leadsTo_Trans]) 2); |
|
491 |
by (asm_simp_tac (simpset() addsimps [leadsTo_Basis, extend_ensures]) 1); |
|
492 |
qed "leadsTo_imp_extend_leadsTo"; |
|
493 |
||
494 |
(*** Proving the converse takes some doing! ***) |
|
495 |
||
496 |
Goalw [slice_def] "slice (Union S) y = (UN x:S. slice x y)"; |
|
497 |
by Auto_tac; |
|
498 |
qed "slice_Union"; |
|
499 |
||
500 |
Goalw [slice_def] "slice (extend_set h A) y = A"; |
|
501 |
by Auto_tac; |
|
502 |
qed "slice_extend_set"; |
|
503 |
||
504 |
Goalw [slice_def] "f``A = (UN y. slice A y)"; |
|
505 |
by Auto_tac; |
|
506 |
by (blast_tac (claset() addIs [f_h_eq RS sym]) 2); |
|
507 |
by (best_tac (claset() addIs [h_f_g_eq RS ssubst]) 1); |
|
508 |
qed "image_is_UN_slice"; |
|
509 |
||
510 |
Goalw [slice_def, transient_def] |
|
511 |
"extend h F : transient A ==> F : transient (slice A y)"; |
|
512 |
by Auto_tac; |
|
513 |
by (rtac bexI 1); |
|
514 |
by Auto_tac; |
|
515 |
by (force_tac (claset(), simpset() addsimps [extend_act_def]) 1); |
|
516 |
qed "extend_transient_slice"; |
|
517 |
||
6536 | 518 |
Goal "extend h F : A ensures B ==> F : (slice A y) ensures (f `` B)"; |
6297 | 519 |
by (full_simp_tac |
520 |
(simpset() addsimps [ensures_def, extend_constrains, extend_transient, |
|
521 |
image_Un RS sym, |
|
522 |
extend_set_Un_distrib RS sym, |
|
523 |
extend_set_Diff_distrib RS sym]) 1); |
|
524 |
by Safe_tac; |
|
525 |
by (full_simp_tac (simpset() addsimps [constrains_def, extend_act_def, |
|
526 |
extend_set_def]) 1); |
|
527 |
by (Clarify_tac 1); |
|
528 |
by (ball_tac 1); |
|
529 |
by (full_simp_tac (simpset() addsimps [slice_def, image_iff, Image_iff]) 1); |
|
530 |
by (force_tac (claset() addSIs [h_f_g_eq RS sym], simpset()) 1); |
|
531 |
(*transient*) |
|
532 |
by (dtac extend_transient_slice 1); |
|
533 |
by (etac transient_strengthen 1); |
|
534 |
by (force_tac (claset() addIs [f_h_eq RS sym], |
|
535 |
simpset() addsimps [slice_def]) 1); |
|
536 |
qed "extend_ensures_slice"; |
|
537 |
||
6536 | 538 |
Goal "ALL y. F : (slice B y) leadsTo CU ==> F : (f `` B) leadsTo CU"; |
6297 | 539 |
by (simp_tac (simpset() addsimps [image_is_UN_slice]) 1); |
540 |
by (blast_tac (claset() addIs [leadsTo_UN]) 1); |
|
541 |
qed "leadsTo_slice_image"; |
|
542 |
||
543 |
||
6536 | 544 |
Goal "extend h F : AU leadsTo BU \ |
545 |
\ ==> ALL y. F : (slice AU y) leadsTo (f `` BU)"; |
|
6297 | 546 |
by (etac leadsTo_induct 1); |
547 |
by (full_simp_tac (simpset() addsimps [slice_Union]) 3); |
|
548 |
by (blast_tac (claset() addIs [leadsTo_UN]) 3); |
|
549 |
by (blast_tac (claset() addIs [leadsTo_slice_image, leadsTo_Trans]) 2); |
|
550 |
by (blast_tac (claset() addIs [extend_ensures_slice, leadsTo_Basis]) 1); |
|
551 |
qed_spec_mp "extend_leadsTo_slice"; |
|
552 |
||
6536 | 553 |
Goal "(extend h F : (extend_set h A) leadsTo (extend_set h B)) = \ |
554 |
\ (F : A leadsTo B)"; |
|
6297 | 555 |
by Safe_tac; |
556 |
by (etac leadsTo_imp_extend_leadsTo 2); |
|
557 |
by (dtac extend_leadsTo_slice 1); |
|
558 |
by (full_simp_tac (simpset() addsimps [slice_extend_set]) 1); |
|
6647 | 559 |
qed "extend_leadsto"; |
6297 | 560 |
|
6536 | 561 |
Goal "(extend h F : (extend_set h A) LeadsTo (extend_set h B)) = \ |
562 |
\ (F : A LeadsTo B)"; |
|
6454 | 563 |
by (simp_tac |
564 |
(simpset() addsimps [LeadsTo_def, reachable_extend_eq, |
|
6647 | 565 |
extend_leadsto, extend_set_Int_distrib RS sym]) 1); |
6454 | 566 |
qed "extend_LeadsTo"; |
567 |
||
6297 | 568 |
|
569 |
(*** guarantees properties ***) |
|
570 |
||
571 |
Goalw [f_act_def, extend_act_def] "f_act (extend_act h act1) = act1"; |
|
572 |
by (force_tac |
|
573 |
(claset() addSIs [rev_bexI], |
|
574 |
simpset() addsimps [image_iff]) 1); |
|
575 |
qed "f_act_extend_act"; |
|
576 |
Addsimps [f_act_extend_act]; |
|
577 |
||
7341 | 578 |
(** Strong precondition and postcondition; doesn't seem very useful. **) |
579 |
||
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
580 |
Goal "F : X guarantees Y ==> \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
581 |
\ extend h F : (extend h `` X) guarantees (extend h `` Y)"; |
6297 | 582 |
by (rtac guaranteesI 1); |
583 |
by Auto_tac; |
|
584 |
by (blast_tac (claset() addDs [extend_Join_eq_extend_D, guaranteesD]) 1); |
|
585 |
qed "guarantees_imp_extend_guarantees"; |
|
586 |
||
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
587 |
Goal "extend h F : (extend h `` X) guarantees (extend h `` Y) \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
588 |
\ ==> F : X guarantees Y"; |
6297 | 589 |
by (rtac guaranteesI 1); |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
590 |
by (auto_tac (claset(), simpset() addsimps [guar_def, component_def])); |
6297 | 591 |
by (dtac spec 1); |
592 |
by (dtac (mp RS mp) 1); |
|
593 |
by (Blast_tac 2); |
|
594 |
by (blast_tac (claset() addSDs [inj_extend RS inj_image_mem_iff RS iffD1]) 2); |
|
595 |
by Auto_tac; |
|
596 |
qed "extend_guarantees_imp_guarantees"; |
|
597 |
||
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
598 |
Goal "(extend h F : (extend h `` X) guarantees (extend h `` Y)) = \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
599 |
\ (F : X guarantees Y)"; |
6297 | 600 |
by (blast_tac (claset() addIs [guarantees_imp_extend_guarantees, |
601 |
extend_guarantees_imp_guarantees]) 1); |
|
602 |
qed "extend_guarantees_eq"; |
|
603 |
||
7341 | 604 |
(*Weak precondition and postcondition; this is the good one! |
7378 | 605 |
Not clear that it has a converse [or that we want one!] *) |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
606 |
val [xguary,project,extend] = |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
607 |
Goal "[| F : X guarantees Y; \ |
7378 | 608 |
\ !!G. extend h F Join G : XX ==> F Join project h G : X; \ |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
609 |
\ !!G. F Join project h G : Y ==> extend h F Join G : YY |] \ |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
610 |
\ ==> extend h F : XX guarantees YY"; |
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
611 |
by (rtac (xguary RS guaranteesD RS extend RS guaranteesI) 1); |
7378 | 612 |
by (etac project 1); |
7341 | 613 |
qed "project_guarantees"; |
614 |
||
615 |
(** It seems that neither "guarantees" law can be proved from the other. **) |
|
616 |
||
617 |
||
618 |
(*** guarantees corollaries ***) |
|
619 |
||
7387 | 620 |
Goal "F : UNIV guarantees increasing func \ |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
621 |
\ ==> extend h F : UNIV guarantees increasing (func o f)"; |
7341 | 622 |
by (etac project_guarantees 1); |
7387 | 623 |
by (asm_simp_tac |
624 |
(simpset() addsimps [project_extend_Join, project_increasing RS sym]) 2); |
|
7341 | 625 |
by Auto_tac; |
626 |
qed "extend_guar_increasing"; |
|
627 |
||
7387 | 628 |
Goal "F : UNIV guarantees Increasing func \ |
7362
f08fade5ea0d
new laws; changed "guar" back to "guarantees" (sorry)
paulson
parents:
7341
diff
changeset
|
629 |
\ ==> extend h F : UNIV guarantees Increasing (func o f)"; |
7341 | 630 |
by (etac project_guarantees 1); |
7387 | 631 |
by (asm_simp_tac |
632 |
(simpset() addsimps [project_extend_Join, project_Increasing_D]) 2); |
|
7341 | 633 |
by Auto_tac; |
634 |
qed "extend_guar_Increasing"; |
|
635 |
||
7387 | 636 |
Goal "F : (func localTo G) guarantees increasing func \ |
637 |
\ ==> extend h F : (func o f) localTo (extend h G) \ |
|
638 |
\ guarantees increasing (func o f)"; |
|
7341 | 639 |
by (etac project_guarantees 1); |
640 |
(*the "increasing" guarantee*) |
|
7387 | 641 |
by (asm_simp_tac |
642 |
(simpset() addsimps [project_extend_Join, project_increasing RS sym]) 2); |
|
7341 | 643 |
(*the "localTo" requirement*) |
7387 | 644 |
by (asm_simp_tac |
645 |
(simpset() addsimps [project_localTo_I, project_extend_Join RS sym]) 1); |
|
7341 | 646 |
qed "extend_localTo_guar_increasing"; |
647 |
||
7387 | 648 |
Goal "F : (func localTo G) guarantees Increasing func \ |
649 |
\ ==> extend h F : (func o f) localTo (extend h G) \ |
|
650 |
\ guarantees Increasing (func o f)"; |
|
7341 | 651 |
by (etac project_guarantees 1); |
652 |
(*the "Increasing" guarantee*) |
|
7387 | 653 |
by (asm_simp_tac |
654 |
(simpset() addsimps [project_extend_Join, project_Increasing_D]) 2); |
|
7341 | 655 |
(*the "localTo" requirement*) |
7387 | 656 |
by (asm_simp_tac |
657 |
(simpset() addsimps [project_localTo_I, project_extend_Join RS sym]) 1); |
|
7341 | 658 |
qed "extend_localTo_guar_Increasing"; |
659 |
||
6297 | 660 |
Close_locale "Extend"; |