Skip to content
Part IA Michaelmas, Lent Term

Relational Composition

Definition

Given relations R:ABR : A \nrightarrow B and S:BCS : B \nrightarrow C, the composite SR:ACS \circ R : A \nrightarrow C is:

SR={(a,c)A×C:bB.aRbbSc}S \circ R = \{(a, c) \in A \times C : \exists b \in B. aRb \land bSc\}

In words: aa is related to cc by SRS \circ R iff there is some intermediate bb connecting them through RR and then SS.

Notation Warning

Some sources write composition as R;SR ; S or RSRS. The order convention varies. Our convention: (SR)(a)=S(R(a))(S \circ R)(a) = S(R(a)).

Example

Let R:{1,2,3}{a,b}R : \{1, 2, 3\} \nrightarrow \{a, b\} with R={(1,a),(2,b),(3,a)}R = \{(1, a), (2, b), (3, a)\}.

Let S:{a,b}{X,Y}S : \{a, b\} \nrightarrow \{X, Y\} with S={(a,X),(b,Y),(b,X)}S = \{(a, X), (b, Y), (b, X)\}.

Then SR={(1,X),(2,X),(2,Y),(3,X)}S \circ R = \{(1, X), (2, X), (2, Y), (3, X)\}.

Check: 1Ra1Ra and aSXaSX, so (1,X)SR(1, X) \in S \circ R. And 2Rb2Rb with bSYbSY and bSXbSX, so (2,Y),(2,X)SR(2, Y), (2, X) \in S \circ R.

Examinable Proof: Associativity

Theorem: Relational composition is associative: (TS)R=T(SR)(T \circ S) \circ R = T \circ (S \circ R).

Proof:

By extensionality, we show both sides relate the same pairs.

a((TS)R)d    c.aRcc(TS)da ((T \circ S) \circ R) d \iff \exists c. aRc \land c(T \circ S)d     c.aRc(b.cSbbTd)\iff \exists c. aRc \land (\exists b. cSb \land bTd)     b,c.aRccSbbTd\iff \exists b, c. aRc \land cSb \land bTd

a(T(SR))d    b.a(SR)bbTda (T \circ (S \circ R)) d \iff \exists b. a(S \circ R)b \land bTd     b.(c.aRccSb)bTd\iff \exists b. (\exists c. aRc \land cSb) \land bTd     b,c.aRccSbbTd\iff \exists b, c. aRc \land cSb \land bTd

Both sides are equivalent to b,c.aRccSbbTd\exists b, c. aRc \land cSb \land bTd.

Therefore (TS)R=T(SR)(T \circ S) \circ R = T \circ (S \circ R).

Examinable Proof: Identity Laws

Theorem: The identity relation is a neutral element for composition.

idBR=R=RidA\text{id}_B \circ R = R = R \circ \text{id}_A

for R:ABR : A \nrightarrow B.

Proof:

a(idBR)b    cB.aRccidBba(\text{id}_B \circ R)b \iff \exists c \in B. aRc \land c\,\text{id}_B\,b     cB.aRcc=b\iff \exists c \in B. aRc \land c = b     aRb\iff aRb

Similarly: a(RidA)b    cA.aidAccRba(R \circ \text{id}_A)b \iff \exists c \in A. a\,\text{id}_A\,c \land cRb     cA.a=ccRb\iff \exists c \in A. a = c \land cRb     aRb\iff aRb

Monoid Structure

The endo-relations Rel(A,A)\text{Rel}(A, A) on a set AA form a monoid under composition:

  • Associativity: (RS)T=R(ST)(R \circ S) \circ T = R \circ (S \circ T)
  • Identity: RidA=R=idARR \circ \text{id}_A = R = \text{id}_A \circ R

This is a foundational structure with many applications.

n-fold Iteration

For a relation RR on AA, define the nn-fold iteration:

R0=idAR^{\circ 0} = \text{id}_A R(n+1)=RRnR^{\circ (n+1)} = R \circ R^{\circ n}

Interpretation

  • R0R^{\circ 0}: “be the same element”
  • R1=RR^{\circ 1} = R: “take one RR-step”
  • RnR^{\circ n}: “take exactly nn RR-steps”

The Path Relation

The path relation (or reflexive-transitive closure) is:

R=n0RnR^{\circ *} = \bigcup_{n \geq 0} R^{\circ n}

This relates aa to bb iff there is a path of length 0\geq 0 from aa to bb.

Properties

  • Always reflexive: idAR\text{id}_A \subseteq R^{\circ *}
  • Always transitive: RR=RR^{\circ *} \circ R^{\circ *} = R^{\circ *}

Summary

  • SR={(a,c):b.aRbbSc}S \circ R = \{(a, c) : \exists b. aRb \land bSc\}
  • Composition is associative with identity id\text{id}
  • Endo-relations form a monoid under composition
  • RnR^{\circ n} is nn-fold iteration; R=nRnR^{\circ *} = \bigcup_n R^{\circ n} is the path relation