Definition 0.3.19: For a set A, a binary relation on A is a subset R ⊆ A × A
of ordered pairs where the relation is said to hold; we write a R b instead of
(a, b) ∈ R.
Instances For
The book's binary relations on a set A correspond to mathlib relations on the
subtype of A.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Example 0.3.20: On the finite set A = {1,2,3} the relation < corresponds to the
set of pairs {(1,2), (1,3), (2,3)}, so 1 < 2 holds but 3 < 1 does not. The relation
= is given by {(1,1), (2,2), (3,3)}. Any subset of A × A is a relation; for example
† = {(1,2), (2,1), (2,3), (3,1)} satisfies 1 † 2 and 3 † 1 but not 1 † 3.
Instances For
Definition 0.3.21: A relation R on a set A is (i) reflexive if a R a for all
a ∈ A; (ii) symmetric if a R b implies b R a; (iii) transitive if a R b and
b R c imply a R c. A relation that is reflexive, symmetric, and transitive is an
equivalence relation.
Equations
- ReflexiveRelationOn A R = Reflexive R
Instances For
The book's transitive relation on A is mathlib's Transitive predicate on the
underlying relation on Subtype A.
Equations
- TransitiveRelationOn A R = Transitive R
Instances For
The book's notion of equivalence relation collects reflexivity, symmetry, and transitivity.
Equations
- equivalenceRelationOn A R = (ReflexiveRelationOn A R ∧ SymmetricRelationOn A R ∧ TransitiveRelationOn A R)
Instances For
The book's equivalence relations on A coincide with mathlib's Equivalence
structure for relations on Subtype A.
Example 0.3.22: On A = {1,2,3}, the usual < is transitive but neither reflexive
nor symmetric. The relation ≤ (restricted to A) given by
{(1,1),(1,2),(1,3),(2,2),(2,3),(3,3)} is reflexive and transitive but not symmetric.
The relation ⋆ with pairs {(1,1),(1,2),(2,1),(2,2),(3,3)} is an equivalence relation.
Equations
- exampleRelationLtOnA x y = (↑x < ↑y)
Instances For
Equations
- exampleRelationLeOnA x y = (↑x ≤ ↑y)
Instances For
Instances For
Any element of finiteExampleSet is at most 2 or equal to 3.
The book's equivalence class agrees with the class coming from the Setoid built from
the equivalence relation R on A.
Proposition 0.3.24: If R is an equivalence relation on A, then every a ∈ A
lies in exactly one equivalence class. Moreover, a R b if and only if [a] = [b].
Example 0.3.25: Rational numbers can be presented as equivalence classes of pairs
(a, b) with a ∈ ℤ and a positive b ∈ ℕ under the relation (a, b) ∼ (c, d) when
a * d = b * c. The class of (a, b) is typically written a / b.
Instances For
Equations
- ratPairRel p q = ((↑p).1 * ↑(↑q).2 = (↑q).1 * ↑(↑p).2)
Instances For
The relation used to define rationals as pairs is an equivalence relation.
The setoid of rational-number representatives as pairs of an integer and a natural number with positive denominator.
Equations
- ratPairSetoid = { r := ratPairRel, iseqv := ratPairRel_equivalence }
Instances For
Rational numbers as the quotient of integer–natural pairs by the relation (a, b) ∼ (c, d)
when a * d = b * c.
Equations
Instances For
Interpret a numerator–denominator pair as a rational number.
Equations
- ratPairToRat p = ↑(↑p).1 / ↑(↑p).2
Instances For
Cross-multiplication characterizes when two pairs represent the same rational.
The quotient of integer–natural pairs is equivalent to mathlib's rationals ℚ.
Equations
- One or more equations did not get rendered due to their size.