(** Counting occurrences by filtering *)

    Definition count_occ' (l : list A) (x : A) : nat :=
      length (filter (fun y => if eq_dec y x then true else false) l).

(* Specifications: *)
Lemma count_occ_alt (l : list A) (x : A) : count_occ' l x = count_occ eq_dec l x.