Proof using A_eq_dec.
intros until l.
induction l.
- auto.
- simpl; intros.
destruct (A_eq_dec x (g a)); subst.
+ right; exists a; tauto.
+ find_apply_lem_hyp IHl.
break_or_hyp; [left|right].
* find_apply_lem_hyp In_cons_neq; tauto.
* break_exists_exists; tauto.
Qed.

Lemma fold_left_for_each_not_in :
forall (f : A -> B -> A) (g : A -> B -> C),
(forall a b b',
b <> b' ->
g (f a b') b = g a b) ->
forall l a b,
~ In b l ->
g (fold_left f l a) b = g a b.