author | wenzelm |
Sat, 14 Jun 2008 23:19:51 +0200 | |
changeset 27208 | 5fe899199f85 |
parent 26359 | 6d437bde2f1d |
child 32149 | ef59550a55d3 |
permissions | -rw-r--r-- |
3071 | 1 |
(* Title: HOLCF/IOA/meta_theory/CompoScheds.thy |
3275 | 2 |
ID: $Id$ |
12218 | 3 |
Author: Olaf Müller |
17233 | 4 |
*) |
3071 | 5 |
|
17233 | 6 |
header {* Compositionality on Schedule level *} |
3071 | 7 |
|
17233 | 8 |
theory CompoScheds |
9 |
imports CompoExecs |
|
10 |
begin |
|
3071 | 11 |
|
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
12 |
definition |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
13 |
mkex2 :: "('a,'s)ioa => ('a,'t)ioa => 'a Seq -> |
17233 | 14 |
('a,'s)pairs -> ('a,'t)pairs -> |
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
15 |
('s => 't => ('a,'s*'t)pairs)" where |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
16 |
"mkex2 A B = (fix$(LAM h sch exA exB. (%s t. case sch of |
3071 | 17 |
nil => nil |
17233 | 18 |
| x##xs => |
19 |
(case x of |
|
12028 | 20 |
UU => UU |
17233 | 21 |
| Def y => |
22 |
(if y:act A then |
|
23 |
(if y:act B then |
|
10835 | 24 |
(case HD$exA of |
12028 | 25 |
UU => UU |
10835 | 26 |
| Def a => (case HD$exB of |
12028 | 27 |
UU => UU |
17233 | 28 |
| Def b => |
3071 | 29 |
(y,(snd a,snd b))>> |
10835 | 30 |
(h$xs$(TL$exA)$(TL$exB)) (snd a) (snd b))) |
3071 | 31 |
else |
10835 | 32 |
(case HD$exA of |
12028 | 33 |
UU => UU |
17233 | 34 |
| Def a => |
10835 | 35 |
(y,(snd a,t))>>(h$xs$(TL$exA)$exB) (snd a) t) |
3071 | 36 |
) |
17233 | 37 |
else |
38 |
(if y:act B then |
|
10835 | 39 |
(case HD$exB of |
12028 | 40 |
UU => UU |
17233 | 41 |
| Def b => |
10835 | 42 |
(y,(s,snd b))>>(h$xs$exA$(TL$exB)) s (snd b)) |
3071 | 43 |
else |
44 |
UU |
|
45 |
) |
|
46 |
) |
|
47 |
))))" |
|
48 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
49 |
definition |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
50 |
mkex :: "('a,'s)ioa => ('a,'t)ioa => 'a Seq => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
51 |
('a,'s)execution => ('a,'t)execution =>('a,'s*'t)execution" where |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
52 |
"mkex A B sch exA exB = |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
53 |
((fst exA,fst exB), |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
54 |
(mkex2 A B$sch$(snd exA)$(snd exB)) (fst exA) (fst exB))" |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
55 |
|
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
56 |
definition |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
57 |
par_scheds ::"['a schedule_module,'a schedule_module] => 'a schedule_module" where |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
58 |
"par_scheds SchedsA SchedsB = |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
59 |
(let schA = fst SchedsA; sigA = snd SchedsA; |
17233 | 60 |
schB = fst SchedsB; sigB = snd SchedsB |
3521 | 61 |
in |
10835 | 62 |
( {sch. Filter (%a. a:actions sigA)$sch : schA} |
63 |
Int {sch. Filter (%a. a:actions sigB)$sch : schB} |
|
3521 | 64 |
Int {sch. Forall (%x. x:(actions sigA Un actions sigB)) sch}, |
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
65 |
asig_comp sigA sigB))" |
3521 | 66 |
|
19741 | 67 |
|
68 |
declare surjective_pairing [symmetric, simp] |
|
69 |
||
70 |
||
71 |
subsection "mkex rewrite rules" |
|
72 |
||
73 |
||
74 |
lemma mkex2_unfold: |
|
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
75 |
"mkex2 A B = (LAM sch exA exB. (%s t. case sch of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
76 |
nil => nil |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
77 |
| x##xs => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
78 |
(case x of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
79 |
UU => UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
80 |
| Def y => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
81 |
(if y:act A then |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
82 |
(if y:act B then |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
83 |
(case HD$exA of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
84 |
UU => UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
85 |
| Def a => (case HD$exB of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
86 |
UU => UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
87 |
| Def b => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
88 |
(y,(snd a,snd b))>> |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
89 |
(mkex2 A B$xs$(TL$exA)$(TL$exB)) (snd a) (snd b))) |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
90 |
else |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
91 |
(case HD$exA of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
92 |
UU => UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
93 |
| Def a => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
94 |
(y,(snd a,t))>>(mkex2 A B$xs$(TL$exA)$exB) (snd a) t) |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
95 |
) |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
96 |
else |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
97 |
(if y:act B then |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
98 |
(case HD$exB of |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
99 |
UU => UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
100 |
| Def b => |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
101 |
(y,(s,snd b))>>(mkex2 A B$xs$exA$(TL$exB)) s (snd b)) |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
102 |
else |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
103 |
UU |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
104 |
) |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
105 |
) |
19741 | 106 |
)))" |
107 |
apply (rule trans) |
|
108 |
apply (rule fix_eq2) |
|
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
109 |
apply (simp only: mkex2_def) |
19741 | 110 |
apply (rule beta_cfun) |
111 |
apply simp |
|
112 |
done |
|
113 |
||
114 |
lemma mkex2_UU: "(mkex2 A B$UU$exA$exB) s t = UU" |
|
115 |
apply (subst mkex2_unfold) |
|
116 |
apply simp |
|
117 |
done |
|
118 |
||
119 |
lemma mkex2_nil: "(mkex2 A B$nil$exA$exB) s t= nil" |
|
120 |
apply (subst mkex2_unfold) |
|
121 |
apply simp |
|
122 |
done |
|
123 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
124 |
lemma mkex2_cons_1: "[| x:act A; x~:act B; HD$exA=Def a|] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
125 |
==> (mkex2 A B$(x>>sch)$exA$exB) s t = |
19741 | 126 |
(x,snd a,t) >> (mkex2 A B$sch$(TL$exA)$exB) (snd a) t" |
127 |
apply (rule trans) |
|
128 |
apply (subst mkex2_unfold) |
|
129 |
apply (simp add: Consq_def If_and_if) |
|
130 |
apply (simp add: Consq_def) |
|
131 |
done |
|
132 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
133 |
lemma mkex2_cons_2: "[| x~:act A; x:act B; HD$exB=Def b|] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
134 |
==> (mkex2 A B$(x>>sch)$exA$exB) s t = |
19741 | 135 |
(x,s,snd b) >> (mkex2 A B$sch$exA$(TL$exB)) s (snd b)" |
136 |
apply (rule trans) |
|
137 |
apply (subst mkex2_unfold) |
|
138 |
apply (simp add: Consq_def If_and_if) |
|
139 |
apply (simp add: Consq_def) |
|
140 |
done |
|
141 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
142 |
lemma mkex2_cons_3: "[| x:act A; x:act B; HD$exA=Def a;HD$exB=Def b|] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
143 |
==> (mkex2 A B$(x>>sch)$exA$exB) s t = |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
144 |
(x,snd a,snd b) >> |
19741 | 145 |
(mkex2 A B$sch$(TL$exA)$(TL$exB)) (snd a) (snd b)" |
146 |
apply (rule trans) |
|
147 |
apply (subst mkex2_unfold) |
|
148 |
apply (simp add: Consq_def If_and_if) |
|
149 |
apply (simp add: Consq_def) |
|
150 |
done |
|
151 |
||
152 |
declare mkex2_UU [simp] mkex2_nil [simp] mkex2_cons_1 [simp] |
|
153 |
mkex2_cons_2 [simp] mkex2_cons_3 [simp] |
|
154 |
||
155 |
||
156 |
subsection {* mkex *} |
|
157 |
||
158 |
lemma mkex_UU: "mkex A B UU (s,exA) (t,exB) = ((s,t),UU)" |
|
159 |
apply (simp add: mkex_def) |
|
160 |
done |
|
161 |
||
162 |
lemma mkex_nil: "mkex A B nil (s,exA) (t,exB) = ((s,t),nil)" |
|
163 |
apply (simp add: mkex_def) |
|
164 |
done |
|
165 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
166 |
lemma mkex_cons_1: "[| x:act A; x~:act B |] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
167 |
==> mkex A B (x>>sch) (s,a>>exA) (t,exB) = |
19741 | 168 |
((s,t), (x,snd a,t) >> snd (mkex A B sch (snd a,exA) (t,exB)))" |
169 |
apply (simp (no_asm) add: mkex_def) |
|
170 |
apply (cut_tac exA = "a>>exA" in mkex2_cons_1) |
|
171 |
apply auto |
|
172 |
done |
|
173 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
174 |
lemma mkex_cons_2: "[| x~:act A; x:act B |] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
175 |
==> mkex A B (x>>sch) (s,exA) (t,b>>exB) = |
19741 | 176 |
((s,t), (x,s,snd b) >> snd (mkex A B sch (s,exA) (snd b,exB)))" |
177 |
apply (simp (no_asm) add: mkex_def) |
|
178 |
apply (cut_tac exB = "b>>exB" in mkex2_cons_2) |
|
179 |
apply auto |
|
180 |
done |
|
181 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
182 |
lemma mkex_cons_3: "[| x:act A; x:act B |] |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
183 |
==> mkex A B (x>>sch) (s,a>>exA) (t,b>>exB) = |
19741 | 184 |
((s,t), (x,snd a,snd b) >> snd (mkex A B sch (snd a,exA) (snd b,exB)))" |
185 |
apply (simp (no_asm) add: mkex_def) |
|
186 |
apply (cut_tac exB = "b>>exB" and exA = "a>>exA" in mkex2_cons_3) |
|
187 |
apply auto |
|
188 |
done |
|
189 |
||
190 |
declare mkex2_UU [simp del] mkex2_nil [simp del] |
|
191 |
mkex2_cons_1 [simp del] mkex2_cons_2 [simp del] mkex2_cons_3 [simp del] |
|
192 |
||
193 |
lemmas composch_simps = mkex_UU mkex_nil mkex_cons_1 mkex_cons_2 mkex_cons_3 |
|
194 |
||
195 |
declare composch_simps [simp] |
|
196 |
||
197 |
||
198 |
subsection {* COMPOSITIONALITY on SCHEDULE Level *} |
|
199 |
||
200 |
subsubsection "Lemmas for ==>" |
|
201 |
||
202 |
(* --------------------------------------------------------------------- *) |
|
203 |
(* Lemma_2_1 : tfilter(ex) and filter_act are commutative *) |
|
204 |
(* --------------------------------------------------------------------- *) |
|
205 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
206 |
lemma lemma_2_1a: |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
207 |
"filter_act$(Filter_ex2 (asig_of A)$xs)= |
19741 | 208 |
Filter (%a. a:act A)$(filter_act$xs)" |
209 |
||
210 |
apply (unfold filter_act_def Filter_ex2_def) |
|
211 |
apply (simp (no_asm) add: MapFilter o_def) |
|
212 |
done |
|
213 |
||
214 |
||
215 |
(* --------------------------------------------------------------------- *) |
|
216 |
(* Lemma_2_2 : State-projections do not affect filter_act *) |
|
217 |
(* --------------------------------------------------------------------- *) |
|
218 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
219 |
lemma lemma_2_1b: |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
220 |
"filter_act$(ProjA2$xs) =filter_act$xs & |
19741 | 221 |
filter_act$(ProjB2$xs) =filter_act$xs" |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
222 |
apply (tactic {* pair_induct_tac @{context} "xs" [] 1 *}) |
19741 | 223 |
done |
224 |
||
225 |
||
226 |
(* --------------------------------------------------------------------- *) |
|
227 |
(* Schedules of A||B have only A- or B-actions *) |
|
228 |
(* --------------------------------------------------------------------- *) |
|
229 |
||
230 |
(* very similar to lemma_1_1c, but it is not checking if every action element of |
|
231 |
an ex is in A or B, but after projecting it onto the action schedule. Of course, this |
|
232 |
is the same proposition, but we cannot change this one, when then rather lemma_1_1c *) |
|
233 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
234 |
lemma sch_actions_in_AorB: "!s. is_exec_frag (A||B) (s,xs) |
19741 | 235 |
--> Forall (%x. x:act (A||B)) (filter_act$xs)" |
236 |
||
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
237 |
apply (tactic {* pair_induct_tac @{context} "xs" [@{thm is_exec_frag_def}, @{thm Forall_def}, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
238 |
@{thm sforall_def}] 1 *}) |
19741 | 239 |
(* main case *) |
26359 | 240 |
apply auto |
241 |
apply (simp add: trans_of_defs2 actions_asig_comp asig_of_par) |
|
19741 | 242 |
done |
243 |
||
244 |
||
245 |
subsubsection "Lemmas for <==" |
|
246 |
||
247 |
(*--------------------------------------------------------------------------- |
|
248 |
Filtering actions out of mkex(sch,exA,exB) yields the oracle sch |
|
249 |
structural induction |
|
250 |
--------------------------------------------------------------------------- *) |
|
251 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
252 |
lemma Mapfst_mkex_is_sch: "! exA exB s t. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
253 |
Forall (%x. x:act (A||B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
254 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
255 |
Filter (%a. a:act B)$sch << filter_act$exB |
19741 | 256 |
--> filter_act$(snd (mkex A B sch (s,exA) (t,exB))) = sch" |
257 |
||
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
258 |
apply (tactic {* Seq_induct_tac @{context} "sch" [@{thm Filter_def}, @{thm Forall_def}, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
259 |
@{thm sforall_def}, @{thm mkex_def}] 1 *}) |
19741 | 260 |
|
261 |
(* main case *) |
|
262 |
(* splitting into 4 cases according to a:A, a:B *) |
|
26359 | 263 |
apply auto |
19741 | 264 |
|
265 |
(* Case y:A, y:B *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
266 |
apply (tactic {* Seq_case_simp_tac @{context} "exA" 1 *}) |
19741 | 267 |
(* Case exA=UU, Case exA=nil*) |
268 |
(* These UU and nil cases are the only places where the assumption filter A sch<<f_act exA |
|
269 |
is used! --> to generate a contradiction using ~a>>ss<< UU(nil), using theorems |
|
270 |
Cons_not_less_UU and Cons_not_less_nil *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
271 |
apply (tactic {* Seq_case_simp_tac @{context} "exB" 1 *}) |
19741 | 272 |
(* Case exA=a>>x, exB=b>>y *) |
273 |
(* here it is important that Seq_case_simp_tac uses no !full!_simp_tac for the cons case, |
|
274 |
as otherwise mkex_cons_3 would not be rewritten without use of rotate_tac: then tactic |
|
275 |
would not be generally applicable *) |
|
276 |
apply simp |
|
277 |
||
278 |
(* Case y:A, y~:B *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
279 |
apply (tactic {* Seq_case_simp_tac @{context} "exA" 1 *}) |
19741 | 280 |
apply simp |
281 |
||
282 |
(* Case y~:A, y:B *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
283 |
apply (tactic {* Seq_case_simp_tac @{context} "exB" 1 *}) |
19741 | 284 |
apply simp |
285 |
||
286 |
(* Case y~:A, y~:B *) |
|
287 |
apply (simp add: asig_of_par actions_asig_comp) |
|
288 |
done |
|
289 |
||
290 |
||
291 |
(* generalizing the proof above to a tactic *) |
|
292 |
||
293 |
ML {* |
|
294 |
||
295 |
local |
|
296 |
val defs = [thm "Filter_def", thm "Forall_def", thm "sforall_def", thm "mkex_def", |
|
297 |
thm "stutter_def"] |
|
298 |
val asigs = [thm "asig_of_par", thm "actions_asig_comp"] |
|
299 |
in |
|
300 |
||
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
301 |
fun mkex_induct_tac ctxt sch exA exB = |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
302 |
let val ss = Simplifier.local_simpset_of ctxt in |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
303 |
EVERY1[Seq_induct_tac ctxt sch defs, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
304 |
asm_full_simp_tac ss, |
26359 | 305 |
SELECT_GOAL (safe_tac (claset_of @{theory Fun})), |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
306 |
Seq_case_simp_tac ctxt exA, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
307 |
Seq_case_simp_tac ctxt exB, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
308 |
asm_full_simp_tac ss, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
309 |
Seq_case_simp_tac ctxt exA, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
310 |
asm_full_simp_tac ss, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
311 |
Seq_case_simp_tac ctxt exB, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
312 |
asm_full_simp_tac ss, |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
313 |
asm_full_simp_tac (ss addsimps asigs) |
19741 | 314 |
] |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
315 |
end |
17233 | 316 |
|
3521 | 317 |
end |
19741 | 318 |
*} |
319 |
||
320 |
||
321 |
(*--------------------------------------------------------------------------- |
|
322 |
Projection of mkex(sch,exA,exB) onto A stutters on A |
|
323 |
structural induction |
|
324 |
--------------------------------------------------------------------------- *) |
|
325 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
326 |
lemma stutterA_mkex: "! exA exB s t. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
327 |
Forall (%x. x:act (A||B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
328 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
329 |
Filter (%a. a:act B)$sch << filter_act$exB |
19741 | 330 |
--> stutter (asig_of A) (s,ProjA2$(snd (mkex A B sch (s,exA) (t,exB))))" |
331 |
||
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
332 |
apply (tactic {* mkex_induct_tac @{context} "sch" "exA" "exB" *}) |
19741 | 333 |
done |
334 |
||
335 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
336 |
lemma stutter_mkex_on_A: "[| |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
337 |
Forall (%x. x:act (A||B)) sch ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
338 |
Filter (%a. a:act A)$sch << filter_act$(snd exA) ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
339 |
Filter (%a. a:act B)$sch << filter_act$(snd exB) |] |
19741 | 340 |
==> stutter (asig_of A) (ProjA (mkex A B sch exA exB))" |
341 |
||
342 |
apply (cut_tac stutterA_mkex) |
|
343 |
apply (simp add: stutter_def ProjA_def mkex_def) |
|
344 |
apply (erule allE)+ |
|
345 |
apply (drule mp) |
|
346 |
prefer 2 apply (assumption) |
|
347 |
apply simp |
|
348 |
done |
|
349 |
||
350 |
||
351 |
(*--------------------------------------------------------------------------- |
|
352 |
Projection of mkex(sch,exA,exB) onto B stutters on B |
|
353 |
structural induction |
|
354 |
--------------------------------------------------------------------------- *) |
|
355 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
356 |
lemma stutterB_mkex: "! exA exB s t. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
357 |
Forall (%x. x:act (A||B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
358 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
359 |
Filter (%a. a:act B)$sch << filter_act$exB |
19741 | 360 |
--> stutter (asig_of B) (t,ProjB2$(snd (mkex A B sch (s,exA) (t,exB))))" |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
361 |
apply (tactic {* mkex_induct_tac @{context} "sch" "exA" "exB" *}) |
19741 | 362 |
done |
363 |
||
364 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
365 |
lemma stutter_mkex_on_B: "[| |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
366 |
Forall (%x. x:act (A||B)) sch ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
367 |
Filter (%a. a:act A)$sch << filter_act$(snd exA) ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
368 |
Filter (%a. a:act B)$sch << filter_act$(snd exB) |] |
19741 | 369 |
==> stutter (asig_of B) (ProjB (mkex A B sch exA exB))" |
370 |
apply (cut_tac stutterB_mkex) |
|
371 |
apply (simp add: stutter_def ProjB_def mkex_def) |
|
372 |
apply (erule allE)+ |
|
373 |
apply (drule mp) |
|
374 |
prefer 2 apply (assumption) |
|
375 |
apply simp |
|
376 |
done |
|
377 |
||
378 |
||
379 |
(*--------------------------------------------------------------------------- |
|
380 |
Filter of mkex(sch,exA,exB) to A after projection onto A is exA |
|
381 |
-- using zip$(proj1$exA)$(proj2$exA) instead of exA -- |
|
382 |
-- because of admissibility problems -- |
|
383 |
structural induction |
|
384 |
--------------------------------------------------------------------------- *) |
|
385 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
386 |
lemma filter_mkex_is_exA_tmp: "! exA exB s t. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
387 |
Forall (%x. x:act (A||B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
388 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
389 |
Filter (%a. a:act B)$sch << filter_act$exB |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
390 |
--> Filter_ex2 (asig_of A)$(ProjA2$(snd (mkex A B sch (s,exA) (t,exB)))) = |
19741 | 391 |
Zip$(Filter (%a. a:act A)$sch)$(Map snd$exA)" |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
392 |
apply (tactic {* mkex_induct_tac @{context} "sch" "exB" "exA" *}) |
19741 | 393 |
done |
394 |
||
395 |
(*--------------------------------------------------------------------------- |
|
396 |
zip$(proj1$y)$(proj2$y) = y (using the lift operations) |
|
397 |
lemma for admissibility problems |
|
398 |
--------------------------------------------------------------------------- *) |
|
399 |
||
400 |
lemma Zip_Map_fst_snd: "Zip$(Map fst$y)$(Map snd$y) = y" |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
401 |
apply (tactic {* Seq_induct_tac @{context} "y" [] 1 *}) |
19741 | 402 |
done |
403 |
||
404 |
||
405 |
(*--------------------------------------------------------------------------- |
|
406 |
filter A$sch = proj1$ex --> zip$(filter A$sch)$(proj2$ex) = ex |
|
407 |
lemma for eliminating non admissible equations in assumptions |
|
408 |
--------------------------------------------------------------------------- *) |
|
409 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
410 |
lemma trick_against_eq_in_ass: "!! sch ex. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
411 |
Filter (%a. a:act AB)$sch = filter_act$ex |
19741 | 412 |
==> ex = Zip$(Filter (%a. a:act AB)$sch)$(Map snd$ex)" |
413 |
apply (simp add: filter_act_def) |
|
414 |
apply (rule Zip_Map_fst_snd [symmetric]) |
|
415 |
done |
|
416 |
||
417 |
(*--------------------------------------------------------------------------- |
|
418 |
Filter of mkex(sch,exA,exB) to A after projection onto A is exA |
|
419 |
using the above trick |
|
420 |
--------------------------------------------------------------------------- *) |
|
421 |
||
422 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
423 |
lemma filter_mkex_is_exA: "!!sch exA exB. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
424 |
[| Forall (%a. a:act (A||B)) sch ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
425 |
Filter (%a. a:act A)$sch = filter_act$(snd exA) ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
426 |
Filter (%a. a:act B)$sch = filter_act$(snd exB) |] |
19741 | 427 |
==> Filter_ex (asig_of A) (ProjA (mkex A B sch exA exB)) = exA" |
428 |
apply (simp add: ProjA_def Filter_ex_def) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
429 |
apply (tactic {* pair_tac @{context} "exA" 1 *}) |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
430 |
apply (tactic {* pair_tac @{context} "exB" 1 *}) |
19741 | 431 |
apply (rule conjI) |
432 |
apply (simp (no_asm) add: mkex_def) |
|
433 |
apply (simplesubst trick_against_eq_in_ass) |
|
434 |
back |
|
435 |
apply assumption |
|
436 |
apply (simp add: filter_mkex_is_exA_tmp) |
|
437 |
done |
|
438 |
||
439 |
||
440 |
(*--------------------------------------------------------------------------- |
|
441 |
Filter of mkex(sch,exA,exB) to B after projection onto B is exB |
|
442 |
-- using zip$(proj1$exB)$(proj2$exB) instead of exB -- |
|
443 |
-- because of admissibility problems -- |
|
444 |
structural induction |
|
445 |
--------------------------------------------------------------------------- *) |
|
446 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
447 |
lemma filter_mkex_is_exB_tmp: "! exA exB s t. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
448 |
Forall (%x. x:act (A||B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
449 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
450 |
Filter (%a. a:act B)$sch << filter_act$exB |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
451 |
--> Filter_ex2 (asig_of B)$(ProjB2$(snd (mkex A B sch (s,exA) (t,exB)))) = |
19741 | 452 |
Zip$(Filter (%a. a:act B)$sch)$(Map snd$exB)" |
453 |
||
454 |
(* notice necessary change of arguments exA and exB *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
455 |
apply (tactic {* mkex_induct_tac @{context} "sch" "exA" "exB" *}) |
19741 | 456 |
done |
457 |
||
458 |
||
459 |
(*--------------------------------------------------------------------------- |
|
460 |
Filter of mkex(sch,exA,exB) to A after projection onto B is exB |
|
461 |
using the above trick |
|
462 |
--------------------------------------------------------------------------- *) |
|
463 |
||
464 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
465 |
lemma filter_mkex_is_exB: "!!sch exA exB. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
466 |
[| Forall (%a. a:act (A||B)) sch ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
467 |
Filter (%a. a:act A)$sch = filter_act$(snd exA) ; |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
468 |
Filter (%a. a:act B)$sch = filter_act$(snd exB) |] |
19741 | 469 |
==> Filter_ex (asig_of B) (ProjB (mkex A B sch exA exB)) = exB" |
470 |
apply (simp add: ProjB_def Filter_ex_def) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
471 |
apply (tactic {* pair_tac @{context} "exA" 1 *}) |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
472 |
apply (tactic {* pair_tac @{context} "exB" 1 *}) |
19741 | 473 |
apply (rule conjI) |
474 |
apply (simp (no_asm) add: mkex_def) |
|
475 |
apply (simplesubst trick_against_eq_in_ass) |
|
476 |
back |
|
477 |
apply assumption |
|
478 |
apply (simp add: filter_mkex_is_exB_tmp) |
|
479 |
done |
|
480 |
||
481 |
(* --------------------------------------------------------------------- *) |
|
482 |
(* mkex has only A- or B-actions *) |
|
483 |
(* --------------------------------------------------------------------- *) |
|
484 |
||
485 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
486 |
lemma mkex_actions_in_AorB: "!s t exA exB. |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
487 |
Forall (%x. x : act (A || B)) sch & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
488 |
Filter (%a. a:act A)$sch << filter_act$exA & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
489 |
Filter (%a. a:act B)$sch << filter_act$exB |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
490 |
--> Forall (%x. fst x : act (A ||B)) |
19741 | 491 |
(snd (mkex A B sch (s,exA) (t,exB)))" |
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
492 |
apply (tactic {* mkex_induct_tac @{context} "sch" "exA" "exB" *}) |
19741 | 493 |
done |
494 |
||
495 |
||
496 |
(* ------------------------------------------------------------------ *) |
|
497 |
(* COMPOSITIONALITY on SCHEDULE Level *) |
|
498 |
(* Main Theorem *) |
|
499 |
(* ------------------------------------------------------------------ *) |
|
500 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
501 |
lemma compositionality_sch: |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
502 |
"(sch : schedules (A||B)) = |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
503 |
(Filter (%a. a:act A)$sch : schedules A & |
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
504 |
Filter (%a. a:act B)$sch : schedules B & |
19741 | 505 |
Forall (%x. x:act (A||B)) sch)" |
506 |
apply (simp (no_asm) add: schedules_def has_schedule_def) |
|
26359 | 507 |
apply auto |
19741 | 508 |
(* ==> *) |
509 |
apply (rule_tac x = "Filter_ex (asig_of A) (ProjA ex) " in bexI) |
|
510 |
prefer 2 |
|
511 |
apply (simp add: compositionality_ex) |
|
512 |
apply (simp (no_asm) add: Filter_ex_def ProjA_def lemma_2_1a lemma_2_1b) |
|
513 |
apply (rule_tac x = "Filter_ex (asig_of B) (ProjB ex) " in bexI) |
|
514 |
prefer 2 |
|
515 |
apply (simp add: compositionality_ex) |
|
516 |
apply (simp (no_asm) add: Filter_ex_def ProjB_def lemma_2_1a lemma_2_1b) |
|
517 |
apply (simp add: executions_def) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
518 |
apply (tactic {* pair_tac @{context} "ex" 1 *}) |
19741 | 519 |
apply (erule conjE) |
520 |
apply (simp add: sch_actions_in_AorB) |
|
521 |
||
522 |
(* <== *) |
|
523 |
||
524 |
(* mkex is exactly the construction of exA||B out of exA, exB, and the oracle sch, |
|
525 |
we need here *) |
|
526 |
apply (rename_tac exA exB) |
|
527 |
apply (rule_tac x = "mkex A B sch exA exB" in bexI) |
|
528 |
(* mkex actions are just the oracle *) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
529 |
apply (tactic {* pair_tac @{context} "exA" 1 *}) |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
530 |
apply (tactic {* pair_tac @{context} "exB" 1 *}) |
19741 | 531 |
apply (simp add: Mapfst_mkex_is_sch) |
532 |
||
533 |
(* mkex is an execution -- use compositionality on ex-level *) |
|
534 |
apply (simp add: compositionality_ex) |
|
535 |
apply (simp add: stutter_mkex_on_A stutter_mkex_on_B filter_mkex_is_exB filter_mkex_is_exA) |
|
27208
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
536 |
apply (tactic {* pair_tac @{context} "exA" 1 *}) |
5fe899199f85
proper context for tactics derived from res_inst_tac;
wenzelm
parents:
26359
diff
changeset
|
537 |
apply (tactic {* pair_tac @{context} "exB" 1 *}) |
19741 | 538 |
apply (simp add: mkex_actions_in_AorB) |
539 |
done |
|
540 |
||
541 |
||
542 |
subsection {* COMPOSITIONALITY on SCHEDULE Level -- for Modules *} |
|
543 |
||
25135
4f8176c940cf
modernized specifications ('definition', 'axiomatization');
wenzelm
parents:
19741
diff
changeset
|
544 |
lemma compositionality_sch_modules: |
19741 | 545 |
"Scheds (A||B) = par_scheds (Scheds A) (Scheds B)" |
546 |
||
547 |
apply (unfold Scheds_def par_scheds_def) |
|
548 |
apply (simp add: asig_of_par) |
|
549 |
apply (rule set_ext) |
|
550 |
apply (simp add: compositionality_sch actions_of_par) |
|
551 |
done |
|
552 |
||
553 |
||
554 |
declare compoex_simps [simp del] |
|
555 |
declare composch_simps [simp del] |
|
556 |
||
557 |
end |