# Is there a “partial function” approach to subobjects in category theory?

Given a relation $f : X \rightarrow Y$, lets define that the source of $f$ is $X$, and that the domain of $f$ is the set of all $x$ such that there exists $y \in Y$ satisfying $(x,y) \in f$. Thus the domain of a partial function is the set of all inputs for which it is defined.

Now given a set $X$, a subset of $X$ can be characterized as a partial function $f : X \rightarrow 1$. (Intuitively, the subset represented by $f$ is precisely the domain of $f$). This is rather convenient, because the preimage of a "subset" $f$ under a relation $g$ can simply by written $f \circ g$, where $\circ$ denotes the composition of relations.

Similarly, given a group $G$, a subgroup of $G$ can be characterized as a partial function $f : G \rightarrow 1$ with the property that the domain of $f$ is in fact a subgroup of $G$ in the classical sense.

My question is, do the above observations have any interesting category-theoretic applications or interpretations? And is there a "partial function" approach to subobjects in category theory, whatever that may mean?

-

Yes, there are even more approaches to this.

1. Normally, in a (classical, total function-like) category, a subobject of an object $X$ is defined as a monomorphism $D\hookrightarrow X$, and then a partial function $X\cdot\!\!\to Y$ is defined as a span with this $D\hookrightarrow X$ and $D\to Y$. Here, if $1$ is the terminal object, the $X\cdot\!\!\to 1$ 'partial arrows' indeed correspond to the subobjects.

2. The category of sets and relations is generalized to the notion of allegory. An allegory is a category enriched over the posets (each homset has a partial order, which was originally the inclusion for relations), and each morphism $r:A-B$ has a converse $r^\circ:B-A$.

In an allegory, a morphism $f:A-B$ is called partial map iff $f^\circ f\le 1_B$ (composition is written to the right).

Find out the rephrasing of injective, surjective relations and that of total functions.

A subobject then can also be defined as any arrow $r:A-A$ such that $r\le 1_A$. One can prove that there is a correspondence of injective total functions and these kind of subobjects. (Among the relations, also because of symmetry, the terminal object coincides with the initial object, and is the empty set..)

Luckily, any kind of algebraic structures (moreover, any category with direct products and pullbacks) gives rise to an allegory of the relations within.

-

The usual way of internalizing the notion of subobject is by that of a subobject classifier. See wikipedia and nLab.

Rather than partial functions, the main idea is, in the case of $\mathbf{Set}$, to define $\Omega = \{ F, T \}$ and to represent a subobject by its indicator function

$$\chi_S : X \to \{ F, T \} : x \mapsto \begin{cases} F & x \notin S \\ T & x \in S \end{cases}$$

The condition that $S$ is the subobject classified by $\chi_S$ is that the following square

$$\begin{matrix}S &\to& 1 \\ \downarrow & & \downarrow \\ X &\xrightarrow{\chi_S}& \Omega \end{matrix}$$

is a pullback diagram, where $1 \to \Omega$ is the function picking out the element $T$. In $\mathbf{Set}$, the canonical pullback is defined by

$$\{ (x, *) \in X \times 1 \mid \chi_S(x) = T \}$$

which is naturally bijective to the set

$$\{ x \in X \mid \chi_S(x) = T \} = S$$

If you're really keen on partial functions, there's a special kind of category called an allegory that is analogous to sets and binary relations rather than sets and functions. See Berci's answer for more detail.

-