src/HOL/UNITY/Comp/Priority.ML
changeset 13796 19f50fa807ae
parent 11701 3d51fbf81c17
child 13812 91713a1915ee
equal deleted inserted replaced
13795:cfa3441c5238 13796:19f50fa807ae
    10    In J. Rolim (editor), Parallel and Distributed Processing,
    10    In J. Rolim (editor), Parallel and Distributed Processing,
    11    Spriner LNCS 1586 (1999), pages 1215-1227.
    11    Spriner LNCS 1586 (1999), pages 1215-1227.
    12 *)
    12 *)
    13 
    13 
    14 Addsimps [Component_def RS def_prg_Init];
    14 Addsimps [Component_def RS def_prg_Init];
    15 program_defs_ref := [Component_def, system_def];
       
    16 Addsimps [highest_def, lowest_def];
    15 Addsimps [highest_def, lowest_def];
    17 Addsimps [simp_of_act  act_def];
    16 Addsimps [simp_of_act  act_def];
    18 Addsimps (map simp_of_set [Highest_def, Lowest_def]);
    17 Addsimps (map simp_of_set [Highest_def, Lowest_def]);
    19 
    18 
    20 
    19 
    22 
    21 
    23 (**** Component correctness proofs  ****)
    22 (**** Component correctness proofs  ****)
    24 
    23 
    25 (* neighbors is stable  *)
    24 (* neighbors is stable  *)
    26 Goal "Component i: stable {s. neighbors k s = n}";
    25 Goal "Component i: stable {s. neighbors k s = n}";
       
    26 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    27 by (constrains_tac 1);
    27 by (constrains_tac 1);
    28 by Auto_tac;
    28 by Auto_tac;
    29 qed "Component_neighbors_stable";
    29 qed "Component_neighbors_stable";
    30 
    30 
    31 (* property 4 *)
    31 (* property 4 *)
    32 Goal 
    32 Goal "Component i: {s. ((i,j):s) = b} Int (- Highest i) co {s. ((i,j):s)=b}";
    33 "Component i: {s. ((i,j):s) = b} Int (- Highest i) co {s. ((i,j):s)=b}";
    33 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    34 by (constrains_tac 1);
    34 by (constrains_tac 1);
    35 qed "Component_waits_priority";  
    35 qed "Component_waits_priority";  
    36 
    36 
    37 (* property 5: charpentier and Chandy mistakenly express it as
    37 (* property 5: charpentier and Chandy mistakenly express it as
    38  'transient Highest i'. Consider the case where i has neighbors *)
    38  'transient Highest i'. Consider the case where i has neighbors *)
    39 Goal
    39 Goal
    40  "Component i: {s. neighbors i s ~= {}} Int Highest i \
    40  "Component i: {s. neighbors i s ~= {}} Int Highest i \
    41 \              ensures - Highest i";
    41 \              ensures - Highest i";
       
    42 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    42 by (ensures_tac "act i" 1);
    43 by (ensures_tac "act i" 1);
    43 by (REPEAT(Fast_tac 1));
    44 by (REPEAT(Fast_tac 1));
    44 qed "Component_yields_priority"; 
    45 qed "Component_yields_priority"; 
    45 
    46 
    46 (* or better *)
    47 (* or better *)
    47 Goal "Component i: Highest i ensures Lowest i";
    48 Goal "Component i: Highest i ensures Lowest i";
       
    49 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    48 by (ensures_tac "act i" 1);
    50 by (ensures_tac "act i" 1);
    49 by (REPEAT(Fast_tac 1));
    51 by (REPEAT(Fast_tac 1));
    50 qed "Component_yields_priority'";
    52 qed "Component_yields_priority'";
    51 
    53 
    52 (* property 6: Component doesn't introduce cycle *)
    54 (* property 6: Component doesn't introduce cycle *)
    53 Goal "Component i: Highest i co Highest i Un Lowest i";
    55 Goal "Component i: Highest i co Highest i Un Lowest i";
       
    56 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    54 by (constrains_tac 1);
    57 by (constrains_tac 1);
    55 by (Fast_tac 1);
    58 by (Fast_tac 1);
    56 qed "Component_well_behaves"; 
    59 qed "Component_well_behaves"; 
    57 
    60 
    58 (* property 7: local axiom *)
    61 (* property 7: local axiom *)
    59 Goal "Component i: stable {s. ALL j k. j~=i & k~=i--> ((j,k):s) = b j k}";
    62 Goal "Component i: stable {s. ALL j k. j~=i & k~=i--> ((j,k):s) = b j k}";
       
    63 by (asm_full_simp_tac (simpset() addsimps [Component_def]) 1); 
    60 by (constrains_tac 1);
    64 by (constrains_tac 1);
    61 qed "locality";  
    65 qed "locality";  
    62 
    66 
    63 
    67 
    64 (**** System  properties  ****)
    68 (**** System  properties  ****)
    65 (* property 8: strictly universal *)
    69 (* property 8: strictly universal *)
    66 
    70 
    67 Goalw [Safety_def] 
    71 Goalw [Safety_def] "system: stable Safety";
    68     "system: stable Safety";
       
    69 by (rtac stable_INT 1);
    72 by (rtac stable_INT 1);
       
    73 by (asm_full_simp_tac (simpset() addsimps [system_def]) 1); 
    70 by (constrains_tac 1);
    74 by (constrains_tac 1);
    71 by (Fast_tac 1);
    75 by (Fast_tac 1);
    72 qed "Safety"; 
    76 qed "Safety"; 
    73 
    77 
    74 (* property 13: universal *)
    78 (* property 13: universal *)
    75 Goal
    79 Goal "system: {s. s = q} co {s. s=q} Un {s. EX i. derive i q s}";
    76 "system: {s. s = q} co {s. s=q} Un {s. EX i. derive i q s}";
    80 by (asm_full_simp_tac (simpset() addsimps [system_def, Component_def]) 1); 
    77 by (constrains_tac 1);
    81 by (constrains_tac 1);
    78 by (Blast_tac 1);
    82 by (Blast_tac 1);
    79 qed "p13";
    83 qed "p13";
    80 
    84 
    81 (* property 14: the 'above set' of a Component that hasn't got 
    85 (* property 14: the 'above set' of a Component that hasn't got 
    82       priority doesn't increase *)
    86       priority doesn't increase *)
    83 Goal
    87 Goal
    84 "ALL j. system: -Highest i Int {s. j~:above i s} co {s. j~:above i s}";
    88 "ALL j. system: -Highest i Int {s. j~:above i s} co {s. j~:above i s}";
    85 by (Clarify_tac 1);
    89 by (Clarify_tac 1);
    86 by (cut_inst_tac [("i", "j")] reach_lemma 1);
    90 by (cut_inst_tac [("i", "j")] reach_lemma 1);
       
    91 by (asm_full_simp_tac (simpset() addsimps [system_def, Component_def]) 1); 
    87 by (constrains_tac 1);
    92 by (constrains_tac 1);
    88 by (auto_tac (claset(), simpset() addsimps [trancl_converse]));
    93 by (auto_tac (claset(), simpset() addsimps [trancl_converse]));
    89 qed "above_not_increase";  
    94 qed "above_not_increase";  
    90 
    95 
    91 Goal 
    96 Goal 
    99 
   104 
   100 
   105 
   101 (* p15: universal property: all Components well behave  *)
   106 (* p15: universal property: all Components well behave  *)
   102 Goal "ALL i. system: Highest i co Highest i Un Lowest i";
   107 Goal "ALL i. system: Highest i co Highest i Un Lowest i";
   103 by (Clarify_tac 1);
   108 by (Clarify_tac 1);
       
   109 by (asm_full_simp_tac (simpset() addsimps [system_def, Component_def]) 1); 
   104 by (constrains_tac 1);
   110 by (constrains_tac 1);
   105 by Auto_tac;
   111 by Auto_tac;
   106 qed "system_well_behaves";  
   112 qed "system_well_behaves";  
   107 
   113 
   108 
   114 
   139 
   145 
   140 
   146 
   141 (* propert 5: existential property *)
   147 (* propert 5: existential property *)
   142 
   148 
   143 Goal "system: Highest i leadsTo Lowest i";
   149 Goal "system: Highest i leadsTo Lowest i";
       
   150 by (asm_full_simp_tac (simpset() addsimps [system_def]) 1); 
   144 by (ensures_tac "act i" 1);
   151 by (ensures_tac "act i" 1);
   145 by (auto_tac (claset(), simpset() addsimps [Component_def]));
   152 by (auto_tac (claset(), simpset() addsimps [Component_def]));
   146 qed "Highest_leadsTo_Lowest";
   153 qed "Highest_leadsTo_Lowest";
   147 
   154 
   148 (* a lowest i can never be in any abover set *) 
   155 (* a lowest i can never be in any abover set *)