src/HOLCF/IOA/meta_theory/CompoExecs.ML
changeset 5068 fb28eaa07e01
parent 4833 2e53109d4bc8
child 7229 6773ba0c36d5
equal deleted inserted replaced
5067:62b6288e6005 5068:fb28eaa07e01
    18 (* ---------------------------------------------------------------- *)
    18 (* ---------------------------------------------------------------- *)
    19 (*                               ProjA2                             *)
    19 (*                               ProjA2                             *)
    20 (* ---------------------------------------------------------------- *)
    20 (* ---------------------------------------------------------------- *)
    21 
    21 
    22 
    22 
    23 goal thy  "ProjA2`UU = UU";
    23 Goal  "ProjA2`UU = UU";
    24 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    24 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    25 qed"ProjA2_UU";
    25 qed"ProjA2_UU";
    26 
    26 
    27 goal thy  "ProjA2`nil = nil";
    27 Goal  "ProjA2`nil = nil";
    28 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    28 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    29 qed"ProjA2_nil";
    29 qed"ProjA2_nil";
    30 
    30 
    31 goal thy "ProjA2`((a,t)>>xs) = (a,fst t) >> ProjA2`xs";
    31 Goal "ProjA2`((a,t)>>xs) = (a,fst t) >> ProjA2`xs";
    32 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    32 by (simp_tac (simpset() addsimps [ProjA2_def]) 1);
    33 qed"ProjA2_cons";
    33 qed"ProjA2_cons";
    34 
    34 
    35 
    35 
    36 (* ---------------------------------------------------------------- *)
    36 (* ---------------------------------------------------------------- *)
    37 (*                               ProjB2                             *)
    37 (*                               ProjB2                             *)
    38 (* ---------------------------------------------------------------- *)
    38 (* ---------------------------------------------------------------- *)
    39 
    39 
    40 
    40 
    41 goal thy  "ProjB2`UU = UU";
    41 Goal  "ProjB2`UU = UU";
    42 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    42 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    43 qed"ProjB2_UU";
    43 qed"ProjB2_UU";
    44 
    44 
    45 goal thy  "ProjB2`nil = nil";
    45 Goal  "ProjB2`nil = nil";
    46 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    46 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    47 qed"ProjB2_nil";
    47 qed"ProjB2_nil";
    48 
    48 
    49 goal thy "ProjB2`((a,t)>>xs) = (a,snd t) >> ProjB2`xs";
    49 Goal "ProjB2`((a,t)>>xs) = (a,snd t) >> ProjB2`xs";
    50 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    50 by (simp_tac (simpset() addsimps [ProjB2_def]) 1);
    51 qed"ProjB2_cons";
    51 qed"ProjB2_cons";
    52 
    52 
    53 
    53 
    54 
    54 
    55 (* ---------------------------------------------------------------- *)
    55 (* ---------------------------------------------------------------- *)
    56 (*                             Filter_ex2                           *)
    56 (*                             Filter_ex2                           *)
    57 (* ---------------------------------------------------------------- *)
    57 (* ---------------------------------------------------------------- *)
    58 
    58 
    59 
    59 
    60 goal thy "Filter_ex2 sig`UU=UU";
    60 Goal "Filter_ex2 sig`UU=UU";
    61 by (simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    61 by (simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    62 qed"Filter_ex2_UU";
    62 qed"Filter_ex2_UU";
    63 
    63 
    64 goal thy "Filter_ex2 sig`nil=nil";
    64 Goal "Filter_ex2 sig`nil=nil";
    65 by (simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    65 by (simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    66 qed"Filter_ex2_nil";
    66 qed"Filter_ex2_nil";
    67 
    67 
    68 goal thy "Filter_ex2 sig`(at >> xs) =    \
    68 Goal "Filter_ex2 sig`(at >> xs) =    \
    69 \            (if (fst at:actions sig)    \       
    69 \            (if (fst at:actions sig)    \       
    70 \                 then at >> (Filter_ex2 sig`xs) \   
    70 \                 then at >> (Filter_ex2 sig`xs) \   
    71 \                 else        Filter_ex2 sig`xs)";
    71 \                 else        Filter_ex2 sig`xs)";
    72 
    72 
    73 by (asm_full_simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    73 by (asm_full_simp_tac (simpset() addsimps [Filter_ex2_def]) 1);
    77 (* ---------------------------------------------------------------- *)
    77 (* ---------------------------------------------------------------- *)
    78 (*                             stutter2                             *)
    78 (*                             stutter2                             *)
    79 (* ---------------------------------------------------------------- *)
    79 (* ---------------------------------------------------------------- *)
    80 
    80 
    81 
    81 
    82 goal thy "stutter2 sig = (LAM ex. (%s. case ex of \
    82 Goal "stutter2 sig = (LAM ex. (%s. case ex of \
    83 \      nil => TT \
    83 \      nil => TT \
    84 \    | x##xs => (flift1 \ 
    84 \    | x##xs => (flift1 \ 
    85 \            (%p.(If Def ((fst p)~:actions sig) \
    85 \            (%p.(If Def ((fst p)~:actions sig) \
    86 \                 then Def (s=(snd p)) \
    86 \                 then Def (s=(snd p)) \
    87 \                 else TT fi) \
    87 \                 else TT fi) \
    93 by (rtac stutter2_def 1);
    93 by (rtac stutter2_def 1);
    94 by (rtac beta_cfun 1);
    94 by (rtac beta_cfun 1);
    95 by (simp_tac (simpset() addsimps [flift1_def]) 1);
    95 by (simp_tac (simpset() addsimps [flift1_def]) 1);
    96 qed"stutter2_unfold";
    96 qed"stutter2_unfold";
    97 
    97 
    98 goal thy "(stutter2 sig`UU) s=UU";
    98 Goal "(stutter2 sig`UU) s=UU";
    99 by (stac stutter2_unfold 1);
    99 by (stac stutter2_unfold 1);
   100 by (Simp_tac 1);
   100 by (Simp_tac 1);
   101 qed"stutter2_UU";
   101 qed"stutter2_UU";
   102 
   102 
   103 goal thy "(stutter2 sig`nil) s = TT";
   103 Goal "(stutter2 sig`nil) s = TT";
   104 by (stac stutter2_unfold 1);
   104 by (stac stutter2_unfold 1);
   105 by (Simp_tac 1);
   105 by (Simp_tac 1);
   106 qed"stutter2_nil";
   106 qed"stutter2_nil";
   107 
   107 
   108 goal thy "(stutter2 sig`(at>>xs)) s = \
   108 Goal "(stutter2 sig`(at>>xs)) s = \
   109 \              ((if (fst at)~:actions sig then Def (s=snd at) else TT) \
   109 \              ((if (fst at)~:actions sig then Def (s=snd at) else TT) \
   110 \                andalso (stutter2 sig`xs) (snd at))"; 
   110 \                andalso (stutter2 sig`xs) (snd at))"; 
   111 by (rtac trans 1);
   111 by (rtac trans 1);
   112 by (stac stutter2_unfold 1);
   112 by (stac stutter2_unfold 1);
   113 by (asm_full_simp_tac (simpset() addsimps [Cons_def,flift1_def,If_and_if]) 1);
   113 by (asm_full_simp_tac (simpset() addsimps [Cons_def,flift1_def,If_and_if]) 1);
   120 
   120 
   121 (* ---------------------------------------------------------------- *)
   121 (* ---------------------------------------------------------------- *)
   122 (*                             stutter                              *)
   122 (*                             stutter                              *)
   123 (* ---------------------------------------------------------------- *)
   123 (* ---------------------------------------------------------------- *)
   124 
   124 
   125 goal thy "stutter sig (s, UU)";
   125 Goal "stutter sig (s, UU)";
   126 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   126 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   127 qed"stutter_UU";
   127 qed"stutter_UU";
   128 
   128 
   129 goal thy "stutter sig (s, nil)";
   129 Goal "stutter sig (s, nil)";
   130 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   130 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   131 qed"stutter_nil";
   131 qed"stutter_nil";
   132 
   132 
   133 goal thy "stutter sig (s, (a,t)>>ex) = \
   133 Goal "stutter sig (s, (a,t)>>ex) = \
   134 \     ((a~:actions sig --> (s=t)) & stutter sig (t,ex))";
   134 \     ((a~:actions sig --> (s=t)) & stutter sig (t,ex))";
   135 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   135 by (simp_tac (simpset() addsimps [stutter_def]) 1);
   136 qed"stutter_cons";
   136 qed"stutter_cons";
   137 
   137 
   138 (* ----------------------------------------------------------------------------------- *)
   138 (* ----------------------------------------------------------------------------------- *)
   156 
   156 
   157 (* --------------------------------------------------------------------- *)
   157 (* --------------------------------------------------------------------- *)
   158 (*  Lemma_1_1a : is_ex_fr propagates from A||B to Projections A and B    *)
   158 (*  Lemma_1_1a : is_ex_fr propagates from A||B to Projections A and B    *)
   159 (* --------------------------------------------------------------------- *)
   159 (* --------------------------------------------------------------------- *)
   160 
   160 
   161 goal thy "!s. is_exec_frag (A||B) (s,xs) \
   161 Goal "!s. is_exec_frag (A||B) (s,xs) \
   162 \      -->  is_exec_frag A (fst s, Filter_ex2 (asig_of A)`(ProjA2`xs)) &\
   162 \      -->  is_exec_frag A (fst s, Filter_ex2 (asig_of A)`(ProjA2`xs)) &\
   163 \           is_exec_frag B (snd s, Filter_ex2 (asig_of B)`(ProjB2`xs))";
   163 \           is_exec_frag B (snd s, Filter_ex2 (asig_of B)`(ProjB2`xs))";
   164 
   164 
   165 by (pair_induct_tac "xs" [is_exec_frag_def] 1);
   165 by (pair_induct_tac "xs" [is_exec_frag_def] 1);
   166 (* main case *)
   166 (* main case *)
   172 
   172 
   173 (* --------------------------------------------------------------------- *)
   173 (* --------------------------------------------------------------------- *)
   174 (*  Lemma_1_1b : is_ex_fr (A||B) implies stuttering on Projections       *)
   174 (*  Lemma_1_1b : is_ex_fr (A||B) implies stuttering on Projections       *)
   175 (* --------------------------------------------------------------------- *)
   175 (* --------------------------------------------------------------------- *)
   176 
   176 
   177 goal thy "!s. is_exec_frag (A||B) (s,xs) \
   177 Goal "!s. is_exec_frag (A||B) (s,xs) \
   178 \      --> stutter (asig_of A) (fst s,ProjA2`xs)  &\
   178 \      --> stutter (asig_of A) (fst s,ProjA2`xs)  &\
   179 \          stutter (asig_of B) (snd s,ProjB2`xs)"; 
   179 \          stutter (asig_of B) (snd s,ProjB2`xs)"; 
   180 
   180 
   181 by (pair_induct_tac "xs" [stutter_def,is_exec_frag_def] 1);
   181 by (pair_induct_tac "xs" [stutter_def,is_exec_frag_def] 1);
   182 (* main case *)
   182 (* main case *)
   187 
   187 
   188 (* --------------------------------------------------------------------- *)
   188 (* --------------------------------------------------------------------- *)
   189 (*  Lemma_1_1c : Executions of A||B have only  A- or B-actions           *)
   189 (*  Lemma_1_1c : Executions of A||B have only  A- or B-actions           *)
   190 (* --------------------------------------------------------------------- *)
   190 (* --------------------------------------------------------------------- *)
   191 
   191 
   192 goal thy "!s. (is_exec_frag (A||B) (s,xs) \
   192 Goal "!s. (is_exec_frag (A||B) (s,xs) \
   193 \  --> Forall (%x. fst x:act (A||B)) xs)";
   193 \  --> Forall (%x. fst x:act (A||B)) xs)";
   194 
   194 
   195 by (pair_induct_tac "xs" [Forall_def,sforall_def,is_exec_frag_def] 1);
   195 by (pair_induct_tac "xs" [Forall_def,sforall_def,is_exec_frag_def] 1);
   196 (* main case *)
   196 (* main case *)
   197 by (safe_tac set_cs);
   197 by (safe_tac set_cs);
   202 
   202 
   203 (* ----------------------------------------------------------------------- *)
   203 (* ----------------------------------------------------------------------- *)
   204 (*  Lemma_1_2 : ex A, exB, stuttering and forall a:A|B implies ex (A||B)   *)
   204 (*  Lemma_1_2 : ex A, exB, stuttering and forall a:A|B implies ex (A||B)   *)
   205 (* ----------------------------------------------------------------------- *)
   205 (* ----------------------------------------------------------------------- *)
   206 
   206 
   207 goal thy 
   207 Goal 
   208 "!s. is_exec_frag A (fst s,Filter_ex2 (asig_of A)`(ProjA2`xs)) &\
   208 "!s. is_exec_frag A (fst s,Filter_ex2 (asig_of A)`(ProjA2`xs)) &\
   209 \    is_exec_frag B (snd s,Filter_ex2 (asig_of B)`(ProjB2`xs)) &\
   209 \    is_exec_frag B (snd s,Filter_ex2 (asig_of B)`(ProjB2`xs)) &\
   210 \    stutter (asig_of A) (fst s,(ProjA2`xs)) & \
   210 \    stutter (asig_of A) (fst s,(ProjA2`xs)) & \
   211 \    stutter (asig_of B) (snd s,(ProjB2`xs)) & \
   211 \    stutter (asig_of B) (snd s,(ProjB2`xs)) & \
   212 \    Forall (%x. fst x:act (A||B)) xs \
   212 \    Forall (%x. fst x:act (A||B)) xs \
   228 (*           COMPOSITIONALITY   on    EXECUTION     Level             *)
   228 (*           COMPOSITIONALITY   on    EXECUTION     Level             *)
   229 (*                          Main Theorem                              *)
   229 (*                          Main Theorem                              *)
   230 (* ------------------------------------------------------------------ *)
   230 (* ------------------------------------------------------------------ *)
   231 
   231 
   232 
   232 
   233 goal thy 
   233 Goal 
   234 "ex:executions(A||B) =\
   234 "ex:executions(A||B) =\
   235 \(Filter_ex (asig_of A) (ProjA ex) : executions A &\
   235 \(Filter_ex (asig_of A) (ProjA ex) : executions A &\
   236 \ Filter_ex (asig_of B) (ProjB ex) : executions B &\
   236 \ Filter_ex (asig_of B) (ProjB ex) : executions B &\
   237 \ stutter (asig_of A) (ProjA ex) & stutter (asig_of B) (ProjB ex) &\
   237 \ stutter (asig_of A) (ProjA ex) & stutter (asig_of B) (ProjB ex) &\
   238 \ Forall (%x. fst x:act (A||B)) (snd ex))";
   238 \ Forall (%x. fst x:act (A||B)) (snd ex))";
   254 (* ------------------------------------------------------------------ *)
   254 (* ------------------------------------------------------------------ *)
   255 (*           COMPOSITIONALITY   on    EXECUTION     Level             *)
   255 (*           COMPOSITIONALITY   on    EXECUTION     Level             *)
   256 (*                            For Modules                             *)
   256 (*                            For Modules                             *)
   257 (* ------------------------------------------------------------------ *)
   257 (* ------------------------------------------------------------------ *)
   258 
   258 
   259 goalw thy [Execs_def,par_execs_def]
   259 Goalw [Execs_def,par_execs_def]
   260 
   260 
   261 "Execs (A||B) = par_execs (Execs A) (Execs B)";
   261 "Execs (A||B) = par_execs (Execs A) (Execs B)";
   262 
   262 
   263 by (asm_full_simp_tac (simpset() addsimps [asig_of_par]) 1);
   263 by (asm_full_simp_tac (simpset() addsimps [asig_of_par]) 1);
   264 by (rtac set_ext 1);
   264 by (rtac set_ext 1);