src/HOL/UNITY/Constrains.thy
changeset 63146 f1ecba0272f9
parent 58889 5b7a9633cfa8
child 67613 ce654b0e6d69
equal deleted inserted replaced
63145:703edebd1d92 63146:f1ecba0272f9
     3     Copyright   1998  University of Cambridge
     3     Copyright   1998  University of Cambridge
     4 
     4 
     5 Weak safety relations: restricted to the set of reachable states.
     5 Weak safety relations: restricted to the set of reachable states.
     6 *)
     6 *)
     7 
     7 
     8 section{*Weak Safety*}
     8 section\<open>Weak Safety\<close>
     9 
     9 
    10 theory Constrains imports UNITY begin
    10 theory Constrains imports UNITY begin
    11 
    11 
    12   (*Initial states and program => (final state, reversed trace to it)...
    12   (*Initial states and program => (final state, reversed trace to it)...
    13     Arguments MUST be curried in an inductive definition*)
    13     Arguments MUST be curried in an inductive definition*)
    48   (*Polymorphic in both states and the meaning of \<le> *)
    48   (*Polymorphic in both states and the meaning of \<le> *)
    49 definition Increasing :: "['a => 'b::{order}] => 'a program set" where
    49 definition Increasing :: "['a => 'b::{order}] => 'a program set" where
    50     "Increasing f == \<Inter>z. Stable {s. z \<le> f s}"
    50     "Increasing f == \<Inter>z. Stable {s. z \<le> f s}"
    51 
    51 
    52 
    52 
    53 subsection{*traces and reachable*}
    53 subsection\<open>traces and reachable\<close>
    54 
    54 
    55 lemma reachable_equiv_traces:
    55 lemma reachable_equiv_traces:
    56      "reachable F = {s. \<exists>evs. (s,evs) \<in> traces (Init F) (Acts F)}"
    56      "reachable F = {s. \<exists>evs. (s,evs) \<in> traces (Init F) (Acts F)}"
    57 apply safe
    57 apply safe
    58 apply (erule_tac [2] traces.induct)
    58 apply (erule_tac [2] traces.induct)
    80 apply (erule reachable.induct)
    80 apply (erule reachable.induct)
    81 apply (blast intro: reachable.intros)+
    81 apply (blast intro: reachable.intros)+
    82 done
    82 done
    83 
    83 
    84 
    84 
    85 subsection{*Co*}
    85 subsection\<open>Co\<close>
    86 
    86 
    87 (*F \<in> B co B' ==> F \<in> (reachable F \<inter> B) co (reachable F \<inter> B')*)
    87 (*F \<in> B co B' ==> F \<in> (reachable F \<inter> B) co (reachable F \<inter> B')*)
    88 lemmas constrains_reachable_Int =  
    88 lemmas constrains_reachable_Int =  
    89     subset_refl [THEN stable_reachable [unfolded stable_def], THEN constrains_Int]
    89     subset_refl [THEN stable_reachable [unfolded stable_def], THEN constrains_Int]
    90 
    90 
   183 apply (simp add: Constrains_eq_constrains constrains_def)
   183 apply (simp add: Constrains_eq_constrains constrains_def)
   184 apply best
   184 apply best
   185 done
   185 done
   186 
   186 
   187 
   187 
   188 subsection{*Stable*}
   188 subsection\<open>Stable\<close>
   189 
   189 
   190 (*Useful because there's no Stable_weaken.  [Tanja Vos]*)
   190 (*Useful because there's no Stable_weaken.  [Tanja Vos]*)
   191 lemma Stable_eq: "[| F \<in> Stable A; A = B |] ==> F \<in> Stable B"
   191 lemma Stable_eq: "[| F \<in> Stable A; A = B |] ==> F \<in> Stable B"
   192 by blast
   192 by blast
   193 
   193 
   237 lemma Stable_reachable: "F \<in> Stable (reachable F)"
   237 lemma Stable_reachable: "F \<in> Stable (reachable F)"
   238 by (simp add: Stable_eq_stable)
   238 by (simp add: Stable_eq_stable)
   239 
   239 
   240 
   240 
   241 
   241 
   242 subsection{*Increasing*}
   242 subsection\<open>Increasing\<close>
   243 
   243 
   244 lemma IncreasingD: 
   244 lemma IncreasingD: 
   245      "F \<in> Increasing f ==> F \<in> Stable {s. x \<le> f s}"
   245      "F \<in> Increasing f ==> F \<in> Stable {s. x \<le> f s}"
   246 by (unfold Increasing_def, blast)
   246 by (unfold Increasing_def, blast)
   247 
   247 
   263 done
   263 done
   264 
   264 
   265 lemmas Increasing_constant = increasing_constant [THEN increasing_imp_Increasing, iff]
   265 lemmas Increasing_constant = increasing_constant [THEN increasing_imp_Increasing, iff]
   266 
   266 
   267 
   267 
   268 subsection{*The Elimination Theorem*}
   268 subsection\<open>The Elimination Theorem\<close>
   269 
   269 
   270 (*The "free" m has become universally quantified! Should the premise be !!m
   270 (*The "free" m has become universally quantified! Should the premise be !!m
   271 instead of \<forall>m ?  Would make it harder to use in forward proof.*)
   271 instead of \<forall>m ?  Would make it harder to use in forward proof.*)
   272 
   272 
   273 lemma Elimination: 
   273 lemma Elimination: 
   280 lemma Elimination_sing: 
   280 lemma Elimination_sing: 
   281     "(\<forall>m. F \<in> {m} Co (B m)) ==> F \<in> M Co (\<Union>m \<in> M. B m)"
   281     "(\<forall>m. F \<in> {m} Co (B m)) ==> F \<in> M Co (\<Union>m \<in> M. B m)"
   282 by (unfold Constrains_def constrains_def, blast)
   282 by (unfold Constrains_def constrains_def, blast)
   283 
   283 
   284 
   284 
   285 subsection{*Specialized laws for handling Always*}
   285 subsection\<open>Specialized laws for handling Always\<close>
   286 
   286 
   287 (** Natural deduction rules for "Always A" **)
   287 (** Natural deduction rules for "Always A" **)
   288 
   288 
   289 lemma AlwaysI: "[| Init F \<subseteq> A;  F \<in> Stable A |] ==> F \<in> Always A"
   289 lemma AlwaysI: "[| Init F \<subseteq> A;  F \<in> Stable A |] ==> F \<in> Always A"
   290 by (simp add: Always_def)
   290 by (simp add: Always_def)
   337 
   337 
   338 lemma Always_weaken: "[| F \<in> Always A; A \<subseteq> B |] ==> F \<in> Always B"
   338 lemma Always_weaken: "[| F \<in> Always A; A \<subseteq> B |] ==> F \<in> Always B"
   339 by (auto simp add: Always_eq_includes_reachable)
   339 by (auto simp add: Always_eq_includes_reachable)
   340 
   340 
   341 
   341 
   342 subsection{*"Co" rules involving Always*}
   342 subsection\<open>"Co" rules involving Always\<close>
   343 
   343 
   344 lemma Always_Constrains_pre:
   344 lemma Always_Constrains_pre:
   345      "F \<in> Always INV ==> (F \<in> (INV \<inter> A) Co A') = (F \<in> A Co A')"
   345      "F \<in> Always INV ==> (F \<in> (INV \<inter> A) Co A') = (F \<in> A Co A')"
   346 by (simp add: Always_includes_reachable [THEN Int_absorb2] Constrains_def 
   346 by (simp add: Always_includes_reachable [THEN Int_absorb2] Constrains_def 
   347               Int_assoc [symmetric])
   347               Int_assoc [symmetric])
   388 (*Delete the nearest invariance assumption (which will be the second one
   388 (*Delete the nearest invariance assumption (which will be the second one
   389   used by Always_Int_I) *)
   389   used by Always_Int_I) *)
   390 lemmas Always_thin = thin_rl [of "F \<in> Always A"]
   390 lemmas Always_thin = thin_rl [of "F \<in> Always A"]
   391 
   391 
   392 
   392 
   393 subsection{*Totalize*}
   393 subsection\<open>Totalize\<close>
   394 
   394 
   395 lemma reachable_imp_reachable_tot:
   395 lemma reachable_imp_reachable_tot:
   396       "s \<in> reachable F ==> s \<in> reachable (totalize F)"
   396       "s \<in> reachable F ==> s \<in> reachable (totalize F)"
   397 apply (erule reachable.induct)
   397 apply (erule reachable.induct)
   398  apply (rule reachable.Init) 
   398  apply (rule reachable.Init)