Proof using A B C.
induction l as [| b' l']; simpl in *; auto.
- intros. intuition.
rewrite IHl'; auto.
Qed.

Lemma fold_left_for_each_in :
forall (f : A -> B -> A) (g : A -> B -> C) (B_eq_dec : forall x y : B, {x = y} + {x <> y}),
(forall a b b',
b <> b' ->
g (f a b') b = g a b) ->
forall l a b,
In b l ->
exists a',
g (fold_left f l a) b = g (f a' b) b.