src/HOL/UNITY/Comp/Priority.thy
changeset 14088 61bd46feb919
parent 14087 cb07c3948668
child 15274 c18f5b076e53
equal deleted inserted replaced
14087:cb07c3948668 14088:61bd46feb919
     1 (*  Title:      HOL/UNITY/Priority
     1 (*  Title:      HOL/UNITY/Priority
     2     ID:         $Id$
     2     ID:         $Id$
     3     Author:     Sidi O Ehmety, Cambridge University Computer Laboratory
     3     Author:     Sidi O Ehmety, Cambridge University Computer Laboratory
     4     Copyright   2001  University of Cambridge
     4     Copyright   2001  University of Cambridge
     5 
       
     6 
       
     7 *)
     5 *)
     8 
     6 
     9 header{*The priority system*}
     7 header{*The priority system*}
    10 
     8 
    11 theory Priority = PriorityAux:
     9 theory Priority = PriorityAux:
   126 by (simp add: system_def Component_def mk_total_program_def totalize_JN, constrains, blast)
   124 by (simp add: system_def Component_def mk_total_program_def totalize_JN, constrains, blast)
   127 
   125 
   128 (* property 14: the 'above set' of a Component that hasn't got 
   126 (* property 14: the 'above set' of a Component that hasn't got 
   129       priority doesn't increase *)
   127       priority doesn't increase *)
   130 lemma above_not_increase: 
   128 lemma above_not_increase: 
   131      "\<forall>j. system \<in> -Highest i Int {s. j\<notin>above i s} co {s. j\<notin>above i s}"
   129      "system \<in> -Highest i Int {s. j\<notin>above i s} co {s. j\<notin>above i s}"
   132 apply clarify
   130 apply (insert reach_lemma [of concl: j])
   133 apply (cut_tac i = j in reach_lemma)
       
   134 apply (simp add: system_def Component_def mk_total_program_def totalize_JN, 
   131 apply (simp add: system_def Component_def mk_total_program_def totalize_JN, 
   135        constrains)
   132        constrains)
   136 apply (auto simp add: trancl_converse)
   133 apply (simp add: trancl_converse, blast) 
   137 done
   134 done
   138 
   135 
   139 lemma above_not_increase':
   136 lemma above_not_increase':
   140      "system \<in> -Highest i Int {s. above i s = x} co {s. above i s <= x}"
   137      "system \<in> -Highest i Int {s. above i s = x} co {s. above i s <= x}"
   141 apply (cut_tac i = i in above_not_increase)
   138 apply (insert above_not_increase [of i])
   142 apply (simp add: trancl_converse constrains_def, blast)
   139 apply (simp add: trancl_converse constrains_def, blast)
   143 done
   140 done
   144 
   141 
   145 
   142 
   146 
   143 
   172 apply (drule above_lemma_b, auto)
   169 apply (drule above_lemma_b, auto)
   173 done
   170 done
   174 
   171 
   175 (* property 17: original one is an invariant *)
   172 (* property 17: original one is an invariant *)
   176 lemma Acyclic_Maximal_stable: "system \<in> stable (Acyclic Int Maximal)"
   173 lemma Acyclic_Maximal_stable: "system \<in> stable (Acyclic Int Maximal)"
   177 apply (simp add: Acyclic_subset_Maximal [THEN Int_absorb2] Acyclic_stable)
   174 by (simp add: Acyclic_subset_Maximal [THEN Int_absorb2] Acyclic_stable)
   178 done
       
   179 
   175 
   180 
   176 
   181 (* propert 5: existential property *)
   177 (* propert 5: existential property *)
   182 
   178 
   183 lemma Highest_leadsTo_Lowest: "system \<in> Highest i leadsTo Lowest i"
   179 lemma Highest_leadsTo_Lowest: "system \<in> Highest i leadsTo Lowest i"
   214      "system \<in> (\<Union>j. {s. above i s = x} Int {s. j \<in> above i s} Int Highest j)  
   210      "system \<in> (\<Union>j. {s. above i s = x} Int {s. j \<in> above i s} Int Highest j)  
   215                leadsTo {s. above i s < x}"
   211                leadsTo {s. above i s < x}"
   216 apply (rule leadsTo_UN)
   212 apply (rule leadsTo_UN)
   217 apply (rule single_leadsTo_I, clarify)
   213 apply (rule single_leadsTo_I, clarify)
   218 apply (rule_tac x2 = "above i x" in above_decreases_lemma)
   214 apply (rule_tac x2 = "above i x" in above_decreases_lemma)
   219 apply (simp_all (no_asm_use) del: Highest_def add: Highest_iff_above0)
   215 apply (simp_all (no_asm_use) add: Highest_iff_above0)
   220 apply blast+
   216 apply blast+
   221 done
   217 done
   222 
   218 
   223 (** Just a massage of conditions to have the desired form ***)
   219 (** Just a massage of conditions to have the desired form ***)
   224 lemma Maximal_eq_Maximal': "Maximal = Maximal'"
   220 lemma Maximal_eq_Maximal': "Maximal = Maximal'"
   247 lemmas finite_psubset_induct = wf_finite_psubset [THEN leadsTo_wf_induct]
   243 lemmas finite_psubset_induct = wf_finite_psubset [THEN leadsTo_wf_induct]
   248 
   244 
   249 
   245 
   250 lemma Progress: "system \<in> Acyclic leadsTo Highest i"
   246 lemma Progress: "system \<in> Acyclic leadsTo Highest i"
   251 apply (rule_tac f = "%s. above i s" in finite_psubset_induct)
   247 apply (rule_tac f = "%s. above i s" in finite_psubset_induct)
   252 apply (simp del: Highest_def above_def
   248 apply (simp del: above_def
   253             add: Highest_iff_above0 vimage_def finite_psubset_def, clarify)
   249             add: Highest_iff_above0 vimage_def finite_psubset_def, clarify)
   254 apply (case_tac "m={}")
   250 apply (case_tac "m={}")
   255 apply (rule Int_lower2 [THEN [2] leadsTo_weaken_L])
   251 apply (rule Int_lower2 [THEN [2] leadsTo_weaken_L])
   256 apply (force simp add: leadsTo_refl)
   252 apply (force simp add: leadsTo_refl)
   257 apply (rule_tac A' = "Acyclic Int {x. above i x < m}" in leadsTo_weaken_R)
   253 apply (rule_tac A' = "Acyclic Int {x. above i x < m}" in leadsTo_weaken_R)