Total function vs Partial function

341 Views Asked by At

I'm reading a lecture note in which the following functions ($fact_i : \mathbb{Z}_\perp → \mathbb{Z}_\perp$) for $i \in \mathbb{N}$ are NOT considered total:

\begin{equation} fact_0(x) = \perp \text{for all } x \in \mathbb{Z}_\perp \end{equation} \begin{equation} fact_1(x) \begin{cases} x!, & \text{for } 0 \le x \lt 1 \\ 1 & \text{for } x \lt 0 \\ \perp & \text{for } x = \perp \text{or } 1 \le x \end{cases} \end{equation} \begin{equation} fact_2(x) \begin{cases} x!, & \text{for } 0 \le x \lt 2 \\ 1 & \text{for } x \lt 0 \\ \perp & \text{for } x = \perp \text{or } 2 \le x \end{cases} \end{equation}

but the least upper bound of this chain $\sqcup \{fact_0,fact_1,fact_2, ...\}$ which is equal to the following:

\begin{equation} fact(x) \begin{cases} x!, & \text{for } 0 \le x \\ 1 & \text{for } x \lt 0 \\ \perp & \text{for } x = \perp \\ \end{cases} \end{equation}

is considered TOTAL. I am confused as a total function must be defined for all inputs but I see no difference in $fact_1(x)$ and $ fact(x)$. Why one is considered total but not the other?

1

There are 1 best solutions below

1
On BEST ANSWER

Seems like we've used our ration of comments so I'll post this as a tentative answer.

I would guess that $f(\perp) = \perp$ doesn't detract from a function being total: it just says no input no output.

$fact(x) $ returns a value for all x other than $\perp$ whereas $fact_1(x)$ doesn't return values (returns $\perp$) for $x \ge 1$