definition
fresher :: "r ==> r ==> bool" (‹(_/ ⊑ _)› [51, 51] 50) where "fresher r r' ≡ ((nsqnr r < nsqnr r') ∨ (nsqnr r = nsqnr r' ∧ π5(r) ≥ π5(r')))"
lemma fresherI1 [intro]: assumes"nsqnr r < nsqnr r'" shows"r ⊑ r'" unfolding fresher_def using assms by simp
lemma fresherI2 [intro]: assumes"nsqnr r = nsqnr r'" and"π5(r) ≥ π5(r')" shows"r ⊑ r'" unfolding fresher_def using assms by simp
lemma fresherI [intro]: assumes"(nsqnr r < nsqnr r') ∨ (nsqnr r = nsqnr r' ∧ π5(r) ≥ π5(r'))" shows"r ⊑ r'" unfolding fresher_def using assms .
lemma fresherE [elim]: assumes"r ⊑ r'" and"nsqnr r < nsqnr r' ==> P r r'" and"nsqnr r = nsqnr r' ∧ π5(r) ≥ π5(r') ==> P r r'" shows"P r r'" using assms unfolding fresher_def by auto
lemma fresher_refl [simp]: "r ⊑ r" unfolding fresher_def by simp
lemma fresher_trans [elim, trans]: "[ x ⊑ y; y ⊑ z ]==> x ⊑ z" unfolding fresher_def by auto
lemma not_fresher_trans [elim, trans]: "[¬(x ⊑ y); ¬(z ⊑ x) ]==>¬(z ⊑ y)" unfolding fresher_def by auto
lemma rt_fresherE [elim]: assumes"rt1 ⊑ rt2" and"dip ∈ kD(rt1)" and"dip ∈ kD(rt2)" and"[ nsqn rt1 dip < nsqn rt2 dip ]==> P rt1 rt2 dip" and"[ nsqn rt1 dip = nsqn rt2 dip; the (dhops rt1 dip) ≥ the (dhops rt2 dip) ]==> P rt1 rt2 dip" shows"P rt1 rt2 dip" using assms(1) unfolding rt_fresher_def2 [OF assms(2-3)] using assms(4-5) by auto
lemma rt_fresher_refl [simp]: "rt ⊑ rt" unfolding rt_fresher_def by simp
lemma rt_fresher_trans [elim, trans]: assumes"rt1 ⊑ rt2" and"rt2 ⊑ rt3" shows"rt1 ⊑ rt3" using assms unfolding rt_fresher_def by auto
lemma rt_fresher_if_Some [intro!]: assumes"the (rt dip) ⊑ r" shows"rt ⊑ (λip. if ip = dip then Some r else rt ip)" using assms unfolding rt_fresher_def by simp
lemma rt_fresh_asI [intro!]: assumes"rt1 ⊑ rt2" and"rt2 ⊑ rt1" shows"rt1 ≈ rt2" using assms unfolding rt_fresh_as_def by simp
lemma rt_fresh_as_fresherI [intro]: assumes"dip∈kD(rt1)" and"dip∈kD(rt2)" and"the (rt1 dip) ⊑ the (rt2 dip)" and"the (rt2 dip) ⊑ the (rt1 dip)" shows"rt1 ≈ rt2" using assms unfolding rt_fresh_as_def by (clarsimp dest!: single_rt_fresher)
lemma nsqn_rt_fresh_asI: assumes"dip ∈ kD(rt)" and"dip ∈ kD(rt')" and"nsqn rt dip = nsqn rt' dip" and"π5(the (rt dip)) = π5(the (rt' dip))" shows"rt ≈ rt'" proof from assms(1-2,4) have dhops': "the (dhops rt' dip) ≤ the (dhops rt dip)" by (simp add: proj5_eq_dhops) with assms(1-3) show"rt ⊑ rt'" by (rule rt_fresherI2) next from assms(1-2,4) have dhops: "the (dhops rt dip) ≤ the (dhops rt' dip)" by (simp add: proj5_eq_dhops) with assms(2,1) assms(3) [symmetric] show"rt' ⊑ rt" by (rule rt_fresherI2) qed
lemma rt_fresh_asE [elim]: assumes"rt1 ≈ rt2" and"[ rt1 ⊑ rt2; rt2 ⊑ rt1 ]==> P rt1 rt2 dip" shows"P rt1 rt2 dip" using assms unfolding rt_fresh_as_def by simp
lemma rt_fresh_asD1 [dest]: assumes"rt1 ≈ rt2" shows"rt1 ⊑ rt2" using assms unfolding rt_fresh_as_def by simp
lemma rt_fresh_asD2 [dest]: assumes"rt1 ≈ rt2" shows"rt2 ⊑ rt1" using assms unfolding rt_fresh_as_def by simp
lemma rt_fresh_as_sym: assumes"rt1 ≈ rt2" shows"rt2 ≈ rt1" using assms unfolding rt_fresh_as_def by simp
from‹dip∈kD(rt)›obtain dsnn dskn fn hopsn nhipnpren where rtn [simp]: "the (rt dip) = (dsnn, dskn, fn, hopsn, nhipn, pren)" by (metis prod_cases6) with‹the (dhops rt dip) ≥ 1›and‹dip∈kD(rt)›have"hopsn≥ 1" by (metis proj5_eq_dhops projs(4)) from‹dip∈kD(rt)› rtn have [simp]: "sqn rt dip = dsnn" and [simp]: "the (dhops rt dip) = hopsn" and [simp]: "the (flag rt dip) = fn" by (simp add: sqn_def proj5_eq_dhops [symmetric]
proj4_eq_flag [symmetric])+
from‹update_arg_wf r›have"(dsnn, dskn, fn, hopsn, nhipn, pren) ⊑ the ((update rt dip r) dip)" proof (rule wf_r_cases) fix nhip pre from‹hopsn≥ 1›have"∧pre'. (dsnn, dskn, fn, hopsn, nhipn, pren) ⊑ (dsnn, unk, val, Suc 0, nhip, pre')" unfolding fresher_def sqn_def by (cases fn) auto thus"(dsnn, dskn, fn, hopsn, nhipn, pren) ⊑ the (update rt dip (0, unk, val, Suc 0, nhip, pre) dip)" using‹dip∈kD(rt)›by - (rule update_cases_kD, simp_all) next fix dsn :: sqn and hops nhip pre assume"0 < dsn" show"(dsnn, dskn, fn, hopsn, nhipn, pren) ⊑ the (update rt dip (dsn, kno, val, hops, nhip, pre) dip)" proof (rule update_cases_kD [OF _ ‹dip∈kD(rt)›], simp_all add: ‹0 < dsn›) assume"dsnn < dsn" thus"(dsnn, dskn, fn, hopsn, nhipn, pren) ⊑ (dsn, kno, val, hops, nhip, pre ∪ pren)" unfolding fresher_def by auto next assume"dsnn = dsn" and"hops < hopsn" thus"(dsn, dskn, fn, hopsn, nhipn, pren) ⊑ (dsn, kno, val, hops, nhip, pre ∪ pren)" unfolding fresher_def nsqnr_defby simp next assume"dsnn = dsn" with‹0 < dsn› show"(dsn, dskn, inv, hopsn, nhipn, pren) ⊑ (dsn, kno, val, hops, nhip, pre ∪ pren)" unfolding fresher_def by simp qed qed hence"rt ⊑ update rt dip r" by - (rule single_rt_fresher, simp) with‹dip = ip›show ?thesis by simp qed
theorem rt_fresher_invalidate [simp]: assumes"dip∈kD(rt)" and indests: "∀rip∈dom(dests). rip∈vD(rt) ∧ sqn rt rip < the (dests rip)" shows"rt ⊑ invalidate rt dests" proof (cases "dip∈dom(dests)") assume"dip∉dom(dests)" thus ?thesis using‹dip∈kD(rt)› by - (rule single_rt_fresher, simp) next assume"dip∈dom(dests)" moreoverwith indests have"dip∈vD(rt)" and"sqn rt dip < the (dests dip)" by auto ultimatelyshow ?thesis unfolding invalidate_def sqn_def by - (rule single_rt_fresher, auto simp: fresher_def) qed
lemma nsqnr_invalidate [simp]: assumes"dip∈kD(rt)" and"dip∈dom(dests)" shows"nsqnr (the (invalidate rt dests dip)) = the (dests dip) - 1" using assms unfolding invalidate_def by auto
lemma rt_fresh_as_inc_invalidate [simp]: assumes"dip∈kD(rt)" and"∀rip∈dom(dests). rip∈vD(rt) ∧ the (dests rip) = inc (sqn rt rip)" shows"rt ≈ invalidate rt dests" proof (cases "dip∈dom(dests)") assume"dip∉dom(dests)" with‹dip∈kD(rt)›have"dip∈kD(invalidate rt dests)" by simp with‹dip∈kD(rt)›show ?thesis by rule (simp_all add: ‹dip∉dom(dests)›) next assume"dip∈dom(dests)" with assms(2) have"dip∈vD(rt)" and"the (dests dip) = inc (sqn rt dip)"by auto from‹dip∈vD(rt)›have"dip∈kD(rt)"by simp moreoverthenhave"dip∈kD(invalidate rt dests)"by simp ultimatelyshow ?thesis proof (rule nsqn_rt_fresh_asI) from‹dip∈vD(rt)›have"nsqn rt dip = sqn rt dip"by simp alsohave"sqn rt dip = nsqnr (the (invalidate rt dests dip))" proof - from‹dip∈kD(rt)›have"nsqnr (the (invalidate rt dests dip)) = the (dests dip) - 1" using‹dip∈dom(dests)›by (rule nsqnr_invalidate) with‹the (dests dip) = inc (sqn rt dip)› show"sqn rt dip = nsqnr (the (invalidate rt dests dip))"by simp qed alsofrom‹dip∈kD(invalidate rt dests)› have"nsqnr (the (invalidate rt dests dip)) = nsqn (invalidate rt dests) dip" by (simp add: kD_nsqn) finallyshow"nsqn rt dip = nsqn (invalidate rt dests) dip" . qed simp qed
lemma rt_strictly_fresherE [elim]: assumes"rt1 ⊏ rt2" and"[ rt1 ⊑ rt2; ¬(rt1 ≈ rt2) ]==> P rt1 rt2 i" shows"P rt1 rt2 i" using assms(1) unfolding rt_strictly_fresher_def by rule (erule(1) assms(2))
lemma rt_strictly_fresher_def': "rt1 ⊏ rt2 = (nsqnr (the (rt1 i)) < nsqnr (the (rt2 i)) ∨ (nsqnr (the (rt1 i)) = nsqnr (the (rt2 i)) ∧ π5(the (rt1 i)) > π5(the (rt2 i))))" unfolding rt_strictly_fresher_def'' rt_fresher_def fresher_def by auto
lemma rt_strictly_fresher_fresherD [dest]: assumes"rt1 ⊏ rt2" shows"the (rt1 dip) ⊑ the (rt2 dip)" using assms unfolding rt_strictly_fresher_def rt_fresher_def by auto
lemma rt_strictly_fresher_not_fresh_asD [dest]: assumes"rt1 ⊏ rt2" shows"¬ rt1 ≈ rt2" using assms unfolding rt_strictly_fresher_def by auto
lemma rt_strictly_fresher_trans [elim, trans]: assumes"rt1 ⊏ rt2" and"rt2 ⊏ rt3" shows"rt1 ⊏ rt3" using assms proof - from‹rt1 ⊏ rt2›obtain"the (rt1 dip) ⊑ the (rt2 dip)"by auto alsofrom‹rt2 ⊏ rt3›obtain"the (rt2 dip) ⊑ the (rt3 dip)"by auto finallyhave"the (rt1 dip) ⊑ the (rt3 dip)" .
moreoverhave"¬ (rt1 ≈ rt3)" proof - from‹rt1 ⊏ rt2›obtain"¬(the (rt2 dip) ⊑ the (rt1 dip))"by auto alsofrom‹rt2 ⊏ rt3›obtain"¬(the (rt3 dip) ⊑ the (rt2 dip))"by auto finallyhave"¬(the (rt3 dip) ⊑ the (rt1 dip))" . thus ?thesis .. qed ultimatelyshow"rt1 ⊏ rt3" .. qed
lemma rt_strictly_fresher_irefl [simp]: "¬ (rt ⊏ rt)" unfolding rt_strictly_fresher_def by clarsimp
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.