A few standard constructions to work with indexed relations.
From OGS Require Import Prelude. From OGS.Utils Require Import Psh. From Coq.Classes Require Export RelationClasses. From Coinduction Require Export lattice. #[export] Existing Instance CompleteLattice_dfun. #[global] Notation "∀ₕ x , R" := (forall_relation (fun x => R%signature)) (x binder, at level 60). Notation relᵢ A B := (forall i, A i -> B i -> Prop). #[global] Notation Reflexiveᵢ R := (forall i, Reflexive (R i)). #[global] Notation Symmetricᵢ R := (forall i, Symmetric (R i)). #[global] Notation Transitiveᵢ R := (forall i, Transitive (R i)). #[global] Notation Equivalenceᵢ R := (forall i, Equivalence (R i)). #[global] Notation Subrelationᵢ R S := (forall i, subrelation (R i) (S i)). #[global] Notation PreOrderᵢ R := (forall i, PreOrder (R i)). Definition eqᵢ {I} (X : psh I) : relᵢ X X := fun _ x y => x = y. Arguments eqᵢ _ _ _ /.I: Type
X: psh IReflexiveᵢ (eqᵢ X)intros ? ?; reflexivity. Qed.I: Type
X: psh IReflexiveᵢ (eqᵢ X)I: Type
X: psh ISymmetricᵢ (eqᵢ X)intros ? ? ? ?; now symmetry. Qed.I: Type
X: psh ISymmetricᵢ (eqᵢ X)I: Type
X: psh ITransitiveᵢ (eqᵢ X)intros i x y z a b; now transitivity y. Qed. Variant sumᵣ {I} {X1 X2 Y1 Y2 : psh I} (R : relᵢ X1 X2) (S : relᵢ Y1 Y2) : relᵢ (X1 +ᵢ Y1) (X2 +ᵢ Y2) := | RLeft {i x1 x2} : R i x1 x2 -> sumᵣ R S i (inl x1) (inl x2) | RRight {i y1 y2} : S i y1 y2 -> sumᵣ R S i (inr y1) (inr y2) . #[global] Hint Constructors sumᵣ : core.I: Type
X: psh ITransitiveᵢ (eqᵢ X)I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ SEquivalenceᵢ (sumᵣ R S)I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: IReflexive (sumᵣ R S i)I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: ISymmetric (sumᵣ R S i)I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: ITransitive (sumᵣ R S i)intros []; eauto.I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: IReflexive (sumᵣ R S i)intros ? ? []; econstructor; symmetry; eauto.I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: ISymmetric (sumᵣ R S i)I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: ITransitive (sumᵣ R S i)dependent destruction H1; dependent destruction H2; econstructor; etransitivity; eauto. Qed. Definition seqᵢ {I} {X Y Z : psh I} (R0 : relᵢ X Y) (R1 : relᵢ Y Z) : relᵢ X Z := fun i x z => exists y, R0 i x y /\ R1 i y z. #[global] Infix "⨟" := (seqᵢ) (at level 120). #[global] Notation "u ⨟⨟ v" := (ex_intro _ _ (conj u v)) (at level 70). #[global] Hint Unfold seqᵢ : core.I: Type
X, Y: psh I
R: relᵢ X X
H: Equivalenceᵢ R
S: relᵢ Y Y
H0: Equivalenceᵢ S
i: I
x, y, z: (X +ᵢ Y) i
H1: sumᵣ R S i x y
H2: sumᵣ R S i y zsumᵣ R S i x zI: Type
X, Y, Z: psh IProper (leq ==> leq ==> leq) seqᵢI: Type
X, Y, Z: psh IProper (leq ==> leq ==> leq) seqᵢI: Type
X, Y, Z: psh I
x, y: relᵢ X Y
H1: x <= y
x0, y0: relᵢ Y Z
H2: x0 <= y0
a: I
a0: X a
a1: Z a
z: Y a
H: x a a0 z
H0: x0 a z a1(y ⨟ y0) a a0 a1I: Type
X, Y, Z: psh I
x, y: relᵢ X Y
H1: x <= y
x0, y0: relᵢ Y Z
H2: x0 <= y0
a: I
a0: X a
a1: Z a
z: Y a
H: x a a0 z
H0: x0 a z a1y a a0 z /\ y0 a z a1I: Type
X, Y, Z: psh I
x, y: relᵢ X Y
H1: x <= y
x0, y0: relᵢ Y Z
H2: x0 <= y0
a: I
a0: X a
a1: Z a
z: Y a
H: x a a0 z
H0: x0 a z a1y a a0 zI: Type
X, Y, Z: psh I
x, y: relᵢ X Y
H1: x <= y
x0, y0: relᵢ Y Z
H2: x0 <= y0
a: I
a0: X a
a1: Z a
z: Y a
H: x a a0 z
H0: x0 a z a1y0 a z a1now apply H2. Qed. Definition squareᵢ {I} {X : psh I} : mon (relᵢ X X) := {| body R := R ⨟ R ; Hbody _ _ H := seq_mon _ _ H _ _ H |}. Definition revᵢ {I} {X Y : psh I} (R : relᵢ X Y) : relᵢ Y X := fun i x y => R i y x. #[global] Hint Unfold revᵢ : core.I: Type
X, Y, Z: psh I
x, y: relᵢ X Y
H1: x <= y
x0, y0: relᵢ Y Z
H2: x0 <= y0
a: I
a0: X a
a1: Z a
z: Y a
H: x a a0 z
H0: x0 a z a1y0 a z a1I: Type
X, Y: psh IProper (leq ==> leq) revᵢfirstorder. Qed. Definition converseᵢ {I} {X : psh I} : mon (relᵢ X X) := {| body := revᵢ ; Hbody := rev_mon |}. Definition orᵢ {I} {X Y : psh I} (R S : relᵢ X Y) : relᵢ X Y := fun i x y => R i x y \/ S i x y. #[global] Infix "∨ᵢ" := (orᵢ) (at level 70).I: Type
X, Y: psh IProper (leq ==> leq) revᵢI: Type
X, Y: psh IProper (leq ==> leq ==> leq) orᵢfirstorder. Qed.I: Type
X, Y: psh IProper (leq ==> leq ==> leq) orᵢI: Type
X: psh I
R: relᵢ X Xeqᵢ X <= R -> Reflexiveᵢ RI: Type
X: psh I
R: relᵢ X Xeqᵢ X <= R -> Reflexiveᵢ Rnow apply H. Qed.I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
i: I
x: X iR i x xI: Type
X: psh I
R: relᵢ X X
H: Reflexiveᵢ Reqᵢ X <= Rintros ? ? ? ->; now reflexivity. Qed.I: Type
X: psh I
R: relᵢ X X
H: Reflexiveᵢ Reqᵢ X <= RI: Type
X: psh I
R: relᵢ X Xconverseᵢ R <= R -> Symmetricᵢ RI: Type
X: psh I
R: relᵢ X Xconverseᵢ R <= R -> Symmetricᵢ Rnow apply H. Qed.I: Type
X: psh I
R: relᵢ X X
H: converseᵢ R <= R
i: I
x, y: X i
H0: R i x yR i y xI: Type
X: psh I
R: relᵢ X X
H: Symmetricᵢ Rconverseᵢ R <= Rintros ? ? ? ?; now symmetry. Qed.I: Type
X: psh I
R: relᵢ X X
H: Symmetricᵢ Rconverseᵢ R <= RI: Type
X: psh I
R: relᵢ X Xsquareᵢ R <= R -> Transitiveᵢ RI: Type
X: psh I
R: relᵢ X Xsquareᵢ R <= R -> Transitiveᵢ Rapply H; now exists y. Qed.I: Type
X: psh I
R: relᵢ X X
H: squareᵢ R <= R
i: I
x, y, z: X i
r: R i x y
s: R i y zR i x zI: Type
X: psh I
R: relᵢ X X
H: Transitiveᵢ Rsquareᵢ R <= RI: Type
X: psh I
R: relᵢ X X
H: Transitiveᵢ Rsquareᵢ R <= Rnow transitivity y. Qed.I: Type
X: psh I
R: relᵢ X X
H: Transitiveᵢ R
a: I
a0, a1, y: X a
H0: R a a0 y
H1: R a y a1R a a0 a1I: Type
X: psh I
R: relᵢ X Xeqᵢ X <= R -> converseᵢ R <= R -> squareᵢ R <= R -> Equivalenceᵢ RI: Type
X: psh I
R: relᵢ X Xeqᵢ X <= R -> converseᵢ R <= R -> squareᵢ R <= R -> Equivalenceᵢ RI: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: IReflexive (R i)I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: ISymmetric (R i)I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: ITransitive (R i)I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: ISymmetric (R i)I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: ITransitive (R i)now apply build_transitive. Qed.I: Type
X: psh I
R: relᵢ X X
H: eqᵢ X <= R
H0: converseᵢ R <= R
H1: squareᵢ R <= R
i: ITransitive (R i)