author | paulson |
Wed, 22 Dec 1999 17:16:53 +0100 | |
changeset 8073 | 6c99b44b333e |
parent 8069 | 19b9f92ca503 |
child 8110 | f7651ede12b7 |
permissions | -rw-r--r-- |
7630 | 1 |
(* Title: HOL/UNITY/Project.ML |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1999 University of Cambridge |
|
5 |
||
6 |
Projections of state sets (also of actions and programs) |
|
7 |
||
8 |
Inheritance of GUARANTEES properties under extension |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
9 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
10 |
POSSIBLY CAN DELETE Restrict_image_Diff |
7630 | 11 |
*) |
12 |
||
13 |
Open_locale "Extend"; |
|
14 |
||
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
15 |
(** projection: monotonicity for safety **) |
7630 | 16 |
|
8041 | 17 |
Goal "D <= C ==> \ |
18 |
\ project_act h (Restrict D act) <= project_act h (Restrict C act)"; |
|
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
19 |
by (auto_tac (claset(), simpset() addsimps [project_act_def])); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
20 |
qed "project_act_mono"; |
7630 | 21 |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
22 |
Goal "[| D <= C; project h C F : A co B |] ==> project h D F : A co B"; |
7630 | 23 |
by (auto_tac (claset(), simpset() addsimps [constrains_def])); |
7689 | 24 |
by (dtac project_act_mono 1); |
7630 | 25 |
by (Blast_tac 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
26 |
qed "project_constrains_mono"; |
7630 | 27 |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
28 |
Goal "[| D <= C; project h C F : stable A |] ==> project h D F : stable A"; |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
29 |
by (asm_full_simp_tac |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
30 |
(simpset() addsimps [stable_def, project_constrains_mono]) 1); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
31 |
qed "project_stable_mono"; |
7630 | 32 |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
33 |
Goal "F : A co B ==> project h C (extend h F) : A co B"; |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
34 |
by (auto_tac (claset(), |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
35 |
simpset() addsimps [extend_act_def, project_act_def, constrains_def])); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
36 |
qed "project_extend_constrains_I"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
37 |
|
7630 | 38 |
Goal "UNIV <= project_set h C \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
39 |
\ ==> project h C ((extend h F) Join G) = F Join (project h C G)"; |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
40 |
by (rtac program_equalityI 1); |
7915
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7880
diff
changeset
|
41 |
by (asm_simp_tac (simpset() addsimps [image_eq_UN, UN_Un, |
7878
43b03d412b82
working version with localTo[C] instead of localTo
paulson
parents:
7841
diff
changeset
|
42 |
subset_UNIV RS subset_trans RS Restrict_triv]) 2); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
43 |
by (simp_tac (simpset() addsimps [project_set_extend_set_Int]) 1); |
7630 | 44 |
qed "project_extend_Join"; |
45 |
||
46 |
Goal "UNIV <= project_set h C \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
47 |
\ ==> (extend h F) Join G = extend h H ==> H = F Join (project h C G)"; |
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
48 |
by (dres_inst_tac [("f", "project h C")] arg_cong 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
49 |
by (asm_full_simp_tac (simpset() addsimps [project_extend_Join]) 1); |
7630 | 50 |
qed "extend_Join_eq_extend_D"; |
51 |
||
52 |
||
53 |
(** Safety **) |
|
54 |
||
55 |
Goalw [constrains_def] |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
56 |
"(project h C F : A co B) = \ |
7630 | 57 |
\ (F : (C Int extend_set h A) co (extend_set h B) & A <= B)"; |
58 |
by (auto_tac (claset() addSIs [project_act_I], simpset() addsimps [ball_Un])); |
|
59 |
by (force_tac (claset() addSIs [project_act_I] addSDs [subsetD], simpset()) 1); |
|
60 |
(*the <== direction*) |
|
61 |
by (rewtac project_act_def); |
|
62 |
by (force_tac (claset() addSDs [subsetD], simpset()) 1); |
|
63 |
qed "project_constrains"; |
|
64 |
||
65 |
Goalw [stable_def] |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
66 |
"(project h UNIV F : stable A) = (F : stable (extend_set h A))"; |
7630 | 67 |
by (simp_tac (simpset() addsimps [project_constrains]) 1); |
68 |
qed "project_stable"; |
|
69 |
||
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
70 |
Goal "F : stable (extend_set h A) ==> project h C F : stable A"; |
7689 | 71 |
by (dtac (project_stable RS iffD2) 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
72 |
by (blast_tac (claset() addIs [project_stable_mono]) 1); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
73 |
qed "project_stable_I"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
74 |
|
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
75 |
(*used below to prove Join_project_ensures*) |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
76 |
Goal "[| G : stable C; project h C G : A unless B |] \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
77 |
\ ==> G : (C Int extend_set h A) unless (extend_set h B)"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
78 |
by (asm_full_simp_tac |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
79 |
(simpset() addsimps [unless_def, project_constrains]) 1); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
80 |
by (blast_tac (claset() addDs [stable_constrains_Int] |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
81 |
addIs [constrains_weaken]) 1); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
82 |
qed_spec_mp "project_unless"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
83 |
|
7630 | 84 |
(*This form's useful with guarantees reasoning*) |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
85 |
Goal "(F Join project h C G : A co B) = \ |
7630 | 86 |
\ (extend h F Join G : (C Int extend_set h A) co (extend_set h B) & \ |
87 |
\ F : A co B)"; |
|
88 |
by (simp_tac (simpset() addsimps [Join_constrains, project_constrains]) 1); |
|
89 |
by (blast_tac (claset() addIs [extend_constrains RS iffD2 RS constrains_weaken] |
|
90 |
addDs [constrains_imp_subset]) 1); |
|
91 |
qed "Join_project_constrains"; |
|
92 |
||
93 |
(*The condition is required to prove the left-to-right direction; |
|
94 |
could weaken it to G : (C Int extend_set h A) co C*) |
|
95 |
Goalw [stable_def] |
|
96 |
"extend h F Join G : stable C \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
97 |
\ ==> (F Join project h C G : stable A) = \ |
7630 | 98 |
\ (extend h F Join G : stable (C Int extend_set h A) & \ |
99 |
\ F : stable A)"; |
|
100 |
by (simp_tac (simpset() addsimps [Join_project_constrains]) 1); |
|
101 |
by (blast_tac (claset() addIs [constrains_weaken] addDs [constrains_Int]) 1); |
|
102 |
qed "Join_project_stable"; |
|
103 |
||
7689 | 104 |
(*For using project_guarantees in particular cases*) |
105 |
Goal "extend h F Join G : extend_set h A co extend_set h B \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
106 |
\ ==> F Join project h C G : A co B"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
107 |
by (asm_full_simp_tac |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
108 |
(simpset() addsimps [project_constrains, Join_constrains, |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
109 |
extend_constrains]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
110 |
by (blast_tac (claset() addIs [constrains_weaken] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
111 |
addDs [constrains_imp_subset]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
112 |
qed "project_constrains_I"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
113 |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
114 |
Goalw [increasing_def, stable_def] |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
115 |
"extend h F Join G : increasing (func o f) \ |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
116 |
\ ==> F Join project h C G : increasing func"; |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
117 |
by (asm_full_simp_tac (simpset() addsimps [project_constrains_I, |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
118 |
Collect_eq_extend_set RS sym]) 1); |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
119 |
qed "project_increasing_I"; |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
120 |
|
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
121 |
Goal "(F Join project h UNIV G : increasing func) = \ |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
122 |
\ (extend h F Join G : increasing (func o f))"; |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
123 |
by (rtac iffI 1); |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
124 |
by (etac project_increasing_I 2); |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
125 |
by (asm_full_simp_tac |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
126 |
(simpset() addsimps [increasing_def, Join_project_stable]) 1); |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
127 |
by (auto_tac (claset(), |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
128 |
simpset() addsimps [Join_stable, Collect_eq_extend_set RS sym, |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
129 |
extend_stable RS iffD1])); |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
130 |
qed "Join_project_increasing"; |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
131 |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
132 |
(*The UNIV argument is essential*) |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
133 |
Goal "F Join project h UNIV G : A co B \ |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
134 |
\ ==> extend h F Join G : extend_set h A co extend_set h B"; |
7689 | 135 |
by (asm_full_simp_tac |
136 |
(simpset() addsimps [project_constrains, Join_constrains, |
|
137 |
extend_constrains]) 1); |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
138 |
qed "project_constrains_D"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
139 |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
140 |
(** "projecting" and union/intersection (no converses) **) |
7841 | 141 |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
142 |
Goalw [projecting_def] |
7841 | 143 |
"[| projecting C h F XA' XA; projecting C h F XB' XB |] \ |
144 |
\ ==> projecting C h F (XA' Int XB') (XA Int XB)"; |
|
145 |
by (Blast_tac 1); |
|
146 |
qed "projecting_Int"; |
|
147 |
||
148 |
Goalw [projecting_def] |
|
149 |
"[| projecting C h F XA' XA; projecting C h F XB' XB |] \ |
|
150 |
\ ==> projecting C h F (XA' Un XB') (XA Un XB)"; |
|
151 |
by (Blast_tac 1); |
|
152 |
qed "projecting_Un"; |
|
153 |
||
154 |
val [prem] = Goalw [projecting_def] |
|
155 |
"[| !!i. i:I ==> projecting C h F (X' i) (X i) |] \ |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
156 |
\ ==> projecting C h F (INT i:I. X' i) (INT i:I. X i)"; |
7841 | 157 |
by (blast_tac (claset() addDs [prem RS spec RS mp]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
158 |
qed "projecting_INT"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
159 |
|
7841 | 160 |
val [prem] = Goalw [projecting_def] |
161 |
"[| !!i. i:I ==> projecting C h F (X' i) (X i) |] \ |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
162 |
\ ==> projecting C h F (UN i:I. X' i) (UN i:I. X i)"; |
7841 | 163 |
by (blast_tac (claset() addDs [prem RS spec RS mp]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
164 |
qed "projecting_UN"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
165 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
166 |
Goalw [projecting_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
167 |
"[| projecting C h F X' X; U'<=X'; X<=U |] ==> projecting C h F U' U"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
168 |
by Auto_tac; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
169 |
qed "projecting_weaken"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
170 |
|
8073 | 171 |
Goalw [projecting_def] |
172 |
"[| projecting C h F X' X; U'<=X' |] ==> projecting C h F U' X"; |
|
173 |
by Auto_tac; |
|
174 |
qed "projecting_weaken_L"; |
|
175 |
||
7841 | 176 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
177 |
"[| extending v C h F YA' YA; extending v C h F YB' YB |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
178 |
\ ==> extending v C h F (YA' Int YB') (YA Int YB)"; |
7841 | 179 |
by (Blast_tac 1); |
180 |
qed "extending_Int"; |
|
181 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
182 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
183 |
"[| extending v C h F YA' YA; extending v C h F YB' YB |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
184 |
\ ==> extending v C h F (YA' Un YB') (YA Un YB)"; |
7841 | 185 |
by (Blast_tac 1); |
186 |
qed "extending_Un"; |
|
187 |
||
188 |
val [prem] = Goalw [extending_def] |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
189 |
"[| !!i. i:I ==> extending v C h F (Y' i) (Y i) |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
190 |
\ ==> extending v C h F (INT i:I. Y' i) (INT i:I. Y i)"; |
7841 | 191 |
by (blast_tac (claset() addDs [prem RS spec RS mp]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
192 |
qed "extending_INT"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
193 |
|
7841 | 194 |
val [prem] = Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
195 |
"[| !!i. i:I ==> extending v C h F (Y' i) (Y i) |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
196 |
\ ==> extending v C h F (UN i:I. Y' i) (UN i:I. Y i)"; |
7841 | 197 |
by (blast_tac (claset() addDs [prem RS spec RS mp]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
198 |
qed "extending_UN"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
199 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
200 |
Goalw [extending_def] |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
201 |
"[| extending v C h F Y' Y; Y'<=V'; V<=Y; \ |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
202 |
\ preserves w <= preserves v |] \ |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
203 |
\ ==> extending w C h F V' V"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
204 |
by Auto_tac; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
205 |
qed "extending_weaken"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
206 |
|
8073 | 207 |
Goalw [extending_def] |
208 |
"[| extending v C h F Y' Y; Y'<=V' |] ==> extending v C h F V' Y"; |
|
209 |
by Auto_tac; |
|
210 |
qed "extending_weaken_L"; |
|
211 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
212 |
Goal "projecting C h F X' UNIV"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
213 |
by (simp_tac (simpset() addsimps [projecting_def]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
214 |
qed "projecting_UNIV"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
215 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
216 |
Goalw [projecting_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
217 |
"projecting C h F (extend_set h A co extend_set h B) (A co B)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
218 |
by (blast_tac (claset() addIs [project_constrains_I]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
219 |
qed "projecting_constrains"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
220 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
221 |
Goalw [stable_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
222 |
"projecting C h F (stable (extend_set h A)) (stable A)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
223 |
by (rtac projecting_constrains 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
224 |
qed "projecting_stable"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
225 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
226 |
Goalw [projecting_def] |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
227 |
"projecting C h F (increasing (func o f)) (increasing func)"; |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
228 |
by (blast_tac (claset() addIs [project_increasing_I]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
229 |
qed "projecting_increasing"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
230 |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
231 |
Goal "extending v C h F UNIV Y"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
232 |
by (simp_tac (simpset() addsimps [extending_def]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
233 |
qed "extending_UNIV"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
234 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
235 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
236 |
"extending v (%G. UNIV) h F (extend_set h A co extend_set h B) (A co B)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
237 |
by (blast_tac (claset() addIs [project_constrains_D]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
238 |
qed "extending_constrains"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
239 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
240 |
Goalw [stable_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
241 |
"extending v (%G. UNIV) h F (stable (extend_set h A)) (stable A)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
242 |
by (rtac extending_constrains 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
243 |
qed "extending_stable"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
244 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
245 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
246 |
"extending v (%G. UNIV) h F (increasing (func o f)) (increasing func)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
247 |
by (simp_tac (simpset() addsimps [Join_project_increasing]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
248 |
qed "extending_increasing"; |
7689 | 249 |
|
7630 | 250 |
|
251 |
(** Reachability and project **) |
|
252 |
||
253 |
Goal "[| reachable (extend h F Join G) <= C; \ |
|
254 |
\ z : reachable (extend h F Join G) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
255 |
\ ==> f z : reachable (F Join project h C G)"; |
7630 | 256 |
by (etac reachable.induct 1); |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
257 |
by (force_tac (claset() addSIs [reachable.Init], |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
258 |
simpset() addsimps [split_extended_all]) 1); |
7630 | 259 |
by Auto_tac; |
260 |
by (force_tac (claset() addIs [project_act_I RSN (3,reachable.Acts)], |
|
261 |
simpset()) 2); |
|
262 |
by (res_inst_tac [("act","x")] reachable.Acts 1); |
|
263 |
by Auto_tac; |
|
264 |
by (etac extend_act_D 1); |
|
265 |
qed "reachable_imp_reachable_project"; |
|
266 |
||
7689 | 267 |
(*The extra generality in the first premise allows guarantees with STRONG |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
268 |
preconditions (localT) and WEAK postconditions.*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
269 |
(*LOCALTO NO LONGER EXISTS: replace C by reachable...??*) |
7630 | 270 |
Goalw [Constrains_def] |
271 |
"[| reachable (extend h F Join G) <= C; \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
272 |
\ F Join project h C G : A Co B |] \ |
7630 | 273 |
\ ==> extend h F Join G : (extend_set h A) Co (extend_set h B)"; |
274 |
by (full_simp_tac (simpset() addsimps [Join_project_constrains]) 1); |
|
275 |
by (Clarify_tac 1); |
|
276 |
by (etac constrains_weaken 1); |
|
277 |
by (auto_tac (claset() addDs [reachable_imp_reachable_project], simpset())); |
|
278 |
qed "project_Constrains_D"; |
|
279 |
||
280 |
Goalw [Stable_def] |
|
281 |
"[| reachable (extend h F Join G) <= C; \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
282 |
\ F Join project h C G : Stable A |] \ |
7630 | 283 |
\ ==> extend h F Join G : Stable (extend_set h A)"; |
284 |
by (asm_simp_tac (simpset() addsimps [project_Constrains_D]) 1); |
|
285 |
qed "project_Stable_D"; |
|
286 |
||
287 |
Goalw [Always_def] |
|
288 |
"[| reachable (extend h F Join G) <= C; \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
289 |
\ F Join project h C G : Always A |] \ |
7630 | 290 |
\ ==> extend h F Join G : Always (extend_set h A)"; |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
291 |
by (force_tac (claset() addIs [reachable.Init], |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
292 |
simpset() addsimps [project_Stable_D, split_extended_all]) 1); |
7630 | 293 |
qed "project_Always_D"; |
294 |
||
295 |
Goalw [Increasing_def] |
|
296 |
"[| reachable (extend h F Join G) <= C; \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
297 |
\ F Join project h C G : Increasing func |] \ |
7630 | 298 |
\ ==> extend h F Join G : Increasing (func o f)"; |
299 |
by Auto_tac; |
|
300 |
by (stac Collect_eq_extend_set 1); |
|
301 |
by (asm_simp_tac (simpset() addsimps [project_Stable_D]) 1); |
|
302 |
qed "project_Increasing_D"; |
|
303 |
||
304 |
||
305 |
(** Converse results for weak safety: benefits of the argument C *) |
|
306 |
||
307 |
Goal "[| C <= reachable(extend h F Join G); \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
308 |
\ x : reachable (F Join project h C G) |] \ |
7630 | 309 |
\ ==> EX y. h(x,y) : reachable (extend h F Join G)"; |
310 |
by (etac reachable.induct 1); |
|
311 |
by (ALLGOALS Asm_full_simp_tac); |
|
312 |
(*SLOW: 6.7s*) |
|
313 |
by (force_tac (claset() delrules [Id_in_Acts] |
|
314 |
addIs [reachable.Acts, extend_act_D], |
|
315 |
simpset() addsimps [project_act_def]) 2); |
|
316 |
by (force_tac (claset() addIs [reachable.Init], |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
317 |
simpset()) 1); |
7630 | 318 |
qed "reachable_project_imp_reachable"; |
319 |
||
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
320 |
Goal "project_set h (reachable (extend h F Join G)) = \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
321 |
\ reachable (F Join project h (reachable (extend h F Join G)) G)"; |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
322 |
by (auto_tac (claset() addDs [subset_refl RS reachable_imp_reachable_project, |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
323 |
subset_refl RS reachable_project_imp_reachable], |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
324 |
simpset())); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
325 |
qed "project_set_reachable_extend_eq"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
326 |
|
7947 | 327 |
Goal "reachable (extend h F Join G) <= C \ |
328 |
\ ==> reachable (extend h F Join G) <= \ |
|
329 |
\ extend_set h (reachable (F Join project h C G))"; |
|
330 |
by (auto_tac (claset() addDs [reachable_imp_reachable_project], |
|
331 |
simpset())); |
|
332 |
qed "reachable_extend_Join_subset"; |
|
333 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
334 |
(*Perhaps should replace C by reachable...*) |
7630 | 335 |
Goalw [Constrains_def] |
336 |
"[| C <= reachable (extend h F Join G); \ |
|
337 |
\ extend h F Join G : (extend_set h A) Co (extend_set h B) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
338 |
\ ==> F Join project h C G : A Co B"; |
7630 | 339 |
by (full_simp_tac (simpset() addsimps [Join_project_constrains, |
340 |
extend_set_Int_distrib]) 1); |
|
341 |
by (rtac conjI 1); |
|
342 |
by (etac constrains_weaken 1); |
|
343 |
by Auto_tac; |
|
344 |
by (asm_full_simp_tac (simpset() addsimps [Join_constrains]) 1); |
|
345 |
(*Some generalization of constrains_weaken_L would be better, but what is it?*) |
|
346 |
by (rewtac constrains_def); |
|
347 |
by Auto_tac; |
|
348 |
by (thin_tac "ALL act : Acts G. ?P act" 1); |
|
349 |
by (force_tac (claset() addSDs [reachable_project_imp_reachable], |
|
350 |
simpset()) 1); |
|
351 |
qed "project_Constrains_I"; |
|
352 |
||
353 |
Goalw [Stable_def] |
|
354 |
"[| C <= reachable (extend h F Join G); \ |
|
355 |
\ extend h F Join G : Stable (extend_set h A) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
356 |
\ ==> F Join project h C G : Stable A"; |
7630 | 357 |
by (asm_simp_tac (simpset() addsimps [project_Constrains_I]) 1); |
358 |
qed "project_Stable_I"; |
|
359 |
||
7689 | 360 |
Goalw [Always_def] |
361 |
"[| C <= reachable (extend h F Join G); \ |
|
362 |
\ extend h F Join G : Always (extend_set h A) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
363 |
\ ==> F Join project h C G : Always A"; |
7689 | 364 |
by (auto_tac (claset(), simpset() addsimps [project_Stable_I])); |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
365 |
by (rewtac extend_set_def); |
7689 | 366 |
by (Blast_tac 1); |
367 |
qed "project_Always_I"; |
|
368 |
||
7630 | 369 |
Goalw [Increasing_def] |
370 |
"[| C <= reachable (extend h F Join G); \ |
|
371 |
\ extend h F Join G : Increasing (func o f) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
372 |
\ ==> F Join project h C G : Increasing func"; |
7630 | 373 |
by Auto_tac; |
374 |
by (asm_simp_tac (simpset() addsimps [Collect_eq_extend_set RS sym, |
|
375 |
project_Stable_I]) 1); |
|
376 |
qed "project_Increasing_I"; |
|
377 |
||
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
378 |
Goal "(F Join project h (reachable (extend h F Join G)) G : A Co B) = \ |
7630 | 379 |
\ (extend h F Join G : (extend_set h A) Co (extend_set h B))"; |
380 |
by (blast_tac (claset() addIs [project_Constrains_I, project_Constrains_D]) 1); |
|
381 |
qed "project_Constrains"; |
|
382 |
||
383 |
Goalw [Stable_def] |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
384 |
"(F Join project h (reachable (extend h F Join G)) G : Stable A) = \ |
7630 | 385 |
\ (extend h F Join G : Stable (extend_set h A))"; |
386 |
by (rtac project_Constrains 1); |
|
387 |
qed "project_Stable"; |
|
388 |
||
389 |
Goal |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
390 |
"(F Join project h (reachable (extend h F Join G)) G : Increasing func) = \ |
7630 | 391 |
\ (extend h F Join G : Increasing (func o f))"; |
392 |
by (asm_simp_tac (simpset() addsimps [Increasing_def, project_Stable, |
|
393 |
Collect_eq_extend_set RS sym]) 1); |
|
394 |
qed "project_Increasing"; |
|
395 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
396 |
(** A lot of redundant theorems: all are proved to facilitate reasoning |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
397 |
about guarantees. **) |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
398 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
399 |
Goalw [projecting_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
400 |
"projecting (%G. reachable (extend h F Join G)) h F \ |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
401 |
\ (extend_set h A Co extend_set h B) (A Co B)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
402 |
by (blast_tac (claset() addIs [project_Constrains_I]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
403 |
qed "projecting_Constrains"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
404 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
405 |
Goalw [Stable_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
406 |
"projecting (%G. reachable (extend h F Join G)) h F \ |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
407 |
\ (Stable (extend_set h A)) (Stable A)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
408 |
by (rtac projecting_Constrains 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
409 |
qed "projecting_Stable"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
410 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
411 |
Goalw [projecting_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
412 |
"projecting (%G. reachable (extend h F Join G)) h F \ |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
413 |
\ (Always (extend_set h A)) (Always A)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
414 |
by (blast_tac (claset() addIs [project_Always_I]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
415 |
qed "projecting_Always"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
416 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
417 |
Goalw [projecting_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
418 |
"projecting (%G. reachable (extend h F Join G)) h F \ |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
419 |
\ (Increasing (func o f)) (Increasing func)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
420 |
by (blast_tac (claset() addIs [project_Increasing_I]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
421 |
qed "projecting_Increasing"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
422 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
423 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
424 |
"extending v (%G. reachable (extend h F Join G)) h F \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
425 |
\ (extend_set h A Co extend_set h B) (A Co B)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
426 |
by (blast_tac (claset() addIs [project_Constrains_D]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
427 |
qed "extending_Constrains"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
428 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
429 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
430 |
"extending v (%G. reachable (extend h F Join G)) h F \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
431 |
\ (Stable (extend_set h A)) (Stable A)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
432 |
by (blast_tac (claset() addIs [project_Stable_D]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
433 |
qed "extending_Stable"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
434 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
435 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
436 |
"extending v (%G. reachable (extend h F Join G)) h F \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
437 |
\ (Always (extend_set h A)) (Always A)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
438 |
by (blast_tac (claset() addIs [project_Always_D]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
439 |
qed "extending_Always"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
440 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
441 |
val [prem] = |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
442 |
Goalw [extending_def] |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
443 |
"(!!G. reachable (extend h F Join G) <= C G) \ |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
444 |
\ ==> extending v C h F (Increasing (func o f)) (Increasing func)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
445 |
by (blast_tac (claset() addIs [prem RS project_Increasing_D]) 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
446 |
qed "extending_Increasing"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
447 |
|
7630 | 448 |
|
449 |
(** Progress includes safety in the definition of ensures **) |
|
450 |
||
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
451 |
(*** Progress for (project h C F) ***) |
7630 | 452 |
|
453 |
(** transient **) |
|
454 |
||
455 |
(*Premise is that C includes the domains of all actions that could be the |
|
456 |
transient one. Could have C=UNIV of course*) |
|
457 |
Goalw [transient_def] |
|
458 |
"[| ALL act: Acts F. act ^^ extend_set h A <= - extend_set h A --> \ |
|
459 |
\ Domain act <= C; \ |
|
460 |
\ F : transient (extend_set h A) |] \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
461 |
\ ==> project h C F : transient A"; |
7630 | 462 |
by (auto_tac (claset() delrules [ballE], |
7915
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7880
diff
changeset
|
463 |
simpset() addsimps [Domain_project_act, Int_absorb1])); |
7630 | 464 |
by (REPEAT (ball_tac 1)); |
465 |
by (auto_tac (claset(), |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
466 |
simpset() addsimps [extend_set_def, project_act_def])); |
7630 | 467 |
by (ALLGOALS Blast_tac); |
468 |
qed "transient_extend_set_imp_project_transient"; |
|
469 |
||
470 |
||
471 |
(** ensures **) |
|
472 |
||
473 |
(*For simplicity, the complicated condition on C is eliminated |
|
474 |
NOT SURE THIS IS GOOD FOR ANYTHING: CAN'T PROVE LEADSTO THEOREM*) |
|
475 |
Goal "F : (extend_set h A) ensures (extend_set h B) \ |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
476 |
\ ==> project h UNIV F : A ensures B"; |
7630 | 477 |
by (asm_full_simp_tac |
478 |
(simpset() addsimps [ensures_def, project_constrains, |
|
479 |
transient_extend_set_imp_project_transient, |
|
480 |
extend_set_Un_distrib RS sym, |
|
481 |
extend_set_Diff_distrib RS sym]) 1); |
|
482 |
by (Blast_tac 1); |
|
483 |
qed "ensures_extend_set_imp_project_ensures"; |
|
484 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
485 |
Goal "[| project h C G ~: transient (A-B) | A<=B; \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
486 |
\ extend h F Join G : stable C; \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
487 |
\ F Join project h C G : A ensures B |] \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
488 |
\ ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)"; |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
489 |
by (etac disjE 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
490 |
by (blast_tac (claset() addIs [subset_imp_ensures]) 2); |
8002 | 491 |
by (auto_tac (claset() addDs [extend_transient RS iffD2] |
8041 | 492 |
addIs [transient_strengthen, project_set_I, |
8002 | 493 |
project_unless RS unlessD, unlessI, |
494 |
project_extend_constrains_I], |
|
495 |
simpset() addsimps [ensures_def, Join_constrains, |
|
496 |
Join_stable, Join_transient])); |
|
7630 | 497 |
qed_spec_mp "Join_project_ensures"; |
498 |
||
7947 | 499 |
(** Lemma useful for both STRONG and WEAK progress*) |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
500 |
|
7947 | 501 |
(*The strange induction formula allows induction over the leadsTo |
502 |
assumption's non-atomic precondition*) |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
503 |
Goal "[| ALL D. project h C G : transient D --> D={}; \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
504 |
\ extend h F Join G : stable C; \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
505 |
\ F Join project h C G : (project_set h C Int A) leadsTo B |] \ |
7947 | 506 |
\ ==> extend h F Join G : \ |
507 |
\ C Int extend_set h (project_set h C Int A) leadsTo (extend_set h B)"; |
|
7630 | 508 |
by (etac leadsTo_induct 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
509 |
by (asm_simp_tac (simpset() delsimps UN_simps |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
510 |
addsimps [Int_UN_distrib, leadsTo_UN, extend_set_Union]) 3); |
8041 | 511 |
by (blast_tac (claset() addIs [psp_stable2 RS leadsTo_weaken_L, |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
512 |
leadsTo_Trans]) 2); |
7630 | 513 |
by (blast_tac (claset() addIs [leadsTo_Basis, Join_project_ensures]) 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
514 |
val lemma = result(); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
515 |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
516 |
Goal "[| ALL D. project h C G : transient D --> D={}; \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
517 |
\ extend h F Join G : stable C; \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
518 |
\ F Join project h C G : (project_set h C Int A) leadsTo B |] \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
519 |
\ ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)"; |
7689 | 520 |
by (rtac (lemma RS leadsTo_weaken) 1); |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
521 |
by (auto_tac (claset(), simpset() addsimps [split_extended_all])); |
7947 | 522 |
qed "project_leadsTo_lemma"; |
7630 | 523 |
|
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
524 |
Goal "[| C = (reachable (extend h F Join G)); \ |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
525 |
\ ALL D. project h C G : transient D --> D={}; \ |
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
526 |
\ F Join project h C G : A LeadsTo B |] \ |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
527 |
\ ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
528 |
by (asm_full_simp_tac |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
529 |
(simpset() addsimps [LeadsTo_def, project_leadsTo_lemma, |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
530 |
project_set_reachable_extend_eq]) 1); |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
531 |
qed "Join_project_LeadsTo"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
532 |
|
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
533 |
|
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
534 |
(*** GUARANTEES and EXTEND ***) |
7630 | 535 |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
536 |
(** preserves **) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
537 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
538 |
Goal "G : preserves (v o f) ==> project h C G : preserves v"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
539 |
by (auto_tac (claset(), |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
540 |
simpset() addsimps [preserves_def, project_stable_I, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
541 |
Collect_eq_extend_set RS sym])); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
542 |
qed "project_preserves_I"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
543 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
544 |
(*to preserve f is to preserve the whole original state*) |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
545 |
Goal "G : preserves f ==> project h C G : preserves id"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
546 |
by (asm_simp_tac (simpset() addsimps [project_preserves_I]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
547 |
qed "project_preserves_id_I"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
548 |
|
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
549 |
Goal "(extend h G : preserves (v o f)) = (G : preserves v)"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
550 |
by (auto_tac (claset(), |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
551 |
simpset() addsimps [preserves_def, extend_stable RS sym, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
552 |
Collect_eq_extend_set RS sym])); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
553 |
qed "extend_preserves"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
554 |
|
8065
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
555 |
Goal "inj h ==> (extend h G : preserves g)"; |
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
556 |
by (auto_tac (claset(), |
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
557 |
simpset() addsimps [preserves_def, extend_def, extend_act_def, |
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
558 |
stable_def, constrains_def, g_def])); |
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
559 |
qed "inj_extend_preserves"; |
658e0d4e4ed9
first working version to Alloc/System_Client_Progress;
paulson
parents:
8055
diff
changeset
|
560 |
|
7630 | 561 |
(** Strong precondition and postcondition; doesn't seem very useful. **) |
562 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
563 |
Goal "F : X guarantees[v] Y ==> \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
564 |
\ extend h F : (extend h `` X) guarantees[v o f] (extend h `` Y)"; |
7630 | 565 |
by (rtac guaranteesI 1); |
566 |
by Auto_tac; |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
567 |
by (blast_tac (claset() addIs [project_preserves_I] |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
568 |
addDs [project_set_UNIV RS equalityD2 RS |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
569 |
extend_Join_eq_extend_D, |
7630 | 570 |
guaranteesD]) 1); |
571 |
qed "guarantees_imp_extend_guarantees"; |
|
572 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
573 |
Goal "extend h F : (extend h `` X) guarantees[v o f] (extend h `` Y) \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
574 |
\ ==> F : X guarantees[v] Y"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
575 |
by (auto_tac (claset(), simpset() addsimps [guar_def])); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
576 |
by (dres_inst_tac [("x", "extend h G")] spec 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
577 |
by (asm_full_simp_tac |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
578 |
(simpset() delsimps [extend_Join] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
579 |
addsimps [extend_Join RS sym, extend_preserves, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
580 |
inj_extend RS inj_image_mem_iff]) 1); |
7630 | 581 |
qed "extend_guarantees_imp_guarantees"; |
582 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
583 |
Goal "(extend h F : (extend h `` X) guarantees[v o f] (extend h `` Y)) = \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
584 |
\ (F : X guarantees[v] Y)"; |
7630 | 585 |
by (blast_tac (claset() addIs [guarantees_imp_extend_guarantees, |
586 |
extend_guarantees_imp_guarantees]) 1); |
|
587 |
qed "extend_guarantees_eq"; |
|
588 |
||
589 |
||
590 |
(*Weak precondition and postcondition; this is the good one! |
|
591 |
Not clear that it has a converse [or that we want one!]*) |
|
7841 | 592 |
|
593 |
(*The raw version*) |
|
594 |
val [xguary,project,extend] = |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
595 |
Goal "[| F : X guarantees[v] Y; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
596 |
\ !!G. extend h F Join G : X' ==> F Join project h C G : X; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
597 |
\ !!G. [| F Join project h C G : Y; extend h F Join G : X' |] \ |
7841 | 598 |
\ ==> extend h F Join G : Y' |] \ |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
599 |
\ ==> extend h F : X' guarantees[v o f] Y'"; |
7841 | 600 |
by (rtac (xguary RS guaranteesD RS extend RS guaranteesI) 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
601 |
by (etac project_preserves_I 1); |
7841 | 602 |
by (etac project 1); |
603 |
by (assume_tac 1); |
|
8041 | 604 |
qed "project_guarantees_raw"; |
7841 | 605 |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
606 |
Goal "[| F : X guarantees[v] Y; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
607 |
\ projecting C h F X' X; extending w C h F Y' Y; \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
608 |
\ preserves w <= preserves (v o f) |] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
609 |
\ ==> extend h F : X' guarantees[w] Y'"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
610 |
by (rtac guaranteesI 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
611 |
by (auto_tac (claset(), |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
612 |
simpset() addsimps [project_preserves_I, guaranteesD, projecting_def, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
613 |
extending_def])); |
7630 | 614 |
qed "project_guarantees"; |
615 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
616 |
|
7841 | 617 |
(*It seems that neither "guarantees" law can be proved from the other.*) |
7630 | 618 |
|
619 |
||
620 |
(*** guarantees corollaries ***) |
|
621 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
622 |
(** Some could be deleted: the required versions are easy to prove **) |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
623 |
|
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
624 |
Goal "F : UNIV guarantees[v] increasing func \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
625 |
\ ==> extend h F : X' guarantees[v o f] increasing (func o f)"; |
7630 | 626 |
by (etac project_guarantees 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
627 |
by (rtac extending_increasing 2); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
628 |
by (rtac projecting_UNIV 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
629 |
by Auto_tac; |
7630 | 630 |
qed "extend_guar_increasing"; |
631 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
632 |
Goal "F : UNIV guarantees[v] Increasing func \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
633 |
\ ==> extend h F : X' guarantees[v o f] Increasing (func o f)"; |
7630 | 634 |
by (etac project_guarantees 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
635 |
by (rtac extending_Increasing 2); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
636 |
by (rtac projecting_UNIV 1); |
7630 | 637 |
by Auto_tac; |
638 |
qed "extend_guar_Increasing"; |
|
639 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
640 |
Goal "F : Always A guarantees[v] Always B \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
641 |
\ ==> extend h F : Always(extend_set h A) guarantees[v o f] \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
642 |
\ Always(extend_set h B)"; |
7689 | 643 |
by (etac project_guarantees 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
644 |
by (rtac extending_Always 2); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
645 |
by (rtac projecting_Always 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
646 |
by Auto_tac; |
7689 | 647 |
qed "extend_guar_Always"; |
648 |
||
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
649 |
Goal "[| G : preserves f; project h C G : transient D |] ==> D={}"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
650 |
by (rtac stable_transient_empty 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
651 |
by (assume_tac 2); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
652 |
by (blast_tac (claset() addIs [project_preserves_id_I, |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
653 |
impOfSubs preserves_id_subset_stable]) 1); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
654 |
qed "preserves_project_transient_empty"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
655 |
|
7630 | 656 |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
657 |
(** Guarantees with a leadsTo postcondition |
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
8065
diff
changeset
|
658 |
THESE ARE ALL TOO WEAK because G can't affect F's variables at all**) |
7630 | 659 |
|
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
660 |
Goal "[| F Join project h UNIV G : A leadsTo B; \ |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
661 |
\ G : preserves f |] \ |
7689 | 662 |
\ ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)"; |
7947 | 663 |
by (res_inst_tac [("C1", "UNIV")] (project_leadsTo_lemma RS leadsTo_weaken) 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
664 |
by (auto_tac (claset() addDs [preserves_project_transient_empty], |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
665 |
simpset())); |
7689 | 666 |
qed "project_leadsTo_D"; |
667 |
||
7880
62fb24e28e5e
exchanged the first two args of "project" and "drop_prog"
paulson
parents:
7878
diff
changeset
|
668 |
Goal "[| F Join project h (reachable (extend h F Join G)) G : A LeadsTo B; \ |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
669 |
\ G : preserves f |] \ |
7689 | 670 |
\ ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)"; |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
671 |
by (rtac (refl RS Join_project_LeadsTo) 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
672 |
by (auto_tac (claset() addDs [preserves_project_transient_empty], |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
673 |
simpset())); |
7689 | 674 |
qed "project_LeadsTo_D"; |
675 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
676 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
677 |
"extending f (%G. UNIV) h F \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
678 |
\ (extend_set h A leadsTo extend_set h B) (A leadsTo B)"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
679 |
by (blast_tac (claset() addIs [project_leadsTo_D]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
680 |
qed "extending_leadsTo"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
681 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
682 |
Goalw [extending_def] |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
683 |
"extending f (%G. reachable (extend h F Join G)) h F \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
684 |
\ (extend_set h A LeadsTo extend_set h B) (A LeadsTo B)"; |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
685 |
by (blast_tac (claset() addIs [project_LeadsTo_D]) 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7689
diff
changeset
|
686 |
qed "extending_LeadsTo"; |
7689 | 687 |
|
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
688 |
(*STRONG precondition and postcondition*) |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
689 |
Goal "F : (A co A') guarantees[v] (B leadsTo B') \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
690 |
\ ==> extend h F : (extend_set h A co extend_set h A') \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
691 |
\ guarantees[f] (extend_set h B leadsTo extend_set h B')"; |
7630 | 692 |
by (etac project_guarantees 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
693 |
by (rtac subset_preserves_o 3); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
694 |
by (rtac extending_leadsTo 2); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
695 |
by (rtac projecting_constrains 1); |
7630 | 696 |
qed "extend_co_guar_leadsTo"; |
697 |
||
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
698 |
(*WEAK precondition and postcondition*) |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
699 |
Goal "F : (A Co A') guarantees[v] (B LeadsTo B') \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
700 |
\ ==> extend h F : (extend_set h A Co extend_set h A') \ |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
701 |
\ guarantees[f] (extend_set h B LeadsTo extend_set h B')"; |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
702 |
by (etac project_guarantees 1); |
8055
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
703 |
by (rtac subset_preserves_o 3); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
704 |
by (rtac extending_LeadsTo 2); |
bb15396278fb
abolition of localTo: instead "guarantees" has local vars as extra argument
paulson
parents:
8041
diff
changeset
|
705 |
by (rtac projecting_Constrains 1); |
7660
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
706 |
qed "extend_Co_guar_LeadsTo"; |
7e38237edfcb
now with (weak safety) guarantees (weak progress) with Extend
paulson
parents:
7630
diff
changeset
|
707 |
|
7630 | 708 |
Close_locale "Extend"; |