equal
deleted
inserted
replaced
216 "{#a#} = M + N \<longleftrightarrow> {#a#} = M \<and> N = {#} \<or> M = {#} \<and> {#a#} = N" |
216 "{#a#} = M + N \<longleftrightarrow> {#a#} = M \<and> N = {#} \<or> M = {#} \<and> {#a#} = N" |
217 by (auto simp add: eq_commute [of "{#a#}" "M + N"] union_is_single) |
217 by (auto simp add: eq_commute [of "{#a#}" "M + N"] union_is_single) |
218 |
218 |
219 lemma add_eq_conv_diff: |
219 lemma add_eq_conv_diff: |
220 "M + {#a#} = N + {#b#} \<longleftrightarrow> M = N \<and> a = b \<or> M = N - {#a#} + {#b#} \<and> N = M - {#b#} + {#a#}" (is "?lhs = ?rhs") |
220 "M + {#a#} = N + {#b#} \<longleftrightarrow> M = N \<and> a = b \<or> M = N - {#a#} + {#b#} \<and> N = M - {#b#} + {#a#}" (is "?lhs = ?rhs") |
221 (* shorter: by (simp add: multiset_eq_iff) fastsimp *) |
221 (* shorter: by (simp add: multiset_eq_iff) fastforce *) |
222 proof |
222 proof |
223 assume ?rhs then show ?lhs |
223 assume ?rhs then show ?lhs |
224 by (auto simp add: add_assoc add_commute [of "{#b#}"]) |
224 by (auto simp add: add_assoc add_commute [of "{#b#}"]) |
225 (drule sym, simp add: add_assoc [symmetric]) |
225 (drule sym, simp add: add_assoc [symmetric]) |
226 next |
226 next |