(** * The [option_le] relator *)
Inductive option_le {A1 A2} (RA: rel A1 A2): rel (option A1) (option A2) :=
| Some_le_def x y: RA x y -> option_le RA (Some x) (Some y)
| None_le_def y: option_le RA None y.
Global Instance Some_le:
Monotonic (@Some) (forallr R @ A1 A2 : rel, R ++> option_le R).
Hint Extern 0 (RIntro _ (option_le _) None _) =>
eapply None_le : typeclass_instances.
Global Instance option_le_subrel A B:
Monotonic (@option_le A B) (subrel ++> subrel).
Global Instance option_le_subrel_params:
Params (@option_le) 3.
Defined.
Global Instance option_le_rel {A B}:
Related (@option_rel A B) (@option_le A B) (subrel ++> subrel) | 10.
Hint Extern 1 (Reflexive (option_le ?R)) =>
eapply option_le_refl : typeclass_instances.
Hint Extern 1 (Transitive (option_le ?R)) =>
eapply option_le_trans : typeclass_instances.
Global Instance option_map_le:
Monotonic
(@option_map)
(forallr RA, forallr RB, (RA ++> RB) ++> option_le RA ++> option_le RB).
(** * The [option_ge] relator *)
Inductive option_ge {A1 A2} (RA: rel A1 A2): rel (option A1) (option A2) :=
| Some_ge_def x y: RA x y -> option_ge RA (Some x) (Some y)
| None_ge_def x: option_ge RA x None.
Global Instance Some_ge:
Monotonic (@Some) (forallr R @ A1 A2 : rel, R ++> option_ge R).

Lemma None_ge {A B} R x:
RIntro True (@option_ge A B R) x None.