Relations

If we have a collection of sets \(A_{1}\) through \(A_{n}\), then we can take an \(n\)-ary relation on those sets. An \(n\)-ary relation on the sets \(A_{1}, ..., A_{n}\) is a set \(R\) such that \(R ⊆ A_{1} × ... × A_{n}\). In the special case of a binary relation on two sets \(A\) and \(B\), \(R\) is a set of pairs \(⟨a, b⟩\), such that \(a ∈ A\) and \(b ∈ B\). That is, \(R ⊆ A × B\). For \(n\)-ary relations \(R\), if the \(n\)-tuple \(⟨a₁, ..., aₙ⟩\) is a member of \(R\), we can indicate this by writing \[R(a₁, ..., aₙ)\]

An important operation on relations is relation composition. Given a relation \(R_{1} ⊂ A × B\) and a relation \(R_{2} ⊆ B × C\), their composition \(R_{2} ∘ R_{1} ⊆ A × C\) is defined as \[R_{2} ∘ R_{1} = \{⟨x, y⟩ ∣ \text{there is some $z$ such that } ⟨x, z⟩ ∈ R_{1} \text{ and } ⟨z, y⟩ ∈ R_{2}\}\] That is, \(R_{2} ∘ R_{1}\) is gotten by relating an element of \(A\) to an element of \(C\) just in case there is some element of \(B\) related to the first element by \(R_{1}\) and to the second element by \(R_{2}\).