src/HOLCF/IOA/meta_theory/CompoTraces.ML
changeset 3842 b55686a7b22c
parent 3521 bdc51b4c6050
child 4042 8abc33930ff0
equal deleted inserted replaced
3841:22bbc1676768 3842:b55686a7b22c
    22 \      (case x of  \ 
    22 \      (case x of  \ 
    23 \        Undef => UU  \
    23 \        Undef => UU  \
    24 \      | Def y => \
    24 \      | Def y => \
    25 \         (if y:act A then \
    25 \         (if y:act A then \
    26 \             (if y:act B then \ 
    26 \             (if y:act B then \ 
    27 \                   ((Takewhile (%a.a:int A)`schA) \
    27 \                   ((Takewhile (%a. a:int A)`schA) \
    28 \                         @@(Takewhile (%a.a:int B)`schB) \
    28 \                         @@(Takewhile (%a. a:int B)`schB) \
    29 \                              @@(y>>(mksch A B`xs   \
    29 \                              @@(y>>(mksch A B`xs   \
    30 \                                       `(TL`(Dropwhile (%a.a:int A)`schA))  \
    30 \                                       `(TL`(Dropwhile (%a. a:int A)`schA))  \
    31 \                                       `(TL`(Dropwhile (%a.a:int B)`schB))  \
    31 \                                       `(TL`(Dropwhile (%a. a:int B)`schB))  \
    32 \                    )))   \
    32 \                    )))   \
    33 \              else  \
    33 \              else  \
    34 \                 ((Takewhile (%a.a:int A)`schA)  \
    34 \                 ((Takewhile (%a. a:int A)`schA)  \
    35 \                      @@ (y>>(mksch A B`xs  \
    35 \                      @@ (y>>(mksch A B`xs  \
    36 \                              `(TL`(Dropwhile (%a.a:int A)`schA))  \
    36 \                              `(TL`(Dropwhile (%a. a:int A)`schA))  \
    37 \                              `schB)))  \
    37 \                              `schB)))  \
    38 \              )   \
    38 \              )   \
    39 \          else    \
    39 \          else    \
    40 \             (if y:act B then  \ 
    40 \             (if y:act B then  \ 
    41 \                 ((Takewhile (%a.a:int B)`schB)  \
    41 \                 ((Takewhile (%a. a:int B)`schB)  \
    42 \                       @@ (y>>(mksch A B`xs   \
    42 \                       @@ (y>>(mksch A B`xs   \
    43 \                              `schA   \
    43 \                              `schA   \
    44 \                              `(TL`(Dropwhile (%a.a:int B)`schB))  \
    44 \                              `(TL`(Dropwhile (%a. a:int B)`schB))  \
    45 \                              )))  \
    45 \                              )))  \
    46 \             else  \
    46 \             else  \
    47 \               UU  \
    47 \               UU  \
    48 \             )  \
    48 \             )  \
    49 \         )  \
    49 \         )  \
    60 by (Simp_tac 1);
    60 by (Simp_tac 1);
    61 qed"mksch_nil";
    61 qed"mksch_nil";
    62 
    62 
    63 goal thy "!!x.[|x:act A;x~:act B|]  \
    63 goal thy "!!x.[|x:act A;x~:act B|]  \
    64 \   ==> mksch A B`(x>>tr)`schA`schB = \
    64 \   ==> mksch A B`(x>>tr)`schA`schB = \
    65 \         (Takewhile (%a.a:int A)`schA) \
    65 \         (Takewhile (%a. a:int A)`schA) \
    66 \         @@ (x>>(mksch A B`tr`(TL`(Dropwhile (%a.a:int A)`schA)) \
    66 \         @@ (x>>(mksch A B`tr`(TL`(Dropwhile (%a. a:int A)`schA)) \
    67 \                             `schB))";
    67 \                             `schB))";
    68 by (rtac trans 1);
    68 by (rtac trans 1);
    69 by (stac mksch_unfold 1);
    69 by (stac mksch_unfold 1);
    70 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    70 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    71 by (simp_tac (!simpset addsimps [Cons_def]) 1);
    71 by (simp_tac (!simpset addsimps [Cons_def]) 1);
    72 qed"mksch_cons1";
    72 qed"mksch_cons1";
    73 
    73 
    74 goal thy "!!x.[|x~:act A;x:act B|] \
    74 goal thy "!!x.[|x~:act A;x:act B|] \
    75 \   ==> mksch A B`(x>>tr)`schA`schB = \
    75 \   ==> mksch A B`(x>>tr)`schA`schB = \
    76 \        (Takewhile (%a.a:int B)`schB)  \
    76 \        (Takewhile (%a. a:int B)`schB)  \
    77 \         @@ (x>>(mksch A B`tr`schA`(TL`(Dropwhile (%a.a:int B)`schB))  \
    77 \         @@ (x>>(mksch A B`tr`schA`(TL`(Dropwhile (%a. a:int B)`schB))  \
    78 \                            ))";
    78 \                            ))";
    79 by (rtac trans 1);
    79 by (rtac trans 1);
    80 by (stac mksch_unfold 1);
    80 by (stac mksch_unfold 1);
    81 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    81 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    82 by (simp_tac (!simpset addsimps [Cons_def]) 1);
    82 by (simp_tac (!simpset addsimps [Cons_def]) 1);
    83 qed"mksch_cons2";
    83 qed"mksch_cons2";
    84 
    84 
    85 goal thy "!!x.[|x:act A;x:act B|] \
    85 goal thy "!!x.[|x:act A;x:act B|] \
    86 \   ==> mksch A B`(x>>tr)`schA`schB = \
    86 \   ==> mksch A B`(x>>tr)`schA`schB = \
    87 \            (Takewhile (%a.a:int A)`schA) \
    87 \            (Takewhile (%a. a:int A)`schA) \
    88 \         @@ ((Takewhile (%a.a:int B)`schB)  \
    88 \         @@ ((Takewhile (%a. a:int B)`schB)  \
    89 \         @@ (x>>(mksch A B`tr`(TL`(Dropwhile (%a.a:int A)`schA)) \
    89 \         @@ (x>>(mksch A B`tr`(TL`(Dropwhile (%a. a:int A)`schA)) \
    90 \                            `(TL`(Dropwhile (%a.a:int B)`schB))))  \
    90 \                            `(TL`(Dropwhile (%a. a:int B)`schB))))  \
    91 \             )";
    91 \             )";
    92 by (rtac trans 1);
    92 by (rtac trans 1);
    93 by (stac mksch_unfold 1);
    93 by (stac mksch_unfold 1);
    94 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    94 by (asm_full_simp_tac (!simpset addsimps [Cons_def,If_and_if]) 1);
    95 by (simp_tac (!simpset addsimps [Cons_def]) 1);
    95 by (simp_tac (!simpset addsimps [Cons_def]) 1);
   206 
   206 
   207 (* safe-tac makes too many case distinctions with this lemma in the next proof *)
   207 (* safe-tac makes too many case distinctions with this lemma in the next proof *)
   208 Delsimps [FiniteConc];
   208 Delsimps [FiniteConc];
   209 
   209 
   210 goal thy "!! tr. [| Finite tr; is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   210 goal thy "!! tr. [| Finite tr; is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   211 \   ! x y. Forall (%x.x:act A) x & Forall (%x.x:act B) y & \
   211 \   ! x y. Forall (%x. x:act A) x & Forall (%x. x:act B) y & \
   212 \          Filter (%a. a:ext A)`x = Filter (%a. a:act A)`tr & \
   212 \          Filter (%a. a:ext A)`x = Filter (%a. a:act A)`tr & \
   213 \          Filter (%a. a:ext B)`y = Filter (%a. a:act B)`tr &\
   213 \          Filter (%a. a:ext B)`y = Filter (%a. a:act B)`tr &\
   214 \          Forall (%x. x:ext (A||B)) tr \
   214 \          Forall (%x. x:ext (A||B)) tr \
   215 \          --> Finite (mksch A B`tr`x`y)";
   215 \          --> Finite (mksch A B`tr`x`y)";
   216 
   216 
   281 
   281 
   282 (* otherwise subst_lemma2 does not fit exactly, just to avoid a subst_lemma3 *)
   282 (* otherwise subst_lemma2 does not fit exactly, just to avoid a subst_lemma3 *)
   283 Delsimps [FilterConc]; 
   283 Delsimps [FilterConc]; 
   284 
   284 
   285 goal thy " !!bs. [| Finite bs; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  \
   285 goal thy " !!bs. [| Finite bs; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  \
   286 \! y.Forall (%x.x:act B) y & Forall (%x. x:act B & x~:act A) bs &\
   286 \! y. Forall (%x. x:act B) y & Forall (%x. x:act B & x~:act A) bs &\
   287 \    Filter (%a. a:ext B)`y = Filter (%a. a:act B)`(bs @@ z) \
   287 \    Filter (%a. a:ext B)`y = Filter (%a. a:act B)`(bs @@ z) \
   288 \    --> (? y1 y2.  (mksch A B`(bs @@ z)`x`y) = (y1 @@ (mksch A B`z`x`y2)) & \
   288 \    --> (? y1 y2.  (mksch A B`(bs @@ z)`x`y) = (y1 @@ (mksch A B`z`x`y2)) & \
   289 \                   Forall (%x. x:act B & x~:act A) y1 & \
   289 \                   Forall (%x. x:act B & x~:act A) y1 & \
   290 \                   Finite y1 & y = (y1 @@ y2) & \
   290 \                   Finite y1 & y = (y1 @@ y2) & \
   291 \                   Filter (%a. a:ext B)`y1 = bs)";
   291 \                   Filter (%a. a:ext B)`y1 = bs)";
   310                    ("g","Filter (%a. a:act B)`(s@@z)")] subst_lemma2 1);
   310                    ("g","Filter (%a. a:act B)`(s@@z)")] subst_lemma2 1);
   311 by (assume_tac 1);
   311 by (assume_tac 1);
   312 Addsimps [FilterConc]; 
   312 Addsimps [FilterConc]; 
   313 by (asm_full_simp_tac (!simpset addsimps [FilterPTakewhileQnil,not_ext_is_int_or_not_act]) 1);
   313 by (asm_full_simp_tac (!simpset addsimps [FilterPTakewhileQnil,not_ext_is_int_or_not_act]) 1);
   314 (* apply IH *)
   314 (* apply IH *)
   315 by (eres_inst_tac [("x","TL`(Dropwhile (%a.a:int B)`y)")] allE 1);
   315 by (eres_inst_tac [("x","TL`(Dropwhile (%a. a:int B)`y)")] allE 1);
   316 by (asm_full_simp_tac (!simpset addsimps [ForallTL,ForallDropwhile])1);
   316 by (asm_full_simp_tac (!simpset addsimps [ForallTL,ForallDropwhile])1);
   317 by (REPEAT (etac exE 1));
   317 by (REPEAT (etac exE 1));
   318 by (REPEAT (etac conjE 1));
   318 by (REPEAT (etac conjE 1));
   319 by (Asm_full_simp_tac 1); 
   319 by (Asm_full_simp_tac 1); 
   320 (* for replacing IH in conclusion *)
   320 (* for replacing IH in conclusion *)
   321 by (rotate_tac ~2 1); 
   321 by (rotate_tac ~2 1); 
   322 by (Asm_full_simp_tac 1); 
   322 by (Asm_full_simp_tac 1); 
   323 (* instantiate y1a and y2a *)
   323 (* instantiate y1a and y2a *)
   324 by (res_inst_tac [("x","Takewhile (%a.a:int B)`y @@ a>>y1")] exI 1);
   324 by (res_inst_tac [("x","Takewhile (%a. a:int B)`y @@ a>>y1")] exI 1);
   325 by (res_inst_tac [("x","y2")] exI 1);
   325 by (res_inst_tac [("x","y2")] exI 1);
   326 (* elminate all obligations up to two depending on Conc_assoc *)
   326 (* elminate all obligations up to two depending on Conc_assoc *)
   327 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, intA_is_not_actB,
   327 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, intA_is_not_actB,
   328              int_is_act,FilterPTakewhileQnil,int_is_not_ext]) 1); 
   328              int_is_act,FilterPTakewhileQnil,int_is_not_ext]) 1); 
   329 by (simp_tac (!simpset addsimps [Conc_assoc]) 1); 
   329 by (simp_tac (!simpset addsimps [Conc_assoc]) 1); 
   336 (* otherwise subst_lemma2 does not fit exactly, just to avoid a subst_lemma3 *)
   336 (* otherwise subst_lemma2 does not fit exactly, just to avoid a subst_lemma3 *)
   337 Delsimps [FilterConc]; 
   337 Delsimps [FilterConc]; 
   338 
   338 
   339 
   339 
   340 goal thy " !!as. [| Finite as; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  \
   340 goal thy " !!as. [| Finite as; is_asig(asig_of A); is_asig(asig_of B);compatible A B|] ==>  \
   341 \! x.Forall (%x.x:act A) x & Forall (%x. x:act A & x~:act B) as &\
   341 \! x. Forall (%x. x:act A) x & Forall (%x. x:act A & x~:act B) as &\
   342 \    Filter (%a. a:ext A)`x = Filter (%a. a:act A)`(as @@ z) \
   342 \    Filter (%a. a:ext A)`x = Filter (%a. a:act A)`(as @@ z) \
   343 \    --> (? x1 x2.  (mksch A B`(as @@ z)`x`y) = (x1 @@ (mksch A B`z`x2`y)) & \
   343 \    --> (? x1 x2.  (mksch A B`(as @@ z)`x`y) = (x1 @@ (mksch A B`z`x2`y)) & \
   344 \                   Forall (%x. x:act A & x~:act B) x1 & \
   344 \                   Forall (%x. x:act A & x~:act B) x1 & \
   345 \                   Finite x1 & x = (x1 @@ x2) & \
   345 \                   Finite x1 & x = (x1 @@ x2) & \
   346 \                   Filter (%a. a:ext A)`x1 = as)";
   346 \                   Filter (%a. a:ext A)`x1 = as)";
   365                    ("g","Filter (%a. a:act A)`(s@@z)")] subst_lemma2 1);
   365                    ("g","Filter (%a. a:act A)`(s@@z)")] subst_lemma2 1);
   366 by (assume_tac 1);
   366 by (assume_tac 1);
   367 Addsimps [FilterConc]; 
   367 Addsimps [FilterConc]; 
   368 by (asm_full_simp_tac (!simpset addsimps [FilterPTakewhileQnil,not_ext_is_int_or_not_act]) 1);
   368 by (asm_full_simp_tac (!simpset addsimps [FilterPTakewhileQnil,not_ext_is_int_or_not_act]) 1);
   369 (* apply IH *)
   369 (* apply IH *)
   370 by (eres_inst_tac [("x","TL`(Dropwhile (%a.a:int A)`x)")] allE 1);
   370 by (eres_inst_tac [("x","TL`(Dropwhile (%a. a:int A)`x)")] allE 1);
   371 by (asm_full_simp_tac (!simpset addsimps [ForallTL,ForallDropwhile])1);
   371 by (asm_full_simp_tac (!simpset addsimps [ForallTL,ForallDropwhile])1);
   372 by (REPEAT (etac exE 1));
   372 by (REPEAT (etac exE 1));
   373 by (REPEAT (etac conjE 1));
   373 by (REPEAT (etac conjE 1));
   374 by (Asm_full_simp_tac 1); 
   374 by (Asm_full_simp_tac 1); 
   375 (* for replacing IH in conclusion *)
   375 (* for replacing IH in conclusion *)
   376 by (rotate_tac ~2 1); 
   376 by (rotate_tac ~2 1); 
   377 by (Asm_full_simp_tac 1); 
   377 by (Asm_full_simp_tac 1); 
   378 (* instantiate y1a and y2a *)
   378 (* instantiate y1a and y2a *)
   379 by (res_inst_tac [("x","Takewhile (%a.a:int A)`x @@ a>>x1")] exI 1);
   379 by (res_inst_tac [("x","Takewhile (%a. a:int A)`x @@ a>>x1")] exI 1);
   380 by (res_inst_tac [("x","x2")] exI 1);
   380 by (res_inst_tac [("x","x2")] exI 1);
   381 (* elminate all obligations up to two depending on Conc_assoc *)
   381 (* elminate all obligations up to two depending on Conc_assoc *)
   382 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, intA_is_not_actB,
   382 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, intA_is_not_actB,
   383              int_is_act,FilterPTakewhileQnil,int_is_not_ext]) 1); 
   383              int_is_act,FilterPTakewhileQnil,int_is_not_ext]) 1); 
   384 by (simp_tac (!simpset addsimps [Conc_assoc]) 1); 
   384 by (simp_tac (!simpset addsimps [Conc_assoc]) 1); 
   432 by (case_tac "aaa:act A" 2);
   432 by (case_tac "aaa:act A" 2);
   433 by (case_tac "aaa:act B" 2);
   433 by (case_tac "aaa:act B" 2);
   434 by (rotate_tac ~2 2);
   434 by (rotate_tac ~2 2);
   435 by (rotate_tac ~2 3);
   435 by (rotate_tac ~2 3);
   436 by (asm_full_simp_tac (HOL_basic_ss addsimps [mksch_cons3]) 2);
   436 by (asm_full_simp_tac (HOL_basic_ss addsimps [mksch_cons3]) 2);
   437 by (eres_inst_tac [("x","sb@@Takewhile (%a.a: int A)`a @@ Takewhile (%a.a:int B)`b@@(aaa>>nil)")] allE 2);
   437 by (eres_inst_tac [("x","sb@@Takewhile (%a. a: int A)`a @@ Takewhile (%a. a:int B)`b@@(aaa>>nil)")] allE 2);
   438 by (eres_inst_tac [("x","sa")] allE 2);
   438 by (eres_inst_tac [("x","sa")] allE 2);
   439 by (asm_full_simp_tac (!simpset addsimps [Conc_assoc])2);
   439 by (asm_full_simp_tac (!simpset addsimps [Conc_assoc])2);
   440 
   440 
   441 
   441 
   442 
   442 
   479   ------------------------------------------------------------------------------------- *)
   479   ------------------------------------------------------------------------------------- *)
   480 
   480 
   481 goal thy 
   481 goal thy 
   482 "!! A B. [| compatible A B; compatible B A;\
   482 "!! A B. [| compatible A B; compatible B A;\
   483 \           is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   483 \           is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   484 \ ! schA schB. Forall (%x.x:act A) schA & Forall (%x.x:act B) schB & \
   484 \ ! schA schB. Forall (%x. x:act A) schA & Forall (%x. x:act B) schB & \
   485 \ Forall (%x.x:ext (A||B)) tr & \
   485 \ Forall (%x. x:ext (A||B)) tr & \
   486 \ Filter (%a.a:act A)`tr << Filter (%a.a:ext A)`schA &\
   486 \ Filter (%a. a:act A)`tr << Filter (%a. a:ext A)`schA &\
   487 \ Filter (%a.a:act B)`tr << Filter (%a.a:ext B)`schB  \
   487 \ Filter (%a. a:act B)`tr << Filter (%a. a:ext B)`schB  \
   488 \ --> Filter (%a.a:ext (A||B))`(mksch A B`tr`schA`schB) = tr";
   488 \ --> Filter (%a. a:ext (A||B))`(mksch A B`tr`schA`schB) = tr";
   489 
   489 
   490 by (Seq_induct_tac "tr" [Forall_def,sforall_def,mksch_def] 1);
   490 by (Seq_induct_tac "tr" [Forall_def,sforall_def,mksch_def] 1);
   491 
   491 
   492 (* main case *) 
   492 (* main case *) 
   493 (* splitting into 4 cases according to a:A, a:B *)
   493 (* splitting into 4 cases according to a:A, a:B *)
   555                              take lemma
   555                              take lemma
   556   --------------------------------------------------------------------------- *)
   556   --------------------------------------------------------------------------- *)
   557 
   557 
   558 goal thy "!! A B. [| compatible A B; compatible B A; \
   558 goal thy "!! A B. [| compatible A B; compatible B A; \
   559 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   559 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   560 \ Forall (%x.x:ext (A||B)) tr & \
   560 \ Forall (%x. x:ext (A||B)) tr & \
   561 \ Forall (%x.x:act A) schA & Forall (%x.x:act B) schB & \
   561 \ Forall (%x. x:act A) schA & Forall (%x. x:act B) schB & \
   562 \ Filter (%a.a:ext A)`schA = Filter (%a.a:act A)`tr &\
   562 \ Filter (%a. a:ext A)`schA = Filter (%a. a:act A)`tr &\
   563 \ Filter (%a.a:ext B)`schB = Filter (%a.a:act B)`tr &\
   563 \ Filter (%a. a:ext B)`schB = Filter (%a. a:act B)`tr &\
   564 \ LastActExtsch A schA & LastActExtsch B schB  \
   564 \ LastActExtsch A schA & LastActExtsch B schB  \
   565 \ --> Filter (%a.a:act A)`(mksch A B`tr`schA`schB) = schA";
   565 \ --> Filter (%a. a:act A)`(mksch A B`tr`schA`schB) = schA";
   566 
   566 
   567 by (res_inst_tac [("Q","%x. x:act B & x~:act A"),("x","tr")] take_lemma_less_induct 1);
   567 by (res_inst_tac [("Q","%x. x:act B & x~:act A"),("x","tr")] take_lemma_less_induct 1);
   568 by (REPEAT (etac conjE 1));
   568 by (REPEAT (etac conjE 1));
   569 
   569 
   570 by (case_tac "Finite s" 1);
   570 by (case_tac "Finite s" 1);
   611 by (hyp_subst_tac 1);
   611 by (hyp_subst_tac 1);
   612 by (Asm_full_simp_tac  1);
   612 by (Asm_full_simp_tac  1);
   613 
   613 
   614 (* eliminate the B-only prefix *)
   614 (* eliminate the B-only prefix *)
   615 
   615 
   616 by (subgoal_tac "(Filter (%a.a :act A)`y1) = nil" 1);
   616 by (subgoal_tac "(Filter (%a. a :act A)`y1) = nil" 1);
   617 by (etac ForallQFilterPnil 2);
   617 by (etac ForallQFilterPnil 2);
   618 by (assume_tac 2);
   618 by (assume_tac 2);
   619 by (Fast_tac 2);
   619 by (Fast_tac 2);
   620 
   620 
   621 (* Now real recursive step follows (in y) *)
   621 (* Now real recursive step follows (in y) *)
   689 
   689 
   690 
   690 
   691 
   691 
   692 goal thy "!! A B. [| compatible A B; compatible B A; \
   692 goal thy "!! A B. [| compatible A B; compatible B A; \
   693 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   693 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   694 \ Forall (%x.x:ext (A||B)) tr & \
   694 \ Forall (%x. x:ext (A||B)) tr & \
   695 \ Forall (%x.x:act A) schA & Forall (%x.x:act B) schB & \
   695 \ Forall (%x. x:act A) schA & Forall (%x. x:act B) schB & \
   696 \ Filter (%a.a:ext A)`schA = Filter (%a.a:act A)`tr &\
   696 \ Filter (%a. a:ext A)`schA = Filter (%a. a:act A)`tr &\
   697 \ Filter (%a.a:ext B)`schB = Filter (%a.a:act B)`tr &\
   697 \ Filter (%a. a:ext B)`schB = Filter (%a. a:act B)`tr &\
   698 \ LastActExtsch A schA & LastActExtsch B schB  \
   698 \ LastActExtsch A schA & LastActExtsch B schB  \
   699 \ --> Filter (%a.a:act A)`(mksch A B`tr`schA`schB) = schA";
   699 \ --> Filter (%a. a:act A)`(mksch A B`tr`schA`schB) = schA";
   700 
   700 
   701 by (strip_tac 1);
   701 by (strip_tac 1);
   702 by (rtac seq.take_lemma 1);
   702 by (rtac seq.take_lemma 1);
   703 by (rtac mp 1);
   703 by (rtac mp 1);
   704 by (assume_tac 2);
   704 by (assume_tac 2);
   728 by (SELECT_GOAL (auto_tac (!claset addSIs [ForallQFilterPnil,ForallBnAmksch,FiniteL_mksch1],
   728 by (SELECT_GOAL (auto_tac (!claset addSIs [ForallQFilterPnil,ForallBnAmksch,FiniteL_mksch1],
   729                            !simpset)) 1);
   729                            !simpset)) 1);
   730 (* second side: schA = nil *)
   730 (* second side: schA = nil *)
   731 by (eres_inst_tac [("A","A")] LastActExtimplnil 1);
   731 by (eres_inst_tac [("A","A")] LastActExtimplnil 1);
   732 by (Asm_simp_tac 1);
   732 by (Asm_simp_tac 1);
   733 by (eres_inst_tac [("Q","%x.x:act B & x~:act A")] ForallQFilterPnil 1);
   733 by (eres_inst_tac [("Q","%x. x:act B & x~:act A")] ForallQFilterPnil 1);
   734 by (assume_tac 1);
   734 by (assume_tac 1);
   735 by (Fast_tac 1);
   735 by (Fast_tac 1);
   736 
   736 
   737 (* case ~ Finite s *)
   737 (* case ~ Finite s *)
   738 
   738 
   745                                             ForallBnAmksch],
   745                                             ForallBnAmksch],
   746                            !simpset)) 1);
   746                            !simpset)) 1);
   747 (* schA = UU *)
   747 (* schA = UU *)
   748 by (eres_inst_tac [("A","A")] LastActExtimplUU 1);
   748 by (eres_inst_tac [("A","A")] LastActExtimplUU 1);
   749 by (Asm_simp_tac 1);
   749 by (Asm_simp_tac 1);
   750 by (eres_inst_tac [("Q","%x.x:act B & x~:act A")] ForallQFilterPUU 1);
   750 by (eres_inst_tac [("Q","%x. x:act B & x~:act A")] ForallQFilterPUU 1);
   751 by (assume_tac 1);
   751 by (assume_tac 1);
   752 by (Fast_tac 1);
   752 by (Fast_tac 1);
   753 
   753 
   754 (* case" ~ Forall (%x.x:act B & x~:act A) s" *)
   754 (* case" ~ Forall (%x.x:act B & x~:act A) s" *)
   755 
   755 
   769 by (hyp_subst_tac 1);
   769 by (hyp_subst_tac 1);
   770 by (Asm_full_simp_tac  1);
   770 by (Asm_full_simp_tac  1);
   771 
   771 
   772 (* eliminate the B-only prefix *)
   772 (* eliminate the B-only prefix *)
   773 
   773 
   774 by (subgoal_tac "(Filter (%a.a :act A)`y1) = nil" 1);
   774 by (subgoal_tac "(Filter (%a. a :act A)`y1) = nil" 1);
   775 by (etac ForallQFilterPnil 2);
   775 by (etac ForallQFilterPnil 2);
   776 by (assume_tac 2);
   776 by (assume_tac 2);
   777 by (Fast_tac 2);
   777 by (Fast_tac 2);
   778 
   778 
   779 (* Now real recursive step follows (in y) *)
   779 (* Now real recursive step follows (in y) *)
   831 by (forw_inst_tac [("sch1.0","y1")]  LastActExtsmall2 1);
   831 by (forw_inst_tac [("sch1.0","y1")]  LastActExtsmall2 1);
   832 by (assume_tac 1);
   832 by (assume_tac 1);
   833 
   833 
   834 (* assumption Forall schA *)
   834 (* assumption Forall schA *)
   835 by (dres_inst_tac [("s","schA"),
   835 by (dres_inst_tac [("s","schA"),
   836                    ("P","Forall (%x.x:act A)")] subst 1);
   836                    ("P","Forall (%x. x:act A)")] subst 1);
   837 by (assume_tac 1);
   837 by (assume_tac 1);
   838 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, int_is_act]) 1);
   838 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, int_is_act]) 1);
   839 
   839 
   840 (* case x:actions(asig_of A) & x: actions(asig_of B) *)
   840 (* case x:actions(asig_of A) & x: actions(asig_of B) *)
   841 
   841 
   931 
   931 
   932 
   932 
   933 
   933 
   934 goal thy "!! A B. [| compatible A B; compatible B A; \
   934 goal thy "!! A B. [| compatible A B; compatible B A; \
   935 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   935 \ is_asig(asig_of A); is_asig(asig_of B) |] ==> \
   936 \ Forall (%x.x:ext (A||B)) tr & \
   936 \ Forall (%x. x:ext (A||B)) tr & \
   937 \ Forall (%x.x:act A) schA & Forall (%x.x:act B) schB & \
   937 \ Forall (%x. x:act A) schA & Forall (%x. x:act B) schB & \
   938 \ Filter (%a.a:ext A)`schA = Filter (%a.a:act A)`tr &\
   938 \ Filter (%a. a:ext A)`schA = Filter (%a. a:act A)`tr &\
   939 \ Filter (%a.a:ext B)`schB = Filter (%a.a:act B)`tr &\
   939 \ Filter (%a. a:ext B)`schB = Filter (%a. a:act B)`tr &\
   940 \ LastActExtsch A schA & LastActExtsch B schB  \
   940 \ LastActExtsch A schA & LastActExtsch B schB  \
   941 \ --> Filter (%a.a:act B)`(mksch A B`tr`schA`schB) = schB";
   941 \ --> Filter (%a. a:act B)`(mksch A B`tr`schA`schB) = schB";
   942 
   942 
   943 by (strip_tac 1);
   943 by (strip_tac 1);
   944 by (rtac seq.take_lemma 1);
   944 by (rtac seq.take_lemma 1);
   945 by (rtac mp 1);
   945 by (rtac mp 1);
   946 by (assume_tac 2);
   946 by (assume_tac 2);
   970 by (SELECT_GOAL (auto_tac (!claset addSIs [ForallQFilterPnil,ForallAnBmksch,FiniteL_mksch1],
   970 by (SELECT_GOAL (auto_tac (!claset addSIs [ForallQFilterPnil,ForallAnBmksch,FiniteL_mksch1],
   971                            !simpset)) 1);
   971                            !simpset)) 1);
   972 (* second side: schA = nil *)
   972 (* second side: schA = nil *)
   973 by (eres_inst_tac [("A","B")] LastActExtimplnil 1);
   973 by (eres_inst_tac [("A","B")] LastActExtimplnil 1);
   974 by (Asm_simp_tac 1);
   974 by (Asm_simp_tac 1);
   975 by (eres_inst_tac [("Q","%x.x:act A & x~:act B")] ForallQFilterPnil 1);
   975 by (eres_inst_tac [("Q","%x. x:act A & x~:act B")] ForallQFilterPnil 1);
   976 by (assume_tac 1);
   976 by (assume_tac 1);
   977 by (Fast_tac 1);
   977 by (Fast_tac 1);
   978 
   978 
   979 (* case ~ Finite tr *)
   979 (* case ~ Finite tr *)
   980 
   980 
   987                                             ForallAnBmksch],
   987                                             ForallAnBmksch],
   988                            !simpset)) 1);
   988                            !simpset)) 1);
   989 (* schA = UU *)
   989 (* schA = UU *)
   990 by (eres_inst_tac [("A","B")] LastActExtimplUU 1);
   990 by (eres_inst_tac [("A","B")] LastActExtimplUU 1);
   991 by (Asm_simp_tac 1);
   991 by (Asm_simp_tac 1);
   992 by (eres_inst_tac [("Q","%x.x:act A & x~:act B")] ForallQFilterPUU 1);
   992 by (eres_inst_tac [("Q","%x. x:act A & x~:act B")] ForallQFilterPUU 1);
   993 by (assume_tac 1);
   993 by (assume_tac 1);
   994 by (Fast_tac 1);
   994 by (Fast_tac 1);
   995 
   995 
   996 (* case" ~ Forall (%x.x:act B & x~:act A) s" *)
   996 (* case" ~ Forall (%x.x:act B & x~:act A) s" *)
   997 
   997 
  1011 by (hyp_subst_tac 1);
  1011 by (hyp_subst_tac 1);
  1012 by (Asm_full_simp_tac  1);
  1012 by (Asm_full_simp_tac  1);
  1013 
  1013 
  1014 (* eliminate the A-only prefix *)
  1014 (* eliminate the A-only prefix *)
  1015 
  1015 
  1016 by (subgoal_tac "(Filter (%a.a :act B)`x1) = nil" 1);
  1016 by (subgoal_tac "(Filter (%a. a :act B)`x1) = nil" 1);
  1017 by (etac ForallQFilterPnil 2);
  1017 by (etac ForallQFilterPnil 2);
  1018 by (assume_tac 2);
  1018 by (assume_tac 2);
  1019 by (Fast_tac 2);
  1019 by (Fast_tac 2);
  1020 
  1020 
  1021 (* Now real recursive step follows (in x) *)
  1021 (* Now real recursive step follows (in x) *)
  1073 by (forw_inst_tac [("sch1.0","x1")]  LastActExtsmall2 1);
  1073 by (forw_inst_tac [("sch1.0","x1")]  LastActExtsmall2 1);
  1074 by (assume_tac 1);
  1074 by (assume_tac 1);
  1075 
  1075 
  1076 (* assumption Forall schB *)
  1076 (* assumption Forall schB *)
  1077 by (dres_inst_tac [("s","schB"),
  1077 by (dres_inst_tac [("s","schB"),
  1078                    ("P","Forall (%x.x:act B)")] subst 1);
  1078                    ("P","Forall (%x. x:act B)")] subst 1);
  1079 by (assume_tac 1);
  1079 by (assume_tac 1);
  1080 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, int_is_act]) 1);
  1080 by (asm_full_simp_tac (!simpset addsimps [ForallPTakewhileQ, int_is_act]) 1);
  1081 
  1081 
  1082 (* case x:actions(asig_of A) & x: actions(asig_of B) *)
  1082 (* case x:actions(asig_of A) & x: actions(asig_of B) *)
  1083 
  1083 
  1171  
  1171  
  1172 goal thy 
  1172 goal thy 
  1173 "!! A B. [| is_trans_of A; is_trans_of B; compatible A B; compatible B A; \
  1173 "!! A B. [| is_trans_of A; is_trans_of B; compatible A B; compatible B A; \
  1174 \           is_asig(asig_of A); is_asig(asig_of B)|] \
  1174 \           is_asig(asig_of A); is_asig(asig_of B)|] \
  1175 \       ==>  tr: traces(A||B) = \
  1175 \       ==>  tr: traces(A||B) = \
  1176 \            (Filter (%a.a:act A)`tr : traces A &\
  1176 \            (Filter (%a. a:act A)`tr : traces A &\
  1177 \             Filter (%a.a:act B)`tr : traces B &\
  1177 \             Filter (%a. a:act B)`tr : traces B &\
  1178 \             Forall (%x. x:ext(A||B)) tr)";
  1178 \             Forall (%x. x:ext(A||B)) tr)";
  1179 
  1179 
  1180 by (simp_tac (!simpset addsimps [traces_def,has_trace_def]) 1);
  1180 by (simp_tac (!simpset addsimps [traces_def,has_trace_def]) 1);
  1181 by (safe_tac set_cs);
  1181 by (safe_tac set_cs);
  1182  
  1182  
  1183 (* ==> *) 
  1183 (* ==> *) 
  1184 (* There is a schedule of A *)
  1184 (* There is a schedule of A *)
  1185 by (res_inst_tac [("x","Filter (%a.a:act A)`sch")] bexI 1);
  1185 by (res_inst_tac [("x","Filter (%a. a:act A)`sch")] bexI 1);
  1186 by (asm_full_simp_tac (!simpset addsimps [compositionality_sch]) 2);
  1186 by (asm_full_simp_tac (!simpset addsimps [compositionality_sch]) 2);
  1187 by (asm_full_simp_tac (!simpset addsimps [compatibility_consequence1,
  1187 by (asm_full_simp_tac (!simpset addsimps [compatibility_consequence1,
  1188                   externals_of_par,ext1_ext2_is_not_act1]) 1);
  1188                   externals_of_par,ext1_ext2_is_not_act1]) 1);
  1189 (* There is a schedule of B *)
  1189 (* There is a schedule of B *)
  1190 by (res_inst_tac [("x","Filter (%a.a:act B)`sch")] bexI 1);
  1190 by (res_inst_tac [("x","Filter (%a. a:act B)`sch")] bexI 1);
  1191 by (asm_full_simp_tac (!simpset addsimps [compositionality_sch]) 2);
  1191 by (asm_full_simp_tac (!simpset addsimps [compositionality_sch]) 2);
  1192 by (asm_full_simp_tac (!simpset addsimps [compatibility_consequence2,
  1192 by (asm_full_simp_tac (!simpset addsimps [compatibility_consequence2,
  1193                   externals_of_par,ext1_ext2_is_not_act2]) 1);
  1193                   externals_of_par,ext1_ext2_is_not_act2]) 1);
  1194 (* Traces of A||B have only external actions from A or B *)  
  1194 (* Traces of A||B have only external actions from A or B *)  
  1195 by (rtac ForallPFilterP 1);
  1195 by (rtac ForallPFilterP 1);