| 1 |
(************************************************************************) |
| 2 |
(* * The Rocq Prover / The Rocq Development Team *) |
| 3 |
(* v * Copyright INRIA, CNRS and contributors *) |
| 4 |
(* <O___,, * (see version control and CREDITS file for authors & dates) *) |
| 5 |
(* \VV/ **************************************************************) |
| 6 |
(* // * This file is distributed under the terms of the *) |
| 7 |
(* * GNU Lesser General Public License Version 2.1 *) |
| 8 |
(* * (see LICENSE file for the text of the license) *) |
| 9 |
(************************************************************************) |
| 10 |
|
| 11 |
Section Relation_Definition. |
| 12 |
|
| 13 |
Variable A : Type. |
| 14 |
|
| 15 |
Definition relation := A -> A -> Prop. |
| 16 |
|
| 17 |
Variable R : relation. |
| 18 |
|
| 19 |
|
| 20 |
Section General_Properties_of_Relations. |
| 21 |
|
| 22 |
Definition reflexive : Prop := forall x:A, R x x. |
| 23 |
Definition transitive : Prop := forall x y z:A, R x y -> R y z -> R x z. |
| 24 |
Definition symmetric : Prop := forall x y:A, R x y -> R y x. |
| 25 |
Definition antisymmetric : Prop := forall x y:A, R x y -> R y x -> x = y. |
| 26 |
|
| 27 |
(* for compatibility with Equivalence in ../PROGRAMS/ALG/ *) |
| 28 |
Definition equiv := reflexive /\ transitive /\ symmetric. |
| 29 |
|
| 30 |
End General_Properties_of_Relations. |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
Section Sets_of_Relations. |
| 35 |
|
| 36 |
Record preorder : Prop := |
| 37 |
{ preord_refl : reflexive; preord_trans : transitive}. |
| 38 |
|
| 39 |
Record order : Prop := |
| 40 |
{ ord_refl : reflexive; |
| 41 |
ord_trans : transitive; |
| 42 |
ord_antisym : antisymmetric}. |
| 43 |
|
| 44 |
Record equivalence : Prop := |
| 45 |
{ equiv_refl : reflexive; |
| 46 |
equiv_trans : transitive; |
| 47 |
equiv_sym : symmetric}. |
| 48 |
|
| 49 |
Record PER : Prop := {per_sym : symmetric; per_trans : transitive}. |
| 50 |
|
| 51 |
End Sets_of_Relations. |
| 52 |
|
| 53 |
|
| 54 |
Section Relations_of_Relations. |
| 55 |
|
| 56 |
Definition inclusion (R1 R2:relation) : Prop := |
| 57 |
forall x y:A, R1 x y -> R2 x y. |
| 58 |
|
| 59 |
Definition same_relation (R1 R2:relation) : Prop := |
| 60 |
inclusion R1 R2 /\ inclusion R2 R1. |
| 61 |
|
| 62 |
Definition commut (R1 R2:relation) : Prop := |
| 63 |
forall x y:A, |
| 64 |
R1 y x -> forall z:A, R2 z y -> exists2 y' : A, R2 y' x & R1 z y'. |
| 65 |
|
| 66 |
End Relations_of_Relations. |
| 67 |
|
| 68 |
|
| 69 |
End Relation_Definition. |
| 70 |
|
| 71 |
#[global] |
| 72 |
Create HintDb sets. |
| 73 |
|
| 74 |
#[global] |
| 75 |
Hint Unfold reflexive transitive antisymmetric symmetric: sets. |
| 76 |
|
| 77 |
#[global] |
| 78 |
Hint Resolve Build_preorder Build_order Build_equivalence Build_PER |
| 79 |
preord_refl preord_trans ord_refl ord_trans ord_antisym equiv_refl |
| 80 |
equiv_trans equiv_sym per_sym per_trans: sets. |
| 81 |
|
| 82 |
#[global] |
| 83 |
Hint Unfold inclusion same_relation commut: sets. |