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. *)

Lemma subsume_insert_inversion:
forall e1 x a2 e2,
subsume e1 (insert x a2 e2) ->
exists f1 a1,
e1 = insert x a1 f1 /\
subsume f1 e2 /\
sub a1 a2.