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.
Remark exists_for_all:
forall m f,
exists_ m f = negb (for_all m (fun x a => negb (f x a))).
Remark for_all_exists:
forall m f,
for_all m f = negb (exists_ m (fun x a => negb (f x a))).

Lemma for_all_false:
forall m f,
for_all m f = false <-> (exists x a, T.get x m = Some a /\ f x a = false).