Let be a function from a set to a set. If a set is a subset of, then the restriction of to is the function given by f|A = f for x in A. Informally, the restriction of to is the same function as, but is only defined on. If the function is thought of as a relation on the Cartesian product, then the restriction of to can be represented by its graph, where the pairs represent ordered pairs in the graph.
Examples
The restriction of the non-injective function to the domain is the injection.
For a function to have an inverse, it must be one-to-one. If a function is not one-to-one, it may be possible to define a partial inverse of by restricting the domain. For example, the function defined on the whole of is not one-to-one since x2 = 2 for any x in. However, the function becomes one-to-one if we restrict to the domain, in which case Alternatively, there is no need to restrict the domain if we don't mind the inverse being a multivalued function.
The selection selects all those tuples in for which holds between the and the attribute. The selection selects all those tuples in for which holds between the attribute and the value. Thus, the selection operator restricts to a subset of the entire database.
The pasting lemma is a result in topology that relates the continuity of a function with the continuity of its restrictions to subsets. Let be two closed subsets of a topological spacesuch that, and let also be a topological space. If is continuous when restricted to both and, then is continuous. This result allows one to take two continuous functions defined on closed subsets of a topological space and create a new one.
Sheaves
provide a way of generalizing restrictions to objects besides functions. In sheaf theory, one assigns an object in a category to each open set of a topological space, and requires that the objects satisfy certain conditions. The most important condition is that there are restriction morphisms between every pair of objects associated to nestedopen sets; i.e., if, then there is a morphismresV,U : F → F satisfying the following properties, which are designed to mimic the restriction of a function:
For every open set U of X, the restriction morphism resU,U : F → F is the identity morphism on F.
If we have three open sets W ⊆ V ⊆ U, then the composite
If is an open covering of an open set U, and if s,t ∈ F are such that s|Ui = t|Ui for each set Ui of the covering, then s = t; and
If is an open covering of an open set U, and if for each i a section si ∈ F is given such that for each pair Ui,Uj of the covering sets the restrictions of si and sj agree on the overlaps: si|Ui∩Uj = sj|Ui∩Uj, then there is a section s ∈ F such that s|Ui = si for each i.
The collection of all such objects is called a sheaf. If only the first two properties are satisfied, it is a pre-sheaf.
Left- and right-restriction
More generally, the restriction of a binary relation between and may be defined as a relation having domain, codomain and graph. Similarly, one can define a right-restriction or range restriction. Indeed, one could define a restriction to -ary relations, as well as to subsets understood as relations, such as ones of for binary relations. These cases do not fit into the scheme of sheaves.
Anti-restriction
The domain anti-restriction of a function or binary relation by a set may be defined as ; it removes all elements of from the domain. It is sometimes denoted ⩤ . Similarly, the range anti-restriction of a function or binary relation by a set is defined as ; it removes all elements of from the codomain. It is sometimes denoted ⩥ .