(** *** Additional operations and their specification **)

(** [for_all] **)
Definition for_all {A : Type} (f : key -> A -> bool) dom (m : t A dom) :=
  fold (fun x v b => b && f x v) m true.

(* Specifications: *)
Lemma for_all_spec_aux : forall dom A f, Proper (X.eq ==> Logic.eq ==> Logic.eq) f -> forall (m : t A dom) l b, fold_left (fun acc xv => acc && f (fst xv) (snd xv)) l b = true <-> b = true ∧ (forall x (v : A), InA (X.eq * Logic.eq)%signature (x, v) l -> f x v = true).
Lemma for_all_spec : forall A f, Proper (X.eq ==> Logic.eq ==> Logic.eq) f -> forall dom (m : t A dom), for_all f m = true <-> forall x v, find x m = Some v -> f x v = true.