relation in nLab
Context
Relations
Rel, bicategory of relations, allegory
Types of Binary relation
-
left and right euclidean;
-
extensional, well-founded relations.
In higher category theory
Idea
A relation is the extension of a predicate. That is, if you have a statement whose truth value may depend on some variables, then you get a relation that consists of those instantiations of the variables that make the statement true. Equivalently, you can think of a relation as a function whose target is the set of truth values.
Definitions
General case
Special cases
A nullary relation is a relation on the empty family of sets. This is the same as a truth value.
A unary relation on is a relation on the singleton family . This is the same as a subset of .
A binary relation on and is a relation on the family , that is a subset of . This is also called a relation from to , especially in the context of the -category Rel described below, or sometimes called a heterogenous relation.
A binary relation on is a relation on , that is a relation from to itself. This is sometimes called a homogenous relation on , simply a relation on , or just an endorelation with its set implicit as a property if not explicitly mentioned.
An -ary relation on is a relation on a family of copies of , that is a subset of .
For a binary relation, one often uses a symbol such as and writes instead of . Actually, even when a relation is given by a letter such as , one often sees instead of , although now that does not look so good.
Internal and external relations
In foundations of mathematics with a sort of propositions and a separate sort of sets, such as most presentations of set theory in first-order logic with equality, there are actually two notions of relation. The definition given above is the notion of internal relation, defined as a subset of the Cartesian product of a family of sets. There is a second definition of relation on a set: external relations, which are not defined purely inside of the set theory. Since each set has a type of elements inside of the set, an external relation is simply a proposition in the context of a family of variables inside of a family of sets
In any unsorted set theory, those variables would be expressed as
It is in this second sense of external relation that equality in first-order logic with equality is an equivalence relation, and inequality is a tight apartness relation in a first-order theory with equality presented in classical logic.
In dependent type theory, where propositions are considered to be the subsingletons or the sets/types themselves, there is only one notion of relation, the internal notion given above.
Morphisms
If and are each sets equipped with a relation, then what makes a function a morphism of sets so equipped?
There are really two ways to do this, shown below. (We will write these as if each set is equipped with a binary relation , but any fixed arity would work.)
- preserves the relation if always;
- f reflects the relation if always.
Now, if is a bijection, then it preserves the relation if and only if its inverse reflects it, so clearly an isomorphism of relation-equipped sets should do both. What about a mere morphism?
In general, it's more natural to require only preservation; these are the morphisms you get if you consider a set with a relation as a models of a finite-limit theory or a simply directed graph.
But in some contexts, particularly when dealing only with irreflexive relations, we instead require (only) that a morphism reflect the relation. Sometimes an even stricter condition is imposed, as for well-orders. But even in these cases, the definition of isomorphism comes out the same.
Binary relations
Binary relations are especially widely used.
Kinds of binary relations
Special kinds of relations from to include:
- functional relations,
- entire relations,
- difunctional relations
- one-to-one relation?s,
- onto relation?s.
Combinations of the above properties of binary relations produce:
Special kinds of binary relations on (so from to itself) additionally include:
- reflexive and irreflexive relations;
- symmetric, antisymmetric, and asymmetric relations;
- transitive relations and comparisons;
- left and right euclidean relations;
- total and connected relations;
- extensional and well-founded relations.
Combinations of the above properties of binary relations produce:
- equivalence relations,
- partial equivalence relations,
- apartness relations,
- the various kinds of orders (which see).
Structure preserving relations
Given pointed sets and , a binary relation from to is said to preserve the point if .
Given sets with endofunctions and , a binary relation from to is said to preserve the endofunction if for every and , if , then .
Given magmas and , a binary relation from to is said to preserve the binary operation if for every , , and , if and , then .
And so forth.
Properties
Every binary endorelation has an equivalence relation generated by .
Binary relations as a coalgebra
By currying the binary relation , one gets a coalgebra for the powerset endofunctor on Set.
The -poset of binary relations
Binary relations form a -category (in fact a -poset) Rel, which is the basic example of an allegory.
The objects are sets, the morphisms from to are the binary relations on and , and there is a 2-morphism from to (both from to ) if implies (that is, when , then ).
The interesting definition is composition
Defintion
If is a relation from to and is a relation from to , then their composite relation – written or – from to is defined as follows:
The identity morphism is given by equality.
The special properties of the kinds of binary relations listed earlier can all be described in terms internal to Rel; most of them make sense in any allegory. Irreflexive and asymmetric relations are most useful if the allegory's hom-posets have bottom elements, and linear relations require this. Comparisons require the hom-posets to have finite unions, and well-founded relations require some sort of higher-order structure.
As a function may be seen as a functional, entire relation, so the category Set of sets and functions is a subcategory of Rel (in fact a replete and locally full sub--category).
The quasitopos of endorelations
Endorelations on sets are the objects of the quasitopos or . It is a reflective subcategory of Quiv the presheaf topos of quivers and its morphisms are quiver morphisms. Endorelations are the separated presheaves for the double negation topology on . “Separated” here translates to a quiver having at most one arc between pairs of verticies. The reflector collapses parallel arcs together. Such quivers might also be called singular or simple though sometimes “simple” also means “no loops”.
Relation closures as reflective subcategories of
All of the sub-types of endorelations with positive conditions (reflexive, symmetric, transitive, and left and right euclidean) and their combinations have an associated closure that can produce one from an arbitrary relation. Such a closure completes a relation by adding the least number of arcs such that the conditions are satisfied. Within these closures are reflectors that produce reflective subcategories. For example the symmetric closure will (possibly) enlarge a quiver that contains any arc to one that also contains . The transitive and reflexive closure produces a category which is isomorphic to PreOrd though its objects are the underlying quivers of the preorders which are the objects of .
In addition to being reflective, the categories from the symmetric, reflexive, and symmetric and reflexive closures are also quasitoposes that can be directly defined through double negation separation. The symmetric and reflexive closure (SimpGph) is also a Grothendieck quasitopos. On the other hand is not a quasitopos because it is not a regular category.
Ternary relations
Apart from binary relations, there are important ternary relations used in mathematics, which for the most part are families of binary relations indexed by a third set:
- uniformity, where the index set is the set of entourages.
- premetric, where the index set is the set of real numbers, or in some cases, the set of rational numbers.
Generalisation
Most of the preceding makes sense in any category with enough products; giving rise to internal relations, for instance congruences in the case of internal equivalence relations.
Probably the trickiest bit is the definition of composition of binary relations, so not every category with finite products has an allegory of relations. In fact, in a certain precise sense, a category has an allegory of relations if and only if it is regular. It can then be recovered from this allegory by looking at the functional entire relations.
Last revised on August 5, 2025 at 14:03:00. See the history of this page for a list of all contributions to it.