intro l; induction l ; firstorder.
Qed.
Next Obligation.
intro l.
fold pointwise_lifting.
induction l as [|T l IHl].
- firstorder.
- intros x y z H H0 x0. pose (IHl (x x0) (y x0) (z x0)).
firstorder.
Qed.
#[global]
Program Instance predicate_implication_preorder {l} :
PreOrder (@predicate_implication l).
Next Obligation.
intro l; induction l ; firstorder.
Qed.
Next Obligation.
intro l.
induction l as [|T l IHl].
- firstorder.
- intros x y z H H0 x0. pose (IHl (x x0) (y x0) (z x0)). firstorder.
Qed.
(** We define the various operations which define the algebra on binary relations, from the general ones. *)
Section Binary.
Context {A : Type}.
Definition relation_equivalence : relation (relation A) :=
@predicate_equivalence (_::_::Tnil).
Global Instance relation_equivalence_rewrite_relation: RewriteRelation relation_equivalence := {}.
Definition relation_conjunction (R : relation A) (R' : relation A) : relation A :=
@predicate_intersection (A::A::Tnil) R R'.
Definition relation_disjunction (R : relation A) (R' : relation A) : relation A :=
@predicate_union (A::A::Tnil) R R'.
(** Relation equivalence is an equivalence, and subrelation defines a partial order. *)
Global Instance relation_equivalence_equivalence :
Equivalence relation_equivalence.

(* Specifications: *)
Lemma PartialOrder_inverse `(PartialOrder eqA R) : PartialOrder eqA (flip R).
Global Typeclasses Opaque arrows predicate_implication predicate_equivalence
relation_equivalence pointwise_lifting.