Commit 8db5c86f authored by Robbert Krebbers's avatar Robbert Krebbers

More type class opacity for multisets.

parent fed72f20
...@@ -41,6 +41,10 @@ Section definitions. ...@@ -41,6 +41,10 @@ Section definitions.
let z := x - y in guard (0 < z); Some (pred z)) X Y. let z := x - y in guard (0 < z); Some (pred z)) X Y.
End definitions. End definitions.
Typeclasses Opaque gmultiset_elem_of gmultiset_subseteq.
Typeclasses Opaque gmultiset_elements gmultiset_size gmultiset_empty.
Typeclasses Opaque gmultiset_singleton gmultiset_union gmultiset_difference.
(** These instances are declared using [Hint Extern] to avoid too (** These instances are declared using [Hint Extern] to avoid too
eager type class search. *) eager type class search. *)
Hint Extern 1 (ElemOf _ (gmultiset _)) => Hint Extern 1 (ElemOf _ (gmultiset _)) =>
...@@ -94,10 +98,10 @@ Proof. ...@@ -94,10 +98,10 @@ Proof.
destruct (X !! _), (Y !! _); simplify_option_eq; omega. destruct (X !! _), (Y !! _); simplify_option_eq; omega.
Qed. Qed.
(* Collection *)
Lemma elem_of_multiplicity x X : x X 0 < multiplicity x X. Lemma elem_of_multiplicity x X : x X 0 < multiplicity x X.
Proof. done. Qed. Proof. done. Qed.
(* Algebraic laws *)
Global Instance gmultiset_simple_collection : SimpleCollection A (gmultiset A). Global Instance gmultiset_simple_collection : SimpleCollection A (gmultiset A).
Proof. Proof.
split. split.
...@@ -108,7 +112,10 @@ Proof. ...@@ -108,7 +112,10 @@ Proof.
by split; auto with lia. by split; auto with lia.
- intros X Y x. rewrite !elem_of_multiplicity, multiplicity_union. omega. - intros X Y x. rewrite !elem_of_multiplicity, multiplicity_union. omega.
Qed. Qed.
Global Instance gmultiset_elem_of_dec x X : Decision (x X).
Proof. unfold elem_of, gmultiset_elem_of. apply _. Defined.
(* Algebraic laws *)
Global Instance gmultiset_comm : Comm (@eq (gmultiset A)) (). Global Instance gmultiset_comm : Comm (@eq (gmultiset A)) ().
Proof. Proof.
intros X Y. apply gmultiset_eq; intros x. rewrite !multiplicity_union; omega. intros X Y. apply gmultiset_eq; intros x. rewrite !multiplicity_union; omega.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment