Set Implicit Arguments.
Unset Standard Proposition Elimination Names.
Require Export List.
Program Omega Factorial
Bool util Morphisms Relations RelationClasses Permutation.
Hint Resolve
in_map Permutation_refl.
Hint Constructors NoDup.
Hint Constructors
NoDup Permutation.
Arguments length {A}.
Arguments Permutation {A}.
Arguments map {A B}.
Arguments tail {A}.
Section count.
Context {X: Type} (p: X -> bool).
Fixpoint count (l: list X): nat :=
match l with
| nil => 0
| h :: t => if p h then S (count t) else count t
end.

Lemma count_app l l': count (l ++ l') = count l + count l'.
Proof with auto.