author | wenzelm |
Sat, 17 Oct 2009 14:43:18 +0200 | |
changeset 32960 | 69916a850301 |
parent 26806 | 40b411ec05aa |
child 36866 | 426d5781bb25 |
permissions | -rw-r--r-- |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
26806
diff
changeset
|
1 |
(* Title: HOL/UNITY/ELT.thy |
8044 | 2 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
3 |
Copyright 1999 University of Cambridge |
|
4 |
||
5 |
leadsTo strengthened with a specification of the allowable sets transient parts |
|
8122
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
6 |
|
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
7 |
TRY INSTEAD (to get rid of the {} and to gain strong induction) |
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
8 |
|
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
9 |
elt :: "['a set set, 'a program, 'a set] => ('a set) set" |
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
10 |
|
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
11 |
inductive "elt CC F B" |
13790 | 12 |
intros |
8122
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
13 |
|
13790 | 14 |
Weaken: "A <= B ==> A : elt CC F B" |
8122
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
15 |
|
13790 | 16 |
ETrans: "[| F : A ensures A'; A-A' : CC; A' : elt CC F B |] |
32960
69916a850301
eliminated hard tabulators, guessing at each author's individual tab-width;
wenzelm
parents:
26806
diff
changeset
|
17 |
==> A : elt CC F B" |
8122
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
18 |
|
13790 | 19 |
Union: "{A. A: S} : Pow (elt CC F B) ==> (Union S) : elt CC F B" |
8122
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
20 |
|
b43ad07660b9
working version, with Alloc now working on the same state space as the whole
paulson
parents:
8072
diff
changeset
|
21 |
monos Pow_mono |
8044 | 22 |
*) |
23 |
||
13798 | 24 |
header{*Progress Under Allowable Sets*} |
25 |
||
16417 | 26 |
theory ELT imports Project begin |
8044 | 27 |
|
23767 | 28 |
inductive_set |
8044 | 29 |
(*LEADS-TO constant for the inductive definition*) |
30 |
elt :: "['a set set, 'a program] => ('a set * 'a set) set" |
|
23767 | 31 |
for CC :: "'a set set" and F :: "'a program" |
32 |
where |
|
8044 | 33 |
|
13790 | 34 |
Basis: "[| F : A ensures B; A-B : (insert {} CC) |] ==> (A,B) : elt CC F" |
8044 | 35 |
|
23767 | 36 |
| Trans: "[| (A,B) : elt CC F; (B,C) : elt CC F |] ==> (A,C) : elt CC F" |
8044 | 37 |
|
23767 | 38 |
| Union: "ALL A: S. (A,B) : elt CC F ==> (Union S, B) : elt CC F" |
8044 | 39 |
|
40 |
||
41 |
constdefs |
|
8128 | 42 |
|
43 |
(*the set of all sets determined by f alone*) |
|
44 |
givenBy :: "['a => 'b] => 'a set set" |
|
10834 | 45 |
"givenBy f == range (%B. f-` B)" |
8044 | 46 |
|
47 |
(*visible version of the LEADS-TO relation*) |
|
48 |
leadsETo :: "['a set, 'a set set, 'a set] => 'a program set" |
|
49 |
("(3_/ leadsTo[_]/ _)" [80,0,80] 80) |
|
50 |
"leadsETo A CC B == {F. (A,B) : elt CC F}" |
|
51 |
||
52 |
LeadsETo :: "['a set, 'a set set, 'a set] => 'a program set" |
|
53 |
("(3_/ LeadsTo[_]/ _)" [80,0,80] 80) |
|
54 |
"LeadsETo A CC B == |
|
10834 | 55 |
{F. F : (reachable F Int A) leadsTo[(%C. reachable F Int C) ` CC] B}" |
8044 | 56 |
|
13790 | 57 |
|
58 |
(*** givenBy ***) |
|
59 |
||
60 |
lemma givenBy_id [simp]: "givenBy id = UNIV" |
|
61 |
by (unfold givenBy_def, auto) |
|
62 |
||
63 |
lemma givenBy_eq_all: "(givenBy v) = {A. ALL x:A. ALL y. v x = v y --> y: A}" |
|
64 |
apply (unfold givenBy_def, safe) |
|
65 |
apply (rule_tac [2] x = "v ` ?u" in image_eqI, auto) |
|
66 |
done |
|
67 |
||
68 |
lemma givenByI: "(!!x y. [| x:A; v x = v y |] ==> y: A) ==> A: givenBy v" |
|
69 |
by (subst givenBy_eq_all, blast) |
|
70 |
||
71 |
lemma givenByD: "[| A: givenBy v; x:A; v x = v y |] ==> y: A" |
|
72 |
by (unfold givenBy_def, auto) |
|
73 |
||
74 |
lemma empty_mem_givenBy [iff]: "{} : givenBy v" |
|
75 |
by (blast intro!: givenByI) |
|
76 |
||
77 |
lemma givenBy_imp_eq_Collect: "A: givenBy v ==> EX P. A = {s. P(v s)}" |
|
78 |
apply (rule_tac x = "%n. EX s. v s = n & s : A" in exI) |
|
79 |
apply (simp (no_asm_use) add: givenBy_eq_all) |
|
80 |
apply blast |
|
81 |
done |
|
82 |
||
83 |
lemma Collect_mem_givenBy: "{s. P(v s)} : givenBy v" |
|
84 |
by (unfold givenBy_def, best) |
|
85 |
||
86 |
lemma givenBy_eq_Collect: "givenBy v = {A. EX P. A = {s. P(v s)}}" |
|
87 |
by (blast intro: Collect_mem_givenBy givenBy_imp_eq_Collect) |
|
88 |
||
89 |
(*preserving v preserves properties given by v*) |
|
90 |
lemma preserves_givenBy_imp_stable: |
|
91 |
"[| F : preserves v; D : givenBy v |] ==> F : stable D" |
|
13798 | 92 |
by (force simp add: preserves_subset_stable [THEN subsetD] givenBy_eq_Collect) |
13790 | 93 |
|
94 |
lemma givenBy_o_subset: "givenBy (w o v) <= givenBy v" |
|
95 |
apply (simp (no_asm) add: givenBy_eq_Collect) |
|
96 |
apply best |
|
97 |
done |
|
98 |
||
99 |
lemma givenBy_DiffI: |
|
100 |
"[| A : givenBy v; B : givenBy v |] ==> A-B : givenBy v" |
|
101 |
apply (simp (no_asm_use) add: givenBy_eq_Collect) |
|
102 |
apply safe |
|
103 |
apply (rule_tac x = "%z. ?R z & ~ ?Q z" in exI) |
|
26806 | 104 |
unfolding set_diff_eq |
26349 | 105 |
apply auto |
13790 | 106 |
done |
107 |
||
108 |
||
109 |
(** Standard leadsTo rules **) |
|
110 |
||
111 |
lemma leadsETo_Basis [intro]: |
|
112 |
"[| F: A ensures B; A-B: insert {} CC |] ==> F : A leadsTo[CC] B" |
|
113 |
apply (unfold leadsETo_def) |
|
114 |
apply (blast intro: elt.Basis) |
|
115 |
done |
|
116 |
||
117 |
lemma leadsETo_Trans: |
|
118 |
"[| F : A leadsTo[CC] B; F : B leadsTo[CC] C |] ==> F : A leadsTo[CC] C" |
|
119 |
apply (unfold leadsETo_def) |
|
120 |
apply (blast intro: elt.Trans) |
|
121 |
done |
|
122 |
||
123 |
||
124 |
(*Useful with cancellation, disjunction*) |
|
125 |
lemma leadsETo_Un_duplicate: |
|
126 |
"F : A leadsTo[CC] (A' Un A') ==> F : A leadsTo[CC] A'" |
|
13819 | 127 |
by (simp add: Un_ac) |
13790 | 128 |
|
129 |
lemma leadsETo_Un_duplicate2: |
|
130 |
"F : A leadsTo[CC] (A' Un C Un C) ==> F : A leadsTo[CC] (A' Un C)" |
|
131 |
by (simp add: Un_ac) |
|
132 |
||
133 |
(*The Union introduction rule as we should have liked to state it*) |
|
134 |
lemma leadsETo_Union: |
|
135 |
"(!!A. A : S ==> F : A leadsTo[CC] B) ==> F : (Union S) leadsTo[CC] B" |
|
136 |
apply (unfold leadsETo_def) |
|
137 |
apply (blast intro: elt.Union) |
|
138 |
done |
|
139 |
||
140 |
lemma leadsETo_UN: |
|
141 |
"(!!i. i : I ==> F : (A i) leadsTo[CC] B) |
|
142 |
==> F : (UN i:I. A i) leadsTo[CC] B" |
|
143 |
apply (subst Union_image_eq [symmetric]) |
|
144 |
apply (blast intro: leadsETo_Union) |
|
145 |
done |
|
146 |
||
147 |
(*The INDUCTION rule as we should have liked to state it*) |
|
148 |
lemma leadsETo_induct: |
|
149 |
"[| F : za leadsTo[CC] zb; |
|
150 |
!!A B. [| F : A ensures B; A-B : insert {} CC |] ==> P A B; |
|
151 |
!!A B C. [| F : A leadsTo[CC] B; P A B; F : B leadsTo[CC] C; P B C |] |
|
152 |
==> P A C; |
|
153 |
!!B S. ALL A:S. F : A leadsTo[CC] B & P A B ==> P (Union S) B |
|
154 |
|] ==> P za zb" |
|
155 |
apply (unfold leadsETo_def) |
|
156 |
apply (drule CollectD) |
|
157 |
apply (erule elt.induct, blast+) |
|
158 |
done |
|
159 |
||
160 |
||
161 |
(** New facts involving leadsETo **) |
|
162 |
||
163 |
lemma leadsETo_mono: "CC' <= CC ==> (A leadsTo[CC'] B) <= (A leadsTo[CC] B)" |
|
164 |
apply safe |
|
165 |
apply (erule leadsETo_induct) |
|
166 |
prefer 3 apply (blast intro: leadsETo_Union) |
|
167 |
prefer 2 apply (blast intro: leadsETo_Trans) |
|
168 |
apply (blast intro: leadsETo_Basis) |
|
169 |
done |
|
170 |
||
171 |
lemma leadsETo_Trans_Un: |
|
172 |
"[| F : A leadsTo[CC] B; F : B leadsTo[DD] C |] |
|
173 |
==> F : A leadsTo[CC Un DD] C" |
|
174 |
by (blast intro: leadsETo_mono [THEN subsetD] leadsETo_Trans) |
|
175 |
||
176 |
lemma leadsETo_Union_Int: |
|
177 |
"(!!A. A : S ==> F : (A Int C) leadsTo[CC] B) |
|
178 |
==> F : (Union S Int C) leadsTo[CC] B" |
|
179 |
apply (unfold leadsETo_def) |
|
180 |
apply (simp only: Int_Union_Union) |
|
181 |
apply (blast intro: elt.Union) |
|
182 |
done |
|
183 |
||
184 |
(*Binary union introduction rule*) |
|
185 |
lemma leadsETo_Un: |
|
186 |
"[| F : A leadsTo[CC] C; F : B leadsTo[CC] C |] |
|
187 |
==> F : (A Un B) leadsTo[CC] C" |
|
188 |
apply (subst Un_eq_Union) |
|
189 |
apply (blast intro: leadsETo_Union) |
|
190 |
done |
|
191 |
||
192 |
lemma single_leadsETo_I: |
|
193 |
"(!!x. x : A ==> F : {x} leadsTo[CC] B) ==> F : A leadsTo[CC] B" |
|
13819 | 194 |
by (subst UN_singleton [symmetric], rule leadsETo_UN, blast) |
13790 | 195 |
|
196 |
||
197 |
lemma subset_imp_leadsETo: "A<=B ==> F : A leadsTo[CC] B" |
|
13819 | 198 |
by (simp add: subset_imp_ensures [THEN leadsETo_Basis] |
199 |
Diff_eq_empty_iff [THEN iffD2]) |
|
13790 | 200 |
|
201 |
lemmas empty_leadsETo = empty_subsetI [THEN subset_imp_leadsETo, simp] |
|
202 |
||
203 |
||
204 |
||
205 |
(** Weakening laws **) |
|
206 |
||
207 |
lemma leadsETo_weaken_R: |
|
208 |
"[| F : A leadsTo[CC] A'; A'<=B' |] ==> F : A leadsTo[CC] B'" |
|
13819 | 209 |
by (blast intro: subset_imp_leadsETo leadsETo_Trans) |
13790 | 210 |
|
13798 | 211 |
lemma leadsETo_weaken_L [rule_format]: |
13790 | 212 |
"[| F : A leadsTo[CC] A'; B<=A |] ==> F : B leadsTo[CC] A'" |
13819 | 213 |
by (blast intro: leadsETo_Trans subset_imp_leadsETo) |
13790 | 214 |
|
215 |
(*Distributes over binary unions*) |
|
216 |
lemma leadsETo_Un_distrib: |
|
217 |
"F : (A Un B) leadsTo[CC] C = |
|
218 |
(F : A leadsTo[CC] C & F : B leadsTo[CC] C)" |
|
13819 | 219 |
by (blast intro: leadsETo_Un leadsETo_weaken_L) |
13790 | 220 |
|
221 |
lemma leadsETo_UN_distrib: |
|
222 |
"F : (UN i:I. A i) leadsTo[CC] B = |
|
223 |
(ALL i : I. F : (A i) leadsTo[CC] B)" |
|
13819 | 224 |
by (blast intro: leadsETo_UN leadsETo_weaken_L) |
13790 | 225 |
|
226 |
lemma leadsETo_Union_distrib: |
|
227 |
"F : (Union S) leadsTo[CC] B = (ALL A : S. F : A leadsTo[CC] B)" |
|
13819 | 228 |
by (blast intro: leadsETo_Union leadsETo_weaken_L) |
13790 | 229 |
|
230 |
lemma leadsETo_weaken: |
|
231 |
"[| F : A leadsTo[CC'] A'; B<=A; A'<=B'; CC' <= CC |] |
|
232 |
==> F : B leadsTo[CC] B'" |
|
233 |
apply (drule leadsETo_mono [THEN subsetD], assumption) |
|
13819 | 234 |
apply (blast del: subsetCE |
235 |
intro: leadsETo_weaken_R leadsETo_weaken_L leadsETo_Trans) |
|
13790 | 236 |
done |
237 |
||
238 |
lemma leadsETo_givenBy: |
|
239 |
"[| F : A leadsTo[CC] A'; CC <= givenBy v |] |
|
240 |
==> F : A leadsTo[givenBy v] A'" |
|
241 |
by (blast intro: empty_mem_givenBy leadsETo_weaken) |
|
242 |
||
243 |
||
244 |
(*Set difference*) |
|
245 |
lemma leadsETo_Diff: |
|
246 |
"[| F : (A-B) leadsTo[CC] C; F : B leadsTo[CC] C |] |
|
247 |
==> F : A leadsTo[CC] C" |
|
248 |
by (blast intro: leadsETo_Un leadsETo_weaken) |
|
249 |
||
250 |
||
251 |
(*Binary union version*) |
|
252 |
lemma leadsETo_Un_Un: |
|
253 |
"[| F : A leadsTo[CC] A'; F : B leadsTo[CC] B' |] |
|
254 |
==> F : (A Un B) leadsTo[CC] (A' Un B')" |
|
255 |
by (blast intro: leadsETo_Un leadsETo_weaken_R) |
|
256 |
||
257 |
||
258 |
(** The cancellation law **) |
|
259 |
||
260 |
lemma leadsETo_cancel2: |
|
261 |
"[| F : A leadsTo[CC] (A' Un B); F : B leadsTo[CC] B' |] |
|
262 |
==> F : A leadsTo[CC] (A' Un B')" |
|
263 |
by (blast intro: leadsETo_Un_Un subset_imp_leadsETo leadsETo_Trans) |
|
264 |
||
265 |
lemma leadsETo_cancel1: |
|
266 |
"[| F : A leadsTo[CC] (B Un A'); F : B leadsTo[CC] B' |] |
|
267 |
==> F : A leadsTo[CC] (B' Un A')" |
|
268 |
apply (simp add: Un_commute) |
|
269 |
apply (blast intro!: leadsETo_cancel2) |
|
270 |
done |
|
271 |
||
272 |
lemma leadsETo_cancel_Diff1: |
|
273 |
"[| F : A leadsTo[CC] (B Un A'); F : (B-A') leadsTo[CC] B' |] |
|
274 |
==> F : A leadsTo[CC] (B' Un A')" |
|
275 |
apply (rule leadsETo_cancel1) |
|
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13798
diff
changeset
|
276 |
prefer 2 apply assumption |
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13798
diff
changeset
|
277 |
apply simp_all |
13790 | 278 |
done |
279 |
||
280 |
||
281 |
(** PSP: Progress-Safety-Progress **) |
|
282 |
||
283 |
(*Special case of PSP: Misra's "stable conjunction"*) |
|
284 |
lemma e_psp_stable: |
|
285 |
"[| F : A leadsTo[CC] A'; F : stable B; ALL C:CC. C Int B : CC |] |
|
286 |
==> F : (A Int B) leadsTo[CC] (A' Int B)" |
|
287 |
apply (unfold stable_def) |
|
288 |
apply (erule leadsETo_induct) |
|
289 |
prefer 3 apply (blast intro: leadsETo_Union_Int) |
|
290 |
prefer 2 apply (blast intro: leadsETo_Trans) |
|
291 |
apply (rule leadsETo_Basis) |
|
292 |
prefer 2 apply (force simp add: Diff_Int_distrib2 [symmetric]) |
|
13819 | 293 |
apply (simp add: ensures_def Diff_Int_distrib2 [symmetric] |
294 |
Int_Un_distrib2 [symmetric]) |
|
13790 | 295 |
apply (blast intro: transient_strengthen constrains_Int) |
296 |
done |
|
297 |
||
298 |
lemma e_psp_stable2: |
|
299 |
"[| F : A leadsTo[CC] A'; F : stable B; ALL C:CC. C Int B : CC |] |
|
300 |
==> F : (B Int A) leadsTo[CC] (B Int A')" |
|
301 |
by (simp (no_asm_simp) add: e_psp_stable Int_ac) |
|
302 |
||
303 |
lemma e_psp: |
|
304 |
"[| F : A leadsTo[CC] A'; F : B co B'; |
|
305 |
ALL C:CC. C Int B Int B' : CC |] |
|
306 |
==> F : (A Int B') leadsTo[CC] ((A' Int B) Un (B' - B))" |
|
307 |
apply (erule leadsETo_induct) |
|
308 |
prefer 3 apply (blast intro: leadsETo_Union_Int) |
|
309 |
(*Transitivity case has a delicate argument involving "cancellation"*) |
|
310 |
apply (rule_tac [2] leadsETo_Un_duplicate2) |
|
311 |
apply (erule_tac [2] leadsETo_cancel_Diff1) |
|
312 |
prefer 2 |
|
313 |
apply (simp add: Int_Diff Diff_triv) |
|
314 |
apply (blast intro: leadsETo_weaken_L dest: constrains_imp_subset) |
|
315 |
(*Basis case*) |
|
316 |
apply (rule leadsETo_Basis) |
|
317 |
apply (blast intro: psp_ensures) |
|
318 |
apply (subgoal_tac "A Int B' - (Ba Int B Un (B' - B)) = (A - Ba) Int B Int B'") |
|
319 |
apply auto |
|
320 |
done |
|
321 |
||
322 |
lemma e_psp2: |
|
323 |
"[| F : A leadsTo[CC] A'; F : B co B'; |
|
324 |
ALL C:CC. C Int B Int B' : CC |] |
|
325 |
==> F : (B' Int A) leadsTo[CC] ((B Int A') Un (B' - B))" |
|
326 |
by (simp add: e_psp Int_ac) |
|
327 |
||
328 |
||
329 |
(*** Special properties involving the parameter [CC] ***) |
|
330 |
||
331 |
(*??IS THIS NEEDED?? or is it just an example of what's provable??*) |
|
332 |
lemma gen_leadsETo_imp_Join_leadsETo: |
|
333 |
"[| F: (A leadsTo[givenBy v] B); G : preserves v; |
|
13819 | 334 |
F\<squnion>G : stable C |] |
335 |
==> F\<squnion>G : ((C Int A) leadsTo[(%D. C Int D) ` givenBy v] B)" |
|
13790 | 336 |
apply (erule leadsETo_induct) |
337 |
prefer 3 |
|
338 |
apply (subst Int_Union) |
|
339 |
apply (blast intro: leadsETo_UN) |
|
340 |
prefer 2 |
|
341 |
apply (blast intro: e_psp_stable2 [THEN leadsETo_weaken_L] leadsETo_Trans) |
|
342 |
apply (rule leadsETo_Basis) |
|
13819 | 343 |
apply (auto simp add: Diff_eq_empty_iff [THEN iffD2] |
344 |
Int_Diff ensures_def givenBy_eq_Collect Join_transient) |
|
13790 | 345 |
prefer 3 apply (blast intro: transient_strengthen) |
346 |
apply (drule_tac [2] P1 = P in preserves_subset_stable [THEN subsetD]) |
|
347 |
apply (drule_tac P1 = P in preserves_subset_stable [THEN subsetD]) |
|
348 |
apply (unfold stable_def) |
|
349 |
apply (blast intro: constrains_Int [THEN constrains_weaken])+ |
|
350 |
done |
|
351 |
||
352 |
(**** Relationship with traditional "leadsTo", strong & weak ****) |
|
353 |
||
354 |
(** strong **) |
|
355 |
||
356 |
lemma leadsETo_subset_leadsTo: "(A leadsTo[CC] B) <= (A leadsTo B)" |
|
357 |
apply safe |
|
358 |
apply (erule leadsETo_induct) |
|
13819 | 359 |
prefer 3 apply (blast intro: leadsTo_Union) |
360 |
prefer 2 apply (blast intro: leadsTo_Trans, blast) |
|
13790 | 361 |
done |
362 |
||
363 |
lemma leadsETo_UNIV_eq_leadsTo: "(A leadsTo[UNIV] B) = (A leadsTo B)" |
|
364 |
apply safe |
|
365 |
apply (erule leadsETo_subset_leadsTo [THEN subsetD]) |
|
366 |
(*right-to-left case*) |
|
367 |
apply (erule leadsTo_induct) |
|
13819 | 368 |
prefer 3 apply (blast intro: leadsETo_Union) |
369 |
prefer 2 apply (blast intro: leadsETo_Trans, blast) |
|
13790 | 370 |
done |
371 |
||
372 |
(**** weak ****) |
|
373 |
||
374 |
lemma LeadsETo_eq_leadsETo: |
|
375 |
"A LeadsTo[CC] B = |
|
376 |
{F. F : (reachable F Int A) leadsTo[(%C. reachable F Int C) ` CC] |
|
377 |
(reachable F Int B)}" |
|
378 |
apply (unfold LeadsETo_def) |
|
379 |
apply (blast dest: e_psp_stable2 intro: leadsETo_weaken) |
|
380 |
done |
|
381 |
||
382 |
(*** Introduction rules: Basis, Trans, Union ***) |
|
383 |
||
384 |
lemma LeadsETo_Trans: |
|
385 |
"[| F : A LeadsTo[CC] B; F : B LeadsTo[CC] C |] |
|
386 |
==> F : A LeadsTo[CC] C" |
|
387 |
apply (simp add: LeadsETo_eq_leadsETo) |
|
388 |
apply (blast intro: leadsETo_Trans) |
|
389 |
done |
|
390 |
||
391 |
lemma LeadsETo_Union: |
|
392 |
"(!!A. A : S ==> F : A LeadsTo[CC] B) ==> F : (Union S) LeadsTo[CC] B" |
|
393 |
apply (simp add: LeadsETo_def) |
|
394 |
apply (subst Int_Union) |
|
395 |
apply (blast intro: leadsETo_UN) |
|
396 |
done |
|
397 |
||
398 |
lemma LeadsETo_UN: |
|
399 |
"(!!i. i : I ==> F : (A i) LeadsTo[CC] B) |
|
400 |
==> F : (UN i:I. A i) LeadsTo[CC] B" |
|
401 |
apply (simp only: Union_image_eq [symmetric]) |
|
402 |
apply (blast intro: LeadsETo_Union) |
|
403 |
done |
|
404 |
||
405 |
(*Binary union introduction rule*) |
|
406 |
lemma LeadsETo_Un: |
|
407 |
"[| F : A LeadsTo[CC] C; F : B LeadsTo[CC] C |] |
|
408 |
==> F : (A Un B) LeadsTo[CC] C" |
|
409 |
apply (subst Un_eq_Union) |
|
410 |
apply (blast intro: LeadsETo_Union) |
|
411 |
done |
|
412 |
||
413 |
(*Lets us look at the starting state*) |
|
414 |
lemma single_LeadsETo_I: |
|
415 |
"(!!s. s : A ==> F : {s} LeadsTo[CC] B) ==> F : A LeadsTo[CC] B" |
|
13819 | 416 |
by (subst UN_singleton [symmetric], rule LeadsETo_UN, blast) |
13790 | 417 |
|
418 |
lemma subset_imp_LeadsETo: |
|
419 |
"A <= B ==> F : A LeadsTo[CC] B" |
|
420 |
apply (simp (no_asm) add: LeadsETo_def) |
|
421 |
apply (blast intro: subset_imp_leadsETo) |
|
422 |
done |
|
423 |
||
424 |
lemmas empty_LeadsETo = empty_subsetI [THEN subset_imp_LeadsETo, standard] |
|
425 |
||
13798 | 426 |
lemma LeadsETo_weaken_R [rule_format]: |
13790 | 427 |
"[| F : A LeadsTo[CC] A'; A' <= B' |] ==> F : A LeadsTo[CC] B'" |
428 |
apply (simp (no_asm_use) add: LeadsETo_def) |
|
429 |
apply (blast intro: leadsETo_weaken_R) |
|
430 |
done |
|
431 |
||
13798 | 432 |
lemma LeadsETo_weaken_L [rule_format]: |
13790 | 433 |
"[| F : A LeadsTo[CC] A'; B <= A |] ==> F : B LeadsTo[CC] A'" |
434 |
apply (simp (no_asm_use) add: LeadsETo_def) |
|
435 |
apply (blast intro: leadsETo_weaken_L) |
|
436 |
done |
|
437 |
||
438 |
lemma LeadsETo_weaken: |
|
439 |
"[| F : A LeadsTo[CC'] A'; |
|
440 |
B <= A; A' <= B'; CC' <= CC |] |
|
441 |
==> F : B LeadsTo[CC] B'" |
|
442 |
apply (simp (no_asm_use) add: LeadsETo_def) |
|
443 |
apply (blast intro: leadsETo_weaken) |
|
444 |
done |
|
445 |
||
446 |
lemma LeadsETo_subset_LeadsTo: "(A LeadsTo[CC] B) <= (A LeadsTo B)" |
|
447 |
apply (unfold LeadsETo_def LeadsTo_def) |
|
448 |
apply (blast intro: leadsETo_subset_leadsTo [THEN subsetD]) |
|
449 |
done |
|
450 |
||
451 |
(*Postcondition can be strengthened to (reachable F Int B) *) |
|
452 |
lemma reachable_ensures: |
|
453 |
"F : A ensures B ==> F : (reachable F Int A) ensures B" |
|
454 |
apply (rule stable_ensures_Int [THEN ensures_weaken_R], auto) |
|
455 |
done |
|
456 |
||
457 |
lemma lel_lemma: |
|
458 |
"F : A leadsTo B ==> F : (reachable F Int A) leadsTo[Pow(reachable F)] B" |
|
459 |
apply (erule leadsTo_induct) |
|
460 |
apply (blast intro: reachable_ensures leadsETo_Basis) |
|
461 |
apply (blast dest: e_psp_stable2 intro: leadsETo_Trans leadsETo_weaken_L) |
|
462 |
apply (subst Int_Union) |
|
463 |
apply (blast intro: leadsETo_UN) |
|
464 |
done |
|
465 |
||
466 |
lemma LeadsETo_UNIV_eq_LeadsTo: "(A LeadsTo[UNIV] B) = (A LeadsTo B)" |
|
467 |
apply safe |
|
468 |
apply (erule LeadsETo_subset_LeadsTo [THEN subsetD]) |
|
469 |
(*right-to-left case*) |
|
470 |
apply (unfold LeadsETo_def LeadsTo_def) |
|
13836 | 471 |
apply (blast intro: lel_lemma [THEN leadsETo_weaken]) |
13790 | 472 |
done |
473 |
||
474 |
||
475 |
(**** EXTEND/PROJECT PROPERTIES ****) |
|
476 |
||
13819 | 477 |
lemma (in Extend) givenBy_o_eq_extend_set: |
478 |
"givenBy (v o f) = extend_set h ` (givenBy v)" |
|
13836 | 479 |
apply (simp add: givenBy_eq_Collect) |
480 |
apply (rule equalityI, best) |
|
481 |
apply blast |
|
482 |
done |
|
13790 | 483 |
|
484 |
lemma (in Extend) givenBy_eq_extend_set: "givenBy f = range (extend_set h)" |
|
13836 | 485 |
by (simp add: givenBy_eq_Collect, best) |
13790 | 486 |
|
487 |
lemma (in Extend) extend_set_givenBy_I: |
|
488 |
"D : givenBy v ==> extend_set h D : givenBy (v o f)" |
|
13836 | 489 |
apply (simp (no_asm_use) add: givenBy_eq_all, blast) |
13790 | 490 |
done |
491 |
||
492 |
lemma (in Extend) leadsETo_imp_extend_leadsETo: |
|
493 |
"F : A leadsTo[CC] B |
|
494 |
==> extend h F : (extend_set h A) leadsTo[extend_set h ` CC] |
|
495 |
(extend_set h B)" |
|
496 |
apply (erule leadsETo_induct) |
|
497 |
apply (force intro: leadsETo_Basis subset_imp_ensures |
|
498 |
simp add: extend_ensures extend_set_Diff_distrib [symmetric]) |
|
499 |
apply (blast intro: leadsETo_Trans) |
|
500 |
apply (simp add: leadsETo_UN extend_set_Union) |
|
501 |
done |
|
502 |
||
503 |
||
504 |
(*This version's stronger in the "ensures" precondition |
|
505 |
BUT there's no ensures_weaken_L*) |
|
506 |
lemma (in Extend) Join_project_ensures_strong: |
|
507 |
"[| project h C G ~: transient (project_set h C Int (A-B)) | |
|
508 |
project_set h C Int (A - B) = {}; |
|
13819 | 509 |
extend h F\<squnion>G : stable C; |
510 |
F\<squnion>project h C G : (project_set h C Int A) ensures B |] |
|
511 |
==> extend h F\<squnion>G : (C Int extend_set h A) ensures (extend_set h B)" |
|
13790 | 512 |
apply (subst Int_extend_set_lemma [symmetric]) |
513 |
apply (rule Join_project_ensures) |
|
514 |
apply (auto simp add: Int_Diff) |
|
515 |
done |
|
516 |
||
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13798
diff
changeset
|
517 |
(*NOT WORKING. MODIFY AS IN Project.thy |
13790 | 518 |
lemma (in Extend) pld_lemma: |
13819 | 519 |
"[| extend h F\<squnion>G : stable C; |
520 |
F\<squnion>project h C G : (project_set h C Int A) leadsTo[(%D. project_set h C Int D)`givenBy v] B; |
|
13790 | 521 |
G : preserves (v o f) |] |
13819 | 522 |
==> extend h F\<squnion>G : |
13790 | 523 |
(C Int extend_set h (project_set h C Int A)) |
524 |
leadsTo[(%D. C Int extend_set h D)`givenBy v] (extend_set h B)" |
|
525 |
apply (erule leadsETo_induct) |
|
526 |
prefer 3 |
|
527 |
apply (simp del: UN_simps add: Int_UN_distrib leadsETo_UN extend_set_Union) |
|
528 |
prefer 2 |
|
529 |
apply (blast intro: e_psp_stable2 [THEN leadsETo_weaken_L] leadsETo_Trans) |
|
530 |
txt{*Base case is hard*} |
|
531 |
apply auto |
|
532 |
apply (force intro: leadsETo_Basis subset_imp_ensures) |
|
533 |
apply (rule leadsETo_Basis) |
|
534 |
prefer 2 |
|
535 |
apply (simp add: Int_Diff Int_extend_set_lemma extend_set_Diff_distrib [symmetric]) |
|
536 |
apply (rule Join_project_ensures_strong) |
|
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13798
diff
changeset
|
537 |
apply (auto intro: project_stable_project_set simp add: Int_left_absorb) |
13790 | 538 |
apply (simp (no_asm_simp) add: stable_ensures_Int [THEN ensures_weaken_R] Int_lower2 project_stable_project_set extend_stable_project_set) |
539 |
done |
|
540 |
||
541 |
lemma (in Extend) project_leadsETo_D_lemma: |
|
13819 | 542 |
"[| extend h F\<squnion>G : stable C; |
543 |
F\<squnion>project h C G : |
|
13790 | 544 |
(project_set h C Int A) |
545 |
leadsTo[(%D. project_set h C Int D)`givenBy v] B; |
|
546 |
G : preserves (v o f) |] |
|
13819 | 547 |
==> extend h F\<squnion>G : (C Int extend_set h A) |
13790 | 548 |
leadsTo[(%D. C Int extend_set h D)`givenBy v] (extend_set h B)" |
549 |
apply (rule pld_lemma [THEN leadsETo_weaken]) |
|
550 |
apply (auto simp add: split_extended_all) |
|
551 |
done |
|
552 |
||
553 |
lemma (in Extend) project_leadsETo_D: |
|
13819 | 554 |
"[| F\<squnion>project h UNIV G : A leadsTo[givenBy v] B; |
13790 | 555 |
G : preserves (v o f) |] |
13819 | 556 |
==> extend h F\<squnion>G : (extend_set h A) |
13790 | 557 |
leadsTo[givenBy (v o f)] (extend_set h B)" |
558 |
apply (cut_tac project_leadsETo_D_lemma [of _ _ UNIV], auto) |
|
559 |
apply (erule leadsETo_givenBy) |
|
560 |
apply (rule givenBy_o_eq_extend_set [THEN equalityD2]) |
|
561 |
done |
|
562 |
||
563 |
lemma (in Extend) project_LeadsETo_D: |
|
13819 | 564 |
"[| F\<squnion>project h (reachable (extend h F\<squnion>G)) G |
13790 | 565 |
: A LeadsTo[givenBy v] B; |
566 |
G : preserves (v o f) |] |
|
13819 | 567 |
==> extend h F\<squnion>G : |
13790 | 568 |
(extend_set h A) LeadsTo[givenBy (v o f)] (extend_set h B)" |
569 |
apply (cut_tac subset_refl [THEN stable_reachable, THEN project_leadsETo_D_lemma]) |
|
570 |
apply (auto simp add: LeadsETo_def) |
|
571 |
apply (erule leadsETo_mono [THEN [2] rev_subsetD]) |
|
572 |
apply (blast intro: extend_set_givenBy_I) |
|
573 |
apply (simp add: project_set_reachable_extend_eq [symmetric]) |
|
574 |
done |
|
575 |
||
576 |
lemma (in Extend) extending_leadsETo: |
|
577 |
"(ALL G. extend h F ok G --> G : preserves (v o f)) |
|
578 |
==> extending (%G. UNIV) h F |
|
579 |
(extend_set h A leadsTo[givenBy (v o f)] extend_set h B) |
|
580 |
(A leadsTo[givenBy v] B)" |
|
581 |
apply (unfold extending_def) |
|
582 |
apply (auto simp add: project_leadsETo_D) |
|
583 |
done |
|
584 |
||
585 |
lemma (in Extend) extending_LeadsETo: |
|
586 |
"(ALL G. extend h F ok G --> G : preserves (v o f)) |
|
13819 | 587 |
==> extending (%G. reachable (extend h F\<squnion>G)) h F |
13790 | 588 |
(extend_set h A LeadsTo[givenBy (v o f)] extend_set h B) |
589 |
(A LeadsTo[givenBy v] B)" |
|
590 |
apply (unfold extending_def) |
|
591 |
apply (blast intro: project_LeadsETo_D) |
|
592 |
done |
|
13812
91713a1915ee
converting HOL/UNITY to use unconditional fairness
paulson
parents:
13798
diff
changeset
|
593 |
*) |
13790 | 594 |
|
595 |
||
596 |
(*** leadsETo in the precondition ***) |
|
597 |
||
598 |
(*Lemma for the Trans case*) |
|
599 |
lemma (in Extend) pli_lemma: |
|
13819 | 600 |
"[| extend h F\<squnion>G : stable C; |
601 |
F\<squnion>project h C G |
|
13790 | 602 |
: project_set h C Int project_set h A leadsTo project_set h B |] |
13819 | 603 |
==> F\<squnion>project h C G |
13790 | 604 |
: project_set h C Int project_set h A leadsTo |
605 |
project_set h C Int project_set h B" |
|
606 |
apply (rule psp_stable2 [THEN leadsTo_weaken_L]) |
|
607 |
apply (auto simp add: project_stable_project_set extend_stable_project_set) |
|
608 |
done |
|
609 |
||
610 |
lemma (in Extend) project_leadsETo_I_lemma: |
|
13819 | 611 |
"[| extend h F\<squnion>G : stable C; |
612 |
extend h F\<squnion>G : |
|
13790 | 613 |
(C Int A) leadsTo[(%D. C Int D)`givenBy f] B |] |
13819 | 614 |
==> F\<squnion>project h C G |
13790 | 615 |
: (project_set h C Int project_set h (C Int A)) leadsTo (project_set h B)" |
616 |
apply (erule leadsETo_induct) |
|
617 |
prefer 3 |
|
618 |
apply (simp only: Int_UN_distrib project_set_Union) |
|
619 |
apply (blast intro: leadsTo_UN) |
|
620 |
prefer 2 apply (blast intro: leadsTo_Trans pli_lemma) |
|
621 |
apply (simp add: givenBy_eq_extend_set) |
|
622 |
apply (rule leadsTo_Basis) |
|
623 |
apply (blast intro: ensures_extend_set_imp_project_ensures) |
|
624 |
done |
|
625 |
||
626 |
lemma (in Extend) project_leadsETo_I: |
|
13819 | 627 |
"extend h F\<squnion>G : (extend_set h A) leadsTo[givenBy f] (extend_set h B) |
628 |
==> F\<squnion>project h UNIV G : A leadsTo B" |
|
13790 | 629 |
apply (rule project_leadsETo_I_lemma [THEN leadsTo_weaken], auto) |
630 |
done |
|
631 |
||
632 |
lemma (in Extend) project_LeadsETo_I: |
|
13819 | 633 |
"extend h F\<squnion>G : (extend_set h A) LeadsTo[givenBy f] (extend_set h B) |
634 |
==> F\<squnion>project h (reachable (extend h F\<squnion>G)) G |
|
13790 | 635 |
: A LeadsTo B" |
636 |
apply (simp (no_asm_use) add: LeadsTo_def LeadsETo_def) |
|
637 |
apply (rule project_leadsETo_I_lemma [THEN leadsTo_weaken]) |
|
638 |
apply (auto simp add: project_set_reachable_extend_eq [symmetric]) |
|
639 |
done |
|
640 |
||
641 |
lemma (in Extend) projecting_leadsTo: |
|
642 |
"projecting (%G. UNIV) h F |
|
643 |
(extend_set h A leadsTo[givenBy f] extend_set h B) |
|
644 |
(A leadsTo B)" |
|
645 |
apply (unfold projecting_def) |
|
646 |
apply (force dest: project_leadsETo_I) |
|
647 |
done |
|
648 |
||
649 |
lemma (in Extend) projecting_LeadsTo: |
|
13819 | 650 |
"projecting (%G. reachable (extend h F\<squnion>G)) h F |
13790 | 651 |
(extend_set h A LeadsTo[givenBy f] extend_set h B) |
652 |
(A LeadsTo B)" |
|
653 |
apply (unfold projecting_def) |
|
654 |
apply (force dest: project_LeadsETo_I) |
|
655 |
done |
|
656 |
||
8044 | 657 |
end |