section \<open>Abstract commutation and confluence notions\<close>
theory Commutation imports Main begin
declare [[syntax_ambiguity_warning = false]]
subsection \<open>Basic definitions\<close>
definition
square :: "['a => 'a => bool, 'a => 'a => bool, 'a => 'a => bool, 'a => 'a => bool] => bool"where "square R S T U =
(\<forall>x y. R x y --> (\<forall>z. S x z --> (\<exists>u. T y u \<and> U z u)))"
definition
commute :: "['a => 'a => bool, 'a => 'a => bool] => bool"where "commute R S = square R S S R"
definition
diamond :: "('a => 'a => bool) => bool"where "diamond R = commute R R"
definition
Church_Rosser :: "('a => 'a => bool) => bool"where "Church_Rosser R =
(\<forall>x y. (sup R (R\<inverse>\<inverse>))\<^sup>*\<^sup>* x y \<longrightarrow> (\<exists>z. R\<^sup>*\<^sup>* x z \<and> R\<^sup>*\<^sup>* y z))"
abbreviation
confluent :: "('a => 'a => bool) => bool"where "confluent R == diamond (R\<^sup>*\<^sup>*)"
lemma square_sym: "square R S T U ==> square S R U T" apply (unfold square_def) apply blast done
lemma square_subset: "[| square R S T U; T \ T' |] ==> square R S T' U" apply (unfold square_def) apply (blast dest: predicate2D) done
lemma square_reflcl: "[| square R S T (R\<^sup>=\<^sup>=); S \ T |] ==> square (R\<^sup>=\<^sup>=) S T (R\<^sup>=\<^sup>=)" apply (unfold square_def) apply (blast dest: predicate2D) done
lemma square_rtrancl: "square R S S T ==> square (R\<^sup>*\<^sup>*) S S (T\<^sup>*\<^sup>*)" apply (unfold square_def) apply (intro strip) apply (erule rtranclp_induct) apply blast apply (blast intro: rtranclp.rtrancl_into_rtrancl) done
theorem newman: assumes wf: "wfP (R\\)" and lc: "\a b c. R a b \ R a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" shows"\b c. R\<^sup>*\<^sup>* a b \ R\<^sup>*\<^sup>* a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" using wf proof induct case (less x b c) have xc: "R\<^sup>*\<^sup>* x c" by fact have xb: "R\<^sup>*\<^sup>* x b" by fact thus ?case proof (rule converse_rtranclpE) assume"x = b" with xc have"R\<^sup>*\<^sup>* b c" by simp thus ?thesis by iprover next fix y assume xy: "R x y" assume yb: "R\<^sup>*\<^sup>* y b" from xc show ?thesis proof (rule converse_rtranclpE) assume"x = c" with xb have"R\<^sup>*\<^sup>* c b" by simp thus ?thesis by iprover next fix y' assume y'c: "R\<^sup>*\<^sup>* y' c" assume xy': "R x y'" with xy have"\u. R\<^sup>*\<^sup>* y u \ R\<^sup>*\<^sup>* y' u" by (rule lc) thenobtain u where yu: "R\<^sup>*\<^sup>* y u" and y'u: "R\<^sup>*\<^sup>* y' u" by iprover from xy have"R\\ y x" .. from this and yb yu have"\d. R\<^sup>*\<^sup>* b d \ R\<^sup>*\<^sup>* u d" by (rule less) thenobtain v where bv: "R\<^sup>*\<^sup>* b v" and uv: "R\<^sup>*\<^sup>* u v" by iprover from xy' have "R\\ y' x" .. moreoverfrom y'u and uv have "R\<^sup>*\<^sup>* y' v" by (rule rtranclp_trans) moreovernote y'c ultimatelyhave"\d. R\<^sup>*\<^sup>* v d \ R\<^sup>*\<^sup>* c d" by (rule less) thenobtain w where vw: "R\<^sup>*\<^sup>* v w" and cw: "R\<^sup>*\<^sup>* c w" by iprover from bv vw have"R\<^sup>*\<^sup>* b w" by (rule rtranclp_trans) with cw show ?thesis by iprover qed qed qed
text\<open>
Alternative version. Partly automated by Tobias
Nipkow. Takes 2 minutes (2002).
This is the maximal amount of automation possible using\<open>blast\<close>. \<close>
theorem newman': assumes wf: "wfP (R\\)" and lc: "\a b c. R a b \ R a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" shows"\b c. R\<^sup>*\<^sup>* a b \ R\<^sup>*\<^sup>* a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" using wf proof induct case (less x b c) note IH = \<open>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d\<close> have xc: "R\<^sup>*\<^sup>* x c" by fact have xb: "R\<^sup>*\<^sup>* x b" by fact thus ?case proof (rule converse_rtranclpE) assume"x = b" with xc have"R\<^sup>*\<^sup>* b c" by simp thus ?thesis by iprover next fix y assume xy: "R x y" assume yb: "R\<^sup>*\<^sup>* y b" from xc show ?thesis proof (rule converse_rtranclpE) assume"x = c" with xb have"R\<^sup>*\<^sup>* c b" by simp thus ?thesis by iprover next fix y' assume y'c: "R\<^sup>*\<^sup>* y' c" assume xy': "R x y'" with xy obtain u where u: "R\<^sup>*\<^sup>* y u" "R\<^sup>*\<^sup>* y' u" by (blast dest: lc) from yb u y'c show ?thesis by (blast del: rtranclp.rtrancl_refl
intro: rtranclp_trans
dest: IH [OF conversepI, OF xy] IH [OF conversepI, OF xy']) qed qed qed
text\<open> Using the coherent logic prover, the proof of the induction step is completely automatic. \<close>
lemma eq_imp_rtranclp: "x = y \ r\<^sup>*\<^sup>* x y" by simp
theorem newman'': assumes wf: "wfP (R\\)" and lc: "\a b c. R a b \ R a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" shows"\b c. R\<^sup>*\<^sup>* a b \ R\<^sup>*\<^sup>* a c \ \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d" using wf proof induct case (less x b c) note IH = \<open>\<And>y b c. \<lbrakk>R\<inverse>\<inverse> y x; R\<^sup>*\<^sup>* y b; R\<^sup>*\<^sup>* y c\<rbrakk> \<Longrightarrow> \<exists>d. R\<^sup>*\<^sup>* b d \<and> R\<^sup>*\<^sup>* c d\<close> show ?case by (coherent \<open>R\<^sup>*\<^sup>* x c\<close> \<open>R\<^sup>*\<^sup>* x b\<close>
refl [where'a='a] sym
eq_imp_rtranclp
r_into_rtranclp [of R]
rtranclp_trans
lc IH [OF conversepI]
converse_rtranclpE) qed
end
¤ Dauer der Verarbeitung: 0.17 Sekunden
(vorverarbeitet)
¤
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.