End DupfreeLength.
(* * Cardinality *)
Section Cardinality.
Variable X : Type.
Context {eq_X_dec : eq_dec X}.
Implicit Types A B : list X.
Definition card (A : list X) : nat := |undup A|.

Lemma card_cons x A :
card (x::A) = if decision (x el A) then card A else 1 + card A.