TITLE: Can morphisms in the category Set be partial functions?
QUESTION [5 upvotes]: In Set, objects are taken to be sets, with morphisms as functions. There are two questions, both are possibly related:

Are the morphisms in Set required to be total functions, as opposed to partial functions?
If required to be total, then why? Is the reason related to the associative and identity laws?

Thanks in advance.

REPLY [9 votes]: Yes.
Well, functions are more fundamental than partial functions. But actually this is just a definition. There are millions of important uses for the category of sets and functions. Therefore it deserves a name, $\mathsf{Set}$.
Of course you can also define another category $\mathsf{Par}$ whose objects are sets and whose morphisms are partial functions. Formally, a partial function $X \to Y$ is a pair $(f,D)$, where $D \subseteq X$ and $f : D \to Y$ is a function. The identity of $X$ is defined by $(\mathrm{id}_X,X)$. The composition of $(f,D) : X \to Y$ with $(g,E) : Y \to Z$ is defined by $(g \circ f|_{...},D \cap f^{-1}(E))$. It is not hard to verify the axioms of a category.

Qiaochu remarks in his answer that $\mathsf{Par} \cong \mathsf{Set}_*$. The equivalence is given by $X \mapsto X + \star$ on objects, and on morphisms one maps a partial function $(f,D)$ to the pointed function $X + \star \to Y + \star$ which is $f$ on $D$ and $\star$ ("undefined") on $(X \setminus D) + \star$.

REPLY [9 votes]: 1) Yes, in the category $Set$ the objects are all sets and the morphisms are all total functions.
2) The reason is that this category is concerned with total functions. If you wish, and it is certainly done, you can define other categories with different notions of morphism. For instance, $Rel$ is the category whose objects are all sets and morphisms $f:A\to B$ are relations $f\subseteq A\times B$. You can define the category $Par$ whose objects are all sets and whose morphisms are partial functions.

REPLY [8 votes]: They're required to be total functions. That's what we mean by $\text{Set}$; if we were talking about sets and partial functions, that's a different category, one incarnation of which is the category $\text{Set}_{\ast}$ of pointed sets (sets together with a distinguished element and functions preserving distinguished elements).