author | wenzelm |
Tue, 16 Dec 1997 17:58:03 +0100 | |
changeset 4423 | a129b817b58a |
parent 4098 | 71e05eb27fb6 |
child 4473 | 803d1e302af1 |
permissions | -rw-r--r-- |
3071 | 1 |
(* Title: HOLCF/IOA/meta_theory/Automata.ML |
3275 | 2 |
ID: $Id$ |
3071 | 3 |
Author: Olaf Mueller, Tobias Nipkow, Konrad Slind |
4 |
Copyright 1994, 1996 TU Muenchen |
|
5 |
||
6 |
The I/O automata of Lynch and Tuttle. |
|
7 |
*) |
|
8 |
||
9 |
(* Has been removed from HOL-simpset, who knows why? *) |
|
10 |
Addsimps [Let_def]; |
|
11 |
||
12 |
open reachable; |
|
13 |
||
3521 | 14 |
val ioa_projections = [asig_of_def, starts_of_def, trans_of_def,wfair_of_def,sfair_of_def]; |
3071 | 15 |
|
16 |
(* ----------------------------------------------------------------------------------- *) |
|
17 |
||
18 |
section "asig_of, starts_of, trans_of"; |
|
19 |
||
20 |
||
21 |
goal thy |
|
3521 | 22 |
"((asig_of (x,y,z,w,s)) = x) & \ |
23 |
\ ((starts_of (x,y,z,w,s)) = y) & \ |
|
24 |
\ ((trans_of (x,y,z,w,s)) = z) & \ |
|
25 |
\ ((wfair_of (x,y,z,w,s)) = w) & \ |
|
26 |
\ ((sfair_of (x,y,z,w,s)) = s)"; |
|
4098 | 27 |
by (simp_tac (simpset() addsimps ioa_projections) 1); |
3071 | 28 |
qed "ioa_triple_proj"; |
29 |
||
3521 | 30 |
goalw thy [is_trans_of_def,actions_def, is_asig_def] |
31 |
"!!A. [| is_trans_of A; (s1,a,s2):trans_of(A) |] ==> a:act A"; |
|
3071 | 32 |
by (REPEAT(etac conjE 1)); |
33 |
by (EVERY1[etac allE, etac impE, atac]); |
|
34 |
by (Asm_full_simp_tac 1); |
|
35 |
qed "trans_in_actions"; |
|
36 |
||
37 |
goal thy |
|
38 |
"starts_of(A || B) = {p. fst(p):starts_of(A) & snd(p):starts_of(B)}"; |
|
4098 | 39 |
by (simp_tac (simpset() addsimps (par_def::ioa_projections)) 1); |
3071 | 40 |
qed "starts_of_par"; |
41 |
||
3521 | 42 |
goal thy |
43 |
"trans_of(A || B) = {tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) \ |
|
44 |
\ in (a:act A | a:act B) & \ |
|
45 |
\ (if a:act A then \ |
|
46 |
\ (fst(s),a,fst(t)):trans_of(A) \ |
|
47 |
\ else fst(t) = fst(s)) \ |
|
48 |
\ & \ |
|
49 |
\ (if a:act B then \ |
|
50 |
\ (snd(s),a,snd(t)):trans_of(B) \ |
|
51 |
\ else snd(t) = snd(s))}"; |
|
52 |
||
4423 | 53 |
by (simp_tac (simpset() addsimps (par_def::ioa_projections)) 1); |
3521 | 54 |
qed "trans_of_par"; |
55 |
||
3071 | 56 |
|
57 |
(* ----------------------------------------------------------------------------------- *) |
|
58 |
||
59 |
section "actions and par"; |
|
60 |
||
61 |
||
62 |
goal thy |
|
63 |
"actions(asig_comp a b) = actions(a) Un actions(b)"; |
|
4098 | 64 |
by (simp_tac (simpset() addsimps |
3071 | 65 |
([actions_def,asig_comp_def]@asig_projections)) 1); |
66 |
by (fast_tac (set_cs addSIs [equalityI]) 1); |
|
67 |
qed "actions_asig_comp"; |
|
68 |
||
69 |
||
70 |
goal thy "asig_of(A || B) = asig_comp (asig_of A) (asig_of B)"; |
|
4098 | 71 |
by (simp_tac (simpset() addsimps (par_def::ioa_projections)) 1); |
3071 | 72 |
qed "asig_of_par"; |
73 |
||
74 |
||
75 |
goal thy "ext (A1||A2) = \ |
|
76 |
\ (ext A1) Un (ext A2)"; |
|
4098 | 77 |
by (asm_full_simp_tac (simpset() addsimps [externals_def,asig_of_par,asig_comp_def, |
3071 | 78 |
asig_inputs_def,asig_outputs_def,Un_def,set_diff_def]) 1); |
79 |
by (rtac set_ext 1); |
|
80 |
by (fast_tac set_cs 1); |
|
81 |
qed"externals_of_par"; |
|
82 |
||
83 |
goal thy "act (A1||A2) = \ |
|
84 |
\ (act A1) Un (act A2)"; |
|
4098 | 85 |
by (asm_full_simp_tac (simpset() addsimps [actions_def,asig_of_par,asig_comp_def, |
3071 | 86 |
asig_inputs_def,asig_outputs_def,asig_internals_def,Un_def,set_diff_def]) 1); |
87 |
by (rtac set_ext 1); |
|
88 |
by (fast_tac set_cs 1); |
|
89 |
qed"actions_of_par"; |
|
90 |
||
91 |
goal thy "inp (A1||A2) =\ |
|
92 |
\ ((inp A1) Un (inp A2)) - ((out A1) Un (out A2))"; |
|
4098 | 93 |
by (asm_full_simp_tac (simpset() addsimps [actions_def,asig_of_par,asig_comp_def, |
3071 | 94 |
asig_inputs_def,asig_outputs_def,Un_def,set_diff_def]) 1); |
95 |
qed"inputs_of_par"; |
|
96 |
||
97 |
goal thy "out (A1||A2) =\ |
|
98 |
\ (out A1) Un (out A2)"; |
|
4098 | 99 |
by (asm_full_simp_tac (simpset() addsimps [actions_def,asig_of_par,asig_comp_def, |
3071 | 100 |
asig_outputs_def,Un_def,set_diff_def]) 1); |
101 |
qed"outputs_of_par"; |
|
102 |
||
3656 | 103 |
goal thy "int (A1||A2) =\ |
104 |
\ (int A1) Un (int A2)"; |
|
4098 | 105 |
by (asm_full_simp_tac (simpset() addsimps [actions_def,asig_of_par,asig_comp_def, |
3656 | 106 |
asig_inputs_def,asig_outputs_def,asig_internals_def,Un_def,set_diff_def]) 1); |
107 |
qed"internals_of_par"; |
|
3071 | 108 |
|
109 |
(* ---------------------------------------------------------------------------------- *) |
|
110 |
||
111 |
section "actions and compatibility"; |
|
112 |
||
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
113 |
goal thy"compatible A B = compatible B A"; |
4098 | 114 |
by (asm_full_simp_tac (simpset() addsimps [compatible_def,Int_commute]) 1); |
3457 | 115 |
by (Auto_tac()); |
3071 | 116 |
qed"compat_commute"; |
117 |
||
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
118 |
goalw thy [externals_def,actions_def,compatible_def] |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
119 |
"!! a. [| compatible A1 A2; a:ext A1|] ==> a~:int A2"; |
3071 | 120 |
by (Asm_full_simp_tac 1); |
121 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
122 |
qed"ext1_is_not_int2"; |
|
123 |
||
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
124 |
(* just commuting the previous one: better commute compatible *) |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
125 |
goalw thy [externals_def,actions_def,compatible_def] |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
126 |
"!! a. [| compatible A2 A1 ; a:ext A1|] ==> a~:int A2"; |
3071 | 127 |
by (Asm_full_simp_tac 1); |
128 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
129 |
qed"ext2_is_not_int1"; |
|
130 |
||
131 |
bind_thm("ext1_ext2_is_not_act2",ext1_is_not_int2 RS int_and_ext_is_act); |
|
132 |
bind_thm("ext1_ext2_is_not_act1",ext2_is_not_int1 RS int_and_ext_is_act); |
|
133 |
||
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
134 |
goalw thy [externals_def,actions_def,compatible_def] |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
135 |
"!! x. [| compatible A B; x:int A |] ==> x~:ext B"; |
3071 | 136 |
by (Asm_full_simp_tac 1); |
137 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
138 |
qed"intA_is_not_extB"; |
|
139 |
||
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
140 |
goalw thy [externals_def,actions_def,compatible_def,is_asig_def,asig_of_def] |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
141 |
"!! a. [| compatible A B; a:int A |] ==> a ~: act B"; |
3071 | 142 |
by (Asm_full_simp_tac 1); |
143 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
144 |
qed"intA_is_not_actB"; |
|
145 |
||
3521 | 146 |
(* the only one that needs disjointness of outputs and of internals and _all_ acts *) |
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
147 |
goalw thy [asig_outputs_def,asig_internals_def,actions_def,asig_inputs_def, |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
148 |
compatible_def,is_asig_def,asig_of_def] |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
149 |
"!! a. [| compatible A B; a:out A ;a:act B|] ==> a : inp B"; |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
150 |
by (Asm_full_simp_tac 1); |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
151 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
152 |
qed"outAactB_is_inpB"; |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
153 |
|
3521 | 154 |
(* needed for propagation of input_enabledness from A,B to A||B *) |
155 |
goalw thy [asig_outputs_def,asig_internals_def,actions_def,asig_inputs_def, |
|
156 |
compatible_def,is_asig_def,asig_of_def] |
|
157 |
"!! a. [| compatible A B; a:inp A ;a:act B|] ==> a : inp B | a: out B"; |
|
158 |
by (Asm_full_simp_tac 1); |
|
159 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
160 |
qed"inpAAactB_is_inpBoroutB"; |
|
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
161 |
|
3521 | 162 |
(* ---------------------------------------------------------------------------------- *) |
163 |
||
164 |
section "input_enabledness and par"; |
|
165 |
||
166 |
||
167 |
(* ugly case distinctions. Heart of proof: |
|
168 |
1. inpAAactB_is_inpBoroutB ie. internals are really hidden. |
|
169 |
2. inputs_of_par: outputs are no longer inputs of par. This is important here *) |
|
170 |
goalw thy [input_enabled_def] |
|
171 |
"!!A. [| compatible A B; input_enabled A; input_enabled B|] \ |
|
172 |
\ ==> input_enabled (A||B)"; |
|
4098 | 173 |
by (asm_full_simp_tac (simpset() addsimps [inputs_of_par,trans_of_par]) 1); |
3521 | 174 |
by (safe_tac set_cs); |
4098 | 175 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
176 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 2); |
|
3521 | 177 |
(* a: inp A *) |
178 |
by (case_tac "a:act B" 1); |
|
179 |
(* a:act B *) |
|
180 |
by (eres_inst_tac [("x","a")] allE 1); |
|
181 |
by (Asm_full_simp_tac 1); |
|
4423 | 182 |
by (dtac inpAAactB_is_inpBoroutB 1); |
183 |
by (assume_tac 1); |
|
184 |
by (assume_tac 1); |
|
3521 | 185 |
by (eres_inst_tac [("x","a")] allE 1); |
186 |
by (Asm_full_simp_tac 1); |
|
187 |
by (eres_inst_tac [("x","aa")] allE 1); |
|
188 |
by (eres_inst_tac [("x","b")] allE 1); |
|
4423 | 189 |
by (etac exE 1); |
190 |
by (etac exE 1); |
|
3521 | 191 |
by (res_inst_tac [("x","(s2,s2a)")] exI 1); |
4098 | 192 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
3521 | 193 |
(* a~: act B*) |
4098 | 194 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
3521 | 195 |
by (eres_inst_tac [("x","a")] allE 1); |
196 |
by (Asm_full_simp_tac 1); |
|
197 |
by (eres_inst_tac [("x","aa")] allE 1); |
|
4423 | 198 |
by (etac exE 1); |
3521 | 199 |
by (res_inst_tac [("x","(s2,b)")] exI 1); |
200 |
by (Asm_full_simp_tac 1); |
|
201 |
||
202 |
(* a:inp B *) |
|
203 |
by (case_tac "a:act A" 1); |
|
204 |
(* a:act A *) |
|
205 |
by (eres_inst_tac [("x","a")] allE 1); |
|
206 |
by (eres_inst_tac [("x","a")] allE 1); |
|
4098 | 207 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
3521 | 208 |
by (forw_inst_tac [("A2","A")] (compat_commute RS iffD1) 1); |
4423 | 209 |
by (dtac inpAAactB_is_inpBoroutB 1); |
3521 | 210 |
back(); |
4423 | 211 |
by (assume_tac 1); |
212 |
by (assume_tac 1); |
|
3521 | 213 |
by (Asm_full_simp_tac 1); |
214 |
by (rotate_tac ~1 1); |
|
215 |
by (Asm_full_simp_tac 1); |
|
216 |
by (eres_inst_tac [("x","aa")] allE 1); |
|
217 |
by (eres_inst_tac [("x","b")] allE 1); |
|
4423 | 218 |
by (etac exE 1); |
219 |
by (etac exE 1); |
|
3521 | 220 |
by (res_inst_tac [("x","(s2,s2a)")] exI 1); |
4098 | 221 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
3521 | 222 |
(* a~: act B*) |
4098 | 223 |
by (asm_full_simp_tac (simpset() addsimps [inp_is_act]) 1); |
3521 | 224 |
by (eres_inst_tac [("x","a")] allE 1); |
225 |
by (Asm_full_simp_tac 1); |
|
226 |
by (eres_inst_tac [("x","a")] allE 1); |
|
227 |
by (Asm_full_simp_tac 1); |
|
228 |
by (eres_inst_tac [("x","b")] allE 1); |
|
4423 | 229 |
by (etac exE 1); |
3521 | 230 |
by (res_inst_tac [("x","(aa,s2)")] exI 1); |
231 |
by (Asm_full_simp_tac 1); |
|
232 |
qed"input_enabled_par"; |
|
3071 | 233 |
|
234 |
(* ---------------------------------------------------------------------------------- *) |
|
235 |
||
236 |
section "invariants"; |
|
237 |
||
238 |
val [p1,p2] = goalw thy [invariant_def] |
|
239 |
"[| !!s. s:starts_of(A) ==> P(s); \ |
|
240 |
\ !!s t a. [|reachable A s; P(s)|] ==> (s,a,t): trans_of(A) --> P(t) |] \ |
|
241 |
\ ==> invariant A P"; |
|
242 |
by (rtac allI 1); |
|
243 |
by (rtac impI 1); |
|
244 |
by (res_inst_tac [("za","s")] reachable.induct 1); |
|
245 |
by (atac 1); |
|
246 |
by (etac p1 1); |
|
247 |
by (eres_inst_tac [("s1","sa")] (p2 RS mp) 1); |
|
248 |
by (REPEAT (atac 1)); |
|
249 |
qed"invariantI"; |
|
250 |
||
251 |
||
252 |
val [p1,p2] = goal thy |
|
253 |
"[| !!s. s : starts_of(A) ==> P(s); \ |
|
254 |
\ !!s t a. reachable A s ==> P(s) --> (s,a,t):trans_of(A) --> P(t) \ |
|
255 |
\ |] ==> invariant A P"; |
|
256 |
by (fast_tac (HOL_cs addSIs [invariantI] addSDs [p1,p2]) 1); |
|
257 |
qed "invariantI1"; |
|
258 |
||
259 |
val [p1,p2] = goalw thy [invariant_def] |
|
260 |
"[| invariant A P; reachable A s |] ==> P(s)"; |
|
261 |
br(p2 RS (p1 RS spec RS mp))1; |
|
262 |
qed "invariantE"; |
|
263 |
||
264 |
(* ---------------------------------------------------------------------------------- *) |
|
265 |
||
266 |
section "restrict"; |
|
267 |
||
268 |
||
269 |
goal thy "starts_of(restrict ioa acts) = starts_of(ioa) & \ |
|
3656 | 270 |
\ trans_of(restrict ioa acts) = trans_of(ioa)"; |
4098 | 271 |
by (simp_tac (simpset() addsimps ([restrict_def]@ioa_projections)) 1); |
3071 | 272 |
qed "cancel_restrict_a"; |
273 |
||
274 |
goal thy "reachable (restrict ioa acts) s = reachable ioa s"; |
|
275 |
by (rtac iffI 1); |
|
3457 | 276 |
by (etac reachable.induct 1); |
4098 | 277 |
by (asm_full_simp_tac (simpset() addsimps [cancel_restrict_a,reachable_0]) 1); |
3071 | 278 |
by (etac reachable_n 1); |
4098 | 279 |
by (asm_full_simp_tac (simpset() addsimps [cancel_restrict_a]) 1); |
3071 | 280 |
(* <-- *) |
3457 | 281 |
by (etac reachable.induct 1); |
3071 | 282 |
by (rtac reachable_0 1); |
4098 | 283 |
by (asm_full_simp_tac (simpset() addsimps [cancel_restrict_a]) 1); |
3071 | 284 |
by (etac reachable_n 1); |
4098 | 285 |
by (asm_full_simp_tac (simpset() addsimps [cancel_restrict_a]) 1); |
3071 | 286 |
qed "cancel_restrict_b"; |
287 |
||
3656 | 288 |
goal thy "act (restrict A acts) = act A"; |
4098 | 289 |
by (simp_tac (simpset() addsimps [actions_def,asig_internals_def, |
3656 | 290 |
asig_outputs_def,asig_inputs_def,externals_def,asig_of_def,restrict_def, |
291 |
restrict_asig_def]) 1); |
|
4423 | 292 |
by (Auto_tac()); |
3656 | 293 |
qed"acts_restrict"; |
294 |
||
3071 | 295 |
goal thy "starts_of(restrict ioa acts) = starts_of(ioa) & \ |
3656 | 296 |
\ trans_of(restrict ioa acts) = trans_of(ioa) & \ |
297 |
\ reachable (restrict ioa acts) s = reachable ioa s & \ |
|
298 |
\ act (restrict A acts) = act A"; |
|
4098 | 299 |
by (simp_tac (simpset() addsimps [cancel_restrict_a,cancel_restrict_b,acts_restrict]) 1); |
3071 | 300 |
qed"cancel_restrict"; |
301 |
||
302 |
(* ---------------------------------------------------------------------------------- *) |
|
303 |
||
304 |
section "rename"; |
|
305 |
||
306 |
||
307 |
||
308 |
goal thy "!!f. s -a--(rename C f)-> t ==> (? x. Some(x) = f(a) & s -x--C-> t)"; |
|
4098 | 309 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,rename_def,trans_of_def]) 1); |
3071 | 310 |
qed"trans_rename"; |
311 |
||
312 |
||
313 |
goal thy "!!s.[| reachable (rename C g) s |] ==> reachable C s"; |
|
3457 | 314 |
by (etac reachable.induct 1); |
315 |
by (rtac reachable_0 1); |
|
4098 | 316 |
by (asm_full_simp_tac (simpset() addsimps [rename_def]@ioa_projections) 1); |
3457 | 317 |
by (dtac trans_rename 1); |
318 |
by (etac exE 1); |
|
319 |
by (etac conjE 1); |
|
320 |
by (etac reachable_n 1); |
|
321 |
by (assume_tac 1); |
|
3071 | 322 |
qed"reachable_rename"; |
323 |
||
324 |
||
325 |
||
326 |
(* ---------------------------------------------------------------------------------- *) |
|
327 |
||
328 |
section "trans_of(A||B)"; |
|
329 |
||
330 |
||
331 |
goal thy "!!A.[|(s,a,t):trans_of (A||B); a:act A|] \ |
|
332 |
\ ==> (fst s,a,fst t):trans_of A"; |
|
4098 | 333 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 334 |
qed"trans_A_proj"; |
335 |
||
336 |
goal thy "!!A.[|(s,a,t):trans_of (A||B); a:act B|] \ |
|
337 |
\ ==> (snd s,a,snd t):trans_of B"; |
|
4098 | 338 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 339 |
qed"trans_B_proj"; |
340 |
||
341 |
goal thy "!!A.[|(s,a,t):trans_of (A||B); a~:act A|]\ |
|
342 |
\ ==> fst s = fst t"; |
|
4098 | 343 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 344 |
qed"trans_A_proj2"; |
345 |
||
346 |
goal thy "!!A.[|(s,a,t):trans_of (A||B); a~:act B|]\ |
|
347 |
\ ==> snd s = snd t"; |
|
4098 | 348 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 349 |
qed"trans_B_proj2"; |
350 |
||
351 |
goal thy "!!A.(s,a,t):trans_of (A||B) \ |
|
352 |
\ ==> a :act A | a :act B"; |
|
4098 | 353 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 354 |
qed"trans_AB_proj"; |
355 |
||
356 |
goal thy "!!A. [|a:act A;a:act B;\ |
|
357 |
\ (fst s,a,fst t):trans_of A;(snd s,a,snd t):trans_of B|]\ |
|
358 |
\ ==> (s,a,t):trans_of (A||B)"; |
|
4098 | 359 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 360 |
qed"trans_AB"; |
361 |
||
362 |
goal thy "!!A. [|a:act A;a~:act B;\ |
|
363 |
\ (fst s,a,fst t):trans_of A;snd s=snd t|]\ |
|
364 |
\ ==> (s,a,t):trans_of (A||B)"; |
|
4098 | 365 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 366 |
qed"trans_A_notB"; |
367 |
||
368 |
goal thy "!!A. [|a~:act A;a:act B;\ |
|
369 |
\ (snd s,a,snd t):trans_of B;fst s=fst t|]\ |
|
370 |
\ ==> (s,a,t):trans_of (A||B)"; |
|
4098 | 371 |
by (asm_full_simp_tac (simpset() addsimps [Let_def,par_def,trans_of_def]) 1); |
3071 | 372 |
qed"trans_notA_B"; |
373 |
||
374 |
val trans_of_defs1 = [trans_AB,trans_A_notB,trans_notA_B]; |
|
375 |
val trans_of_defs2 = [trans_A_proj,trans_B_proj,trans_A_proj2, |
|
376 |
trans_B_proj2,trans_AB_proj]; |
|
377 |
||
378 |
||
379 |
goal thy |
|
380 |
"(s,a,t) : trans_of(A || B || C || D) = \ |
|
381 |
\ ((a:actions(asig_of(A)) | a:actions(asig_of(B)) | a:actions(asig_of(C)) | \ |
|
382 |
\ a:actions(asig_of(D))) & \ |
|
383 |
\ (if a:actions(asig_of(A)) then (fst(s),a,fst(t)):trans_of(A) \ |
|
384 |
\ else fst t=fst s) & \ |
|
385 |
\ (if a:actions(asig_of(B)) then (fst(snd(s)),a,fst(snd(t))):trans_of(B) \ |
|
386 |
\ else fst(snd(t))=fst(snd(s))) & \ |
|
387 |
\ (if a:actions(asig_of(C)) then \ |
|
388 |
\ (fst(snd(snd(s))),a,fst(snd(snd(t)))):trans_of(C) \ |
|
389 |
\ else fst(snd(snd(t)))=fst(snd(snd(s)))) & \ |
|
390 |
\ (if a:actions(asig_of(D)) then \ |
|
391 |
\ (snd(snd(snd(s))),a,snd(snd(snd(t)))):trans_of(D) \ |
|
392 |
\ else snd(snd(snd(t)))=snd(snd(snd(s)))))"; |
|
393 |
||
4098 | 394 |
by (simp_tac (simpset() addsimps ([par_def,actions_asig_comp,Pair_fst_snd_eq,Let_def]@ |
3071 | 395 |
ioa_projections) |
396 |
setloop (split_tac [expand_if])) 1); |
|
397 |
qed "trans_of_par4"; |
|
398 |
||
399 |
||
3521 | 400 |
(* ---------------------------------------------------------------------------------- *) |
3071 | 401 |
|
3521 | 402 |
section "proof obligation generator for IOA requirements"; |
403 |
||
404 |
(* without assumptions on A and B because is_trans_of is also incorporated in ||def *) |
|
405 |
goalw thy [is_trans_of_def] |
|
406 |
"is_trans_of (A||B)"; |
|
4098 | 407 |
by (simp_tac (simpset() addsimps [actions_of_par,trans_of_par]) 1); |
3521 | 408 |
qed"is_trans_of_par"; |
409 |
||
3656 | 410 |
goalw thy [is_trans_of_def] |
3521 | 411 |
"!!A. is_trans_of A ==> is_trans_of (restrict A acts)"; |
4098 | 412 |
by (asm_simp_tac (simpset() addsimps [cancel_restrict,acts_restrict])1); |
3656 | 413 |
qed"is_trans_of_restrict"; |
3521 | 414 |
|
415 |
goalw thy [is_trans_of_def,restrict_def,restrict_asig_def] |
|
416 |
"!!A. is_trans_of A ==> is_trans_of (rename A f)"; |
|
4098 | 417 |
by (asm_full_simp_tac (simpset() addsimps [actions_def,trans_of_def, |
3656 | 418 |
asig_internals_def,asig_outputs_def,asig_inputs_def,externals_def, |
419 |
asig_of_def,rename_def,rename_set_def]) 1); |
|
4423 | 420 |
by (Auto_tac()); |
3656 | 421 |
qed"is_trans_of_rename"; |
3521 | 422 |
|
423 |
goal thy "!! A. [| is_asig_of A; is_asig_of B; compatible A B|] \ |
|
424 |
\ ==> is_asig_of (A||B)"; |
|
4098 | 425 |
by (asm_full_simp_tac (simpset() addsimps [is_asig_of_def,asig_of_par, |
3656 | 426 |
asig_comp_def,compatible_def,asig_internals_def,asig_outputs_def, |
427 |
asig_inputs_def,actions_def,is_asig_def]) 1); |
|
4098 | 428 |
by (asm_full_simp_tac (simpset() addsimps [asig_of_def]) 1); |
4423 | 429 |
by (Auto_tac()); |
3656 | 430 |
by (REPEAT (best_tac (set_cs addEs [equalityCE]) 1)); |
431 |
qed"is_asig_of_par"; |
|
3521 | 432 |
|
3656 | 433 |
goalw thy [is_asig_of_def,is_asig_def,asig_of_def,restrict_def,restrict_asig_def, |
434 |
asig_internals_def,asig_outputs_def,asig_inputs_def,externals_def,o_def] |
|
435 |
"!! A. is_asig_of A ==> is_asig_of (restrict A f)"; |
|
436 |
by (Asm_full_simp_tac 1); |
|
4423 | 437 |
by (Auto_tac()); |
3656 | 438 |
by (REPEAT (best_tac (set_cs addEs [equalityCE]) 1)); |
439 |
qed"is_asig_of_restrict"; |
|
3521 | 440 |
|
3656 | 441 |
goal thy "!! A. is_asig_of A ==> is_asig_of (rename A f)"; |
4098 | 442 |
by (asm_full_simp_tac (simpset() addsimps [is_asig_of_def, |
3656 | 443 |
rename_def,rename_set_def,asig_internals_def,asig_outputs_def, |
444 |
asig_inputs_def,actions_def,is_asig_def,asig_of_def]) 1); |
|
4423 | 445 |
by (Auto_tac()); |
3656 | 446 |
by (dres_inst_tac [("s","Some xb")] sym 1); |
447 |
by (rotate_tac ~1 1); |
|
448 |
by (Asm_full_simp_tac 1); |
|
449 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
450 |
by (dres_inst_tac [("s","Some xb")] sym 1); |
|
451 |
by (rotate_tac ~1 1); |
|
452 |
by (Asm_full_simp_tac 1); |
|
453 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
454 |
by (dres_inst_tac [("s","Some xb")] sym 1); |
|
455 |
by (rotate_tac ~1 1); |
|
456 |
by (Asm_full_simp_tac 1); |
|
457 |
by (best_tac (set_cs addEs [equalityCE]) 1); |
|
458 |
qed"is_asig_of_rename"; |
|
3521 | 459 |
|
460 |
||
3656 | 461 |
Addsimps [is_asig_of_par,is_asig_of_restrict,is_asig_of_rename, |
462 |
is_trans_of_par,is_trans_of_restrict,is_trans_of_rename]; |
|
3521 | 463 |
|
464 |
||
3656 | 465 |
goalw thy [compatible_def] |
466 |
"!! A. [|compatible A B; compatible A C |]==> compatible A (B||C)"; |
|
4098 | 467 |
by (asm_full_simp_tac (simpset() addsimps [internals_of_par, |
3656 | 468 |
outputs_of_par,actions_of_par]) 1); |
4423 | 469 |
by (Auto_tac()); |
3656 | 470 |
by (REPEAT (best_tac (set_cs addEs [equalityCE]) 1)); |
471 |
qed"compatible_par"; |
|
3521 | 472 |
|
3656 | 473 |
(* FIX: better derive by previous one and compat_commute *) |
474 |
goalw thy [compatible_def] |
|
475 |
"!! A. [|compatible A C; compatible B C |]==> compatible (A||B) C"; |
|
4098 | 476 |
by (asm_full_simp_tac (simpset() addsimps [internals_of_par, |
3656 | 477 |
outputs_of_par,actions_of_par]) 1); |
4423 | 478 |
by (Auto_tac()); |
3656 | 479 |
by (REPEAT (best_tac (set_cs addEs [equalityCE]) 1)); |
480 |
qed"compatible_par2"; |
|
3521 | 481 |
|
3656 | 482 |
goalw thy [compatible_def] |
483 |
"!! A. [| compatible A B; (ext B - S) Int ext A = {}|] \ |
|
484 |
\ ==> compatible A (restrict B S)"; |
|
4098 | 485 |
by (asm_full_simp_tac (simpset() addsimps [ioa_triple_proj,asig_triple_proj, |
3656 | 486 |
externals_def,restrict_def,restrict_asig_def,actions_def]) 1); |
4098 | 487 |
by (auto_tac (claset() addEs [equalityCE],simpset())); |
3656 | 488 |
qed"compatible_restrict"; |
489 |