author | paulson |
Wed, 08 Dec 1999 13:53:29 +0100 | |
changeset 8055 | bb15396278fb |
parent 8044 | 296b03b79505 |
child 8067 | 225e3b45b766 |
permissions | -rw-r--r-- |
8044 | 1 |
(* Title: HOL/UNITY/ELT |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1999 University of Cambridge |
|
5 |
||
6 |
leadsTo strengthened with a specification of the allowable sets transient parts |
|
7 |
*) |
|
8 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
9 |
Goalw [givenBy_def] "givenBy id = UNIV"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
10 |
by Auto_tac; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
11 |
qed "givenBy_id"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
12 |
Addsimps [givenBy_id]; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
13 |
|
8044 | 14 |
Goalw [givenBy_def] "(givenBy v) = {A. ALL x:A. ALL y. v x = v y --> y: A}"; |
15 |
by Safe_tac; |
|
16 |
by (res_inst_tac [("x", "v `` ?u")] image_eqI 2); |
|
17 |
by Auto_tac; |
|
18 |
qed "givenBy_eq_all"; |
|
19 |
||
20 |
Goal "givenBy v = {A. EX P. A = {s. P(v s)}}"; |
|
21 |
by (simp_tac (simpset() addsimps [givenBy_eq_all]) 1); |
|
22 |
by Safe_tac; |
|
23 |
by (res_inst_tac [("x", "%n. EX s. v s = n & s : ?A")] exI 1); |
|
24 |
by (Blast_tac 1); |
|
25 |
by Auto_tac; |
|
26 |
qed "givenBy_eq_Collect"; |
|
27 |
||
28 |
val prems = |
|
29 |
Goal "(!!x y. [| x:A; v x = v y |] ==> y: A) ==> A: givenBy v"; |
|
30 |
by (stac givenBy_eq_all 1); |
|
31 |
by (blast_tac (claset() addIs prems) 1); |
|
32 |
qed "givenByI"; |
|
33 |
||
34 |
Goalw [givenBy_def] "[| A: givenBy v; x:A; v x = v y |] ==> y: A"; |
|
35 |
by Auto_tac; |
|
36 |
qed "givenByD"; |
|
37 |
||
38 |
Goal "{} : givenBy v"; |
|
39 |
by (blast_tac (claset() addSIs [givenByI]) 1); |
|
40 |
qed "empty_mem_givenBy"; |
|
41 |
||
42 |
AddIffs [empty_mem_givenBy]; |
|
43 |
||
44 |
Goal "A: givenBy v ==> EX P. A = {s. P(v s)}"; |
|
45 |
by (res_inst_tac [("x", "%n. EX s. v s = n & s : A")] exI 1); |
|
46 |
by (full_simp_tac (simpset() addsimps [givenBy_eq_all]) 1); |
|
47 |
by (Blast_tac 1); |
|
48 |
qed "givenBy_imp_eq_Collect"; |
|
49 |
||
50 |
Goalw [givenBy_def] "EX P. A = {s. P(v s)} ==> A: givenBy v"; |
|
51 |
by (Best_tac 1); |
|
52 |
qed "eq_Collect_imp_givenBy"; |
|
53 |
||
54 |
Goal "givenBy v = {A. EX P. A = {s. P(v s)}}"; |
|
55 |
by (blast_tac (claset() addIs [eq_Collect_imp_givenBy, |
|
56 |
givenBy_imp_eq_Collect]) 1); |
|
57 |
qed "givenBy_eq_eq_Collect"; |
|
58 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
59 |
(*preserving v preserves properties given by v*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
60 |
Goal "[| F : preserves v; D : givenBy v |] ==> F : stable D"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
61 |
by (force_tac (claset(), |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
62 |
simpset() addsimps [impOfSubs preserves_subset_stable, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
63 |
givenBy_eq_Collect]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
64 |
qed "preserves_givenBy_imp_stable"; |
8044 | 65 |
|
66 |
||
67 |
(** Standard leadsTo rules **) |
|
68 |
||
69 |
Goalw [leadsETo_def] "[| F: A ensures B; A-B: CC |] ==> F : A leadsTo[CC] B"; |
|
70 |
by (blast_tac (claset() addIs [elt.Basis]) 1); |
|
71 |
qed "leadsETo_Basis"; |
|
72 |
||
73 |
Goalw [leadsETo_def] |
|
74 |
"[| F : A leadsTo[CC] B; F : B leadsTo[CC] C |] ==> F : A leadsTo[CC] C"; |
|
75 |
by (blast_tac (claset() addIs [elt.Trans]) 1); |
|
76 |
qed "leadsETo_Trans"; |
|
77 |
||
78 |
(*Useful with cancellation, disjunction*) |
|
79 |
Goal "F : A leadsTo[CC] (A' Un A') ==> F : A leadsTo[CC] A'"; |
|
80 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
|
81 |
qed "leadsETo_Un_duplicate"; |
|
82 |
||
83 |
Goal "F : A leadsTo[CC] (A' Un C Un C) ==> F : A leadsTo[CC] (A' Un C)"; |
|
84 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
|
85 |
qed "leadsETo_Un_duplicate2"; |
|
86 |
||
87 |
(*The Union introduction rule as we should have liked to state it*) |
|
88 |
val prems = Goalw [leadsETo_def] |
|
89 |
"(!!A. A : S ==> F : A leadsTo[CC] B) ==> F : (Union S) leadsTo[CC] B"; |
|
90 |
by (blast_tac (claset() addIs [elt.Union] addDs prems) 1); |
|
91 |
qed "leadsETo_Union"; |
|
92 |
||
93 |
val prems = Goal |
|
94 |
"(!!i. i : I ==> F : (A i) leadsTo[CC] B) \ |
|
95 |
\ ==> F : (UN i:I. A i) leadsTo[CC] B"; |
|
96 |
by (stac (Union_image_eq RS sym) 1); |
|
97 |
by (blast_tac (claset() addIs leadsETo_Union::prems) 1); |
|
98 |
qed "leadsETo_UN"; |
|
99 |
||
100 |
(*The INDUCTION rule as we should have liked to state it*) |
|
101 |
val major::prems = Goalw [leadsETo_def] |
|
102 |
"[| F : za leadsTo[CC] zb; \ |
|
103 |
\ !!A B. [| F : A ensures B; A-B : CC |] ==> P A B; \ |
|
104 |
\ !!A B C. [| F : A leadsTo[CC] B; P A B; F : B leadsTo[CC] C; P B C |] \ |
|
105 |
\ ==> P A C; \ |
|
106 |
\ !!B S. ALL A:S. F : A leadsTo[CC] B & P A B ==> P (Union S) B \ |
|
107 |
\ |] ==> P za zb"; |
|
108 |
by (rtac (major RS CollectD RS elt.induct) 1); |
|
109 |
by (REPEAT (blast_tac (claset() addIs prems) 1)); |
|
110 |
qed "leadsETo_induct"; |
|
111 |
||
112 |
||
113 |
(** New facts involving leadsETo **) |
|
114 |
||
115 |
Goal "CC' <= CC ==> (A leadsTo[CC'] B) <= (A leadsTo[CC] B)"; |
|
116 |
by Safe_tac; |
|
117 |
by (etac leadsETo_induct 1); |
|
118 |
by (blast_tac (claset() addIs [leadsETo_Union]) 3); |
|
119 |
by (blast_tac (claset() addIs [leadsETo_Trans]) 2); |
|
120 |
by (blast_tac (claset() addIs [leadsETo_Basis]) 1); |
|
121 |
qed "leadsETo_mono"; |
|
122 |
||
123 |
||
124 |
val prems = Goalw [leadsETo_def] |
|
125 |
"(!!A. A : S ==> F : (A Int C) leadsTo[CC] B) ==> F : (Union S Int C) leadsTo[CC] B"; |
|
126 |
by (simp_tac (HOL_ss addsimps [Int_Union_Union]) 1); |
|
127 |
by (blast_tac (claset() addIs [elt.Union] addDs prems) 1); |
|
128 |
qed "leadsETo_Union_Int"; |
|
129 |
||
130 |
(*Binary union introduction rule*) |
|
131 |
Goal "[| F : A leadsTo[CC] C; F : B leadsTo[CC] C |] ==> F : (A Un B) leadsTo[CC] C"; |
|
132 |
by (stac Un_eq_Union 1); |
|
133 |
by (blast_tac (claset() addIs [leadsETo_Union]) 1); |
|
134 |
qed "leadsETo_Un"; |
|
135 |
||
136 |
val prems = |
|
137 |
Goal "(!!x. x : A ==> F : {x} leadsTo[CC] B) ==> F : A leadsTo[CC] B"; |
|
138 |
by (stac (UN_singleton RS sym) 1 THEN rtac leadsETo_UN 1); |
|
139 |
by (blast_tac (claset() addIs prems) 1); |
|
140 |
qed "single_leadsETo_I"; |
|
141 |
||
142 |
||
143 |
Goal "[| A<=B; {}:CC |] ==> F : A leadsTo[CC] B"; |
|
144 |
by (asm_simp_tac (simpset() addsimps [subset_imp_ensures RS leadsETo_Basis, |
|
145 |
Diff_eq_empty_iff RS iffD2]) 1); |
|
146 |
qed "subset_imp_leadsETo"; |
|
147 |
||
148 |
bind_thm ("empty_leadsETo", empty_subsetI RS subset_imp_leadsETo); |
|
149 |
Addsimps [empty_leadsETo]; |
|
150 |
||
151 |
||
152 |
(** Weakening laws all require {}:CC **) |
|
153 |
||
154 |
Goal "[| F : A leadsTo[CC] A'; A'<=B'; {}:CC |] ==> F : A leadsTo[CC] B'"; |
|
155 |
by (blast_tac (claset() addIs [subset_imp_leadsETo, leadsETo_Trans]) 1); |
|
156 |
qed "leadsETo_weaken_R"; |
|
157 |
||
158 |
Goal "[| F : A leadsTo[CC] A'; B<=A; {}:CC |] ==> F : B leadsTo[CC] A'"; |
|
159 |
by (blast_tac (claset() addIs [leadsETo_Trans, subset_imp_leadsETo]) 1); |
|
160 |
qed_spec_mp "leadsETo_weaken_L"; |
|
161 |
||
162 |
(*Distributes over binary unions*) |
|
163 |
Goal "{} : CC ==> \ |
|
164 |
\ F : (A Un B) leadsTo[CC] C = (F : A leadsTo[CC] C & F : B leadsTo[CC] C)"; |
|
165 |
by (blast_tac (claset() addIs [leadsETo_Un, leadsETo_weaken_L]) 1); |
|
166 |
qed "leadsETo_Un_distrib"; |
|
167 |
||
168 |
Goal "{} : CC ==> \ |
|
169 |
\ F : (UN i:I. A i) leadsTo[CC] B = (ALL i : I. F : (A i) leadsTo[CC] B)"; |
|
170 |
by (blast_tac (claset() addIs [leadsETo_UN, leadsETo_weaken_L]) 1); |
|
171 |
qed "leadsETo_UN_distrib"; |
|
172 |
||
173 |
Goal "{} : CC \ |
|
174 |
\ ==> F : (Union S) leadsTo[CC] B = (ALL A : S. F : A leadsTo[CC] B)"; |
|
175 |
by (blast_tac (claset() addIs [leadsETo_Union, leadsETo_weaken_L]) 1); |
|
176 |
qed "leadsETo_Union_distrib"; |
|
177 |
||
178 |
Goal "[| F : A leadsTo[CC'] A'; B<=A; A'<=B'; CC' <= CC; {}:CC |] \ |
|
179 |
\ ==> F : B leadsTo[CC] B'"; |
|
180 |
by (dtac (impOfSubs leadsETo_mono) 1); |
|
181 |
by (assume_tac 1); |
|
182 |
by (blast_tac (claset() addIs [leadsETo_weaken_R, leadsETo_weaken_L, |
|
183 |
leadsETo_Trans]) 1); |
|
184 |
qed "leadsETo_weaken"; |
|
185 |
||
186 |
Goal "[| F : A leadsTo[CC] A'; CC <= givenBy v |] \ |
|
187 |
\ ==> F : A leadsTo[givenBy v] A'"; |
|
188 |
by (blast_tac (claset() addIs [empty_mem_givenBy, leadsETo_weaken]) 1); |
|
189 |
qed "leadsETo_givenBy"; |
|
190 |
||
191 |
||
192 |
(*Set difference*) |
|
193 |
Goal "[| F : (A-B) leadsTo[CC] C; F : B leadsTo[CC] C; {}:CC |] \ |
|
194 |
\ ==> F : A leadsTo[CC] C"; |
|
195 |
by (blast_tac (claset() addIs [leadsETo_Un, leadsETo_weaken]) 1); |
|
196 |
qed "leadsETo_Diff"; |
|
197 |
||
198 |
||
199 |
(** Meta or object quantifier ??? |
|
200 |
see ball_constrains_UN in UNITY.ML***) |
|
201 |
||
202 |
val prems = goal thy |
|
203 |
"[| !! i. i:I ==> F : (A i) leadsTo[CC] (A' i); {}:CC |] \ |
|
204 |
\ ==> F : (UN i:I. A i) leadsTo[CC] (UN i:I. A' i)"; |
|
205 |
by (simp_tac (HOL_ss addsimps [Union_image_eq RS sym]) 1); |
|
206 |
by (blast_tac (claset() addIs [leadsETo_Union, leadsETo_weaken_R] |
|
207 |
addIs prems) 1); |
|
208 |
qed "leadsETo_UN_UN"; |
|
209 |
||
210 |
(*Binary union version*) |
|
211 |
Goal "[| F : A leadsTo[CC] A'; F : B leadsTo[CC] B'; {}:CC |] \ |
|
212 |
\ ==> F : (A Un B) leadsTo[CC] (A' Un B')"; |
|
213 |
by (blast_tac (claset() addIs [leadsETo_Un, |
|
214 |
leadsETo_weaken_R]) 1); |
|
215 |
qed "leadsETo_Un_Un"; |
|
216 |
||
217 |
||
218 |
(** The cancellation law **) |
|
219 |
||
220 |
Goal "[| F : A leadsTo[CC] (A' Un B); F : B leadsTo[CC] B'; {}:CC |] \ |
|
221 |
\ ==> F : A leadsTo[CC] (A' Un B')"; |
|
222 |
by (blast_tac (claset() addIs [leadsETo_Un_Un, |
|
223 |
subset_imp_leadsETo, leadsETo_Trans]) 1); |
|
224 |
qed "leadsETo_cancel2"; |
|
225 |
||
226 |
Goal "[| F : A leadsTo[CC] (A' Un B); F : (B-A') leadsTo[CC] B'; {}:CC |] \ |
|
227 |
\ ==> F : A leadsTo[CC] (A' Un B')"; |
|
228 |
by (rtac leadsETo_cancel2 1); |
|
229 |
by (assume_tac 2); |
|
230 |
by (ALLGOALS Asm_simp_tac); |
|
231 |
qed "leadsETo_cancel_Diff2"; |
|
232 |
||
233 |
Goal "[| F : A leadsTo[CC] (B Un A'); F : B leadsTo[CC] B'; {}:CC |] \ |
|
234 |
\ ==> F : A leadsTo[CC] (B' Un A')"; |
|
235 |
by (asm_full_simp_tac (simpset() addsimps [Un_commute]) 1); |
|
236 |
by (blast_tac (claset() addSIs [leadsETo_cancel2]) 1); |
|
237 |
qed "leadsETo_cancel1"; |
|
238 |
||
239 |
Goal "[| F : A leadsTo[CC] (B Un A'); F : (B-A') leadsTo[CC] B'; {}:CC |] \ |
|
240 |
\ ==> F : A leadsTo[CC] (B' Un A')"; |
|
241 |
by (rtac leadsETo_cancel1 1); |
|
242 |
by (assume_tac 2); |
|
243 |
by (ALLGOALS Asm_simp_tac); |
|
244 |
qed "leadsETo_cancel_Diff1"; |
|
245 |
||
246 |
||
247 |
(** The impossibility law **) |
|
248 |
||
249 |
Goal "F : A leadsTo[CC] B ==> B={} --> A={}"; |
|
250 |
by (etac leadsETo_induct 1); |
|
251 |
by (ALLGOALS Asm_simp_tac); |
|
252 |
by (rewrite_goals_tac [ensures_def, constrains_def, transient_def]); |
|
253 |
by (Blast_tac 1); |
|
254 |
val lemma = result() RS mp; |
|
255 |
||
256 |
Goal "F : A leadsTo[CC] {} ==> A={}"; |
|
257 |
by (blast_tac (claset() addSIs [lemma]) 1); |
|
258 |
qed "leadsETo_empty"; |
|
259 |
||
260 |
||
261 |
(** PSP: Progress-Safety-Progress **) |
|
262 |
||
263 |
(*Special case of PSP: Misra's "stable conjunction"*) |
|
264 |
Goalw [stable_def] |
|
265 |
"[| F : A leadsTo[CC] A'; F : stable B; ALL C:CC. C Int B : CC |] \ |
|
266 |
\ ==> F : (A Int B) leadsTo[CC] (A' Int B)"; |
|
267 |
by (etac leadsETo_induct 1); |
|
268 |
by (blast_tac (claset() addIs [leadsETo_Union_Int]) 3); |
|
269 |
by (blast_tac (claset() addIs [leadsETo_Trans]) 2); |
|
270 |
by (rtac leadsETo_Basis 1); |
|
271 |
by (asm_full_simp_tac |
|
272 |
(simpset() addsimps [ensures_def, |
|
273 |
Diff_Int_distrib2 RS sym, Int_Un_distrib2 RS sym]) 1); |
|
274 |
by (asm_simp_tac (simpset() addsimps [Diff_Int_distrib2 RS sym]) 2); |
|
275 |
by (blast_tac (claset() addIs [transient_strengthen, constrains_Int]) 1); |
|
276 |
qed "e_psp_stable"; |
|
277 |
||
278 |
Goal "[| F : A leadsTo[CC] A'; F : stable B; ALL C:CC. C Int B : CC |] \ |
|
279 |
\ ==> F : (B Int A) leadsTo[CC] (B Int A')"; |
|
280 |
by (asm_simp_tac (simpset() addsimps e_psp_stable::Int_ac) 1); |
|
281 |
qed "e_psp_stable2"; |
|
282 |
||
283 |
Goal "[| F : A leadsTo[CC] A'; F : B co B'; \ |
|
284 |
\ ALL C:CC. C Int B Int B' : CC; {}:CC |] \ |
|
285 |
\ ==> F : (A Int B') leadsTo[CC] ((A' Int B) Un (B' - B))"; |
|
286 |
by (etac leadsETo_induct 1); |
|
287 |
by (blast_tac (claset() addIs [leadsETo_Union_Int]) 3); |
|
288 |
(*Transitivity case has a delicate argument involving "cancellation"*) |
|
289 |
by (rtac leadsETo_Un_duplicate2 2); |
|
290 |
by (etac leadsETo_cancel_Diff1 2); |
|
291 |
by (assume_tac 3); |
|
292 |
by (asm_full_simp_tac (simpset() addsimps [Int_Diff, Diff_triv]) 2); |
|
293 |
by (blast_tac (claset() addIs [leadsETo_weaken_L] |
|
294 |
addDs [constrains_imp_subset]) 2); |
|
295 |
(*Basis case*) |
|
296 |
by (rtac leadsETo_Basis 1); |
|
297 |
by (blast_tac (claset() addIs [psp_ensures]) 1); |
|
298 |
by (subgoal_tac "A Int B' - (Ba Int B Un (B' - B)) = (A - Ba) Int B Int B'" 1); |
|
299 |
by Auto_tac; |
|
300 |
qed "e_psp"; |
|
301 |
||
302 |
Goal "[| F : A leadsTo[CC] A'; F : B co B'; \ |
|
303 |
\ ALL C:CC. C Int B Int B' : CC; {}:CC |] \ |
|
304 |
\ ==> F : (B' Int A) leadsTo[CC] ((B Int A') Un (B' - B))"; |
|
305 |
by (asm_full_simp_tac (simpset() addsimps e_psp::Int_ac) 1); |
|
306 |
qed "e_psp2"; |
|
307 |
||
308 |
||
309 |
(*** Special properties involving the parameter [CC] ***) |
|
310 |
||
311 |
(*??IS THIS NEEDED?? or is it just an example of what's provable??*) |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
312 |
Goal "[| F: (A leadsTo[givenBy v] B); G : preserves v; \ |
8044 | 313 |
\ F Join G : stable C |] \ |
314 |
\ ==> F Join G : ((C Int A) leadsTo[(%D. C Int D) `` givenBy v] B)"; |
|
315 |
by (etac leadsETo_induct 1); |
|
316 |
by (stac Int_Union 3); |
|
317 |
by (blast_tac (claset() addIs [leadsETo_UN]) 3); |
|
318 |
by (blast_tac (claset() addIs [e_psp_stable2 RS leadsETo_weaken_L, |
|
319 |
leadsETo_Trans]) 2); |
|
320 |
by (rtac leadsETo_Basis 1); |
|
321 |
by (auto_tac (claset(), |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
322 |
simpset() addsimps [Int_Diff, ensures_def, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
323 |
givenBy_eq_Collect, Join_stable, |
8044 | 324 |
Join_constrains, Join_transient])); |
325 |
by (blast_tac (claset() addIs [transient_strengthen]) 3); |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
326 |
by (ALLGOALS (dres_inst_tac [("P1","P")] (impOfSubs preserves_subset_stable))); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
327 |
by (rewtac stable_def); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
328 |
by (blast_tac (claset() addSEs [equalityE] |
8044 | 329 |
addIs [constrains_Int RS constrains_weaken]) 2); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
330 |
by (blast_tac (claset() addSEs [equalityE] |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
331 |
addIs [constrains_Int RS constrains_weaken]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
332 |
qed "gen_leadsETo_imp_Join_leadsETo"; |
8044 | 333 |
|
334 |
(*useful??*) |
|
335 |
Goal "[| F Join G : (A leadsTo[CC] B); ALL C:CC. G : stable C |] \ |
|
336 |
\ ==> F: (A leadsTo[CC] B)"; |
|
337 |
by (etac leadsETo_induct 1); |
|
338 |
by (blast_tac (claset() addIs [leadsETo_Union]) 3); |
|
339 |
by (blast_tac (claset() addIs [leadsETo_Trans]) 2); |
|
340 |
by (rtac leadsETo_Basis 1); |
|
341 |
by (case_tac "A <= B" 1); |
|
342 |
by (etac subset_imp_ensures 1); |
|
343 |
by (auto_tac (claset() addIs [constrains_weaken], |
|
344 |
simpset() addsimps [stable_def, ensures_def, |
|
345 |
Join_constrains, Join_transient])); |
|
346 |
by (REPEAT (thin_tac "?F : ?A co ?B" 1)); |
|
347 |
by (etac transientE 1); |
|
348 |
by (rewtac constrains_def); |
|
349 |
by (blast_tac (claset() addSDs [bspec]) 1); |
|
350 |
qed "Join_leadsETo_stable_imp_leadsETo"; |
|
351 |
||
352 |
||
353 |
||
354 |
(**** EXTEND/PROJECT PROPERTIES ****) |
|
355 |
||
356 |
Open_locale "Extend"; |
|
357 |
||
358 |
(*Here h and f are locale constants*) |
|
359 |
Goal "extend_set h `` (givenBy v) <= (givenBy (v o f))"; |
|
360 |
by (simp_tac (simpset() addsimps [givenBy_eq_all]) 1); |
|
361 |
by (Blast_tac 1); |
|
362 |
qed "extend_set_givenBy_subset"; |
|
363 |
||
364 |
Goal "D : givenBy v ==> extend_set h D : givenBy (v o f)"; |
|
365 |
by (full_simp_tac (simpset() addsimps [givenBy_eq_all]) 1); |
|
366 |
by (Blast_tac 1); |
|
367 |
qed "extend_set_givenBy_I"; |
|
368 |
||
369 |
||
370 |
Goal "F : A leadsTo[CC] B \ |
|
371 |
\ ==> extend h F : (extend_set h A) leadsTo[extend_set h `` CC] \ |
|
372 |
\ (extend_set h B)"; |
|
373 |
by (etac leadsETo_induct 1); |
|
374 |
by (asm_simp_tac (simpset() addsimps [leadsETo_UN, extend_set_Union]) 3); |
|
375 |
by (blast_tac (claset() addIs [leadsETo_Trans]) 2); |
|
376 |
by (asm_simp_tac (simpset() addsimps [leadsETo_Basis, extend_ensures, |
|
377 |
extend_set_Diff_distrib RS sym]) 1); |
|
378 |
qed "leadsETo_imp_extend_leadsETo"; |
|
379 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
380 |
(*NEEDED?? THEN MOVE TO EXTEND.ML??*) |
8044 | 381 |
Goal "A Int extend_set h ((project_set h A) Int B) = A Int extend_set h B"; |
382 |
by (auto_tac (claset() addIs [project_set_I], |
|
383 |
simpset())); |
|
384 |
qed "Int_extend_set_lemma"; |
|
385 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
386 |
(*NEEDED?? THEN MOVE TO EXTEND.ML??*) |
8044 | 387 |
Goal "G : C co B ==> project h C G : project_set h C co project_set h B"; |
388 |
by (full_simp_tac (simpset() addsimps [constrains_def, project_def, |
|
389 |
project_act_def, project_set_def]) 1); |
|
390 |
by (Blast_tac 1); |
|
391 |
qed "project_constrains_project_set"; |
|
392 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
393 |
(*NEEDED?? THEN MOVE TO EXTEND.ML??*) |
8044 | 394 |
Goal "G : stable C ==> project h C G : stable (project_set h C)"; |
395 |
by (asm_full_simp_tac (simpset() addsimps [stable_def, |
|
396 |
project_constrains_project_set]) 1); |
|
397 |
qed "project_stable_project_set"; |
|
398 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
399 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
400 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
401 |
(*NOT USED, but analogous to preserves_project_transient_empty in Project.ML*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
402 |
Goal "[| G : preserves (v o f); project h C G : transient D; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
403 |
\ D : givenBy v |] ==> D={}"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
404 |
by (rtac stable_transient_empty 1); |
8044 | 405 |
by (assume_tac 2); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
406 |
(*If addIs then PROOF FAILED at depth 2*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
407 |
by (blast_tac (claset() addSIs [preserves_givenBy_imp_stable, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
408 |
project_preserves_I]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
409 |
result(); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
410 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
411 |
(*Generalizes the version proved in Project.ML*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
412 |
Goal "[| G : preserves (v o f); \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
413 |
\ project h C G : transient (C' Int D); \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
414 |
\ project h C G : stable C'; D : givenBy v |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
415 |
\ ==> C' Int D = {}"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
416 |
by (rtac stable_transient_empty 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
417 |
by (assume_tac 2); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
418 |
(*If addIs then PROOF FAILED at depth 3*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
419 |
by (blast_tac (claset() addSIs [stable_Int, preserves_givenBy_imp_stable, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
420 |
project_preserves_I]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
421 |
qed "preserves_o_project_transient_empty"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
422 |
|
8044 | 423 |
|
424 |
(*This version's stronger in the "ensures" precondition |
|
425 |
BUT there's no ensures_weaken_L*) |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
426 |
Goal "[| project h C G ~: transient (project_set h C Int (A-B)) | \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
427 |
\ project_set h C Int (A - B) = {}; \ |
8044 | 428 |
\ extend h F Join G : stable C; \ |
429 |
\ F Join project h C G : (project_set h C Int A) ensures B |] \ |
|
430 |
\ ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)"; |
|
431 |
by (stac (Int_extend_set_lemma RS sym) 1); |
|
432 |
by (rtac Join_project_ensures 1); |
|
433 |
by (auto_tac (claset(), simpset() addsimps [Int_Diff])); |
|
434 |
qed "Join_project_ensures_strong"; |
|
435 |
||
436 |
Goal "[| extend h F Join G : stable C; \ |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
437 |
\ F Join project h C G : (project_set h C Int A) leadsTo[(%D. project_set h C Int D)``givenBy v] B; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
438 |
\ G : preserves (v o f) |] \ |
8044 | 439 |
\ ==> extend h F Join G : \ |
440 |
\ (C Int extend_set h (project_set h C Int A)) \ |
|
441 |
\ leadsTo[(%D. C Int extend_set h D)``givenBy v] (extend_set h B)"; |
|
442 |
by (etac leadsETo_induct 1); |
|
443 |
by (asm_simp_tac (simpset() delsimps UN_simps |
|
444 |
addsimps [Int_UN_distrib, leadsETo_UN, extend_set_Union]) 3); |
|
445 |
by (blast_tac (claset() addIs [e_psp_stable2 RS leadsETo_weaken_L, |
|
446 |
leadsETo_Trans]) 2); |
|
447 |
by (Clarify_tac 1); |
|
448 |
by (rtac leadsETo_Basis 1); |
|
449 |
by (etac rev_image_eqI 2); |
|
450 |
by (asm_simp_tac (simpset() addsimps [Int_Diff, Int_extend_set_lemma, |
|
451 |
extend_set_Diff_distrib RS sym]) 2); |
|
452 |
by (rtac Join_project_ensures_strong 1); |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
453 |
by (auto_tac (claset() addDs [preserves_o_project_transient_empty] |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
454 |
addIs [project_stable_project_set], |
8044 | 455 |
simpset() addsimps [Int_left_absorb, Join_stable])); |
456 |
by (asm_simp_tac |
|
457 |
(simpset() addsimps [stable_ensures_Int RS ensures_weaken_R, |
|
458 |
Int_lower2, project_stable_project_set, |
|
459 |
Join_stable, extend_stable_project_set]) 1); |
|
460 |
val lemma = result(); |
|
461 |
||
462 |
Goal "[| extend h F Join G : stable C; \ |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
463 |
\ F Join project h C G : \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
464 |
\ (project_set h C Int A) \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
465 |
\ leadsTo[(%D. project_set h C Int D)``givenBy v] B; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
466 |
\ G : preserves (v o f) |] \ |
8044 | 467 |
\ ==> extend h F Join G : (C Int extend_set h A) \ |
468 |
\ leadsTo[(%D. C Int extend_set h D)``givenBy v] (extend_set h B)"; |
|
469 |
by (rtac (lemma RS leadsETo_weaken) 1); |
|
470 |
by (auto_tac (claset() addIs [project_set_I], simpset())); |
|
471 |
qed "project_leadsETo_lemma"; |
|
472 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
473 |
Goal "[| F Join project h UNIV G : A leadsTo[givenBy v] B; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
474 |
\ G : preserves (v o f) |] \ |
8044 | 475 |
\ ==> extend h F Join G : (extend_set h A) \ |
476 |
\ leadsTo[givenBy (v o f)] (extend_set h B)"; |
|
477 |
by (rtac (make_elim project_leadsETo_lemma) 1); |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
478 |
by (stac stable_UNIV 1); |
8044 | 479 |
by Auto_tac; |
480 |
by (etac leadsETo_givenBy 1); |
|
481 |
by (rtac extend_set_givenBy_subset 1); |
|
482 |
qed "project_leadsETo_D"; |
|
483 |
||
484 |
Goal "[| F Join project h (reachable (extend h F Join G)) G \ |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
485 |
\ : A LeadsTo[givenBy v] B; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
486 |
\ G : preserves (v o f) |] \ |
8044 | 487 |
\ ==> extend h F Join G : \ |
488 |
\ (extend_set h A) LeadsTo[givenBy (v o f)] (extend_set h B)"; |
|
489 |
by (rtac (make_elim (subset_refl RS stable_reachable RS |
|
490 |
project_leadsETo_lemma)) 1); |
|
491 |
by (auto_tac (claset(), |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
492 |
simpset() addsimps [LeadsETo_def])); |
8044 | 493 |
by (asm_full_simp_tac |
494 |
(simpset() addsimps [project_set_reachable_extend_eq RS sym]) 1); |
|
495 |
by (etac (impOfSubs leadsETo_mono) 1); |
|
496 |
by (blast_tac (claset() addIs [extend_set_givenBy_I]) 1); |
|
497 |
qed "project_LeadsETo_D"; |
|
498 |
||
499 |
Goalw [extending_def] |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
500 |
"extending (v o f) (%G. UNIV) h F \ |
8044 | 501 |
\ (extend_set h A leadsTo[givenBy (v o f)] extend_set h B) \ |
502 |
\ (A leadsTo[givenBy v] B)"; |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
503 |
by (auto_tac (claset(), simpset() addsimps [project_leadsETo_D])); |
8044 | 504 |
qed "extending_leadsETo"; |
505 |
||
506 |
||
507 |
Goalw [extending_def] |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
508 |
"extending (v o f) (%G. reachable (extend h F Join G)) h F \ |
8044 | 509 |
\ (extend_set h A LeadsTo[givenBy (v o f)] extend_set h B) \ |
510 |
\ (A LeadsTo[givenBy v] B)"; |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8044
diff
changeset
|
511 |
by (blast_tac (claset() addIs [project_LeadsETo_D]) 1); |
8044 | 512 |
qed "extending_LeadsETo"; |
513 |
||
514 |
||
515 |
Close_locale "Extend"; |
|
516 |
||
517 |