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