| author | wenzelm | 
| Tue, 05 Oct 1999 15:30:14 +0200 | |
| changeset 7718 | 86755cc5b83c | 
| parent 7688 | d106cad8f515 | 
| child 7826 | c6a8b73b6c2a | 
| permissions | -rw-r--r-- | 
| 7186 | 1  | 
(* Title: HOL/UNITY/Lift_prog.ML  | 
2  | 
ID: $Id$  | 
|
3  | 
Author: Lawrence C Paulson, Cambridge University Computer Laboratory  | 
|
4  | 
Copyright 1998 University of Cambridge  | 
|
| 7482 | 5  | 
|
6  | 
THESE PROOFS CAN BE REPLACED BY INVOCATIONS OF RESULTS FROM EXTEND.ML  | 
|
| 7186 | 7  | 
*)  | 
8  | 
||
9  | 
||
| 7525 | 10  | 
val image_eqI' = read_instantiate_sg (sign_of thy)  | 
11  | 
                     [("x", "?ff(i := ?u)")] image_eqI;
 | 
|
12  | 
||
| 7186 | 13  | 
(*** Basic properties ***)  | 
14  | 
||
15  | 
(** lift_set and drop_set **)  | 
|
16  | 
||
17  | 
Goalw [lift_set_def] "(f : lift_set i A) = (f i : A)";  | 
|
18  | 
by Auto_tac;  | 
|
19  | 
qed "lift_set_iff";  | 
|
20  | 
AddIffs [lift_set_iff];  | 
|
21  | 
||
| 7525 | 22  | 
Goalw [lift_set_def] "lift_set i A Int lift_set i B = lift_set i (A Int B)";  | 
23  | 
by Auto_tac;  | 
|
24  | 
qed "Int_lift_set";  | 
|
25  | 
||
26  | 
Goalw [lift_set_def] "lift_set i A Un lift_set i B = lift_set i (A Un B)";  | 
|
| 7186 | 27  | 
by Auto_tac;  | 
| 7525 | 28  | 
qed "Un_lift_set";  | 
29  | 
||
30  | 
Goalw [lift_set_def] "lift_set i A - lift_set i B = lift_set i (A-B)";  | 
|
31  | 
by Auto_tac;  | 
|
32  | 
qed "Diff_lift_set";  | 
|
33  | 
||
34  | 
Addsimps [Int_lift_set, Un_lift_set, Diff_lift_set];  | 
|
| 7186 | 35  | 
|
36  | 
(*Converse fails*)  | 
|
37  | 
Goalw [drop_set_def] "f : A ==> f i : drop_set i A";  | 
|
38  | 
by Auto_tac;  | 
|
39  | 
qed "drop_set_I";  | 
|
40  | 
||
41  | 
(** lift_act and drop_act **)  | 
|
42  | 
||
43  | 
Goalw [lift_act_def] "lift_act i Id = Id";  | 
|
44  | 
by Auto_tac;  | 
|
45  | 
by (etac rev_mp 1);  | 
|
46  | 
by (dtac sym 1);  | 
|
47  | 
by (asm_simp_tac (simpset() addsimps [fun_upd_idem_iff]) 1);  | 
|
48  | 
qed "lift_act_Id";  | 
|
49  | 
Addsimps [lift_act_Id];  | 
|
50  | 
||
| 7688 | 51  | 
(*For compatibility with the original definition and perhaps simpler proofs*)  | 
52  | 
Goalw [lift_act_def]  | 
|
53  | 
"((f,f') : lift_act i act) = (EX s'. f' = f(i := s') & (f i, s') : act)";  | 
|
54  | 
by Auto_tac;  | 
|
55  | 
by (rtac exI 1);  | 
|
56  | 
by Auto_tac;  | 
|
57  | 
qed "lift_act_eq";  | 
|
58  | 
AddIffs [lift_act_eq];  | 
|
59  | 
||
60  | 
Goalw [drop_act_def]  | 
|
61  | 
"[| (s, s') : act; s : C |] ==> (s i, s' i) : drop_act C i act";  | 
|
62  | 
by Auto_tac;  | 
|
| 7186 | 63  | 
qed "drop_act_I";  | 
64  | 
||
| 7688 | 65  | 
Goalw [drop_set_def, drop_act_def]  | 
66  | 
"UNIV <= drop_set i C ==> drop_act C i Id = Id";  | 
|
67  | 
by (Blast_tac 1);  | 
|
| 7186 | 68  | 
qed "drop_act_Id";  | 
69  | 
Addsimps [drop_act_Id];  | 
|
70  | 
||
71  | 
(** lift_prog and drop_prog **)  | 
|
72  | 
||
73  | 
Goalw [lift_prog_def] "Init (lift_prog i F) = lift_set i (Init F)";  | 
|
74  | 
by Auto_tac;  | 
|
75  | 
qed "Init_lift_prog";  | 
|
76  | 
Addsimps [Init_lift_prog];  | 
|
77  | 
||
78  | 
Goalw [lift_prog_def] "Acts (lift_prog i F) = lift_act i `` Acts F";  | 
|
79  | 
by (auto_tac (claset() addIs [Id_in_Acts RSN (2,image_eqI)], simpset()));  | 
|
80  | 
qed "Acts_lift_prog";  | 
|
81  | 
Addsimps [Acts_lift_prog];  | 
|
82  | 
||
| 7688 | 83  | 
Goalw [drop_prog_def] "Init (drop_prog C i F) = drop_set i (Init F)";  | 
| 7186 | 84  | 
by Auto_tac;  | 
85  | 
qed "Init_drop_prog";  | 
|
86  | 
Addsimps [Init_drop_prog];  | 
|
87  | 
||
| 7688 | 88  | 
Goal "Acts (drop_prog C i F) = insert Id (drop_act C i `` Acts F)";  | 
89  | 
by (auto_tac (claset() addIs [Id_in_Acts RSN (2,image_eqI)],  | 
|
90  | 
simpset() addsimps [drop_prog_def]));  | 
|
| 7186 | 91  | 
qed "Acts_drop_prog";  | 
92  | 
Addsimps [Acts_drop_prog];  | 
|
93  | 
||
| 7688 | 94  | 
|
95  | 
(*** sub ***)  | 
|
96  | 
||
97  | 
Addsimps [sub_def];  | 
|
98  | 
||
99  | 
Goal "lift_set i {s. P s} = {s. P (sub i s)}";
 | 
|
100  | 
by (asm_simp_tac (simpset() addsimps [lift_set_def]) 1);  | 
|
101  | 
qed "lift_set_sub";  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
102  | 
|
| 7688 | 103  | 
Goal "{s. P (s i)} = lift_set i {s. P s}";
 | 
104  | 
by (asm_simp_tac (simpset() addsimps [lift_set_def]) 1);  | 
|
105  | 
qed "Collect_eq_lift_set";  | 
|
| 7186 | 106  | 
|
| 7688 | 107  | 
Goal "sub i -`` A = lift_set i A";  | 
108  | 
by (Force_tac 1);  | 
|
109  | 
qed "sub_vimage";  | 
|
110  | 
Addsimps [sub_vimage];  | 
|
111  | 
||
112  | 
||
113  | 
||
114  | 
(*** lift_prog and the lattice operations ***)  | 
|
| 7186 | 115  | 
|
116  | 
Goal "lift_prog i SKIP = SKIP";  | 
|
117  | 
by (auto_tac (claset() addSIs [program_equalityI],  | 
|
118  | 
simpset() addsimps [SKIP_def, lift_prog_def]));  | 
|
119  | 
qed "lift_prog_SKIP";  | 
|
120  | 
||
121  | 
Goal "lift_prog i (F Join G) = (lift_prog i F) Join (lift_prog i G)";  | 
|
122  | 
by (rtac program_equalityI 1);  | 
|
| 7537 | 123  | 
by Auto_tac;  | 
| 7186 | 124  | 
qed "lift_prog_Join";  | 
125  | 
||
| 7525 | 126  | 
Goal "lift_prog i (JOIN J F) = (JN j:J. lift_prog i (F j))";  | 
| 7186 | 127  | 
by (rtac program_equalityI 1);  | 
| 7537 | 128  | 
by Auto_tac;  | 
| 7186 | 129  | 
qed "lift_prog_JN";  | 
130  | 
||
131  | 
||
| 7525 | 132  | 
(*** Equivalence with "extend" version ***)  | 
133  | 
||
134  | 
Goalw [lift_map_def] "good_map (lift_map i)";  | 
|
135  | 
by (rtac good_mapI 1);  | 
|
136  | 
by (res_inst_tac [("f", "%f. (f i, f)")] surjI 1);
 | 
|
137  | 
by Auto_tac;  | 
|
138  | 
by (dres_inst_tac [("f", "%f. f i")] arg_cong 1);
 | 
|
139  | 
by Auto_tac;  | 
|
140  | 
qed "good_map_lift_map";  | 
|
141  | 
||
142  | 
fun lift_export th = good_map_lift_map RS export th;  | 
|
143  | 
||
144  | 
Goal "fst (inv (lift_map i) g) = g i";  | 
|
145  | 
by (rtac (good_map_lift_map RS good_map_is_surj RS fst_inv_equalityI) 1);  | 
|
146  | 
by (auto_tac (claset(), simpset() addsimps [lift_map_def]));  | 
|
147  | 
qed "fst_inv_lift_map";  | 
|
148  | 
Addsimps [fst_inv_lift_map];  | 
|
149  | 
||
150  | 
||
151  | 
Goal "lift_set i A = extend_set (lift_map i) A";  | 
|
152  | 
by (auto_tac (claset(),  | 
|
153  | 
simpset() addsimps [lift_export mem_extend_set_iff]));  | 
|
154  | 
qed "lift_set_correct";  | 
|
155  | 
||
156  | 
Goalw [drop_set_def, project_set_def, lift_map_def]  | 
|
157  | 
"drop_set i A = project_set (lift_map i) A";  | 
|
158  | 
by Auto_tac;  | 
|
159  | 
by (rtac image_eqI 2);  | 
|
160  | 
by (rtac exI 1);  | 
|
161  | 
by (stac (refl RS fun_upd_idem) 1);  | 
|
162  | 
by Auto_tac;  | 
|
163  | 
qed "drop_set_correct";  | 
|
164  | 
||
165  | 
Goal "lift_act i = extend_act (lift_map i)";  | 
|
166  | 
by (rtac ext 1);  | 
|
167  | 
by Auto_tac;  | 
|
168  | 
by (forward_tac [lift_export extend_act_D] 2);  | 
|
| 7688 | 169  | 
by (auto_tac (claset(), simpset() addsimps [extend_act_def]));  | 
| 7525 | 170  | 
by (auto_tac (claset(), simpset() addsimps [extend_act_def, lift_map_def]));  | 
171  | 
by (rtac bexI 1);  | 
|
172  | 
by (auto_tac (claset() addSIs [exI], simpset()));  | 
|
173  | 
qed "lift_act_correct";  | 
|
174  | 
||
| 7688 | 175  | 
Goal "drop_act C i = project_act C (lift_map i)";  | 
| 7525 | 176  | 
by (rtac ext 1);  | 
177  | 
by (rewrite_goals_tac [project_act_def, drop_act_def, lift_map_def]);  | 
|
178  | 
by Auto_tac;  | 
|
| 7688 | 179  | 
by (REPEAT_FIRST (ares_tac [exI, conjI]));  | 
| 7525 | 180  | 
by Auto_tac;  | 
| 7688 | 181  | 
by (REPEAT_FIRST (assume_tac ORELSE' stac (refl RS fun_upd_idem)));  | 
| 7525 | 182  | 
qed "drop_act_correct";  | 
183  | 
||
| 7688 | 184  | 
Goal "lift_prog i = extend (lift_map i)";  | 
185  | 
by (rtac (program_equalityI RS ext) 1);  | 
|
| 7525 | 186  | 
by (simp_tac (simpset() addsimps [lift_set_correct]) 1);  | 
187  | 
by (simp_tac (simpset()  | 
|
188  | 
addsimps [lift_export Acts_extend,  | 
|
189  | 
lift_act_correct]) 1);  | 
|
190  | 
qed "lift_prog_correct";  | 
|
191  | 
||
| 7688 | 192  | 
Goal "drop_prog C i = project C (lift_map i)";  | 
193  | 
by (rtac (program_equalityI RS ext) 1);  | 
|
| 7525 | 194  | 
by (simp_tac (simpset() addsimps [drop_set_correct]) 1);  | 
195  | 
by (simp_tac (simpset()  | 
|
| 
7547
 
a72a551b6d79
new proof of drop_prog_correct for new definition of project_act
 
paulson 
parents: 
7537 
diff
changeset
 | 
196  | 
addsimps [Acts_project, drop_act_correct]) 1);  | 
| 7525 | 197  | 
qed "drop_prog_correct";  | 
198  | 
||
199  | 
||
| 7688 | 200  | 
(** Injectivity of lift_set, lift_act, lift_prog **)  | 
201  | 
||
202  | 
Goalw [lift_set_def, drop_set_def] "drop_set i (lift_set i F) = F";  | 
|
203  | 
by Auto_tac;  | 
|
204  | 
qed "lift_set_inverse";  | 
|
205  | 
Addsimps [lift_set_inverse];  | 
|
206  | 
||
207  | 
Goal "inj (lift_set i)";  | 
|
208  | 
by (rtac inj_on_inverseI 1);  | 
|
209  | 
by (rtac lift_set_inverse 1);  | 
|
210  | 
qed "inj_lift_set";  | 
|
211  | 
||
212  | 
(*Because A and B could differ outside i, cannot generalize result to  | 
|
213  | 
drop_set i (A Int B) = drop_set i A Int drop_set i B  | 
|
214  | 
*)  | 
|
215  | 
Goalw [lift_set_def, drop_set_def]  | 
|
216  | 
"drop_set i ((lift_set i A) Int B) = A Int (drop_set i B)";  | 
|
217  | 
by Auto_tac;  | 
|
218  | 
qed "drop_set_Int_lift_set";  | 
|
219  | 
||
220  | 
Goalw [lift_set_def, drop_set_def]  | 
|
221  | 
"drop_set i (B Int (lift_set i A)) = (drop_set i B) Int A";  | 
|
222  | 
by Auto_tac;  | 
|
223  | 
qed "drop_set_Int_lift_set2";  | 
|
224  | 
||
225  | 
Goalw [drop_set_def]  | 
|
226  | 
"i : I ==> drop_set i (INT j:I. lift_set j A) = A";  | 
|
227  | 
by Auto_tac;  | 
|
228  | 
qed "drop_set_INT";  | 
|
229  | 
||
230  | 
Goal "lift_set i UNIV = UNIV";  | 
|
231  | 
by (simp_tac  | 
|
232  | 
(simpset() addsimps [lift_set_correct, lift_export extend_set_UNIV_eq]) 1);  | 
|
233  | 
qed "lift_set_UNIV_eq";  | 
|
234  | 
Addsimps [lift_set_UNIV_eq];  | 
|
235  | 
||
236  | 
Goal "Domain act <= drop_set i C ==> drop_act C i (lift_act i act) = act";  | 
|
237  | 
by (asm_full_simp_tac  | 
|
238  | 
(simpset() addsimps [drop_set_correct, drop_act_correct,  | 
|
239  | 
lift_act_correct, lift_export extend_act_inverse]) 1);  | 
|
240  | 
qed "lift_act_inverse";  | 
|
241  | 
Addsimps [lift_act_inverse];  | 
|
242  | 
||
243  | 
Goal "UNIV <= drop_set i C ==> drop_prog C i (lift_prog i F) = F";  | 
|
244  | 
by (asm_full_simp_tac  | 
|
245  | 
(simpset() addsimps [drop_set_correct, drop_prog_correct,  | 
|
246  | 
lift_prog_correct, lift_export extend_inverse]) 1);  | 
|
247  | 
qed "lift_prog_inverse";  | 
|
248  | 
Addsimps [lift_prog_inverse];  | 
|
249  | 
||
250  | 
Goal "inj (lift_prog i)";  | 
|
251  | 
by (simp_tac  | 
|
252  | 
(simpset() addsimps [lift_prog_correct, lift_export inj_extend]) 1);  | 
|
253  | 
qed "inj_lift_prog";  | 
|
254  | 
||
255  | 
||
| 7525 | 256  | 
(*** More Lemmas ***)  | 
257  | 
||
258  | 
Goal "lift_act i act ^^ lift_set i A = lift_set i (act^^A)";  | 
|
259  | 
by (asm_simp_tac (simpset() addsimps [lift_set_correct, lift_act_correct,  | 
|
260  | 
lift_export extend_act_Image]) 1);  | 
|
261  | 
qed "lift_act_Image";  | 
|
262  | 
Addsimps [lift_act_Image];  | 
|
263  | 
||
264  | 
||
265  | 
||
| 7186 | 266  | 
(*** Safety: co, stable, invariant ***)  | 
267  | 
||
268  | 
(** Safety and lift_prog **)  | 
|
269  | 
||
270  | 
Goal "(lift_prog i F : (lift_set i A) co (lift_set i B)) = \  | 
|
271  | 
\ (F : A co B)";  | 
|
272  | 
by (auto_tac (claset(),  | 
|
273  | 
simpset() addsimps [constrains_def]));  | 
|
274  | 
by (Force_tac 1);  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
275  | 
qed "lift_prog_constrains";  | 
| 7186 | 276  | 
|
277  | 
Goal "(lift_prog i F : stable (lift_set i A)) = (F : stable A)";  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
278  | 
by (simp_tac (simpset() addsimps [stable_def, lift_prog_constrains]) 1);  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
279  | 
qed "lift_prog_stable";  | 
| 7186 | 280  | 
|
281  | 
Goal "(lift_prog i F : invariant (lift_set i A)) = (F : invariant A)";  | 
|
282  | 
by (auto_tac (claset(),  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
283  | 
simpset() addsimps [invariant_def, lift_prog_stable]));  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
284  | 
qed "lift_prog_invariant";  | 
| 7186 | 285  | 
|
286  | 
(*This one looks strange! Proof probably is by case analysis on i=j.  | 
|
287  | 
If i~=j then lift_prog j (F j) does nothing to lift_set i, and the  | 
|
288  | 
premise ensures A<=B.*)  | 
|
289  | 
Goal "F i : A co B \  | 
|
290  | 
\ ==> lift_prog j (F j) : (lift_set i A) co (lift_set i B)";  | 
|
291  | 
by (auto_tac (claset(),  | 
|
292  | 
simpset() addsimps [constrains_def]));  | 
|
293  | 
by (REPEAT (Blast_tac 1));  | 
|
294  | 
qed "constrains_imp_lift_prog_constrains";  | 
|
295  | 
||
296  | 
||
297  | 
(** Safety and drop_prog **)  | 
|
298  | 
||
| 7688 | 299  | 
Goal "(drop_prog C i F : A co B) = \  | 
300  | 
\ (F : (C Int lift_set i A) co (lift_set i B) & A <= B)";  | 
|
301  | 
by (simp_tac  | 
|
302  | 
(simpset() addsimps [drop_prog_correct,  | 
|
303  | 
lift_set_correct, lift_export project_constrains]) 1);  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
304  | 
qed "drop_prog_constrains";  | 
| 7186 | 305  | 
|
| 7688 | 306  | 
Goal "(drop_prog UNIV i F : stable A) = (F : stable (lift_set i A))";  | 
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
307  | 
by (simp_tac (simpset() addsimps [stable_def, drop_prog_constrains]) 1);  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
308  | 
qed "drop_prog_stable";  | 
| 7186 | 309  | 
|
310  | 
||
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
311  | 
(*** Diff, needed for localTo ***)  | 
| 7186 | 312  | 
|
| 7688 | 313  | 
Goal "[| (UN act:acts. Domain act) <= drop_set i C; \  | 
314  | 
\ Diff G (lift_act i `` acts) : (lift_set i A) co (lift_set i B) |] \  | 
|
315  | 
\ ==> Diff (drop_prog C i G) acts : A co B";  | 
|
316  | 
by (asm_full_simp_tac  | 
|
317  | 
(simpset() addsimps [drop_set_correct, drop_prog_correct,  | 
|
318  | 
lift_set_correct, lift_act_correct,  | 
|
319  | 
lift_export Diff_project_co]) 1);  | 
|
| 7186 | 320  | 
qed "Diff_drop_prog_co";  | 
321  | 
||
322  | 
Goalw [stable_def]  | 
|
| 7688 | 323  | 
"[| (UN act:acts. Domain act) <= drop_set i C; \  | 
324  | 
\ Diff G (lift_act i `` acts) : stable (lift_set i A) |] \  | 
|
325  | 
\ ==> Diff (drop_prog C i G) acts : stable A";  | 
|
| 7186 | 326  | 
by (etac Diff_drop_prog_co 1);  | 
| 7688 | 327  | 
by (assume_tac 1);  | 
| 7186 | 328  | 
qed "Diff_drop_prog_stable";  | 
329  | 
||
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
330  | 
Goalw [constrains_def, Diff_def]  | 
| 7688 | 331  | 
"Diff G acts : A co B \  | 
332  | 
\ ==> Diff (lift_prog i G) (lift_act i `` acts) \  | 
|
| 7186 | 333  | 
\ : (lift_set i A) co (lift_set i B)";  | 
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
334  | 
by Auto_tac;  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
335  | 
by (Blast_tac 1);  | 
| 7186 | 336  | 
qed "Diff_lift_prog_co";  | 
337  | 
||
338  | 
Goalw [stable_def]  | 
|
| 7688 | 339  | 
"Diff G acts : stable A \  | 
340  | 
\ ==> Diff (lift_prog i G) (lift_act i `` acts) : stable (lift_set i A)";  | 
|
| 7186 | 341  | 
by (etac Diff_lift_prog_co 1);  | 
342  | 
qed "Diff_lift_prog_stable";  | 
|
343  | 
||
344  | 
||
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
345  | 
(*** Weak safety primitives: Co, Stable ***)  | 
| 7186 | 346  | 
|
347  | 
(** Reachability **)  | 
|
348  | 
||
349  | 
Goal "reachable (lift_prog i F) = lift_set i (reachable F)";  | 
|
| 7688 | 350  | 
by (simp_tac  | 
351  | 
(simpset() addsimps [lift_prog_correct, lift_set_correct,  | 
|
352  | 
lift_export reachable_extend_eq]) 1);  | 
|
| 7186 | 353  | 
qed "reachable_lift_prog";  | 
354  | 
||
355  | 
Goal "(lift_prog i F : (lift_set i A) Co (lift_set i B)) = \  | 
|
356  | 
\ (F : A Co B)";  | 
|
357  | 
by (simp_tac (simpset() addsimps [Constrains_def, reachable_lift_prog,  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
358  | 
lift_prog_constrains]) 1);  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
359  | 
qed "lift_prog_Constrains";  | 
| 7186 | 360  | 
|
361  | 
Goal "(lift_prog i F : Stable (lift_set i A)) = (F : Stable A)";  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
362  | 
by (simp_tac (simpset() addsimps [Stable_def, lift_prog_Constrains]) 1);  | 
| 
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
363  | 
qed "lift_prog_Stable";  | 
| 7186 | 364  | 
|
| 7688 | 365  | 
Goal "[| reachable (lift_prog i F Join G) <= C; \  | 
366  | 
\ F Join drop_prog C i G : A Co B |] \  | 
|
367  | 
\ ==> lift_prog i F Join G : (lift_set i A) Co (lift_set i B)";  | 
|
368  | 
by (asm_full_simp_tac  | 
|
369  | 
(simpset() addsimps [lift_prog_correct, drop_prog_correct,  | 
|
370  | 
lift_set_correct, lift_export project_Constrains_D]) 1);  | 
|
| 7186 | 371  | 
qed "drop_prog_Constrains_D";  | 
372  | 
||
373  | 
Goalw [Stable_def]  | 
|
| 7688 | 374  | 
"[| reachable (lift_prog i F Join G) <= C; \  | 
375  | 
\ F Join drop_prog C i G : Stable A |] \  | 
|
376  | 
\ ==> lift_prog i F Join G : Stable (lift_set i A)";  | 
|
| 7186 | 377  | 
by (asm_simp_tac (simpset() addsimps [drop_prog_Constrains_D]) 1);  | 
378  | 
qed "drop_prog_Stable_D";  | 
|
379  | 
||
| 7688 | 380  | 
Goal "[| reachable (lift_prog i F Join G) <= C; \  | 
381  | 
\ F Join drop_prog C i G : Always A |] \  | 
|
382  | 
\ ==> lift_prog i F Join G : Always (lift_set i A)";  | 
|
383  | 
by (asm_full_simp_tac  | 
|
384  | 
(simpset() addsimps [lift_prog_correct, drop_prog_correct,  | 
|
385  | 
lift_set_correct, lift_export project_Always_D]) 1);  | 
|
386  | 
qed "drop_prog_Always_D";  | 
|
| 7186 | 387  | 
|
| 7688 | 388  | 
Goalw [Increasing_def]  | 
389  | 
"[| reachable (lift_prog i F Join G) <= C; \  | 
|
390  | 
\ F Join drop_prog C i G : Increasing func |] \  | 
|
391  | 
\ ==> lift_prog i F Join G : Increasing (func o (sub i))";  | 
|
| 7186 | 392  | 
by Auto_tac;  | 
| 7688 | 393  | 
by (stac Collect_eq_lift_set 1);  | 
394  | 
by (asm_simp_tac (simpset() addsimps [drop_prog_Stable_D]) 1);  | 
|
395  | 
qed "project_Increasing_D";  | 
|
| 7186 | 396  | 
|
| 7361 | 397  | 
|
| 7688 | 398  | 
(*UNUSED*)  | 
399  | 
Goal "UNIV <= drop_set i C \  | 
|
400  | 
\ ==> drop_prog C i ((lift_prog i F) Join G) = F Join (drop_prog C i G)";  | 
|
401  | 
by (asm_full_simp_tac  | 
|
402  | 
(simpset() addsimps [lift_prog_correct, drop_prog_correct,  | 
|
403  | 
drop_set_correct, lift_export project_extend_Join]) 1);  | 
|
404  | 
qed "drop_prog_lift_prog_Join";  | 
|
| 7186 | 405  | 
|
406  | 
||
| 7525 | 407  | 
(*** Progress: transient, ensures ***)  | 
408  | 
||
409  | 
Goal "(lift_prog i F : transient (lift_set i A)) = (F : transient A)";  | 
|
410  | 
by (simp_tac (simpset() addsimps [lift_set_correct, lift_prog_correct,  | 
|
411  | 
lift_export extend_transient]) 1);  | 
|
412  | 
qed "lift_prog_transient";  | 
|
413  | 
||
414  | 
Goal "(lift_prog i F : transient (lift_set j A)) = \  | 
|
415  | 
\     (i=j & F : transient A | A={})";
 | 
|
416  | 
by (case_tac "i=j" 1);  | 
|
417  | 
by (auto_tac (claset(), simpset() addsimps [lift_prog_transient]));  | 
|
418  | 
by (auto_tac (claset(), simpset() addsimps [lift_prog_def, transient_def]));  | 
|
419  | 
by (Force_tac 1);  | 
|
420  | 
qed "lift_prog_transient_eq_disj";  | 
|
421  | 
||
422  | 
||
| 7186 | 423  | 
(*** guarantees properties ***)  | 
424  | 
||
| 7688 | 425  | 
val [xguary,project,lift_prog] =  | 
| 7361 | 426  | 
Goal "[| F : X guarantees Y; \  | 
| 7688 | 427  | 
\ !!G. lift_prog i F Join G : X' ==> F Join proj G : X; \  | 
428  | 
\ !!G. [| F Join proj G : Y; lift_prog i F Join G : X'; \  | 
|
429  | 
\ Disjoint (lift_prog i F) G |] \  | 
|
430  | 
\ ==> lift_prog i F Join G : Y' |] \  | 
|
431  | 
\ ==> lift_prog i F : X' guarantees Y'";  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
432  | 
by (rtac (xguary RS guaranteesD RS lift_prog RS guaranteesI) 1);  | 
| 7688 | 433  | 
by (etac project 1);  | 
434  | 
by (assume_tac 1);  | 
|
435  | 
by (assume_tac 1);  | 
|
| 7186 | 436  | 
qed "drop_prog_guarantees";  | 
437  | 
||
438  | 
||
439  | 
(** Are these two useful?? **)  | 
|
440  | 
||
441  | 
(*The other direction fails: having FF : Stable {s. z <= f (s i)} does not
 | 
|
442  | 
ensure that F has the form lift_prog i F for some F.*)  | 
|
443  | 
Goal "lift_prog i `` Stable {s. P (f s)} <= Stable {s. P (f (s i))}";
 | 
|
444  | 
by Auto_tac;  | 
|
445  | 
by (stac Collect_eq_lift_set 1);  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
446  | 
by (asm_simp_tac (simpset() addsimps [lift_prog_Stable]) 1);  | 
| 7186 | 447  | 
qed "image_lift_prog_Stable";  | 
448  | 
||
449  | 
Goal "lift_prog i `` Increasing f <= Increasing (f o sub i)";  | 
|
450  | 
by (simp_tac (simpset() addsimps [Increasing_def,  | 
|
451  | 
inj_lift_prog RS image_INT]) 1);  | 
|
452  | 
by (blast_tac (claset() addIs [impOfSubs image_lift_prog_Stable]) 1);  | 
|
453  | 
qed "image_lift_prog_Increasing";  | 
|
454  | 
||
455  | 
||
456  | 
(*** guarantees corollaries ***)  | 
|
457  | 
||
| 7688 | 458  | 
Goal "F : UNIV guarantees increasing f \  | 
| 7361 | 459  | 
\ ==> lift_prog i F : UNIV guarantees increasing (f o sub i)";  | 
| 7688 | 460  | 
by (dtac (lift_export extend_guar_increasing) 1);  | 
461  | 
by (asm_full_simp_tac (simpset() addsimps [lift_prog_correct, o_def]) 1);  | 
|
| 7186 | 462  | 
qed "lift_prog_guar_increasing";  | 
463  | 
||
| 7688 | 464  | 
Goal "F : UNIV guarantees Increasing f \  | 
| 7361 | 465  | 
\ ==> lift_prog i F : UNIV guarantees Increasing (f o sub i)";  | 
| 7688 | 466  | 
by (dtac (lift_export extend_guar_Increasing) 1);  | 
467  | 
by (asm_full_simp_tac (simpset() addsimps [lift_prog_correct, o_def]) 1);  | 
|
| 7186 | 468  | 
qed "lift_prog_guar_Increasing";  | 
469  | 
||
| 7688 | 470  | 
Goal "F : (v localTo G) guarantees increasing func \  | 
471  | 
\ ==> lift_prog i F : (v o sub i) localTo (lift_prog i G) \  | 
|
472  | 
\ guarantees increasing (func o sub i)";  | 
|
473  | 
by (dtac (lift_export extend_localTo_guar_increasing) 1);  | 
|
474  | 
by (asm_full_simp_tac (simpset() addsimps [lift_prog_correct, o_def]) 1);  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
475  | 
qed "lift_prog_localTo_guar_increasing";  | 
| 7186 | 476  | 
|
| 7688 | 477  | 
Goal "F : (v localTo G) guarantees Increasing func \  | 
478  | 
\ ==> lift_prog i F : (v o sub i) localTo (lift_prog i G) \  | 
|
479  | 
\ guarantees Increasing (func o sub i)";  | 
|
480  | 
by (dtac (lift_export extend_localTo_guar_Increasing) 1);  | 
|
481  | 
by (asm_full_simp_tac (simpset() addsimps [lift_prog_correct, o_def]) 1);  | 
|
| 
7343
 
4fa705cedbdb
renamed some theorems; also better natural deduction style for old ones
 
paulson 
parents: 
7186 
diff
changeset
 | 
482  | 
qed "lift_prog_localTo_guar_Increasing";  | 
| 7186 | 483  | 
|
| 7688 | 484  | 
Goal "F : Always A guarantees Always B \  | 
485  | 
\ ==> lift_prog i F : Always(lift_set i A) guarantees Always (lift_set i B)";  | 
|
486  | 
by (asm_simp_tac  | 
|
487  | 
(simpset() addsimps [lift_set_correct, lift_prog_correct,  | 
|
488  | 
lift_export extend_guar_Always]) 1);  | 
|
489  | 
qed "lift_prog_guar_Always";  | 
|
| 7482 | 490  | 
|
| 7525 | 491  | 
(*No analogue of this in Extend.ML!*)  | 
| 7688 | 492  | 
Goal "[| lift_prog i F : A co B |] \  | 
493  | 
\ ==> F : (drop_set i A) co (drop_set i B)";  | 
|
| 7482 | 494  | 
by (auto_tac (claset(),  | 
| 7525 | 495  | 
simpset() addsimps [constrains_def, drop_set_def]));  | 
496  | 
by (force_tac (claset() addSIs [image_eqI'], simpset()) 1);  | 
|
497  | 
qed "lift_prog_constrains_drop_set";  |