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