# HG changeset patch # User paulson # Date 1434548150 -3600 # Node ID 866f41a869e6381ee201dcffeca2cf71018b4331 # Parent db0f4f4c17c732cbf43bbc7fcd09b997a0a60ea2 New WF theorem by Tjark Weber. Replaced the proof of the subsequent theorem. diff -r db0f4f4c17c7 -r 866f41a869e6 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Tue Jun 16 20:50:00 2015 +0100 +++ b/src/HOL/Wellfounded.thy Wed Jun 17 14:35:50 2015 +0100 @@ -318,7 +318,6 @@ 2. There is no such step. Pick an S-min element of A. In this case it must be an R-min element of A as well. - *) lemma wf_Un: "[| wf r; wf s; Domain r Int Range s = {} |] ==> wf(r Un s)" @@ -382,30 +381,59 @@ subsection {* Well-Foundedness of Composition *} -text{* Provided by Tjark Weber: *} +text \Bachmair and Dershowitz 1986, Lemma 2. [Provided by Tjark Weber]\ -lemma wf_relcomp_compatible: +lemma qc_wf_relto_iff: + assumes "R O S \ (R \ S)\<^sup>* O R" -- \R quasi-commutes over S\ + shows "wf (S\<^sup>* O R O S\<^sup>*) \ wf R" (is "wf ?S \ _") +proof + assume "wf ?S" + moreover have "R \ ?S" by auto + ultimately show "wf R" using wf_subset by auto +next + assume "wf R" + show "wf ?S" + proof (rule wfI_pf) + fix A assume A: "A \ ?S `` A" + let ?X = "(R \ S)\<^sup>* `` A" + have *: "R O (R \ S)\<^sup>* \ (R \ S)\<^sup>* O R" + proof - + { fix x y z assume "(y, z) \ (R \ S)\<^sup>*" and "(x, y) \ R" + then have "(x, z) \ (R \ S)\<^sup>* O R" + proof (induct y z) + case rtrancl_refl then show ?case by auto + next + case (rtrancl_into_rtrancl a b c) + then have "(x, c) \ ((R \ S)\<^sup>* O (R \ S)\<^sup>*) O R" using assms by blast + then show ?case by simp + qed } + then show ?thesis by auto + qed + then have "R O S\<^sup>* \ (R \ S)\<^sup>* O R" using rtrancl_Un_subset by blast + then have "?S \ (R \ S)\<^sup>* O (R \ S)\<^sup>* O R" by (simp add: relcomp_mono rtrancl_mono) + also have "\ = (R \ S)\<^sup>* O R" by (simp add: O_assoc[symmetric]) + finally have "?S O (R \ S)\<^sup>* \ (R \ S)\<^sup>* O R O (R \ S)\<^sup>*" by (simp add: O_assoc[symmetric] relcomp_mono) + also have "\ \ (R \ S)\<^sup>* O (R \ S)\<^sup>* O R" using * by (simp add: relcomp_mono) + finally have "?S O (R \ S)\<^sup>* \ (R \ S)\<^sup>* O R" by (simp add: O_assoc[symmetric]) + then have "(?S O (R \ S)\<^sup>*) `` A \ ((R \ S)\<^sup>* O R) `` A" by (simp add: Image_mono) + moreover have "?X \ (?S O (R \ S)\<^sup>*) `` A" using A by (auto simp: relcomp_Image) + ultimately have "?X \ R `` ?X" by (auto simp: relcomp_Image) + then have "?X = {}" using \wf R\ by (simp add: wfE_pf) + moreover have "A \ ?X" by auto + ultimately show "A = {}" by simp + qed +qed + +corollary wf_relcomp_compatible: assumes "wf R" and "R O S \ S O R" shows "wf (S O R)" -proof (rule wfI_pf) - fix A assume A: "A \ (S O R) `` A" - { - fix n have "(S ^^ n) `` A \ R `` (S ^^ Suc n) `` A" - proof (induction n) - case 0 show ?case using A by (simp add: relcomp_Image) - next - case (Suc n) - then have "S `` (S ^^ n) `` A \ S `` R `` (S ^^ Suc n) `` A" - by (simp add: Image_mono) - also have "\ \ R `` S `` (S ^^ Suc n) `` A" using assms(2) - by (simp add: Image_mono O_assoc relcomp_Image[symmetric] relcomp_mono) - finally show ?case by (simp add: relcomp_Image) - qed - } - then have "(\n. (S ^^ n) `` A) \ R `` (\n. (S ^^ n) `` A)" by blast - then have "(\n. (S ^^ n) `` A) = {}" - using assms(1) by (simp only: wfE_pf) - then show "A = {}" using relpow.simps(1) by blast +proof - + have "R O S \ (R \ S)\<^sup>* O R" + using assms by blast + then have "wf (S\<^sup>* O R O S\<^sup>*)" + by (simp add: assms qc_wf_relto_iff) + then show ?thesis + by (rule Wellfounded.wf_subset) blast qed @@ -486,7 +514,7 @@ by (simp add: less_than_def less_eq) lemma wf_less: "wf {(x, y::nat). x < y}" - using wf_less_than by (simp add: less_than_def less_eq [symmetric]) + by (rule Wellfounded.wellorder_class.wf) subsection {* Accessible Part *}