Lemma. Associativity and unit laws of relational composition [00IP]
- January 17, 2024
- Jon Sterling, with contributions from Marcelo Fiore
Relational composition is associative and has the identity relation as a neutral element.
Proof.
- January 17, 2024
- Jon Sterling
To prove associativity, we fix relations R\colon A\mathbin {\nrightarrow } B, S\colon B\mathbin {\nrightarrow } C, and T\colon C\mathbin {\nrightarrow } D to prove {\mathopen {}\left (T\circ S\right )\mathclose {}}\circ R = T\circ {\mathopen {}\left (S\circ R\right )\mathclose {}}. To get started, we compute the intermediate composites:
\begin {aligned} b\mathrel {{\mathopen {}\left (T\circ S\right )\mathclose {}}}d &\Longleftrightarrow \exists c: C\mathpunct {.} b\mathrel {S}c\land c\mathrel {T}d \\ a\mathrel {{\mathopen {}\left (S\circ R\right )\mathclose {}}}c &\Longleftrightarrow \exists b: B\mathpunct {.} a\mathrel {R}b\land b\mathrel {S}c \end {aligned}Using the above, we can compute the full composites:
\begin {aligned} a\mathrel {{\mathopen {}\left ({\mathopen {}\left (T\circ S\right )\mathclose {}}\circ R\right )\mathclose {}}} d &\Longleftrightarrow \exists b : B\mathpunct {.} a\mathrel {R}b \land b\mathrel {{\mathopen {}\left (T\circ S\right )\mathclose {}}} d \\ &\Longleftrightarrow \exists b: B\mathpunct {.} a\mathrel {R}b \land \exists c: C\mathpunct {.} c\mathrel {S}c\land c\mathrel {T}d \\ &\Longleftrightarrow \exists b: B\mathpunct {.} \exists c: C\mathpunct {.} a\mathrel {R}b \land b\mathrel {S}c\land c\mathrel {T}d \\ &\Longleftrightarrow \exists c: C\mathpunct {.} {\mathopen {}\left (\exists b: B\mathpunct {.} a\mathrel {R}b\land b\mathrel {S}c\right )\mathclose {}}\land c\mathrel {T}d \\ &\Longleftrightarrow \exists c : C\mathpunct {.} a\mathrel {{\mathopen {}\left (S\circ R\right )\mathclose {}}}c\land c\mathrel {T}d \\ &\Longleftrightarrow a \mathrel {{\mathopen {}\left (T\circ {\mathopen {}\left (S\circ R\right )\mathclose {}}\right )\mathclose {}}}d \end {aligned}For the right and left neutrality, we must prove that R\circ \mathsf {id}_{A} = R = \mathsf {id}_{B}\circ R for all r\colon A\mathbin {\nrightarrow } B. We prove only the first law, as the other proof is analogous:
\begin {aligned} a \mathrel {{\mathopen {}\left (R\circ \mathsf {id}_{A}\right )\mathclose {}}} b &\Longleftrightarrow \exists a':A\mathpunct {.} a\mathrel {\mathsf {id}_{A}}a' \land a' \mathrel {R}b \\ &\Longleftrightarrow \exists a': A\mathpunct {.} a = a' \land a' \mathrel {R}b \\ &\Longleftrightarrow a \mathrel {R} b \end {aligned}