Definition. The matrix associated to a finite relation [00IY]

Let R\colon {\mathopen {}\left [m\right ]\mathclose {}}\mathbin {\nrightarrow }{\mathopen {}\left [n\right ]\mathclose {}} be a relation; for any semiring S, we may form the {\mathopen {}\left (n\times n\right )\mathclose {}}-matrix over S associated to R as follows:

{\mathopen {}\left (\operatorname {\underline {mat}}_S{R}\right )\mathclose {}}_{i:{\mathopen {}\left [m\right ]\mathclose {}},j:{\mathopen {}\left [n\right ]\mathclose {}}} = \begin {cases} 1&\text {if } i\mathrel {R}j \\ 0&\text {otherwise} \end {cases}

We have defined a function \operatorname {\underline {mat}}_S\colon \mathrm {Rel}{\mathopen {}\left ({\mathopen {}\left [m\right ]\mathclose {}},{\mathopen {}\left [n\right ]\mathclose {}}\right )\mathclose {}} \to \mathrm {Mat}_{S}{\mathopen {}\left (m,n\right )\mathclose {}}.