Partial function

https://arbital.com/p/partial_function

by Patrick Stevens Jul 30 2016 updated Aug 6 2016

A partial function is one which "might not be defined everywhere one might expect it to be".


A partial function is like a Function f:AB, but where we relax the requirement that f(a) must be defined for all aA. That is, it must still be the case that "a=b and f(a) is defined" implies "f(b) is defined and f(a)=f(b)", but now we no longer need f(a) to be defined everywhere. We can write f:AB %%note:In LaTeX, this symbol is given by \rightharpoonup.%%to denote that f is a partial function with domain A and codomain B: that is, whenever f(x) is defined then we have xA and f(x)B.

This idea is essentially the "flip side" to the distinction between the Codomain vs image dichotomy.

Implementation in set theory

Just as a function can be implemented as a set f of ordered pairs (a,b) such that:

so we can define a partial function as a set f of ordered pairs (a,b) such that:

(That is, we omit the first listed requirement from the definition of a bona fide function.)

Relationship to Turing machines

[todo: maybe this should be under Turing machine rather than partial function?]

Morally speaking, every Turing machine T may be viewed as computing some function f:NN, by defining f(n) to be the state of the tape after T has been allowed to execute on the tape which has been initialised with the value n.

However, if T does not terminate on input n (for example, it may be the machine "if n=3 then return 1; otherwise loop indefinitely"), then this "morally correct" state of affairs is not accurate: how should we define f(4)? The answer is that we should instead view f as a partial function which is just undefined if T fails to halt on the input in question. So with the example T above, f is the partial function which is only defined at 3, and f(3)=1.