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