(** ** The bottom and top relations *)

Definition rel_bot {A B}: rel A B :=
  fun x y => False.Notation "⊥" := rel_bot : rel_scope.Definition rel_top {A B}: rel A B :=
  fun x y => True.Notation "⊤" := rel_top : rel_scope.(** ** Relation equivalence *)

Definition eqrel {A B}: rel (rel A B) (rel A B) :=
  (subrel /\ flip subrel)%rel.Global Instance eqrel_equivalence A B:
  Equivalence (@eqrel A B).Global Instance eqrel_subrel A B:
  Related (@eqrel A B) (@subrel A B) subrel.(** ** Relation composition *)

Definition rel_compose {A B C} (RAB: rel A B) (RBC: rel B C): rel A C :=
  fun x z => exists y, RAB x y /\ RBC y z.Global Instance rel_compose_params:
  Params (@rel_compose) 4.

Lemma rel_compose_assoc {A B C D} (RAB: rel A B) (RBC: rel B C) (RCD: rel C D): eqrel (rel_compose (rel_compose RAB RBC) RCD) (rel_compose RAB (rel_compose RBC RCD)).