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