CpsG.thy
changeset 33 9b9f2117561f
parent 32 e861aff29655
child 35 92f61f6a0fe7
equal deleted inserted replaced
32:e861aff29655 33:9b9f2117561f
       
     1 
     1 theory CpsG
     2 theory CpsG
     2 imports PrioG 
     3 imports PrioG 
     3 begin
     4 begin
     4 
     5 
     5 lemma not_thread_holdents:
     6 lemma not_thread_holdents:
   156 
   157 
   157 lemma next_th_unique: 
   158 lemma next_th_unique: 
   158   assumes nt1: "next_th s th cs th1"
   159   assumes nt1: "next_th s th cs th1"
   159   and nt2: "next_th s th cs th2"
   160   and nt2: "next_th s th cs th2"
   160   shows "th1 = th2"
   161   shows "th1 = th2"
   161 proof -
   162 using assms by (unfold next_th_def, auto)
   162   from assms show ?thesis
       
   163     by (unfold next_th_def, auto)
       
   164 qed
       
   165 
       
   166 lemma pp_sub: "(r^+)^+ \<subseteq> r^+"
       
   167   by auto
       
   168 
   163 
   169 lemma wf_depend:
   164 lemma wf_depend:
   170   assumes vt: "vt s"
   165   assumes vt: "vt s"
   171   shows "wf (depend s)"
   166   shows "wf (depend s)"
   172 proof(rule finite_acyclic_wf)
   167 proof(rule finite_acyclic_wf)
   244   qed
   239   qed
   245 qed
   240 qed
   246 
   241 
   247 definition child :: "state \<Rightarrow> (node \<times> node) set"
   242 definition child :: "state \<Rightarrow> (node \<times> node) set"
   248   where "child s \<equiv>
   243   where "child s \<equiv>
   249             {(Th th', Th th) | th th'. \<exists> cs. (Th th', Cs cs) \<in> depend s \<and> (Cs cs, Th th) \<in> depend s}"
   244             {(Th th', Th th) | th th'. \<exists>cs. (Th th', Cs cs) \<in> depend s \<and> (Cs cs, Th th) \<in> depend s}"
   250 
   245 
   251 definition children :: "state \<Rightarrow> thread \<Rightarrow> thread set"
   246 definition children :: "state \<Rightarrow> thread \<Rightarrow> thread set"
   252   where "children s th \<equiv> {th'. (Th th', Th th) \<in> child s}"
   247   where "children s th \<equiv> {th'. (Th th', Th th) \<in> child s}"
   253 
   248 
   254 lemma children_def2:
   249 lemma children_def2:
   261 lemma child_unique:
   256 lemma child_unique:
   262   assumes vt: "vt s"
   257   assumes vt: "vt s"
   263   and ch1: "(Th th, Th th1) \<in> child s"
   258   and ch1: "(Th th, Th th1) \<in> child s"
   264   and ch2: "(Th th, Th th2) \<in> child s"
   259   and ch2: "(Th th, Th th2) \<in> child s"
   265   shows "th1 = th2"
   260   shows "th1 = th2"
   266 proof -
   261 using ch1 ch2 
   267   from ch1 ch2 show ?thesis
   262 proof(unfold child_def, clarsimp)
   268   proof(unfold child_def, clarsimp)
   263   fix cs csa
   269     fix cs csa
   264   assume h1: "(Th th, Cs cs) \<in> depend s"
   270     assume h1: "(Th th, Cs cs) \<in> depend s"
   265     and h2: "(Cs cs, Th th1) \<in> depend s"
   271       and h2: "(Cs cs, Th th1) \<in> depend s"
   266     and h3: "(Th th, Cs csa) \<in> depend s"
   272       and h3: "(Th th, Cs csa) \<in> depend s"
   267     and h4: "(Cs csa, Th th2) \<in> depend s"
   273       and h4: "(Cs csa, Th th2) \<in> depend s"
   268   from unique_depend[OF vt h1 h3] have "cs = csa" by simp
   274     from unique_depend[OF vt h1 h3] have "cs = csa" by simp
   269   with h4 have "(Cs cs, Th th2) \<in> depend s" by simp
   275     with h4 have "(Cs cs, Th th2) \<in> depend s" by simp
   270   from unique_depend[OF vt h2 this]
   276     from unique_depend[OF vt h2 this]
   271   show "th1 = th2" by simp
   277     show "th1 = th2" by simp
   272 qed 
   278   qed 
       
   279 qed
       
   280 
       
   281 
       
   282 lemma cp_eq_cpreced_f: "cp s = cpreced (wq s) s"
       
   283 proof -
       
   284   from fun_eq_iff 
       
   285   have h:"\<And>f g. (\<forall> x. f x = g x) \<Longrightarrow> f = g" by auto
       
   286   show ?thesis
       
   287   proof(rule h)
       
   288     from cp_eq_cpreced show "\<forall>x. cp s x = cpreced (wq s) s x" by auto
       
   289   qed
       
   290 qed
       
   291 
   273 
   292 lemma depend_children:
   274 lemma depend_children:
   293   assumes h: "(Th th1, Th th2) \<in> (depend s)^+"
   275   assumes h: "(Th th1, Th th2) \<in> (depend s)^+"
   294   shows "th1 \<in> children s th2 \<or> (\<exists> th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (depend s)^+)"
   276   shows "th1 \<in> children s th2 \<or> (\<exists> th3. th3 \<in> children s th2 \<and> (Th th1, Th th3) \<in> (depend s)^+)"
   295 proof -
   277 proof -
   332   by (unfold child_def, auto)
   314   by (unfold child_def, auto)
   333 
   315 
   334 lemma wf_child: 
   316 lemma wf_child: 
   335   assumes vt: "vt s"
   317   assumes vt: "vt s"
   336   shows "wf (child s)"
   318   shows "wf (child s)"
   337 proof(rule wf_subset)
   319 apply(rule wf_subset)
   338   from wf_trancl[OF wf_depend[OF vt]]
   320 apply(rule wf_trancl[OF wf_depend[OF vt]])
   339   show "wf ((depend s)\<^sup>+)" .
   321 apply(rule sub_child)
   340 next
   322 done
   341   from sub_child show "child s \<subseteq> (depend s)\<^sup>+" .
       
   342 qed
       
   343 
   323 
   344 lemma depend_child_pre:
   324 lemma depend_child_pre:
   345   assumes vt: "vt s"
   325   assumes vt: "vt s"
   346   shows
   326   shows
   347   "(Th th, n) \<in> (depend s)^+ \<longrightarrow> (\<forall> th'. n = (Th th') \<longrightarrow> (Th th, Th th') \<in> (child s)^+)" (is "?P n")
   327   "(Th th, n) \<in> (depend s)^+ \<longrightarrow> (\<forall> th'. n = (Th th') \<longrightarrow> (Th th, Th th') \<in> (child s)^+)" (is "?P n")
   394   qed
   374   qed
   395 qed
   375 qed
   396 
   376 
   397 lemma child_depend_eq: 
   377 lemma child_depend_eq: 
   398   assumes vt: "vt s"
   378   assumes vt: "vt s"
   399   shows 
   379   shows "(Th th1, Th th2) \<in> (child s)^+  \<longleftrightarrow> (Th th1, Th th2) \<in> (depend s)^+"
   400   "((Th th1, Th th2) \<in> (child s)^+) = 
       
   401    ((Th th1, Th th2) \<in> (depend s)^+)"
       
   402   by (auto intro: depend_child[OF vt] child_depend_p)
   380   by (auto intro: depend_child[OF vt] child_depend_p)
   403 
   381 
   404 lemma children_no_dep:
   382 lemma children_no_dep:
   405   fixes s th th1 th2 th3
   383   fixes s th th1 th2 th3
   406   assumes vt: "vt s"
   384   assumes vt: "vt s"
   411 proof -
   389 proof -
   412   from depend_child[OF vt ch3]
   390   from depend_child[OF vt ch3]
   413   have "(Th th1, Th th2) \<in> (child s)\<^sup>+" .
   391   have "(Th th1, Th th2) \<in> (child s)\<^sup>+" .
   414   thus ?thesis
   392   thus ?thesis
   415   proof(rule converse_tranclE)
   393   proof(rule converse_tranclE)
   416     thm tranclD
       
   417     assume "(Th th1, Th th2) \<in> child s"
   394     assume "(Th th1, Th th2) \<in> child s"
   418     from child_unique[OF vt ch1 this] have "th = th2" by simp
   395     from child_unique[OF vt ch1 this] have "th = th2" by simp
   419     with ch2 have "(Th th2, Th th2) \<in> child s" by simp
   396     with ch2 have "(Th th2, Th th2) \<in> child s" by simp
   420     with wf_child[OF vt] show ?thesis by auto
   397     with wf_child[OF vt] show ?thesis by auto
   421   next
   398   next
   471       from children_no_dep[OF vt ch2 ch1 this] show ?thesis .
   448       from children_no_dep[OF vt ch2 ch1 this] show ?thesis .
   472     qed
   449     qed
   473   } thus ?thesis by auto
   450   } thus ?thesis by auto
   474 qed
   451 qed
   475 
   452 
       
   453 lemma depend_plus_elim:
       
   454   assumes "vt s"
       
   455   fixes x
       
   456   assumes "(Th x, Th th) \<in> (depend (wq s))\<^sup>+"
       
   457   shows "\<exists>th'\<in>children s th. x = th' \<or> (Th x, Th th') \<in> (depend (wq s))\<^sup>+"
       
   458   using assms(2)[unfolded eq_depend, folded child_depend_eq[OF `vt s`]]
       
   459   apply (unfold children_def)
       
   460   by (metis assms(2) children_def depend_children eq_depend)
       
   461 
       
   462 lemma dependants_expand_pre: 
       
   463   assumes "vt s"
       
   464   shows "dependants (wq s) th = (\<Union> th' \<in> children s th. {th'} \<union> dependants (wq s) th')"
       
   465   apply (unfold cs_dependants_def)
       
   466   apply (auto elim!:depend_plus_elim[OF assms])
       
   467   apply (metis children_def eq_depend mem_Collect_eq set_mp sub_child)
       
   468   apply (unfold children_def, auto)
       
   469   apply (unfold eq_depend, fold  child_depend_eq[OF `vt s`])
       
   470   by (metis trancl.simps)
       
   471 
       
   472 lemma dependants_expand:
       
   473   assumes "vt s"
       
   474   shows "dependants (wq s) th = (\<Union> ((\<lambda> th. {th} \<union> dependants (wq s) th) ` (children s th)))"
       
   475   apply (subst dependants_expand_pre[OF assms])
       
   476   by simp
       
   477 
       
   478 lemma finite_children:
       
   479   assumes "vt s"
       
   480   shows "finite (children s th)"
       
   481   using children_dependants dependants_threads[OF assms] finite_threads[OF assms]
       
   482   by (metis rev_finite_subset)
       
   483   
       
   484 lemma finite_dependants:
       
   485   assumes "vt s"
       
   486   shows "finite (dependants (wq s) th')"
       
   487   using dependants_threads[OF assms] finite_threads[OF assms]
       
   488   by (metis rev_finite_subset)
       
   489 
       
   490 lemma Max_insert:
       
   491   assumes "finite B"
       
   492   and  "B \<noteq> {}"
       
   493   shows "Max ({x} \<union> B) = max x (Max B)"
       
   494   by (metis Max_insert assms insert_is_Un)
       
   495 
       
   496 lemma dependands_expand2:
       
   497   assumes "vt s"
       
   498   shows "dependants (wq s) th = (children s th) \<union> (\<Union>((dependants (wq s)) ` children s th))"
       
   499   by (subst dependants_expand[OF assms]) (auto)
       
   500 
       
   501 abbreviation
       
   502   "preceds s Ths \<equiv> {preced th s| th. th \<in> Ths}"
       
   503 
       
   504 lemma image_compr:
       
   505   "f ` A = {f x | x. x \<in> A}"
       
   506 by auto
       
   507 
       
   508 lemma Un_compr:
       
   509   "{f th | th. R th \<or> Q th} = ({f th | th. R th} \<union> {f th' | th'. Q th'})"
       
   510 by auto
       
   511 
       
   512 lemma in_disj:
       
   513   shows "x \<in> A \<or> (\<exists>y \<in> A. x \<in> Q y) \<longleftrightarrow> (\<exists>y \<in> A. x = y \<or> x \<in> Q y)"
       
   514 by metis
       
   515 
       
   516 lemma UN_exists:
       
   517   shows "(\<Union>x \<in> A. {f y | y. Q y x}) = ({f y | y. (\<exists>x \<in> A. Q y x)})"
       
   518 by auto
       
   519 
   476 lemma cp_rec:
   520 lemma cp_rec:
   477   fixes s th
   521   fixes s th
   478   assumes vt: "vt s"
   522   assumes vt: "vt s"
   479   shows "cp s th = Max ({preced th s} \<union> (cp s ` children s th))"
   523   shows "cp s th = Max ({preced th s} \<union> (cp s ` children s th))"
   480 proof(unfold cp_eq_cpreced_f cpreced_def)
   524 proof(cases "children s th = {}")
   481   let ?f = "(\<lambda>th. preced th s)"
   525   case True
   482   show "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th)) =
   526   show ?thesis
   483         Max ({preced th s} \<union> (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th))) ` children s th)"
   527     unfolding cp_eq_cpreced cpreced_def 
   484   proof(cases " children s th = {}")
   528     by (subst dependants_expand[OF `vt s`]) (simp add: True)
   485     case False
   529 next
   486     have "(\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th))) ` children s th = 
   530   case False
   487           {Max ((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) | th' . th' \<in> children s th}"
   531   show ?thesis (is "?LHS = ?RHS")
   488       (is "?L = ?R")
   532   proof -
   489       by auto
   533     have eq_cp: "cp s = (\<lambda>th. Max (preceds s ({th} \<union> dependants (wq s) th)))"
   490     also have "\<dots> = 
   534       by (simp add: fun_eq_iff cp_eq_cpreced cpreced_def Un_compr image_compr[symmetric])
   491       Max ` {((\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th')) | th' . th' \<in> children s th}"
   535   
   492       (is "_ = Max ` ?C")
   536     have not_emptyness_facts[simp]: 
   493       by auto
   537       "dependants (wq s) th \<noteq> {}" "children s th \<noteq> {}"
   494     finally have "Max ?L = Max (Max ` ?C)" by auto
   538       using False dependands_expand2[OF assms] by(auto simp only: Un_empty)
   495     also have "\<dots> = Max (\<Union> ?C)"
   539 
   496     proof(rule Max_Union[symmetric])
   540     have finiteness_facts[simp]:
   497       from children_dependants[of s th] finite_threads[OF vt] and dependants_threads[OF vt, of th]
   541       "\<And>th. finite (dependants (wq s) th)" "\<And>th. finite (children s th)"
   498       show "finite {(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
   542       by (simp_all add: finite_dependants[OF `vt s`] finite_children[OF `vt s`])
   499         by (auto simp:finite_subset)
   543 
   500     next
   544     (* expanding definition *)
   501       from False
   545     have "?LHS = Max ({preced th s} \<union> preceds s (dependants (wq s) th))"
   502       show "{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th} \<noteq> {}"
   546       unfolding eq_cp by (simp add: Un_compr)
   503         by simp
   547     
   504     next
   548     (* moving Max in *)
   505       show "\<And>A. A \<in> {(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th} \<Longrightarrow>
   549     also have "\<dots> = max (Max {preced th s}) (Max (preceds s (dependants (wq s) th)))"
   506         finite A \<and> A \<noteq> {}"
   550       by (simp add: Max_Un)
   507         apply (auto simp:finite_subset)
   551 
   508       proof -
   552     (* expanding dependants *)
   509         fix th'
   553     also have "\<dots> = max (Max {preced th s}) 
   510         from finite_threads[OF vt] and dependants_threads[OF vt, of th']
   554       (Max (preceds s (children s th \<union> \<Union>(dependants (wq s) ` children s th))))"
   511         show "finite ((\<lambda>th. preced th s) ` dependants (wq s) th')" by (auto simp:finite_subset)
   555       by (subst dependands_expand2[OF `vt s`]) (simp)
   512       qed
   556 
   513     qed
   557     (* moving out big Union *)
   514     also have "\<dots> = Max ((\<lambda>th. preced th s) ` dependants (wq s) th)"
   558     also have "\<dots> = max (Max {preced th s})
   515       (is "Max ?A = Max ?B")
   559       (Max (preceds s (\<Union> ({children s th} \<union> (dependants (wq s) ` children s th)))))"  
   516     proof -
   560       by simp
   517       have "?A = ?B"
   561 
   518       proof
   562     (* moving in small union *)
   519         show "\<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}
   563     also have "\<dots> = max (Max {preced th s})
   520                     \<subseteq> (\<lambda>th. preced th s) ` dependants (wq s) th"
   564       (Max (preceds s (\<Union> ((\<lambda>th. {th} \<union> (dependants (wq s) th)) ` children s th))))"  
   521         proof
   565       by (simp add: in_disj)
   522           fix x 
   566 
   523           assume "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
   567     (* moving in preceds *)
   524           then obtain th' where 
   568     also have "\<dots> = max (Max {preced th s})  
   525              th'_in: "th' \<in> children s th"
   569       (Max (\<Union> ((\<lambda>th. preceds s ({th} \<union> (dependants (wq s) th))) ` children s th)))" 
   526             and x_in: "x \<in> ?f ` ({th'} \<union> dependants (wq s) th')" by auto
   570       by (simp add: UN_exists)
   527           hence "x = ?f th' \<or> x \<in> (?f ` dependants (wq s) th')" by auto
   571 
   528           thus "x \<in> ?f ` dependants (wq s) th"
   572     (* moving in Max *)
   529           proof
   573     also have "\<dots> = max (Max {preced th s})  
   530             assume "x = preced th' s"
   574       (Max ((\<lambda>th. Max (preceds s ({th} \<union> (dependants (wq s) th)))) ` children s th))" 
   531             with th'_in and children_dependants
   575       by (subst Max_Union) (auto simp add: image_image)
   532             show "x \<in> (\<lambda>th. preced th s) ` dependants (wq s) th" by auto
   576 
   533           next
   577     (* folding cp + moving out Max *)
   534             assume "x \<in> (\<lambda>th. preced th s) ` dependants (wq s) th'"
   578     also have "\<dots> = ?RHS" 
   535             moreover note th'_in
   579       unfolding eq_cp by (simp add: Max_insert)
   536             ultimately show " x \<in> (\<lambda>th. preced th s) ` dependants (wq s) th"
   580 
   537               by (unfold cs_dependants_def children_def child_def, auto simp:eq_depend)
   581     finally show "?LHS = ?RHS" .
   538           qed
       
   539         qed
       
   540       next
       
   541         show "?f ` dependants (wq s) th
       
   542            \<subseteq> \<Union>{?f ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
       
   543         proof
       
   544           fix x 
       
   545           assume x_in: "x \<in> (\<lambda>th. preced th s) ` dependants (wq s) th"
       
   546           then obtain th' where
       
   547             eq_x: "x = ?f th'" and dp: "(Th th', Th th) \<in> (depend s)^+" 
       
   548             by (auto simp:cs_dependants_def eq_depend)
       
   549           from depend_children[OF dp]
       
   550           have "th' \<in> children s th \<or> (\<exists>th3. th3 \<in> children s th \<and> (Th th', Th th3) \<in> (depend s)\<^sup>+)" .
       
   551           thus "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
       
   552           proof
       
   553             assume "th' \<in> children s th"
       
   554             with eq_x
       
   555             show "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
       
   556               by auto
       
   557           next
       
   558             assume "\<exists>th3. th3 \<in> children s th \<and> (Th th', Th th3) \<in> (depend s)\<^sup>+"
       
   559             then obtain th3 where th3_in: "th3 \<in> children s th"
       
   560               and dp3: "(Th th', Th th3) \<in> (depend s)\<^sup>+" by auto
       
   561             show "x \<in> \<Union>{(\<lambda>th. preced th s) ` ({th'} \<union> dependants (wq s) th') |th'. th' \<in> children s th}"
       
   562             proof -
       
   563               from dp3
       
   564               have "th' \<in> dependants (wq s) th3"
       
   565                 by (auto simp:cs_dependants_def eq_depend)
       
   566               with eq_x th3_in show ?thesis by auto
       
   567             qed
       
   568           qed          
       
   569         qed
       
   570       qed
       
   571       thus ?thesis by simp
       
   572     qed
       
   573     finally have "Max ((\<lambda>th. preced th s) ` dependants (wq s) th) = Max (?L)" 
       
   574       (is "?X = ?Y") by auto
       
   575     moreover have "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th)) = 
       
   576                    max (?f th) ?X" 
       
   577     proof -
       
   578       have "Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th)) = 
       
   579             Max ({?f th} \<union> ?f ` (dependants (wq s) th))" by simp
       
   580       also have "\<dots> = max (Max {?f th}) (Max (?f ` (dependants (wq s) th)))"
       
   581       proof(rule Max_Un, auto)
       
   582         from finite_threads[OF vt] and dependants_threads[OF vt, of th]
       
   583         show "finite ((\<lambda>th. preced th s) ` dependants (wq s) th)" by (auto simp:finite_subset)
       
   584       next
       
   585         assume "dependants (wq s) th = {}"
       
   586         with False and children_dependants show False by auto
       
   587       qed
       
   588       also have "\<dots> = max (?f th) ?X" by simp
       
   589       finally show ?thesis .
       
   590     qed
       
   591     moreover have "Max ({preced th s} \<union> 
       
   592                      (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th))) ` children s th) = 
       
   593                    max (?f th) ?Y"
       
   594     proof -
       
   595       have "Max ({preced th s} \<union> 
       
   596                      (\<lambda>th. Max ((\<lambda>th. preced th s) ` ({th} \<union> dependants (wq s) th))) ` children s th) = 
       
   597             max (Max {preced th s}) ?Y"
       
   598       proof(rule Max_Un, auto)
       
   599         from finite_threads[OF vt] dependants_threads[OF vt, of th] children_dependants [of s th]
       
   600         show "finite ((\<lambda>th. Max (insert (preced th s) ((\<lambda>th. preced th s) ` dependants (wq s) th))) ` 
       
   601                        children s th)" 
       
   602           by (auto simp:finite_subset)
       
   603       next
       
   604         assume "children s th = {}"
       
   605         with False show False by auto
       
   606       qed
       
   607       thus ?thesis by simp
       
   608     qed
       
   609     ultimately show ?thesis by auto
       
   610   next
       
   611     case True
       
   612     moreover have "dependants (wq s) th = {}"
       
   613     proof -
       
   614       { fix th'
       
   615         assume "th' \<in> dependants (wq s) th"
       
   616         hence " (Th th', Th th) \<in> (depend s)\<^sup>+" by (simp add:cs_dependants_def eq_depend)
       
   617         from depend_children[OF this] and True
       
   618         have "False" by auto
       
   619       } thus ?thesis by auto
       
   620     qed
       
   621     ultimately show ?thesis by auto
       
   622   qed
   582   qed
   623 qed
   583 qed
   624 
   584 
   625 definition cps:: "state \<Rightarrow> (thread \<times> precedence) set"
   585 definition cps:: "state \<Rightarrow> (thread \<times> precedence) set"
   626 where "cps s = {(th, cp s th) | th . th \<in> threads s}"
   586 where "cps s = {(th, cp s th) | th . th \<in> threads s}"
  1934 end
  1894 end
  1935 
  1895 
  1936 
  1896 
  1937 locale step_exit_cps =
  1897 locale step_exit_cps =
  1938   fixes s' th prio s 
  1898   fixes s' th prio s 
  1939   defines s_def : "s \<equiv> (Exit th#s')"
  1899   defines s_def : "s \<equiv> Exit th # s'"
  1940   assumes vt_s: "vt s"
  1900   assumes vt_s: "vt s"
  1941 
  1901 
  1942 context step_exit_cps
  1902 context step_exit_cps
  1943 begin
  1903 begin
  1944 
  1904