diff --git a/tests/multiset_solver.v b/tests/multiset_solver.v index a52397cf5059a6fca1c4e3b2cbe491aad62b74ce..24f3106c967e04f0589575dc89b5658f1dbc9b28 100644 --- a/tests/multiset_solver.v +++ b/tests/multiset_solver.v @@ -15,4 +15,6 @@ Section test. {[z]} ⊎ X = {[y]} ⊎ Y → {[x]} ⊎ ({[z]} ⊎ X) = {[y]} ⊎ ({[x]} ⊎ Y). Proof. multiset_solver. Qed. + Lemma test5 X x : X ⊎ ∅ = {[x]} → X ⊎ ∅ ≠@{gmultiset A} ∅. + Proof. multiset_solver. Qed. End test. diff --git a/theories/gmultiset.v b/theories/gmultiset.v index 177069a1c48a9f093c224842efa5ab5408e1e988..736980c18f06b4069698847bdff28e1ecdf7a982 100644 --- a/theories/gmultiset.v +++ b/theories/gmultiset.v @@ -163,8 +163,9 @@ singleton [{[ y ]}] since the singleton receives special treatment in step (3). Step (3) is achieved using the tactic [multiset_instantiate], which instantiates universally quantified hypotheses [H : ∀ x : A, P x] in two ways: -- If [P] contains a multiset singleton [{[ y ]}] it creates the hypothesis [H y]. -- If the goal contains [multiplicity y X] it creates the hypothesis [H y]. +- If [P] contains a multiset singleton [{[ y ]}] it adds the hypothesis [H y]. +- If the goal or some hypothesis contains [multiplicity y X] it adds the + hypothesis [H y]. *) Class MultisetUnfold `{Countable A} (x : A) (X : gmultiset A) (n : nat) := { multiset_unfold : multiplicity x X = n }. @@ -233,6 +234,10 @@ Ltac multiset_instantiate := already exists. *) unify y e'; unless (P y) by assumption; pose proof (H y) end + | H : (∀ x : ?A, @?P x), _ : context [multiplicity ?y _] |- _ => + (* Use [unless] to avoid creating a new hypothesis [H y : P y] if [P y] + already exists. *) + unless (P y) by assumption; pose proof (H y) | H : (∀ x : ?A, @?P x) |- context [multiplicity ?y _] => (* Use [unless] to avoid creating a new hypothesis [H y : P y] if [P y] already exists. *)