# HG changeset patch # User desharna # Date 1676748849 -3600 # Node ID 3a2670c37e5c26c6def0e89a9cd4835c5babc3e8 # Parent 8543e6b10a569d38bdc3463ca253664ded927fb1 added lemmas asymp_not_liftable_to_multpHO and asymp_multpHO diff -r 8543e6b10a56 -r 3a2670c37e5c NEWS --- a/NEWS Sat Feb 18 18:10:05 2023 +0000 +++ b/NEWS Sat Feb 18 20:34:09 2023 +0100 @@ -216,6 +216,8 @@ * Theory "HOL-Library.Multiset_Order": - Added lemmas. + asymp_multpHO + asymp_not_liftable_to_multpHO irreflp_on_multpHO[simp] multpHO_plus_plus[simp] totalp_multpDM diff -r 8543e6b10a56 -r 3a2670c37e5c src/HOL/Library/Multiset_Order.thy --- a/src/HOL/Library/Multiset_Order.thy Sat Feb 18 18:10:05 2023 +0000 +++ b/src/HOL/Library/Multiset_Order.thy Sat Feb 18 20:34:09 2023 +0100 @@ -147,6 +147,48 @@ lemma irreflp_on_multp\<^sub>H\<^sub>O[simp]: "irreflp_on B (multp\<^sub>H\<^sub>O R)" by (simp add: irreflp_onI multp\<^sub>H\<^sub>O_def) +text \The following lemma is a negative result stating that asymmetry of an arbitrary binary +relation cannot be simply lifted to @{const multp\<^sub>H\<^sub>O}. It suffices to have four distinct values to +build a counterexample.\ + +lemma asymp_not_liftable_to_multp\<^sub>H\<^sub>O: + fixes a b c d :: 'a + assumes "distinct [a, b, c, d]" + shows "\ (\(R :: 'a \ 'a \ bool). asymp R \ asymp (multp\<^sub>H\<^sub>O R))" +proof - + define R :: "'a \ 'a \ bool" where + "R = (\x y. x = a \ y = c \ x = b \ y = d \ x = c \ y = b \ x = d \ y = a)" + + from assms(1) have "{#a, b#} \ {#c, d#}" + by (metis add_mset_add_single distinct.simps(2) list.set(1) list.simps(15) multi_member_this + set_mset_add_mset_insert set_mset_single) + + from assms(1) have "asymp R" + by (auto simp: R_def intro: asymp_onI) + moreover have "\ asymp (multp\<^sub>H\<^sub>O R)" + unfolding asymp_on_def Set.ball_simps not_all not_imp not_not + proof (intro exI conjI) + show "multp\<^sub>H\<^sub>O R {#a, b#} {#c, d#}" + unfolding multp\<^sub>H\<^sub>O_def + using \{#a, b#} \ {#c, d#}\ R_def assms by auto + next + show "multp\<^sub>H\<^sub>O R {#c, d#} {#a, b#}" + unfolding multp\<^sub>H\<^sub>O_def + using \{#a, b#} \ {#c, d#}\ R_def assms by auto + qed + ultimately show ?thesis + unfolding not_all not_imp by auto +qed + +text \However, if the binary relation is both asymmetric and transitive, then @{const multp\<^sub>H\<^sub>O} is +also asymmetric.\ + +lemma asymp_multp\<^sub>H\<^sub>O: + assumes "asymp R" and "transp R" + shows "asymp (multp\<^sub>H\<^sub>O R)" + using assms + by (metis asymp_on_iff_irreflp_on_if_transp_on irreflp_multp multp_eq_multp\<^sub>H\<^sub>O transp_multp) + lemma totalp_on_multp\<^sub>D\<^sub>M: "totalp_on A R \ (\M. M \ B \ set_mset M \ A) \ totalp_on B (multp\<^sub>D\<^sub>M R)" by (smt (verit, ccfv_SIG) count_inI in_mono multp\<^sub>H\<^sub>O_def multp\<^sub>H\<^sub>O_imp_multp\<^sub>D\<^sub>M not_less_iff_gr_or_eq