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.invis theRel β αobtained by swapping the arguments ofr.Rel.dom: Domain of a relation.x ∈ r.domiff there existsysuch thatr x y.Rel.codom: Codomain, aka range, of a relation.y ∈ r.codomiff there existsxsuch 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 sis the set off xover 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 sis the set ofx : αsuch that allyrelated toxare 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.