author | wenzelm |
Thu, 26 Apr 2007 14:24:08 +0200 | |
changeset 22808 | a7daa74e2980 |
parent 19741 | f65265d71426 |
child 23778 | 18f426a137a9 |
permissions | -rw-r--r-- |
3071 | 1 |
(* Title: HOLCF/IOA/meta_theory/Automata.thy |
3275 | 2 |
ID: $Id$ |
12218 | 3 |
Author: Olaf Müller, Konrad Slind, Tobias Nipkow |
17233 | 4 |
*) |
3071 | 5 |
|
17233 | 6 |
header {* The I/O automata of Lynch and Tuttle in HOLCF *} |
3071 | 7 |
|
17233 | 8 |
theory Automata |
9 |
imports Asig |
|
10 |
begin |
|
11 |
||
12 |
defaultsort type |
|
13 |
||
3071 | 14 |
types |
17233 | 15 |
('a, 's) transition = "'s * 'a * 's" |
16 |
('a, 's) ioa = "'a signature * 's set * ('a,'s)transition set * ('a set set) * ('a set set)" |
|
3071 | 17 |
|
18 |
consts |
|
17233 | 19 |
|
3071 | 20 |
(* IO automata *) |
3521 | 21 |
|
22 |
asig_of ::"('a,'s)ioa => 'a signature" |
|
23 |
starts_of ::"('a,'s)ioa => 's set" |
|
24 |
trans_of ::"('a,'s)ioa => ('a,'s)transition set" |
|
25 |
wfair_of ::"('a,'s)ioa => ('a set) set" |
|
26 |
sfair_of ::"('a,'s)ioa => ('a set) set" |
|
27 |
||
28 |
is_asig_of ::"('a,'s)ioa => bool" |
|
17233 | 29 |
is_starts_of ::"('a,'s)ioa => bool" |
30 |
is_trans_of ::"('a,'s)ioa => bool" |
|
31 |
input_enabled ::"('a,'s)ioa => bool" |
|
32 |
IOA ::"('a,'s)ioa => bool" |
|
3071 | 33 |
|
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
34 |
(* constraints for fair IOA *) |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
35 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
36 |
fairIOA ::"('a,'s)ioa => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
37 |
input_resistant::"('a,'s)ioa => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
38 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
39 |
(* enabledness of actions and action sets *) |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
40 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
41 |
enabled ::"('a,'s)ioa => 'a => 's => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
42 |
Enabled ::"('a,'s)ioa => 'a set => 's => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
43 |
|
17233 | 44 |
(* action set keeps enabled until probably disabled by itself *) |
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
45 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
46 |
en_persistent :: "('a,'s)ioa => 'a set => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
47 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
48 |
(* post_conditions for actions and action sets *) |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
49 |
|
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
50 |
was_enabled ::"('a,'s)ioa => 'a => 's => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
51 |
set_was_enabled ::"('a,'s)ioa => 'a set => 's => bool" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
52 |
|
3071 | 53 |
(* reachability and invariants *) |
54 |
reachable :: "('a,'s)ioa => 's set" |
|
55 |
invariant :: "[('a,'s)ioa, 's=>bool] => bool" |
|
56 |
||
57 |
(* binary composition of action signatures and automata *) |
|
58 |
asig_comp ::"['a signature, 'a signature] => 'a signature" |
|
3521 | 59 |
compatible ::"[('a,'s)ioa, ('a,'t)ioa] => bool" |
22808 | 60 |
par ::"[('a,'s)ioa, ('a,'t)ioa] => ('a,'s*'t)ioa" (infixr "||" 10) |
3071 | 61 |
|
3521 | 62 |
(* hiding and restricting *) |
63 |
hide_asig :: "['a signature, 'a set] => 'a signature" |
|
17233 | 64 |
"hide" :: "[('a,'s)ioa, 'a set] => ('a,'s)ioa" |
3071 | 65 |
restrict_asig :: "['a signature, 'a set] => 'a signature" |
66 |
restrict :: "[('a,'s)ioa, 'a set] => ('a,'s)ioa" |
|
67 |
||
68 |
(* renaming *) |
|
3521 | 69 |
rename_set :: "'a set => ('c => 'a option) => 'c set" |
70 |
rename :: "('a, 'b)ioa => ('c => 'a option) => ('c,'b)ioa" |
|
3071 | 71 |
|
72 |
||
17233 | 73 |
syntax |
3071 | 74 |
|
75 |
"_trans_of" :: "'s => 'a => ('a,'s)ioa => 's => bool" ("_ -_--_-> _" [81,81,81,81] 100) |
|
76 |
"reachable" :: "[('a,'s)ioa, 's] => bool" |
|
77 |
"act" :: "('a,'s)ioa => 'a set" |
|
78 |
"ext" :: "('a,'s)ioa => 'a set" |
|
79 |
"int" :: "('a,'s)ioa => 'a set" |
|
80 |
"inp" :: "('a,'s)ioa => 'a set" |
|
81 |
"out" :: "('a,'s)ioa => 'a set" |
|
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
82 |
"local" :: "('a,'s)ioa => 'a set" |
3071 | 83 |
|
84 |
||
12114
a8e860c86252
eliminated old "symbols" syntax, use "xsymbols" instead;
wenzelm
parents:
7661
diff
changeset
|
85 |
syntax (xsymbols) |
3071 | 86 |
|
17233 | 87 |
"_trans_of" :: "'s => 'a => ('a,'s)ioa => 's => bool" |
88 |
("_ \<midarrow>_\<midarrow>_\<longrightarrow> _" [81,81,81,81] 100) |
|
22808 | 89 |
|
90 |
notation (xsymbols) |
|
91 |
par (infixr "\<parallel>" 10) |
|
3071 | 92 |
|
93 |
||
17233 | 94 |
inductive "reachable C" |
95 |
intros |
|
96 |
reachable_0: "s:(starts_of C) ==> s : reachable C" |
|
97 |
reachable_n: "[|s:reachable C; (s,a,t):trans_of C|] ==> t:reachable C" |
|
3071 | 98 |
|
99 |
||
100 |
translations |
|
101 |
"s -a--A-> t" == "(s,a,t):trans_of A" |
|
102 |
"reachable A s" == "s:reachable A" |
|
103 |
"act A" == "actions (asig_of A)" |
|
104 |
"ext A" == "externals (asig_of A)" |
|
105 |
"int A" == "internals (asig_of A)" |
|
106 |
"inp A" == "inputs (asig_of A)" |
|
107 |
"out A" == "outputs (asig_of A)" |
|
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
108 |
"local A" == "locals (asig_of A)" |
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
109 |
|
3071 | 110 |
defs |
111 |
||
112 |
(* --------------------------------- IOA ---------------------------------*) |
|
113 |
||
17233 | 114 |
asig_of_def: "asig_of == fst" |
115 |
starts_of_def: "starts_of == (fst o snd)" |
|
116 |
trans_of_def: "trans_of == (fst o snd o snd)" |
|
117 |
wfair_of_def: "wfair_of == (fst o snd o snd o snd)" |
|
118 |
sfair_of_def: "sfair_of == (snd o snd o snd o snd)" |
|
119 |
||
120 |
is_asig_of_def: |
|
121 |
"is_asig_of A == is_asig (asig_of A)" |
|
122 |
||
123 |
is_starts_of_def: |
|
124 |
"is_starts_of A == (~ starts_of A = {})" |
|
125 |
||
126 |
is_trans_of_def: |
|
127 |
"is_trans_of A == |
|
128 |
(!triple. triple:(trans_of A) --> fst(snd(triple)):actions(asig_of A))" |
|
129 |
||
130 |
input_enabled_def: |
|
131 |
"input_enabled A == |
|
132 |
(!a. (a:inputs(asig_of A)) --> (!s1. ? s2. (s1,a,s2):(trans_of A)))" |
|
3071 | 133 |
|
134 |
||
17233 | 135 |
ioa_def: |
136 |
"IOA A == (is_asig_of A & |
|
137 |
is_starts_of A & |
|
3521 | 138 |
is_trans_of A & |
139 |
input_enabled A)" |
|
3071 | 140 |
|
141 |
||
17233 | 142 |
invariant_def: "invariant A P == (!s. reachable A s --> P(s))" |
3071 | 143 |
|
144 |
||
145 |
(* ------------------------- parallel composition --------------------------*) |
|
146 |
||
147 |
||
17233 | 148 |
compatible_def: |
149 |
"compatible A B == |
|
150 |
(((out A Int out B) = {}) & |
|
151 |
((int A Int act B) = {}) & |
|
3433
2de17c994071
added deadlock freedom, polished definitions and proofs
mueller
parents:
3275
diff
changeset
|
152 |
((int B Int act A) = {}))" |
3071 | 153 |
|
17233 | 154 |
asig_comp_def: |
155 |
"asig_comp a1 a2 == |
|
156 |
(((inputs(a1) Un inputs(a2)) - (outputs(a1) Un outputs(a2)), |
|
157 |
(outputs(a1) Un outputs(a2)), |
|
3071 | 158 |
(internals(a1) Un internals(a2))))" |
159 |
||
17233 | 160 |
par_def: |
161 |
"(A || B) == |
|
162 |
(asig_comp (asig_of A) (asig_of B), |
|
163 |
{pr. fst(pr):starts_of(A) & snd(pr):starts_of(B)}, |
|
164 |
{tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) |
|
165 |
in (a:act A | a:act B) & |
|
166 |
(if a:act A then |
|
167 |
(fst(s),a,fst(t)):trans_of(A) |
|
168 |
else fst(t) = fst(s)) |
|
169 |
& |
|
170 |
(if a:act B then |
|
171 |
(snd(s),a,snd(t)):trans_of(B) |
|
3521 | 172 |
else snd(t) = snd(s))}, |
173 |
wfair_of A Un wfair_of B, |
|
174 |
sfair_of A Un sfair_of B)" |
|
175 |
||
3071 | 176 |
|
177 |
(* ------------------------ hiding -------------------------------------------- *) |
|
178 |
||
17233 | 179 |
restrict_asig_def: |
180 |
"restrict_asig asig actns == |
|
181 |
(inputs(asig) Int actns, |
|
182 |
outputs(asig) Int actns, |
|
3071 | 183 |
internals(asig) Un (externals(asig) - actns))" |
184 |
||
17233 | 185 |
(* Notice that for wfair_of and sfair_of nothing has to be changed, as |
186 |
changes from the outputs to the internals does not touch the locals as |
|
3521 | 187 |
a whole, which is of importance for fairness only *) |
3071 | 188 |
|
17233 | 189 |
restrict_def: |
190 |
"restrict A actns == |
|
191 |
(restrict_asig (asig_of A) actns, |
|
192 |
starts_of A, |
|
3521 | 193 |
trans_of A, |
194 |
wfair_of A, |
|
195 |
sfair_of A)" |
|
196 |
||
17233 | 197 |
hide_asig_def: |
198 |
"hide_asig asig actns == |
|
199 |
(inputs(asig) - actns, |
|
200 |
outputs(asig) - actns, |
|
3521 | 201 |
internals(asig) Un actns)" |
202 |
||
17233 | 203 |
hide_def: |
204 |
"hide A actns == |
|
205 |
(hide_asig (asig_of A) actns, |
|
206 |
starts_of A, |
|
3521 | 207 |
trans_of A, |
208 |
wfair_of A, |
|
209 |
sfair_of A)" |
|
3071 | 210 |
|
211 |
(* ------------------------- renaming ------------------------------------------- *) |
|
17233 | 212 |
|
213 |
rename_set_def: |
|
214 |
"rename_set A ren == {b. ? x. Some x = ren b & x : A}" |
|
3521 | 215 |
|
17233 | 216 |
rename_def: |
217 |
"rename ioa ren == |
|
218 |
((rename_set (inp ioa) ren, |
|
219 |
rename_set (out ioa) ren, |
|
220 |
rename_set (int ioa) ren), |
|
221 |
starts_of ioa, |
|
222 |
{tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) |
|
223 |
in |
|
3521 | 224 |
? x. Some(x) = ren(a) & (s,x,t):trans_of ioa}, |
225 |
{rename_set s ren | s. s: wfair_of ioa}, |
|
226 |
{rename_set s ren | s. s: sfair_of ioa})" |
|
3071 | 227 |
|
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
228 |
(* ------------------------- fairness ----------------------------- *) |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
229 |
|
17233 | 230 |
fairIOA_def: |
231 |
"fairIOA A == (! S : wfair_of A. S<= local A) & |
|
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
232 |
(! S : sfair_of A. S<= local A)" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
233 |
|
17233 | 234 |
input_resistant_def: |
235 |
"input_resistant A == ! W : sfair_of A. ! s a t. |
|
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
236 |
reachable A s & reachable A t & a:inp A & |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
237 |
Enabled A W s & s -a--A-> t |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
238 |
--> Enabled A W t" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
239 |
|
17233 | 240 |
enabled_def: |
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
241 |
"enabled A a s == ? t. s-a--A-> t" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
242 |
|
17233 | 243 |
Enabled_def: |
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
244 |
"Enabled A W s == ? w:W. enabled A w s" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
245 |
|
17233 | 246 |
en_persistent_def: |
247 |
"en_persistent A W == ! s a t. Enabled A W s & |
|
248 |
a ~:W & |
|
249 |
s -a--A-> t |
|
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
250 |
--> Enabled A W t" |
17233 | 251 |
was_enabled_def: |
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
252 |
"was_enabled A a t == ? s. s-a--A-> t" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
253 |
|
17233 | 254 |
set_was_enabled_def: |
4559
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
255 |
"set_was_enabled A W t == ? w:W. was_enabled A w t" |
8e604d885b54
added files containing temproal logic and abstraction;
mueller
parents:
3521
diff
changeset
|
256 |
|
19741 | 257 |
|
258 |
declare split_paired_Ex [simp del] |
|
259 |
||
260 |
lemmas ioa_projections = asig_of_def starts_of_def trans_of_def wfair_of_def sfair_of_def |
|
261 |
||
262 |
||
263 |
subsection "asig_of, starts_of, trans_of" |
|
264 |
||
265 |
lemma ioa_triple_proj: |
|
266 |
"((asig_of (x,y,z,w,s)) = x) & |
|
267 |
((starts_of (x,y,z,w,s)) = y) & |
|
268 |
((trans_of (x,y,z,w,s)) = z) & |
|
269 |
((wfair_of (x,y,z,w,s)) = w) & |
|
270 |
((sfair_of (x,y,z,w,s)) = s)" |
|
271 |
apply (simp add: ioa_projections) |
|
272 |
done |
|
273 |
||
274 |
lemma trans_in_actions: |
|
275 |
"[| is_trans_of A; (s1,a,s2):trans_of(A) |] ==> a:act A" |
|
276 |
apply (unfold is_trans_of_def actions_def is_asig_def) |
|
277 |
apply (erule allE, erule impE, assumption) |
|
278 |
apply simp |
|
279 |
done |
|
280 |
||
281 |
lemma starts_of_par: |
|
282 |
"starts_of(A || B) = {p. fst(p):starts_of(A) & snd(p):starts_of(B)}" |
|
283 |
apply (simp add: par_def ioa_projections) |
|
284 |
done |
|
285 |
||
286 |
lemma trans_of_par: |
|
287 |
"trans_of(A || B) = {tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) |
|
288 |
in (a:act A | a:act B) & |
|
289 |
(if a:act A then |
|
290 |
(fst(s),a,fst(t)):trans_of(A) |
|
291 |
else fst(t) = fst(s)) |
|
292 |
& |
|
293 |
(if a:act B then |
|
294 |
(snd(s),a,snd(t)):trans_of(B) |
|
295 |
else snd(t) = snd(s))}" |
|
296 |
||
297 |
apply (simp add: par_def ioa_projections) |
|
298 |
done |
|
299 |
||
300 |
||
301 |
subsection "actions and par" |
|
302 |
||
303 |
lemma actions_asig_comp: |
|
304 |
"actions(asig_comp a b) = actions(a) Un actions(b)" |
|
305 |
apply (simp (no_asm) add: actions_def asig_comp_def asig_projections) |
|
306 |
apply blast |
|
307 |
done |
|
308 |
||
309 |
lemma asig_of_par: "asig_of(A || B) = asig_comp (asig_of A) (asig_of B)" |
|
310 |
apply (simp add: par_def ioa_projections) |
|
311 |
done |
|
312 |
||
313 |
||
314 |
lemma externals_of_par: "ext (A1||A2) = |
|
315 |
(ext A1) Un (ext A2)" |
|
316 |
apply (simp add: externals_def asig_of_par asig_comp_def |
|
317 |
asig_inputs_def asig_outputs_def Un_def set_diff_def) |
|
318 |
apply blast |
|
319 |
done |
|
320 |
||
321 |
lemma actions_of_par: "act (A1||A2) = |
|
322 |
(act A1) Un (act A2)" |
|
323 |
apply (simp add: actions_def asig_of_par asig_comp_def |
|
324 |
asig_inputs_def asig_outputs_def asig_internals_def Un_def set_diff_def) |
|
325 |
apply blast |
|
326 |
done |
|
327 |
||
328 |
lemma inputs_of_par: "inp (A1||A2) = |
|
329 |
((inp A1) Un (inp A2)) - ((out A1) Un (out A2))" |
|
330 |
apply (simp add: actions_def asig_of_par asig_comp_def |
|
331 |
asig_inputs_def asig_outputs_def Un_def set_diff_def) |
|
332 |
done |
|
333 |
||
334 |
lemma outputs_of_par: "out (A1||A2) = |
|
335 |
(out A1) Un (out A2)" |
|
336 |
apply (simp add: actions_def asig_of_par asig_comp_def |
|
337 |
asig_outputs_def Un_def set_diff_def) |
|
338 |
done |
|
339 |
||
340 |
lemma internals_of_par: "int (A1||A2) = |
|
341 |
(int A1) Un (int A2)" |
|
342 |
apply (simp add: actions_def asig_of_par asig_comp_def |
|
343 |
asig_inputs_def asig_outputs_def asig_internals_def Un_def set_diff_def) |
|
344 |
done |
|
345 |
||
346 |
||
347 |
subsection "actions and compatibility" |
|
348 |
||
349 |
lemma compat_commute: "compatible A B = compatible B A" |
|
350 |
apply (simp add: compatible_def Int_commute) |
|
351 |
apply auto |
|
352 |
done |
|
353 |
||
354 |
lemma ext1_is_not_int2: |
|
355 |
"[| compatible A1 A2; a:ext A1|] ==> a~:int A2" |
|
356 |
apply (unfold externals_def actions_def compatible_def) |
|
357 |
apply simp |
|
358 |
apply blast |
|
359 |
done |
|
360 |
||
361 |
(* just commuting the previous one: better commute compatible *) |
|
362 |
lemma ext2_is_not_int1: |
|
363 |
"[| compatible A2 A1 ; a:ext A1|] ==> a~:int A2" |
|
364 |
apply (unfold externals_def actions_def compatible_def) |
|
365 |
apply simp |
|
366 |
apply blast |
|
367 |
done |
|
368 |
||
369 |
lemmas ext1_ext2_is_not_act2 = ext1_is_not_int2 [THEN int_and_ext_is_act, standard] |
|
370 |
lemmas ext1_ext2_is_not_act1 = ext2_is_not_int1 [THEN int_and_ext_is_act, standard] |
|
371 |
||
372 |
lemma intA_is_not_extB: |
|
373 |
"[| compatible A B; x:int A |] ==> x~:ext B" |
|
374 |
apply (unfold externals_def actions_def compatible_def) |
|
375 |
apply simp |
|
376 |
apply blast |
|
377 |
done |
|
378 |
||
379 |
lemma intA_is_not_actB: |
|
380 |
"[| compatible A B; a:int A |] ==> a ~: act B" |
|
381 |
apply (unfold externals_def actions_def compatible_def is_asig_def asig_of_def) |
|
382 |
apply simp |
|
383 |
apply blast |
|
384 |
done |
|
385 |
||
386 |
(* the only one that needs disjointness of outputs and of internals and _all_ acts *) |
|
387 |
lemma outAactB_is_inpB: |
|
388 |
"[| compatible A B; a:out A ;a:act B|] ==> a : inp B" |
|
389 |
apply (unfold asig_outputs_def asig_internals_def actions_def asig_inputs_def |
|
390 |
compatible_def is_asig_def asig_of_def) |
|
391 |
apply simp |
|
392 |
apply blast |
|
393 |
done |
|
394 |
||
395 |
(* needed for propagation of input_enabledness from A,B to A||B *) |
|
396 |
lemma inpAAactB_is_inpBoroutB: |
|
397 |
"[| compatible A B; a:inp A ;a:act B|] ==> a : inp B | a: out B" |
|
398 |
apply (unfold asig_outputs_def asig_internals_def actions_def asig_inputs_def |
|
399 |
compatible_def is_asig_def asig_of_def) |
|
400 |
apply simp |
|
401 |
apply blast |
|
402 |
done |
|
403 |
||
404 |
||
405 |
subsection "input_enabledness and par" |
|
406 |
||
407 |
||
408 |
(* ugly case distinctions. Heart of proof: |
|
409 |
1. inpAAactB_is_inpBoroutB ie. internals are really hidden. |
|
410 |
2. inputs_of_par: outputs are no longer inputs of par. This is important here *) |
|
411 |
lemma input_enabled_par: |
|
412 |
"[| compatible A B; input_enabled A; input_enabled B|] |
|
413 |
==> input_enabled (A||B)" |
|
414 |
apply (unfold input_enabled_def) |
|
415 |
apply (simp add: Let_def inputs_of_par trans_of_par) |
|
416 |
apply (tactic "safe_tac set_cs") |
|
417 |
apply (simp add: inp_is_act) |
|
418 |
prefer 2 |
|
419 |
apply (simp add: inp_is_act) |
|
420 |
(* a: inp A *) |
|
421 |
apply (case_tac "a:act B") |
|
422 |
(* a:act B *) |
|
423 |
apply (erule_tac x = "a" in allE) |
|
424 |
apply simp |
|
425 |
apply (drule inpAAactB_is_inpBoroutB) |
|
426 |
apply assumption |
|
427 |
apply assumption |
|
428 |
apply (erule_tac x = "a" in allE) |
|
429 |
apply simp |
|
430 |
apply (erule_tac x = "aa" in allE) |
|
431 |
apply (erule_tac x = "b" in allE) |
|
432 |
apply (erule exE) |
|
433 |
apply (erule exE) |
|
434 |
apply (rule_tac x = " (s2,s2a) " in exI) |
|
435 |
apply (simp add: inp_is_act) |
|
436 |
(* a~: act B*) |
|
437 |
apply (simp add: inp_is_act) |
|
438 |
apply (erule_tac x = "a" in allE) |
|
439 |
apply simp |
|
440 |
apply (erule_tac x = "aa" in allE) |
|
441 |
apply (erule exE) |
|
442 |
apply (rule_tac x = " (s2,b) " in exI) |
|
443 |
apply simp |
|
444 |
||
445 |
(* a:inp B *) |
|
446 |
apply (case_tac "a:act A") |
|
447 |
(* a:act A *) |
|
448 |
apply (erule_tac x = "a" in allE) |
|
449 |
apply (erule_tac x = "a" in allE) |
|
450 |
apply (simp add: inp_is_act) |
|
451 |
apply (frule_tac A1 = "A" in compat_commute [THEN iffD1]) |
|
452 |
apply (drule inpAAactB_is_inpBoroutB) |
|
453 |
back |
|
454 |
apply assumption |
|
455 |
apply assumption |
|
456 |
apply simp |
|
457 |
apply (erule_tac x = "aa" in allE) |
|
458 |
apply (erule_tac x = "b" in allE) |
|
459 |
apply (erule exE) |
|
460 |
apply (erule exE) |
|
461 |
apply (rule_tac x = " (s2,s2a) " in exI) |
|
462 |
apply (simp add: inp_is_act) |
|
463 |
(* a~: act B*) |
|
464 |
apply (simp add: inp_is_act) |
|
465 |
apply (erule_tac x = "a" in allE) |
|
466 |
apply (erule_tac x = "a" in allE) |
|
467 |
apply simp |
|
468 |
apply (erule_tac x = "b" in allE) |
|
469 |
apply (erule exE) |
|
470 |
apply (rule_tac x = " (aa,s2) " in exI) |
|
471 |
apply simp |
|
472 |
done |
|
473 |
||
474 |
||
475 |
subsection "invariants" |
|
476 |
||
477 |
lemma invariantI: |
|
478 |
"[| !!s. s:starts_of(A) ==> P(s); |
|
479 |
!!s t a. [|reachable A s; P(s)|] ==> (s,a,t): trans_of(A) --> P(t) |] |
|
480 |
==> invariant A P" |
|
481 |
apply (unfold invariant_def) |
|
482 |
apply (rule allI) |
|
483 |
apply (rule impI) |
|
484 |
apply (rule_tac xa = "s" in reachable.induct) |
|
485 |
apply assumption |
|
486 |
apply blast |
|
487 |
apply blast |
|
488 |
done |
|
489 |
||
490 |
lemma invariantI1: |
|
491 |
"[| !!s. s : starts_of(A) ==> P(s); |
|
492 |
!!s t a. reachable A s ==> P(s) --> (s,a,t):trans_of(A) --> P(t) |
|
493 |
|] ==> invariant A P" |
|
494 |
apply (blast intro: invariantI) |
|
495 |
done |
|
496 |
||
497 |
lemma invariantE: "[| invariant A P; reachable A s |] ==> P(s)" |
|
498 |
apply (unfold invariant_def) |
|
499 |
apply blast |
|
500 |
done |
|
501 |
||
502 |
||
503 |
subsection "restrict" |
|
504 |
||
505 |
||
506 |
lemmas reachable_0 = reachable.reachable_0 |
|
507 |
and reachable_n = reachable.reachable_n |
|
508 |
||
509 |
lemma cancel_restrict_a: "starts_of(restrict ioa acts) = starts_of(ioa) & |
|
510 |
trans_of(restrict ioa acts) = trans_of(ioa)" |
|
511 |
apply (simp add: restrict_def ioa_projections) |
|
512 |
done |
|
513 |
||
514 |
lemma cancel_restrict_b: "reachable (restrict ioa acts) s = reachable ioa s" |
|
515 |
apply (rule iffI) |
|
516 |
apply (erule reachable.induct) |
|
517 |
apply (simp add: cancel_restrict_a reachable_0) |
|
518 |
apply (erule reachable_n) |
|
519 |
apply (simp add: cancel_restrict_a) |
|
520 |
(* <-- *) |
|
521 |
apply (erule reachable.induct) |
|
522 |
apply (rule reachable_0) |
|
523 |
apply (simp add: cancel_restrict_a) |
|
524 |
apply (erule reachable_n) |
|
525 |
apply (simp add: cancel_restrict_a) |
|
526 |
done |
|
527 |
||
528 |
lemma acts_restrict: "act (restrict A acts) = act A" |
|
529 |
apply (simp (no_asm) add: actions_def asig_internals_def |
|
530 |
asig_outputs_def asig_inputs_def externals_def asig_of_def restrict_def restrict_asig_def) |
|
531 |
apply auto |
|
532 |
done |
|
533 |
||
534 |
lemma cancel_restrict: "starts_of(restrict ioa acts) = starts_of(ioa) & |
|
535 |
trans_of(restrict ioa acts) = trans_of(ioa) & |
|
536 |
reachable (restrict ioa acts) s = reachable ioa s & |
|
537 |
act (restrict A acts) = act A" |
|
538 |
apply (simp (no_asm) add: cancel_restrict_a cancel_restrict_b acts_restrict) |
|
539 |
done |
|
540 |
||
541 |
||
542 |
subsection "rename" |
|
543 |
||
544 |
lemma trans_rename: "s -a--(rename C f)-> t ==> (? x. Some(x) = f(a) & s -x--C-> t)" |
|
545 |
apply (simp add: Let_def rename_def trans_of_def) |
|
546 |
done |
|
547 |
||
548 |
||
549 |
lemma reachable_rename: "[| reachable (rename C g) s |] ==> reachable C s" |
|
550 |
apply (erule reachable.induct) |
|
551 |
apply (rule reachable_0) |
|
552 |
apply (simp add: rename_def ioa_projections) |
|
553 |
apply (drule trans_rename) |
|
554 |
apply (erule exE) |
|
555 |
apply (erule conjE) |
|
556 |
apply (erule reachable_n) |
|
557 |
apply assumption |
|
558 |
done |
|
559 |
||
560 |
||
561 |
subsection "trans_of(A||B)" |
|
562 |
||
563 |
||
564 |
lemma trans_A_proj: "[|(s,a,t):trans_of (A||B); a:act A|] |
|
565 |
==> (fst s,a,fst t):trans_of A" |
|
566 |
apply (simp add: Let_def par_def trans_of_def) |
|
567 |
done |
|
568 |
||
569 |
lemma trans_B_proj: "[|(s,a,t):trans_of (A||B); a:act B|] |
|
570 |
==> (snd s,a,snd t):trans_of B" |
|
571 |
apply (simp add: Let_def par_def trans_of_def) |
|
572 |
done |
|
573 |
||
574 |
lemma trans_A_proj2: "[|(s,a,t):trans_of (A||B); a~:act A|] |
|
575 |
==> fst s = fst t" |
|
576 |
apply (simp add: Let_def par_def trans_of_def) |
|
577 |
done |
|
578 |
||
579 |
lemma trans_B_proj2: "[|(s,a,t):trans_of (A||B); a~:act B|] |
|
580 |
==> snd s = snd t" |
|
581 |
apply (simp add: Let_def par_def trans_of_def) |
|
582 |
done |
|
583 |
||
584 |
lemma trans_AB_proj: "(s,a,t):trans_of (A||B) |
|
585 |
==> a :act A | a :act B" |
|
586 |
apply (simp add: Let_def par_def trans_of_def) |
|
587 |
done |
|
588 |
||
589 |
lemma trans_AB: "[|a:act A;a:act B; |
|
590 |
(fst s,a,fst t):trans_of A;(snd s,a,snd t):trans_of B|] |
|
591 |
==> (s,a,t):trans_of (A||B)" |
|
592 |
apply (simp add: Let_def par_def trans_of_def) |
|
593 |
done |
|
594 |
||
595 |
lemma trans_A_notB: "[|a:act A;a~:act B; |
|
596 |
(fst s,a,fst t):trans_of A;snd s=snd t|] |
|
597 |
==> (s,a,t):trans_of (A||B)" |
|
598 |
apply (simp add: Let_def par_def trans_of_def) |
|
599 |
done |
|
600 |
||
601 |
lemma trans_notA_B: "[|a~:act A;a:act B; |
|
602 |
(snd s,a,snd t):trans_of B;fst s=fst t|] |
|
603 |
==> (s,a,t):trans_of (A||B)" |
|
604 |
apply (simp add: Let_def par_def trans_of_def) |
|
605 |
done |
|
606 |
||
607 |
lemmas trans_of_defs1 = trans_AB trans_A_notB trans_notA_B |
|
608 |
and trans_of_defs2 = trans_A_proj trans_B_proj trans_A_proj2 trans_B_proj2 trans_AB_proj |
|
609 |
||
610 |
||
611 |
lemma trans_of_par4: |
|
612 |
"((s,a,t) : trans_of(A || B || C || D)) = |
|
613 |
((a:actions(asig_of(A)) | a:actions(asig_of(B)) | a:actions(asig_of(C)) | |
|
614 |
a:actions(asig_of(D))) & |
|
615 |
(if a:actions(asig_of(A)) then (fst(s),a,fst(t)):trans_of(A) |
|
616 |
else fst t=fst s) & |
|
617 |
(if a:actions(asig_of(B)) then (fst(snd(s)),a,fst(snd(t))):trans_of(B) |
|
618 |
else fst(snd(t))=fst(snd(s))) & |
|
619 |
(if a:actions(asig_of(C)) then |
|
620 |
(fst(snd(snd(s))),a,fst(snd(snd(t)))):trans_of(C) |
|
621 |
else fst(snd(snd(t)))=fst(snd(snd(s)))) & |
|
622 |
(if a:actions(asig_of(D)) then |
|
623 |
(snd(snd(snd(s))),a,snd(snd(snd(t)))):trans_of(D) |
|
624 |
else snd(snd(snd(t)))=snd(snd(snd(s)))))" |
|
625 |
apply (simp (no_asm) add: par_def actions_asig_comp Pair_fst_snd_eq Let_def ioa_projections) |
|
626 |
done |
|
627 |
||
628 |
||
629 |
subsection "proof obligation generator for IOA requirements" |
|
630 |
||
631 |
(* without assumptions on A and B because is_trans_of is also incorporated in ||def *) |
|
632 |
lemma is_trans_of_par: "is_trans_of (A||B)" |
|
633 |
apply (unfold is_trans_of_def) |
|
634 |
apply (simp add: Let_def actions_of_par trans_of_par) |
|
635 |
done |
|
636 |
||
637 |
lemma is_trans_of_restrict: |
|
638 |
"is_trans_of A ==> is_trans_of (restrict A acts)" |
|
639 |
apply (unfold is_trans_of_def) |
|
640 |
apply (simp add: cancel_restrict acts_restrict) |
|
641 |
done |
|
642 |
||
643 |
lemma is_trans_of_rename: |
|
644 |
"is_trans_of A ==> is_trans_of (rename A f)" |
|
645 |
apply (unfold is_trans_of_def restrict_def restrict_asig_def) |
|
646 |
apply (simp add: Let_def actions_def trans_of_def asig_internals_def |
|
647 |
asig_outputs_def asig_inputs_def externals_def asig_of_def rename_def rename_set_def) |
|
648 |
apply blast |
|
649 |
done |
|
650 |
||
651 |
lemma is_asig_of_par: "[| is_asig_of A; is_asig_of B; compatible A B|] |
|
652 |
==> is_asig_of (A||B)" |
|
653 |
apply (simp add: is_asig_of_def asig_of_par asig_comp_def compatible_def |
|
654 |
asig_internals_def asig_outputs_def asig_inputs_def actions_def is_asig_def) |
|
655 |
apply (simp add: asig_of_def) |
|
656 |
apply auto |
|
657 |
done |
|
658 |
||
659 |
lemma is_asig_of_restrict: |
|
660 |
"is_asig_of A ==> is_asig_of (restrict A f)" |
|
661 |
apply (unfold is_asig_of_def is_asig_def asig_of_def restrict_def restrict_asig_def |
|
662 |
asig_internals_def asig_outputs_def asig_inputs_def externals_def o_def) |
|
663 |
apply simp |
|
664 |
apply auto |
|
665 |
done |
|
666 |
||
667 |
lemma is_asig_of_rename: "is_asig_of A ==> is_asig_of (rename A f)" |
|
668 |
apply (simp add: is_asig_of_def rename_def rename_set_def asig_internals_def |
|
669 |
asig_outputs_def asig_inputs_def actions_def is_asig_def asig_of_def) |
|
670 |
apply auto |
|
671 |
apply (drule_tac [!] s = "Some ?x" in sym) |
|
672 |
apply auto |
|
673 |
done |
|
674 |
||
675 |
lemmas [simp] = is_asig_of_par is_asig_of_restrict |
|
676 |
is_asig_of_rename is_trans_of_par is_trans_of_restrict is_trans_of_rename |
|
677 |
||
678 |
||
679 |
lemma compatible_par: |
|
680 |
"[|compatible A B; compatible A C |]==> compatible A (B||C)" |
|
681 |
apply (unfold compatible_def) |
|
682 |
apply (simp add: internals_of_par outputs_of_par actions_of_par) |
|
683 |
apply auto |
|
684 |
done |
|
685 |
||
686 |
(* better derive by previous one and compat_commute *) |
|
687 |
lemma compatible_par2: |
|
688 |
"[|compatible A C; compatible B C |]==> compatible (A||B) C" |
|
689 |
apply (unfold compatible_def) |
|
690 |
apply (simp add: internals_of_par outputs_of_par actions_of_par) |
|
691 |
apply auto |
|
692 |
done |
|
693 |
||
694 |
lemma compatible_restrict: |
|
695 |
"[| compatible A B; (ext B - S) Int ext A = {}|] |
|
696 |
==> compatible A (restrict B S)" |
|
697 |
apply (unfold compatible_def) |
|
698 |
apply (simp add: ioa_triple_proj asig_triple_proj externals_def |
|
699 |
restrict_def restrict_asig_def actions_def) |
|
700 |
apply auto |
|
701 |
done |
|
702 |
||
703 |
||
704 |
declare split_paired_Ex [simp] |
|
3071 | 705 |
|
706 |
end |