Section FORALL_EXISTS.
Variable A: Type.
Definition for_all (m: T.t A) (f: T.elt -> A -> bool) : bool :=
T.fold (fun b x a => b && f x a) m true.
Definition exists_ (m: T.t A) (f: T.elt -> A -> bool) : bool :=
T.fold (fun b x a => b || f x a) m false.

Lemma exists_correct:
forall m f,
exists_ m f = true <-> (exists x a, T.get x m = Some a /\ f x a = true).