(* Title: HOL/HOLCF/IOA/ShortExecutions.thy Author: Olaf Müller
*)
theory ShortExecutions imports Traces begin
text\<open>
Some properties about \<open>Cut ex\<close>, defined as follows:
For every execution ex there is another shorter execution \<open>Cut ex\<close>
that has the same trace as ex, but its schedule ends with an external action. \<close>
definition oraclebuild :: "('a \ bool) \ 'a Seq \ 'a Seq \ 'a Seq" where"oraclebuild P =
(fix\<cdot>
(LAM h s t. case t of
nil \<Rightarrow> nil
| x ## xs \<Rightarrow>
(case x of
UU \<Rightarrow> UU
| Def y \<Rightarrow>
(Takewhile (\<lambda>x. \<not> P x) \<cdot> s) @@
(y \<leadsto> (h \<cdot> (TL \<cdot> (Dropwhile (\<lambda>x. \<not> P x) \<cdot> s)) \<cdot> xs)))))"
definition Cut :: "('a \ bool) \ 'a Seq \ 'a Seq" where"Cut P s = oraclebuild P \ s \ (Filter P \ s)"
definition LastActExtsch :: "('a,'s) ioa \ 'a Seq \ bool" where"LastActExtsch A sch \ Cut (\x. x \ ext A) sch = sch"
axiomatizationwhere
Cut_prefixcl_Finite: "Finite s \ \y. s = Cut P s @@ y"
axiomatizationwhere
LastActExtsmall1: "LastActExtsch A sch \ LastActExtsch A (TL \ (Dropwhile P \ sch))"
axiomatizationwhere
LastActExtsmall2: "Finite sch1 \ LastActExtsch A (sch1 @@ sch2) \ LastActExtsch A sch2"
lemma oraclebuild_unfold: "oraclebuild P =
(LAM s t. case t of
nil \<Rightarrow> nil
| x ## xs \<Rightarrow>
(case x of
UU \<Rightarrow> UU
| Def y \<Rightarrow>
(Takewhile (\<lambda>a. \<not> P a) \<cdot> s) @@
(y \<leadsto> (oraclebuild P \<cdot> (TL \<cdot> (Dropwhile (\<lambda>a. \<not> P a) \<cdot> s)) \<cdot> xs))))" apply (rule trans) apply (rule fix_eq2) apply (simp only: oraclebuild_def) apply (rule beta_cfun) apply simp done
lemma oraclebuild_cons: "oraclebuild P \ s \ (x \ t) =
(Takewhile (\<lambda>a. \<not> P a) \<cdot> s) @@
(x \<leadsto> (oraclebuild P \<cdot> (TL \<cdot> (Dropwhile (\<lambda>a. \<not> P a) \<cdot> s)) \<cdot> t))" apply (rule trans) apply (subst oraclebuild_unfold) apply (simp add: Consq_def) apply (simp add: Consq_def) done
subsection \<open>Cut rewrite rules\<close>
lemma Cut_nil: "Forall (\a. \ P a) s \ Finite s \ Cut P s = nil" apply (unfold Cut_def) apply (subgoal_tac "Filter P \ s = nil") apply (simp add: oraclebuild_nil) apply (rule ForallQFilterPnil) apply assumption+ done
lemma Cut_UU: "Forall (\a. \ P a) s \ \ Finite s \ Cut P s = UU" apply (unfold Cut_def) apply (subgoal_tac "Filter P \ s = UU") apply (simp add: oraclebuild_UU) apply (rule ForallQFilterPUU) apply assumption+ done
lemma Cut_Cons: "P t \ Forall (\x. \ P x) ss \ Finite ss \
Cut P (ss @@ (t \<leadsto> rs)) = ss @@ (t \<leadsto> Cut P rs)" apply (unfold Cut_def) apply (simp add: ForallQFilterPnil oraclebuild_cons TakewhileConc DropwhileConc) done
subsection \<open>Cut lemmas for main theorem\<close>
lemma FilterCut: "Filter P \ s = Filter P \ (Cut P s)" apply (rule_tac A1 = "\x. True" and Q1 = "\x. \ P x" and x1 = "s" in take_lemma_induct [THEN mp]) prefer 3 apply fast apply (case_tac "Finite s") apply (simp add: Cut_nil ForallQFilterPnil) apply (simp add: Cut_UU ForallQFilterPUU) text\<open>main case\<close> apply (simp add: Cut_Cons ForallQFilterPnil) done
lemma Cut_idemp: "Cut P (Cut P s) = (Cut P s)" apply (rule_tac A1 = "\x. True" and Q1 = "\x. \ P x" and x1 = "s" in
take_lemma_less_induct [THEN mp]) prefer 3 apply fast apply (case_tac "Finite s") apply (simp add: Cut_nil ForallQFilterPnil) apply (simp add: Cut_UU ForallQFilterPUU) text\<open>main case\<close> apply (simp add: Cut_Cons ForallQFilterPnil) apply (rule take_reduction) apply auto done
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 ist noch experimentell.