author | paulson |
Fri, 17 Sep 1999 10:31:38 +0200 | |
changeset 7538 | 357873391561 |
parent 7537 | 875754b599df |
child 7689 | affe0c2fdfbf |
permissions | -rw-r--r-- |
5899 | 1 |
(* Title: HOL/UNITY/PPROD.ML |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
4 |
Copyright 1999 University of Cambridge |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
5 |
|
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
6 |
Abstraction over replicated components (PLam) |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
7 |
General products of programs (Pi operation) |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
8 |
|
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
9 |
It is not clear that any of this is good for anything. |
5899 | 10 |
*) |
11 |
||
6020 | 12 |
|
5899 | 13 |
(*** Basic properties ***) |
14 |
||
6842 | 15 |
Goalw [PLam_def] "Init (PLam I F) = (INT i:I. lift_set i (Init (F i)))"; |
5972 | 16 |
by Auto_tac; |
6842 | 17 |
qed "Init_PLam"; |
18 |
Addsimps [Init_PLam]; |
|
5972 | 19 |
|
6842 | 20 |
Goal "Acts (PLam I F) = insert Id (UN i:I. lift_act i `` Acts (F i))"; |
5899 | 21 |
by (auto_tac (claset(), |
7537 | 22 |
simpset() addsimps [PLam_def])); |
6842 | 23 |
qed "Acts_PLam"; |
5899 | 24 |
|
6842 | 25 |
Goal "PLam {} F = SKIP"; |
26 |
by (simp_tac (simpset() addsimps [PLam_def]) 1); |
|
27 |
qed "PLam_empty"; |
|
5899 | 28 |
|
6842 | 29 |
Goal "(plam i: I. SKIP) = SKIP"; |
30 |
by (simp_tac (simpset() addsimps [PLam_def,lift_prog_SKIP,JN_constant]) 1); |
|
31 |
qed "PLam_SKIP"; |
|
6299 | 32 |
|
6842 | 33 |
Addsimps [PLam_SKIP, PLam_empty]; |
5899 | 34 |
|
6842 | 35 |
Goalw [PLam_def] |
36 |
"PLam (insert i I) F = (lift_prog i (F i)) Join (PLam I F)"; |
|
5899 | 37 |
by Auto_tac; |
6842 | 38 |
qed "PLam_insert"; |
5899 | 39 |
|
7399
cf780c2bcccf
changed "component" infix in HOL/UNITY/Comp.thy to be overloaded <
paulson
parents:
7361
diff
changeset
|
40 |
Goalw [PLam_def] "i : I ==> lift_prog i (F i) <= (PLam I F)"; |
5972 | 41 |
(*blast_tac doesn't use HO unification*) |
42 |
by (fast_tac (claset() addIs [component_JN]) 1); |
|
6842 | 43 |
qed "component_PLam"; |
5899 | 44 |
|
5972 | 45 |
|
7523 | 46 |
(** Safety & Progress **) |
6835
588f791ee737
addition of drop_... operators with new results and simplification of old ones
paulson
parents:
6826
diff
changeset
|
47 |
|
5899 | 48 |
Goal "i : I ==> \ |
6842 | 49 |
\ (PLam I F : (lift_set i A) co (lift_set i B)) = \ |
6536 | 50 |
\ (F i : A co B)"; |
7523 | 51 |
by (asm_simp_tac (simpset() addsimps [PLam_def, JN_constrains]) 1); |
7344
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
52 |
by (blast_tac (claset() addIs [lift_prog_constrains RS iffD1, |
5972 | 53 |
constrains_imp_lift_prog_constrains]) 1); |
6842 | 54 |
qed "PLam_constrains"; |
5899 | 55 |
|
6842 | 56 |
Goal "i : I ==> (PLam I F : stable (lift_set i A)) = (F i : stable A)"; |
57 |
by (asm_simp_tac (simpset() addsimps [stable_def, PLam_constrains]) 1); |
|
58 |
qed "PLam_stable"; |
|
5972 | 59 |
|
7523 | 60 |
Goal "i : I ==> \ |
61 |
\ PLam I F : transient A = (EX i:I. lift_prog i (F i) : transient A)"; |
|
62 |
by (asm_simp_tac (simpset() addsimps [JN_transient, PLam_def]) 1); |
|
63 |
qed "PLam_transient"; |
|
64 |
||
65 |
Addsimps [PLam_constrains, PLam_stable, PLam_transient]; |
|
66 |
||
7538 | 67 |
Goal "[| i : I; F i : A ensures B |] ==> \ |
68 |
\ PLam I F : (lift_set i A) ensures lift_set i B"; |
|
69 |
by (auto_tac (claset(), |
|
70 |
simpset() addsimps [ensures_def, lift_prog_transient_eq_disj])); |
|
71 |
qed "PLam_ensures"; |
|
72 |
||
7523 | 73 |
Goal "[| i : I; F i : (A-B) co (A Un B); F i : transient (A-B) |] ==> \ |
74 |
\ PLam I F : (lift_set i A) leadsTo lift_set i B"; |
|
7538 | 75 |
by (rtac (PLam_ensures RS leadsTo_Basis) 1); |
76 |
by (rtac ensuresI 2); |
|
77 |
by (ALLGOALS assume_tac); |
|
7523 | 78 |
qed "PLam_leadsTo_Basis"; |
5972 | 79 |
|
6842 | 80 |
Goal "[| PLam I F : AA co BB; i: I |] \ |
6835
588f791ee737
addition of drop_... operators with new results and simplification of old ones
paulson
parents:
6826
diff
changeset
|
81 |
\ ==> F i : (drop_set i AA) co (drop_set i BB)"; |
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
82 |
by (rtac lift_prog_constrains_drop_set 1); |
5972 | 83 |
(*rotate this assumption to be last*) |
6842 | 84 |
by (dres_inst_tac [("psi", "PLam I F : ?C")] asm_rl 1); |
7523 | 85 |
by (asm_full_simp_tac (simpset() addsimps [PLam_def, JN_constrains]) 1); |
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
86 |
qed "PLam_constrains_drop_set"; |
5899 | 87 |
|
88 |
||
5972 | 89 |
(** invariant **) |
90 |
||
6299 | 91 |
Goal "[| F i : invariant A; i : I |] \ |
6842 | 92 |
\ ==> PLam I F : invariant (lift_set i A)"; |
5972 | 93 |
by (auto_tac (claset(), |
7523 | 94 |
simpset() addsimps [invariant_def])); |
6842 | 95 |
qed "invariant_imp_PLam_invariant"; |
5972 | 96 |
|
97 |
(*The f0 premise ensures that the product is well-defined.*) |
|
6842 | 98 |
Goal "[| PLam I F : invariant (lift_set i A); i : I; \ |
99 |
\ f0: Init (PLam I F) |] ==> F i : invariant A"; |
|
5899 | 100 |
by (auto_tac (claset(), |
7523 | 101 |
simpset() addsimps [invariant_def])); |
5972 | 102 |
by (dres_inst_tac [("c", "f0(i:=x)")] subsetD 1); |
103 |
by Auto_tac; |
|
6842 | 104 |
qed "PLam_invariant_imp_invariant"; |
5972 | 105 |
|
6842 | 106 |
Goal "[| i : I; f0: Init (PLam I F) |] \ |
107 |
\ ==> (PLam I F : invariant (lift_set i A)) = (F i : invariant A)"; |
|
108 |
by (blast_tac (claset() addIs [invariant_imp_PLam_invariant, |
|
109 |
PLam_invariant_imp_invariant]) 1); |
|
110 |
qed "PLam_invariant"; |
|
5899 | 111 |
|
5972 | 112 |
(*The f0 premise isn't needed if F is a constant program because then |
113 |
we get an initial state by replicating that of F*) |
|
114 |
Goal "i : I \ |
|
6842 | 115 |
\ ==> ((plam x:I. F) : invariant (lift_set i A)) = (F : invariant A)"; |
5972 | 116 |
by (auto_tac (claset(), |
7523 | 117 |
simpset() addsimps [invariant_def])); |
6842 | 118 |
qed "const_PLam_invariant"; |
5972 | 119 |
|
5899 | 120 |
|
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
121 |
(** Reachability **) |
5972 | 122 |
|
6842 | 123 |
Goal "[| f : reachable (PLam I F); i : I |] ==> f i : reachable (F i)"; |
5899 | 124 |
by (etac reachable.induct 1); |
125 |
by (auto_tac |
|
126 |
(claset() addIs reachable.intrs, |
|
6842 | 127 |
simpset() addsimps [Acts_PLam])); |
128 |
qed "reachable_PLam"; |
|
5899 | 129 |
|
6842 | 130 |
(*Result to justify a re-organization of this file*) |
131 |
Goal "{f. ALL i:I. f i : R i} = (INT i:I. lift_set i (R i))"; |
|
6867 | 132 |
by Auto_tac; |
6842 | 133 |
result(); |
134 |
||
135 |
Goal "reachable (PLam I F) <= (INT i:I. lift_set i (reachable (F i)))"; |
|
136 |
by (force_tac (claset() addSDs [reachable_PLam], simpset()) 1); |
|
137 |
qed "reachable_PLam_subset1"; |
|
5899 | 138 |
|
6826 | 139 |
(*simplify using reachable_lift_prog??*) |
5972 | 140 |
Goal "[| i ~: I; A : reachable (F i) |] \ |
6842 | 141 |
\ ==> ALL f. f : reachable (PLam I F) \ |
142 |
\ --> f(i:=A) : reachable (lift_prog i (F i) Join PLam I F)"; |
|
5899 | 143 |
by (etac reachable.induct 1); |
144 |
by (ALLGOALS Clarify_tac); |
|
145 |
by (etac reachable.induct 1); |
|
146 |
(*Init, Init case*) |
|
6826 | 147 |
by (force_tac (claset() addIs reachable.intrs, simpset()) 1); |
6842 | 148 |
(*Init of F, action of PLam F case*) |
5972 | 149 |
by (rtac reachable.Acts 1); |
7537 | 150 |
by (Force_tac 1); |
5972 | 151 |
by (assume_tac 1); |
6842 | 152 |
by (force_tac (claset() addIs [ext], simpset() addsimps [Acts_PLam]) 1); |
5899 | 153 |
(*induction over the 2nd "reachable" assumption*) |
154 |
by (eres_inst_tac [("xa","f")] reachable.induct 1); |
|
6842 | 155 |
(*Init of PLam F, action of F case*) |
5899 | 156 |
by (res_inst_tac [("act","lift_act i act")] reachable.Acts 1); |
7537 | 157 |
by (Force_tac 1); |
5899 | 158 |
by (force_tac (claset() addIs [reachable.Init], simpset()) 1); |
159 |
by (force_tac (claset() addIs [ext], simpset() addsimps [lift_act_def]) 1); |
|
6842 | 160 |
(*last case: an action of PLam I F*) |
5972 | 161 |
by (rtac reachable.Acts 1); |
7537 | 162 |
by (Force_tac 1); |
5972 | 163 |
by (assume_tac 1); |
6842 | 164 |
by (force_tac (claset() addIs [ext], simpset() addsimps [Acts_PLam]) 1); |
165 |
qed_spec_mp "reachable_lift_Join_PLam"; |
|
5899 | 166 |
|
167 |
||
168 |
(*The index set must be finite: otherwise infinitely many copies of F can |
|
6842 | 169 |
perform actions, and PLam can never catch up in finite time.*) |
5972 | 170 |
Goal "finite I \ |
6842 | 171 |
\ ==> (INT i:I. lift_set i (reachable (F i))) <= reachable (PLam I F)"; |
5899 | 172 |
by (etac finite_induct 1); |
173 |
by (Simp_tac 1); |
|
6842 | 174 |
by (force_tac (claset() addDs [reachable_lift_Join_PLam], |
175 |
simpset() addsimps [PLam_insert]) 1); |
|
176 |
qed "reachable_PLam_subset2"; |
|
5899 | 177 |
|
5972 | 178 |
Goal "finite I ==> \ |
6842 | 179 |
\ reachable (PLam I F) = (INT i:I. lift_set i (reachable (F i)))"; |
5899 | 180 |
by (REPEAT_FIRST (ares_tac [equalityI, |
6842 | 181 |
reachable_PLam_subset1, |
182 |
reachable_PLam_subset2])); |
|
183 |
qed "reachable_PLam_eq"; |
|
5899 | 184 |
|
185 |
||
6536 | 186 |
(** Co **) |
5899 | 187 |
|
6536 | 188 |
Goal "[| F i : A Co B; i: I; finite I |] \ |
6842 | 189 |
\ ==> PLam I F : (lift_set i A) Co (lift_set i B)"; |
5899 | 190 |
by (auto_tac |
191 |
(claset(), |
|
192 |
simpset() addsimps [Constrains_def, Collect_conj_eq RS sym, |
|
6842 | 193 |
reachable_PLam_eq])); |
5899 | 194 |
by (auto_tac (claset(), |
7537 | 195 |
simpset() addsimps [constrains_def, PLam_def])); |
5899 | 196 |
by (REPEAT (blast_tac (claset() addIs reachable.intrs) 1)); |
6842 | 197 |
qed "Constrains_imp_PLam_Constrains"; |
5972 | 198 |
|
6842 | 199 |
Goal "[| ALL j:I. f0 j : A j; i: I |] \ |
200 |
\ ==> drop_set i (INT j:I. lift_set j (A j)) = A i"; |
|
7523 | 201 |
by (force_tac (claset() addSIs [image_eqI'], |
6842 | 202 |
simpset() addsimps [drop_set_def]) 1); |
203 |
qed "drop_set_INT_lift_set"; |
|
5972 | 204 |
|
6842 | 205 |
(*Again, we need the f0 premise so that PLam I F has an initial state; |
6575 | 206 |
otherwise its Co-property is vacuous.*) |
6842 | 207 |
Goal "[| PLam I F : (lift_set i A) Co (lift_set i B); \ |
208 |
\ i: I; finite I; f0: Init (PLam I F) |] \ |
|
6536 | 209 |
\ ==> F i : A Co B"; |
6575 | 210 |
by (full_simp_tac (simpset() addsimps [Constrains_eq_constrains]) 1); |
5972 | 211 |
by (subgoal_tac "ALL i:I. f0 i : reachable (F i)" 1); |
212 |
by (blast_tac (claset() addIs [reachable.Init]) 2); |
|
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
213 |
by (dtac PLam_constrains_drop_set 1); |
5972 | 214 |
by (assume_tac 1); |
215 |
by (asm_full_simp_tac |
|
7523 | 216 |
(simpset() addsimps [drop_set_Int_lift_set2, |
6842 | 217 |
drop_set_INT_lift_set, reachable_PLam_eq]) 1); |
218 |
qed "PLam_Constrains_imp_Constrains"; |
|
5899 | 219 |
|
220 |
||
6842 | 221 |
Goal "[| i: I; finite I; f0: Init (PLam I F) |] \ |
222 |
\ ==> (PLam I F : (lift_set i A) Co (lift_set i B)) = \ |
|
6536 | 223 |
\ (F i : A Co B)"; |
6842 | 224 |
by (blast_tac (claset() addIs [Constrains_imp_PLam_Constrains, |
225 |
PLam_Constrains_imp_Constrains]) 1); |
|
226 |
qed "PLam_Constrains"; |
|
5972 | 227 |
|
6842 | 228 |
Goal "[| i: I; finite I; f0: Init (PLam I F) |] \ |
229 |
\ ==> (PLam I F : Stable (lift_set i A)) = (F i : Stable A)"; |
|
230 |
by (asm_simp_tac (simpset() delsimps [Init_PLam] |
|
231 |
addsimps [Stable_def, PLam_Constrains]) 1); |
|
232 |
qed "PLam_Stable"; |
|
5899 | 233 |
|
234 |
||
6842 | 235 |
(** const_PLam (no dependence on i) doesn't require the f0 premise **) |
5899 | 236 |
|
6842 | 237 |
Goal "[| (plam x:I. F) : (lift_set i A) Co (lift_set i B); \ |
5972 | 238 |
\ i: I; finite I |] \ |
6536 | 239 |
\ ==> F : A Co B"; |
6575 | 240 |
by (full_simp_tac (simpset() addsimps [Constrains_eq_constrains]) 1); |
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
241 |
by (dtac PLam_constrains_drop_set 1); |
5972 | 242 |
by (assume_tac 1); |
243 |
by (asm_full_simp_tac |
|
6842 | 244 |
(simpset() addsimps [drop_set_INT, |
7523 | 245 |
drop_set_Int_lift_set2, Collect_conj_eq RS sym, |
6842 | 246 |
reachable_PLam_eq]) 1); |
247 |
qed "const_PLam_Constrains_imp_Constrains"; |
|
5972 | 248 |
|
249 |
Goal "[| i: I; finite I |] \ |
|
6842 | 250 |
\ ==> ((plam x:I. F) : (lift_set i A) Co (lift_set i B)) = \ |
6536 | 251 |
\ (F : A Co B)"; |
6842 | 252 |
by (blast_tac (claset() addIs [Constrains_imp_PLam_Constrains, |
253 |
const_PLam_Constrains_imp_Constrains]) 1); |
|
254 |
qed "const_PLam_Constrains"; |
|
5972 | 255 |
|
256 |
Goal "[| i: I; finite I |] \ |
|
6842 | 257 |
\ ==> ((plam x:I. F) : Stable (lift_set i A)) = (F : Stable A)"; |
258 |
by (asm_simp_tac (simpset() addsimps [Stable_def, const_PLam_Constrains]) 1); |
|
259 |
qed "const_PLam_Stable"; |
|
5972 | 260 |
|
7188
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
261 |
Goalw [Increasing_def] |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
262 |
"[| i: I; finite I |] \ |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
263 |
\ ==> ((plam x:I. F) : Increasing (f o sub i)) = (F : Increasing f)"; |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
264 |
by (subgoal_tac "ALL z. {s. z <= (f o sub i) s} = lift_set i {s. z <= f s}" 1); |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
265 |
by (asm_simp_tac (simpset() addsimps [lift_set_sub]) 2); |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
266 |
by (asm_full_simp_tac |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
267 |
(simpset() addsimps [finite_lessThan, const_PLam_Stable]) 1); |
2bc63a44721b
re-organization of theorems from Alloc and PPROD, partly into new theory
paulson
parents:
6867
diff
changeset
|
268 |
qed "const_PLam_Increasing"; |
5972 | 269 |
|
270 |
||
271 |
(*** guarantees properties ***) |
|
272 |
||
6842 | 273 |
Goalw [PLam_def] |
7361 | 274 |
"[| i : I; lift_prog i (F i): X guarantees Y |] \ |
275 |
\ ==> (PLam I F) : X guarantees Y"; |
|
7344
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
276 |
by (asm_simp_tac (simpset() addsimps [guarantees_JN_I]) 1); |
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
277 |
qed "guarantees_PLam_I"; |
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
278 |
|
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
279 |
Goalw [PLam_def] |
7361 | 280 |
"[| ALL i:I. F i : X guarantees Y |] \ |
6842 | 281 |
\ ==> (PLam I F) : (INT i: I. lift_prog i `` X) \ |
7361 | 282 |
\ guarantees (INT i: I. lift_prog i `` Y)"; |
6835
588f791ee737
addition of drop_... operators with new results and simplification of old ones
paulson
parents:
6826
diff
changeset
|
283 |
by (blast_tac (claset() addIs [guarantees_JN_INT, lift_prog_guarantees]) 1); |
7344
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
284 |
bind_thm ("guarantees_PLam_INT", ballI RS result()); |
5972 | 285 |
|
6842 | 286 |
Goalw [PLam_def] |
7361 | 287 |
"[| ALL i:I. F i : X guarantees Y |] \ |
6842 | 288 |
\ ==> (PLam I F) : (UN i: I. lift_prog i `` X) \ |
7361 | 289 |
\ guarantees (UN i: I. lift_prog i `` Y)"; |
6835
588f791ee737
addition of drop_... operators with new results and simplification of old ones
paulson
parents:
6826
diff
changeset
|
290 |
by (blast_tac (claset() addIs [guarantees_JN_UN, lift_prog_guarantees]) 1); |
7344
d54e871d77e0
new guarantees laws; also better natural deduction style for old ones
paulson
parents:
7188
diff
changeset
|
291 |
bind_thm ("guarantees_PLam_UN", ballI RS result()); |