# HG changeset patch # User desharna # Date 1742074949 -3600 # Node ID d804c8e78ed36f36800b117eb89403a685140d0e # Parent a01ea04aa58f0d0e55dddcba3ce40ef7fb7e8b76 added lemmas totalp_on_mono[mono], totalp_on_mono_strong, totalp_on_mono_stronger, totalp_on_mono_stronger_alt diff -r a01ea04aa58f -r d804c8e78ed3 NEWS --- a/NEWS Sat Mar 15 20:33:19 2025 +0100 +++ b/NEWS Sat Mar 15 22:42:29 2025 +0100 @@ -31,6 +31,10 @@ left_unique_iff_Uniq reflp_on_refl_on_eq[pred_set_conv] symp_on_equality[simp] + totalp_on_mono[mono] + totalp_on_mono_strong + totalp_on_mono_stronger + totalp_on_mono_stronger_alt * Theory "HOL.Wellfounded": - Added lemmas. diff -r a01ea04aa58f -r d804c8e78ed3 src/HOL/Relation.thy --- a/src/HOL/Relation.thy Sat Mar 15 20:33:19 2025 +0100 +++ b/src/HOL/Relation.thy Sat Mar 15 22:42:29 2025 +0100 @@ -788,11 +788,59 @@ lemma totalpD: "totalp R \ x \ y \ R x y \ R y x" by (simp add: totalp_onD) +lemma totalp_on_mono_stronger: + fixes + A :: "'a set" and R :: "'a \ 'a \ bool" and + B :: "'b set" and Q :: "'b \ 'b \ bool" and + f :: "'a \ 'b" + assumes "totalp_on B Q" and "f ` A \ B" and + Q_imp_R: "\x y. x \ A \ y \ A \ Q (f x) (f y) \ R x y" and + inj_f: "inj_on f A" + shows "totalp_on A R" +proof (rule totalp_onI) + fix x y :: 'a + assume "x \ A" and "y \ A" and "x \ y" + hence "f x \ B" and "f y \ B" and "f x \ f y" + using \f ` A \ B\ inj_f by (auto dest: inj_onD) + hence "Q (f x) (f y) \ Q (f y) (f x)" + using \totalp_on B Q\ by (iprover dest: totalp_onD) + thus "R x y \ R y x" + using Q_imp_R \x \ A\ \y \ A\ by iprover +qed + +lemma totalp_on_mono_stronger_alt: + fixes + A :: "'a set" and R :: "'a \ 'a \ bool" and + B :: "'b set" and Q :: "'b \ 'b \ bool" and + f :: "'b \ 'a" + assumes "totalp_on B Q" and "A \ f ` B" and + Q_imp_R: "\x y. x \ B \ y \ B \ Q x y \ R (f x) (f y)" + shows "totalp_on A R" +proof (rule totalp_onI) + fix x y :: 'a + assume "x \ A" and "y \ A" and "x \ y" + then obtain x' y' where "x' \ B" and "x = f x'" and "y' \ B" and "y = f y'" and "x' \ y'" + using \A \ f ` B\ by blast + hence "Q x' y' \ Q y' x'" + using \totalp_on B Q\[THEN totalp_onD] by blast + hence "R (f x') (f y') \ R (f y') (f x')" + using Q_imp_R \x' \ B\ \y' \ B\ by blast + thus "R x y \ R y x" + using \x = f x'\ \y = f y'\ by blast +qed + +lemma totalp_on_mono_strong: + "totalp_on B Q \ A \ B \ (\x y. x \ A \ y \ A \ Q x y \ R x y) \ totalp_on A R" + using totalp_on_mono_stronger[of B Q "\x. x" A R, simplified] . + +lemma totalp_on_mono[mono]: "A \ B \ Q \ R \ totalp_on B Q \ totalp_on A R" + by (auto intro: totalp_on_mono_strong) + lemma total_on_subset: "total_on A r \ B \ A \ total_on B r" by (auto simp: total_on_def) lemma totalp_on_subset: "totalp_on A R \ B \ A \ totalp_on B R" - by (auto intro: totalp_onI dest: totalp_onD) + using totalp_on_mono_strong . lemma totalp_on_image: assumes "inj_on f A"