author | obua |
Sun, 09 May 2004 23:04:36 +0200 | |
changeset 14722 | 8e739a6eaf11 |
parent 14092 | 68da54626309 |
permissions | -rw-r--r-- |
11479 | 1 |
(* Title: ZF/UNITY/SubstAx.ML |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
2 |
ID: $Id \\<in> SubstAx.ML,v 1.8 2003/05/27 09:39:06 paulson Exp $ |
11479 | 3 |
Author: Sidi O Ehmety, Computer Laboratory |
4 |
Copyright 2001 University of Cambridge |
|
5 |
||
6 |
LeadsTo relation, restricted to the set of reachable states. |
|
7 |
||
8 |
*) |
|
9 |
||
10 |
||
11 |
(*Resembles the previous definition of LeadsTo*) |
|
12 |
||
12195 | 13 |
(* Equivalence with the HOL-like definition *) |
11479 | 14 |
Goalw [LeadsTo_def] |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
15 |
"st_set(B)==> A LeadsTo B = {F \\<in> program. F:(reachable(F) Int A) leadsTo B}"; |
12195 | 16 |
by (blast_tac (claset() addDs [psp_stable2, leadsToD2, constrainsD2] |
11479 | 17 |
addIs [leadsTo_weaken]) 1); |
12195 | 18 |
qed "LeadsTo_eq"; |
11479 | 19 |
|
12195 | 20 |
Goalw [LeadsTo_def] "A LeadsTo B <=program"; |
21 |
by Auto_tac; |
|
22 |
qed "LeadsTo_type"; |
|
11479 | 23 |
|
24 |
(*** Specialized laws for handling invariants ***) |
|
25 |
||
26 |
(** Conjoining an Always property **) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
27 |
Goal "F \\<in> Always(I) ==> (F:(I Int A) LeadsTo A') <-> (F \\<in> A LeadsTo A')"; |
11479 | 28 |
by (asm_full_simp_tac |
29 |
(simpset() addsimps [LeadsTo_def, Always_eq_includes_reachable, |
|
12195 | 30 |
Int_absorb2, Int_assoc RS sym, leadsToD2]) 1); |
11479 | 31 |
qed "Always_LeadsTo_pre"; |
32 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
33 |
Goalw [LeadsTo_def] "F \\<in> Always(I) ==> (F \\<in> A LeadsTo (I Int A')) <-> (F \\<in> A LeadsTo A')"; |
12195 | 34 |
by (asm_full_simp_tac (simpset() addsimps [Always_eq_includes_reachable, |
35 |
Int_absorb2, Int_assoc RS sym,leadsToD2]) 1); |
|
11479 | 36 |
qed "Always_LeadsTo_post"; |
37 |
||
38 |
(* Like 'Always_LeadsTo_pre RS iffD1', but with premises in the good order *) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
39 |
Goal "[| F \\<in> Always(C); F \\<in> (C Int A) LeadsTo A' |] ==> F \\<in> A LeadsTo A'"; |
11479 | 40 |
by (blast_tac (claset() addIs [Always_LeadsTo_pre RS iffD1]) 1); |
41 |
qed "Always_LeadsToI"; |
|
42 |
||
43 |
(* Like 'Always_LeadsTo_post RS iffD2', but with premises in the good order *) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
44 |
Goal "[| F \\<in> Always(C); F \\<in> A LeadsTo A' |] ==> F \\<in> A LeadsTo (C Int A')"; |
11479 | 45 |
by (blast_tac (claset() addIs [Always_LeadsTo_post RS iffD2]) 1); |
46 |
qed "Always_LeadsToD"; |
|
47 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
48 |
(*** Introduction rules \\<in> Basis, Trans, Union ***) |
11479 | 49 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
50 |
Goal "F \\<in> A Ensures B ==> F \\<in> A LeadsTo B"; |
12195 | 51 |
by (auto_tac (claset(), simpset() addsimps |
52 |
[Ensures_def, LeadsTo_def])); |
|
53 |
qed "LeadsTo_Basis"; |
|
11479 | 54 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
55 |
Goal "[| F \\<in> A LeadsTo B; F \\<in> B LeadsTo C |] ==> F \\<in> A LeadsTo C"; |
12195 | 56 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
11479 | 57 |
by (blast_tac (claset() addIs [leadsTo_Trans]) 1); |
58 |
qed "LeadsTo_Trans"; |
|
59 |
||
12195 | 60 |
val [major, program] = Goalw [LeadsTo_def] |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
61 |
"[|(!!A. A \\<in> S ==> F \\<in> A LeadsTo B); F \\<in> program|]==>F \\<in> Union(S) LeadsTo B"; |
12195 | 62 |
by (cut_facts_tac [program] 1); |
11479 | 63 |
by Auto_tac; |
64 |
by (stac Int_Union_Union2 1); |
|
12195 | 65 |
by (rtac leadsTo_UN 1); |
66 |
by (dtac major 1); |
|
67 |
by Auto_tac; |
|
68 |
qed "LeadsTo_Union"; |
|
11479 | 69 |
|
70 |
(*** Derived rules ***) |
|
71 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
72 |
Goal "F \\<in> A leadsTo B ==> F \\<in> A LeadsTo B"; |
12484 | 73 |
by (ftac leadsToD2 1); |
12195 | 74 |
by (Clarify_tac 1); |
75 |
by (asm_simp_tac (simpset() addsimps [LeadsTo_eq]) 1); |
|
76 |
by (blast_tac (claset() addIs [leadsTo_weaken_L]) 1); |
|
77 |
qed "leadsTo_imp_LeadsTo"; |
|
11479 | 78 |
|
79 |
(*Useful with cancellation, disjunction*) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
80 |
Goal "F \\<in> A LeadsTo (A' Un A') ==> F \\<in> A LeadsTo A'"; |
11479 | 81 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
82 |
qed "LeadsTo_Un_duplicate"; |
|
83 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
84 |
Goal "F \\<in> A LeadsTo (A' Un C Un C) ==> F \\<in> A LeadsTo (A' Un C)"; |
11479 | 85 |
by (asm_full_simp_tac (simpset() addsimps Un_ac) 1); |
86 |
qed "LeadsTo_Un_duplicate2"; |
|
87 |
||
12195 | 88 |
val [major, program] = Goalw [LeadsTo_def] |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
89 |
"[|(!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo B); F \\<in> program|]==>F:(\\<Union>i \\<in> I. A(i)) LeadsTo B"; |
12195 | 90 |
by (cut_facts_tac [program] 1); |
12215
55c084921240
Modified to make the files build with the new changes in ZF
ehmety
parents:
12195
diff
changeset
|
91 |
by (asm_simp_tac (simpset() delsimps UN_simps addsimps [Int_UN_distrib]) 1); |
12195 | 92 |
by (rtac leadsTo_UN 1); |
93 |
by (dtac major 1); |
|
94 |
by Auto_tac; |
|
95 |
qed "LeadsTo_UN"; |
|
11479 | 96 |
|
97 |
(*Binary union introduction rule*) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
98 |
Goal "[| F \\<in> A LeadsTo C; F \\<in> B LeadsTo C |] ==> F \\<in> (A Un B) LeadsTo C"; |
11479 | 99 |
by (stac Un_eq_Union 1); |
12195 | 100 |
by (rtac LeadsTo_Union 1); |
101 |
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD], simpset())); |
|
11479 | 102 |
qed "LeadsTo_Un"; |
103 |
||
104 |
(*Lets us look at the starting state*) |
|
12195 | 105 |
val [major, program] = Goal |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
106 |
"[|(!!s. s \\<in> A ==> F:{s} LeadsTo B); F \\<in> program|]==>F \\<in> A LeadsTo B"; |
12195 | 107 |
by (cut_facts_tac [program] 1); |
11479 | 108 |
by (stac (UN_singleton RS sym) 1 THEN rtac LeadsTo_UN 1); |
12484 | 109 |
by (ftac major 1); |
12195 | 110 |
by Auto_tac; |
111 |
qed "single_LeadsTo_I"; |
|
11479 | 112 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
113 |
Goal "[| A <= B; F \\<in> program |] ==> F \\<in> A LeadsTo B"; |
12195 | 114 |
by (asm_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
11479 | 115 |
by (blast_tac (claset() addIs [subset_imp_leadsTo]) 1); |
116 |
qed "subset_imp_LeadsTo"; |
|
117 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
118 |
Goal "F:0 LeadsTo A <-> F \\<in> program"; |
12195 | 119 |
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD] |
120 |
addIs [empty_subsetI RS subset_imp_LeadsTo], simpset())); |
|
121 |
qed "empty_LeadsTo"; |
|
122 |
AddIffs [empty_LeadsTo]; |
|
11479 | 123 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
124 |
Goal "F \\<in> A LeadsTo state <-> F \\<in> program"; |
12195 | 125 |
by (auto_tac (claset() addDs [LeadsTo_type RS subsetD], |
126 |
simpset() addsimps [LeadsTo_eq])); |
|
127 |
qed "LeadsTo_state"; |
|
128 |
AddIffs [LeadsTo_state]; |
|
129 |
||
130 |
Goalw [LeadsTo_def] |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
131 |
"[| F \\<in> A LeadsTo A'; A'<=B'|] ==> F \\<in> A LeadsTo B'"; |
12195 | 132 |
by (auto_tac (claset() addIs[leadsTo_weaken_R], simpset())); |
11479 | 133 |
qed_spec_mp "LeadsTo_weaken_R"; |
134 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
135 |
Goalw [LeadsTo_def] "[| F \\<in> A LeadsTo A'; B <= A |] ==> F \\<in> B LeadsTo A'"; |
12195 | 136 |
by (auto_tac (claset() addIs[leadsTo_weaken_L], simpset())); |
11479 | 137 |
qed_spec_mp "LeadsTo_weaken_L"; |
138 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
139 |
Goal "[| F \\<in> A LeadsTo A'; B<=A; A'<=B' |] ==> F \\<in> B LeadsTo B'"; |
11479 | 140 |
by (blast_tac (claset() addIs [LeadsTo_weaken_R, |
141 |
LeadsTo_weaken_L, LeadsTo_Trans]) 1); |
|
142 |
qed "LeadsTo_weaken"; |
|
143 |
||
12195 | 144 |
Goal |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
145 |
"[| F \\<in> Always(C); F \\<in> A LeadsTo A'; C Int B <= A; C Int A' <= B' |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
146 |
\ ==> F \\<in> B LeadsTo B'"; |
12195 | 147 |
by (blast_tac (claset() addDs [Always_LeadsToI] |
148 |
addIs [LeadsTo_weaken, Always_LeadsToD]) 1); |
|
11479 | 149 |
qed "Always_LeadsTo_weaken"; |
150 |
||
151 |
(** Two theorems for "proof lattices" **) |
|
152 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
153 |
Goal "F \\<in> A LeadsTo B ==> F:(A Un B) LeadsTo B"; |
12195 | 154 |
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD] |
155 |
addIs [LeadsTo_Un, subset_imp_LeadsTo]) 1); |
|
11479 | 156 |
qed "LeadsTo_Un_post"; |
157 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
158 |
Goal "[| F \\<in> A LeadsTo B; F \\<in> B LeadsTo C |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
159 |
\ ==> F \\<in> (A Un B) LeadsTo C"; |
11479 | 160 |
by (blast_tac (claset() addIs [LeadsTo_Un, subset_imp_LeadsTo, |
161 |
LeadsTo_weaken_L, LeadsTo_Trans] |
|
12195 | 162 |
addDs [LeadsTo_type RS subsetD]) 1); |
11479 | 163 |
qed "LeadsTo_Trans_Un"; |
164 |
||
165 |
(** Distributive laws **) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
166 |
Goal "(F \\<in> (A Un B) LeadsTo C) <-> (F \\<in> A LeadsTo C & F \\<in> B LeadsTo C)"; |
11479 | 167 |
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken_L]) 1); |
168 |
qed "LeadsTo_Un_distrib"; |
|
169 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
170 |
Goal "(F \\<in> (\\<Union>i \\<in> I. A(i)) LeadsTo B) <-> (\\<forall>i \\<in> I. F \\<in> A(i) LeadsTo B) & F \\<in> program"; |
12195 | 171 |
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD] |
172 |
addIs [LeadsTo_UN, LeadsTo_weaken_L]) 1); |
|
11479 | 173 |
qed "LeadsTo_UN_distrib"; |
174 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
175 |
Goal "(F \\<in> Union(S) LeadsTo B) <-> (\\<forall>A \\<in> S. F \\<in> A LeadsTo B) & F \\<in> program"; |
12195 | 176 |
by (blast_tac (claset() addDs [LeadsTo_type RS subsetD] |
177 |
addIs [LeadsTo_Union, LeadsTo_weaken_L]) 1); |
|
11479 | 178 |
qed "LeadsTo_Union_distrib"; |
179 |
||
12195 | 180 |
(** More rules using the premise "Always(I)" **) |
11479 | 181 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
182 |
Goal "[| F:(A-B) Co (A Un B); F \\<in> transient (A-B) |] ==> F \\<in> A Ensures B"; |
11479 | 183 |
by (asm_full_simp_tac |
184 |
(simpset() addsimps [Ensures_def, Constrains_eq_constrains]) 1); |
|
185 |
by (blast_tac (claset() addIs [ensuresI, constrains_weaken, |
|
186 |
transient_strengthen] |
|
187 |
addDs [constrainsD2]) 1); |
|
188 |
qed "EnsuresI"; |
|
189 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
190 |
Goal "[| F \\<in> Always(I); F \\<in> (I Int (A-A')) Co (A Un A'); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
191 |
\ F \\<in> transient (I Int (A-A')) |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
192 |
\ ==> F \\<in> A LeadsTo A'"; |
11479 | 193 |
by (rtac Always_LeadsToI 1); |
194 |
by (assume_tac 1); |
|
195 |
by (blast_tac (claset() addIs [EnsuresI, LeadsTo_Basis, |
|
196 |
Always_ConstrainsD RS Constrains_weaken, |
|
12195 | 197 |
transient_strengthen]) 1); |
11479 | 198 |
qed "Always_LeadsTo_Basis"; |
199 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
200 |
(*Set difference \\<in> maybe combine with leadsTo_weaken_L?? |
11479 | 201 |
This is the most useful form of the "disjunction" rule*) |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
202 |
Goal "[| F \\<in> (A-B) LeadsTo C; F \\<in> (A Int B) LeadsTo C |] ==> F \\<in> A LeadsTo C"; |
12195 | 203 |
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken]) 1); |
11479 | 204 |
qed "LeadsTo_Diff"; |
205 |
||
12195 | 206 |
val [major, minor] = Goal |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
207 |
"[|(!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo A'(i)); F \\<in> program |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
208 |
\ ==> F \\<in> (\\<Union>i \\<in> I. A(i)) LeadsTo (\\<Union>i \\<in> I. A'(i))"; |
12195 | 209 |
by (cut_facts_tac [minor] 1); |
11479 | 210 |
by (rtac LeadsTo_Union 1); |
211 |
by (ALLGOALS(Clarify_tac)); |
|
12484 | 212 |
by (ftac major 1); |
12195 | 213 |
by (blast_tac (claset() addIs [LeadsTo_weaken_R]) 1); |
214 |
qed "LeadsTo_UN_UN"; |
|
11479 | 215 |
|
216 |
(*Binary union version*) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
217 |
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B LeadsTo B' |] ==> F:(A Un B) LeadsTo (A' Un B')"; |
12195 | 218 |
by (blast_tac (claset() addIs [LeadsTo_Un, LeadsTo_weaken_R]) 1); |
11479 | 219 |
qed "LeadsTo_Un_Un"; |
220 |
||
221 |
(** The cancellation law **) |
|
222 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
223 |
Goal "[| F \\<in> A LeadsTo(A' Un B); F \\<in> B LeadsTo B' |] ==> F \\<in> A LeadsTo (A' Un B')"; |
12195 | 224 |
by (blast_tac (claset() addIs [LeadsTo_Un_Un, subset_imp_LeadsTo, LeadsTo_Trans] |
225 |
addDs [LeadsTo_type RS subsetD]) 1); |
|
11479 | 226 |
qed "LeadsTo_cancel2"; |
227 |
||
228 |
Goal "A Un (B - A) = A Un B"; |
|
229 |
by Auto_tac; |
|
230 |
qed "Un_Diff"; |
|
231 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
232 |
Goal "[| F \\<in> A LeadsTo (A' Un B); F \\<in> (B-A') LeadsTo B' |] ==> F \\<in> A LeadsTo (A' Un B')"; |
11479 | 233 |
by (rtac LeadsTo_cancel2 1); |
234 |
by (assume_tac 2); |
|
235 |
by (asm_simp_tac (simpset() addsimps [Un_Diff]) 1); |
|
236 |
qed "LeadsTo_cancel_Diff2"; |
|
237 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
238 |
Goal "[| F \\<in> A LeadsTo (B Un A'); F \\<in> B LeadsTo B' |] ==> F \\<in> A LeadsTo (B' Un A')"; |
11479 | 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 |
||
243 |
Goal "(B - A) Un A = B Un A"; |
|
244 |
by Auto_tac; |
|
245 |
qed "Diff_Un2"; |
|
246 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
247 |
Goal "[| F \\<in> A LeadsTo (B Un A'); F \\<in> (B-A') LeadsTo B' |] ==> F \\<in> A LeadsTo (B' Un A')"; |
11479 | 248 |
by (rtac LeadsTo_cancel1 1); |
249 |
by (assume_tac 2); |
|
250 |
by (asm_simp_tac (simpset() addsimps [Diff_Un2]) 1); |
|
251 |
qed "LeadsTo_cancel_Diff1"; |
|
252 |
||
253 |
(** The impossibility law **) |
|
254 |
||
255 |
(*The set "A" may be non-empty, but it contains no reachable states*) |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
256 |
Goal "F \\<in> A LeadsTo 0 ==> F \\<in> Always (state -A)"; |
11479 | 257 |
by (full_simp_tac (simpset() |
258 |
addsimps [LeadsTo_def,Always_eq_includes_reachable]) 1); |
|
12195 | 259 |
by (cut_facts_tac [reachable_type] 1); |
260 |
by (auto_tac (claset() addSDs [leadsTo_empty], simpset())); |
|
11479 | 261 |
qed "LeadsTo_empty"; |
262 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
263 |
(** PSP \\<in> Progress-Safety-Progress **) |
11479 | 264 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
265 |
(*Special case of PSP \\<in> Misra's "stable conjunction"*) |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
266 |
Goal "[| F \\<in> A LeadsTo A'; F \\<in> Stable(B) |]==> F:(A Int B) LeadsTo (A' Int B)"; |
12195 | 267 |
by (asm_full_simp_tac (simpset() addsimps [LeadsTo_def, Stable_eq_stable]) 1); |
11479 | 268 |
by (Clarify_tac 1); |
269 |
by (dtac psp_stable 1); |
|
12195 | 270 |
by (REPEAT(asm_full_simp_tac (simpset() addsimps (Int_absorb::Int_ac)) 1)); |
11479 | 271 |
qed "PSP_Stable"; |
272 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
273 |
Goal "[| F \\<in> A LeadsTo A'; F \\<in> Stable(B) |] ==> F \\<in> (B Int A) LeadsTo (B Int A')"; |
11479 | 274 |
by (asm_simp_tac (simpset() addsimps PSP_Stable::Int_ac) 1); |
275 |
qed "PSP_Stable2"; |
|
276 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
277 |
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B Co B'|]==> F \\<in> (A Int B') LeadsTo ((A' Int B) Un (B' - B))"; |
12195 | 278 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def, Constrains_eq_constrains]) 1); |
11479 | 279 |
by (blast_tac (claset() addDs [psp] addIs [leadsTo_weaken]) 1); |
280 |
qed "PSP"; |
|
281 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
282 |
Goal "[| F \\<in> A LeadsTo A'; F \\<in> B Co B' |]==> F:(B' Int A) LeadsTo ((B Int A') Un (B' - B))"; |
11479 | 283 |
by (asm_simp_tac (simpset() addsimps PSP::Int_ac) 1); |
284 |
qed "PSP2"; |
|
285 |
||
286 |
Goal |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
287 |
"[| F \\<in> A LeadsTo A'; F \\<in> B Unless B'|]==> F:(A Int B) LeadsTo ((A' Int B) Un B')"; |
12484 | 288 |
by (rewtac Unless_def); |
11479 | 289 |
by (dtac PSP 1); |
290 |
by (assume_tac 1); |
|
12195 | 291 |
by (blast_tac (claset() addIs [LeadsTo_Diff, LeadsTo_weaken, subset_imp_LeadsTo]) 1); |
11479 | 292 |
qed "PSP_Unless"; |
293 |
||
294 |
(*** Induction rules ***) |
|
295 |
||
296 |
(** Meta or object quantifier ????? **) |
|
297 |
Goal "[| wf(r); \ |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
298 |
\ \\<forall>m \\<in> I. F \\<in> (A Int f-``{m}) LeadsTo \ |
11479 | 299 |
\ ((A Int f-``(converse(r) `` {m})) Un B); \ |
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
300 |
\ field(r)<=I; A<=f-``I; F \\<in> program |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
301 |
\ ==> F \\<in> A LeadsTo B"; |
12195 | 302 |
by (full_simp_tac (simpset() addsimps [LeadsTo_def]) 1); |
12825 | 303 |
by Auto_tac; |
11479 | 304 |
by (eres_inst_tac [("I", "I"), ("f", "f")] leadsTo_wf_induct 1); |
305 |
by (ALLGOALS(Clarify_tac)); |
|
12195 | 306 |
by (dres_inst_tac [("x", "m")] bspec 2); |
11479 | 307 |
by Safe_tac; |
12825 | 308 |
by (res_inst_tac [("A'", |
309 |
"reachable(F) Int (A Int f -``(converse(r)``{m}) Un B)")] |
|
310 |
leadsTo_weaken_R 2); |
|
12195 | 311 |
by (asm_simp_tac (simpset() addsimps [Int_assoc]) 2); |
312 |
by (asm_simp_tac (simpset() addsimps [Int_assoc]) 3); |
|
11479 | 313 |
by (REPEAT(Blast_tac 1)); |
314 |
qed "LeadsTo_wf_induct"; |
|
315 |
||
316 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
317 |
Goal "[| \\<forall>m \\<in> nat. F:(A Int f-``{m}) LeadsTo ((A Int f-``m) Un B); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
318 |
\ A<=f-``nat; F \\<in> program |] ==> F \\<in> A LeadsTo B"; |
14046 | 319 |
by (res_inst_tac [("A1", "nat"),("f1", "%x. x")] |
320 |
(wf_measure RS LeadsTo_wf_induct) 1); |
|
11479 | 321 |
by (ALLGOALS(asm_full_simp_tac |
14046 | 322 |
(simpset() addsimps [nat_measure_field]))); |
323 |
by (asm_simp_tac (simpset() addsimps [ltI, Image_inverse_lessThan, symmetric vimage_def]) 1); |
|
11479 | 324 |
qed "LessThan_induct"; |
325 |
||
326 |
||
327 |
(****** |
|
328 |
To be ported ??? I am not sure. |
|
329 |
||
330 |
integ_0_le_induct |
|
331 |
LessThan_bounded_induct |
|
332 |
GreaterThan_bounded_induct |
|
333 |
||
334 |
*****) |
|
335 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
336 |
(*** Completion \\<in> Binary and General Finite versions ***) |
11479 | 337 |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
338 |
Goal "[| F \\<in> A LeadsTo (A' Un C); F \\<in> A' Co (A' Un C); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
339 |
\ F \\<in> B LeadsTo (B' Un C); F \\<in> B' Co (B' Un C) |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
340 |
\ ==> F \\<in> (A Int B) LeadsTo ((A' Int B') Un C)"; |
11479 | 341 |
by (full_simp_tac |
12195 | 342 |
(simpset() addsimps [LeadsTo_def, Constrains_eq_constrains, |
12215
55c084921240
Modified to make the files build with the new changes in ZF
ehmety
parents:
12195
diff
changeset
|
343 |
Int_Un_distrib]) 1); |
11479 | 344 |
by Safe_tac; |
345 |
by (REPEAT(Blast_tac 2)); |
|
346 |
by (blast_tac (claset() addIs [completion, leadsTo_weaken]) 1); |
|
347 |
qed "Completion"; |
|
348 |
||
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
349 |
Goal "[| I \\<in> Fin(X);F \\<in> program |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
350 |
\ ==> (\\<forall>i \\<in> I. F \\<in> (A(i)) LeadsTo (A'(i) Un C)) --> \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
351 |
\ (\\<forall>i \\<in> I. F \\<in> (A'(i)) Co (A'(i) Un C)) --> \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
352 |
\ F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo ((\\<Inter>i \\<in> I. A'(i)) Un C)"; |
11479 | 353 |
by (etac Fin_induct 1); |
12220 | 354 |
by (auto_tac (claset(), simpset() delsimps INT_simps |
355 |
addsimps [Inter_0])); |
|
11479 | 356 |
by (rtac Completion 1); |
12220 | 357 |
by (asm_simp_tac (simpset() delsimps INT_simps addsimps INT_extend_simps) 4); |
11479 | 358 |
by (rtac Constrains_INT 4); |
359 |
by (REPEAT(Blast_tac 1)); |
|
360 |
val lemma = result(); |
|
361 |
||
362 |
val prems = Goal |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
363 |
"[| I \\<in> Fin(X); !!i. i \\<in> I ==> F \\<in> A(i) LeadsTo (A'(i) Un C); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
364 |
\ !!i. i \\<in> I ==> F \\<in> A'(i) Co (A'(i) Un C); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
365 |
\ F \\<in> program |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
366 |
\ ==> F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo ((\\<Inter>i \\<in> I. A'(i)) Un C)"; |
11479 | 367 |
by (blast_tac (claset() addIs (lemma RS mp RS mp)::prems) 1); |
368 |
qed "Finite_completion"; |
|
369 |
||
370 |
Goalw [Stable_def] |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
371 |
"[| F \\<in> A LeadsTo A'; F \\<in> Stable(A'); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
372 |
\ F \\<in> B LeadsTo B'; F \\<in> Stable(B') |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
373 |
\ ==> F \\<in> (A Int B) LeadsTo (A' Int B')"; |
11479 | 374 |
by (res_inst_tac [("C1", "0")] (Completion RS LeadsTo_weaken_R) 1); |
12195 | 375 |
by (Asm_full_simp_tac 5); |
376 |
by (rtac subset_refl 5); |
|
377 |
by Auto_tac; |
|
11479 | 378 |
qed "Stable_completion"; |
379 |
||
380 |
val prems = Goalw [Stable_def] |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
381 |
"[| I \\<in> Fin(X); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
382 |
\ (!!i. i \\<in> I ==> F \\<in> A(i) LeadsTo A'(i)); \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
383 |
\ (!!i. i \\<in> I ==>F \\<in> Stable(A'(i))); F \\<in> program |] \ |
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
384 |
\ ==> F \\<in> (\\<Inter>i \\<in> I. A(i)) LeadsTo (\\<Inter>i \\<in> I. A'(i))"; |
11479 | 385 |
by (res_inst_tac [("C1", "0")] (Finite_completion RS LeadsTo_weaken_R) 1); |
12195 | 386 |
by (ALLGOALS(Simp_tac)); |
387 |
by (rtac subset_refl 5); |
|
388 |
by (REPEAT(blast_tac (claset() addIs prems) 1)); |
|
11479 | 389 |
qed "Finite_stable_completion"; |
390 |
||
391 |
||
392 |
(*proves "ensures/leadsTo" properties when the program is specified*) |
|
393 |
fun ensures_tac sact = |
|
394 |
SELECT_GOAL |
|
395 |
(EVERY [REPEAT (Always_Int_tac 1), |
|
396 |
etac Always_LeadsTo_Basis 1 |
|
397 |
ORELSE (*subgoal may involve LeadsTo, leadsTo or ensures*) |
|
398 |
REPEAT (ares_tac [LeadsTo_Basis, leadsTo_Basis, |
|
399 |
EnsuresI, ensuresI] 1), |
|
14092
68da54626309
Conversion of ZF/UNITY/{FP,Union} to Isar script.
paulson
parents:
14046
diff
changeset
|
400 |
(*now there are two subgoals \\<in> co & transient*) |
11479 | 401 |
simp_tac (simpset() addsimps !program_defs_ref) 2, |
402 |
res_inst_tac [("act", sact)] transientI 2, |
|
403 |
(*simplify the command's domain*) |
|
404 |
simp_tac (simpset() addsimps [domain_def]) 3, |
|
405 |
(* proving the domain part *) |
|
406 |
Clarify_tac 3, dtac swap 3, Force_tac 4, |
|
407 |
rtac ReplaceI 3, Force_tac 3, Force_tac 4, |
|
408 |
Asm_full_simp_tac 3, rtac conjI 3, Simp_tac 4, |
|
14046 | 409 |
REPEAT (rtac state_update_type 3), |
11479 | 410 |
constrains_tac 1, |
411 |
ALLGOALS Clarify_tac, |
|
412 |
ALLGOALS (asm_full_simp_tac |
|
12195 | 413 |
(simpset() addsimps [st_set_def])), |
414 |
ALLGOALS Clarify_tac, |
|
415 |
ALLGOALS (Asm_full_simp_tac)]); |
|
11479 | 416 |