# HG changeset patch # User desharna # Date 1679179736 -3600 # Node ID 9b87709947800728cf49f3e9fb816c48d3322f2c # Parent 07e2cafcc97ed0963d246a70b023eb6afff34404# Parent 58b3913059fabb91095aec10b7a8801558b0ac1b merged diff -r 07e2cafcc97e -r 9b8770994780 NEWS --- a/NEWS Sat Mar 18 20:23:17 2023 +0100 +++ b/NEWS Sat Mar 18 23:48:56 2023 +0100 @@ -218,6 +218,7 @@ multeqp_code_iff_reflclp_multp multp_code_iff_multp multp_mono_strong + multp_repeat_mset_repeat_msetI total_mult total_on_mult totalp_multp diff -r 07e2cafcc97e -r 9b8770994780 src/HOL/Library/Multiset.thy --- a/src/HOL/Library/Multiset.thy Sat Mar 18 20:23:17 2023 +0100 +++ b/src/HOL/Library/Multiset.thy Sat Mar 18 23:48:56 2023 +0100 @@ -3192,6 +3192,33 @@ lemma subset_implies_multp: "A \# B \ multp r A B" by (rule subset_implies_mult[of _ _ "{(x, y). r x y}" for r, folded multp_def]) +lemma multp_repeat_mset_repeat_msetI: + assumes "transp R" and "multp R A B" and "n \ 0" + shows "multp R (repeat_mset n A) (repeat_mset n B)" +proof - + from \transp R\ \multp R A B\ obtain I J K where + "B = I + J" and "A = I + K" and "J \ {#}" and "\k \# K. \x \# J. R k x" + by (auto dest: multp_implies_one_step) + + have repeat_n_A_eq: "repeat_mset n A = repeat_mset n I + repeat_mset n K" + using \A = I + K\ by simp + + have repeat_n_B_eq: "repeat_mset n B = repeat_mset n I + repeat_mset n J" + using \B = I + J\ by simp + + show ?thesis + unfolding repeat_n_A_eq repeat_n_B_eq + proof (rule one_step_implies_multp) + from \n \ 0\ show "repeat_mset n J \ {#}" + using \J \ {#}\ + by (simp add: repeat_mset_eq_empty_iff) + next + show "\k \# repeat_mset n K. \j \# repeat_mset n J. R k j" + using \\k \# K. \x \# J. R k x\ + by (metis count_greater_zero_iff nat_0_less_mult_iff repeat_mset.rep_eq) + qed +qed + subsubsection \Monotonicity\