(** [fold_rec_weak] is a weaker principle than [fold_rec_bis] : the step hypothesis must here be applicable anywhere. At the same time, it looks more like an induction principle, and hence can be easier to use. *)

(* Specifications: *)
Lemma fold_rec_weak :
forall (A:Type)(P : t elt -> A -> Type)(f : key -> elt -> A -> A)(i:A),
(forall m m' a, Equal m m' -> P m a -> P m' a) ->
P (empty _) i ->
(forall k e a m, ~In k m -> P m a -> P (add k e m) (f k e a)) ->
forall m, P m (fold f m i).
Lemma fold_rel :
forall (A B:Type)(R : A -> B -> Type)
(f : key -> elt -> A -> A)(g : key -> elt -> B -> B)(i : A)(j : B)
(m : t elt),
R i j ->
(forall k e a b, MapsTo k e m -> R a b -> R (f k e a) (g k e b)) ->
R (fold f m i) (fold g m j).