Module Argument.
Local Notation "p ≃ q" := (poly_eq p q) (at level 65).
Local Notation "A ≡ B" := (mset_eq A B) (at level 65).
Definition encode_msetc (c : msetc) : polyc :=
match c with
| msetc_zero x => polyc_one x
| msetc_sum x y z => polyc_sum x y z
| msetc_h x y => polyc_prod x y
end.
(* count the number of occurrences of each element *)
Fixpoint mset_to_poly (A: list nat) :=
match A with
| [] => []
| a :: A => poly_add (repeat 0 a ++ [1]) (mset_to_poly A)
end.
Fixpoint poly_to_mset (p: list nat) :=
match p with
| [] => []
| a :: p => (repeat 0 a) ++ map S (poly_to_mset p)
end.

Lemma poly_to_mset_eqI {p q} : p ≃ q -> poly_to_mset p ≡ poly_to_mset q.