Relations #
This file defines bundled relations. A relation between α
and β
is a function α → β → Prop
.
Relations are also known as set-valued functions, or partial multifunctions.
Main declarations #
Rel α β
: Relation betweenα
andβ
.Rel.inv
:r.inv
is theRel β α
obtained by swapping the arguments ofr
.Rel.dom
: Domain of a relation.x ∈ r.dom
iff there existsy
such thatr x y
.Rel.codom
: Codomain, aka range, of a relation.y ∈ r.codom
iff there existsx
such thatr x y
.Rel.comp
: Relation composition. Note that the arguments order follows theCategoryTheory/
one, sor.comp s x z ↔ ∃ y, r x y ∧ s y z
.Rel.image
: Image of a set under a relation.r.image s
is the set off x
over allx ∈ s
.Rel.preimage
: Preimage of a set under a relation. Note thatr.preimage = r.inv.image
.Rel.core
: Core of a set. Fors : Set β
,r.core s
is the set ofx : α
such that ally
related tox
are ins
.Rel.restrict_domain
: Domain-restriction of a relation to a subtype.Function.graph
: Graph of a function as a relation.
TODO #
The Rel.comp
function uses the notation r • s
, rather than the more common r ∘ s
for things
named comp
. This is because the latter is already used for function composition, and causes a
clash. A better notation should be found, perhaps a variant of r ∘r s
or r; s
.