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.
Proof with auto.
induction l...
simpl.
destruct (p a)...
intros.
rewrite IHl...
Qed.
Proof with auto. induction l... simpl. intros. rewrite H... Qed.
Proof with auto with arith.
induction l...
simpl.
destruct (p a)...
Qed.
Proof with auto with arith.
induction x...
simpl.
destruct (f a).
simpl.
destruct (p a)...
destruct (p a)...
Qed.
Hint Resolve count_le.
Proof with auto with arith.
induction l; simpl; intros.
elimtype False...
inversion_clear H.
subst.
rewrite H0...
destruct (p a)...
Qed.
End count.
Hint Resolve @count_le.
Proof with auto.
induction l...
simpl.
intros.
inversion_clear H.
apply NoDup_cons...
Qed.
Proof with auto. intros. induction l... simpl. destruct (p a)... simpl... Qed.
Hint Resolve filter_preserves_incl.

Lemma In_inv_perm X (x: X) (l: list X):
In x l -> exists l', Permutation (x :: l') l.