| author | wenzelm |
| Mon, 09 Nov 1998 15:34:23 +0100 | |
| changeset 5830 | 95b619c7289b |
| parent 5804 | 8e0a4c4fd67b |
| child 6295 | 351b3c2b0d83 |
| permissions | -rw-r--r-- |
| 4776 | 1 |
(* Title: HOL/UNITY/SubstAx |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1998 University of Cambridge |
|
5 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
6 |
LeadsTo relation, restricted to the set of reachable states. |
| 4776 | 7 |
*) |
8 |
||
| 5648 | 9 |
overload_1st_set "SubstAx.LeadsTo"; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
10 |
|
| 4776 | 11 |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
12 |
(*** Specialized laws for handling invariants ***) |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
13 |
|
| 5544 | 14 |
(** Conjoining a safety property **) |
15 |
||
| 5648 | 16 |
Goal "[| reachable F <= C; F : LeadsTo (C Int A) A' |] \ |
17 |
\ ==> F : LeadsTo A A'"; |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
18 |
by (asm_full_simp_tac |
| 5544 | 19 |
(simpset() addsimps [LeadsTo_def, Int_absorb2, Int_assoc RS sym]) 1); |
20 |
qed "reachable_LeadsToI"; |
|
21 |
||
| 5648 | 22 |
Goal "[| reachable F <= C; F : LeadsTo A A' |] \ |
23 |
\ ==> F : LeadsTo A (C Int A')"; |
|
| 5544 | 24 |
by (asm_full_simp_tac |
25 |
(simpset() addsimps [LeadsTo_def, Int_absorb2, |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
26 |
Int_assoc RS sym]) 1); |
| 5544 | 27 |
qed "reachable_LeadsToD"; |
28 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
29 |
|
| 5544 | 30 |
(** Conjoining an invariant **) |
31 |
||
| 5648 | 32 |
(* [| Invariant F C; F : LeadsTo (C Int A) A' |] ==> F : LeadsTo A A' *) |
| 5544 | 33 |
bind_thm ("Invariant_LeadsToI",
|
34 |
Invariant_includes_reachable RS reachable_LeadsToI); |
|
35 |
||
| 5648 | 36 |
(* [| Invariant F C; F : LeadsTo A A' |] ==> F : LeadsTo A (C Int A') *) |
| 5544 | 37 |
bind_thm ("Invariant_LeadsToD",
|
38 |
Invariant_includes_reachable RS reachable_LeadsToD); |
|
39 |
||
40 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
41 |
|
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
42 |
|
| 4776 | 43 |
(*** Introduction rules: Basis, Trans, Union ***) |
44 |
||
| 5648 | 45 |
Goal "F : leadsTo A B ==> F : LeadsTo A B"; |
| 5111 | 46 |
by (simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
47 |
by (blast_tac (claset() addIs [psp_stable2, stable_reachable]) 1); |
| 4776 | 48 |
qed "leadsTo_imp_LeadsTo"; |
49 |
||
| 5648 | 50 |
Goal "[| F : LeadsTo A B; F : LeadsTo B C |] ==> F : LeadsTo A C"; |
| 5111 | 51 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 52 |
by (blast_tac (claset() addIs [leadsTo_Trans]) 1); |
53 |
qed "LeadsTo_Trans"; |
|
54 |
||
| 5648 | 55 |
val prems = Goalw [LeadsTo_def] |
56 |
"(!!A. A : S ==> F : LeadsTo A B) ==> F : LeadsTo (Union S) B"; |
|
| 5111 | 57 |
by (Simp_tac 1); |
| 4776 | 58 |
by (stac Int_Union 1); |
| 5648 | 59 |
by (blast_tac (claset() addIs [leadsTo_UN] addDs prems) 1); |
| 4776 | 60 |
qed "LeadsTo_Union"; |
61 |
||
62 |
||
63 |
(*** Derived rules ***) |
|
64 |
||
| 5648 | 65 |
Goal "F : LeadsTo A UNIV"; |
66 |
by (asm_simp_tac |
|
67 |
(simpset() addsimps [LeadsTo_def, Int_lower1 RS subset_imp_leadsTo]) 1); |
|
| 4776 | 68 |
qed "LeadsTo_UNIV"; |
69 |
Addsimps [LeadsTo_UNIV]; |
|
70 |
||
71 |
(*Useful with cancellation, disjunction*) |
|
| 5648 | 72 |
Goal "F : LeadsTo A (A' Un A') ==> F : LeadsTo A A'"; |
| 4776 | 73 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
74 |
qed "LeadsTo_Un_duplicate"; |
|
75 |
||
| 5648 | 76 |
Goal "F : LeadsTo A (A' Un C Un C) ==> F : LeadsTo A (A' Un C)"; |
| 4776 | 77 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
78 |
qed "LeadsTo_Un_duplicate2"; |
|
79 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
80 |
val prems = |
| 5648 | 81 |
Goal "(!!i. i : I ==> F : LeadsTo (A i) B) ==> F : LeadsTo (UN i:I. A i) B"; |
| 4776 | 82 |
by (simp_tac (simpset() addsimps [Union_image_eq RS sym]) 1); |
83 |
by (blast_tac (claset() addIs (LeadsTo_Union::prems)) 1); |
|
84 |
qed "LeadsTo_UN"; |
|
85 |
||
86 |
(*Binary union introduction rule*) |
|
| 5648 | 87 |
Goal "[| F : LeadsTo A C; F : LeadsTo B C |] ==> F : LeadsTo (A Un B) C"; |
| 4776 | 88 |
by (stac Un_eq_Union 1); |
89 |
by (blast_tac (claset() addIs [LeadsTo_Union]) 1); |
|
90 |
qed "LeadsTo_Un"; |
|
91 |
||
| 5648 | 92 |
Goal "A <= B ==> F : LeadsTo A B"; |
| 5111 | 93 |
by (simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 94 |
by (blast_tac (claset() addIs [subset_imp_leadsTo]) 1); |
95 |
qed "subset_imp_LeadsTo"; |
|
96 |
||
97 |
bind_thm ("empty_LeadsTo", empty_subsetI RS subset_imp_LeadsTo);
|
|
98 |
Addsimps [empty_LeadsTo]; |
|
99 |
||
| 5648 | 100 |
Goal "[| F : LeadsTo A A'; A' <= B' |] ==> F : LeadsTo A B'"; |
| 5111 | 101 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 102 |
by (blast_tac (claset() addIs [leadsTo_weaken_R]) 1); |
103 |
qed_spec_mp "LeadsTo_weaken_R"; |
|
104 |
||
| 5648 | 105 |
Goal "[| F : LeadsTo A A'; B <= A |] \ |
106 |
\ ==> F : LeadsTo B A'"; |
|
| 5111 | 107 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 108 |
by (blast_tac (claset() addIs [leadsTo_weaken_L]) 1); |
109 |
qed_spec_mp "LeadsTo_weaken_L"; |
|
110 |
||
| 5648 | 111 |
Goal "[| F : LeadsTo A A'; \ |
| 5340 | 112 |
\ B <= A; A' <= B' |] \ |
| 5648 | 113 |
\ ==> F : LeadsTo B B'"; |
| 5340 | 114 |
by (blast_tac (claset() addIs [LeadsTo_weaken_R, LeadsTo_weaken_L, |
115 |
LeadsTo_Trans]) 1); |
|
116 |
qed "LeadsTo_weaken"; |
|
| 4776 | 117 |
|
| 5648 | 118 |
Goal "[| reachable F <= C; F : LeadsTo A A'; \ |
| 5544 | 119 |
\ C Int B <= A; C Int A' <= B' |] \ |
| 5648 | 120 |
\ ==> F : LeadsTo B B'"; |
| 5544 | 121 |
by (blast_tac (claset() addDs [reachable_LeadsToI] addIs[LeadsTo_weaken] |
122 |
addIs [reachable_LeadsToD]) 1); |
|
123 |
qed "reachable_LeadsTo_weaken"; |
|
| 5340 | 124 |
|
125 |
(** Two theorems for "proof lattices" **) |
|
126 |
||
| 5648 | 127 |
Goal "[| F : LeadsTo A B |] ==> F : LeadsTo (A Un B) B"; |
| 5340 | 128 |
by (blast_tac (claset() addIs [LeadsTo_Un, subset_imp_LeadsTo]) 1); |
129 |
qed "LeadsTo_Un_post"; |
|
130 |
||
| 5648 | 131 |
Goal "[| F : LeadsTo A B; F : LeadsTo B C |] \ |
132 |
\ ==> F : LeadsTo (A Un B) C"; |
|
| 5340 | 133 |
by (blast_tac (claset() addIs [LeadsTo_Un, subset_imp_LeadsTo, |
134 |
LeadsTo_weaken_L, LeadsTo_Trans]) 1); |
|
135 |
qed "LeadsTo_Trans_Un"; |
|
136 |
||
137 |
||
138 |
(** Distributive laws **) |
|
139 |
||
| 5648 | 140 |
Goal "(F : LeadsTo (A Un B) C) = (F : LeadsTo A C & F : LeadsTo B C)"; |
| 4776 | 141 |
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken_L]) 1); |
142 |
qed "LeadsTo_Un_distrib"; |
|
143 |
||
| 5648 | 144 |
Goal "(F : LeadsTo (UN i:I. A i) B) = (ALL i : I. F : LeadsTo (A i) B)"; |
| 4776 | 145 |
by (blast_tac (claset() addIs [LeadsTo_UN, LeadsTo_weaken_L]) 1); |
146 |
qed "LeadsTo_UN_distrib"; |
|
147 |
||
| 5648 | 148 |
Goal "(F : LeadsTo (Union S) B) = (ALL A : S. F : LeadsTo A B)"; |
| 4776 | 149 |
by (blast_tac (claset() addIs [LeadsTo_Union, LeadsTo_weaken_L]) 1); |
150 |
qed "LeadsTo_Union_distrib"; |
|
151 |
||
152 |
||
| 5620 | 153 |
(** More rules using the premise "Invariant F" **) |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
154 |
|
| 5648 | 155 |
Goal "[| F : Constrains (A-A') (A Un A'); F : transient (A-A') |] \ |
156 |
\ ==> F : LeadsTo A A'"; |
|
157 |
by (asm_full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_def]) 1); |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
158 |
by (rtac (ensuresI RS leadsTo_Basis) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
159 |
by (blast_tac (claset() addIs [transient_strengthen]) 2); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
160 |
by (blast_tac (claset() addIs [constrains_weaken]) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
161 |
qed "LeadsTo_Basis"; |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
162 |
|
| 5648 | 163 |
Goal "[| F : Invariant INV; \ |
164 |
\ F : Constrains (INV Int (A-A')) (A Un A'); \ |
|
165 |
\ F : transient (INV Int (A-A')) |] \ |
|
166 |
\ ==> F : LeadsTo A A'"; |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
167 |
by (rtac Invariant_LeadsToI 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
168 |
by (assume_tac 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
169 |
by (rtac LeadsTo_Basis 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
170 |
by (blast_tac (claset() addIs [transient_strengthen]) 2); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
171 |
by (blast_tac (claset() addIs [Invariant_ConstrainsD RS Constrains_weaken]) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
172 |
qed "Invariant_LeadsTo_Basis"; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
173 |
|
| 5648 | 174 |
Goal "[| F : Invariant INV; \ |
175 |
\ F : LeadsTo A A'; INV Int B <= A; INV Int A' <= B' |] \ |
|
176 |
\ ==> F : LeadsTo B B'"; |
|
| 5639 | 177 |
by (REPEAT (ares_tac [Invariant_includes_reachable, |
178 |
reachable_LeadsTo_weaken] 1)); |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
179 |
qed "Invariant_LeadsTo_weaken"; |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
180 |
|
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
181 |
|
| 5253 | 182 |
(*Set difference: maybe combine with leadsTo_weaken_L?? |
183 |
This is the most useful form of the "disjunction" rule*) |
|
| 5648 | 184 |
Goal "[| F : LeadsTo (A-B) C; F : LeadsTo (A Int B) C |] \ |
185 |
\ ==> F : LeadsTo A C"; |
|
| 5479 | 186 |
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken]) 1); |
| 4776 | 187 |
qed "LeadsTo_Diff"; |
188 |
||
189 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
190 |
val prems = |
| 5648 | 191 |
Goal "(!! i. i:I ==> F : LeadsTo (A i) (A' i)) \ |
192 |
\ ==> F : LeadsTo (UN i:I. A i) (UN i:I. A' i)"; |
|
| 4776 | 193 |
by (simp_tac (simpset() addsimps [Union_image_eq RS sym]) 1); |
194 |
by (blast_tac (claset() addIs [LeadsTo_Union, LeadsTo_weaken_R] |
|
195 |
addIs prems) 1); |
|
196 |
qed "LeadsTo_UN_UN"; |
|
197 |
||
198 |
||
199 |
(*Version with no index set*) |
|
| 5257 | 200 |
val prems = |
| 5648 | 201 |
Goal "(!! i. F : LeadsTo (A i) (A' i)) \ |
202 |
\ ==> F : LeadsTo (UN i. A i) (UN i. A' i)"; |
|
| 4776 | 203 |
by (blast_tac (claset() addIs [LeadsTo_UN_UN] |
204 |
addIs prems) 1); |
|
205 |
qed "LeadsTo_UN_UN_noindex"; |
|
206 |
||
207 |
(*Version with no index set*) |
|
| 5648 | 208 |
Goal "ALL i. F : LeadsTo (A i) (A' i) \ |
209 |
\ ==> F : LeadsTo (UN i. A i) (UN i. A' i)"; |
|
| 4776 | 210 |
by (blast_tac (claset() addIs [LeadsTo_UN_UN]) 1); |
211 |
qed "all_LeadsTo_UN_UN"; |
|
212 |
||
213 |
||
214 |
(*Binary union version*) |
|
| 5648 | 215 |
Goal "[| F : LeadsTo A A'; F : LeadsTo B B' |] \ |
216 |
\ ==> F : LeadsTo (A Un B) (A' Un B')"; |
|
| 4776 | 217 |
by (blast_tac (claset() addIs [LeadsTo_Un, |
218 |
LeadsTo_weaken_R]) 1); |
|
219 |
qed "LeadsTo_Un_Un"; |
|
220 |
||
221 |
||
222 |
(** The cancellation law **) |
|
223 |
||
| 5648 | 224 |
Goal "[| F : LeadsTo A (A' Un B); F : LeadsTo B B' |] \ |
225 |
\ ==> F : LeadsTo A (A' Un B')"; |
|
| 4776 | 226 |
by (blast_tac (claset() addIs [LeadsTo_Un_Un, |
227 |
subset_imp_LeadsTo, LeadsTo_Trans]) 1); |
|
228 |
qed "LeadsTo_cancel2"; |
|
229 |
||
| 5648 | 230 |
Goal "[| F : LeadsTo A (A' Un B); F : LeadsTo (B-A') B' |] \ |
231 |
\ ==> F : LeadsTo A (A' Un B')"; |
|
| 4776 | 232 |
by (rtac LeadsTo_cancel2 1); |
233 |
by (assume_tac 2); |
|
234 |
by (ALLGOALS Asm_simp_tac); |
|
235 |
qed "LeadsTo_cancel_Diff2"; |
|
236 |
||
| 5648 | 237 |
Goal "[| F : LeadsTo A (B Un A'); F : LeadsTo B B' |] \ |
238 |
\ ==> F : LeadsTo A (B' Un A')"; |
|
| 4776 | 239 |
by (asm_full_simp_tac (simpset() addsimps [Un_commute]) 1); |
240 |
by (blast_tac (claset() addSIs [LeadsTo_cancel2]) 1); |
|
241 |
qed "LeadsTo_cancel1"; |
|
242 |
||
| 5648 | 243 |
Goal "[| F : LeadsTo A (B Un A'); F : LeadsTo (B-A') B' |] \ |
244 |
\ ==> F : LeadsTo A (B' Un A')"; |
|
| 4776 | 245 |
by (rtac LeadsTo_cancel1 1); |
246 |
by (assume_tac 2); |
|
247 |
by (ALLGOALS Asm_simp_tac); |
|
248 |
qed "LeadsTo_cancel_Diff1"; |
|
249 |
||
250 |
||
251 |
(** The impossibility law **) |
|
252 |
||
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
253 |
(*The set "A" may be non-empty, but it contains no reachable states*) |
| 5648 | 254 |
Goal "F : LeadsTo A {} ==> reachable F Int A = {}";
|
| 5111 | 255 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 256 |
by (etac leadsTo_empty 1); |
257 |
qed "LeadsTo_empty"; |
|
258 |
||
259 |
||
260 |
(** PSP: Progress-Safety-Progress **) |
|
261 |
||
| 5639 | 262 |
(*Special case of PSP: Misra's "stable conjunction"*) |
| 5648 | 263 |
Goal "[| F : LeadsTo A A'; F : Stable B |] \ |
264 |
\ ==> F : LeadsTo (A Int B) (A' Int B)"; |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
265 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
266 |
by (dtac psp_stable 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
267 |
by (assume_tac 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
268 |
by (asm_full_simp_tac (simpset() addsimps Int_ac) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
269 |
qed "PSP_stable"; |
| 4776 | 270 |
|
| 5648 | 271 |
Goal "[| F : LeadsTo A A'; F : Stable B |] \ |
272 |
\ ==> F : LeadsTo (B Int A) (B Int A')"; |
|
| 5536 | 273 |
by (asm_simp_tac (simpset() addsimps PSP_stable::Int_ac) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
274 |
qed "PSP_stable2"; |
| 4776 | 275 |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
276 |
Goalw [LeadsTo_def, Constrains_def] |
| 5648 | 277 |
"[| F : LeadsTo A A'; F : Constrains B B' |] \ |
278 |
\ ==> F : LeadsTo (A Int B) ((A' Int B) Un (B' - B))"; |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
279 |
by (blast_tac (claset() addDs [psp] addIs [leadsTo_weaken]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
280 |
qed "PSP"; |
| 4776 | 281 |
|
| 5648 | 282 |
Goal "[| F : LeadsTo A A'; F : Constrains B B' |] \ |
283 |
\ ==> F : LeadsTo (B Int A) ((B Int A') Un (B' - B))"; |
|
| 5536 | 284 |
by (asm_simp_tac (simpset() addsimps PSP::Int_ac) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
285 |
qed "PSP2"; |
| 4776 | 286 |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
287 |
Goalw [Unless_def] |
| 5648 | 288 |
"[| F : LeadsTo A A'; F : Unless B B' |] \ |
289 |
\ ==> F : LeadsTo (A Int B) ((A' Int B) Un B')"; |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
290 |
by (dtac PSP 1); |
| 4776 | 291 |
by (assume_tac 1); |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
292 |
by (blast_tac (claset() addIs [LeadsTo_Diff, LeadsTo_weaken, |
| 5584 | 293 |
subset_imp_LeadsTo]) 1); |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
294 |
qed "PSP_Unless"; |
| 4776 | 295 |
|
296 |
||
|
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
297 |
Goal "[| F : Stable A; F : transient C; \ |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
298 |
\ reachable F <= (-A Un B Un C) |] ==> F : LeadsTo A B"; |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
299 |
by (etac reachable_LeadsTo_weaken 1); |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
300 |
by (rtac LeadsTo_Diff 1); |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
301 |
by (etac (transient_imp_leadsTo RS leadsTo_imp_LeadsTo RS PSP_stable2) 2); |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
302 |
by (ALLGOALS (blast_tac (claset() addIs [subset_imp_LeadsTo]))); |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
303 |
qed "Stable_transient_reachable_LeadsTo"; |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
304 |
|
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5648
diff
changeset
|
305 |
|
| 4776 | 306 |
(*** Induction rules ***) |
307 |
||
308 |
(** Meta or object quantifier ????? **) |
|
| 5232 | 309 |
Goal "[| wf r; \ |
| 5648 | 310 |
\ ALL m. F : LeadsTo (A Int f-``{m}) \
|
| 5584 | 311 |
\ ((A Int f-``(r^-1 ^^ {m})) Un B) |] \
|
| 5648 | 312 |
\ ==> F : LeadsTo A B"; |
| 5111 | 313 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
| 4776 | 314 |
by (etac leadsTo_wf_induct 1); |
315 |
by (blast_tac (claset() addIs [leadsTo_weaken]) 1); |
|
316 |
qed "LeadsTo_wf_induct"; |
|
317 |
||
318 |
||
| 5232 | 319 |
Goal "[| wf r; \ |
| 5648 | 320 |
\ ALL m:I. F : LeadsTo (A Int f-``{m}) \
|
| 5584 | 321 |
\ ((A Int f-``(r^-1 ^^ {m})) Un B) |] \
|
| 5648 | 322 |
\ ==> F : LeadsTo A ((A - (f-``I)) Un B)"; |
| 4776 | 323 |
by (etac LeadsTo_wf_induct 1); |
324 |
by Safe_tac; |
|
325 |
by (case_tac "m:I" 1); |
|
326 |
by (blast_tac (claset() addIs [LeadsTo_weaken]) 1); |
|
327 |
by (blast_tac (claset() addIs [subset_imp_LeadsTo]) 1); |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
328 |
qed "Bounded_induct"; |
| 4776 | 329 |
|
330 |
||
| 5648 | 331 |
Goal "[| ALL m. F : LeadsTo (A Int f-``{m}) \
|
| 5584 | 332 |
\ ((A Int f-``(lessThan m)) Un B) |] \ |
| 5648 | 333 |
\ ==> F : LeadsTo A B"; |
| 4776 | 334 |
by (rtac (wf_less_than RS LeadsTo_wf_induct) 1); |
335 |
by (Asm_simp_tac 1); |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
336 |
qed "LessThan_induct"; |
| 4776 | 337 |
|
| 5544 | 338 |
(*Integer version. Could generalize from #0 to any lower bound*) |
| 5584 | 339 |
val [reach, prem] = |
| 5620 | 340 |
Goal "[| reachable F <= {s. #0 <= f s}; \
|
| 5648 | 341 |
\ !! z. F : LeadsTo (A Int {s. f s = z}) \
|
| 5584 | 342 |
\ ((A Int {s. f s < z}) Un B) |] \
|
| 5648 | 343 |
\ ==> F : LeadsTo A B"; |
|
5569
8c7e1190e789
Renaming of Integ/Integ.* to Integ/Int.*, and renaming of related constants
paulson
parents:
5544
diff
changeset
|
344 |
by (res_inst_tac [("f", "nat o f")] (allI RS LessThan_induct) 1);
|
| 5544 | 345 |
by (simp_tac (simpset() addsimps [vimage_def]) 1); |
| 5620 | 346 |
by (rtac ([reach, prem] MRS reachable_LeadsTo_weaken) 1); |
| 5584 | 347 |
by (auto_tac (claset(), simpset() addsimps [nat_eq_iff, nat_less_iff])); |
| 5544 | 348 |
qed "integ_0_le_induct"; |
349 |
||
| 5648 | 350 |
Goal "[| ALL m:(greaterThan l). F : LeadsTo (A Int f-``{m}) \
|
| 5584 | 351 |
\ ((A Int f-``(lessThan m)) Un B) |] \ |
| 5648 | 352 |
\ ==> F : LeadsTo A ((A Int (f-``(atMost l))) Un B)"; |
| 4776 | 353 |
by (simp_tac (HOL_ss addsimps [Diff_eq RS sym, vimage_Compl, Compl_greaterThan RS sym]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
354 |
by (rtac (wf_less_than RS Bounded_induct) 1); |
| 4776 | 355 |
by (Asm_simp_tac 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
356 |
qed "LessThan_bounded_induct"; |
| 4776 | 357 |
|
| 5648 | 358 |
Goal "[| ALL m:(lessThan l). F : LeadsTo (A Int f-``{m}) \
|
| 5584 | 359 |
\ ((A Int f-``(greaterThan m)) Un B) |] \ |
| 5648 | 360 |
\ ==> F : LeadsTo A ((A Int (f-``(atLeast l))) Un B)"; |
| 4776 | 361 |
by (res_inst_tac [("f","f"),("f1", "%k. l - k")]
|
362 |
(wf_less_than RS wf_inv_image RS LeadsTo_wf_induct) 1); |
|
363 |
by (simp_tac (simpset() addsimps [inv_image_def, Image_singleton]) 1); |
|
364 |
by (Clarify_tac 1); |
|
365 |
by (case_tac "m<l" 1); |
|
366 |
by (blast_tac (claset() addIs [not_leE, subset_imp_LeadsTo]) 2); |
|
367 |
by (blast_tac (claset() addIs [LeadsTo_weaken_R, diff_less_mono2]) 1); |
|
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
368 |
qed "GreaterThan_bounded_induct"; |
| 4776 | 369 |
|
370 |
||
371 |
(*** Completion: Binary and General Finite versions ***) |
|
372 |
||
| 5648 | 373 |
Goal "[| F : LeadsTo A A'; F : Stable A'; \ |
374 |
\ F : LeadsTo B B'; F : Stable B' |] \ |
|
375 |
\ ==> F : LeadsTo (A Int B) (A' Int B')"; |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
376 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
377 |
by (blast_tac (claset() addIs [stable_completion, leadsTo_weaken]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
378 |
qed "Stable_completion"; |
| 4776 | 379 |
|
380 |
||
| 5584 | 381 |
Goal "finite I \ |
| 5648 | 382 |
\ ==> (ALL i:I. F : LeadsTo (A i) (A' i)) --> \ |
383 |
\ (ALL i:I. F : Stable (A' i)) --> \ |
|
384 |
\ F : LeadsTo (INT i:I. A i) (INT i:I. A' i)"; |
|
| 4776 | 385 |
by (etac finite_induct 1); |
386 |
by (Asm_simp_tac 1); |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
387 |
by (asm_simp_tac (simpset() addsimps [Stable_completion, ball_Stable_INT]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
388 |
qed_spec_mp "Finite_stable_completion"; |
| 4776 | 389 |
|
390 |
||
| 5648 | 391 |
Goal "[| F : LeadsTo A (A' Un C); F : Constrains A' (A' Un C); \ |
392 |
\ F : LeadsTo B (B' Un C); F : Constrains B' (B' Un C) |] \ |
|
393 |
\ ==> F : LeadsTo (A Int B) ((A' Int B') Un C)"; |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
394 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_def, |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
395 |
Int_Un_distrib]) 1); |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
396 |
by (blast_tac (claset() addIs [completion, leadsTo_weaken]) 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
397 |
qed "Completion"; |
| 4776 | 398 |
|
399 |
||
| 5584 | 400 |
Goal "[| finite I |] \ |
| 5648 | 401 |
\ ==> (ALL i:I. F : LeadsTo (A i) (A' i Un C)) --> \ |
402 |
\ (ALL i:I. F : Constrains (A' i) (A' i Un C)) --> \ |
|
403 |
\ F : LeadsTo (INT i:I. A i) ((INT i:I. A' i) Un C)"; |
|
| 4776 | 404 |
by (etac finite_induct 1); |
405 |
by (ALLGOALS Asm_simp_tac); |
|
406 |
by (Clarify_tac 1); |
|
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
407 |
by (dtac ball_Constrains_INT 1); |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
408 |
by (asm_full_simp_tac (simpset() addsimps [Completion]) 1); |
|
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5257
diff
changeset
|
409 |
qed "Finite_completion"; |
| 5232 | 410 |
|
411 |
||
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
412 |
(*proves "ensures/leadsTo" properties when the program is specified*) |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5422
diff
changeset
|
413 |
fun ensures_tac sact = |
|
5240
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
414 |
SELECT_GOAL |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
415 |
(EVERY [REPEAT (Invariant_Int_tac 1), |
|
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
416 |
etac Invariant_LeadsTo_Basis 1 |
|
5240
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
417 |
ORELSE (*subgoal may involve LeadsTo, leadsTo or ensures*) |
|
5313
1861a564d7e2
Constrains, Stable, Invariant...more of the substitution axiom, but Union
paulson
parents:
5277
diff
changeset
|
418 |
REPEAT (ares_tac [LeadsTo_Basis, ensuresI] 1), |
| 5648 | 419 |
(*now there are two subgoals: constrains & transient*) |
420 |
simp_tac (simpset() addsimps !program_defs_ref) 2, |
|
|
5240
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
421 |
res_inst_tac [("act", sact)] transient_mem 2,
|
| 5340 | 422 |
(*simplify the command's domain*) |
|
5426
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5422
diff
changeset
|
423 |
simp_tac (simpset() addsimps [Domain_def]) 3, |
|
566f47250bd0
A new approach, using simp_of_act and simp_of_set to activate definitions when
paulson
parents:
5422
diff
changeset
|
424 |
constrains_tac 1, |
|
5240
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
425 |
ALLGOALS Clarify_tac, |
| 5422 | 426 |
ALLGOALS Asm_full_simp_tac]); |
|
5240
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
427 |
|
|
bbcd79ef7cf2
Constant "invariant" and new constrains_tac, ensures_tac
paulson
parents:
5232
diff
changeset
|
428 |