src/HOL/UNITY/Project.thy
changeset 13812 91713a1915ee
parent 13798 4c1a53627500
child 13819 78f5885b76a9
equal deleted inserted replaced
13811:f39f67982854 13812:91713a1915ee
    14 
    14 
    15 constdefs
    15 constdefs
    16   projecting :: "['c program => 'c set, 'a*'b => 'c, 
    16   projecting :: "['c program => 'c set, 'a*'b => 'c, 
    17 		  'a program, 'c program set, 'a program set] => bool"
    17 		  'a program, 'c program set, 'a program set] => bool"
    18     "projecting C h F X' X ==
    18     "projecting C h F X' X ==
    19        ALL G. extend h F Join G : X' --> F Join project h (C G) G : X"
    19        \<forall>G. extend h F Join G \<in> X' --> F Join project h (C G) G \<in> X"
    20 
    20 
    21   extending :: "['c program => 'c set, 'a*'b => 'c, 'a program, 
    21   extending :: "['c program => 'c set, 'a*'b => 'c, 'a program, 
    22 		 'c program set, 'a program set] => bool"
    22 		 'c program set, 'a program set] => bool"
    23     "extending C h F Y' Y ==
    23     "extending C h F Y' Y ==
    24        ALL G. extend h F  ok G --> F Join project h (C G) G : Y
    24        \<forall>G. extend h F  ok G --> F Join project h (C G) G \<in> Y
    25 	      --> extend h F Join G : Y'"
    25 	      --> extend h F Join G \<in> Y'"
    26 
    26 
    27   subset_closed :: "'a set set => bool"
    27   subset_closed :: "'a set set => bool"
    28     "subset_closed U == ALL A: U. Pow A <= U"  
    28     "subset_closed U == \<forall>A \<in> U. Pow A \<subseteq> U"  
    29 
    29 
    30 
    30 
    31 lemma (in Extend) project_extend_constrains_I:
    31 lemma (in Extend) project_extend_constrains_I:
    32      "F : A co B ==> project h C (extend h F) : A co B"
    32      "F \<in> A co B ==> project h C (extend h F) \<in> A co B"
    33 apply (auto simp add: extend_act_def project_act_def constrains_def)
    33 apply (auto simp add: extend_act_def project_act_def constrains_def)
    34 done
    34 done
    35 
    35 
    36 
    36 
    37 subsection{*Safety*}
    37 subsection{*Safety*}
    38 
    38 
    39 (*used below to prove Join_project_ensures*)
    39 (*used below to prove Join_project_ensures*)
    40 lemma (in Extend) project_unless [rule_format]:
    40 lemma (in Extend) project_unless [rule_format]:
    41      "[| G : stable C;  project h C G : A unless B |]  
    41      "[| G \<in> stable C;  project h C G \<in> A unless B |]  
    42       ==> G : (C Int extend_set h A) unless (extend_set h B)"
    42       ==> G \<in> (C \<inter> extend_set h A) unless (extend_set h B)"
    43 apply (simp add: unless_def project_constrains)
    43 apply (simp add: unless_def project_constrains)
    44 apply (blast dest: stable_constrains_Int intro: constrains_weaken)
    44 apply (blast dest: stable_constrains_Int intro: constrains_weaken)
    45 done
    45 done
    46 
    46 
    47 (*Generalizes project_constrains to the program F Join project h C G
    47 (*Generalizes project_constrains to the program F Join project h C G
    48   useful with guarantees reasoning*)
    48   useful with guarantees reasoning*)
    49 lemma (in Extend) Join_project_constrains:
    49 lemma (in Extend) Join_project_constrains:
    50      "(F Join project h C G : A co B)  =   
    50      "(F Join project h C G \<in> A co B)  =   
    51         (extend h F Join G : (C Int extend_set h A) co (extend_set h B) &   
    51         (extend h F Join G \<in> (C \<inter> extend_set h A) co (extend_set h B) &   
    52          F : A co B)"
    52          F \<in> A co B)"
    53 apply (simp (no_asm) add: project_constrains)
    53 apply (simp (no_asm) add: project_constrains)
    54 apply (blast intro: extend_constrains [THEN iffD2, THEN constrains_weaken] 
    54 apply (blast intro: extend_constrains [THEN iffD2, THEN constrains_weaken] 
    55              dest: constrains_imp_subset)
    55              dest: constrains_imp_subset)
    56 done
    56 done
    57 
    57 
    58 (*The condition is required to prove the left-to-right direction
    58 (*The condition is required to prove the left-to-right direction
    59   could weaken it to G : (C Int extend_set h A) co C*)
    59   could weaken it to G \<in> (C \<inter> extend_set h A) co C*)
    60 lemma (in Extend) Join_project_stable: 
    60 lemma (in Extend) Join_project_stable: 
    61      "extend h F Join G : stable C  
    61      "extend h F Join G \<in> stable C  
    62       ==> (F Join project h C G : stable A)  =   
    62       ==> (F Join project h C G \<in> stable A)  =   
    63           (extend h F Join G : stable (C Int extend_set h A) &   
    63           (extend h F Join G \<in> stable (C \<inter> extend_set h A) &   
    64            F : stable A)"
    64            F \<in> stable A)"
    65 apply (unfold stable_def)
    65 apply (unfold stable_def)
    66 apply (simp only: Join_project_constrains)
    66 apply (simp only: Join_project_constrains)
    67 apply (blast intro: constrains_weaken dest: constrains_Int)
    67 apply (blast intro: constrains_weaken dest: constrains_Int)
    68 done
    68 done
    69 
    69 
    70 (*For using project_guarantees in particular cases*)
    70 (*For using project_guarantees in particular cases*)
    71 lemma (in Extend) project_constrains_I:
    71 lemma (in Extend) project_constrains_I:
    72      "extend h F Join G : extend_set h A co extend_set h B  
    72      "extend h F Join G \<in> extend_set h A co extend_set h B  
    73       ==> F Join project h C G : A co B"
    73       ==> F Join project h C G \<in> A co B"
    74 apply (simp add: project_constrains extend_constrains)
    74 apply (simp add: project_constrains extend_constrains)
    75 apply (blast intro: constrains_weaken dest: constrains_imp_subset)
    75 apply (blast intro: constrains_weaken dest: constrains_imp_subset)
    76 done
    76 done
    77 
    77 
    78 lemma (in Extend) project_increasing_I: 
    78 lemma (in Extend) project_increasing_I: 
    79      "extend h F Join G : increasing (func o f)  
    79      "extend h F Join G \<in> increasing (func o f)  
    80       ==> F Join project h C G : increasing func"
    80       ==> F Join project h C G \<in> increasing func"
    81 apply (unfold increasing_def stable_def)
    81 apply (unfold increasing_def stable_def)
    82 apply (simp del: Join_constrains
    82 apply (simp del: Join_constrains
    83             add: project_constrains_I extend_set_eq_Collect)
    83             add: project_constrains_I extend_set_eq_Collect)
    84 done
    84 done
    85 
    85 
    86 lemma (in Extend) Join_project_increasing:
    86 lemma (in Extend) Join_project_increasing:
    87      "(F Join project h UNIV G : increasing func)  =   
    87      "(F Join project h UNIV G \<in> increasing func)  =   
    88       (extend h F Join G : increasing (func o f))"
    88       (extend h F Join G \<in> increasing (func o f))"
    89 apply (rule iffI)
    89 apply (rule iffI)
    90 apply (erule_tac [2] project_increasing_I)
    90 apply (erule_tac [2] project_increasing_I)
    91 apply (simp del: Join_stable
    91 apply (simp del: Join_stable
    92             add: increasing_def Join_project_stable)
    92             add: increasing_def Join_project_stable)
    93 apply (auto simp add: extend_set_eq_Collect extend_stable [THEN iffD1])
    93 apply (auto simp add: extend_set_eq_Collect extend_stable [THEN iffD1])
    94 done
    94 done
    95 
    95 
    96 (*The UNIV argument is essential*)
    96 (*The UNIV argument is essential*)
    97 lemma (in Extend) project_constrains_D:
    97 lemma (in Extend) project_constrains_D:
    98      "F Join project h UNIV G : A co B  
    98      "F Join project h UNIV G \<in> A co B  
    99       ==> extend h F Join G : extend_set h A co extend_set h B"
    99       ==> extend h F Join G \<in> extend_set h A co extend_set h B"
   100 by (simp add: project_constrains extend_constrains)
   100 by (simp add: project_constrains extend_constrains)
   101 
   101 
   102 
   102 
   103 subsection{*"projecting" and union/intersection (no converses)*}
   103 subsection{*"projecting" and union/intersection (no converses)*}
   104 
   104 
   105 lemma projecting_Int: 
   105 lemma projecting_Int: 
   106      "[| projecting C h F XA' XA;  projecting C h F XB' XB |]  
   106      "[| projecting C h F XA' XA;  projecting C h F XB' XB |]  
   107       ==> projecting C h F (XA' Int XB') (XA Int XB)"
   107       ==> projecting C h F (XA' \<inter> XB') (XA \<inter> XB)"
   108 by (unfold projecting_def, blast)
   108 by (unfold projecting_def, blast)
   109 
   109 
   110 lemma projecting_Un: 
   110 lemma projecting_Un: 
   111      "[| projecting C h F XA' XA;  projecting C h F XB' XB |]  
   111      "[| projecting C h F XA' XA;  projecting C h F XB' XB |]  
   112       ==> projecting C h F (XA' Un XB') (XA Un XB)"
   112       ==> projecting C h F (XA' \<union> XB') (XA \<union> XB)"
   113 by (unfold projecting_def, blast)
   113 by (unfold projecting_def, blast)
   114 
   114 
   115 lemma projecting_INT: 
   115 lemma projecting_INT: 
   116      "[| !!i. i:I ==> projecting C h F (X' i) (X i) |]  
   116      "[| !!i. i \<in> I ==> projecting C h F (X' i) (X i) |]  
   117       ==> projecting C h F (INT i:I. X' i) (INT i:I. X i)"
   117       ==> projecting C h F (\<Inter>i \<in> I. X' i) (\<Inter>i \<in> I. X i)"
   118 by (unfold projecting_def, blast)
   118 by (unfold projecting_def, blast)
   119 
   119 
   120 lemma projecting_UN: 
   120 lemma projecting_UN: 
   121      "[| !!i. i:I ==> projecting C h F (X' i) (X i) |]  
   121      "[| !!i. i \<in> I ==> projecting C h F (X' i) (X i) |]  
   122       ==> projecting C h F (UN i:I. X' i) (UN i:I. X i)"
   122       ==> projecting C h F (\<Union>i \<in> I. X' i) (\<Union>i \<in> I. X i)"
   123 by (unfold projecting_def, blast)
   123 by (unfold projecting_def, blast)
   124 
   124 
   125 lemma projecting_weaken: 
   125 lemma projecting_weaken: 
   126      "[| projecting C h F X' X;  U'<=X';  X<=U |] ==> projecting C h F U' U"
   126      "[| projecting C h F X' X;  U'<=X';  X \<subseteq> U |] ==> projecting C h F U' U"
   127 by (unfold projecting_def, auto)
   127 by (unfold projecting_def, auto)
   128 
   128 
   129 lemma projecting_weaken_L: 
   129 lemma projecting_weaken_L: 
   130      "[| projecting C h F X' X;  U'<=X' |] ==> projecting C h F U' X"
   130      "[| projecting C h F X' X;  U'<=X' |] ==> projecting C h F U' X"
   131 by (unfold projecting_def, auto)
   131 by (unfold projecting_def, auto)
   132 
   132 
   133 lemma extending_Int: 
   133 lemma extending_Int: 
   134      "[| extending C h F YA' YA;  extending C h F YB' YB |]  
   134      "[| extending C h F YA' YA;  extending C h F YB' YB |]  
   135       ==> extending C h F (YA' Int YB') (YA Int YB)"
   135       ==> extending C h F (YA' \<inter> YB') (YA \<inter> YB)"
   136 by (unfold extending_def, blast)
   136 by (unfold extending_def, blast)
   137 
   137 
   138 lemma extending_Un: 
   138 lemma extending_Un: 
   139      "[| extending C h F YA' YA;  extending C h F YB' YB |]  
   139      "[| extending C h F YA' YA;  extending C h F YB' YB |]  
   140       ==> extending C h F (YA' Un YB') (YA Un YB)"
   140       ==> extending C h F (YA' \<union> YB') (YA \<union> YB)"
   141 by (unfold extending_def, blast)
   141 by (unfold extending_def, blast)
   142 
   142 
   143 lemma extending_INT: 
   143 lemma extending_INT: 
   144      "[| !!i. i:I ==> extending C h F (Y' i) (Y i) |]  
   144      "[| !!i. i \<in> I ==> extending C h F (Y' i) (Y i) |]  
   145       ==> extending C h F (INT i:I. Y' i) (INT i:I. Y i)"
   145       ==> extending C h F (\<Inter>i \<in> I. Y' i) (\<Inter>i \<in> I. Y i)"
   146 by (unfold extending_def, blast)
   146 by (unfold extending_def, blast)
   147 
   147 
   148 lemma extending_UN: 
   148 lemma extending_UN: 
   149      "[| !!i. i:I ==> extending C h F (Y' i) (Y i) |]  
   149      "[| !!i. i \<in> I ==> extending C h F (Y' i) (Y i) |]  
   150       ==> extending C h F (UN i:I. Y' i) (UN i:I. Y i)"
   150       ==> extending C h F (\<Union>i \<in> I. Y' i) (\<Union>i \<in> I. Y i)"
   151 by (unfold extending_def, blast)
   151 by (unfold extending_def, blast)
   152 
   152 
   153 lemma extending_weaken: 
   153 lemma extending_weaken: 
   154      "[| extending C h F Y' Y;  Y'<=V';  V<=Y |] ==> extending C h F V' V"
   154      "[| extending C h F Y' Y;  Y'<=V';  V \<subseteq> Y |] ==> extending C h F V' V"
   155 by (unfold extending_def, auto)
   155 by (unfold extending_def, auto)
   156 
   156 
   157 lemma extending_weaken_L: 
   157 lemma extending_weaken_L: 
   158      "[| extending C h F Y' Y;  Y'<=V' |] ==> extending C h F V' Y"
   158      "[| extending C h F Y' Y;  Y'<=V' |] ==> extending C h F V' Y"
   159 by (unfold extending_def, auto)
   159 by (unfold extending_def, auto)
   202 
   202 
   203 subsection{*Reachability and project*}
   203 subsection{*Reachability and project*}
   204 
   204 
   205 (*In practice, C = reachable(...): the inclusion is equality*)
   205 (*In practice, C = reachable(...): the inclusion is equality*)
   206 lemma (in Extend) reachable_imp_reachable_project:
   206 lemma (in Extend) reachable_imp_reachable_project:
   207      "[| reachable (extend h F Join G) <= C;   
   207      "[| reachable (extend h F Join G) \<subseteq> C;   
   208          z : reachable (extend h F Join G) |]  
   208          z \<in> reachable (extend h F Join G) |]  
   209       ==> f z : reachable (F Join project h C G)"
   209       ==> f z \<in> reachable (F Join project h C G)"
   210 apply (erule reachable.induct)
   210 apply (erule reachable.induct)
   211 apply (force intro!: reachable.Init simp add: split_extended_all, auto)
   211 apply (force intro!: reachable.Init simp add: split_extended_all, auto)
   212  apply (rule_tac act = x in reachable.Acts)
   212  apply (rule_tac act = x in reachable.Acts)
   213  apply auto
   213  apply auto
   214  apply (erule extend_act_D)
   214  apply (erule extend_act_D)
   215 apply (rule_tac act1 = "Restrict C act"
   215 apply (rule_tac act1 = "Restrict C act"
   216        in project_act_I [THEN [3] reachable.Acts], auto) 
   216        in project_act_I [THEN [3] reachable.Acts], auto) 
   217 done
   217 done
   218 
   218 
   219 lemma (in Extend) project_Constrains_D: 
   219 lemma (in Extend) project_Constrains_D: 
   220      "F Join project h (reachable (extend h F Join G)) G : A Co B   
   220      "F Join project h (reachable (extend h F Join G)) G \<in> A Co B   
   221       ==> extend h F Join G : (extend_set h A) Co (extend_set h B)"
   221       ==> extend h F Join G \<in> (extend_set h A) Co (extend_set h B)"
   222 apply (unfold Constrains_def)
   222 apply (unfold Constrains_def)
   223 apply (simp del: Join_constrains
   223 apply (simp del: Join_constrains
   224             add: Join_project_constrains, clarify)
   224             add: Join_project_constrains, clarify)
   225 apply (erule constrains_weaken)
   225 apply (erule constrains_weaken)
   226 apply (auto intro: reachable_imp_reachable_project)
   226 apply (auto intro: reachable_imp_reachable_project)
   227 done
   227 done
   228 
   228 
   229 lemma (in Extend) project_Stable_D: 
   229 lemma (in Extend) project_Stable_D: 
   230      "F Join project h (reachable (extend h F Join G)) G : Stable A   
   230      "F Join project h (reachable (extend h F Join G)) G \<in> Stable A   
   231       ==> extend h F Join G : Stable (extend_set h A)"
   231       ==> extend h F Join G \<in> Stable (extend_set h A)"
   232 apply (unfold Stable_def)
   232 apply (unfold Stable_def)
   233 apply (simp (no_asm_simp) add: project_Constrains_D)
   233 apply (simp (no_asm_simp) add: project_Constrains_D)
   234 done
   234 done
   235 
   235 
   236 lemma (in Extend) project_Always_D: 
   236 lemma (in Extend) project_Always_D: 
   237      "F Join project h (reachable (extend h F Join G)) G : Always A   
   237      "F Join project h (reachable (extend h F Join G)) G \<in> Always A   
   238       ==> extend h F Join G : Always (extend_set h A)"
   238       ==> extend h F Join G \<in> Always (extend_set h A)"
   239 apply (unfold Always_def)
   239 apply (unfold Always_def)
   240 apply (force intro: reachable.Init simp add: project_Stable_D split_extended_all)
   240 apply (force intro: reachable.Init simp add: project_Stable_D split_extended_all)
   241 done
   241 done
   242 
   242 
   243 lemma (in Extend) project_Increasing_D: 
   243 lemma (in Extend) project_Increasing_D: 
   244      "F Join project h (reachable (extend h F Join G)) G : Increasing func   
   244      "F Join project h (reachable (extend h F Join G)) G \<in> Increasing func   
   245       ==> extend h F Join G : Increasing (func o f)"
   245       ==> extend h F Join G \<in> Increasing (func o f)"
   246 apply (unfold Increasing_def, auto)
   246 apply (unfold Increasing_def, auto)
   247 apply (subst extend_set_eq_Collect [symmetric])
   247 apply (subst extend_set_eq_Collect [symmetric])
   248 apply (simp (no_asm_simp) add: project_Stable_D)
   248 apply (simp (no_asm_simp) add: project_Stable_D)
   249 done
   249 done
   250 
   250 
   251 
   251 
   252 subsection{*Converse results for weak safety: benefits of the argument C *}
   252 subsection{*Converse results for weak safety: benefits of the argument C *}
   253 
   253 
   254 (*In practice, C = reachable(...): the inclusion is equality*)
   254 (*In practice, C = reachable(...): the inclusion is equality*)
   255 lemma (in Extend) reachable_project_imp_reachable:
   255 lemma (in Extend) reachable_project_imp_reachable:
   256      "[| C <= reachable(extend h F Join G);    
   256      "[| C \<subseteq> reachable(extend h F Join G);    
   257          x : reachable (F Join project h C G) |]  
   257          x \<in> reachable (F Join project h C G) |]  
   258       ==> EX y. h(x,y) : reachable (extend h F Join G)"
   258       ==> \<exists>y. h(x,y) \<in> reachable (extend h F Join G)"
   259 apply (erule reachable.induct)
   259 apply (erule reachable.induct)
   260 apply  (force intro: reachable.Init)
   260 apply  (force intro: reachable.Init)
   261 apply (auto simp add: project_act_def)
   261 apply (auto simp add: project_act_def)
   262 apply (force del: Id_in_Acts intro: reachable.Acts extend_act_D)+
   262 apply (force del: Id_in_Acts intro: reachable.Acts extend_act_D)+
   263 done
   263 done
   268 by (auto dest: subset_refl [THEN reachable_imp_reachable_project] 
   268 by (auto dest: subset_refl [THEN reachable_imp_reachable_project] 
   269                subset_refl [THEN reachable_project_imp_reachable])
   269                subset_refl [THEN reachable_project_imp_reachable])
   270 
   270 
   271 (*UNUSED*)
   271 (*UNUSED*)
   272 lemma (in Extend) reachable_extend_Join_subset:
   272 lemma (in Extend) reachable_extend_Join_subset:
   273      "reachable (extend h F Join G) <= C   
   273      "reachable (extend h F Join G) \<subseteq> C   
   274       ==> reachable (extend h F Join G) <=  
   274       ==> reachable (extend h F Join G) \<subseteq>  
   275           extend_set h (reachable (F Join project h C G))"
   275           extend_set h (reachable (F Join project h C G))"
   276 apply (auto dest: reachable_imp_reachable_project)
   276 apply (auto dest: reachable_imp_reachable_project)
   277 done
   277 done
   278 
   278 
   279 lemma (in Extend) project_Constrains_I: 
   279 lemma (in Extend) project_Constrains_I: 
   280      "extend h F Join G : (extend_set h A) Co (extend_set h B)   
   280      "extend h F Join G \<in> (extend_set h A) Co (extend_set h B)   
   281       ==> F Join project h (reachable (extend h F Join G)) G : A Co B"
   281       ==> F Join project h (reachable (extend h F Join G)) G \<in> A Co B"
   282 apply (unfold Constrains_def)
   282 apply (unfold Constrains_def)
   283 apply (simp del: Join_constrains
   283 apply (simp del: Join_constrains
   284             add: Join_project_constrains extend_set_Int_distrib)
   284             add: Join_project_constrains extend_set_Int_distrib)
   285 apply (rule conjI)
   285 apply (rule conjI)
   286  prefer 2 
   286  prefer 2 
   289                      subset_refl [THEN reachable_project_imp_reachable])
   289                      subset_refl [THEN reachable_project_imp_reachable])
   290 apply (blast intro: constrains_weaken_L)
   290 apply (blast intro: constrains_weaken_L)
   291 done
   291 done
   292 
   292 
   293 lemma (in Extend) project_Stable_I: 
   293 lemma (in Extend) project_Stable_I: 
   294      "extend h F Join G : Stable (extend_set h A)   
   294      "extend h F Join G \<in> Stable (extend_set h A)   
   295       ==> F Join project h (reachable (extend h F Join G)) G : Stable A"
   295       ==> F Join project h (reachable (extend h F Join G)) G \<in> Stable A"
   296 apply (unfold Stable_def)
   296 apply (unfold Stable_def)
   297 apply (simp (no_asm_simp) add: project_Constrains_I)
   297 apply (simp (no_asm_simp) add: project_Constrains_I)
   298 done
   298 done
   299 
   299 
   300 lemma (in Extend) project_Always_I: 
   300 lemma (in Extend) project_Always_I: 
   301      "extend h F Join G : Always (extend_set h A)   
   301      "extend h F Join G \<in> Always (extend_set h A)   
   302       ==> F Join project h (reachable (extend h F Join G)) G : Always A"
   302       ==> F Join project h (reachable (extend h F Join G)) G \<in> Always A"
   303 apply (unfold Always_def)
   303 apply (unfold Always_def)
   304 apply (auto simp add: project_Stable_I)
   304 apply (auto simp add: project_Stable_I)
   305 apply (unfold extend_set_def, blast)
   305 apply (unfold extend_set_def, blast)
   306 done
   306 done
   307 
   307 
   308 lemma (in Extend) project_Increasing_I: 
   308 lemma (in Extend) project_Increasing_I: 
   309     "extend h F Join G : Increasing (func o f)   
   309     "extend h F Join G \<in> Increasing (func o f)   
   310      ==> F Join project h (reachable (extend h F Join G)) G : Increasing func"
   310      ==> F Join project h (reachable (extend h F Join G)) G \<in> Increasing func"
   311 apply (unfold Increasing_def, auto)
   311 apply (unfold Increasing_def, auto)
   312 apply (simp (no_asm_simp) add: extend_set_eq_Collect project_Stable_I)
   312 apply (simp (no_asm_simp) add: extend_set_eq_Collect project_Stable_I)
   313 done
   313 done
   314 
   314 
   315 lemma (in Extend) project_Constrains:
   315 lemma (in Extend) project_Constrains:
   316      "(F Join project h (reachable (extend h F Join G)) G : A Co B)  =   
   316      "(F Join project h (reachable (extend h F Join G)) G \<in> A Co B)  =   
   317       (extend h F Join G : (extend_set h A) Co (extend_set h B))"
   317       (extend h F Join G \<in> (extend_set h A) Co (extend_set h B))"
   318 apply (blast intro: project_Constrains_I project_Constrains_D)
   318 apply (blast intro: project_Constrains_I project_Constrains_D)
   319 done
   319 done
   320 
   320 
   321 lemma (in Extend) project_Stable: 
   321 lemma (in Extend) project_Stable: 
   322      "(F Join project h (reachable (extend h F Join G)) G : Stable A)  =   
   322      "(F Join project h (reachable (extend h F Join G)) G \<in> Stable A)  =   
   323       (extend h F Join G : Stable (extend_set h A))"
   323       (extend h F Join G \<in> Stable (extend_set h A))"
   324 apply (unfold Stable_def)
   324 apply (unfold Stable_def)
   325 apply (rule project_Constrains)
   325 apply (rule project_Constrains)
   326 done
   326 done
   327 
   327 
   328 lemma (in Extend) project_Increasing: 
   328 lemma (in Extend) project_Increasing: 
   329    "(F Join project h (reachable (extend h F Join G)) G : Increasing func)  =  
   329    "(F Join project h (reachable (extend h F Join G)) G \<in> Increasing func)  =  
   330     (extend h F Join G : Increasing (func o f))"
   330     (extend h F Join G \<in> Increasing (func o f))"
   331 apply (simp (no_asm_simp) add: Increasing_def project_Stable extend_set_eq_Collect)
   331 apply (simp (no_asm_simp) add: Increasing_def project_Stable extend_set_eq_Collect)
   332 done
   332 done
   333 
   333 
   334 subsection{*A lot of redundant theorems: all are proved to facilitate reasoning
   334 subsection{*A lot of redundant theorems: all are proved to facilitate reasoning
   335     about guarantees.*}
   335     about guarantees.*}
   395 subsection{*leadsETo in the precondition (??)*}
   395 subsection{*leadsETo in the precondition (??)*}
   396 
   396 
   397 subsubsection{*transient*}
   397 subsubsection{*transient*}
   398 
   398 
   399 lemma (in Extend) transient_extend_set_imp_project_transient: 
   399 lemma (in Extend) transient_extend_set_imp_project_transient: 
   400      "[| G : transient (C Int extend_set h A);  G : stable C |]   
   400      "[| G \<in> transient (C \<inter> extend_set h A);  G \<in> stable C |]   
   401       ==> project h C G : transient (project_set h C Int A)"
   401       ==> project h C G \<in> transient (project_set h C \<inter> A)"
   402 
   402 apply (auto simp add: transient_def Domain_project_act)
   403 apply (unfold transient_def)
   403 apply (subgoal_tac "act `` (C \<inter> extend_set h A) \<subseteq> - extend_set h A")
   404 apply (auto simp add: Domain_project_act)
   404  prefer 2
   405 apply (subgoal_tac "act `` (C Int extend_set h A) <= - extend_set h A")
       
   406 prefer 2
       
   407  apply (simp add: stable_def constrains_def, blast) 
   405  apply (simp add: stable_def constrains_def, blast) 
   408 (*back to main goal*)
   406 (*back to main goal*)
   409 apply (erule_tac V = "?AA <= -C Un ?BB" in thin_rl)
   407 apply (erule_tac V = "?AA \<subseteq> -C \<union> ?BB" in thin_rl)
   410 apply (drule bspec, assumption) 
   408 apply (drule bspec, assumption) 
   411 apply (simp add: extend_set_def project_act_def, blast)
   409 apply (simp add: extend_set_def project_act_def, blast)
   412 done
   410 done
   413 
   411 
   414 (*converse might hold too?*)
   412 (*converse might hold too?*)
   415 lemma (in Extend) project_extend_transient_D: 
   413 lemma (in Extend) project_extend_transient_D: 
   416      "project h C (extend h F) : transient (project_set h C Int D)  
   414      "project h C (extend h F) \<in> transient (project_set h C \<inter> D)  
   417       ==> F : transient (project_set h C Int D)"
   415       ==> F \<in> transient (project_set h C \<inter> D)"
   418 apply (unfold transient_def)
   416 apply (simp add: transient_def Domain_project_act, safe)
   419 apply (auto simp add: Domain_project_act)
   417 apply blast+
   420 apply (rule bexI)
       
   421 prefer 2 apply assumption
       
   422 apply auto
       
   423 apply (unfold extend_act_def, blast)
       
   424 done
   418 done
   425 
   419 
   426 
   420 
   427 subsubsection{*ensures -- a primitive combining progress with safety*}
   421 subsubsection{*ensures -- a primitive combining progress with safety*}
   428 
   422 
   429 (*Used to prove project_leadsETo_I*)
   423 (*Used to prove project_leadsETo_I*)
   430 lemma (in Extend) ensures_extend_set_imp_project_ensures:
   424 lemma (in Extend) ensures_extend_set_imp_project_ensures:
   431      "[| extend h F : stable C;  G : stable C;   
   425      "[| extend h F \<in> stable C;  G \<in> stable C;   
   432          extend h F Join G : A ensures B;  A-B = C Int extend_set h D |]   
   426          extend h F Join G \<in> A ensures B;  A-B = C \<inter> extend_set h D |]   
   433       ==> F Join project h C G   
   427       ==> F Join project h C G   
   434             : (project_set h C Int project_set h A) ensures (project_set h B)"
   428             \<in> (project_set h C \<inter> project_set h A) ensures (project_set h B)"
   435 apply (simp add: ensures_def project_constrains Join_transient extend_transient, clarify)
   429 apply (simp add: ensures_def project_constrains Join_transient extend_transient,
       
   430        clarify)
   436 apply (intro conjI) 
   431 apply (intro conjI) 
   437 (*first subgoal*)
   432 (*first subgoal*)
   438 apply (blast intro: extend_stable_project_set 
   433 apply (blast intro: extend_stable_project_set 
   439                   [THEN stableD, THEN constrains_Int, THEN constrains_weaken] 
   434                   [THEN stableD, THEN constrains_Int, THEN constrains_weaken] 
   440              dest!: extend_constrains_project_set equalityD1)
   435              dest!: extend_constrains_project_set equalityD1)
   455 apply (force dest!: equalityD1 
   450 apply (force dest!: equalityD1 
   456              intro: transient_extend_set_imp_project_transient 
   451              intro: transient_extend_set_imp_project_transient 
   457                [THEN project_extend_transient_D, THEN transient_strengthen])
   452                [THEN project_extend_transient_D, THEN transient_strengthen])
   458 done
   453 done
   459 
   454 
       
   455 text{*Transferring a transient property upwards*}
       
   456 lemma (in Extend) project_transient_extend_set:
       
   457      "project h C G \<in> transient (project_set h C \<inter> A - B)
       
   458       ==> G \<in> transient (C \<inter> extend_set h A - extend_set h B)"
       
   459 apply (simp add: transient_def project_set_def extend_set_def project_act_def)
       
   460 apply (elim disjE bexE)
       
   461  apply (rule_tac x=Id in bexI)  
       
   462   apply (blast intro!: rev_bexI )+
       
   463 done
       
   464 
       
   465 lemma (in Extend) project_unless2 [rule_format]:
       
   466      "[| G \<in> stable C;  project h C G \<in> (project_set h C \<inter> A) unless B |]  
       
   467       ==> G \<in> (C \<inter> extend_set h A) unless (extend_set h B)"
       
   468 by (auto dest: stable_constrains_Int intro: constrains_weaken
       
   469          simp add: unless_def project_constrains Diff_eq Int_assoc 
       
   470                    Int_extend_set_lemma)
       
   471 
       
   472 
       
   473 lemma (in Extend) extend_unless:
       
   474    "[|extend h F \<in> stable C; F \<in> A unless B|]
       
   475     ==> extend h F \<in> C \<inter> extend_set h A unless extend_set h B"
       
   476 apply (simp add: unless_def stable_def)
       
   477 apply (drule constrains_Int) 
       
   478 apply (erule extend_constrains [THEN iffD2]) 
       
   479 apply (erule constrains_weaken, blast) 
       
   480 apply blast 
       
   481 done
       
   482 
   460 (*Used to prove project_leadsETo_D*)
   483 (*Used to prove project_leadsETo_D*)
   461 lemma (in Extend) Join_project_ensures [rule_format]:
   484 lemma (in Extend) Join_project_ensures [rule_format]:
   462      "[| project h C G ~: transient (A-B) | A<=B;   
   485      "[| extend h F Join G \<in> stable C;   
   463          extend h F Join G : stable C;   
   486          F Join project h C G \<in> A ensures B |]  
   464          F Join project h C G : A ensures B |]  
   487       ==> extend h F Join G \<in> (C \<inter> extend_set h A) ensures (extend_set h B)"
   465       ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)"
   488 apply (auto simp add: ensures_eq extend_unless project_unless)
   466 apply (erule disjE)
   489 apply (blast intro:  extend_transient [THEN iffD2] transient_strengthen)  
   467 prefer 2 apply (blast intro: subset_imp_ensures)
   490 apply (blast intro: project_transient_extend_set transient_strengthen)  
   468 apply (auto dest: extend_transient [THEN iffD2]
       
   469             intro: transient_strengthen project_set_I
       
   470                    project_unless [THEN unlessD] unlessI 
       
   471                    project_extend_constrains_I 
       
   472             simp add: ensures_def Join_transient)
       
   473 done
   491 done
   474 
   492 
   475 text{*Lemma useful for both STRONG and WEAK progress, but the transient
   493 text{*Lemma useful for both STRONG and WEAK progress, but the transient
   476     condition's very strong*}
   494     condition's very strong*}
   477 
   495 
   478 (*The strange induction formula allows induction over the leadsTo
   496 (*The strange induction formula allows induction over the leadsTo
   479   assumption's non-atomic precondition*)
   497   assumption's non-atomic precondition*)
   480 lemma (in Extend) PLD_lemma:
   498 lemma (in Extend) PLD_lemma:
   481      "[| ALL D. project h C G : transient D --> D={};   
   499      "[| extend h F Join G \<in> stable C;   
   482          extend h F Join G : stable C;   
   500          F Join project h C G \<in> (project_set h C \<inter> A) leadsTo B |]  
   483          F Join project h C G : (project_set h C Int A) leadsTo B |]  
   501       ==> extend h F Join G \<in>  
   484       ==> extend h F Join G :  
   502           C \<inter> extend_set h (project_set h C \<inter> A) leadsTo (extend_set h B)"
   485           C Int extend_set h (project_set h C Int A) leadsTo (extend_set h B)"
       
   486 apply (erule leadsTo_induct)
   503 apply (erule leadsTo_induct)
   487   apply (blast intro: leadsTo_Basis Join_project_ensures)
   504   apply (blast intro: leadsTo_Basis Join_project_ensures)
   488  apply (blast intro: psp_stable2 [THEN leadsTo_weaken_L] leadsTo_Trans)
   505  apply (blast intro: psp_stable2 [THEN leadsTo_weaken_L] leadsTo_Trans)
   489 apply (simp del: UN_simps add: Int_UN_distrib leadsTo_UN extend_set_Union)
   506 apply (simp del: UN_simps add: Int_UN_distrib leadsTo_UN extend_set_Union)
   490 done
   507 done
   491 
   508 
   492 lemma (in Extend) project_leadsTo_D_lemma:
   509 lemma (in Extend) project_leadsTo_D_lemma:
   493      "[| ALL D. project h C G : transient D --> D={};   
   510      "[| extend h F Join G \<in> stable C;   
   494          extend h F Join G : stable C;   
   511          F Join project h C G \<in> (project_set h C \<inter> A) leadsTo B |]  
   495          F Join project h C G : (project_set h C Int A) leadsTo B |]  
   512       ==> extend h F Join G \<in> (C \<inter> extend_set h A) leadsTo (extend_set h B)"
   496       ==> extend h F Join G : (C Int extend_set h A) leadsTo (extend_set h B)"
       
   497 apply (rule PLD_lemma [THEN leadsTo_weaken])
   513 apply (rule PLD_lemma [THEN leadsTo_weaken])
   498 apply (auto simp add: split_extended_all)
   514 apply (auto simp add: split_extended_all)
   499 done
   515 done
   500 
   516 
   501 lemma (in Extend) Join_project_LeadsTo:
   517 lemma (in Extend) Join_project_LeadsTo:
   502      "[| C = (reachable (extend h F Join G));  
   518      "[| C = (reachable (extend h F Join G));  
   503          ALL D. project h C G : transient D --> D={};   
   519          F Join project h C G \<in> A LeadsTo B |]  
   504          F Join project h C G : A LeadsTo B |]  
   520       ==> extend h F Join G \<in> (extend_set h A) LeadsTo (extend_set h B)"
   505       ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)"
       
   506 by (simp del: Join_stable    add: LeadsTo_def project_leadsTo_D_lemma
   521 by (simp del: Join_stable    add: LeadsTo_def project_leadsTo_D_lemma
   507                                   project_set_reachable_extend_eq)
   522                                   project_set_reachable_extend_eq)
   508 
   523 
   509 
   524 
   510 subsection{*Towards the theorem @{text project_Ensures_D}*}
   525 subsection{*Towards the theorem @{text project_Ensures_D}*}
   511 
   526 
   512 
       
   513 lemma (in Extend) act_subset_imp_project_act_subset: 
       
   514      "act `` (C Int extend_set h A) <= B  
       
   515       ==> project_act h (Restrict C act) `` (project_set h C Int A)  
       
   516           <= project_set h B"
       
   517 apply (unfold project_set_def extend_set_def project_act_def, blast)
       
   518 done
       
   519 
       
   520 (*This trivial proof is the complementation part of transferring a transient
       
   521   property upwards.  The hard part would be to 
       
   522   show that G's action has a big enough domain.*)
       
   523 lemma (in Extend) 
       
   524      "[| act: Acts G;        
       
   525          (project_act h (Restrict C act))``  
       
   526               (project_set h C Int A - B) <= -(project_set h C Int A - B) |]  
       
   527       ==> act``(C Int extend_set h A - extend_set h B)  
       
   528             <= -(C Int extend_set h A - extend_set h B)"
       
   529 by (auto simp add: project_set_def extend_set_def project_act_def)
       
   530 
       
   531 lemma (in Extend) stable_project_transient:
       
   532      "[| G : stable ((C Int extend_set h A) - (extend_set h B));   
       
   533          project h C G : transient (project_set h C Int A - B) |]   
       
   534       ==> (C Int extend_set h A) - extend_set h B = {}"
       
   535 apply (auto simp add: transient_def subset_Compl_self_eq Domain_project_act split_extended_all, blast)
       
   536 apply (auto simp add: stable_def constrains_def)
       
   537 apply (drule bspec, assumption) 
       
   538 apply (auto simp add: Int_Diff extend_set_Diff_distrib [symmetric])
       
   539 apply (drule act_subset_imp_project_act_subset)
       
   540 apply (subgoal_tac "project_act h (Restrict C act) `` (project_set h C Int (A - B)) = {}")
       
   541 apply (erule_tac V = "?r``?A <= ?B" in thin_rl)+
       
   542 apply (unfold project_set_def extend_set_def project_act_def)
       
   543 prefer 2 apply blast
       
   544 apply (rule ccontr)
       
   545 apply (drule subsetD, blast)
       
   546 apply (force simp add: split_extended_all)
       
   547 done
       
   548 
       
   549 lemma (in Extend) project_unless2 [rule_format]:
       
   550      "[| G : stable C;  project h C G : (project_set h C Int A) unless B |]  
       
   551       ==> G : (C Int extend_set h A) unless (extend_set h B)"
       
   552 by (auto dest: stable_constrains_Int intro: constrains_weaken
       
   553          simp add: unless_def project_constrains Diff_eq Int_assoc 
       
   554                    Int_extend_set_lemma)
       
   555 
       
   556 lemma (in Extend) project_ensures_D_lemma:
   527 lemma (in Extend) project_ensures_D_lemma:
   557      "[| G : stable ((C Int extend_set h A) - (extend_set h B));   
   528      "[| G \<in> stable ((C \<inter> extend_set h A) - (extend_set h B));   
   558          F Join project h C G : (project_set h C Int A) ensures B;   
   529          F Join project h C G \<in> (project_set h C \<inter> A) ensures B;   
   559          extend h F Join G : stable C |]  
   530          extend h F Join G \<in> stable C |]  
   560       ==> extend h F Join G : (C Int extend_set h A) ensures (extend_set h B)"
   531       ==> extend h F Join G \<in> (C \<inter> extend_set h A) ensures (extend_set h B)"
   561 (*unless*)
   532 (*unless*)
   562 apply (auto intro!: project_unless2 [unfolded unless_def] 
   533 apply (auto intro!: project_unless2 [unfolded unless_def] 
   563             intro: project_extend_constrains_I 
   534             intro: project_extend_constrains_I 
   564             simp add: ensures_def)
   535             simp add: ensures_def)
   565 (*transient*)
   536 (*transient*)
   566 (*A G-action cannot occur*)
   537 (*A G-action cannot occur*)
   567  prefer 2
   538  prefer 2
   568  apply (force dest: stable_project_transient 
   539  apply (blast intro: project_transient_extend_set) 
   569               simp del: Diff_eq_empty_iff
       
   570               simp add: Diff_eq_empty_iff [symmetric])
       
   571 (*An F-action*)
   540 (*An F-action*)
   572 apply (force elim!: extend_transient [THEN iffD2, THEN transient_strengthen]
   541 apply (force elim!: extend_transient [THEN iffD2, THEN transient_strengthen]
   573              simp add: split_extended_all)
   542              simp add: split_extended_all)
   574 done
   543 done
   575 
   544 
   576 lemma (in Extend) project_ensures_D:
   545 lemma (in Extend) project_ensures_D:
   577      "[| F Join project h UNIV G : A ensures B;   
   546      "[| F Join project h UNIV G \<in> A ensures B;   
   578          G : stable (extend_set h A - extend_set h B) |]  
   547          G \<in> stable (extend_set h A - extend_set h B) |]  
   579       ==> extend h F Join G : (extend_set h A) ensures (extend_set h B)"
   548       ==> extend h F Join G \<in> (extend_set h A) ensures (extend_set h B)"
   580 apply (rule project_ensures_D_lemma [of _ UNIV, THEN revcut_rl], auto)
   549 apply (rule project_ensures_D_lemma [of _ UNIV, THEN revcut_rl], auto)
   581 done
   550 done
   582 
   551 
   583 lemma (in Extend) project_Ensures_D: 
   552 lemma (in Extend) project_Ensures_D: 
   584      "[| F Join project h (reachable (extend h F Join G)) G : A Ensures B;   
   553      "[| F Join project h (reachable (extend h F Join G)) G \<in> A Ensures B;   
   585          G : stable (reachable (extend h F Join G) Int extend_set h A -  
   554          G \<in> stable (reachable (extend h F Join G) \<inter> extend_set h A -  
   586                      extend_set h B) |]  
   555                      extend_set h B) |]  
   587       ==> extend h F Join G : (extend_set h A) Ensures (extend_set h B)"
   556       ==> extend h F Join G \<in> (extend_set h A) Ensures (extend_set h B)"
   588 apply (unfold Ensures_def)
   557 apply (unfold Ensures_def)
   589 apply (rule project_ensures_D_lemma [THEN revcut_rl])
   558 apply (rule project_ensures_D_lemma [THEN revcut_rl])
   590 apply (auto simp add: project_set_reachable_extend_eq [symmetric])
   559 apply (auto simp add: project_set_reachable_extend_eq [symmetric])
   591 done
   560 done
   592 
   561 
   593 
   562 
   594 subsection{*Guarantees*}
   563 subsection{*Guarantees*}
   595 
   564 
   596 lemma (in Extend) project_act_Restrict_subset_project_act:
   565 lemma (in Extend) project_act_Restrict_subset_project_act:
   597      "project_act h (Restrict C act) <= project_act h act"
   566      "project_act h (Restrict C act) \<subseteq> project_act h act"
   598 apply (auto simp add: project_act_def)
   567 apply (auto simp add: project_act_def)
   599 done
   568 done
   600 					   
   569 					   
   601 							   
   570 							   
   602 lemma (in Extend) subset_closed_ok_extend_imp_ok_project:
   571 lemma (in Extend) subset_closed_ok_extend_imp_ok_project:
   614 
   583 
   615 (*Weak precondition and postcondition
   584 (*Weak precondition and postcondition
   616   Not clear that it has a converse [or that we want one!]*)
   585   Not clear that it has a converse [or that we want one!]*)
   617 
   586 
   618 (*The raw version; 3rd premise could be weakened by adding the
   587 (*The raw version; 3rd premise could be weakened by adding the
   619   precondition extend h F Join G : X' *)
   588   precondition extend h F Join G \<in> X' *)
   620 lemma (in Extend) project_guarantees_raw:
   589 lemma (in Extend) project_guarantees_raw:
   621  assumes xguary:  "F : X guarantees Y"
   590  assumes xguary:  "F \<in> X guarantees Y"
   622      and closed:  "subset_closed (AllowedActs F)"
   591      and closed:  "subset_closed (AllowedActs F)"
   623      and project: "!!G. extend h F Join G : X' 
   592      and project: "!!G. extend h F Join G \<in> X' 
   624                         ==> F Join project h (C G) G : X"
   593                         ==> F Join project h (C G) G \<in> X"
   625      and extend:  "!!G. [| F Join project h (C G) G : Y |]  
   594      and extend:  "!!G. [| F Join project h (C G) G \<in> Y |]  
   626                         ==> extend h F Join G : Y'"
   595                         ==> extend h F Join G \<in> Y'"
   627  shows "extend h F : X' guarantees Y'"
   596  shows "extend h F \<in> X' guarantees Y'"
   628 apply (rule xguary [THEN guaranteesD, THEN extend, THEN guaranteesI])
   597 apply (rule xguary [THEN guaranteesD, THEN extend, THEN guaranteesI])
   629 apply (blast intro: closed subset_closed_ok_extend_imp_ok_project)
   598 apply (blast intro: closed subset_closed_ok_extend_imp_ok_project)
   630 apply (erule project)
   599 apply (erule project)
   631 done
   600 done
   632 
   601 
   633 lemma (in Extend) project_guarantees:
   602 lemma (in Extend) project_guarantees:
   634      "[| F : X guarantees Y;  subset_closed (AllowedActs F);  
   603      "[| F \<in> X guarantees Y;  subset_closed (AllowedActs F);  
   635          projecting C h F X' X;  extending C h F Y' Y |]  
   604          projecting C h F X' X;  extending C h F Y' Y |]  
   636       ==> extend h F : X' guarantees Y'"
   605       ==> extend h F \<in> X' guarantees Y'"
   637 apply (rule guaranteesI)
   606 apply (rule guaranteesI)
   638 apply (auto simp add: guaranteesD projecting_def extending_def
   607 apply (auto simp add: guaranteesD projecting_def extending_def
   639                       subset_closed_ok_extend_imp_ok_project)
   608                       subset_closed_ok_extend_imp_ok_project)
   640 done
   609 done
   641 
   610 
   646 subsection{*guarantees corollaries*}
   615 subsection{*guarantees corollaries*}
   647 
   616 
   648 subsubsection{*Some could be deleted: the required versions are easy to prove*}
   617 subsubsection{*Some could be deleted: the required versions are easy to prove*}
   649 
   618 
   650 lemma (in Extend) extend_guar_increasing:
   619 lemma (in Extend) extend_guar_increasing:
   651      "[| F : UNIV guarantees increasing func;   
   620      "[| F \<in> UNIV guarantees increasing func;   
   652          subset_closed (AllowedActs F) |]  
   621          subset_closed (AllowedActs F) |]  
   653       ==> extend h F : X' guarantees increasing (func o f)"
   622       ==> extend h F \<in> X' guarantees increasing (func o f)"
   654 apply (erule project_guarantees)
   623 apply (erule project_guarantees)
   655 apply (rule_tac [3] extending_increasing)
   624 apply (rule_tac [3] extending_increasing)
   656 apply (rule_tac [2] projecting_UNIV, auto)
   625 apply (rule_tac [2] projecting_UNIV, auto)
   657 done
   626 done
   658 
   627 
   659 lemma (in Extend) extend_guar_Increasing:
   628 lemma (in Extend) extend_guar_Increasing:
   660      "[| F : UNIV guarantees Increasing func;   
   629      "[| F \<in> UNIV guarantees Increasing func;   
   661          subset_closed (AllowedActs F) |]  
   630          subset_closed (AllowedActs F) |]  
   662       ==> extend h F : X' guarantees Increasing (func o f)"
   631       ==> extend h F \<in> X' guarantees Increasing (func o f)"
   663 apply (erule project_guarantees)
   632 apply (erule project_guarantees)
   664 apply (rule_tac [3] extending_Increasing)
   633 apply (rule_tac [3] extending_Increasing)
   665 apply (rule_tac [2] projecting_UNIV, auto)
   634 apply (rule_tac [2] projecting_UNIV, auto)
   666 done
   635 done
   667 
   636 
   668 lemma (in Extend) extend_guar_Always:
   637 lemma (in Extend) extend_guar_Always:
   669      "[| F : Always A guarantees Always B;   
   638      "[| F \<in> Always A guarantees Always B;   
   670          subset_closed (AllowedActs F) |]  
   639          subset_closed (AllowedActs F) |]  
   671       ==> extend h F                    
   640       ==> extend h F                    
   672             : Always(extend_set h A) guarantees Always(extend_set h B)"
   641             \<in> Always(extend_set h A) guarantees Always(extend_set h B)"
   673 apply (erule project_guarantees)
   642 apply (erule project_guarantees)
   674 apply (rule_tac [3] extending_Always)
   643 apply (rule_tac [3] extending_Always)
   675 apply (rule_tac [2] projecting_Always, auto)
   644 apply (rule_tac [2] projecting_Always, auto)
   676 done
   645 done
   677 
   646 
   678 lemma (in Extend) preserves_project_transient_empty:
   647 
   679      "[| G : preserves f;  project h C G : transient D |] ==> D={}"
   648 subsubsection{*Guarantees with a leadsTo postcondition*}
   680 apply (rule stable_transient_empty)
       
   681  prefer 2 apply assumption
       
   682 apply (blast intro: project_preserves_id_I 
       
   683                     preserves_id_subset_stable [THEN subsetD])
       
   684 done
       
   685 
       
   686 
       
   687 subsubsection{*Guarantees with a leadsTo postcondition 
       
   688      ALL TOO WEAK because G can't affect F's variables at all**)
       
   689 
   649 
   690 lemma (in Extend) project_leadsTo_D:
   650 lemma (in Extend) project_leadsTo_D:
   691      "[| F Join project h UNIV G : A leadsTo B;     
   651      "F Join project h UNIV G \<in> A leadsTo B
   692          G : preserves f |]   
   652       ==> extend h F Join G \<in> (extend_set h A) leadsTo (extend_set h B)"
   693       ==> extend h F Join G : (extend_set h A) leadsTo (extend_set h B)"
   653 apply (rule_tac C1 = UNIV in project_leadsTo_D_lemma [THEN leadsTo_weaken], auto)
   694 apply (rule_tac C1 = UNIV in project_leadsTo_D_lemma [THEN leadsTo_weaken])
       
   695 apply (auto dest: preserves_project_transient_empty)
       
   696 done
   654 done
   697 
   655 
   698 lemma (in Extend) project_LeadsTo_D:
   656 lemma (in Extend) project_LeadsTo_D:
   699      "[| F Join project h (reachable (extend h F Join G)) G : A LeadsTo B;
   657      "F Join project h (reachable (extend h F Join G)) G \<in> A LeadsTo B   
   700          G : preserves f |]   
   658        ==> extend h F Join G \<in> (extend_set h A) LeadsTo (extend_set h B)"
   701        ==> extend h F Join G : (extend_set h A) LeadsTo (extend_set h B)"
   659 apply (rule refl [THEN Join_project_LeadsTo], auto)
   702 apply (rule refl [THEN Join_project_LeadsTo])
       
   703 apply (auto dest: preserves_project_transient_empty)
       
   704 done
   660 done
   705 
   661 
   706 lemma (in Extend) extending_leadsTo: 
   662 lemma (in Extend) extending_leadsTo: 
   707      "(ALL G. extend h F ok G --> G : preserves f)  
   663      "extending (%G. UNIV) h F  
   708       ==> extending (%G. UNIV) h F  
   664                 (extend_set h A leadsTo extend_set h B) (A leadsTo B)"
   709                   (extend_set h A leadsTo extend_set h B) (A leadsTo B)"
       
   710 apply (unfold extending_def)
   665 apply (unfold extending_def)
   711 apply (blast intro: project_leadsTo_D)
   666 apply (blast intro: project_leadsTo_D)
   712 done
   667 done
   713 
   668 
   714 lemma (in Extend) extending_LeadsTo: 
   669 lemma (in Extend) extending_LeadsTo: 
   715      "(ALL G. extend h F ok G --> G : preserves f)  
   670      "extending (%G. reachable (extend h F Join G)) h F  
   716       ==> extending (%G. reachable (extend h F Join G)) h F  
   671                 (extend_set h A LeadsTo extend_set h B) (A LeadsTo B)"
   717                   (extend_set h A LeadsTo extend_set h B) (A LeadsTo B)"
       
   718 apply (unfold extending_def)
   672 apply (unfold extending_def)
   719 apply (blast intro: project_LeadsTo_D)
   673 apply (blast intro: project_LeadsTo_D)
   720 done
   674 done
   721 
   675 
   722 ML
   676 ML