(* ---------------------------------------------------------------------------- *)
(* [map] composes with itself. *)

(* Specifications: *)
Lemma map_map_fuse:
forall A B C (f : B -> C) (g : A -> B) h e,
(forall (d : A), f (g d) = h d) ->
map f (map g e) = map h e.
Lemma map_map_exchange:
forall A F G B (f1 : F -> B) (f2 : A -> F) (g1 : G -> B) (g2 : A -> G) e,
(forall (d : A), f1 (f2 d) = g1 (g2 d)) ->
map f1 (map f2 e) = map g1 (map g2 e).
Lemma map_lift_map_lift:
forall T k s wk ws (e : env T),
forall `{Lift T},
@LiftLift T _ ->
k <= s ->
map (lift wk k) (map (lift ws s) e) = map (lift ws (wk + s)) (map (lift wk k) e).
Lemma map_insert_map:
forall A (f g h : A -> A) x (a : A) e,
(forall a, f (g a) = g (h a)) ->
map f (insert x a (map g e)) =
insert x (f a) (map g (map h e)).
Lemma map_map_vanish:
forall A B (f : B -> A) (g : A -> B) (e : env A),
(forall x, f (g x) = x) ->
map f (map g e) = e.