A partial function is like a function from to except that may not be defined for every element of . (Compare a multi-valued function, where may have several possible values.)
In some fields (including secondary-school mathematics even today), functions are often considered to be partial by default, requiring one to specify a total function otherwise. As category-theoretic and type-theoretic formalisation spreads, this is difficult to treat as the basic concept, and the most modern idea is that a function must be total. If you want partial functions, then you can get them in terms of total functions as below.
In dependent type theory, given h-sets and , a partial function from to is an h-proposition-valued type family on which states whether is defined for element , and a section
If the dependent type theory has function types and dependent sum types, then one could define the partial function directly as:
In dependent type theory, given types and , a partial anafunction is a type family which comes with a family of witnesses
that for each element , the dependent sum type is a mere proposition.
Historically, partial anafunctions are called functional relations, but nowadays in type theory one tends to use the term relation only for those type families which are valued in mere propositions.
For any partial anafunction, there is a partial function
which could be written as the function
since is already a proposition, one could simply use
instead, and by the rules of dependent sum types, it becomes
on the other side, the function can be written as
There are multiple examples of partial functions in mathematics.
The reciprocal function on the real numbers is only defined on the real numbers apart from zero, and so is given by the following rules:
The reciprocal function is given by the partial anafunction .
Another example is the metric square root on the real numbers, which is only defined on the non-negative real numbers, and is given by the following rules:
In both cases, the witness is usually left implicit in informal notation, and the partial function is written as or .
Given sets and , a partial function from to consists a subset of and a (total) function from to . In more detail, this is a span
of total functions, where is an injection. (This condition can be dropped to define a partial multi-valued function, which is simply a span.)
and are called the source and target of as usual; then is the domain of and is the inclusion of the domain into the source. By abuse of notation, the partial function is conflated with the (total) function .
Notice that the induced function is an injection, so a partial function is the same as a functional relation seen from a different point of view.
We consider two partial functions (with the same given source and target) to be equal if there is a bijection between their domains that makes the obvious diagrams commute. You can get this automatically in a traditional set theory by requiring to be literally a subset of (with the inclusion map).
If is a category with pullbacks, then a partial map from to may be defined to be a span
where is monic. Such spans are closed under span composition, and as a locally full sub-2-category of , the bicategory of partial maps in is locally preordered. In more down-to-earth terms, if and are partial maps from to , we have if there exists (necessarily monic) such that and .
Abstract bicategories of partial maps, parallel to bicategories of relations, were introduced by (Carboni 87).
Notice that a partial function from to as above is (in classical mathematics) equivalently a genuine function from to the disjoint union (coproduct) of with the point (the singleton)
The subset in the above is the preimage ; for in this preimage, . Conversely, an element is sent to by if and only if is undefined at .
This in turn is equivalently a morphism in the Kleisli category of the maybe monad. Phrased this way, the concept of partial function makes sense in any category with coproducts and with a terminal object. It comes out as intended when the category is an extensive category (partial functions with complemented domain).
In secondary-school mathematics, one often makes functions partial by fiat, just to see if students can calculate the domains of composite functions and the like. This is not (only) busywork, as in applications one often has a function given by a formula that is really valid only on a certain domain. However, in more sophisticated analyses (such as those that Lawvere and his followers propose for physics and synthetic geometry), these domains and the total functions on them become the primary objects of study, with the partial functions being secondary (as is seen as merely a way to place coordinates on ).
In analysis, one often considers partial functions whose domains are required to be intervals in the real line, regions of the complex plane, or dense subsets of a Banach space.
In a field, the multiplicative inverse is a partial function whose domain is the set of non-zero elements of the field.
The category of sets and partial functions between them is important for understanding computation. However, one often replaces this with an equivalent category of sets and total functions.
Specifically, replace each set with the set of all subsets of with at most one element, otherwise known as the partial map classifier of Set. In this context, we identify an element of with the subset and write the empty subset as . Then a partial function becomes a total function such that inhabited subsets of are assigned only to inhabited subsets of . Then is equivalent to the category of such sets and functions.
In classical mathematics , although this is not true constructively. In this case, is the maybe monad and is its Kleisli category. Moreover, since every algebra for this monad is free? this category is also equivalent to its Eilenberg-Moore category, which is the category of pointed sets and total point-preserving functions. Traditionally, one uses the notation of but (unless one is a constructivist) thinks of this as simply different notation for . It is still true constructively that is a monad (the partial map classifier) and is its Kleisli category, but it is (probably) no longer true that every algebra is free.
For a more sophisticated analysis of computation, can be replaced with a suitable category of domains, such as directed complete partially ordered sets (DCPOs). The requirement that be preserved can then be removed to model lazy computation, but now we are hardly talking about partial functions anymore.
The functions of high-school mathematics, consisting of real (or complex)-valued functions of one (or two or three) real (or complex) variables, are by default partial functions. As they take values in a field, one may consider adding or multiplying them. The usual rule is that , etc, but this leads to an unusual algebra: a commutative semiring in which addition has an identity element (the always-defined constant zero function) and multiplication has an absorbing element (the never-defined empty function), but it fails to be a rig because these two elements are not the same. It has many other interesting properties, such as simultaneous additive and multiplicative idempotents (the zero functions with arbitrary domains).
An axiomatic treatment of such semirings may be found at the end of Richman 2012, as well as in the article category of partial endofunctions.
Aurelio Carboni, Bicategories of partial maps, Cahiers de Topologie et Géométrie Différentielle Catégoriques, 28 no. 2 (1987), p. 111-126 (web)
Robin Cockett, Steve Lack, Restriction categories I: categories of partial maps (pdf)
Robin Cockett, Steve Lack, Restriction categories II: partial map classification (web)
Robin Cockett, Steve Lack, Restriction categories III: colimits, partial limits, and extensivity (arXiv:math/0610500)
Fred Richman, Algebraic functions, calculus style. Communications in Algebra, Volume 40, Issue 7, July 2012, Pages 2671-2683 [doi:10.1080/00927872.2011.584337]
Last revised on January 28, 2024 at 04:41:57. See the history of this page for a list of all contributions to it.