src/HOL/UNITY/Alloc.ML
changeset 7482 7badd511844d
parent 7399 cf780c2bcccf
child 7537 875754b599df
equal deleted inserted replaced
7481:d44c77be268c 7482:7badd511844d
    42 by (auto_tac (claset() addSWrapper record_split_wrapper, simpset()));
    42 by (auto_tac (claset() addSWrapper record_split_wrapper, simpset()));
    43 qed "surj_sysOfAlloc";
    43 qed "surj_sysOfAlloc";
    44 
    44 
    45 AddIffs [inj_sysOfAlloc, surj_sysOfAlloc];
    45 AddIffs [inj_sysOfAlloc, surj_sysOfAlloc];
    46 
    46 
    47 val bij_sysOfAlloc = [inj_sysOfAlloc, surj_sysOfAlloc] MRS bijI;
    47 Goalw [good_map_def] "good_map sysOfAlloc";
       
    48 by Auto_tac;
       
    49 qed "good_map_sysOfAlloc";
    48 
    50 
    49 (*MUST BE AUTOMATED: even the statement of such results*)
    51 (*MUST BE AUTOMATED: even the statement of such results*)
    50 Goal "!!s. inv sysOfAlloc s = \
    52 Goal "!!s. inv sysOfAlloc s = \
    51 \            ((| allocGiv = allocGiv s,   \
    53 \            ((| allocGiv = allocGiv s,   \
    52 \                allocAsk = allocAsk s,   \
    54 \                allocAsk = allocAsk s,   \
    73 by (Blast_tac 1);
    75 by (Blast_tac 1);
    74 qed "surj_sysOfClient";
    76 qed "surj_sysOfClient";
    75 
    77 
    76 AddIffs [inj_sysOfClient, surj_sysOfClient];
    78 AddIffs [inj_sysOfClient, surj_sysOfClient];
    77 
    79 
    78 val bij_sysOfClient = [inj_sysOfClient, surj_sysOfClient] MRS bijI;
    80 Goalw [good_map_def] "good_map sysOfClient";
       
    81 by Auto_tac;
       
    82 qed "good_map_sysOfClient";
    79 
    83 
    80 (*MUST BE AUTOMATED: even the statement of such results*)
    84 (*MUST BE AUTOMATED: even the statement of such results*)
    81 Goal "!!s. inv sysOfClient s = \
    85 Goal "!!s. inv sysOfClient s = \
    82 \            (client s, \
    86 \            (client s, \
    83 \             (| allocGiv = allocGiv s, \
    87 \             (| allocGiv = allocGiv s, \
   167 
   171 
   168 
   172 
   169 (* F : UNIV guarantees Increasing func
   173 (* F : UNIV guarantees Increasing func
   170    ==> extend sysOfClient F : UNIV guarantees Increasing (func o client) *)
   174    ==> extend sysOfClient F : UNIV guarantees Increasing (func o client) *)
   171 val extend_Client_guar_Increasing =
   175 val extend_Client_guar_Increasing =
   172   bij_sysOfClient RS export extend_guar_Increasing
   176   good_map_sysOfClient RS export extend_guar_Increasing
   173   |> simplify (simpset() addsimps [inv_sysOfClient_eq]);
   177   |> simplify (simpset() addsimps [inv_sysOfClient_eq]);
   174 
   178 
   175 
   179 
   176 (** Proof of property (1) **)
   180 (** Proof of property (1) **)
   177 
   181 
   199 
   203 
   200 
   204 
   201 (*NEED TO PROVE something like this (maybe without premise)*)
   205 (*NEED TO PROVE something like this (maybe without premise)*)
   202 Goal "i < Nclients ==> System : (sub i o allocRel) localTo Network";
   206 Goal "i < Nclients ==> System : (sub i o allocRel) localTo Network";
   203 
   207 
   204 fun alloc_export th = bij_sysOfAlloc RS export th;
   208 fun alloc_export th = good_map_sysOfAlloc RS export th;
   205 
   209 
   206 val extend_Alloc_guar_Increasing =
   210 val extend_Alloc_guar_Increasing =
   207   alloc_export extend_guar_Increasing
   211   alloc_export extend_guar_Increasing
   208   |> simplify (simpset() addsimps [inv_sysOfAlloc_eq]);
   212   |> simplify (simpset() addsimps [inv_sysOfAlloc_eq]);
   209 
   213 
   211 \                  <= NbT + sum (%i. (tokens o sub i o allocRel) s) Nclients}";
   215 \                  <= NbT + sum (%i. (tokens o sub i o allocRel) s) Nclients}";
   212 by (res_inst_tac 
   216 by (res_inst_tac 
   213     [("X", "(INT i : lessThan Nclients. (sub i o allocRel) localTo Network \
   217     [("X", "(INT i : lessThan Nclients. (sub i o allocRel) localTo Network \
   214 \                                       Int Increasing (sub i o allocRel))")] 
   218 \                                       Int Increasing (sub i o allocRel))")] 
   215     component_guaranteesD 1);;
   219     component_guaranteesD 1);;
   216 br Alloc_component_System 3;
   220 by (rtac Alloc_component_System 3);
   217 br project_guarantees 1;
   221 by (rtac project_guarantees 1);
   218 br Alloc_Safety 1;
   222 by (rtac Alloc_Safety 1);
   219 by (dtac (alloc_export (project_extend_Join RSN (2, subst_elem RS project_Always_D))) 2 
   223 by (dtac (alloc_export (project_extend_Join RSN (2, subst_elem RS project_Always_D))) 2 
   220      THEN
   224      THEN
   221      full_simp_tac
   225      full_simp_tac
   222      (simpset() addsimps [inv_sysOfAlloc_eq,
   226      (simpset() addsimps [inv_sysOfAlloc_eq,
   223 			  alloc_export Collect_eq_extend_set RS sym]) 2);
   227 			  alloc_export Collect_eq_extend_set RS sym]) 2);
   224 auto();
   228 by Auto_tac;
   225 by (force_tac (claset(), simpset() addsimps [System_Increasing_allocRel]) 3);
   229 by (force_tac (claset(), simpset() addsimps [System_Increasing_allocRel]) 3);
   226 
   230 
   227 bd bspec 1;
   231 by (dtac bspec 1);
   228 by (Blast_tac 1);
   232 by (Blast_tac 1);
   229 
   233 
   230 
   234 
   231 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
   235 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
   232 
   236 
   248 by (asm_full_simp_tac 
   252 by (asm_full_simp_tac 
   249     (simpset() addsimps [localTo_def, 
   253     (simpset() addsimps [localTo_def, 
   250 			 project_extend_Join RS sym,
   254 			 project_extend_Join RS sym,
   251 			 Diff_project_stable,
   255 			 Diff_project_stable,
   252 			 Collect_eq_extend_set RS sym]) 1);
   256 			 Collect_eq_extend_set RS sym]) 1);
   253 auto();
   257 by Auto_tac;
   254 br Diff_project_stable 1;
   258 by (rtac Diff_project_stable 1);
   255 PROBABLY FALSE;
   259 PROBABLY FALSE;
   256 
   260 
   257 by (Clarify_tac 1);
   261 by (Clarify_tac 1);
   258 by (dres_inst_tac [("x","z")] spec 1);
   262 by (dres_inst_tac [("x","z")] spec 1);
   259 
   263 
   260 br (alloc_export project_Always_D) 2;
   264 by (rtac (alloc_export project_Always_D) 2);
   261 
   265 
   262 by (rtac (alloc_export extend_Always RS iffD2) 2);
   266 by (rtac (alloc_export extend_Always RS iffD2) 2);
   263 
   267 
   264 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
   268 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
   265 
   269 
   266 br guaranteesI 1;
   270 by (rtac guaranteesI 1);
   267 
   271 
   268 by (res_inst_tac 
   272 by (res_inst_tac 
   269     [("X", "(INT i : lessThan Nclients. Increasing (sub i o allocRel))")] 
   273     [("X", "(INT i : lessThan Nclients. Increasing (sub i o allocRel))")] 
   270     component_guaranteesD 1);;
   274     component_guaranteesD 1);;
   271 
   275 
   272 
   276 
   273 by (rtac (Alloc_Safety RS component_guaranteesD) 1);
   277 by (rtac (Alloc_Safety RS component_guaranteesD) 1);
   274 
   278 
   275 
   279 
   276 br (alloc_export guarantees_imp_extend_guarantees RS guarantees_weaken) 1;
   280 by (rtac (alloc_export guarantees_imp_extend_guarantees RS guarantees_weaken) 1);
   277 br Alloc_Safety 1;
   281 by (rtac Alloc_Safety 1);