Hint Resolve defined_implies_below_length agree_below agree_empty_left
agree_empty_right agree_insert : agree.
(* ---------------------------------------------------------------------------- *)
(* A definition of when an environment subsumes another, up to a notion of subsumption on environment entries. *)
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.

(* Specifications: *)
Lemma osub_None:
forall o,
osub o None.
Lemma osub_Some_Some:
forall a1 a2,
sub a1 a2 ->
osub (Some a1) (Some a2).
Lemma osub_None_Some:
forall a2,
osub None (Some a2) ->
False.
Lemma osub_Some_inversion:
forall o1 a2,
osub o1 (Some a2) ->
exists a1,
o1 = Some a1 /\ sub a1 a2.