src/HOL/IOA/Solve.ML
changeset 17288 aa3833fb7bee
parent 7499 23e090051cb8
equal deleted inserted replaced
17287:bd49e10bbd24 17288:aa3833fb7bee
     1 (*  Title:      HOL/IOA/Solve.ML
     1 (*  Title:      HOL/IOA/Solve.ML
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Tobias Nipkow & Konrad Slind
     3     Author:     Tobias Nipkow & Konrad Slind
     4     Copyright   1994  TU Muenchen
     4     Copyright   1994  TU Muenchen
     5 
       
     6 Weak possibilities mapping (abstraction)
       
     7 *)
     5 *)
     8 
       
     9 open Solve; 
       
    10 
     6 
    11 Addsimps [mk_trace_thm,trans_in_actions];
     7 Addsimps [mk_trace_thm,trans_in_actions];
    12 
     8 
    13 Goalw [is_weak_pmap_def,traces_def]
     9 Goalw [is_weak_pmap_def,traces_def]
    14   "!!f. [| IOA(C); IOA(A); externals(asig_of(C)) = externals(asig_of(A)); \
    10   "!!f. [| IOA(C); IOA(A); externals(asig_of(C)) = externals(asig_of(A)); \
    55   by (fast_tac (claset() addDs prems) 1);
    51   by (fast_tac (claset() addDs prems) 1);
    56 val imp_conj_lemma = result();
    52 val imp_conj_lemma = result();
    57 
    53 
    58 
    54 
    59 (* fist_order_tautology of externals_of_par *)
    55 (* fist_order_tautology of externals_of_par *)
    60 goal IOA.thy "a:externals(asig_of(A1||A2)) =    \
    56 goal (theory "IOA") "a:externals(asig_of(A1||A2)) =    \
    61 \  (a:externals(asig_of(A1)) & a:externals(asig_of(A2)) |  \
    57 \  (a:externals(asig_of(A1)) & a:externals(asig_of(A2)) |  \
    62 \  a:externals(asig_of(A1)) & a~:externals(asig_of(A2)) |  \
    58 \  a:externals(asig_of(A1)) & a~:externals(asig_of(A2)) |  \
    63 \  a~:externals(asig_of(A1)) & a:externals(asig_of(A2)))";
    59 \  a~:externals(asig_of(A1)) & a:externals(asig_of(A2)))";
    64 by (asm_full_simp_tac (simpset() addsimps [externals_def,asig_of_par,asig_comp_def,asig_inputs_def,asig_outputs_def]) 1);
    60 by (asm_full_simp_tac (simpset() addsimps [externals_def,asig_of_par,asig_comp_def,asig_inputs_def,asig_outputs_def]) 1);
    65  by (Fast_tac 1);
    61  by (Fast_tac 1);
    66 val externals_of_par_extra = result(); 
    62 val externals_of_par_extra = result();
    67 
    63 
    68 Goal "[| reachable (C1||C2) s |] ==> reachable C1 (fst s)";
    64 Goal "[| reachable (C1||C2) s |] ==> reachable C1 (fst s)";
    69 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1); 
    65 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1);
    70 by (etac bexE 1);
    66 by (etac bexE 1);
    71 by (res_inst_tac [("x",
    67 by (res_inst_tac [("x",
    72    "(filter_oseq (%a. a:actions(asig_of(C1))) \
    68    "(filter_oseq (%a. a:actions(asig_of(C1))) \
    73 \                (fst ex),                                                \
    69 \                (fst ex),                                                \
    74 \    %i. fst (snd ex i))")]  bexI 1);
    70 \    %i. fst (snd ex i))")]  bexI 1);
    75 (* fst(s) is in projected execution *)
    71 (* fst(s) is in projected execution *)
    76  by (Force_tac 1);
    72  by (Force_tac 1);
    77 (* projected execution is indeed an execution *)
    73 (* projected execution is indeed an execution *)
    78 by (asm_full_simp_tac
    74 by (asm_full_simp_tac
    79       (simpset() delcongs [if_weak_cong]
    75       (simpset() delcongs [if_weak_cong]
    80 		 addsimps [executions_def,is_execution_fragment_def,
    76                  addsimps [executions_def,is_execution_fragment_def,
    81 			   par_def,starts_of_def,trans_of_def,filter_oseq_def]
    77                            par_def,starts_of_def,trans_of_def,filter_oseq_def]
    82                  addsplits [option.split]) 1);
    78                  addsplits [option.split]) 1);
    83 qed"comp1_reachable";
    79 qed"comp1_reachable";
    84 
    80 
    85 
    81 
    86 (* Exact copy of proof of comp1_reachable for the second 
    82 (* Exact copy of proof of comp1_reachable for the second
    87    component of a parallel composition.     *)
    83    component of a parallel composition.     *)
    88 Goal "[| reachable (C1||C2) s|] ==> reachable C2 (snd s)";
    84 Goal "[| reachable (C1||C2) s|] ==> reachable C2 (snd s)";
    89 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1); 
    85 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1);
    90 by (etac bexE 1);
    86 by (etac bexE 1);
    91 by (res_inst_tac [("x",
    87 by (res_inst_tac [("x",
    92    "(filter_oseq (%a. a:actions(asig_of(C2)))\
    88    "(filter_oseq (%a. a:actions(asig_of(C2)))\
    93 \                (fst ex),                                                \
    89 \                (fst ex),                                                \
    94 \    %i. snd (snd ex i))")]  bexI 1);
    90 \    %i. snd (snd ex i))")]  bexI 1);
    95 (* fst(s) is in projected execution *)
    91 (* fst(s) is in projected execution *)
    96  by (Force_tac 1);
    92  by (Force_tac 1);
    97 (* projected execution is indeed an execution *)
    93 (* projected execution is indeed an execution *)
    98 by (asm_full_simp_tac
    94 by (asm_full_simp_tac
    99       (simpset() delcongs [if_weak_cong]
    95       (simpset() delcongs [if_weak_cong]
   100 		 addsimps [executions_def,is_execution_fragment_def,
    96                  addsimps [executions_def,is_execution_fragment_def,
   101 			   par_def,starts_of_def,trans_of_def,filter_oseq_def]
    97                            par_def,starts_of_def,trans_of_def,filter_oseq_def]
   102                  addsplits [option.split]) 1);
    98                  addsplits [option.split]) 1);
   103 qed"comp2_reachable";
    99 qed"comp2_reachable";
   104 
   100 
   105 Delsplits [split_if]; Delcongs [if_weak_cong];
   101 Delsplits [split_if]; Delcongs [if_weak_cong];
   106 
   102 
   122 by (simp_tac (simpset() addsimps [externals_of_par_extra]) 1);
   118 by (simp_tac (simpset() addsimps [externals_of_par_extra]) 1);
   123 by (simp_tac (simpset() addsimps [par_def]) 1);
   119 by (simp_tac (simpset() addsimps [par_def]) 1);
   124 by (asm_full_simp_tac (simpset() addsimps [trans_of_def]) 1);
   120 by (asm_full_simp_tac (simpset() addsimps [trans_of_def]) 1);
   125 by (stac split_if 1);
   121 by (stac split_if 1);
   126 by (rtac conjI 1);
   122 by (rtac conjI 1);
   127 by (rtac impI 1); 
   123 by (rtac impI 1);
   128 by (etac disjE 1);
   124 by (etac disjE 1);
   129 (* case 1      a:e(A1) | a:e(A2) *)
   125 (* case 1      a:e(A1) | a:e(A2) *)
   130 by (asm_full_simp_tac (simpset() addsimps [comp1_reachable,comp2_reachable,
   126 by (asm_full_simp_tac (simpset() addsimps [comp1_reachable,comp2_reachable,
   131                                     ext_is_act]) 1);
   127                                     ext_is_act]) 1);
   132 by (etac disjE 1);
   128 by (etac disjE 1);
   143 by (Asm_full_simp_tac 2);
   139 by (Asm_full_simp_tac 2);
   144 by (Fast_tac 2);
   140 by (Fast_tac 2);
   145 by (simp_tac (simpset() addsimps [conj_disj_distribR] addcongs [conj_cong]
   141 by (simp_tac (simpset() addsimps [conj_disj_distribR] addcongs [conj_cong]
   146                  addsplits [split_if]) 1);
   142                  addsplits [split_if]) 1);
   147 by (REPEAT((resolve_tac [conjI,impI] 1 ORELSE etac conjE 1) THEN
   143 by (REPEAT((resolve_tac [conjI,impI] 1 ORELSE etac conjE 1) THEN
   148 	   asm_full_simp_tac(simpset() addsimps[comp1_reachable,
   144            asm_full_simp_tac(simpset() addsimps[comp1_reachable,
   149 						comp2_reachable])1));
   145                                                 comp2_reachable])1));
   150 qed"fxg_is_weak_pmap_of_product_IOA";
   146 qed"fxg_is_weak_pmap_of_product_IOA";
   151 
   147 
   152 
   148 
   153 Goal "[| reachable (rename C g) s |] ==> reachable C s";
   149 Goal "[| reachable (rename C g) s |] ==> reachable C s";
   154 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1); 
   150 by (asm_full_simp_tac (simpset() addsimps [reachable_def]) 1);
   155 by (etac bexE 1);
   151 by (etac bexE 1);
   156 by (res_inst_tac [("x",
   152 by (res_inst_tac [("x",
   157    "((%i. case (fst ex i) \
   153    "((%i. case (fst ex i) \
   158 \         of None => None\
   154 \         of None => None\
   159 \          | Some(x) => g x) ,snd ex)")]  bexI 1);
   155 \          | Some(x) => g x) ,snd ex)")]  bexI 1);
   200 by (REPEAT (hyp_subst_tac 1));
   196 by (REPEAT (hyp_subst_tac 1));
   201 by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1);
   197 by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1);
   202 by (assume_tac 1);
   198 by (assume_tac 1);
   203 by (Asm_full_simp_tac 1);
   199 by (Asm_full_simp_tac 1);
   204 (* x is internal *)
   200 (* x is internal *)
   205 by (simp_tac (simpset() addsimps [de_Morgan_disj, de_Morgan_conj, not_ex] 
   201 by (simp_tac (simpset() addsimps [de_Morgan_disj, de_Morgan_conj, not_ex]
   206 	               addcongs [conj_cong]) 1);
   202                        addcongs [conj_cong]) 1);
   207 by (rtac impI 1);
   203 by (rtac impI 1);
   208 by (etac conjE 1);
   204 by (etac conjE 1);
   209 by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1);
   205 by (cut_inst_tac [("C","C"),("g","g"),("s","s")] reachable_rename_ioa 1);
   210 by Auto_tac;
   206 by Auto_tac;
   211 qed"rename_through_pmap";
   207 qed"rename_through_pmap";