End Equi.
(* * Filter *)
Definition filter (X : Type) (p : X -> Prop) (p_dec : forall x, dec (p x)) : list X -> list X :=
fix f A := match A with
| nil => nil
| x::A' => if decision (p x) then x :: f A' else f A'
end.
Arguments filter {X} p {p_dec} A.
Section FilterLemmas.
Variable X : Type.
Variable p : X -> Prop.
Context {p_dec : forall x, dec (p x)}.

Lemma filter_fst x A :
p x -> filter p (x::A) = x::filter p A.