Section Subsume.
Variable A : Type.
Variable sub : A -> A -> Prop.
Variable sub_reflexive:
forall a,
sub a a.
Variable sub_transitive:
forall a1 a2 a3,
sub a1 a2 ->
sub a2 a3 ->
sub a1 a3.
(* Subsumption is first extended to options. *)
Definition osub (o1 o2 : option A) :=
forall a2,
o2 = Some a2 ->
exists a1,
o1 = Some a1 /\ sub a1 a2.
(* Then, it is extended pointwise to environments. *)
Definition subsume (e1 e2 : env A) :=
forall x,
osub (lookup x e1) (lookup x e2).
(* Subsumption of environments is reflexive and transitive. *)
(* Every environment subsumes the empty environment. *)
(* Extending two environments with a new variable preserves subsumption. *)
(* Applying a transformation [f] pointwise to two environments preserves environment subsumption, provided [f] preserves [sub]. *)

Lemma subsume_map:
forall f,
(forall a1 a2, sub a1 a2 -> sub (f a1) (f a2)) ->
forall e1 e2,
subsume e1 e2 ->
subsume (map f e1) (map f e2).