Partial function
In mathematics, a partial function is a binary relation over two sets that associates to every element of the first set at most one element of the second set; it is thus a functional binary relation. It generalizes the concept of a function by not requiring every element of the first set to be associated to at least one element of the second set. Consequently, the domain of definition of a partial function can be a proper subset of its domain, contrary to a function for which the two sets always coincide.
A partial function over and is sometimes written as,, or. Partial functions are often used when their exact domain of definition is not known. In real and complex analysis, a partial function is generally called simply a function.
Specifically, we will say that for any, either:
- or
- is undefined.
Thus is only defined for that are perfect squares. So,, but is undefined.
Basic concepts
A partial function is said to be injective, surjective, or bijective when the function given by the restriction of the partial function to its domain of definition is injective, surjective, bijective respectively.Because a function is trivially surjective when restricted to its image, the term partial bijection denotes a partial function which is injective.
An injective partial function may be inverted to an injective partial function, and a partial function which is both injective and surjective has an injective function as inverse. Furthermore, a function which is injective may be inverted to an injective partial function.
The notion of transformation can be generalized to partial functions as well. A partial transformation is a function, where both and are subsets of some set.
Function
A function is a binary relation that is functional and serial. This is a stronger definition than that of a partial function which only requires the functional property.Function spaces
The set of all partial functions from a set X to a set Y, denoted by, is the union of all functions defined on subsets of X with same codomain Y:the latter also written as. In finite case, its cardinality is
because any partial function can be extended to a function by any fixed value c not contained in Y, so that the codomain is, an operation which is injective.
Discussion and examples
The first diagram at the top of the article represents a partial function that is not a function since the element 1 in the left-hand set is not associated with anything in the right-hand set. Whereas, the second diagram represents a function since every element on the left-hand set is associated with exactly one element in the right hand set.Natural logarithm
Consider the natural logarithm function mapping the real numbers to themselves. The logarithm of a non-positive real is not a real number, so the natural logarithm function doesn't associate any real number in the codomain with any non-positive real number in the domain. Therefore, the natural logarithm function is not a function when viewed as a function from the reals to themselves, but it is a partial function. If the domain is restricted to only include the positive reals, then the natural logarithm is a function.Subtraction of natural numbers
Subtraction of natural numbers can be viewed as a partial function:It is defined only when.
Bottom element
In denotational semantics a partial function is considered as returning the bottom element when it is undefined.In computer science a partial function corresponds to a subroutine that raises an exception or loops forever. The IEEE floating point standard defines a not-a-number value which is returned when a floating point operation is undefined and exceptions are suppressed, e.g. when the square root of a negative number is requested.
In a programming language where function parameters are statically typed, a function may be defined as a partial function because the language's type system cannot express the exact domain of the function, so the programmer instead gives it the smallest domain which is expressible as a type and contains the domain of definition of the function.
In category theory
In category theory, when considering the operation of morphism composition in concrete categories, the composition operation is a function if and only if has one element. The reason for this is that two morphisms and can only be composed as if, that is, the codomain of must equal the domain of.The category of sets and partial functions is equivalent to but not isomorphic with the category of pointed sets and point-preserving maps. One textbook notes that "This formal completion of sets and partial maps by adding “improper,” “infinite” elements was reinvented many times, in particular, in topology and in theoretical computer science."
The category of sets and partial bijections is equivalent to its dual. It is the prototypical inverse category.
In abstract algebra
generalizes the notion of universal algebra to partial operations. An example would be a field, in which the multiplicative inversion is the only proper partial operation.The set of all partial functions on a given base set, X, forms a regular semigroup called the semigroup of all partial transformations, typically denoted by. The set of all partial bijections on X forms the symmetric inverse semigroup.
Charts and atlases for manifolds and fiber bundles
Charts in the atlases which specify the structure of manifolds and fiber bundles are partial functions. In the case of manifolds, the domain is the point set of the manifold. In the case of fiber bundles, the domain is the space of the fiber bundle. In these applications, the most important construction is the transition map, which is the composite of one chart with the inverse of another. The initial classification of manifolds and fiber bundles is largely expressed in terms of constraints on these transition maps.The reason for the use of partial functions instead of functions is to permit general global topologies to be represented by stitching together local patches to describe the global structure. The "patches" are the domains where the charts are defined.