| author | wenzelm | 
| Tue, 11 Feb 2014 21:58:31 +0100 | |
| changeset 55432 | 9c53198dbb1c | 
| parent 48194 | 1440a3103af0 | 
| child 58318 | f95754ca7082 | 
| permissions | -rw-r--r-- | 
| 42151 | 1  | 
(* Title: HOL/HOLCF/IOA/meta_theory/CompoTraces.thy  | 
| 40945 | 2  | 
Author: Olaf Müller  | 
| 3071 | 3  | 
*)  | 
4  | 
||
| 17233 | 5  | 
header {* Compositionality on Trace level *}
 | 
6  | 
||
7  | 
theory CompoTraces  | 
|
8  | 
imports CompoScheds ShortExecutions  | 
|
9  | 
begin  | 
|
| 3071 | 10  | 
|
11  | 
||
12  | 
consts  | 
|
13  | 
||
| 3521 | 14  | 
 mksch      ::"('a,'s)ioa => ('a,'t)ioa => 'a Seq -> 'a Seq -> 'a Seq -> 'a Seq" 
 | 
15  | 
par_traces ::"['a trace_module,'a trace_module] => 'a trace_module"  | 
|
| 3071 | 16  | 
|
17  | 
defs  | 
|
18  | 
||
| 17233 | 19  | 
mksch_def:  | 
| 10835 | 20  | 
"mksch A B == (fix$(LAM h tr schA schB. case tr of  | 
| 3071 | 21  | 
nil => nil  | 
22  | 
| x##xs =>  | 
|
23  | 
(case x of  | 
|
| 12028 | 24  | 
UU => UU  | 
| 3071 | 25  | 
| Def y =>  | 
26  | 
(if y:act A then  | 
|
27  | 
(if y:act B then  | 
|
| 10835 | 28  | 
((Takewhile (%a. a:int A)$schA)  | 
29  | 
@@ (Takewhile (%a. a:int B)$schB)  | 
|
30  | 
@@ (y>>(h$xs  | 
|
31  | 
$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
32  | 
$(TL$(Dropwhile (%a. a:int B)$schB))  | 
|
| 3071 | 33  | 
)))  | 
34  | 
else  | 
|
| 10835 | 35  | 
((Takewhile (%a. a:int A)$schA)  | 
36  | 
@@ (y>>(h$xs  | 
|
37  | 
$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
38  | 
$schB)))  | 
|
| 3071 | 39  | 
)  | 
40  | 
else  | 
|
41  | 
(if y:act B then  | 
|
| 10835 | 42  | 
((Takewhile (%a. a:int B)$schB)  | 
43  | 
@@ (y>>(h$xs  | 
|
44  | 
$schA  | 
|
45  | 
$(TL$(Dropwhile (%a. a:int B)$schB))  | 
|
| 3071 | 46  | 
)))  | 
47  | 
else  | 
|
48  | 
UU  | 
|
49  | 
)  | 
|
50  | 
)  | 
|
51  | 
)))"  | 
|
52  | 
||
53  | 
||
| 17233 | 54  | 
par_traces_def:  | 
| 3521 | 55  | 
"par_traces TracesA TracesB ==  | 
56  | 
let trA = fst TracesA; sigA = snd TracesA;  | 
|
57  | 
trB = fst TracesB; sigB = snd TracesB  | 
|
58  | 
in  | 
|
| 10835 | 59  | 
       (    {tr. Filter (%a. a:actions sigA)$tr : trA}
 | 
60  | 
        Int {tr. Filter (%a. a:actions sigB)$tr : trB}
 | 
|
| 3521 | 61  | 
        Int {tr. Forall (%x. x:(externals sigA Un externals sigB)) tr},
 | 
62  | 
asig_comp sigA sigB)"  | 
|
63  | 
||
| 47026 | 64  | 
axiomatization where  | 
| 3071 | 65  | 
|
| 17233 | 66  | 
finiteR_mksch:  | 
| 
48194
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
67  | 
"Finite (mksch A B$tr$x$y) \<Longrightarrow> Finite tr"  | 
| 
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
68  | 
|
| 
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
69  | 
lemma finiteR_mksch': "\<not> Finite tr \<Longrightarrow> \<not> Finite (mksch A B$tr$x$y)"  | 
| 
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
70  | 
by (blast intro: finiteR_mksch)  | 
| 3071 | 71  | 
|
| 19741 | 72  | 
|
| 
45625
 
750c5a47400b
modernized some old-style infix operations, which were left over from the time of ML proof scripts;
 
wenzelm 
parents: 
44890 
diff
changeset
 | 
73  | 
declaration {* fn _ => Simplifier.map_ss (Simplifier.set_mksym (K (K NONE))) *}
 | 
| 19741 | 74  | 
|
75  | 
||
76  | 
subsection "mksch rewrite rules"  | 
|
77  | 
||
78  | 
lemma mksch_unfold:  | 
|
79  | 
"mksch A B = (LAM tr schA schB. case tr of  | 
|
80  | 
nil => nil  | 
|
81  | 
| x##xs =>  | 
|
82  | 
(case x of  | 
|
83  | 
UU => UU  | 
|
84  | 
| Def y =>  | 
|
85  | 
(if y:act A then  | 
|
86  | 
(if y:act B then  | 
|
87  | 
((Takewhile (%a. a:int A)$schA)  | 
|
88  | 
@@(Takewhile (%a. a:int B)$schB)  | 
|
89  | 
@@(y>>(mksch A B$xs  | 
|
90  | 
$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
91  | 
$(TL$(Dropwhile (%a. a:int B)$schB))  | 
|
92  | 
)))  | 
|
93  | 
else  | 
|
94  | 
((Takewhile (%a. a:int A)$schA)  | 
|
95  | 
@@ (y>>(mksch A B$xs  | 
|
96  | 
$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
97  | 
$schB)))  | 
|
98  | 
)  | 
|
99  | 
else  | 
|
100  | 
(if y:act B then  | 
|
101  | 
((Takewhile (%a. a:int B)$schB)  | 
|
102  | 
@@ (y>>(mksch A B$xs  | 
|
103  | 
$schA  | 
|
104  | 
$(TL$(Dropwhile (%a. a:int B)$schB))  | 
|
105  | 
)))  | 
|
106  | 
else  | 
|
107  | 
UU  | 
|
108  | 
)  | 
|
109  | 
)  | 
|
110  | 
))"  | 
|
111  | 
apply (rule trans)  | 
|
112  | 
apply (rule fix_eq2)  | 
|
113  | 
apply (rule mksch_def)  | 
|
114  | 
apply (rule beta_cfun)  | 
|
115  | 
apply simp  | 
|
116  | 
done  | 
|
117  | 
||
118  | 
lemma mksch_UU: "mksch A B$UU$schA$schB = UU"  | 
|
119  | 
apply (subst mksch_unfold)  | 
|
120  | 
apply simp  | 
|
121  | 
done  | 
|
122  | 
||
123  | 
lemma mksch_nil: "mksch A B$nil$schA$schB = nil"  | 
|
124  | 
apply (subst mksch_unfold)  | 
|
125  | 
apply simp  | 
|
126  | 
done  | 
|
127  | 
||
128  | 
lemma mksch_cons1: "[|x:act A;x~:act B|]  | 
|
129  | 
==> mksch A B$(x>>tr)$schA$schB =  | 
|
130  | 
(Takewhile (%a. a:int A)$schA)  | 
|
131  | 
@@ (x>>(mksch A B$tr$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
132  | 
$schB))"  | 
|
133  | 
apply (rule trans)  | 
|
134  | 
apply (subst mksch_unfold)  | 
|
135  | 
apply (simp add: Consq_def If_and_if)  | 
|
136  | 
apply (simp add: Consq_def)  | 
|
137  | 
done  | 
|
138  | 
||
139  | 
lemma mksch_cons2: "[|x~:act A;x:act B|]  | 
|
140  | 
==> mksch A B$(x>>tr)$schA$schB =  | 
|
141  | 
(Takewhile (%a. a:int B)$schB)  | 
|
142  | 
@@ (x>>(mksch A B$tr$schA$(TL$(Dropwhile (%a. a:int B)$schB))  | 
|
143  | 
))"  | 
|
144  | 
apply (rule trans)  | 
|
145  | 
apply (subst mksch_unfold)  | 
|
146  | 
apply (simp add: Consq_def If_and_if)  | 
|
147  | 
apply (simp add: Consq_def)  | 
|
148  | 
done  | 
|
149  | 
||
150  | 
lemma mksch_cons3: "[|x:act A;x:act B|]  | 
|
151  | 
==> mksch A B$(x>>tr)$schA$schB =  | 
|
152  | 
(Takewhile (%a. a:int A)$schA)  | 
|
153  | 
@@ ((Takewhile (%a. a:int B)$schB)  | 
|
154  | 
@@ (x>>(mksch A B$tr$(TL$(Dropwhile (%a. a:int A)$schA))  | 
|
155  | 
$(TL$(Dropwhile (%a. a:int B)$schB))))  | 
|
156  | 
)"  | 
|
157  | 
apply (rule trans)  | 
|
158  | 
apply (subst mksch_unfold)  | 
|
159  | 
apply (simp add: Consq_def If_and_if)  | 
|
160  | 
apply (simp add: Consq_def)  | 
|
161  | 
done  | 
|
162  | 
||
163  | 
lemmas compotr_simps = mksch_UU mksch_nil mksch_cons1 mksch_cons2 mksch_cons3  | 
|
164  | 
||
165  | 
declare compotr_simps [simp]  | 
|
166  | 
||
167  | 
||
168  | 
subsection {* COMPOSITIONALITY on TRACE Level *}
 | 
|
169  | 
||
170  | 
subsubsection "Lemmata for ==>"  | 
|
171  | 
||
172  | 
(* Consequence out of ext1_ext2_is_not_act1(2), which in turn are consequences out of  | 
|
173  | 
the compatibility of IOA, in particular out of the condition that internals are  | 
|
174  | 
really hidden. *)  | 
|
175  | 
||
176  | 
lemma compatibility_consequence1: "(eB & ~eA --> ~A) -->  | 
|
177  | 
(A & (eA | eB)) = (eA & A)"  | 
|
178  | 
apply fast  | 
|
179  | 
done  | 
|
180  | 
||
181  | 
||
182  | 
(* very similar to above, only the commutativity of | is used to make a slight change *)  | 
|
183  | 
||
184  | 
lemma compatibility_consequence2: "(eB & ~eA --> ~A) -->  | 
|
185  | 
(A & (eB | eA)) = (eA & A)"  | 
|
186  | 
apply fast  | 
|
187  | 
done  | 
|
188  | 
||
189  | 
||
190  | 
subsubsection "Lemmata for <=="  | 
|
191  | 
||
192  | 
(* Lemma for substitution of looping assumption in another specific assumption *)  | 
|
193  | 
lemma subst_lemma1: "[| f << (g x) ; x=(h x) |] ==> f << g (h x)"  | 
|
194  | 
by (erule subst)  | 
|
195  | 
||
196  | 
(* Lemma for substitution of looping assumption in another specific assumption *)  | 
|
197  | 
lemma subst_lemma2: "[| (f x) = y >> g; x=(h x) |] ==> (f (h x)) = y >> g"  | 
|
198  | 
by (erule subst)  | 
|
199  | 
||
200  | 
lemma ForallAorB_mksch [rule_format]:  | 
|
201  | 
"!!A B. compatible A B ==>  | 
|
202  | 
! schA schB. Forall (%x. x:act (A||B)) tr  | 
|
203  | 
--> Forall (%x. x:act (A||B)) (mksch A B$tr$schA$schB)"  | 
|
| 
27208
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
204  | 
apply (tactic {* Seq_induct_tac @{context} "tr"
 | 
| 
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
205  | 
  [@{thm Forall_def}, @{thm sforall_def}, @{thm mksch_def}] 1 *})
 | 
| 26359 | 206  | 
apply auto  | 
| 19741 | 207  | 
apply (simp add: actions_of_par)  | 
208  | 
apply (case_tac "a:act A")  | 
|
209  | 
apply (case_tac "a:act B")  | 
|
210  | 
(* a:A, a:B *)  | 
|
211  | 
apply simp  | 
|
212  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
213  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 214  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
215  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 216  | 
(* a:A,a~:B *)  | 
217  | 
apply simp  | 
|
218  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
219  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 220  | 
apply (case_tac "a:act B")  | 
221  | 
(* a~:A, a:B *)  | 
|
222  | 
apply simp  | 
|
223  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
224  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 225  | 
(* a~:A,a~:B *)  | 
226  | 
apply auto  | 
|
227  | 
done  | 
|
228  | 
||
229  | 
lemma ForallBnAmksch [rule_format (no_asm)]: "!!A B. compatible B A ==>  | 
|
230  | 
! schA schB. (Forall (%x. x:act B & x~:act A) tr  | 
|
231  | 
--> Forall (%x. x:act B & x~:act A) (mksch A B$tr$schA$schB))"  | 
|
| 
27208
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
232  | 
apply (tactic {* Seq_induct_tac @{context} "tr"
 | 
| 
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
233  | 
  [@{thm Forall_def}, @{thm sforall_def}, @{thm mksch_def}] 1 *})
 | 
| 26359 | 234  | 
apply auto  | 
| 19741 | 235  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
236  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 237  | 
done  | 
238  | 
||
239  | 
lemma ForallAnBmksch [rule_format (no_asm)]: "!!A B. compatible A B ==>  | 
|
240  | 
! schA schB. (Forall (%x. x:act A & x~:act B) tr  | 
|
241  | 
--> Forall (%x. x:act A & x~:act B) (mksch A B$tr$schA$schB))"  | 
|
| 
27208
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
242  | 
apply (tactic {* Seq_induct_tac @{context} "tr"
 | 
| 
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
243  | 
  [@{thm Forall_def}, @{thm sforall_def}, @{thm mksch_def}] 1 *})
 | 
| 26359 | 244  | 
apply auto  | 
| 19741 | 245  | 
apply (rule Forall_Conc_impl [THEN mp])  | 
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
246  | 
apply (simp add: intA_is_not_actB int_is_act)  | 
| 19741 | 247  | 
done  | 
248  | 
||
249  | 
(* safe-tac makes too many case distinctions with this lemma in the next proof *)  | 
|
250  | 
declare FiniteConc [simp del]  | 
|
251  | 
||
252  | 
lemma FiniteL_mksch [rule_format (no_asm)]: "[| Finite tr; is_asig(asig_of A); is_asig(asig_of B) |] ==>  | 
|
253  | 
! x y. Forall (%x. x:act A) x & Forall (%x. x:act B) y &  | 
|
254  | 
Filter (%a. a:ext A)$x = Filter (%a. a:act A)$tr &  | 
|
255  | 
Filter (%a. a:ext B)$y = Filter (%a. a:act B)$tr &  | 
|
256  | 
Forall (%x. x:ext (A||B)) tr  | 
|
257  | 
--> Finite (mksch A B$tr$x$y)"  | 
|
258  | 
||
259  | 
apply (erule Seq_Finite_ind)  | 
|
260  | 
apply simp  | 
|
261  | 
(* main case *)  | 
|
262  | 
apply simp  | 
|
| 26359 | 263  | 
apply auto  | 
| 19741 | 264  | 
|
265  | 
(* a: act A; a: act B *)  | 
|
| 40432 | 266  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
267  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
|
| 19741 | 268  | 
back  | 
269  | 
apply (erule conjE)+  | 
|
270  | 
(* Finite (tw iA x) and Finite (tw iB y) *)  | 
|
271  | 
apply (simp add: not_ext_is_int_or_not_act FiniteConc)  | 
|
272  | 
(* now for conclusion IH applicable, but assumptions have to be transformed *)  | 
|
273  | 
apply (drule_tac x = "x" and g = "Filter (%a. a:act A) $s" in subst_lemma2)  | 
|
274  | 
apply assumption  | 
|
275  | 
apply (drule_tac x = "y" and g = "Filter (%a. a:act B) $s" in subst_lemma2)  | 
|
276  | 
apply assumption  | 
|
277  | 
(* IH *)  | 
|
278  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
279  | 
||
280  | 
(* a: act B; a~: act A *)  | 
|
| 40432 | 281  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 282  | 
|
283  | 
apply (erule conjE)+  | 
|
284  | 
(* Finite (tw iB y) *)  | 
|
285  | 
apply (simp add: not_ext_is_int_or_not_act FiniteConc)  | 
|
286  | 
(* now for conclusion IH applicable, but assumptions have to be transformed *)  | 
|
287  | 
apply (drule_tac x = "y" and g = "Filter (%a. a:act B) $s" in subst_lemma2)  | 
|
288  | 
apply assumption  | 
|
289  | 
(* IH *)  | 
|
290  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
291  | 
||
292  | 
(* a~: act B; a: act A *)  | 
|
| 40432 | 293  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 294  | 
|
295  | 
apply (erule conjE)+  | 
|
296  | 
(* Finite (tw iA x) *)  | 
|
297  | 
apply (simp add: not_ext_is_int_or_not_act FiniteConc)  | 
|
298  | 
(* now for conclusion IH applicable, but assumptions have to be transformed *)  | 
|
299  | 
apply (drule_tac x = "x" and g = "Filter (%a. a:act A) $s" in subst_lemma2)  | 
|
300  | 
apply assumption  | 
|
301  | 
(* IH *)  | 
|
302  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
303  | 
||
304  | 
(* a~: act B; a~: act A *)  | 
|
| 
44890
 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 
nipkow 
parents: 
42151 
diff
changeset
 | 
305  | 
apply (fastforce intro!: ext_is_act simp: externals_of_par)  | 
| 19741 | 306  | 
done  | 
307  | 
||
308  | 
declare FiniteConc [simp]  | 
|
309  | 
||
310  | 
declare FilterConc [simp del]  | 
|
311  | 
||
312  | 
lemma reduceA_mksch1 [rule_format (no_asm)]: " [| Finite bs; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  | 
|
313  | 
! y. Forall (%x. x:act B) y & Forall (%x. x:act B & x~:act A) bs &  | 
|
314  | 
Filter (%a. a:ext B)$y = Filter (%a. a:act B)$(bs @@ z)  | 
|
315  | 
--> (? y1 y2. (mksch A B$(bs @@ z)$x$y) = (y1 @@ (mksch A B$z$x$y2)) &  | 
|
316  | 
Forall (%x. x:act B & x~:act A) y1 &  | 
|
317  | 
Finite y1 & y = (y1 @@ y2) &  | 
|
318  | 
Filter (%a. a:ext B)$y1 = bs)"  | 
|
319  | 
apply (frule_tac A1 = "A" in compat_commute [THEN iffD1])  | 
|
320  | 
apply (erule Seq_Finite_ind)  | 
|
321  | 
apply (rule allI)+  | 
|
322  | 
apply (rule impI)  | 
|
323  | 
apply (rule_tac x = "nil" in exI)  | 
|
324  | 
apply (rule_tac x = "y" in exI)  | 
|
325  | 
apply simp  | 
|
326  | 
(* main case *)  | 
|
327  | 
apply (rule allI)+  | 
|
328  | 
apply (rule impI)  | 
|
329  | 
apply simp  | 
|
330  | 
apply (erule conjE)+  | 
|
331  | 
apply simp  | 
|
332  | 
(* divide_Seq on s *)  | 
|
| 40432 | 333  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 334  | 
apply (erule conjE)+  | 
335  | 
(* transform assumption f eB y = f B (s@z) *)  | 
|
336  | 
apply (drule_tac x = "y" and g = "Filter (%a. a:act B) $ (s@@z) " in subst_lemma2)  | 
|
337  | 
apply assumption  | 
|
338  | 
apply (simp add: not_ext_is_int_or_not_act FilterConc)  | 
|
339  | 
(* apply IH *)  | 
|
340  | 
apply (erule_tac x = "TL$ (Dropwhile (%a. a:int B) $y) " in allE)  | 
|
341  | 
apply (simp add: ForallTL ForallDropwhile FilterConc)  | 
|
342  | 
apply (erule exE)+  | 
|
343  | 
apply (erule conjE)+  | 
|
344  | 
apply (simp add: FilterConc)  | 
|
345  | 
(* for replacing IH in conclusion *)  | 
|
346  | 
apply (rotate_tac -2)  | 
|
347  | 
(* instantiate y1a and y2a *)  | 
|
348  | 
apply (rule_tac x = "Takewhile (%a. a:int B) $y @@ a>>y1" in exI)  | 
|
349  | 
apply (rule_tac x = "y2" in exI)  | 
|
350  | 
(* elminate all obligations up to two depending on Conc_assoc *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
351  | 
apply (simp add: intA_is_not_actB int_is_act int_is_not_ext FilterConc)  | 
| 19741 | 352  | 
apply (simp (no_asm) add: Conc_assoc FilterConc)  | 
353  | 
done  | 
|
354  | 
||
355  | 
lemmas reduceA_mksch = conjI [THEN [6] conjI [THEN [5] reduceA_mksch1]]  | 
|
356  | 
||
357  | 
lemma reduceB_mksch1 [rule_format]:  | 
|
358  | 
" [| Finite a_s; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  | 
|
359  | 
! x. Forall (%x. x:act A) x & Forall (%x. x:act A & x~:act B) a_s &  | 
|
360  | 
Filter (%a. a:ext A)$x = Filter (%a. a:act A)$(a_s @@ z)  | 
|
361  | 
--> (? x1 x2. (mksch A B$(a_s @@ z)$x$y) = (x1 @@ (mksch A B$z$x2$y)) &  | 
|
362  | 
Forall (%x. x:act A & x~:act B) x1 &  | 
|
363  | 
Finite x1 & x = (x1 @@ x2) &  | 
|
364  | 
Filter (%a. a:ext A)$x1 = a_s)"  | 
|
365  | 
apply (frule_tac A1 = "A" in compat_commute [THEN iffD1])  | 
|
366  | 
apply (erule Seq_Finite_ind)  | 
|
367  | 
apply (rule allI)+  | 
|
368  | 
apply (rule impI)  | 
|
369  | 
apply (rule_tac x = "nil" in exI)  | 
|
370  | 
apply (rule_tac x = "x" in exI)  | 
|
371  | 
apply simp  | 
|
372  | 
(* main case *)  | 
|
373  | 
apply (rule allI)+  | 
|
374  | 
apply (rule impI)  | 
|
375  | 
apply simp  | 
|
376  | 
apply (erule conjE)+  | 
|
377  | 
apply simp  | 
|
378  | 
(* divide_Seq on s *)  | 
|
| 40432 | 379  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 380  | 
apply (erule conjE)+  | 
381  | 
(* transform assumption f eA x = f A (s@z) *)  | 
|
382  | 
apply (drule_tac x = "x" and g = "Filter (%a. a:act A) $ (s@@z) " in subst_lemma2)  | 
|
383  | 
apply assumption  | 
|
384  | 
apply (simp add: not_ext_is_int_or_not_act FilterConc)  | 
|
385  | 
(* apply IH *)  | 
|
386  | 
apply (erule_tac x = "TL$ (Dropwhile (%a. a:int A) $x) " in allE)  | 
|
387  | 
apply (simp add: ForallTL ForallDropwhile FilterConc)  | 
|
388  | 
apply (erule exE)+  | 
|
389  | 
apply (erule conjE)+  | 
|
390  | 
apply (simp add: FilterConc)  | 
|
391  | 
(* for replacing IH in conclusion *)  | 
|
392  | 
apply (rotate_tac -2)  | 
|
393  | 
(* instantiate y1a and y2a *)  | 
|
394  | 
apply (rule_tac x = "Takewhile (%a. a:int A) $x @@ a>>x1" in exI)  | 
|
395  | 
apply (rule_tac x = "x2" in exI)  | 
|
396  | 
(* elminate all obligations up to two depending on Conc_assoc *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
397  | 
apply (simp add: intA_is_not_actB int_is_act int_is_not_ext FilterConc)  | 
| 19741 | 398  | 
apply (simp (no_asm) add: Conc_assoc FilterConc)  | 
399  | 
done  | 
|
400  | 
||
401  | 
lemmas reduceB_mksch = conjI [THEN [6] conjI [THEN [5] reduceB_mksch1]]  | 
|
402  | 
||
403  | 
declare FilterConc [simp]  | 
|
404  | 
||
405  | 
||
406  | 
subsection "Filtering external actions out of mksch(tr,schA,schB) yields the oracle tr"  | 
|
407  | 
||
408  | 
lemma FilterA_mksch_is_tr:  | 
|
409  | 
"!! A B. [| compatible A B; compatible B A;  | 
|
410  | 
is_asig(asig_of A); is_asig(asig_of B) |] ==>  | 
|
411  | 
! schA schB. Forall (%x. x:act A) schA & Forall (%x. x:act B) schB &  | 
|
412  | 
Forall (%x. x:ext (A||B)) tr &  | 
|
413  | 
Filter (%a. a:act A)$tr << Filter (%a. a:ext A)$schA &  | 
|
414  | 
Filter (%a. a:act B)$tr << Filter (%a. a:ext B)$schB  | 
|
415  | 
--> Filter (%a. a:ext (A||B))$(mksch A B$tr$schA$schB) = tr"  | 
|
416  | 
||
| 
27208
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
417  | 
apply (tactic {* Seq_induct_tac @{context} "tr"
 | 
| 
 
5fe899199f85
proper context for tactics derived from res_inst_tac;
 
wenzelm 
parents: 
26359 
diff
changeset
 | 
418  | 
  [@{thm Forall_def}, @{thm sforall_def}, @{thm mksch_def}] 1 *})
 | 
| 19741 | 419  | 
(* main case *)  | 
420  | 
(* splitting into 4 cases according to a:A, a:B *)  | 
|
| 26359 | 421  | 
apply auto  | 
| 19741 | 422  | 
|
423  | 
(* Case a:A, a:B *)  | 
|
424  | 
apply (frule divide_Seq)  | 
|
425  | 
apply (frule divide_Seq)  | 
|
426  | 
back  | 
|
427  | 
apply (erule conjE)+  | 
|
428  | 
(* filtering internals of A in schA and of B in schB is nil *)  | 
|
429  | 
apply (simp add: not_ext_is_int_or_not_act externals_of_par intA_is_not_extB int_is_not_ext)  | 
|
430  | 
(* conclusion of IH ok, but assumptions of IH have to be transformed *)  | 
|
431  | 
apply (drule_tac x = "schA" in subst_lemma1)  | 
|
432  | 
apply assumption  | 
|
433  | 
apply (drule_tac x = "schB" in subst_lemma1)  | 
|
434  | 
apply assumption  | 
|
435  | 
(* IH *)  | 
|
436  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
437  | 
||
438  | 
(* Case a:A, a~:B *)  | 
|
439  | 
apply (frule divide_Seq)  | 
|
440  | 
apply (erule conjE)+  | 
|
441  | 
(* filtering internals of A is nil *)  | 
|
442  | 
apply (simp add: not_ext_is_int_or_not_act externals_of_par intA_is_not_extB int_is_not_ext)  | 
|
443  | 
apply (drule_tac x = "schA" in subst_lemma1)  | 
|
444  | 
apply assumption  | 
|
445  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
446  | 
||
447  | 
(* Case a:B, a~:A *)  | 
|
448  | 
apply (frule divide_Seq)  | 
|
449  | 
apply (erule conjE)+  | 
|
450  | 
(* filtering internals of A is nil *)  | 
|
451  | 
apply (simp add: not_ext_is_int_or_not_act externals_of_par intA_is_not_extB int_is_not_ext)  | 
|
452  | 
apply (drule_tac x = "schB" in subst_lemma1)  | 
|
453  | 
back  | 
|
454  | 
apply assumption  | 
|
455  | 
apply (simp add: not_ext_is_int_or_not_act ForallTL ForallDropwhile)  | 
|
456  | 
||
457  | 
(* Case a~:A, a~:B *)  | 
|
| 
44890
 
22f665a2e91c
new fastforce replacing fastsimp - less confusing name
 
nipkow 
parents: 
42151 
diff
changeset
 | 
458  | 
apply (fastforce intro!: ext_is_act simp: externals_of_par)  | 
| 19741 | 459  | 
done  | 
460  | 
||
461  | 
||
462  | 
subsection" Filter of mksch(tr,schA,schB) to A is schA -- take lemma proof"  | 
|
463  | 
||
464  | 
lemma FilterAmksch_is_schA: "!! A B. [| compatible A B; compatible B A;  | 
|
465  | 
is_asig(asig_of A); is_asig(asig_of B) |] ==>  | 
|
466  | 
Forall (%x. x:ext (A||B)) tr &  | 
|
467  | 
Forall (%x. x:act A) schA & Forall (%x. x:act B) schB &  | 
|
468  | 
Filter (%a. a:ext A)$schA = Filter (%a. a:act A)$tr &  | 
|
469  | 
Filter (%a. a:ext B)$schB = Filter (%a. a:act B)$tr &  | 
|
470  | 
LastActExtsch A schA & LastActExtsch B schB  | 
|
471  | 
--> Filter (%a. a:act A)$(mksch A B$tr$schA$schB) = schA"  | 
|
472  | 
apply (intro strip)  | 
|
| 
35642
 
f478d5a9d238
generate separate qualified theorem name for each type's reach and take_lemma
 
huffman 
parents: 
35215 
diff
changeset
 | 
473  | 
apply (rule seq.take_lemma)  | 
| 19741 | 474  | 
apply (rule mp)  | 
475  | 
prefer 2 apply assumption  | 
|
476  | 
back back back back  | 
|
477  | 
apply (rule_tac x = "schA" in spec)  | 
|
478  | 
apply (rule_tac x = "schB" in spec)  | 
|
479  | 
apply (rule_tac x = "tr" in spec)  | 
|
480  | 
apply (tactic "thin_tac' 5 1")  | 
|
481  | 
apply (rule nat_less_induct)  | 
|
482  | 
apply (rule allI)+  | 
|
483  | 
apply (rename_tac tr schB schA)  | 
|
484  | 
apply (intro strip)  | 
|
485  | 
apply (erule conjE)+  | 
|
486  | 
||
487  | 
apply (case_tac "Forall (%x. x:act B & x~:act A) tr")  | 
|
488  | 
||
489  | 
apply (rule seq_take_lemma [THEN iffD2, THEN spec])  | 
|
490  | 
apply (tactic "thin_tac' 5 1")  | 
|
491  | 
||
492  | 
||
493  | 
apply (case_tac "Finite tr")  | 
|
494  | 
||
495  | 
(* both sides of this equation are nil *)  | 
|
496  | 
apply (subgoal_tac "schA=nil")  | 
|
497  | 
apply (simp (no_asm_simp))  | 
|
498  | 
(* first side: mksch = nil *)  | 
|
499  | 
apply (auto intro!: ForallQFilterPnil ForallBnAmksch FiniteL_mksch)[1]  | 
|
500  | 
(* second side: schA = nil *)  | 
|
501  | 
apply (erule_tac A = "A" in LastActExtimplnil)  | 
|
502  | 
apply (simp (no_asm_simp))  | 
|
503  | 
apply (erule_tac Q = "%x. x:act B & x~:act A" in ForallQFilterPnil)  | 
|
504  | 
apply assumption  | 
|
505  | 
apply fast  | 
|
506  | 
||
507  | 
(* case ~ Finite s *)  | 
|
508  | 
||
509  | 
(* both sides of this equation are UU *)  | 
|
510  | 
apply (subgoal_tac "schA=UU")  | 
|
511  | 
apply (simp (no_asm_simp))  | 
|
512  | 
(* first side: mksch = UU *)  | 
|
| 
48194
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
513  | 
apply (auto intro!: ForallQFilterPUU finiteR_mksch' ForallBnAmksch)[1]  | 
| 19741 | 514  | 
(* schA = UU *)  | 
515  | 
apply (erule_tac A = "A" in LastActExtimplUU)  | 
|
516  | 
apply (simp (no_asm_simp))  | 
|
517  | 
apply (erule_tac Q = "%x. x:act B & x~:act A" in ForallQFilterPUU)  | 
|
518  | 
apply assumption  | 
|
519  | 
apply fast  | 
|
520  | 
||
521  | 
(* case" ~ Forall (%x.x:act B & x~:act A) s" *)  | 
|
522  | 
||
523  | 
apply (drule divide_Seq3)  | 
|
524  | 
||
525  | 
apply (erule exE)+  | 
|
526  | 
apply (erule conjE)+  | 
|
527  | 
apply hypsubst  | 
|
528  | 
||
529  | 
(* bring in lemma reduceA_mksch *)  | 
|
530  | 
apply (frule_tac x = "schA" and y = "schB" and A = "A" and B = "B" in reduceA_mksch)  | 
|
531  | 
apply assumption+  | 
|
532  | 
apply (erule exE)+  | 
|
533  | 
apply (erule conjE)+  | 
|
534  | 
||
535  | 
(* use reduceA_mksch to rewrite conclusion *)  | 
|
536  | 
apply hypsubst  | 
|
537  | 
apply simp  | 
|
538  | 
||
539  | 
(* eliminate the B-only prefix *)  | 
|
540  | 
||
541  | 
apply (subgoal_tac " (Filter (%a. a :act A) $y1) = nil")  | 
|
542  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
543  | 
prefer 2 apply assumption  | 
|
544  | 
prefer 2 apply fast  | 
|
545  | 
||
546  | 
(* Now real recursive step follows (in y) *)  | 
|
547  | 
||
548  | 
apply simp  | 
|
549  | 
apply (case_tac "x:act A")  | 
|
550  | 
apply (case_tac "x~:act B")  | 
|
551  | 
apply (rotate_tac -2)  | 
|
552  | 
apply simp  | 
|
553  | 
||
554  | 
apply (subgoal_tac "Filter (%a. a:act A & a:ext B) $y1=nil")  | 
|
555  | 
apply (rotate_tac -1)  | 
|
556  | 
apply simp  | 
|
557  | 
(* eliminate introduced subgoal 2 *)  | 
|
558  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
559  | 
prefer 2 apply assumption  | 
|
560  | 
prefer 2 apply fast  | 
|
561  | 
||
562  | 
(* bring in divide Seq for s *)  | 
|
| 40432 | 563  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 564  | 
apply (erule conjE)+  | 
565  | 
||
566  | 
(* subst divide_Seq in conclusion, but only at the righest occurence *)  | 
|
567  | 
apply (rule_tac t = "schA" in ssubst)  | 
|
568  | 
back  | 
|
569  | 
back  | 
|
570  | 
back  | 
|
571  | 
apply assumption  | 
|
572  | 
||
573  | 
(* reduce trace_takes from n to strictly smaller k *)  | 
|
574  | 
apply (rule take_reduction)  | 
|
575  | 
||
576  | 
(* f A (tw iA) = tw ~eA *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
577  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
| 19741 | 578  | 
apply (rule refl)  | 
579  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
|
580  | 
apply (rotate_tac -11)  | 
|
581  | 
||
582  | 
(* now conclusion fulfills induction hypothesis, but assumptions are not ready *)  | 
|
583  | 
||
584  | 
(* assumption Forall tr *)  | 
|
585  | 
(* assumption schB *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
586  | 
apply (simp add: ext_and_act)  | 
| 19741 | 587  | 
(* assumption schA *)  | 
588  | 
apply (drule_tac x = "schA" and g = "Filter (%a. a:act A) $rs" in subst_lemma2)  | 
|
589  | 
apply assumption  | 
|
590  | 
apply (simp add: int_is_not_ext)  | 
|
591  | 
(* assumptions concerning LastActExtsch, cannot be rewritten, as LastActExtsmalli are looping *)  | 
|
592  | 
apply (drule_tac sch = "schA" and P = "%a. a:int A" in LastActExtsmall1)  | 
|
593  | 
apply (frule_tac ?sch1.0 = "y1" in LastActExtsmall2)  | 
|
594  | 
apply assumption  | 
|
595  | 
||
596  | 
(* assumption Forall schA *)  | 
|
597  | 
apply (drule_tac s = "schA" and P = "Forall (%x. x:act A) " in subst)  | 
|
598  | 
apply assumption  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
599  | 
apply (simp add: int_is_act)  | 
| 19741 | 600  | 
|
601  | 
(* case x:actions(asig_of A) & x: actions(asig_of B) *)  | 
|
602  | 
||
603  | 
||
604  | 
apply (rotate_tac -2)  | 
|
605  | 
apply simp  | 
|
606  | 
||
607  | 
apply (subgoal_tac "Filter (%a. a:act A & a:ext B) $y1=nil")  | 
|
608  | 
apply (rotate_tac -1)  | 
|
609  | 
apply simp  | 
|
610  | 
(* eliminate introduced subgoal 2 *)  | 
|
611  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
612  | 
prefer 2 apply (assumption)  | 
|
613  | 
prefer 2 apply (fast)  | 
|
614  | 
||
615  | 
(* bring in divide Seq for s *)  | 
|
| 40432 | 616  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 617  | 
apply (erule conjE)+  | 
618  | 
||
619  | 
(* subst divide_Seq in conclusion, but only at the righest occurence *)  | 
|
620  | 
apply (rule_tac t = "schA" in ssubst)  | 
|
621  | 
back  | 
|
622  | 
back  | 
|
623  | 
back  | 
|
624  | 
apply assumption  | 
|
625  | 
||
626  | 
(* f A (tw iA) = tw ~eA *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
627  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
| 19741 | 628  | 
|
629  | 
(* rewrite assumption forall and schB *)  | 
|
630  | 
apply (rotate_tac 13)  | 
|
631  | 
apply (simp add: ext_and_act)  | 
|
632  | 
||
633  | 
(* divide_Seq for schB2 *)  | 
|
| 40432 | 634  | 
apply (frule_tac y = "y2" in sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 635  | 
apply (erule conjE)+  | 
636  | 
(* assumption schA *)  | 
|
637  | 
apply (drule_tac x = "schA" and g = "Filter (%a. a:act A) $rs" in subst_lemma2)  | 
|
638  | 
apply assumption  | 
|
639  | 
apply (simp add: int_is_not_ext)  | 
|
640  | 
||
641  | 
(* f A (tw iB schB2) = nil *)  | 
|
642  | 
apply (simp add: int_is_not_ext not_ext_is_int_or_not_act intA_is_not_actB)  | 
|
643  | 
||
644  | 
||
645  | 
(* reduce trace_takes from n to strictly smaller k *)  | 
|
646  | 
apply (rule take_reduction)  | 
|
647  | 
apply (rule refl)  | 
|
648  | 
apply (rule refl)  | 
|
649  | 
||
650  | 
(* now conclusion fulfills induction hypothesis, but assumptions are not all ready *)  | 
|
651  | 
||
652  | 
(* assumption schB *)  | 
|
653  | 
apply (drule_tac x = "y2" and g = "Filter (%a. a:act B) $rs" in subst_lemma2)  | 
|
654  | 
apply assumption  | 
|
655  | 
apply (simp add: intA_is_not_actB int_is_not_ext)  | 
|
656  | 
||
657  | 
(* conclusions concerning LastActExtsch, cannot be rewritten, as LastActExtsmalli are looping *)  | 
|
658  | 
apply (drule_tac sch = "schA" and P = "%a. a:int A" in LastActExtsmall1)  | 
|
659  | 
apply (frule_tac ?sch1.0 = "y1" in LastActExtsmall2)  | 
|
660  | 
apply assumption  | 
|
661  | 
apply (drule_tac sch = "y2" and P = "%a. a:int B" in LastActExtsmall1)  | 
|
662  | 
||
663  | 
(* assumption Forall schA, and Forall schA are performed by ForallTL,ForallDropwhile *)  | 
|
664  | 
apply (simp add: ForallTL ForallDropwhile)  | 
|
665  | 
||
666  | 
(* case x~:A & x:B *)  | 
|
667  | 
(* cannot occur, as just this case has been scheduled out before as the B-only prefix *)  | 
|
668  | 
apply (case_tac "x:act B")  | 
|
669  | 
apply fast  | 
|
670  | 
||
671  | 
(* case x~:A & x~:B *)  | 
|
672  | 
(* cannot occur because of assumption: Forall (a:ext A | a:ext B) *)  | 
|
673  | 
apply (rotate_tac -9)  | 
|
674  | 
(* reduce forall assumption from tr to (x>>rs) *)  | 
|
675  | 
apply (simp add: externals_of_par)  | 
|
676  | 
apply (fast intro!: ext_is_act)  | 
|
677  | 
||
678  | 
done  | 
|
679  | 
||
680  | 
||
681  | 
||
682  | 
subsection" Filter of mksch(tr,schA,schB) to B is schB -- take lemma proof"  | 
|
683  | 
||
684  | 
lemma FilterBmksch_is_schB: "!! A B. [| compatible A B; compatible B A;  | 
|
685  | 
is_asig(asig_of A); is_asig(asig_of B) |] ==>  | 
|
686  | 
Forall (%x. x:ext (A||B)) tr &  | 
|
687  | 
Forall (%x. x:act A) schA & Forall (%x. x:act B) schB &  | 
|
688  | 
Filter (%a. a:ext A)$schA = Filter (%a. a:act A)$tr &  | 
|
689  | 
Filter (%a. a:ext B)$schB = Filter (%a. a:act B)$tr &  | 
|
690  | 
LastActExtsch A schA & LastActExtsch B schB  | 
|
691  | 
--> Filter (%a. a:act B)$(mksch A B$tr$schA$schB) = schB"  | 
|
692  | 
apply (intro strip)  | 
|
| 
35642
 
f478d5a9d238
generate separate qualified theorem name for each type's reach and take_lemma
 
huffman 
parents: 
35215 
diff
changeset
 | 
693  | 
apply (rule seq.take_lemma)  | 
| 19741 | 694  | 
apply (rule mp)  | 
695  | 
prefer 2 apply assumption  | 
|
696  | 
back back back back  | 
|
697  | 
apply (rule_tac x = "schA" in spec)  | 
|
698  | 
apply (rule_tac x = "schB" in spec)  | 
|
699  | 
apply (rule_tac x = "tr" in spec)  | 
|
700  | 
apply (tactic "thin_tac' 5 1")  | 
|
701  | 
apply (rule nat_less_induct)  | 
|
702  | 
apply (rule allI)+  | 
|
703  | 
apply (rename_tac tr schB schA)  | 
|
704  | 
apply (intro strip)  | 
|
705  | 
apply (erule conjE)+  | 
|
706  | 
||
707  | 
apply (case_tac "Forall (%x. x:act A & x~:act B) tr")  | 
|
708  | 
||
709  | 
apply (rule seq_take_lemma [THEN iffD2, THEN spec])  | 
|
710  | 
apply (tactic "thin_tac' 5 1")  | 
|
711  | 
||
712  | 
apply (case_tac "Finite tr")  | 
|
713  | 
||
714  | 
(* both sides of this equation are nil *)  | 
|
715  | 
apply (subgoal_tac "schB=nil")  | 
|
716  | 
apply (simp (no_asm_simp))  | 
|
717  | 
(* first side: mksch = nil *)  | 
|
718  | 
apply (auto intro!: ForallQFilterPnil ForallAnBmksch FiniteL_mksch)[1]  | 
|
719  | 
(* second side: schA = nil *)  | 
|
720  | 
apply (erule_tac A = "B" in LastActExtimplnil)  | 
|
721  | 
apply (simp (no_asm_simp))  | 
|
722  | 
apply (erule_tac Q = "%x. x:act A & x~:act B" in ForallQFilterPnil)  | 
|
723  | 
apply assumption  | 
|
724  | 
apply fast  | 
|
725  | 
||
726  | 
(* case ~ Finite tr *)  | 
|
727  | 
||
728  | 
(* both sides of this equation are UU *)  | 
|
729  | 
apply (subgoal_tac "schB=UU")  | 
|
730  | 
apply (simp (no_asm_simp))  | 
|
731  | 
(* first side: mksch = UU *)  | 
|
| 
48194
 
1440a3103af0
tuned proofs -- eliminated old-fashioned COMP and rev_contrapos;
 
wenzelm 
parents: 
47239 
diff
changeset
 | 
732  | 
apply (force intro!: ForallQFilterPUU finiteR_mksch' ForallAnBmksch)  | 
| 19741 | 733  | 
(* schA = UU *)  | 
734  | 
apply (erule_tac A = "B" in LastActExtimplUU)  | 
|
735  | 
apply (simp (no_asm_simp))  | 
|
736  | 
apply (erule_tac Q = "%x. x:act A & x~:act B" in ForallQFilterPUU)  | 
|
737  | 
apply assumption  | 
|
738  | 
apply fast  | 
|
739  | 
||
740  | 
(* case" ~ Forall (%x.x:act B & x~:act A) s" *)  | 
|
741  | 
||
742  | 
apply (drule divide_Seq3)  | 
|
743  | 
||
744  | 
apply (erule exE)+  | 
|
745  | 
apply (erule conjE)+  | 
|
746  | 
apply hypsubst  | 
|
747  | 
||
748  | 
(* bring in lemma reduceB_mksch *)  | 
|
749  | 
apply (frule_tac y = "schB" and x = "schA" and A = "A" and B = "B" in reduceB_mksch)  | 
|
750  | 
apply assumption+  | 
|
751  | 
apply (erule exE)+  | 
|
752  | 
apply (erule conjE)+  | 
|
753  | 
||
754  | 
(* use reduceB_mksch to rewrite conclusion *)  | 
|
755  | 
apply hypsubst  | 
|
756  | 
apply simp  | 
|
757  | 
||
758  | 
(* eliminate the A-only prefix *)  | 
|
759  | 
||
760  | 
apply (subgoal_tac "(Filter (%a. a :act B) $x1) = nil")  | 
|
761  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
762  | 
prefer 2 apply (assumption)  | 
|
763  | 
prefer 2 apply (fast)  | 
|
764  | 
||
765  | 
(* Now real recursive step follows (in x) *)  | 
|
766  | 
||
767  | 
apply simp  | 
|
768  | 
apply (case_tac "x:act B")  | 
|
769  | 
apply (case_tac "x~:act A")  | 
|
770  | 
apply (rotate_tac -2)  | 
|
771  | 
apply simp  | 
|
772  | 
||
773  | 
apply (subgoal_tac "Filter (%a. a:act B & a:ext A) $x1=nil")  | 
|
774  | 
apply (rotate_tac -1)  | 
|
775  | 
apply simp  | 
|
776  | 
(* eliminate introduced subgoal 2 *)  | 
|
777  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
778  | 
prefer 2 apply (assumption)  | 
|
779  | 
prefer 2 apply (fast)  | 
|
780  | 
||
781  | 
(* bring in divide Seq for s *)  | 
|
| 40432 | 782  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 783  | 
apply (erule conjE)+  | 
784  | 
||
785  | 
(* subst divide_Seq in conclusion, but only at the righest occurence *)  | 
|
786  | 
apply (rule_tac t = "schB" in ssubst)  | 
|
787  | 
back  | 
|
788  | 
back  | 
|
789  | 
back  | 
|
790  | 
apply assumption  | 
|
791  | 
||
792  | 
(* reduce trace_takes from n to strictly smaller k *)  | 
|
793  | 
apply (rule take_reduction)  | 
|
794  | 
||
795  | 
(* f B (tw iB) = tw ~eB *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
796  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
| 19741 | 797  | 
apply (rule refl)  | 
798  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
|
799  | 
apply (rotate_tac -11)  | 
|
800  | 
||
801  | 
(* now conclusion fulfills induction hypothesis, but assumptions are not ready *)  | 
|
802  | 
||
803  | 
(* assumption schA *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
804  | 
apply (simp add: ext_and_act)  | 
| 19741 | 805  | 
(* assumption schB *)  | 
806  | 
apply (drule_tac x = "schB" and g = "Filter (%a. a:act B) $rs" in subst_lemma2)  | 
|
807  | 
apply assumption  | 
|
808  | 
apply (simp add: int_is_not_ext)  | 
|
809  | 
(* assumptions concerning LastActExtsch, cannot be rewritten, as LastActExtsmalli are looping *)  | 
|
810  | 
apply (drule_tac sch = "schB" and P = "%a. a:int B" in LastActExtsmall1)  | 
|
811  | 
apply (frule_tac ?sch1.0 = "x1" in LastActExtsmall2)  | 
|
812  | 
apply assumption  | 
|
813  | 
||
814  | 
(* assumption Forall schB *)  | 
|
815  | 
apply (drule_tac s = "schB" and P = "Forall (%x. x:act B) " in subst)  | 
|
816  | 
apply assumption  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
817  | 
apply (simp add: int_is_act)  | 
| 19741 | 818  | 
|
819  | 
(* case x:actions(asig_of A) & x: actions(asig_of B) *)  | 
|
820  | 
||
821  | 
apply (rotate_tac -2)  | 
|
822  | 
apply simp  | 
|
823  | 
||
824  | 
apply (subgoal_tac "Filter (%a. a:act B & a:ext A) $x1=nil")  | 
|
825  | 
apply (rotate_tac -1)  | 
|
826  | 
apply simp  | 
|
827  | 
(* eliminate introduced subgoal 2 *)  | 
|
828  | 
apply (erule_tac [2] ForallQFilterPnil)  | 
|
829  | 
prefer 2 apply (assumption)  | 
|
830  | 
prefer 2 apply (fast)  | 
|
831  | 
||
832  | 
(* bring in divide Seq for s *)  | 
|
| 40432 | 833  | 
apply (frule sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 834  | 
apply (erule conjE)+  | 
835  | 
||
836  | 
(* subst divide_Seq in conclusion, but only at the righest occurence *)  | 
|
837  | 
apply (rule_tac t = "schB" in ssubst)  | 
|
838  | 
back  | 
|
839  | 
back  | 
|
840  | 
back  | 
|
841  | 
apply assumption  | 
|
842  | 
||
843  | 
(* f B (tw iB) = tw ~eB *)  | 
|
| 
35215
 
a03462cbf86f
get rid of warnings about duplicate simp rules in all HOLCF theories
 
huffman 
parents: 
35174 
diff
changeset
 | 
844  | 
apply (simp add: int_is_act not_ext_is_int_or_not_act)  | 
| 19741 | 845  | 
|
846  | 
(* rewrite assumption forall and schB *)  | 
|
847  | 
apply (rotate_tac 13)  | 
|
848  | 
apply (simp add: ext_and_act)  | 
|
849  | 
||
850  | 
(* divide_Seq for schB2 *)  | 
|
| 40432 | 851  | 
apply (frule_tac y = "x2" in sym [THEN eq_imp_below, THEN divide_Seq])  | 
| 19741 | 852  | 
apply (erule conjE)+  | 
853  | 
(* assumption schA *)  | 
|
854  | 
apply (drule_tac x = "schB" and g = "Filter (%a. a:act B) $rs" in subst_lemma2)  | 
|
855  | 
apply assumption  | 
|
856  | 
apply (simp add: int_is_not_ext)  | 
|
857  | 
||
858  | 
(* f B (tw iA schA2) = nil *)  | 
|
859  | 
apply (simp add: int_is_not_ext not_ext_is_int_or_not_act intA_is_not_actB)  | 
|
860  | 
||
861  | 
||
862  | 
(* reduce trace_takes from n to strictly smaller k *)  | 
|
863  | 
apply (rule take_reduction)  | 
|
864  | 
apply (rule refl)  | 
|
865  | 
apply (rule refl)  | 
|
866  | 
||
867  | 
(* now conclusion fulfills induction hypothesis, but assumptions are not all ready *)  | 
|
868  | 
||
869  | 
(* assumption schA *)  | 
|
870  | 
apply (drule_tac x = "x2" and g = "Filter (%a. a:act A) $rs" in subst_lemma2)  | 
|
871  | 
apply assumption  | 
|
872  | 
apply (simp add: intA_is_not_actB int_is_not_ext)  | 
|
873  | 
||
874  | 
(* conclusions concerning LastActExtsch, cannot be rewritten, as LastActExtsmalli are looping *)  | 
|
875  | 
apply (drule_tac sch = "schB" and P = "%a. a:int B" in LastActExtsmall1)  | 
|
876  | 
apply (frule_tac ?sch1.0 = "x1" in LastActExtsmall2)  | 
|
877  | 
apply assumption  | 
|
878  | 
apply (drule_tac sch = "x2" and P = "%a. a:int A" in LastActExtsmall1)  | 
|
879  | 
||
880  | 
(* assumption Forall schA, and Forall schA are performed by ForallTL,ForallDropwhile *)  | 
|
881  | 
apply (simp add: ForallTL ForallDropwhile)  | 
|
882  | 
||
883  | 
(* case x~:B & x:A *)  | 
|
884  | 
(* cannot occur, as just this case has been scheduled out before as the B-only prefix *)  | 
|
885  | 
apply (case_tac "x:act A")  | 
|
886  | 
apply fast  | 
|
887  | 
||
888  | 
(* case x~:B & x~:A *)  | 
|
889  | 
(* cannot occur because of assumption: Forall (a:ext A | a:ext B) *)  | 
|
890  | 
apply (rotate_tac -9)  | 
|
891  | 
(* reduce forall assumption from tr to (x>>rs) *)  | 
|
892  | 
apply (simp add: externals_of_par)  | 
|
893  | 
apply (fast intro!: ext_is_act)  | 
|
894  | 
||
895  | 
done  | 
|
896  | 
||
897  | 
||
898  | 
subsection "COMPOSITIONALITY on TRACE Level -- Main Theorem"  | 
|
899  | 
||
900  | 
lemma compositionality_tr:  | 
|
901  | 
"!! A B. [| is_trans_of A; is_trans_of B; compatible A B; compatible B A;  | 
|
902  | 
is_asig(asig_of A); is_asig(asig_of B)|]  | 
|
903  | 
==> (tr: traces(A||B)) =  | 
|
904  | 
(Filter (%a. a:act A)$tr : traces A &  | 
|
905  | 
Filter (%a. a:act B)$tr : traces B &  | 
|
906  | 
Forall (%x. x:ext(A||B)) tr)"  | 
|
907  | 
||
908  | 
apply (simp (no_asm) add: traces_def has_trace_def)  | 
|
| 26359 | 909  | 
apply auto  | 
| 19741 | 910  | 
|
911  | 
(* ==> *)  | 
|
912  | 
(* There is a schedule of A *)  | 
|
913  | 
apply (rule_tac x = "Filter (%a. a:act A) $sch" in bexI)  | 
|
914  | 
prefer 2  | 
|
915  | 
apply (simp add: compositionality_sch)  | 
|
916  | 
apply (simp add: compatibility_consequence1 externals_of_par ext1_ext2_is_not_act1)  | 
|
917  | 
(* There is a schedule of B *)  | 
|
918  | 
apply (rule_tac x = "Filter (%a. a:act B) $sch" in bexI)  | 
|
919  | 
prefer 2  | 
|
920  | 
apply (simp add: compositionality_sch)  | 
|
921  | 
apply (simp add: compatibility_consequence2 externals_of_par ext1_ext2_is_not_act2)  | 
|
922  | 
(* Traces of A||B have only external actions from A or B *)  | 
|
923  | 
apply (rule ForallPFilterP)  | 
|
924  | 
||
925  | 
(* <== *)  | 
|
926  | 
||
927  | 
(* replace schA and schB by Cut(schA) and Cut(schB) *)  | 
|
928  | 
apply (drule exists_LastActExtsch)  | 
|
929  | 
apply assumption  | 
|
930  | 
apply (drule exists_LastActExtsch)  | 
|
931  | 
apply assumption  | 
|
932  | 
apply (erule exE)+  | 
|
933  | 
apply (erule conjE)+  | 
|
934  | 
(* Schedules of A(B) have only actions of A(B) *)  | 
|
935  | 
apply (drule scheds_in_sig)  | 
|
936  | 
apply assumption  | 
|
937  | 
apply (drule scheds_in_sig)  | 
|
938  | 
apply assumption  | 
|
939  | 
||
940  | 
apply (rename_tac h1 h2 schA schB)  | 
|
941  | 
(* mksch is exactly the construction of trA||B out of schA, schB, and the oracle tr,  | 
|
942  | 
we need here *)  | 
|
943  | 
apply (rule_tac x = "mksch A B$tr$schA$schB" in bexI)  | 
|
944  | 
||
945  | 
(* External actions of mksch are just the oracle *)  | 
|
946  | 
apply (simp add: FilterA_mksch_is_tr)  | 
|
947  | 
||
948  | 
(* mksch is a schedule -- use compositionality on sch-level *)  | 
|
949  | 
apply (simp add: compositionality_sch)  | 
|
950  | 
apply (simp add: FilterAmksch_is_schA FilterBmksch_is_schB)  | 
|
951  | 
apply (erule ForallAorB_mksch)  | 
|
952  | 
apply (erule ForallPForallQ)  | 
|
953  | 
apply (erule ext_is_act)  | 
|
954  | 
done  | 
|
955  | 
||
956  | 
||
957  | 
||
958  | 
subsection {* COMPOSITIONALITY on TRACE Level -- for Modules *}
 | 
|
959  | 
||
960  | 
lemma compositionality_tr_modules:  | 
|
961  | 
||
962  | 
"!! A B. [| is_trans_of A; is_trans_of B; compatible A B; compatible B A;  | 
|
963  | 
is_asig(asig_of A); is_asig(asig_of B)|]  | 
|
964  | 
==> Traces (A||B) = par_traces (Traces A) (Traces B)"  | 
|
965  | 
||
966  | 
apply (unfold Traces_def par_traces_def)  | 
|
967  | 
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: 
36543 
diff
changeset
 | 
968  | 
apply (rule set_eqI)  | 
| 19741 | 969  | 
apply (simp add: compositionality_tr externals_of_par)  | 
970  | 
done  | 
|
971  | 
||
972  | 
||
| 47239 | 973  | 
declaration {* fn _ => Simplifier.map_ss (Simplifier.set_mksym Simplifier.default_mk_sym) *}
 | 
| 3071 | 974  | 
|
975  | 
||
976  | 
end  |