diff -r 313acffe63b6 -r 92f61f6a0fe7 PrioG.thy --- a/PrioG.thy Tue May 20 12:49:21 2014 +0100 +++ b/PrioG.thy Thu May 22 17:40:39 2014 +0100 @@ -24,7 +24,7 @@ thus "distinct (wq (e # s) cs)" proof(induct rule:step.induct, auto simp: wq_def Let_def split:list.splits) fix thread s - assume h1: "(Cs cs, Th thread) \ (depend s)\<^sup>+" + assume h1: "(Cs cs, Th thread) \ (RAG s)\<^sup>+" and h2: "thread \ set (wq_fun (schs s) cs)" and h3: "thread \ runing s" show "False" @@ -34,8 +34,8 @@ by (simp add:runing_def readys_def s_waiting_def wq_def) from this [OF h2] have "thread = hd (wq_fun (schs s) cs)" . with h2 - have "(Cs cs, Th thread) \ (depend s)" - by (simp add:s_depend_def s_holding_def wq_def cs_holding_def) + have "(Cs cs, Th thread) \ (RAG s)" + by (simp add:s_RAG_def s_holding_def wq_def cs_holding_def) with h1 show False by auto qed next @@ -112,7 +112,7 @@ qed lemma p_pre: "\vt ((P thread cs)#s)\ \ - thread \ runing s \ (Cs cs, Th thread) \ (depend s)^+" + thread \ runing s \ (Cs cs, Th thread) \ (RAG s)^+" apply (ind_cases "vt ((P thread cs)#s)") apply (ind_cases "step s (P thread cs)") by auto @@ -501,16 +501,16 @@ qed qed -lemma depend_set_unchanged: "(depend (Set th prio # s)) = depend s" -apply (unfold s_depend_def s_waiting_def wq_def) +lemma RAG_set_unchanged: "(RAG (Set th prio # s)) = RAG s" +apply (unfold s_RAG_def s_waiting_def wq_def) by (simp add:Let_def) -lemma depend_create_unchanged: "(depend (Create th prio # s)) = depend s" -apply (unfold s_depend_def s_waiting_def wq_def) +lemma RAG_create_unchanged: "(RAG (Create th prio # s)) = RAG s" +apply (unfold s_RAG_def s_waiting_def wq_def) by (simp add:Let_def) -lemma depend_exit_unchanged: "(depend (Exit th # s)) = depend s" -apply (unfold s_depend_def s_waiting_def wq_def) +lemma RAG_exit_unchanged: "(RAG (Exit th # s)) = RAG s" +apply (unfold s_RAG_def s_waiting_def wq_def) by (simp add:Let_def) @@ -773,16 +773,16 @@ qed qed -lemma step_depend_v: +lemma step_RAG_v: fixes th::thread assumes vt: "vt (V th cs#s)" shows " - depend (V th cs # s) = - depend s - {(Cs cs, Th th)} - + RAG (V th cs # s) = + RAG s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \ {(Cs cs, Th th') |th'. next_th s th cs th'}" - apply (insert vt, unfold s_depend_def) + apply (insert vt, unfold s_RAG_def) apply (auto split:if_splits list.splits simp:Let_def) apply (auto elim: step_v_waiting_mono step_v_hold_inv step_v_release step_v_wait_inv @@ -790,17 +790,17 @@ apply (erule_tac step_v_not_wait, auto) done -lemma step_depend_p: +lemma step_RAG_p: "vt (P th cs#s) \ - depend (P th cs # s) = (if (wq s cs = []) then depend s \ {(Cs cs, Th th)} - else depend s \ {(Th th, Cs cs)})" - apply(simp only: s_depend_def wq_def) + RAG (P th cs # s) = (if (wq s cs = []) then RAG s \ {(Cs cs, Th th)} + else RAG s \ {(Th th, Cs cs)})" + apply(simp only: s_RAG_def wq_def) apply (auto split:list.splits prod.splits simp:Let_def wq_def cs_waiting_def cs_holding_def) apply(case_tac "csa = cs", auto) apply(fold wq_def) apply(drule_tac step_back_step) apply(ind_cases " step s (P (hd (wq s cs)) cs)") - apply(auto simp:s_depend_def wq_def cs_holding_def) + apply(auto simp:s_RAG_def wq_def cs_holding_def) done lemma simple_A: @@ -815,35 +815,35 @@ thus ?thesis by simp qed -lemma depend_target_th: "(Th th, x) \ depend (s::state) \ \ cs. x = Cs cs" - by (unfold s_depend_def, auto) +lemma RAG_target_th: "(Th th, x) \ RAG (s::state) \ \ cs. x = Cs cs" + by (unfold s_RAG_def, auto) -lemma acyclic_depend: +lemma acyclic_RAG: fixes s assumes vt: "vt s" - shows "acyclic (depend s)" + shows "acyclic (RAG s)" proof - from vt show ?thesis proof(induct) case (vt_cons s e) - assume ih: "acyclic (depend s)" + assume ih: "acyclic (RAG s)" and stp: "step s e" and vt: "vt s" show ?case proof(cases e) case (Create th prio) with ih - show ?thesis by (simp add:depend_create_unchanged) + show ?thesis by (simp add:RAG_create_unchanged) next case (Exit th) - with ih show ?thesis by (simp add:depend_exit_unchanged) + with ih show ?thesis by (simp add:RAG_exit_unchanged) next case (V th cs) from V vt stp have vtt: "vt (V th cs#s)" by auto - from step_depend_v [OF this] + from step_RAG_v [OF this] have eq_de: - "depend (e # s) = - depend s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \ + "RAG (e # s) = + RAG s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \ {(Cs cs, Th th') |th'. next_th s th cs th'}" (is "?L = (?A - ?B - ?C) \ ?D") by (simp add:V) from ih have ac: "acyclic (?A - ?B - ?C)" by (auto elim:acyclic_subset) @@ -871,11 +871,11 @@ from tranclD [OF this] obtain x where th'_e: "(Th ?th', x) \ ?E" by blast hence th_d: "(Th ?th', x) \ ?A" by simp - from depend_target_th [OF this] + from RAG_target_th [OF this] obtain cs' where eq_x: "x = Cs cs'" by auto with th_d have "(Th ?th', Cs cs') \ ?A" by simp hence wt_th': "waiting s ?th' cs'" - unfolding s_depend_def s_waiting_def cs_waiting_def wq_def by simp + unfolding s_RAG_def s_waiting_def cs_waiting_def wq_def by simp hence "cs' = cs" proof(rule waiting_unique [OF vt]) from eq_wq wq_distinct[OF vt, of cs] @@ -945,35 +945,35 @@ next case (P th cs) from P vt stp have vtt: "vt (P th cs#s)" by auto - from step_depend_p [OF this] P - have "depend (e # s) = - (if wq s cs = [] then depend s \ {(Cs cs, Th th)} else - depend s \ {(Th th, Cs cs)})" (is "?L = ?R") + from step_RAG_p [OF this] P + have "RAG (e # s) = + (if wq s cs = [] then RAG s \ {(Cs cs, Th th)} else + RAG s \ {(Th th, Cs cs)})" (is "?L = ?R") by simp moreover have "acyclic ?R" proof(cases "wq s cs = []") case True - hence eq_r: "?R = depend s \ {(Cs cs, Th th)}" by simp - have "(Th th, Cs cs) \ (depend s)\<^sup>*" + hence eq_r: "?R = RAG s \ {(Cs cs, Th th)}" by simp + have "(Th th, Cs cs) \ (RAG s)\<^sup>*" proof - assume "(Th th, Cs cs) \ (depend s)\<^sup>*" - hence "(Th th, Cs cs) \ (depend s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) + assume "(Th th, Cs cs) \ (RAG s)\<^sup>*" + hence "(Th th, Cs cs) \ (RAG s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) from tranclD2 [OF this] - obtain x where "(x, Cs cs) \ depend s" by auto - with True show False by (auto simp:s_depend_def cs_waiting_def) + obtain x where "(x, Cs cs) \ RAG s" by auto + with True show False by (auto simp:s_RAG_def cs_waiting_def) qed with acyclic_insert ih eq_r show ?thesis by auto next case False - hence eq_r: "?R = depend s \ {(Th th, Cs cs)}" by simp - have "(Cs cs, Th th) \ (depend s)\<^sup>*" + hence eq_r: "?R = RAG s \ {(Th th, Cs cs)}" by simp + have "(Cs cs, Th th) \ (RAG s)\<^sup>*" proof - assume "(Cs cs, Th th) \ (depend s)\<^sup>*" - hence "(Cs cs, Th th) \ (depend s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) + assume "(Cs cs, Th th) \ (RAG s)\<^sup>*" + hence "(Cs cs, Th th) \ (RAG s)\<^sup>+" by (simp add: rtrancl_eq_or_trancl) moreover from step_back_step [OF vtt] have "step s (P th cs)" . ultimately show False proof - - show " \(Cs cs, Th th) \ (depend s)\<^sup>+; step s (P th cs)\ \ False" + show " \(Cs cs, Th th) \ (RAG s)\<^sup>+; step s (P th cs)\ \ False" by (ind_cases "step s (P th cs)", simp) qed qed @@ -983,42 +983,42 @@ next case (Set thread prio) with ih - thm depend_set_unchanged - show ?thesis by (simp add:depend_set_unchanged) + thm RAG_set_unchanged + show ?thesis by (simp add:RAG_set_unchanged) qed next case vt_nil - show "acyclic (depend ([]::state))" - by (auto simp: s_depend_def cs_waiting_def + show "acyclic (RAG ([]::state))" + by (auto simp: s_RAG_def cs_waiting_def cs_holding_def wq_def acyclic_def) qed qed -lemma finite_depend: +lemma finite_RAG: fixes s assumes vt: "vt s" - shows "finite (depend s)" + shows "finite (RAG s)" proof - from vt show ?thesis proof(induct) case (vt_cons s e) - assume ih: "finite (depend s)" + assume ih: "finite (RAG s)" and stp: "step s e" and vt: "vt s" show ?case proof(cases e) case (Create th prio) with ih - show ?thesis by (simp add:depend_create_unchanged) + show ?thesis by (simp add:RAG_create_unchanged) next case (Exit th) - with ih show ?thesis by (simp add:depend_exit_unchanged) + with ih show ?thesis by (simp add:RAG_exit_unchanged) next case (V th cs) from V vt stp have vtt: "vt (V th cs#s)" by auto - from step_depend_v [OF this] - have eq_de: "depend (e # s) = - depend s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \ + from step_RAG_v [OF this] + have eq_de: "RAG (e # s) = + RAG s - {(Cs cs, Th th)} - {(Th th', Cs cs) |th'. next_th s th cs th'} \ {(Cs cs, Th th') |th'. next_th s th cs th'} " (is "?L = (?A - ?B - ?C) \ ?D") by (simp add:V) @@ -1041,31 +1041,31 @@ next case (P th cs) from P vt stp have vtt: "vt (P th cs#s)" by auto - from step_depend_p [OF this] P - have "depend (e # s) = - (if wq s cs = [] then depend s \ {(Cs cs, Th th)} else - depend s \ {(Th th, Cs cs)})" (is "?L = ?R") + from step_RAG_p [OF this] P + have "RAG (e # s) = + (if wq s cs = [] then RAG s \ {(Cs cs, Th th)} else + RAG s \ {(Th th, Cs cs)})" (is "?L = ?R") by simp moreover have "finite ?R" proof(cases "wq s cs = []") case True - hence eq_r: "?R = depend s \ {(Cs cs, Th th)}" by simp + hence eq_r: "?R = RAG s \ {(Cs cs, Th th)}" by simp with True and ih show ?thesis by auto next case False - hence "?R = depend s \ {(Th th, Cs cs)}" by simp + hence "?R = RAG s \ {(Th th, Cs cs)}" by simp with False and ih show ?thesis by auto qed ultimately show ?thesis by auto next case (Set thread prio) with ih - show ?thesis by (simp add:depend_set_unchanged) + show ?thesis by (simp add:RAG_set_unchanged) qed next case vt_nil - show "finite (depend ([]::state))" - by (auto simp: s_depend_def cs_waiting_def + show "finite (RAG ([]::state))" + by (auto simp: s_RAG_def cs_waiting_def cs_holding_def wq_def acyclic_def) qed qed @@ -1075,20 +1075,20 @@ lemma wf_dep_converse: fixes s assumes vt: "vt s" - shows "wf ((depend s)^-1)" + shows "wf ((RAG s)^-1)" proof(rule finite_acyclic_wf_converse) - from finite_depend [OF vt] - show "finite (depend s)" . + from finite_RAG [OF vt] + show "finite (RAG s)" . next - from acyclic_depend[OF vt] - show "acyclic (depend s)" . + from acyclic_RAG[OF vt] + show "acyclic (RAG s)" . qed lemma hd_np_in: "x \ set l \ hd l \ set l" by (induct l, auto) -lemma th_chasing: "(Th th, Cs cs) \ depend (s::state) \ \ th'. (Cs cs, Th th') \ depend s" - by (auto simp:s_depend_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) +lemma th_chasing: "(Th th, Cs cs) \ RAG (s::state) \ \ th'. (Cs cs, Th th') \ RAG s" + by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) lemma wq_threads: fixes s cs @@ -1114,7 +1114,7 @@ apply (auto simp:wq_def Let_def) apply (ind_cases "step s (Exit th')") apply (auto simp:runing_def readys_def s_holding_def s_waiting_def holdents_def - s_depend_def s_holding_def cs_holding_def) + s_RAG_def s_holding_def cs_holding_def) done next case (V th' cs') @@ -1192,8 +1192,8 @@ qed qed -lemma range_in: "\vt s; (Th th) \ Range (depend (s::state))\ \ th \ threads s" - apply(unfold s_depend_def cs_waiting_def cs_holding_def) +lemma range_in: "\vt s; (Th th) \ Range (RAG (s::state))\ \ th \ threads s" + apply(unfold s_RAG_def cs_waiting_def cs_holding_def) by (auto intro:wq_threads) lemma readys_v_eq: @@ -1231,33 +1231,33 @@ lemma chain_building: assumes vt: "vt s" - shows "node \ Domain (depend s) \ (\ th'. th' \ readys s \ (node, Th th') \ (depend s)^+)" + shows "node \ Domain (RAG s) \ (\ th'. th' \ readys s \ (node, Th th') \ (RAG s)^+)" proof - from wf_dep_converse [OF vt] - have h: "wf ((depend s)\)" . + have h: "wf ((RAG s)\)" . show ?thesis proof(induct rule:wf_induct [OF h]) fix x assume ih [rule_format]: - "\y. (y, x) \ (depend s)\ \ - y \ Domain (depend s) \ (\th'. th' \ readys s \ (y, Th th') \ (depend s)\<^sup>+)" - show "x \ Domain (depend s) \ (\th'. th' \ readys s \ (x, Th th') \ (depend s)\<^sup>+)" + "\y. (y, x) \ (RAG s)\ \ + y \ Domain (RAG s) \ (\th'. th' \ readys s \ (y, Th th') \ (RAG s)\<^sup>+)" + show "x \ Domain (RAG s) \ (\th'. th' \ readys s \ (x, Th th') \ (RAG s)\<^sup>+)" proof - assume x_d: "x \ Domain (depend s)" - show "\th'. th' \ readys s \ (x, Th th') \ (depend s)\<^sup>+" + assume x_d: "x \ Domain (RAG s)" + show "\th'. th' \ readys s \ (x, Th th') \ (RAG s)\<^sup>+" proof(cases x) case (Th th) - from x_d Th obtain cs where x_in: "(Th th, Cs cs) \ depend s" by (auto simp:s_depend_def) - with Th have x_in_r: "(Cs cs, x) \ (depend s)^-1" by simp - from th_chasing [OF x_in] obtain th' where "(Cs cs, Th th') \ depend s" by blast - hence "Cs cs \ Domain (depend s)" by auto + from x_d Th obtain cs where x_in: "(Th th, Cs cs) \ RAG s" by (auto simp:s_RAG_def) + with Th have x_in_r: "(Cs cs, x) \ (RAG s)^-1" by simp + from th_chasing [OF x_in] obtain th' where "(Cs cs, Th th') \ RAG s" by blast + hence "Cs cs \ Domain (RAG s)" by auto from ih [OF x_in_r this] obtain th' - where th'_ready: " th' \ readys s" and cs_in: "(Cs cs, Th th') \ (depend s)\<^sup>+" by auto - have "(x, Th th') \ (depend s)\<^sup>+" using Th x_in cs_in by auto + where th'_ready: " th' \ readys s" and cs_in: "(Cs cs, Th th') \ (RAG s)\<^sup>+" by auto + have "(x, Th th') \ (RAG s)\<^sup>+" using Th x_in cs_in by auto with th'_ready show ?thesis by auto next case (Cs cs) - from x_d Cs obtain th' where th'_d: "(Th th', x) \ (depend s)^-1" by (auto simp:s_depend_def) + from x_d Cs obtain th' where th'_d: "(Th th', x) \ (RAG s)^-1" by (auto simp:s_RAG_def) show ?thesis proof(cases "th' \ readys s") case True @@ -1265,14 +1265,14 @@ next case False from th'_d and range_in [OF vt] have "th' \ threads s" by auto - with False have "Th th' \ Domain (depend s)" - by (auto simp:readys_def wq_def s_waiting_def s_depend_def cs_waiting_def Domain_def) + with False have "Th th' \ Domain (RAG s)" + by (auto simp:readys_def wq_def s_waiting_def s_RAG_def cs_waiting_def Domain_def) from ih [OF th'_d this] obtain th'' where th''_r: "th'' \ readys s" and - th''_in: "(Th th', Th th'') \ (depend s)\<^sup>+" by auto + th''_in: "(Th th', Th th'') \ (RAG s)\<^sup>+" by auto from th'_d and th''_in - have "(x, Th th'') \ (depend s)\<^sup>+" by auto + have "(x, Th th'') \ (RAG s)\<^sup>+" by auto with th''_r show ?thesis by auto qed qed @@ -1284,14 +1284,14 @@ fixes s th assumes vt: "vt s" and th_in: "th \ threads s" - shows "th \ readys s \ (\ th'. th' \ readys s \ (Th th, Th th') \ (depend s)^+)" + shows "th \ readys s \ (\ th'. th' \ readys s \ (Th th, Th th') \ (RAG s)^+)" proof(cases "th \ readys s") case True thus ?thesis by auto next case False - from False and th_in have "Th th \ Domain (depend s)" - by (auto simp:readys_def s_waiting_def s_depend_def wq_def cs_waiting_def Domain_def) + from False and th_in have "Th th \ Domain (RAG s)" + by (auto simp:readys_def s_waiting_def s_RAG_def wq_def cs_waiting_def Domain_def) from chain_building [rule_format, OF vt this] show ?thesis by auto qed @@ -1305,8 +1305,8 @@ lemma holding_unique: "\holding (s::state) th1 cs; holding s th2 cs\ \ th1 = th2" by (unfold s_holding_def cs_holding_def, auto) -lemma unique_depend: "\vt s; (n, n1) \ depend s; (n, n2) \ depend s\ \ n1 = n2" - apply(unfold s_depend_def, auto, fold waiting_eq holding_eq) +lemma unique_RAG: "\vt s; (n, n1) \ RAG s; (n, n2) \ RAG s\ \ n1 = n2" + apply(unfold s_RAG_def, auto, fold waiting_eq holding_eq) by(auto elim:waiting_unique holding_unique) lemma trancl_split: "(a, b) \ r^+ \ \ c. (a, c) \ r" @@ -1314,34 +1314,34 @@ lemma dchain_unique: assumes vt: "vt s" - and th1_d: "(n, Th th1) \ (depend s)^+" + and th1_d: "(n, Th th1) \ (RAG s)^+" and th1_r: "th1 \ readys s" - and th2_d: "(n, Th th2) \ (depend s)^+" + and th2_d: "(n, Th th2) \ (RAG s)^+" and th2_r: "th2 \ readys s" shows "th1 = th2" proof - { assume neq: "th1 \ th2" hence "Th th1 \ Th th2" by simp - from unique_chain [OF _ th1_d th2_d this] and unique_depend [OF vt] - have "(Th th1, Th th2) \ (depend s)\<^sup>+ \ (Th th2, Th th1) \ (depend s)\<^sup>+" by auto + from unique_chain [OF _ th1_d th2_d this] and unique_RAG [OF vt] + have "(Th th1, Th th2) \ (RAG s)\<^sup>+ \ (Th th2, Th th1) \ (RAG s)\<^sup>+" by auto hence "False" proof - assume "(Th th1, Th th2) \ (depend s)\<^sup>+" + assume "(Th th1, Th th2) \ (RAG s)\<^sup>+" from trancl_split [OF this] - obtain n where dd: "(Th th1, n) \ depend s" by auto + obtain n where dd: "(Th th1, n) \ RAG s" by auto then obtain cs where eq_n: "n = Cs cs" - by (auto simp:s_depend_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) + by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) from dd eq_n have "th1 \ readys s" - by (auto simp:readys_def s_depend_def wq_def s_waiting_def cs_waiting_def) + by (auto simp:readys_def s_RAG_def wq_def s_waiting_def cs_waiting_def) with th1_r show ?thesis by auto next - assume "(Th th2, Th th1) \ (depend s)\<^sup>+" + assume "(Th th2, Th th1) \ (RAG s)\<^sup>+" from trancl_split [OF this] - obtain n where dd: "(Th th2, n) \ depend s" by auto + obtain n where dd: "(Th th2, n) \ RAG s" by auto then obtain cs where eq_n: "n = Cs cs" - by (auto simp:s_depend_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) + by (auto simp:s_RAG_def s_holding_def cs_holding_def cs_waiting_def wq_def dest:hd_np_in) from dd eq_n have "th2 \ readys s" - by (auto simp:readys_def wq_def s_depend_def s_waiting_def cs_waiting_def) + by (auto simp:readys_def wq_def s_RAG_def s_waiting_def cs_waiting_def) with th2_r show ?thesis by auto qed } thus ?thesis by auto @@ -1355,7 +1355,7 @@ shows "holdents (P th cs#s) th = holdents s th \ {cs}" proof - from assms show ?thesis - unfolding holdents_test step_depend_p[OF vt] by (auto) + unfolding holdents_test step_RAG_p[OF vt] by (auto) qed lemma step_holdents_p_eq: @@ -1365,7 +1365,7 @@ shows "holdents (P th cs#s) th = holdents s th" proof - from assms show ?thesis - unfolding holdents_test step_depend_p[OF vt] by auto + unfolding holdents_test step_RAG_p[OF vt] by auto qed @@ -1375,16 +1375,16 @@ shows "finite (holdents s th)" proof - let ?F = "\ (x, y). the_cs x" - from finite_depend [OF vt] - have "finite (depend s)" . - hence "finite (?F `(depend s))" by simp - moreover have "{cs . (Cs cs, Th th) \ depend s} \ \" + from finite_RAG [OF vt] + have "finite (RAG s)" . + hence "finite (?F `(RAG s))" by simp + moreover have "{cs . (Cs cs, Th th) \ RAG s} \ \" proof - { have h: "\ a A f. a \ A \ f a \ f ` A" by auto - fix x assume "(Cs x, Th th) \ depend s" - hence "?F (Cs x, Th th) \ ?F `(depend s)" by (rule h) + fix x assume "(Cs x, Th th) \ RAG s" + hence "?F (Cs x, Th th) \ ?F `(RAG s)" by (rule h) moreover have "?F (Cs x, Th th) = x" by simp - ultimately have "x \ (\(x, y). the_cs x) ` depend s" by simp + ultimately have "x \ (\(x, y). the_cs x) ` RAG s" by simp } thus ?thesis by auto qed ultimately show ?thesis by (unfold holdents_test, auto intro:finite_subset) @@ -1397,12 +1397,12 @@ proof - from step_back_step[OF vtv] have cs_in: "cs \ holdents s thread" - apply (cases, unfold holdents_test s_depend_def, simp) + apply (cases, unfold holdents_test s_RAG_def, simp) by (unfold cs_holding_def s_holding_def wq_def, auto) moreover have cs_not_in: "(holdents (V thread cs#s) thread) = holdents s thread - {cs}" apply (insert wq_distinct[OF step_back_vt[OF vtv], of cs]) - apply (unfold holdents_test, unfold step_depend_v[OF vtv], + apply (unfold holdents_test, unfold step_RAG_v[OF vtv], auto simp:next_th_def) proof - fix rest @@ -1425,7 +1425,7 @@ show "x \ []" by auto qed ultimately - show "(Cs cs, Th (hd (SOME q. distinct q \ set q = set rest))) \ depend s" + show "(Cs cs, Th (hd (SOME q. distinct q \ set q = set rest))) \ RAG s" by auto next fix rest @@ -1494,7 +1494,7 @@ from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) have eq_cncs: "cntCS (e#s) th = cntCS s th" unfolding cntCS_def holdents_test - by (simp add:depend_create_unchanged eq_e) + by (simp add:RAG_create_unchanged eq_e) { assume "th \ thread" with eq_readys eq_e have "(th \ readys (e # s) \ th \ threads (e # s)) = @@ -1519,7 +1519,7 @@ from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) have eq_cncs: "cntCS (e#s) th = cntCS s th" unfolding cntCS_def holdents_test - by (simp add:depend_exit_unchanged eq_e) + by (simp add:RAG_exit_unchanged eq_e) { assume "th \ thread" with eq_e have "(th \ readys (e # s) \ th \ threads (e # s)) = @@ -1544,7 +1544,7 @@ case (thread_P thread cs) assume eq_e: "e = P thread cs" and is_runing: "thread \ runing s" - and no_dep: "(Cs cs, Th thread) \ (depend s)\<^sup>+" + and no_dep: "(Cs cs, Th thread) \ (RAG s)\<^sup>+" from thread_P vt stp ih have vtp: "vt (P thread cs#s)" by auto show ?thesis proof - @@ -1561,7 +1561,7 @@ by (case_tac "(wq_fun (schs s) cs)", auto) moreover from neq_th eq_e have "cntCS (e # s) th = cntCS s th" apply (simp add:cntCS_def holdents_test) - by (unfold step_depend_p [OF vtp], auto) + by (unfold step_RAG_p [OF vtp], auto) moreover from eq_e neq_th have "cntP (e # s) th = cntP s th" by (simp add:cntP_def count_def) moreover from eq_e neq_th have "cntV (e#s) th = cntV s th" @@ -1582,26 +1582,26 @@ case True with is_runing have "th \ readys (e#s)" - apply (unfold eq_e wq_def, unfold readys_def s_depend_def) + apply (unfold eq_e wq_def, unfold readys_def s_RAG_def) apply (simp add: wq_def[symmetric] runing_def eq_th s_waiting_def) by (auto simp:readys_def wq_def Let_def s_waiting_def wq_def) moreover have "cntCS (e # s) th = 1 + cntCS s th" proof - - have "card {csa. csa = cs \ (Cs csa, Th thread) \ depend s} = - Suc (card {cs. (Cs cs, Th thread) \ depend s})" (is "card ?L = Suc (card ?R)") + have "card {csa. csa = cs \ (Cs csa, Th thread) \ RAG s} = + Suc (card {cs. (Cs cs, Th thread) \ RAG s})" (is "card ?L = Suc (card ?R)") proof - have "?L = insert cs ?R" by auto moreover have "card \ = Suc (card (?R - {cs}))" proof(rule card_insert) from finite_holding [OF vt, of thread] - show " finite {cs. (Cs cs, Th thread) \ depend s}" + show " finite {cs. (Cs cs, Th thread) \ RAG s}" by (unfold holdents_test, simp) qed moreover have "?R - {cs} = ?R" proof - have "cs \ ?R" proof - assume "cs \ {cs. (Cs cs, Th thread) \ depend s}" + assume "cs \ {cs. (Cs cs, Th thread) \ RAG s}" with no_dep show False by auto qed thus ?thesis by auto @@ -1611,7 +1611,7 @@ thus ?thesis apply (unfold eq_e eq_th cntCS_def) apply (simp add: holdents_test) - by (unfold step_depend_p [OF vtp], auto simp:True) + by (unfold step_RAG_p [OF vtp], auto simp:True) qed moreover from is_runing have "th \ readys s" by (simp add:runing_def eq_th) @@ -1638,7 +1638,7 @@ moreover from is_runing have "th \ threads (e#s)" by (unfold eq_e, auto simp:runing_def readys_def eq_th) moreover have "cntCS (e # s) th = cntCS s th" - apply (unfold cntCS_def holdents_test eq_e step_depend_p[OF vtp]) + apply (unfold cntCS_def holdents_test eq_e step_RAG_p[OF vtp]) by (auto simp:False) moreover note eq_cnp eq_cnv ih[of th] moreover from is_runing have "th \ readys s" @@ -1735,13 +1735,13 @@ apply (insert step_back_vt[OF vtv]) by (unfold eq_e, rule readys_v_eq [OF _ neq_th eq_wq False], auto) moreover have "cntCS (e#s) th = cntCS s th" - apply (insert neq_th, unfold eq_e cntCS_def holdents_test step_depend_v[OF vtv], auto) + apply (insert neq_th, unfold eq_e cntCS_def holdents_test step_RAG_v[OF vtv], auto) proof - - have "{csa. (Cs csa, Th th) \ depend s \ csa = cs \ next_th s thread cs th} = - {cs. (Cs cs, Th th) \ depend s}" + have "{csa. (Cs csa, Th th) \ RAG s \ csa = cs \ next_th s thread cs th} = + {cs. (Cs cs, Th th) \ RAG s}" proof - from False eq_wq - have " next_th s thread cs th \ (Cs cs, Th th) \ depend s" + have " next_th s thread cs th \ (Cs cs, Th th) \ RAG s" apply (unfold next_th_def, auto) proof - assume ne: "rest \ []" @@ -1759,13 +1759,13 @@ with ne show "x \ []" by auto qed ultimately show - "(Cs cs, Th (hd (SOME q. distinct q \ set q = set rest))) \ depend s" + "(Cs cs, Th (hd (SOME q. distinct q \ set q = set rest))) \ RAG s" by auto qed thus ?thesis by auto qed - thus "card {csa. (Cs csa, Th th) \ depend s \ csa = cs \ next_th s thread cs th} = - card {cs. (Cs cs, Th th) \ depend s}" by simp + thus "card {csa. (Cs csa, Th th) \ RAG s \ csa = cs \ next_th s thread cs th} = + card {cs. (Cs cs, Th th) \ RAG s}" by simp qed moreover note ih eq_cnp eq_cnv eq_threads ultimately show ?thesis by auto @@ -1796,8 +1796,8 @@ proof - from eq_wq and th_in and neq_hd have "(holdents (e # s) th) = (holdents s th)" - apply (unfold eq_e step_depend_v[OF vtv], - auto simp:next_th_def eq_set s_depend_def holdents_test wq_def + apply (unfold eq_e step_RAG_v[OF vtv], + auto simp:next_th_def eq_set s_RAG_def holdents_test wq_def Let_def cs_holding_def) by (insert wq_distinct[OF step_back_vt[OF vtv], of cs], auto simp:wq_def) thus ?thesis by (simp add:cntCS_def) @@ -1862,28 +1862,28 @@ ultimately show ?thesis using ih by auto qed moreover from True neq_th have "cntCS (e # s) th = 1 + cntCS s th" - apply (unfold cntCS_def holdents_test eq_e step_depend_v[OF vtv], auto) + apply (unfold cntCS_def holdents_test eq_e step_RAG_v[OF vtv], auto) proof - - show "card {csa. (Cs csa, Th th) \ depend s \ csa = cs} = - Suc (card {cs. (Cs cs, Th th) \ depend s})" + show "card {csa. (Cs csa, Th th) \ RAG s \ csa = cs} = + Suc (card {cs. (Cs cs, Th th) \ RAG s})" (is "card ?A = Suc (card ?B)") proof - have "?A = insert cs ?B" by auto hence "card ?A = card (insert cs ?B)" by simp also have "\ = Suc (card ?B)" proof(rule card_insert_disjoint) - have "?B \ ((\ (x, y). the_cs x) ` depend s)" + have "?B \ ((\ (x, y). the_cs x) ` RAG s)" apply (auto simp:image_def) by (rule_tac x = "(Cs x, Th th)" in bexI, auto) - with finite_depend[OF step_back_vt[OF vtv]] - show "finite {cs. (Cs cs, Th th) \ depend s}" by (auto intro:finite_subset) + with finite_RAG[OF step_back_vt[OF vtv]] + show "finite {cs. (Cs cs, Th th) \ RAG s}" by (auto intro:finite_subset) next - show "cs \ {cs. (Cs cs, Th th) \ depend s}" + show "cs \ {cs. (Cs cs, Th th) \ RAG s}" proof - assume "cs \ {cs. (Cs cs, Th th) \ depend s}" - hence "(Cs cs, Th th) \ depend s" by simp + assume "cs \ {cs. (Cs cs, Th th) \ RAG s}" + hence "(Cs cs, Th th) \ RAG s" by simp with True neq_th eq_wq show False - by (auto simp:next_th_def s_depend_def cs_holding_def) + by (auto simp:next_th_def s_RAG_def cs_holding_def) qed qed finally show ?thesis . @@ -1905,7 +1905,7 @@ from eq_e have eq_cnv: "cntV (e#s) th = cntV s th" by (simp add:cntV_def count_def) have eq_cncs: "cntCS (e#s) th = cntCS s th" unfolding cntCS_def holdents_test - by (simp add:depend_set_unchanged eq_e) + by (simp add:RAG_set_unchanged eq_e) from eq_e have eq_readys: "readys (e#s) = readys s" by (simp add:readys_def cs_waiting_def s_waiting_def wq_def, auto simp:Let_def) @@ -1931,7 +1931,7 @@ case vt_nil show ?case by (unfold cntP_def cntV_def cntCS_def, - auto simp:count_def holdents_test s_depend_def wq_def cs_holding_def) + auto simp:count_def holdents_test s_RAG_def wq_def cs_holding_def) qed qed @@ -1955,7 +1955,7 @@ and not_in': "thread \ threads s" have "cntCS (e # s) th = cntCS s th" apply (unfold eq_e cntCS_def holdents_test) - by (simp add:depend_create_unchanged) + by (simp add:RAG_create_unchanged) moreover have "th \ threads s" proof - from not_in eq_e show ?thesis by simp @@ -1967,7 +1967,7 @@ and nh: "holdents s thread = {}" have eq_cns: "cntCS (e # s) th = cntCS s th" apply (unfold eq_e cntCS_def holdents_test) - by (simp add:depend_exit_unchanged) + by (simp add:RAG_exit_unchanged) show ?thesis proof(cases "th = thread") case True @@ -1993,7 +1993,7 @@ qed hence "cntCS (e # s) th = cntCS s th " apply (unfold cntCS_def holdents_test eq_e) - by (unfold step_depend_p[OF vtp], auto) + by (unfold step_RAG_p[OF vtp], auto) moreover have "cntCS s th = 0" proof(rule ih) from not_in eq_e show "th \ threads s" by simp @@ -2035,7 +2035,7 @@ qed moreover note neq_th eq_wq ultimately have "cntCS (e # s) th = cntCS s th" - by (unfold eq_e cntCS_def holdents_test step_depend_v[OF vtv], auto) + by (unfold eq_e cntCS_def holdents_test step_RAG_v[OF vtv], auto) moreover have "cntCS s th = 0" proof(rule ih) from not_in eq_e show "th \ threads s" by simp @@ -2050,30 +2050,30 @@ from ih [OF this] and eq_e show ?thesis apply (unfold eq_e cntCS_def holdents_test) - by (simp add:depend_set_unchanged) + by (simp add:RAG_set_unchanged) qed next case vt_nil show ?case by (unfold cntCS_def, - auto simp:count_def holdents_test s_depend_def wq_def cs_holding_def) + auto simp:count_def holdents_test s_RAG_def wq_def cs_holding_def) qed qed lemma eq_waiting: "waiting (wq (s::state)) th cs = waiting s th cs" by (auto simp:s_waiting_def cs_waiting_def wq_def) -lemma dm_depend_threads: +lemma dm_RAG_threads: fixes th s assumes vt: "vt s" - and in_dom: "(Th th) \ Domain (depend s)" + and in_dom: "(Th th) \ Domain (RAG s)" shows "th \ threads s" proof - - from in_dom obtain n where "(Th th, n) \ depend s" by auto - moreover from depend_target_th[OF this] obtain cs where "n = Cs cs" by auto - ultimately have "(Th th, Cs cs) \ depend s" by simp + from in_dom obtain n where "(Th th, n) \ RAG s" by auto + moreover from RAG_target_th[OF this] obtain cs where "n = Cs cs" by auto + ultimately have "(Th th, Cs cs) \ RAG s" by simp hence "th \ set (wq s cs)" - by (unfold s_depend_def, auto simp:cs_waiting_def) + by (unfold s_RAG_def, auto simp:cs_waiting_def) from wq_threads [OF vt this] show ?thesis . qed @@ -2112,18 +2112,18 @@ proof - have "finite (dependants (wq s) th1)" proof- - have "finite {th'. (Th th', Th th1) \ (depend (wq s))\<^sup>+}" + have "finite {th'. (Th th', Th th1) \ (RAG (wq s))\<^sup>+}" proof - let ?F = "\ (x, y). the_th x" - have "{th'. (Th th', Th th1) \ (depend (wq s))\<^sup>+} \ ?F ` ((depend (wq s))\<^sup>+)" + have "{th'. (Th th', Th th1) \ (RAG (wq s))\<^sup>+} \ ?F ` ((RAG (wq s))\<^sup>+)" apply (auto simp:image_def) by (rule_tac x = "(Th x, Th th1)" in bexI, auto) moreover have "finite \" proof - - from finite_depend[OF vt] have "finite (depend s)" . - hence "finite ((depend (wq s))\<^sup>+)" + from finite_RAG[OF vt] have "finite (RAG s)" . + hence "finite ((RAG (wq s))\<^sup>+)" apply (unfold finite_trancl) - by (auto simp: s_depend_def cs_depend_def wq_def) + by (auto simp: s_RAG_def cs_RAG_def wq_def) thus ?thesis by auto qed ultimately show ?thesis by (auto intro:finite_subset) @@ -2151,18 +2151,18 @@ proof - have "finite (dependants (wq s) th2)" proof- - have "finite {th'. (Th th', Th th2) \ (depend (wq s))\<^sup>+}" + have "finite {th'. (Th th', Th th2) \ (RAG (wq s))\<^sup>+}" proof - let ?F = "\ (x, y). the_th x" - have "{th'. (Th th', Th th2) \ (depend (wq s))\<^sup>+} \ ?F ` ((depend (wq s))\<^sup>+)" + have "{th'. (Th th', Th th2) \ (RAG (wq s))\<^sup>+} \ ?F ` ((RAG (wq s))\<^sup>+)" apply (auto simp:image_def) by (rule_tac x = "(Th x, Th th2)" in bexI, auto) moreover have "finite \" proof - - from finite_depend[OF vt] have "finite (depend s)" . - hence "finite ((depend (wq s))\<^sup>+)" + from finite_RAG[OF vt] have "finite (RAG s)" . + hence "finite ((RAG (wq s))\<^sup>+)" apply (unfold finite_trancl) - by (auto simp: s_depend_def cs_depend_def wq_def) + by (auto simp: s_RAG_def cs_RAG_def wq_def) thus ?thesis by auto qed ultimately show ?thesis by (auto intro:finite_subset) @@ -2190,11 +2190,11 @@ thus "th1' \ threads s" proof assume "th1' \ dependants (wq s) th1" - hence "(Th th1') \ Domain ((depend s)^+)" - apply (unfold cs_dependants_def cs_depend_def s_depend_def) + hence "(Th th1') \ Domain ((RAG s)^+)" + apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) by (auto simp:Domain_def) - hence "(Th th1') \ Domain (depend s)" by (simp add:trancl_domain) - from dm_depend_threads[OF vt this] show ?thesis . + hence "(Th th1') \ Domain (RAG s)" by (simp add:trancl_domain) + from dm_RAG_threads[OF vt this] show ?thesis . next assume "th1' = th1" with runing_1 show ?thesis @@ -2205,11 +2205,11 @@ thus "th2' \ threads s" proof assume "th2' \ dependants (wq s) th2" - hence "(Th th2') \ Domain ((depend s)^+)" - apply (unfold cs_dependants_def cs_depend_def s_depend_def) + hence "(Th th2') \ Domain ((RAG s)^+)" + apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) by (auto simp:Domain_def) - hence "(Th th2') \ Domain (depend s)" by (simp add:trancl_domain) - from dm_depend_threads[OF vt this] show ?thesis . + hence "(Th th2') \ Domain (RAG s)" by (simp add:trancl_domain) + from dm_RAG_threads[OF vt this] show ?thesis . next assume "th2' = th2" with runing_2 show ?thesis @@ -2227,18 +2227,18 @@ next assume "th2' \ dependants (wq s) th2" with eq_th12 eq_th' have "th1 \ dependants (wq s) th2" by simp - hence "(Th th1, Th th2) \ (depend s)^+" - by (unfold cs_dependants_def s_depend_def cs_depend_def, simp) - hence "Th th1 \ Domain ((depend s)^+)" - apply (unfold cs_dependants_def cs_depend_def s_depend_def) + hence "(Th th1, Th th2) \ (RAG s)^+" + by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) + hence "Th th1 \ Domain ((RAG s)^+)" + apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) by (auto simp:Domain_def) - hence "Th th1 \ Domain (depend s)" by (simp add:trancl_domain) - then obtain n where d: "(Th th1, n) \ depend s" by (auto simp:Domain_def) - from depend_target_th [OF this] + hence "Th th1 \ Domain (RAG s)" by (simp add:trancl_domain) + then obtain n where d: "(Th th1, n) \ RAG s" by (auto simp:Domain_def) + from RAG_target_th [OF this] obtain cs' where "n = Cs cs'" by auto - with d have "(Th th1, Cs cs') \ depend s" by simp + with d have "(Th th1, Cs cs') \ RAG s" by simp with runing_1 have "False" - apply (unfold runing_def readys_def s_depend_def) + apply (unfold runing_def readys_def s_RAG_def) by (auto simp:eq_waiting) thus ?thesis by simp qed @@ -2249,27 +2249,27 @@ proof assume "th2' = th2" with th1'_in eq_th12 have "th2 \ dependants (wq s) th1" by simp - hence "(Th th2, Th th1) \ (depend s)^+" - by (unfold cs_dependants_def s_depend_def cs_depend_def, simp) - hence "Th th2 \ Domain ((depend s)^+)" - apply (unfold cs_dependants_def cs_depend_def s_depend_def) + hence "(Th th2, Th th1) \ (RAG s)^+" + by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) + hence "Th th2 \ Domain ((RAG s)^+)" + apply (unfold cs_dependants_def cs_RAG_def s_RAG_def) by (auto simp:Domain_def) - hence "Th th2 \ Domain (depend s)" by (simp add:trancl_domain) - then obtain n where d: "(Th th2, n) \ depend s" by (auto simp:Domain_def) - from depend_target_th [OF this] + hence "Th th2 \ Domain (RAG s)" by (simp add:trancl_domain) + then obtain n where d: "(Th th2, n) \ RAG s" by (auto simp:Domain_def) + from RAG_target_th [OF this] obtain cs' where "n = Cs cs'" by auto - with d have "(Th th2, Cs cs') \ depend s" by simp + with d have "(Th th2, Cs cs') \ RAG s" by simp with runing_2 have "False" - apply (unfold runing_def readys_def s_depend_def) + apply (unfold runing_def readys_def s_RAG_def) by (auto simp:eq_waiting) thus ?thesis by simp next assume "th2' \ dependants (wq s) th2" with eq_th12 have "th1' \ dependants (wq s) th2" by simp - hence h1: "(Th th1', Th th2) \ (depend s)^+" - by (unfold cs_dependants_def s_depend_def cs_depend_def, simp) - from th1'_in have h2: "(Th th1', Th th1) \ (depend s)^+" - by (unfold cs_dependants_def s_depend_def cs_depend_def, simp) + hence h1: "(Th th1', Th th2) \ (RAG s)^+" + by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) + from th1'_in have h2: "(Th th1', Th th1) \ (RAG s)^+" + by (unfold cs_dependants_def s_RAG_def cs_RAG_def, simp) show ?thesis proof(rule dchain_unique[OF vt h1 _ h2, symmetric]) from runing_1 show "th1 \ readys s" by (simp add:runing_def) @@ -2411,9 +2411,9 @@ qed qed -lemma eq_depend: - "depend (wq s) = depend s" -by (unfold cs_depend_def s_depend_def, auto) +lemma eq_RAG: + "RAG (wq s) = RAG s" +by (unfold cs_RAG_def s_RAG_def, auto) lemma count_eq_dependants: assumes vt: "vt s" @@ -2423,28 +2423,28 @@ from cnp_cnv_cncs[OF vt] and eq_pv have "cntCS s th = 0" by (auto split:if_splits) - moreover have "finite {cs. (Cs cs, Th th) \ depend s}" + moreover have "finite {cs. (Cs cs, Th th) \ RAG s}" proof - from finite_holding[OF vt, of th] show ?thesis by (simp add:holdents_test) qed - ultimately have h: "{cs. (Cs cs, Th th) \ depend s} = {}" + ultimately have h: "{cs. (Cs cs, Th th) \ RAG s} = {}" by (unfold cntCS_def holdents_test cs_dependants_def, auto) show ?thesis proof(unfold cs_dependants_def) - { assume "{th'. (Th th', Th th) \ (depend (wq s))\<^sup>+} \ {}" - then obtain th' where "(Th th', Th th) \ (depend (wq s))\<^sup>+" by auto + { assume "{th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+} \ {}" + then obtain th' where "(Th th', Th th) \ (RAG (wq s))\<^sup>+" by auto hence "False" proof(cases) - assume "(Th th', Th th) \ depend (wq s)" - thus "False" by (auto simp:cs_depend_def) + assume "(Th th', Th th) \ RAG (wq s)" + thus "False" by (auto simp:cs_RAG_def) next fix c - assume "(c, Th th) \ depend (wq s)" - with h and eq_depend show "False" - by (cases c, auto simp:cs_depend_def) + assume "(c, Th th) \ RAG (wq s)" + with h and eq_RAG show "False" + by (cases c, auto simp:cs_RAG_def) qed - } thus "{th'. (Th th', Th th) \ (depend (wq s))\<^sup>+} = {}" by auto + } thus "{th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+} = {}" by auto qed qed @@ -2454,20 +2454,20 @@ shows "dependants (wq s) th \ threads s" proof { fix th th' - assume h: "th \ {th'a. (Th th'a, Th th') \ (depend (wq s))\<^sup>+}" - have "Th th \ Domain (depend s)" + assume h: "th \ {th'a. (Th th'a, Th th') \ (RAG (wq s))\<^sup>+}" + have "Th th \ Domain (RAG s)" proof - - from h obtain th' where "(Th th, Th th') \ (depend (wq s))\<^sup>+" by auto - hence "(Th th) \ Domain ( (depend (wq s))\<^sup>+)" by (auto simp:Domain_def) - with trancl_domain have "(Th th) \ Domain (depend (wq s))" by simp - thus ?thesis using eq_depend by simp + from h obtain th' where "(Th th, Th th') \ (RAG (wq s))\<^sup>+" by auto + hence "(Th th) \ Domain ( (RAG (wq s))\<^sup>+)" by (auto simp:Domain_def) + with trancl_domain have "(Th th) \ Domain (RAG (wq s))" by simp + thus ?thesis using eq_RAG by simp qed - from dm_depend_threads[OF vt this] + from dm_RAG_threads[OF vt this] have "th \ threads s" . } note hh = this fix th1 assume "th1 \ dependants (wq s) th" - hence "th1 \ {th'a. (Th th'a, Th th) \ (depend (wq s))\<^sup>+}" + hence "th1 \ {th'a. (Th th'a, Th th) \ (RAG (wq s))\<^sup>+}" by (unfold cs_dependants_def, simp) from hh [OF this] show "th1 \ threads s" . qed @@ -2496,21 +2496,21 @@ and th_in: "th \ threads s" shows "cp s th \ Max ((\ th. (preced th s)) ` threads s)" proof(unfold cp_eq_cpreced cpreced_def cs_dependants_def) - show "Max ((\th. preced th s) ` ({th} \ {th'. (Th th', Th th) \ (depend (wq s))\<^sup>+})) + show "Max ((\th. preced th s) ` ({th} \ {th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+})) \ Max ((\th. preced th s) ` threads s)" (is "Max (?f ` ?A) \ Max (?f ` ?B)") proof(rule Max_f_mono) - show "{th} \ {th'. (Th th', Th th) \ (depend (wq s))\<^sup>+} \ {}" by simp + show "{th} \ {th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+} \ {}" by simp next from finite_threads [OF vt] show "finite (threads s)" . next from th_in - show "{th} \ {th'. (Th th', Th th) \ (depend (wq s))\<^sup>+} \ threads s" + show "{th} \ {th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+} \ threads s" apply (auto simp:Domain_def) - apply (rule_tac dm_depend_threads[OF vt]) - apply (unfold trancl_domain [of "depend s", symmetric]) - by (unfold cs_depend_def s_depend_def, auto simp:Domain_def) + apply (rule_tac dm_RAG_threads[OF vt]) + apply (unfold trancl_domain [of "RAG s", symmetric]) + by (unfold cs_RAG_def s_RAG_def, auto simp:Domain_def) qed qed @@ -2528,18 +2528,18 @@ proof - have "finite ?B" proof- - have "finite {th'. (Th th', Th th) \ (depend (wq s))\<^sup>+}" + have "finite {th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+}" proof - let ?F = "\ (x, y). the_th x" - have "{th'. (Th th', Th th) \ (depend (wq s))\<^sup>+} \ ?F ` ((depend (wq s))\<^sup>+)" + have "{th'. (Th th', Th th) \ (RAG (wq s))\<^sup>+} \ ?F ` ((RAG (wq s))\<^sup>+)" apply (auto simp:image_def) by (rule_tac x = "(Th x, Th th)" in bexI, auto) moreover have "finite \" proof - - from finite_depend[OF vt] have "finite (depend s)" . - hence "finite ((depend (wq s))\<^sup>+)" + from finite_RAG[OF vt] have "finite (RAG s)" . + hence "finite ((RAG (wq s))\<^sup>+)" apply (unfold finite_trancl) - by (auto simp: s_depend_def cs_depend_def wq_def) + by (auto simp: s_RAG_def cs_RAG_def wq_def) thus ?thesis by auto qed ultimately show ?thesis by (auto intro:finite_subset) @@ -2621,12 +2621,12 @@ then obtain tm where tm_max: "?f tm = ?p" and tm_in: "tm \ threads s" by (auto simp:Image_def) from th_chain_to_ready [OF vt tm_in] - have "tm \ readys s \ (\th'. th' \ readys s \ (Th tm, Th th') \ (depend s)\<^sup>+)" . + have "tm \ readys s \ (\th'. th' \ readys s \ (Th tm, Th th') \ (RAG s)\<^sup>+)" . thus ?thesis proof - assume "\th'. th' \ readys s \ (Th tm, Th th') \ (depend s)\<^sup>+ " + assume "\th'. th' \ readys s \ (Th tm, Th th') \ (RAG s)\<^sup>+ " then obtain th' where th'_in: "th' \ readys s" - and tm_chain:"(Th tm, Th th') \ (depend s)\<^sup>+" by auto + and tm_chain:"(Th tm, Th th') \ (RAG s)\<^sup>+" by auto have "cp s th' = ?f tm" proof(subst cp_eq_cpreced, subst cpreced_def, rule Max_eqI) from dependants_threads[OF vt] finite_threads[OF vt] @@ -2650,7 +2650,7 @@ proof - from tm_chain have "tm \ dependants (wq s) th'" - by (unfold cs_dependants_def s_depend_def cs_depend_def, auto) + by (unfold cs_dependants_def s_RAG_def cs_RAG_def, auto) thus ?thesis by auto qed qed @@ -2780,9 +2780,9 @@ lemma detached_test: - shows "detached s th = (Th th \ Field (depend s))" + shows "detached s th = (Th th \ Field (RAG s))" apply(simp add: detached_def Field_def) -apply(simp add: s_depend_def) +apply(simp add: s_RAG_def) apply(simp add: s_holding_abv s_waiting_abv) apply(simp add: Domain_iff Range_iff) apply(simp add: wq_def) @@ -2805,12 +2805,12 @@ thus ?thesis proof assume "th \ threads s" - with range_in[OF vt] dm_depend_threads[OF vt] + with range_in[OF vt] dm_RAG_threads[OF vt] show ?thesis - by (auto simp add: detached_def s_depend_def s_waiting_abv s_holding_abv wq_def Domain_iff Range_iff) + by (auto simp add: detached_def s_RAG_def s_waiting_abv s_holding_abv wq_def Domain_iff Range_iff) next assume "th \ readys s" - moreover have "Th th \ Range (depend s)" + moreover have "Th th \ Range (RAG s)" proof - from card_0_eq [OF finite_holding [OF vt]] and cncs_zero have "holdents s th = {}" @@ -2818,11 +2818,11 @@ thus ?thesis apply(auto simp:holdents_test) apply(case_tac a) - apply(auto simp:holdents_test s_depend_def) + apply(auto simp:holdents_test s_RAG_def) done qed ultimately show ?thesis - by (auto simp add: detached_def s_depend_def s_waiting_abv s_holding_abv wq_def readys_def) + by (auto simp add: detached_def s_RAG_def s_waiting_abv s_holding_abv wq_def readys_def) qed qed @@ -2838,7 +2838,7 @@ have cncs_z: "cntCS s th = 0" proof - from dtc have "holdents s th = {}" - unfolding detached_def holdents_test s_depend_def + unfolding detached_def holdents_test s_RAG_def by (simp add: s_waiting_abv wq_def s_holding_abv Domain_iff Range_iff) thus ?thesis by (auto simp:cntCS_def) qed @@ -2848,7 +2848,7 @@ with dtc have "th \ readys s" by (unfold readys_def detached_def Field_def Domain_def Range_def, - auto simp:eq_waiting s_depend_def) + auto simp:eq_waiting s_RAG_def) with cncs_z and eq_pv show ?thesis by simp next case False @@ -2862,4 +2862,4 @@ shows "(detached s th) = (cntP s th = cntV s th)" by (insert vt, auto intro:detached_intro detached_elim) -end \ No newline at end of file +end