# HG changeset patch # User desharna # Date 1670255037 -3600 # Node ID 595261b3d03341e4e1df5bbaa59959b876698568 # Parent d6a2a8bc40e17115e0fcb230ead31f67a5ffafcc# Parent df6ba3cf7874da470692e84d40f8fb7dd5d10d09 merged diff -r d6a2a8bc40e1 -r 595261b3d033 NEWS --- a/NEWS Mon Dec 05 15:19:52 2022 +0100 +++ b/NEWS Mon Dec 05 16:43:57 2022 +0100 @@ -26,14 +26,23 @@ Minor INCOMPATIBILITY. * Theory "HOL.Relation": + - Added predicates irrefl_on and irreflp_on and redefined irrefl and + irreflp to be abbreviations. Lemmas irrefl_def and irreflp_def are + explicitly provided for backward compatibility but their usage is + discouraged. Minor INCOMPATIBILITY. - Strengthened (and renamed) lemmas. Minor INCOMPATIBILITY. total_on_singleton reflp_equality[simp] ~> reflp_on_equality[simp] - Added lemmas. antisym_if_asymp antisymp_if_asymp - irreflD - irreflpD + irrefl_onD + irrefl_onI + irrefl_on_subset + irreflp_onD + irreflp_onI + irreflp_on_irrefl_on_eq[pred_set_conv] + irreflp_on_subset linorder.totalp_on_ge[simp] linorder.totalp_on_greater[simp] linorder.totalp_on_le[simp] diff -r d6a2a8bc40e1 -r 595261b3d033 src/HOL/Relation.thy --- a/src/HOL/Relation.thy Mon Dec 05 15:19:52 2022 +0100 +++ b/src/HOL/Relation.thy Mon Dec 05 16:43:57 2022 +0100 @@ -1,6 +1,7 @@ (* Title: HOL/Relation.thy Author: Lawrence C Paulson, Cambridge University Computer Laboratory Author: Stefan Berghofer, TU Muenchen + Author: Martin Desharnais, MPI-INF Saarbruecken *) section \Relations -- as sets of pairs, and binary predicates\ @@ -265,29 +266,65 @@ subsubsection \Irreflexivity\ -definition irrefl :: "'a rel \ bool" - where "irrefl r \ (\a. (a, a) \ r)" +definition irrefl_on :: "'a set \ 'a rel \ bool" where + "irrefl_on A r \ (\a \ A. (a, a) \ r)" + +abbreviation irrefl :: "'a rel \ bool" where + "irrefl \ irrefl_on UNIV" + +definition irreflp_on :: "'a set \ ('a \ 'a \ bool) \ bool" where + "irreflp_on A R \ (\a \ A. \ R a a)" -definition irreflp :: "('a \ 'a \ bool) \ bool" - where "irreflp R \ (\a. \ R a a)" +abbreviation irreflp :: "('a \ 'a \ bool) \ bool" where + "irreflp \ irreflp_on UNIV" + +lemma irrefl_def[no_atp]: "irrefl r \ (\a. (a, a) \ r)" + by (simp add: irrefl_on_def) + +lemma irreflp_def[no_atp]: "irreflp R \ (\a. \ R a a)" + by (simp add: irreflp_on_def) + +text \@{thm [source] irrefl_def} and @{thm [source] irreflp_def} are for backward compatibility.\ -lemma irreflp_irrefl_eq [pred_set_conv]: "irreflp (\a b. (a, b) \ R) \ irrefl R" - by (simp add: irrefl_def irreflp_def) +lemma irreflp_on_irrefl_on_eq [pred_set_conv]: "irreflp_on A (\a b. (a, b) \ r) \ irrefl_on A r" + by (simp add: irrefl_on_def irreflp_on_def) + +lemmas irreflp_irrefl_eq = irreflp_on_irrefl_on_eq[of UNIV] + +lemma irrefl_onI: "(\a. a \ A \ (a, a) \ r) \ irrefl_on A r" + by (simp add: irrefl_on_def) -lemma irreflI [intro?]: "(\a. (a, a) \ R) \ irrefl R" - by (simp add: irrefl_def) +lemma irreflI[intro?]: "(\a. (a, a) \ r) \ irrefl r" + by (rule irrefl_onI[of UNIV, simplified]) + +lemma irreflp_onI: "(\a. a \ A \ \ R a a) \ irreflp_on A R" + by (simp add: irreflp_on_def) -lemma irreflpI [intro?]: "(\a. \ R a a) \ irreflp R" - by (fact irreflI [to_pred]) +lemma irreflpI[intro?]: "(\a. \ R a a) \ irreflp R" + by (rule irreflp_onI[of UNIV, simplified]) + +lemma irrefl_onD: "irrefl_on A r \ a \ A \ (a, a) \ r" + by (simp add: irrefl_on_def) lemma irreflD: "irrefl r \ (x, x) \ r" - unfolding irrefl_def by simp + by (rule irrefl_onD[of UNIV, simplified]) + +lemma irreflp_onD: "irreflp_on A R \ a \ A \ \ R a a" + by (simp add: irreflp_on_def) lemma irreflpD: "irreflp R \ \ R x x" - unfolding irreflp_def by simp + by (rule irreflp_onD[of UNIV, simplified]) + +lemma irrefl_on_distinct [code]: "irrefl_on A r \ (\(a, b) \ r. a \ A \ b \ A \ a \ b)" + by (auto simp add: irrefl_on_def) -lemma irrefl_distinct [code]: "irrefl r \ (\(a, b) \ r. a \ b)" - by (auto simp add: irrefl_def) +lemmas irrefl_distinct = irrefl_on_distinct \ \For backward compatibility\ + +lemma irrefl_on_subset: "irrefl_on A r \ B \ A \ irrefl_on B r" + by (auto simp: irrefl_on_def) + +lemma irreflp_on_subset: "irreflp_on A R \ B \ A \ irreflp_on B R" + by (auto simp: irreflp_on_def) lemma (in preorder) irreflp_less[simp]: "irreflp (<)" by (simp add: irreflpI) diff -r d6a2a8bc40e1 -r 595261b3d033 src/HOL/Wellfounded.thy --- a/src/HOL/Wellfounded.thy Mon Dec 05 15:19:52 2022 +0100 +++ b/src/HOL/Wellfounded.thy Mon Dec 05 16:43:57 2022 +0100 @@ -75,7 +75,7 @@ using wf_irrefl [OF assms] by (auto simp add: irrefl_def) lemma wfP_imp_irreflp: "wfP r \ irreflp r" - by (rule wf_imp_irrefl[to_pred]) + by (rule wf_imp_irrefl[to_pred, folded top_set_def]) lemma wf_wellorderI: assumes wf: "wf {(x::'a::ord, y). x < y}"