# HG changeset patch # User desharna # Date 1710662598 -3600 # Node ID 65e0682cca6396b111e48b36808abfff6c366411 # Parent 87a04ce7e3c39e0658540b230c12efea9fdde9bd added lemmas wfP_iff_ex_minimal, wf_iff_ex_minimal, wf_onE_pf, wf_onI_pf, wf_on_iff_ex_minimal, and wfp_on_iff_ex_minimal diff -r 87a04ce7e3c3 -r 65e0682cca63 NEWS --- a/NEWS Sun Mar 17 07:45:12 2024 +0100 +++ b/NEWS Sun Mar 17 09:03:18 2024 +0100 @@ -98,9 +98,15 @@ - Added definitions wf_on and wfp_on as restricted versions versions of wf and wfP respectively. - Added lemmas. + wfP_iff_ex_minimal + wf_iff_ex_minimal + wf_onE_pf + wf_onI_pf wf_on_UNIV + wf_on_iff_ex_minimal wf_on_induct wfp_on_UNIV + wfp_on_iff_ex_minimal wfp_on_induct wfp_on_wf_on_eq diff -r 87a04ce7e3c3 -r 65e0682cca63 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Sun Mar 17 07:45:12 2024 +0100 +++ b/src/HOL/Wellfounded.thy Sun Mar 17 09:03:18 2024 +0100 @@ -44,7 +44,7 @@ subsection \Induction Principles\ -lemma wf_on_induct[consumes 2, case_names less, induct set: wf]: +lemma wf_on_induct[consumes 2, case_names less, induct set: wf_on]: assumes "wf_on A r" and "x \ A" and "\x. x \ A \ (\y. y \ A \ (y, x) \ r \ P y) \ P x" shows "P x" using assms(2,3) by (auto intro: \wf_on A r\[unfolded wf_on_def, rule_format]) @@ -133,6 +133,23 @@ text \Point-free characterization of well-foundedness\ +lemma wf_onE_pf: + assumes wf: "wf_on A r" and "B \ A" and "B \ r `` B" + shows "B = {}" +proof - + have "x \ B" if "x \ A" for x + using wf that + proof (induction x rule: wf_on_induct) + case (less x) + have "x \ r `` B" + using less.IH \B \ A\ by blast + thus ?case + using \B \ r `` B\ by blast + qed + with \B \ A\ show ?thesis + by blast +qed + lemma wfE_pf: assumes wf: "wf R" and a: "A \ R `` A" @@ -147,6 +164,22 @@ then show ?thesis by auto qed +lemma wf_onI_pf: + assumes "\B. B \ A \ B \ R `` B \ B = {}" + shows "wf_on A R" + unfolding wf_on_def +proof (intro allI impI ballI) + fix P :: "'a \ bool" and x :: 'a + let ?B = "{x \ A. \ P x}" + assume "\x\A. (\y\A. (y, x) \ R \ P y) \ P x" + hence "?B \ R `` ?B" by blast + hence "{x \ A. \ P x} = {}" + using assms(1)[of ?B] by simp + moreover assume "x \ A" + ultimately show "P x" + by simp +qed + lemma wfI_pf: assumes a: "\A. A \ R `` A \ A = {}" shows "wf R" @@ -161,6 +194,35 @@ subsubsection \Minimal-element characterization of well-foundedness\ +lemma wf_on_iff_ex_minimal: "wf_on A R \ (\B \ A. B \ {} \ (\z \ B. \y. (y, z) \ R \ y \ B))" +proof (intro iffI allI impI) + fix B + assume "wf_on A R" and "B \ A" and "B \ {}" + show "\z \ B. \y. (y, z) \ R \ y \ B" + using wf_onE_pf[OF \wf_on A R\ \B \ A\] \B \ {}\ by blast +next + assume ex_min: "\B\A. B \ {} \ (\z\B. \y. (y, z) \ R \ y \ B)" + show "wf_on A R " + proof (rule wf_onI_pf) + fix B + assume "B \ A" and "B \ R `` B" + have False if "B \ {}" + using ex_min[rule_format, OF \B \ A\ \B \ {}\] + using \B \ R `` B\ by blast + thus "B = {}" + by blast + qed +qed + +lemma wf_iff_ex_minimal: "wf R \ (\B. B \ {} \ (\z \ B. \y. (y, z) \ R \ y \ B))" + using wf_on_iff_ex_minimal[of UNIV, unfolded wf_on_UNIV, simplified] . + +lemma wfp_on_iff_ex_minimal: "wfp_on A R \ (\B \ A. B \ {} \ (\z \ B. \y. R y z \ y \ B))" + using wf_on_iff_ex_minimal[of A, to_pred] by simp + +lemma wfP_iff_ex_minimal: "wfP R \ (\B. B \ {} \ (\z \ B. \y. R y z \ y \ B))" + using wfp_on_iff_ex_minimal[of UNIV, unfolded wfp_on_UNIV, simplified] . + lemma wfE_min: assumes wf: "wf R" and Q: "x \ Q" obtains z where "z \ Q" "\y. (y, z) \ R \ y \ Q"