Fixpoint remove_aux {A} (A_eqb : A -> A -> bool) (lst : list A) (x : A) : list A :=
match lst with
| [] => []
| h :: t =>
if A_eqb h x then t else h :: remove_aux A_eqb t x
end.

Lemma remove_aux_iff {A} `{EqDec A} : forall lst a a',
NoDup lst ->
In a' (remove_aux eqb lst a) <-> In a' lst /\ a' <> a.