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