author | paulson |
Fri, 03 Mar 2000 18:26:19 +0100 | |
changeset 8334 | 7896bcbd8641 |
parent 8327 | 108fcc85a767 |
child 8703 | 816d8f6513be |
permissions | -rw-r--r-- |
4776 | 1 |
(* Title: HOL/UNITY/UNITY |
2 |
ID: $Id$ |
|
3 |
Author: Lawrence C Paulson, Cambridge University Computer Laboratory |
|
4 |
Copyright 1998 University of Cambridge |
|
5 |
||
6 |
The basic UNITY theory (revised version, based upon the "co" operator) |
|
7 |
||
8 |
From Misra, "A Logic for Concurrent Programming", 1994 |
|
9 |
*) |
|
10 |
||
11 |
set proof_timing; |
|
12 |
||
8311
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8216
diff
changeset
|
13 |
(*Perhaps equalities.ML shouldn't add this in the first place!*) |
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8216
diff
changeset
|
14 |
Delsimps [image_Collect]; |
6218522253e7
new mostly working version; Alloc nearly converted to "Rename"
paulson
parents:
8216
diff
changeset
|
15 |
|
4776 | 16 |
|
6012
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
17 |
(*** General lemmas ***) |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
18 |
|
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
19 |
Goal "UNIV Times UNIV = UNIV"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
20 |
by Auto_tac; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
21 |
qed "UNIV_Times_UNIV"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
22 |
Addsimps [UNIV_Times_UNIV]; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
23 |
|
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
24 |
Goal "- (UNIV Times A) = UNIV Times (-A)"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
25 |
by Auto_tac; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
26 |
qed "Compl_Times_UNIV1"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
27 |
|
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
28 |
Goal "- (A Times UNIV) = (-A) Times UNIV"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
29 |
by Auto_tac; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
30 |
qed "Compl_Times_UNIV2"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
31 |
|
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
32 |
Addsimps [Compl_Times_UNIV1, Compl_Times_UNIV2]; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
33 |
|
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
34 |
|
6535 | 35 |
(*** The abstract type of programs ***) |
36 |
||
37 |
val rep_ss = simpset() addsimps |
|
38 |
[Init_def, Acts_def, mk_program_def, Program_def, Rep_Program, |
|
39 |
Rep_Program_inverse, Abs_Program_inverse]; |
|
40 |
||
41 |
||
42 |
Goal "Id : Acts F"; |
|
43 |
by (cut_inst_tac [("x", "F")] Rep_Program 1); |
|
44 |
by (auto_tac (claset(), rep_ss)); |
|
45 |
qed "Id_in_Acts"; |
|
46 |
AddIffs [Id_in_Acts]; |
|
47 |
||
48 |
Goal "insert Id (Acts F) = Acts F"; |
|
49 |
by (simp_tac (simpset() addsimps [insert_absorb, Id_in_Acts]) 1); |
|
50 |
qed "insert_Id_Acts"; |
|
51 |
AddIffs [insert_Id_Acts]; |
|
52 |
||
53 |
(** Inspectors for type "program" **) |
|
54 |
||
55 |
Goal "Init (mk_program (init,acts)) = init"; |
|
56 |
by (auto_tac (claset(), rep_ss)); |
|
57 |
qed "Init_eq"; |
|
58 |
||
59 |
Goal "Acts (mk_program (init,acts)) = insert Id acts"; |
|
60 |
by (auto_tac (claset(), rep_ss)); |
|
61 |
qed "Acts_eq"; |
|
62 |
||
63 |
Addsimps [Acts_eq, Init_eq]; |
|
64 |
||
65 |
||
8327 | 66 |
(** Equality for UNITY programs **) |
7915
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
67 |
|
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
68 |
Goal "mk_program (Init F, Acts F) = F"; |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
69 |
by (cut_inst_tac [("x", "F")] Rep_Program 1); |
6535 | 70 |
by (auto_tac (claset(), rep_ss)); |
71 |
by (REPEAT (dres_inst_tac [("f", "Abs_Program")] arg_cong 1)); |
|
7915
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
72 |
by (asm_full_simp_tac (rep_ss addsimps [insert_absorb]) 1); |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
73 |
qed "surjective_mk_program"; |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
74 |
|
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
75 |
Goal "[| Init F = Init G; Acts F = Acts G |] ==> F = G"; |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
76 |
by (stac (surjective_mk_program RS sym) 1); |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
77 |
by (stac (surjective_mk_program RS sym) 1 THEN Force_tac 1); |
6535 | 78 |
qed "program_equalityI"; |
79 |
||
80 |
val [major,minor] = |
|
81 |
Goal "[| F = G; [| Init F = Init G; Acts F = Acts G |] ==> P |] ==> P"; |
|
82 |
by (rtac minor 1); |
|
83 |
by (auto_tac (claset(), simpset() addsimps [major])); |
|
84 |
qed "program_equalityE"; |
|
85 |
||
8327 | 86 |
Goal "(F=G) = (Init F = Init G & Acts F = Acts G)"; |
87 |
by (blast_tac (claset() addIs [program_equalityI, program_equalityE]) 1); |
|
88 |
qed "program_equality_iff"; |
|
89 |
||
7915
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
90 |
Addsimps [surjective_mk_program]; |
c7fd7eb3b0ef
ALMOST working version: LocalTo results commented out
paulson
parents:
7826
diff
changeset
|
91 |
|
6535 | 92 |
|
93 |
(*** These rules allow "lazy" definition expansion |
|
94 |
They avoid expanding the full program, which is a large expression |
|
95 |
***) |
|
96 |
||
97 |
Goal "F == mk_program (init,acts) ==> Init F = init"; |
|
98 |
by Auto_tac; |
|
99 |
qed "def_prg_Init"; |
|
100 |
||
101 |
(*The program is not expanded, but its Init and Acts are*) |
|
102 |
val [rew] = goal thy |
|
103 |
"[| F == mk_program (init,acts) |] \ |
|
104 |
\ ==> Init F = init & Acts F = insert Id acts"; |
|
105 |
by (rewtac rew); |
|
106 |
by Auto_tac; |
|
107 |
qed "def_prg_simps"; |
|
108 |
||
109 |
(*An action is expanded only if a pair of states is being tested against it*) |
|
110 |
Goal "[| act == {(s,s'). P s s'} |] ==> ((s,s') : act) = P s s'"; |
|
111 |
by Auto_tac; |
|
112 |
qed "def_act_simp"; |
|
113 |
||
114 |
fun simp_of_act def = def RS def_act_simp; |
|
115 |
||
116 |
(*A set is expanded only if an element is being tested against it*) |
|
117 |
Goal "A == B ==> (x : A) = (x : B)"; |
|
118 |
by Auto_tac; |
|
119 |
qed "def_set_simp"; |
|
120 |
||
121 |
fun simp_of_set def = def RS def_set_simp; |
|
122 |
||
123 |
||
6536 | 124 |
(*** co ***) |
4776 | 125 |
|
7403 | 126 |
(*These operators are not overloaded, but their operands are sets, and |
127 |
ultimately there's a risk of reaching equality, which IS overloaded*) |
|
128 |
overload_1st_set "UNITY.constrains"; |
|
5648 | 129 |
overload_1st_set "UNITY.stable"; |
130 |
overload_1st_set "UNITY.unless"; |
|
5340 | 131 |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
132 |
val prems = Goalw [constrains_def] |
5648 | 133 |
"(!!act s s'. [| act: Acts F; (s,s') : act; s: A |] ==> s': A') \ |
6536 | 134 |
\ ==> F : A co A'"; |
4776 | 135 |
by (blast_tac (claset() addIs prems) 1); |
136 |
qed "constrainsI"; |
|
137 |
||
5069 | 138 |
Goalw [constrains_def] |
6536 | 139 |
"[| F : A co A'; act: Acts F; (s,s'): act; s: A |] ==> s': A'"; |
4776 | 140 |
by (Blast_tac 1); |
141 |
qed "constrainsD"; |
|
142 |
||
6536 | 143 |
Goalw [constrains_def] "F : {} co B"; |
4776 | 144 |
by (Blast_tac 1); |
145 |
qed "constrains_empty"; |
|
146 |
||
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
147 |
Goalw [constrains_def] "(F : A co {}) = (A={})"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
148 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
149 |
qed "constrains_empty2"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
150 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
151 |
Goalw [constrains_def] "(F : UNIV co B) = (B = UNIV)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
152 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
153 |
qed "constrains_UNIV"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
154 |
|
6536 | 155 |
Goalw [constrains_def] "F : A co UNIV"; |
4776 | 156 |
by (Blast_tac 1); |
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
157 |
qed "constrains_UNIV2"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
158 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
159 |
AddIffs [constrains_empty, constrains_empty2, |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
160 |
constrains_UNIV, constrains_UNIV2]; |
4776 | 161 |
|
5648 | 162 |
(*monotonic in 2nd argument*) |
5069 | 163 |
Goalw [constrains_def] |
6536 | 164 |
"[| F : A co A'; A'<=B' |] ==> F : A co B'"; |
4776 | 165 |
by (Blast_tac 1); |
166 |
qed "constrains_weaken_R"; |
|
167 |
||
5648 | 168 |
(*anti-monotonic in 1st argument*) |
5069 | 169 |
Goalw [constrains_def] |
6536 | 170 |
"[| F : A co A'; B<=A |] ==> F : B co A'"; |
4776 | 171 |
by (Blast_tac 1); |
172 |
qed "constrains_weaken_L"; |
|
173 |
||
5069 | 174 |
Goalw [constrains_def] |
6536 | 175 |
"[| F : A co A'; B<=A; A'<=B' |] ==> F : B co B'"; |
4776 | 176 |
by (Blast_tac 1); |
177 |
qed "constrains_weaken"; |
|
178 |
||
179 |
(** Union **) |
|
180 |
||
5069 | 181 |
Goalw [constrains_def] |
7345 | 182 |
"[| F : A co A'; F : B co B' |] ==> F : (A Un B) co (A' Un B')"; |
4776 | 183 |
by (Blast_tac 1); |
184 |
qed "constrains_Un"; |
|
185 |
||
5069 | 186 |
Goalw [constrains_def] |
7345 | 187 |
"ALL i:I. F : (A i) co (A' i) ==> F : (UN i:I. A i) co (UN i:I. A' i)"; |
4776 | 188 |
by (Blast_tac 1); |
8334
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
189 |
bind_thm ("constrains_UN", ballI RS result()); |
4776 | 190 |
|
7826
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
191 |
Goalw [constrains_def] "(A Un B) co C = (A co C) Int (B co C)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
192 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
193 |
qed "constrains_Un_distrib"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
194 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
195 |
Goalw [constrains_def] "(UN i:I. A i) co B = (INT i:I. A i co B)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
196 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
197 |
qed "constrains_UN_distrib"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
198 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
199 |
Goalw [constrains_def] "C co (A Int B) = (C co A) Int (C co B)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
200 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
201 |
qed "constrains_Int_distrib"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
202 |
|
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
203 |
Goalw [constrains_def] "A co (INT i:I. B i) = (INT i:I. A co B i)"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
204 |
by (Blast_tac 1); |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
205 |
qed "constrains_INT_distrib"; |
c6a8b73b6c2a
working shapshot with "projecting" and "extending"
paulson
parents:
7630
diff
changeset
|
206 |
|
4776 | 207 |
(** Intersection **) |
208 |
||
5069 | 209 |
Goalw [constrains_def] |
7345 | 210 |
"[| F : A co A'; F : B co B' |] ==> F : (A Int B) co (A' Int B')"; |
4776 | 211 |
by (Blast_tac 1); |
212 |
qed "constrains_Int"; |
|
213 |
||
5069 | 214 |
Goalw [constrains_def] |
7345 | 215 |
"ALL i:I. F : (A i) co (A' i) ==> F : (INT i:I. A i) co (INT i:I. A' i)"; |
4776 | 216 |
by (Blast_tac 1); |
8334
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
217 |
bind_thm ("constrains_INT", ballI RS result()); |
4776 | 218 |
|
6536 | 219 |
Goalw [constrains_def] "F : A co A' ==> A <= A'"; |
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
220 |
by Auto_tac; |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
221 |
qed "constrains_imp_subset"; |
4776 | 222 |
|
6536 | 223 |
(*The reasoning is by subsets since "co" refers to single actions |
6012
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
224 |
only. So this rule isn't that useful.*) |
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
225 |
Goalw [constrains_def] |
6536 | 226 |
"[| F : A co B; F : B co C |] ==> F : A co C"; |
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
227 |
by (Blast_tac 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
228 |
qed "constrains_trans"; |
4776 | 229 |
|
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
230 |
Goalw [constrains_def] |
7345 | 231 |
"[| F : A co (A' Un B); F : B co B' |] ==> F : A co (A' Un B')"; |
6295
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
232 |
by (Clarify_tac 1); |
351b3c2b0d83
removed the infernal States, eqStates, compatible, etc.
paulson
parents:
6012
diff
changeset
|
233 |
by (Blast_tac 1); |
6012
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
234 |
qed "constrains_cancel"; |
1894bfc4aee9
Addition of the States component; parts of Comp not working
paulson
parents:
5804
diff
changeset
|
235 |
|
4776 | 236 |
|
7630 | 237 |
(*** unless ***) |
238 |
||
239 |
Goalw [unless_def] "F : (A-B) co (A Un B) ==> F : A unless B"; |
|
240 |
by (assume_tac 1); |
|
241 |
qed "unlessI"; |
|
242 |
||
243 |
Goalw [unless_def] "F : A unless B ==> F : (A-B) co (A Un B)"; |
|
244 |
by (assume_tac 1); |
|
245 |
qed "unlessD"; |
|
246 |
||
247 |
||
4776 | 248 |
(*** stable ***) |
249 |
||
6536 | 250 |
Goalw [stable_def] "F : A co A ==> F : stable A"; |
4776 | 251 |
by (assume_tac 1); |
252 |
qed "stableI"; |
|
253 |
||
6536 | 254 |
Goalw [stable_def] "F : stable A ==> F : A co A"; |
4776 | 255 |
by (assume_tac 1); |
256 |
qed "stableD"; |
|
257 |
||
7594
8a188ef6545e
working version with co-guarantees-leadsto results
paulson
parents:
7403
diff
changeset
|
258 |
Goalw [stable_def, constrains_def] "stable UNIV = UNIV"; |
8a188ef6545e
working version with co-guarantees-leadsto results
paulson
parents:
7403
diff
changeset
|
259 |
by Auto_tac; |
8a188ef6545e
working version with co-guarantees-leadsto results
paulson
parents:
7403
diff
changeset
|
260 |
qed "stable_UNIV"; |
8a188ef6545e
working version with co-guarantees-leadsto results
paulson
parents:
7403
diff
changeset
|
261 |
Addsimps [stable_UNIV]; |
8a188ef6545e
working version with co-guarantees-leadsto results
paulson
parents:
7403
diff
changeset
|
262 |
|
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
263 |
(** Union **) |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
264 |
|
5069 | 265 |
Goalw [stable_def] |
5648 | 266 |
"[| F : stable A; F : stable A' |] ==> F : stable (A Un A')"; |
4776 | 267 |
by (blast_tac (claset() addIs [constrains_Un]) 1); |
268 |
qed "stable_Un"; |
|
269 |
||
5069 | 270 |
Goalw [stable_def] |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
271 |
"ALL i:I. F : stable (A i) ==> F : stable (UN i:I. A i)"; |
8334
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
272 |
by (blast_tac (claset() addIs [constrains_UN]) 1); |
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
273 |
bind_thm ("stable_UN", ballI RS result()); |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
274 |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
275 |
(** Intersection **) |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
276 |
|
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
277 |
Goalw [stable_def] |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
7915
diff
changeset
|
278 |
"[| F : stable A; F : stable A' |] ==> F : stable (A Int A')"; |
4776 | 279 |
by (blast_tac (claset() addIs [constrains_Int]) 1); |
280 |
qed "stable_Int"; |
|
281 |
||
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
282 |
Goalw [stable_def] |
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
283 |
"ALL i:I. F : stable (A i) ==> F : stable (INT i:I. A i)"; |
8334
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
284 |
by (blast_tac (claset() addIs [constrains_INT]) 1); |
7896bcbd8641
Added Tanja's Detects and Reachability theories. Also
paulson
parents:
8327
diff
changeset
|
285 |
bind_thm ("stable_INT", ballI RS result()); |
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
286 |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
287 |
Goalw [stable_def, constrains_def] |
7345 | 288 |
"[| F : stable C; F : A co (C Un A') |] ==> F : (C Un A) co (C Un A')"; |
4776 | 289 |
by (Blast_tac 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
290 |
qed "stable_constrains_Un"; |
4776 | 291 |
|
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
292 |
Goalw [stable_def, constrains_def] |
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
7915
diff
changeset
|
293 |
"[| F : stable C; F : (C Int A) co A' |] ==> F : (C Int A) co (C Int A')"; |
4776 | 294 |
by (Blast_tac 1); |
5277
e4297d03e5d2
A higher-level treatment of LeadsTo, minimizing use of "reachable"
paulson
parents:
5253
diff
changeset
|
295 |
qed "stable_constrains_Int"; |
4776 | 296 |
|
8069
19b9f92ca503
working with weak LeadsTo in guarantees precondition\!
paulson
parents:
7915
diff
changeset
|
297 |
(*[| F : stable C; F : (C Int A) co A |] ==> F : stable (C Int A) *) |
5648 | 298 |
bind_thm ("stable_constrains_stable", stable_constrains_Int RS stableI); |
299 |
||
300 |
||
5804
8e0a4c4fd67b
Revising the Client proof as suggested by Michel Charpentier. New lemmas
paulson
parents:
5669
diff
changeset
|
301 |
(*** invariant ***) |
5648 | 302 |
|
303 |
Goal "[| Init F<=A; F: stable A |] ==> F : invariant A"; |
|
304 |
by (asm_simp_tac (simpset() addsimps [invariant_def]) 1); |
|
305 |
qed "invariantI"; |
|
306 |
||
307 |
(*Could also say "invariant A Int invariant B <= invariant (A Int B)"*) |
|
308 |
Goal "[| F : invariant A; F : invariant B |] ==> F : invariant (A Int B)"; |
|
309 |
by (auto_tac (claset(), simpset() addsimps [invariant_def, stable_Int])); |
|
310 |
qed "invariant_Int"; |
|
311 |
||
312 |
||
313 |
(*** increasing ***) |
|
314 |
||
8216 | 315 |
Goalw [increasing_def] |
316 |
"F : increasing f ==> F : stable {s. z <= f s}"; |
|
317 |
by (Blast_tac 1); |
|
318 |
qed "increasingD"; |
|
319 |
||
5648 | 320 |
Goalw [increasing_def, stable_def, constrains_def] |
6712 | 321 |
"mono g ==> increasing f <= increasing (g o f)"; |
5648 | 322 |
by Auto_tac; |
6712 | 323 |
by (blast_tac (claset() addIs [monoD, order_trans]) 1); |
324 |
qed "mono_increasing_o"; |
|
5648 | 325 |
|
8216 | 326 |
(*Holds by the theorem (Suc m <= n) = (m < n) *) |
5648 | 327 |
Goalw [increasing_def] |
8216 | 328 |
"!!z::nat. F : increasing f ==> F: stable {s. z < f s}"; |
5648 | 329 |
by (simp_tac (simpset() addsimps [Suc_le_eq RS sym]) 1); |
330 |
by (Blast_tac 1); |
|
8216 | 331 |
qed "strict_increasingD"; |
5648 | 332 |
|
333 |
||
334 |
(** The Elimination Theorem. The "free" m has become universally quantified! |
|
335 |
Should the premise be !!m instead of ALL m ? Would make it harder to use |
|
336 |
in forward proof. **) |
|
337 |
||
5069 | 338 |
Goalw [constrains_def] |
6536 | 339 |
"[| ALL m:M. F : {s. s x = m} co (B m) |] \ |
340 |
\ ==> F : {s. s x : M} co (UN m:M. B m)"; |
|
4776 | 341 |
by (Blast_tac 1); |
342 |
qed "elimination"; |
|
343 |
||
344 |
(*As above, but for the trivial case of a one-variable state, in which the |
|
345 |
state is identified with its one variable.*) |
|
5069 | 346 |
Goalw [constrains_def] |
6536 | 347 |
"(ALL m:M. F : {m} co (B m)) ==> F : M co (UN m:M. B m)"; |
4776 | 348 |
by (Blast_tac 1); |
349 |
qed "elimination_sing"; |
|
350 |
||
351 |
||
352 |
||
353 |
(*** Theoretical Results from Section 6 ***) |
|
354 |
||
5069 | 355 |
Goalw [constrains_def, strongest_rhs_def] |
6536 | 356 |
"F : A co (strongest_rhs F A )"; |
4776 | 357 |
by (Blast_tac 1); |
358 |
qed "constrains_strongest_rhs"; |
|
359 |
||
5069 | 360 |
Goalw [constrains_def, strongest_rhs_def] |
6536 | 361 |
"F : A co B ==> strongest_rhs F A <= B"; |
4776 | 362 |
by (Blast_tac 1); |
363 |
qed "strongest_rhs_is_strongest"; |