Enderton.Set.Relation #
A representation of a relation, i.e. a set of ordered pairs. Like Set
, it is
assumed a relation is homogeneous.
A relation type as defined by Enderton.
We choose to use tuples to represent our ordered pairs, as opposed to Kuratowski's definition of a set.
Not to be confused with the Lean-provided Rel
.
Equations
- Set.HRelation α β = Set (α × β)
Instances For
A homogeneous variant of the HRelation
type.
Equations
- Set.Relation α = Set.HRelation α α
Instances For
Domain and Range #
The first component of any pair in a Relation
must be a member of the
Relation
's domain.
If x ∈ dom R
, there exists some y
such that ⟨x, y⟩ ∈ R
.
If x ∈ ran R
, there exists some t
such that ⟨t, x⟩ ∈ R
.
The inverse of a Relation
.
Equations
- Set.Relation.inv R = {x : β × α | ∃ p ∈ R, (p.2, p.1) = x}
Instances For
(x, y)
is a member of relation R
iff (y, x)
is a member of R⁻¹
.
Restriction #
The restriction of a Relation
to a Set
.
Instances For
Image #
The image of a Relation
under a Set
.
Equations
- Set.Relation.image R A = {y : β | ∃ u ∈ A, (u, y) ∈ R}
Instances For
Single-Rooted and Single-Valued #
A Relation
R
is said to be single-rooted iff for all y ∈ ran R
, there
exists exactly one x
such that ⟨x, y⟩ ∈ R
.
Equations
- Set.Relation.isSingleRooted R = ∀ y ∈ Set.Relation.ran R, ∃! (x : α), x ∈ Set.Relation.dom R ∧ (x, y) ∈ R
Instances For
A single-rooted Relation
should map the same output to the same input.
A Relation
R
is said to be single-valued iff for all x ∈ dom R
, there
exists exactly one y
such that ⟨x, y⟩ ∈ R
.
Notice, a Relation
that is single-valued is a function.
Equations
- Set.Relation.isSingleValued R = ∀ x ∈ Set.Relation.dom R, ∃! (y : β), y ∈ Set.Relation.ran R ∧ (x, y) ∈ R
Instances For
A single-valued Relation
should map the same input to the same output.
For a set F
, F⁻¹
is a function iff F
is single-rooted.
For a relation F
, F
is a function iff F⁻¹
is single-rooted.
The subset of a function must also be a function.
Injections #
A Relation
is one-to-one iff it's inverse is.
Surjections #
Indicates Relation
F
is a function from A
to B
.
This is usually denoted as F : A → B
.
- is_func : Set.Relation.isSingleValued F
- dom_eq : Set.Relation.dom F = A
- ran_ss : Set.Relation.ran F ⊆ B
Instances For
Indicates Relation
F
is a function from A
to ran F = B
.
- is_func : Set.Relation.isSingleValued F
- dom_eq : Set.Relation.dom F = A
- ran_eq : Set.Relation.ran F = B
Instances For
Composition #
The composition of two Relation
s.
Instances For
Composition of functions is associative.
The composition of two functions is itself a function.
The composition of two one-to-one Relation
s is one-to-one.
For Relation
s F
and G
, (F ∘ G)⁻¹ = G⁻¹ ∘ F⁻¹
.
Ordered Pairs #
Convert a Relation
into an equivalent representation using OrderedPair
s.
Equations
- Set.Relation.toOrderedPairs R = (fun (x : α × α) => match x with | (x, y) => OrderedPair x y) '' R
Instances For
Equivalence Classes #
A binary Relation
R
is reflexive on A
iff xRx
for all x ∈ A
.
Equations
- Set.Relation.isReflexive R A = ∀ x ∈ A, (x, x) ∈ R
Instances For
A binary Relation
R
is symmetric iff whenever xRy
then yRx
.
Equations
- Set.Relation.isSymmetric R = ∀ {x y : α}, (x, y) ∈ R → (y, x) ∈ R
Instances For
Relation
R
is an equivalence relation on set A
iff R
is a binary
relation on A
that is relexive on A
, symmetric, and transitive.
- b_on : Set.Relation.fld R ⊆ A
- refl : Set.Relation.isReflexive R A
- symm : Set.Relation.isSymmetric R
- trans : Set.Relation.isTransitive R
Instances For
A set of members related to x
via Relation
R
.
The term "neighborhood" here was chosen to reflect this relationship between x
and the members of the set. It isn't standard in anyway.
Equations
- Set.Relation.neighborhood R x = {t : α | (x, t) ∈ R}
Instances For
The neighborhood with some respect to an equivalence relation R
on set A
and member x
contains x
.
Assume that R
is an equivalence relation on A
and that x
and y
belong
to A
. Then [x]_R = [y]_R ↔ xRy
.
Assume that R
is an equivalence relation on A
. If two sets x
and y
belong to the same neighborhood, then xRy
.
A partition Π
of a set A
is a set of nonempty subsets of A
that is
disjoint and exhaustive.
- p_subset : ∀ p ∈ P, p ⊆ A
- nonempty : ∀ p ∈ P, Set.Nonempty p
- exhaustive : ∀ a ∈ A, ∃ p ∈ P, a ∈ p
Instances For
The partition A / R
induced by an equivalence relation R
.
Equations
- Set.Relation.modEquiv x = {x : Set α | ∃ x_1 ∈ A, Set.Relation.neighborhood R x_1 = x}
Instances For
Show the sets formed by modEquiv
do indeed form a partition
.