An option would be to resort to Relational Algebra, in a *pointfree* style.

A *logic of relations* was first proposed by Augustus de Morgan, in 1867.

**Functions** are just special cases of **Relations** (**binary** relations, for that matter).

Given types $A$ and $B$, we denote a relation $R$, from $A$ to $B$, as $B \xleftarrow{R} A$.

We write $b \, R \, a$, to denote $(b,a) \in R$.

In the particular case of functions, for a function $f$, writing $b \, f \, a$ simply means $b = f \, a$, since we expect $b$ to be unique.

Therefore, $b \, R \, a$ is a generalization of $b \, f \, a$.

This generalization applies in many ways. For instance, **equality** on functions, $f=g$, generalizes to **inclusion** on relations, $R \subseteq S$, meaning $R$ is (at most) $S$.

Besides inclusion, an important concept to have in mind is the **converse** of a relation.

The converse of $R$, $B \xleftarrow{R} A$, is $R^\circ$, $A \xleftarrow{R^\circ} B$ (just turn the arrows the other way around).

The converse of a function always exists, as a relation (sometimes, in special cases, as a function too).

Function composition, $f \cdot g$, also generalizes to relations, $R \cdot S$, in the same way.

So, what is it that *really* defines when a given relation is a function?$\vphantom{Some commands added; A.K.}\newcommand{\img}{\operatorname{img}}\newcommand{\id}{\mathrm{id}}$

Let's look at a special function, $\id$.

We have $b \, \id \, a \equiv b = a$. Not too hard.

Why does $id$ matter?

- $R$ is
**reflexive** iff $\id \subseteq R$.
- $R$ is
**coreflexive** iff $R \subseteq \id$.

We then define:

**Kernel** of $R$ as $\ker R \doteq R^\circ \cdot R$.
**Image** of $R$ as $\img R \doteq R \cdot R^\circ$.

Finally, we have the following facts:

- $\ker R$ is reflexive $\equiv$ $R$ is
**entire**.
- $\ker R$ is coreflexive $\equiv$ $R$ is
**injective**.
- $\img R$ is reflexive $\equiv$ $R$ is
**surjective**.
- $\img R$ is coreflexive $\equiv$ $R$ is
**simple**.

We say relation $f$ is a function iff $f$ is entire **and** $f$ is simple.

Put in another way, what you want to **prove** is:

- $\id \subseteq ker f$ (simplifies to $\id \subseteq f^\circ \cdot f$)
- $\img f \subseteq \id$ (simplifies to $f \cdot f^\circ \subseteq \id$)

Bonus facts:

- $\ker (R^\circ) = \img R$
- $\img (R^\circ) = \ker R$