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_cons:
forall o e1 e2,
osub o (lookup 0 e2) ->
subsume e1 (tl e2) ->
subsume (o :: e1) e2.