TITLE: How is an empty Set an initial object
QUESTION [6 upvotes]: (I'm using Haskell syntax)
So I have an initial object, which I call $\text{Void}$. The prerequisite for an inital object is $\forall X \in \text{Hask.} \exists ! f : \text{Void} \to X$. But how is that true?
Can't I just say:
f :: Void -> Int
f _ = 1

f' :: Void -> Int
f _ = 2

(...)

The same applies to Set, with a set $I \in \text{Set}$ such that $\forall X \in \text{Set}. \exists! f : I \rightarrow X$, where $I = \emptyset$::
$$
f: \emptyset \rightarrow \mathbb{N} \\ 
f(x) = 1 \\ 
f': \emptyset \rightarrow \mathbb{N} \\ 
f'(x) = 2 \\ 
...
$$
Of course I can't call any of them, because the prerequisites of having an element of type Void will never hold true, but still, I can create as many functions as I want.
And if pattern matching is illegal, then how can I even create a single function?
f'' :: Void -> a
-- how is this ok?

REPLY [2 votes]: I think what confused me when I wrote the question is the Haskell syntax.
You got to remember that the _ character is just a syntactic sugar. It means "for all remaining cases, assign that value". If I had realized that, I probably wouldn't have posed that question. Because "technically" it should look like this:
f :: Void -> Int

Because there is not even a first case. Saying "all remaining cases", although there are zero cases is like saying, "Every person in this room is a doctor.", where the room is empty. There is still no doctor in the room.
Also another thing that is important to remember is that in a mathematical sense, functions are equal, if they produce the same output for every possible output. This is definitely true of the functions I've written above:
f :: Void -> Int
f _ = 1

f' :: Void -> Int
f _ = 2

They both give the same output for all imaginable input (which is none).
Another way to think about it is visually in the category of $Set$. I've drawn a quick picture for that purpose:

Yet another fun fact is that you can use $n^k$ to calculate the number of morphisms of type $K \rightarrow N, |K| = k, |N| = n$. And as we now, $n^0$ is 1 for all $n$.