src/HOL/UNITY/Comp.ML
changeset 6833 15d6c121d75f
parent 6822 8932f33259d4
child 7340 a22efb7a522b
equal deleted inserted replaced
6832:0c92ccb3c4ba 6833:15d6c121d75f
    24 by (blast_tac (claset() addIs [Join_SKIP_right]) 1);
    24 by (blast_tac (claset() addIs [Join_SKIP_right]) 1);
    25 qed "component_refl";
    25 qed "component_refl";
    26 
    26 
    27 AddIffs [component_SKIP, component_refl];
    27 AddIffs [component_SKIP, component_refl];
    28 
    28 
       
    29 Goal "F component SKIP ==> F = SKIP";
       
    30 by (auto_tac (claset() addSIs [program_equalityI],
       
    31 	      simpset() addsimps [component_eq_subset]));
       
    32 qed "SKIP_minimal";
       
    33 
    29 Goalw [component_def] "F component (F Join G)";
    34 Goalw [component_def] "F component (F Join G)";
    30 by (Blast_tac 1);
    35 by (Blast_tac 1);
    31 qed "component_Join1";
    36 qed "component_Join1";
    32 
    37 
    33 Goalw [component_def] "G component (F Join G)";
    38 Goalw [component_def] "G component (F Join G)";
    50 
    55 
    51 Goalw [component_def]
    56 Goalw [component_def]
    52       "F component H = (EX G. F Join G = H & Disjoint F G)";
    57       "F component H = (EX G. F Join G = H & Disjoint F G)";
    53 by (blast_tac (claset() addSIs [Diff_Disjoint, Join_Diff2]) 1);
    58 by (blast_tac (claset() addSIs [Diff_Disjoint, Join_Diff2]) 1);
    54 qed "component_eq";
    59 qed "component_eq";
       
    60 
       
    61 Goal "((F Join G) component H) = (F component H & G component H)";
       
    62 by (simp_tac (simpset() addsimps [component_eq_subset, Acts_Join]) 1);
       
    63 by (Blast_tac 1);
       
    64 qed "Join_component_iff";
    55 
    65 
    56 
    66 
    57 (*** existential properties ***)
    67 (*** existential properties ***)
    58 
    68 
    59 Goalw [ex_prop_def]
    69 Goalw [ex_prop_def]
   108 qed "uv_prop_finite";
   118 qed "uv_prop_finite";
   109 
   119 
   110 
   120 
   111 (*** guarantees ***)
   121 (*** guarantees ***)
   112 
   122 
   113 (*This equation is more intuitive than the official definition*)
       
   114 Goal "(F : X guar Y) = \
       
   115 \     (ALL G. F Join G : X & Disjoint F G --> F Join G : Y)";
       
   116 by (simp_tac (simpset() addsimps [guarantees_def, component_eq]) 1);
       
   117 by (Blast_tac 1);
       
   118 qed "guarantees_eq";
       
   119 
       
   120 Goalw [guarantees_def] "X <= Y ==> X guar Y = UNIV";
       
   121 by (Blast_tac 1);
       
   122 qed "subset_imp_guarantees_UNIV";
       
   123 
       
   124 (*Equivalent to subset_imp_guarantees_UNIV but more intuitive*)
       
   125 Goalw [guarantees_def] "X <= Y ==> F : X guar Y";
       
   126 by (Blast_tac 1);
       
   127 qed "subset_imp_guarantees";
       
   128 
       
   129 (*Remark at end of section 4.1*)
       
   130 Goalw [guarantees_def] "ex_prop Y = (Y = UNIV guar Y)";
       
   131 by (simp_tac (simpset() addsimps [ex_prop_equiv]) 1);
       
   132 by (blast_tac (claset() addEs [equalityE]) 1);
       
   133 qed "ex_prop_equiv2";
       
   134 
       
   135 (** Distributive laws.  Re-orient to perform miniscoping **)
       
   136 
       
   137 Goalw [guarantees_def]
       
   138      "(UN X:XX. X) guar Y = (INT X:XX. X guar Y)";
       
   139 by (Blast_tac 1);
       
   140 qed "guarantees_UN_left";
       
   141 
       
   142 Goalw [guarantees_def]
       
   143     "(X Un Y) guar Z = (X guar Z) Int (Y guar Z)";
       
   144 by (Blast_tac 1);
       
   145 qed "guarantees_Un_left";
       
   146 
       
   147 Goalw [guarantees_def]
       
   148      "X guar (INT Y:YY. Y) = (INT Y:YY. X guar Y)";
       
   149 by (Blast_tac 1);
       
   150 qed "guarantees_INT_right";
       
   151 
       
   152 Goalw [guarantees_def]
       
   153     "Z guar (X Int Y) = (Z guar X) Int (Z guar Y)";
       
   154 by (Blast_tac 1);
       
   155 qed "guarantees_Int_right";
       
   156 
       
   157 Goalw [guarantees_def] "(X guar Y) = (UNIV guar (-X Un Y))";
       
   158 by (Blast_tac 1);
       
   159 qed "shunting";
       
   160 
       
   161 Goalw [guarantees_def] "(X guar Y) = -Y guar -X";
       
   162 by (Blast_tac 1);
       
   163 qed "contrapositive";
       
   164 
       
   165 (** The following two can be expressed using intersection and subset, which
       
   166     is more faithful to the text but looks cryptic.
       
   167 **)
       
   168 
       
   169 Goalw [guarantees_def]
       
   170     "[| F : V guar X;  F : (X Int Y) guar Z |]\
       
   171 \    ==> F : (V Int Y) guar Z";
       
   172 by (Blast_tac 1);
       
   173 qed "combining1";
       
   174 
       
   175 Goalw [guarantees_def]
       
   176     "[| F : V guar (X Un Y);  F : Y guar Z |]\
       
   177 \    ==> F : V guar (X Un Z)";
       
   178 by (Blast_tac 1);
       
   179 qed "combining2";
       
   180 
       
   181 (** The following two follow Chandy-Sanders, but the use of object-quantifiers
       
   182     does not suit Isabelle... **)
       
   183 
       
   184 (*Premise should be (!!i. i: I ==> F: X guar Y i) *)
       
   185 Goalw [guarantees_def]
       
   186      "ALL i:I. F : X guar (Y i) ==> F : X guar (INT i:I. Y i)";
       
   187 by (Blast_tac 1);
       
   188 qed "all_guarantees";
       
   189 
       
   190 (*Premises should be [| F: X guar Y i; i: I |] *)
       
   191 Goalw [guarantees_def]
       
   192      "EX i:I. F : X guar (Y i) ==> F : X guar (UN i:I. Y i)";
       
   193 by (Blast_tac 1);
       
   194 qed "ex_guarantees";
       
   195 
       
   196 val prems = Goal
   123 val prems = Goal
   197      "(!!G. [| F Join G : X;  Disjoint F G |] ==> F Join G : Y) \
   124      "(!!G. [| F Join G : X;  Disjoint F G |] ==> F Join G : Y) \
   198 \     ==> F : X guar Y";
   125 \     ==> F : X guar Y";
   199 by (simp_tac (simpset() addsimps [guarantees_def, component_eq]) 1);
   126 by (simp_tac (simpset() addsimps [guarantees_def, component_eq]) 1);
   200 by (blast_tac (claset() addIs prems) 1);
   127 by (blast_tac (claset() addIs prems) 1);
   202 
   129 
   203 Goalw [guarantees_def, component_def]
   130 Goalw [guarantees_def, component_def]
   204      "[| F : X guar Y;  F Join G : X |] ==> F Join G : Y";
   131      "[| F : X guar Y;  F Join G : X |] ==> F Join G : Y";
   205 by (Blast_tac 1);
   132 by (Blast_tac 1);
   206 qed "guaranteesD";
   133 qed "guaranteesD";
       
   134 
       
   135 (*This equation is more intuitive than the official definition*)
       
   136 Goal "(F : X guar Y) = \
       
   137 \     (ALL G. F Join G : X & Disjoint F G --> F Join G : Y)";
       
   138 by (simp_tac (simpset() addsimps [guarantees_def, component_eq]) 1);
       
   139 by (Blast_tac 1);
       
   140 qed "guarantees_eq";
       
   141 
       
   142 Goalw [guarantees_def] "[| F: X guar X'; Y <= X; X' <= Y' |] ==> F: Y guar Y'";
       
   143 by (Blast_tac 1);
       
   144 qed "guarantees_weaken";
       
   145 
       
   146 Goalw [guarantees_def] "[| F: X guar Y; F component F' |] ==> F': X guar Y";
       
   147 by (blast_tac (claset() addIs [component_trans]) 1);
       
   148 qed "guarantees_weaken_prog";
       
   149 
       
   150 Goalw [guarantees_def] "X <= Y ==> X guar Y = UNIV";
       
   151 by (Blast_tac 1);
       
   152 qed "subset_imp_guarantees_UNIV";
       
   153 
       
   154 (*Equivalent to subset_imp_guarantees_UNIV but more intuitive*)
       
   155 Goalw [guarantees_def] "X <= Y ==> F : X guar Y";
       
   156 by (Blast_tac 1);
       
   157 qed "subset_imp_guarantees";
       
   158 
       
   159 (*Remark at end of section 4.1*)
       
   160 Goalw [guarantees_def] "ex_prop Y = (Y = UNIV guar Y)";
       
   161 by (simp_tac (simpset() addsimps [ex_prop_equiv]) 1);
       
   162 by (blast_tac (claset() addEs [equalityE]) 1);
       
   163 qed "ex_prop_equiv2";
       
   164 
       
   165 (** Distributive laws.  Re-orient to perform miniscoping **)
       
   166 
       
   167 Goalw [guarantees_def]
       
   168      "(UN X:XX. X) guar Y = (INT X:XX. X guar Y)";
       
   169 by (Blast_tac 1);
       
   170 qed "guarantees_UN_left";
       
   171 
       
   172 Goalw [guarantees_def]
       
   173     "(X Un Y) guar Z = (X guar Z) Int (Y guar Z)";
       
   174 by (Blast_tac 1);
       
   175 qed "guarantees_Un_left";
       
   176 
       
   177 Goalw [guarantees_def]
       
   178      "X guar (INT Y:YY. Y) = (INT Y:YY. X guar Y)";
       
   179 by (Blast_tac 1);
       
   180 qed "guarantees_INT_right";
       
   181 
       
   182 Goalw [guarantees_def]
       
   183     "Z guar (X Int Y) = (Z guar X) Int (Z guar Y)";
       
   184 by (Blast_tac 1);
       
   185 qed "guarantees_Int_right";
       
   186 
       
   187 Goalw [guarantees_def] "(X guar Y) = (UNIV guar (-X Un Y))";
       
   188 by (Blast_tac 1);
       
   189 qed "shunting";
       
   190 
       
   191 Goalw [guarantees_def] "(X guar Y) = -Y guar -X";
       
   192 by (Blast_tac 1);
       
   193 qed "contrapositive";
       
   194 
       
   195 (** The following two can be expressed using intersection and subset, which
       
   196     is more faithful to the text but looks cryptic.
       
   197 **)
       
   198 
       
   199 Goalw [guarantees_def]
       
   200     "[| F : V guar X;  F : (X Int Y) guar Z |]\
       
   201 \    ==> F : (V Int Y) guar Z";
       
   202 by (Blast_tac 1);
       
   203 qed "combining1";
       
   204 
       
   205 Goalw [guarantees_def]
       
   206     "[| F : V guar (X Un Y);  F : Y guar Z |]\
       
   207 \    ==> F : V guar (X Un Z)";
       
   208 by (Blast_tac 1);
       
   209 qed "combining2";
       
   210 
       
   211 (** The following two follow Chandy-Sanders, but the use of object-quantifiers
       
   212     does not suit Isabelle... **)
       
   213 
       
   214 (*Premise should be (!!i. i: I ==> F: X guar Y i) *)
       
   215 Goalw [guarantees_def]
       
   216      "ALL i:I. F : X guar (Y i) ==> F : X guar (INT i:I. Y i)";
       
   217 by (Blast_tac 1);
       
   218 qed "all_guarantees";
       
   219 
       
   220 (*Premises should be [| F: X guar Y i; i: I |] *)
       
   221 Goalw [guarantees_def]
       
   222      "EX i:I. F : X guar (Y i) ==> F : X guar (UN i:I. Y i)";
       
   223 by (Blast_tac 1);
       
   224 qed "ex_guarantees";
       
   225 
       
   226 (*** Additional guarantees laws, by lcp ***)
       
   227 
       
   228 Goalw [guarantees_def]
       
   229     "[| F: U guar V;  G: X guar Y |] ==> F Join G: (U Int X) guar (V Int Y)";
       
   230 by (simp_tac (simpset() addsimps [Join_component_iff]) 1);
       
   231 by (Blast_tac 1);
       
   232 qed "guarantees_Join_Int";
       
   233 
       
   234 Goalw [guarantees_def]
       
   235     "[| F: U guar V;  G: X guar Y |] ==> F Join G: (U Un X) guar (V Un Y)";
       
   236 by (simp_tac (simpset() addsimps [Join_component_iff]) 1);
       
   237 by (Blast_tac 1);
       
   238 qed "guarantees_Join_Un";
       
   239 
       
   240 Goal "((JOIN I F) component H) = (ALL i: I. F i component H)";
       
   241 by (simp_tac (simpset() addsimps [component_eq_subset, Acts_JN]) 1);
       
   242 by (Blast_tac 1);
       
   243 qed "JN_component_iff";
       
   244 
       
   245 Goalw [guarantees_def]
       
   246     "[| ALL i:I. F i : X i guar Y i |] \
       
   247 \    ==> (JOIN I F) : (INTER I X) guar (INTER I Y)";
       
   248 by (simp_tac (simpset() addsimps [JN_component_iff]) 1);
       
   249 by (Blast_tac 1);
       
   250 qed "guarantees_JN_INT";
       
   251 
       
   252 Goalw [guarantees_def]
       
   253     "[| ALL i:I. F i : X i guar Y i |] \
       
   254 \    ==> (JOIN I F) : (UNION I X) guar (UNION I Y)";
       
   255 by (simp_tac (simpset() addsimps [JN_component_iff]) 1);
       
   256 by (Blast_tac 1);
       
   257 qed "guarantees_JN_UN";
   207 
   258 
   208 
   259 
   209 (*** well-definedness ***)
   260 (*** well-definedness ***)
   210 
   261 
   211 Goalw [welldef_def] "F Join G: welldef ==> F: welldef";
   262 Goalw [welldef_def] "F Join G: welldef ==> F: welldef";