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