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