(*****************)
(** ** Remove    *)
(*****************)
Fixpoint remove (x : A) (l : list A) : list A :=
match l with
| [] => []
| y::tl => if (eq_dec x y) then remove x tl else y :: remove x tl
end.

Lemma remove_length_lt : forall l x, In x l -> length (remove x l) < length l.
Fixpoint count_occ (l : list A) (x : A) : nat :=
match l with
| [] => 0
| y :: tl =>
let n := count_occ tl x in
if eq_dec y x then S n else n
end.