author | blanchet |
Mon, 09 Aug 2010 12:53:16 +0200 | |
changeset 38287 | 796302ca3611 |
parent 36862 | 952b2b102a0a |
child 42174 | d0be2722ce9f |
permissions | -rw-r--r-- |
4530 | 1 |
(* Title: HOL/IOA/IOA.thy |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
2 |
Author: Tobias Nipkow & Konrad Slind |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
3 |
Copyright 1994 TU Muenchen |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
4 |
*) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
5 |
|
17288 | 6 |
header {* The I/O automata of Lynch and Tuttle *} |
7 |
||
8 |
theory IOA |
|
9 |
imports Asig |
|
10 |
begin |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
11 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
12 |
types |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
13 |
'a seq = "nat => 'a" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
14 |
'a oseq = "nat => 'a option" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
15 |
('a,'b)execution = "'a oseq * 'b seq" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
16 |
('a,'s)transition = "('s * 'a * 's)" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
17 |
('a,'s)ioa = "'a signature * 's set * ('a,'s)transition set" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
18 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
19 |
consts |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
20 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
21 |
(* IO automata *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
22 |
state_trans::"['action signature, ('action,'state)transition set] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
23 |
asig_of ::"('action,'state)ioa => 'action signature" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
24 |
starts_of ::"('action,'state)ioa => 'state set" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
25 |
trans_of ::"('action,'state)ioa => ('action,'state)transition set" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
26 |
IOA ::"('action,'state)ioa => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
27 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
28 |
(* Executions, schedules, and traces *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
29 |
|
17288 | 30 |
is_execution_fragment ::"[('action,'state)ioa, ('action,'state)execution] => bool" |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
31 |
has_execution ::"[('action,'state)ioa, ('action,'state)execution] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
32 |
executions :: "('action,'state)ioa => ('action,'state)execution set" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
33 |
mk_trace :: "[('action,'state)ioa, 'action oseq] => 'action oseq" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
34 |
reachable :: "[('action,'state)ioa, 'state] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
35 |
invariant :: "[('action,'state)ioa, 'state=>bool] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
36 |
has_trace :: "[('action,'state)ioa, 'action oseq] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
37 |
traces :: "('action,'state)ioa => 'action oseq set" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
38 |
NF :: "'a oseq => 'a oseq" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
39 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
40 |
(* Composition of action signatures and automata *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
41 |
compatible_asigs ::"('a => 'action signature) => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
42 |
asig_composition ::"('a => 'action signature) => 'action signature" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
43 |
compatible_ioas ::"('a => ('action,'state)ioa) => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
44 |
ioa_composition ::"('a => ('action, 'state)ioa) =>('action,'a => 'state)ioa" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
45 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
46 |
(* binary composition of action signatures and automata *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
47 |
compat_asigs ::"['action signature, 'action signature] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
48 |
asig_comp ::"['action signature, 'action signature] => 'action signature" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
49 |
compat_ioas ::"[('action,'s)ioa, ('action,'t)ioa] => bool" |
17288 | 50 |
par ::"[('a,'s)ioa, ('a,'t)ioa] => ('a,'s*'t)ioa" (infixr "||" 10) |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
51 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
52 |
(* Filtering and hiding *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
53 |
filter_oseq :: "('a => bool) => 'a oseq => 'a oseq" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
54 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
55 |
restrict_asig :: "['a signature, 'a set] => 'a signature" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
56 |
restrict :: "[('a,'s)ioa, 'a set] => ('a,'s)ioa" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
57 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
58 |
(* Notions of correctness *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
59 |
ioa_implements :: "[('action,'state1)ioa, ('action,'state2)ioa] => bool" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
60 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
61 |
(* Instantiation of abstract IOA by concrete actions *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
62 |
rename:: "('a, 'b)ioa => ('c => 'a option) => ('c,'b)ioa" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
63 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
64 |
defs |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
65 |
|
17288 | 66 |
state_trans_def: |
67 |
"state_trans asig R == |
|
68 |
(!triple. triple:R --> fst(snd(triple)):actions(asig)) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
69 |
(!a. (a:inputs(asig)) --> (!s1. ? s2. (s1,a,s2):R))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
70 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
71 |
|
17288 | 72 |
asig_of_def: "asig_of == fst" |
73 |
starts_of_def: "starts_of == (fst o snd)" |
|
74 |
trans_of_def: "trans_of == (snd o snd)" |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
75 |
|
17288 | 76 |
ioa_def: |
77 |
"IOA(ioa) == (is_asig(asig_of(ioa)) & |
|
78 |
(~ starts_of(ioa) = {}) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
79 |
state_trans (asig_of ioa) (trans_of ioa))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
80 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
81 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
82 |
(* An execution fragment is modelled with a pair of sequences: |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
83 |
* the first is the action options, the second the state sequence. |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
84 |
* Finite executions have None actions from some point on. |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
85 |
*******) |
17288 | 86 |
is_execution_fragment_def: |
87 |
"is_execution_fragment A ex == |
|
88 |
let act = fst(ex); state = snd(ex) |
|
89 |
in !n a. (act(n)=None --> state(Suc(n)) = state(n)) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
90 |
(act(n)=Some(a) --> (state(n),a,state(Suc(n))):trans_of(A))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
91 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
92 |
|
17288 | 93 |
executions_def: |
94 |
"executions(ioa) == {e. snd e 0:starts_of(ioa) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
95 |
is_execution_fragment ioa e}" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
96 |
|
17288 | 97 |
|
98 |
reachable_def: |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
99 |
"reachable ioa s == (? ex:executions(ioa). ? n. (snd ex n) = s)" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
100 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
101 |
|
17288 | 102 |
invariant_def: "invariant A P == (!s. reachable A s --> P(s))" |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
103 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
104 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
105 |
(* Restrict the trace to those members of the set s *) |
17288 | 106 |
filter_oseq_def: |
107 |
"filter_oseq p s == |
|
108 |
(%i. case s(i) |
|
109 |
of None => None |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
110 |
| Some(x) => if p x then Some x else None)" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
111 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
112 |
|
17288 | 113 |
mk_trace_def: |
3842 | 114 |
"mk_trace(ioa) == filter_oseq(%a. a:externals(asig_of(ioa)))" |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
115 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
116 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
117 |
(* Does an ioa have an execution with the given trace *) |
17288 | 118 |
has_trace_def: |
119 |
"has_trace ioa b == |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
120 |
(? ex:executions(ioa). b = mk_trace ioa (fst ex))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
121 |
|
17288 | 122 |
normal_form_def: |
123 |
"NF(tr) == @nf. ? f. mono(f) & (!i. nf(i)=tr(f(i))) & |
|
124 |
(!j. j ~: range(f) --> nf(j)= None) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
125 |
(!i. nf(i)=None --> (nf (Suc i)) = None) " |
17288 | 126 |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
127 |
(* All the traces of an ioa *) |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
128 |
|
17288 | 129 |
traces_def: |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
130 |
"traces(ioa) == {trace. ? tr. trace=NF(tr) & has_trace ioa tr}" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
131 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
132 |
(* |
17288 | 133 |
traces_def: |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
134 |
"traces(ioa) == {tr. has_trace ioa tr}" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
135 |
*) |
17288 | 136 |
|
137 |
compat_asigs_def: |
|
138 |
"compat_asigs a1 a2 == |
|
139 |
(((outputs(a1) Int outputs(a2)) = {}) & |
|
140 |
((internals(a1) Int actions(a2)) = {}) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
141 |
((internals(a2) Int actions(a1)) = {}))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
142 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
143 |
|
17288 | 144 |
compat_ioas_def: |
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
145 |
"compat_ioas ioa1 ioa2 == compat_asigs (asig_of(ioa1)) (asig_of(ioa2))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
146 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
147 |
|
17288 | 148 |
asig_comp_def: |
149 |
"asig_comp a1 a2 == |
|
150 |
(((inputs(a1) Un inputs(a2)) - (outputs(a1) Un outputs(a2)), |
|
151 |
(outputs(a1) Un outputs(a2)), |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
152 |
(internals(a1) Un internals(a2))))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
153 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
154 |
|
17288 | 155 |
par_def: |
156 |
"(ioa1 || ioa2) == |
|
157 |
(asig_comp (asig_of ioa1) (asig_of ioa2), |
|
158 |
{pr. fst(pr):starts_of(ioa1) & snd(pr):starts_of(ioa2)}, |
|
159 |
{tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) |
|
160 |
in (a:actions(asig_of(ioa1)) | a:actions(asig_of(ioa2))) & |
|
161 |
(if a:actions(asig_of(ioa1)) then |
|
162 |
(fst(s),a,fst(t)):trans_of(ioa1) |
|
163 |
else fst(t) = fst(s)) |
|
164 |
& |
|
165 |
(if a:actions(asig_of(ioa2)) then |
|
166 |
(snd(s),a,snd(t)):trans_of(ioa2) |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
167 |
else snd(t) = snd(s))})" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
168 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
169 |
|
17288 | 170 |
restrict_asig_def: |
171 |
"restrict_asig asig actns == |
|
172 |
(inputs(asig) Int actns, outputs(asig) Int actns, |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
173 |
internals(asig) Un (externals(asig) - actns))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
174 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
175 |
|
17288 | 176 |
restrict_def: |
177 |
"restrict ioa actns == |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
178 |
(restrict_asig (asig_of ioa) actns, starts_of(ioa), trans_of(ioa))" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
179 |
|
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
180 |
|
17288 | 181 |
ioa_implements_def: |
182 |
"ioa_implements ioa1 ioa2 == |
|
183 |
((inputs(asig_of(ioa1)) = inputs(asig_of(ioa2))) & |
|
184 |
(outputs(asig_of(ioa1)) = outputs(asig_of(ioa2))) & |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
185 |
traces(ioa1) <= traces(ioa2))" |
17288 | 186 |
|
187 |
rename_def: |
|
188 |
"rename ioa ren == |
|
189 |
(({b. ? x. Some(x)= ren(b) & x : inputs(asig_of(ioa))}, |
|
190 |
{b. ? x. Some(x)= ren(b) & x : outputs(asig_of(ioa))}, |
|
191 |
{b. ? x. Some(x)= ren(b) & x : internals(asig_of(ioa))}), |
|
192 |
starts_of(ioa) , |
|
193 |
{tr. let s = fst(tr); a = fst(snd(tr)); t = snd(snd(tr)) |
|
194 |
in |
|
3078
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
195 |
? x. Some(x) = ren(a) & (s,x,t):trans_of(ioa)})" |
984866a8f905
old IOA meta theory (see also new version in HOLCF/IOA/meta_theory);
mueller
parents:
diff
changeset
|
196 |
|
19801 | 197 |
|
198 |
declare Let_def [simp] |
|
199 |
||
200 |
lemmas ioa_projections = asig_of_def starts_of_def trans_of_def |
|
201 |
and exec_rws = executions_def is_execution_fragment_def |
|
202 |
||
203 |
lemma ioa_triple_proj: |
|
204 |
"asig_of(x,y,z) = x & starts_of(x,y,z) = y & trans_of(x,y,z) = z" |
|
205 |
apply (simp add: ioa_projections) |
|
206 |
done |
|
207 |
||
208 |
lemma trans_in_actions: |
|
209 |
"[| IOA(A); (s1,a,s2):trans_of(A) |] ==> a:actions(asig_of(A))" |
|
210 |
apply (unfold ioa_def state_trans_def actions_def is_asig_def) |
|
211 |
apply (erule conjE)+ |
|
212 |
apply (erule allE, erule impE, assumption) |
|
213 |
apply simp |
|
214 |
done |
|
215 |
||
216 |
||
217 |
lemma filter_oseq_idemp: "filter_oseq p (filter_oseq p s) = filter_oseq p s" |
|
218 |
apply (simp add: filter_oseq_def) |
|
219 |
apply (rule ext) |
|
220 |
apply (case_tac "s i") |
|
221 |
apply simp_all |
|
222 |
done |
|
223 |
||
224 |
lemma mk_trace_thm: |
|
225 |
"(mk_trace A s n = None) = |
|
226 |
(s(n)=None | (? a. s(n)=Some(a) & a ~: externals(asig_of(A)))) |
|
227 |
& |
|
228 |
(mk_trace A s n = Some(a)) = |
|
229 |
(s(n)=Some(a) & a : externals(asig_of(A)))" |
|
230 |
apply (unfold mk_trace_def filter_oseq_def) |
|
231 |
apply (case_tac "s n") |
|
232 |
apply auto |
|
233 |
done |
|
234 |
||
235 |
lemma reachable_0: "s:starts_of(A) ==> reachable A s" |
|
236 |
apply (unfold reachable_def) |
|
237 |
apply (rule_tac x = "(%i. None, %i. s)" in bexI) |
|
238 |
apply simp |
|
239 |
apply (simp add: exec_rws) |
|
240 |
done |
|
241 |
||
242 |
lemma reachable_n: |
|
243 |
"!!A. [| reachable A s; (s,a,t) : trans_of(A) |] ==> reachable A t" |
|
244 |
apply (unfold reachable_def exec_rws) |
|
245 |
apply (simp del: bex_simps) |
|
246 |
apply (simp (no_asm_simp) only: split_tupled_all) |
|
247 |
apply safe |
|
248 |
apply (rename_tac ex1 ex2 n) |
|
249 |
apply (rule_tac x = "(%i. if i<n then ex1 i else (if i=n then Some a else None) , %i. if i<Suc n then ex2 i else t)" in bexI) |
|
250 |
apply (rule_tac x = "Suc n" in exI) |
|
251 |
apply (simp (no_asm)) |
|
252 |
apply simp |
|
24742
73b8b42a36b6
removal of some "ref"s from res_axioms.ML; a side-effect is that the ordering
paulson
parents:
19801
diff
changeset
|
253 |
apply (metis ioa_triple_proj less_antisym) |
19801 | 254 |
done |
255 |
||
256 |
||
257 |
lemma invariantI: |
|
258 |
assumes p1: "!!s. s:starts_of(A) ==> P(s)" |
|
259 |
and p2: "!!s t a. [|reachable A s; P(s)|] ==> (s,a,t): trans_of(A) --> P(t)" |
|
260 |
shows "invariant A P" |
|
261 |
apply (unfold invariant_def reachable_def Let_def exec_rws) |
|
262 |
apply safe |
|
263 |
apply (rename_tac ex1 ex2 n) |
|
264 |
apply (rule_tac Q = "reachable A (ex2 n) " in conjunct1) |
|
265 |
apply simp |
|
266 |
apply (induct_tac n) |
|
267 |
apply (fast intro: p1 reachable_0) |
|
268 |
apply (erule_tac x = na in allE) |
|
269 |
apply (case_tac "ex1 na", simp_all) |
|
270 |
apply safe |
|
271 |
apply (erule p2 [THEN mp]) |
|
272 |
apply (fast dest: reachable_n)+ |
|
273 |
done |
|
274 |
||
275 |
lemma invariantI1: |
|
276 |
"[| !!s. s : starts_of(A) ==> P(s); |
|
277 |
!!s t a. reachable A s ==> P(s) --> (s,a,t):trans_of(A) --> P(t) |
|
278 |
|] ==> invariant A P" |
|
279 |
apply (blast intro!: invariantI) |
|
280 |
done |
|
281 |
||
282 |
lemma invariantE: |
|
283 |
"[| invariant A P; reachable A s |] ==> P(s)" |
|
284 |
apply (unfold invariant_def) |
|
285 |
apply blast |
|
286 |
done |
|
287 |
||
288 |
lemma actions_asig_comp: |
|
289 |
"actions(asig_comp a b) = actions(a) Un actions(b)" |
|
290 |
apply (auto simp add: actions_def asig_comp_def asig_projections) |
|
291 |
done |
|
292 |
||
293 |
lemma starts_of_par: |
|
294 |
"starts_of(A || B) = {p. fst(p):starts_of(A) & snd(p):starts_of(B)}" |
|
295 |
apply (simp add: par_def ioa_projections) |
|
296 |
done |
|
297 |
||
298 |
(* Every state in an execution is reachable *) |
|
299 |
lemma states_of_exec_reachable: |
|
300 |
"ex:executions(A) ==> !n. reachable A (snd ex n)" |
|
301 |
apply (unfold reachable_def) |
|
302 |
apply fast |
|
303 |
done |
|
304 |
||
305 |
||
306 |
lemma trans_of_par4: |
|
307 |
"(s,a,t) : trans_of(A || B || C || D) = |
|
308 |
((a:actions(asig_of(A)) | a:actions(asig_of(B)) | a:actions(asig_of(C)) | |
|
309 |
a:actions(asig_of(D))) & |
|
310 |
(if a:actions(asig_of(A)) then (fst(s),a,fst(t)):trans_of(A) |
|
311 |
else fst t=fst s) & |
|
312 |
(if a:actions(asig_of(B)) then (fst(snd(s)),a,fst(snd(t))):trans_of(B) |
|
313 |
else fst(snd(t))=fst(snd(s))) & |
|
314 |
(if a:actions(asig_of(C)) then |
|
315 |
(fst(snd(snd(s))),a,fst(snd(snd(t)))):trans_of(C) |
|
316 |
else fst(snd(snd(t)))=fst(snd(snd(s)))) & |
|
317 |
(if a:actions(asig_of(D)) then |
|
318 |
(snd(snd(snd(s))),a,snd(snd(snd(t)))):trans_of(D) |
|
319 |
else snd(snd(snd(t)))=snd(snd(snd(s)))))" |
|
320 |
(*SLOW*) |
|
321 |
apply (simp (no_asm) add: par_def actions_asig_comp Pair_fst_snd_eq ioa_projections) |
|
322 |
done |
|
323 |
||
324 |
lemma cancel_restrict: "starts_of(restrict ioa acts) = starts_of(ioa) & |
|
325 |
trans_of(restrict ioa acts) = trans_of(ioa) & |
|
326 |
reachable (restrict ioa acts) s = reachable ioa s" |
|
327 |
apply (simp add: is_execution_fragment_def executions_def |
|
328 |
reachable_def restrict_def ioa_projections) |
|
329 |
done |
|
330 |
||
331 |
lemma asig_of_par: "asig_of(A || B) = asig_comp (asig_of A) (asig_of B)" |
|
332 |
apply (simp add: par_def ioa_projections) |
|
333 |
done |
|
334 |
||
335 |
||
336 |
lemma externals_of_par: "externals(asig_of(A1||A2)) = |
|
337 |
(externals(asig_of(A1)) Un externals(asig_of(A2)))" |
|
338 |
apply (simp add: externals_def asig_of_par asig_comp_def |
|
26806 | 339 |
asig_inputs_def asig_outputs_def Un_def set_diff_eq) |
19801 | 340 |
apply blast |
341 |
done |
|
342 |
||
343 |
lemma ext1_is_not_int2: |
|
344 |
"[| compat_ioas A1 A2; a:externals(asig_of(A1))|] ==> a~:internals(asig_of(A2))" |
|
345 |
apply (unfold externals_def actions_def compat_ioas_def compat_asigs_def) |
|
346 |
apply auto |
|
347 |
done |
|
348 |
||
349 |
lemma ext2_is_not_int1: |
|
350 |
"[| compat_ioas A2 A1 ; a:externals(asig_of(A1))|] ==> a~:internals(asig_of(A2))" |
|
351 |
apply (unfold externals_def actions_def compat_ioas_def compat_asigs_def) |
|
352 |
apply auto |
|
353 |
done |
|
354 |
||
355 |
lemmas ext1_ext2_is_not_act2 = ext1_is_not_int2 [THEN int_and_ext_is_act] |
|
356 |
and ext1_ext2_is_not_act1 = ext2_is_not_int1 [THEN int_and_ext_is_act] |
|
17288 | 357 |
|
358 |
end |