# HG changeset patch # User desharna # Date 1710657912 -3600 # Node ID 87a04ce7e3c39e0658540b230c12efea9fdde9bd # Parent d0205dde00bb7c7d4071506776ed50a0df3d4d63# Parent cfeb3a8f241d72b300b61362313f5c6e4cb9dbfa merged diff -r cfeb3a8f241d -r 87a04ce7e3c3 NEWS --- a/NEWS Sat Mar 16 21:22:02 2024 +0100 +++ b/NEWS Sun Mar 17 07:45:12 2024 +0100 @@ -94,6 +94,16 @@ tranclp_less[simp] tranclp_less_eq[simp] +* Theory "HOL.Wellfounded": + - Added definitions wf_on and wfp_on as restricted versions versions of + wf and wfP respectively. + - Added lemmas. + wf_on_UNIV + wf_on_induct + wfp_on_UNIV + wfp_on_induct + wfp_on_wf_on_eq + * Theory "HOL-Library.Multiset": - Added lemmas. trans_on_mult diff -r cfeb3a8f241d -r 87a04ce7e3c3 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Sat Mar 16 21:22:02 2024 +0100 +++ b/src/HOL/Wellfounded.thy Sun Mar 17 07:45:12 2024 +0100 @@ -14,15 +14,61 @@ subsection \Basic Definitions\ +definition wf_on :: "'a set \ 'a rel \ bool" + where "wf_on A r \ (\P. (\x \ A. (\y \ A. (y, x) \ r \ P y) \ P x) \ (\x \ A. P x))" + definition wf :: "('a \ 'a) set \ bool" where "wf r \ (\P. (\x. (\y. (y, x) \ r \ P y) \ P x) \ (\x. P x))" +definition wfp_on :: "'a set \ ('a \ 'a \ bool) \ bool" where + "wfp_on A R \ (\P. (\x \ A. (\y \ A. R y x \ P y) \ P x) \ (\x \ A. P x))" + definition wfP :: "('a \ 'a \ bool) \ bool" where "wfP r \ wf {(x, y). r x y}" + +subsection \Equivalence of Definitions\ + +lemma wf_on_UNIV: "wf_on UNIV r \ wf r" + by (simp add: wf_on_def wf_def) + +lemma wfp_on_UNIV: "wfp_on UNIV R \ wfP R" + by (simp add: wfp_on_def wfP_def wf_def) + +lemma wfp_on_wf_on_eq[pred_set_conv]: "wfp_on A (\x y. (x, y) \ r) \ wf_on A r" + by (simp add: wfp_on_def wf_on_def) + lemma wfP_wf_eq [pred_set_conv]: "wfP (\x y. (x, y) \ r) = wf r" by (simp add: wfP_def) + +subsection \Induction Principles\ + +lemma wf_on_induct[consumes 2, case_names less, induct set: wf]: + 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]) + +lemma wfp_on_induct[consumes 2, case_names less, induct pred: wfp_on]: + assumes "wfp_on A r" and "x \ A" and "\x. x \ A \ (\y. y \ A \ r y x \ P y) \ P x" + shows "P x" + using assms by (fact wf_on_induct[to_pred]) + +lemma wf_induct: + assumes "wf r" + and "\x. \y. (y, x) \ r \ P y \ P x" + shows "P a" + using assms by (auto simp: wf_on_UNIV intro: wf_on_induct[of UNIV]) + +lemmas wfP_induct = wf_induct [to_pred] + +lemmas wf_induct_rule = wf_induct [rule_format, consumes 1, case_names less, induct set: wf] + +lemmas wfP_induct_rule = wf_induct_rule [to_pred, induct set: wfP] + + +subsection \Introduction Rules\ + lemma wfUNIVI: "(\P x. (\x. (\y. (y, x) \ r \ P y) \ P x) \ P x) \ wf r" unfolding wf_def by blast @@ -36,17 +82,8 @@ shows "wf r" using assms unfolding wf_def by blast -lemma wf_induct: - assumes "wf r" - and "\x. \y. (y, x) \ r \ P y \ P x" - shows "P a" - using assms unfolding wf_def by blast -lemmas wfP_induct = wf_induct [to_pred] - -lemmas wf_induct_rule = wf_induct [rule_format, consumes 1, case_names less, induct set: wf] - -lemmas wfP_induct_rule = wf_induct_rule [to_pred, induct set: wfP] +subsection \Ordering Properties\ lemma wf_not_sym: "wf r \ (a, x) \ r \ (x, a) \ r" by (induct a arbitrary: x set: wf) blast