In mathematics, the restriction of a function
f
{\displaystyle f}
is a new function, denoted
f
|
A
{\displaystyle f\vert _{A}}
or
f
↾
A
,
{\displaystyle f{\upharpoonright _{A}},}
obtained by choosing a smaller domain
A
{\displaystyle A}
for the original function
f
.
{\displaystyle f.}
The function
f
{\displaystyle f}
is then said to extend
f
|
A
.
{\displaystyle f\vert _{A}.}
Formal definition
Let
f
:
E
→
F
{\displaystyle f:E\to F}
be a function from a set
E
{\displaystyle E}
to a set
F
.
{\displaystyle F.}
If a set
A
{\displaystyle A}
is a subset of
E
,
{\displaystyle E,}
then the restriction of
f
{\displaystyle f}
to
A
{\displaystyle A}
is the function
f
|
A
:
A
→
F
{\displaystyle {f|}_{A}:A\to F}
given by
f
|
A
(
x
)
=
f
(
x
)
{\displaystyle {f|}_{A}(x)=f(x)}
for
x
∈
A
.
{\displaystyle x\in A.}
Informally, the restriction of
f
{\displaystyle f}
to
A
{\displaystyle A}
is the same function as
f
,
{\displaystyle f,}
but is only defined on
A
{\displaystyle A}
.
If the function
f
{\displaystyle f}
is thought of as a relation
(
x
,
f
(
x
)
)
{\displaystyle (x,f(x))}
on the Cartesian product
E
×
F
,
{\displaystyle E\times F,}
then the restriction of
f
{\displaystyle f}
to
A
{\displaystyle A}
can be represented by its graph,
G
(
f
|
A
)
=
{
(
x
,
f
(
x
)
)
∈
G
(
f
)
:
x
∈
A
}
=
G
(
f
)
∩
(
A
×
F
)
,
{\displaystyle G({f|}_{A})=\{(x,f(x))\in G(f):x\in A\}=G(f)\cap (A\times F),}
where the pairs
(
x
,
f
(
x
)
)
{\displaystyle (x,f(x))}
represent ordered pairs in the graph
G
.
{\displaystyle G.}
Extensions
A function
F
{\displaystyle F}
is said to be an extension of another function
f
{\displaystyle f}
if whenever
x
{\displaystyle x}
is in the domain of
f
{\displaystyle f}
then
x
{\displaystyle x}
is also in the domain of
F
{\displaystyle F}
and
f
(
x
)
=
F
(
x
)
.
{\displaystyle f(x)=F(x).}
That is, if
domain
f
⊆
domain
F
{\displaystyle \operatorname {domain} f\subseteq \operatorname {domain} F}
and
F
|
domain
f
=
f
.
{\displaystyle F{\big \vert }_{\operatorname {domain} f}=f.}
A linear extension (respectively, continuous extension, etc.) of a function
f
{\displaystyle f}
is an extension of
f
{\displaystyle f}
that is also a linear map (respectively, a continuous map, etc.).
Examples
The restriction of the non-injective function
f
:
R
→
R
,
x
↦
x
2
{\displaystyle f:\mathbb {R} \to \mathbb {R} ,\ x\mapsto x^{2}}
to the domain
R
+
=
[
0
,
∞
)
{\displaystyle \mathbb {R} _{+}=[0,\infty )}
is the injection
f
:
R
+
→
R
,
x
↦
x
2
.
{\displaystyle f:\mathbb {R} _{+}\to \mathbb {R} ,\ x\mapsto x^{2}.}
The factorial function is the restriction of the gamma function to the positive integers, with the argument shifted by one:
Γ
|
Z
+
(
n
)
=
(
n
−
1
)
!
{\displaystyle {\Gamma |}_{\mathbb {Z} ^{+}}\!(n)=(n-1)!}
Properties of restrictions
Restricting a function
f
:
X
→
Y
{\displaystyle f:X\rightarrow Y}
to its entire domain
X
{\displaystyle X}
gives back the original function, that is,
f
|
X
=
f
.
{\displaystyle f|_{X}=f.}
Restricting a function twice is the same as restricting it once, that is, if
A
⊆
B
⊆
dom
f
,
{\displaystyle A\subseteq B\subseteq \operatorname {dom} f,}
then
(
f
|
B
)
|
A
=
f
|
A
.
{\displaystyle \left(f|_{B}\right)|_{A}=f|_{A}.}
The restriction of the identity function on a set
X
{\displaystyle X}
to a subset
A
{\displaystyle A}
of
X
{\displaystyle X}
is just the inclusion map from
A
{\displaystyle A}
into
X
.
{\displaystyle X.}
The restriction of a continuous function is continuous.
Applications
Inverse functions
For a function to have an inverse, it must be one-to-one. If a function
f
{\displaystyle f}
is not one-to-one, it may be possible to define a partial inverse of
f
{\displaystyle f}
by restricting the domain. For example, the function
f
(
x
)
=
x
2
{\displaystyle f(x)=x^{2}}
defined on the whole of
R
{\displaystyle \mathbb {R} }
is not one-to-one since
x
2
=
(
−
x
)
2
{\displaystyle x^{2}=(-x)^{2}}
for any
x
∈
R
.
{\displaystyle x\in \mathbb {R} .}
However, the function becomes one-to-one if we restrict to the domain
R
≥
0
=
[
0
,
∞
)
,
{\displaystyle \mathbb {R} _{\geq 0}=[0,\infty ),}
in which case
f
−
1
(
y
)
=
y
.
{\displaystyle f^{-1}(y)={\sqrt {y}}.}
(If we instead restrict to the domain
(
−
∞
,
0
]
,
{\displaystyle (-\infty ,0],}
then the inverse is the negative of the square root of
y
.
{\displaystyle y.}
) Alternatively, there is no need to restrict the domain if we allow the inverse to be a multivalued function.
Selection operators
In relational algebra, a selection (sometimes called a restriction to avoid confusion with SQL's use of SELECT) is a unary operation written as
σ
a
θ
b
(
R
)
{\displaystyle \sigma _{a\theta b}(R)}
or
σ
a
θ
v
(
R
)
{\displaystyle \sigma _{a\theta v}(R)}
where:
a
{\displaystyle a}
and
b
{\displaystyle b}
are attribute names,
θ
{\displaystyle \theta }
is a binary operation in the set
{
<
,
≤
,
=
,
≠
,
≥
,
>
}
,
{\displaystyle \{<,\leq ,=,\neq ,\geq ,>\},}
v
{\displaystyle v}
is a value constant,
R
{\displaystyle R}
is a relation.
The selection
σ
a
θ
b
(
R
)
{\displaystyle \sigma _{a\theta b}(R)}
selects all those tuples in
R
{\displaystyle R}
for which
θ
{\displaystyle \theta }
holds between the
a
{\displaystyle a}
and the
b
{\displaystyle b}
attribute.
The selection
σ
a
θ
v
(
R
)
{\displaystyle \sigma _{a\theta v}(R)}
selects all those tuples in
R
{\displaystyle R}
for which
θ
{\displaystyle \theta }
holds between the
a
{\displaystyle a}
attribute and the value
v
.
{\displaystyle v.}
Thus, the selection operator restricts to a subset of the entire database.
The pasting lemma
The pasting lemma is a result in topology that relates the continuity of a function with the continuity of its restrictions to subsets.
Let
X
,
Y
{\displaystyle X,Y}
be two closed subsets (or two open subsets) of a topological space
A
{\displaystyle A}
such that
A
=
X
∪
Y
,
{\displaystyle A=X\cup Y,}
and let
B
{\displaystyle B}
also be a topological space. If
f
:
A
→
B
{\displaystyle f:A\to B}
is continuous when restricted to both
X
{\displaystyle X}
and
Y
,
{\displaystyle Y,}
then
f
{\displaystyle f}
is continuous.
This result allows one to take two continuous functions defined on closed (or open) subsets of a topological space and create a new one.
Sheaves
Sheaves provide a way of generalizing restrictions to objects besides functions.
In sheaf theory, one assigns an object
F
(
U
)
{\displaystyle F(U)}
in a category to each open set
U
{\displaystyle U}
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 nested open sets; that is, if
V
⊆
U
,
{\displaystyle V\subseteq U,}
then there is a morphism
res
V
,
U
:
F
(
U
)
→
F
(
V
)
{\displaystyle \operatorname {res} _{V,U}:F(U)\to F(V)}
satisfying the following properties, which are designed to mimic the restriction of a function:
For every open set
U
{\displaystyle U}
of
X
,
{\displaystyle X,}
the restriction morphism
res
U
,
U
:
F
(
U
)
→
F
(
U
)
{\displaystyle \operatorname {res} _{U,U}:F(U)\to F(U)}
is the identity morphism on
F
(
U
)
.
{\displaystyle F(U).}
If we have three open sets
W
⊆
V
⊆
U
,
{\displaystyle W\subseteq V\subseteq U,}
then the composite
res
W
,
V
∘
res
V
,
U
=
res
W
,
U
.
{\displaystyle \operatorname {res} _{W,V}\circ \operatorname {res} _{V,U}=\operatorname {res} _{W,U}.}
(Locality) If
(
U
i
)
{\displaystyle \left(U_{i}\right)}
is an open covering of an open set
U
,
{\displaystyle U,}
and if
s
,
t
∈
F
(
U
)
{\displaystyle s,t\in F(U)}
are such that
s
|
U
i
=
t
|
U
i
{\displaystyle s{\big \vert }_{U_{i}}=t{\big \vert }_{U_{i}}}
for each set
U
i
{\displaystyle U_{i}}
of the covering, then
s
=
t
{\displaystyle s=t}
; and
(Gluing) If
(
U
i
)
{\displaystyle \left(U_{i}\right)}
is an open covering of an open set
U
,
{\displaystyle U,}
and if for each
i
{\displaystyle i}
a section
x
i
∈
F
(
U
i
)
{\displaystyle x_{i}\in F\left(U_{i}\right)}
is given such that for each pair
U
i
,
U
j
{\displaystyle U_{i},U_{j}}
of the covering sets the restrictions of
s
i
{\displaystyle s_{i}}
and
s
j
{\displaystyle s_{j}}
agree on the overlaps:
s
i
|
U
i
∩
U
j
=
s
j
|
U
i
∩
U
j
,
{\displaystyle s_{i}{\big \vert }_{U_{i}\cap U_{j}}=s_{j}{\big \vert }_{U_{i}\cap U_{j}},}
then there is a section
s
∈
F
(
U
)
{\displaystyle s\in F(U)}
such that
s
|
U
i
=
s
i
{\displaystyle s{\big \vert }_{U_{i}}=s_{i}}
for each
i
.
{\displaystyle 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 (or domain restriction or left-restriction)
A
◃
R
{\displaystyle A\triangleleft R}
of a binary relation
R
{\displaystyle R}
between
E
{\displaystyle E}
and
F
{\displaystyle F}
may be defined as a relation having domain
A
,
{\displaystyle A,}
codomain
F
{\displaystyle F}
and graph
G
(
A
◃
R
)
=
{
(
x
,
y
)
∈
F
(
R
)
:
x
∈
A
}
.
{\displaystyle G(A\triangleleft R)=\{(x,y)\in F(R):x\in A\}.}
Similarly, one can define a right-restriction or range restriction
R
▹
B
.
{\displaystyle R\triangleright B.}
Indeed, one could define a restriction to
n
{\displaystyle n}
-ary relations, as well as to subsets understood as relations, such as ones of the Cartesian product
E
×
F
{\displaystyle E\times F}
for binary relations.
These cases do not fit into the scheme of sheaves.
Anti-restriction
The domain anti-restriction (or domain subtraction) of a function or binary relation
R
{\displaystyle R}
(with domain
E
{\displaystyle E}
and codomain
F
{\displaystyle F}
) by a set
A
{\displaystyle A}
may be defined as
(
E
∖
A
)
◃
R
{\displaystyle (E\setminus A)\triangleleft R}
; it removes all elements of
A
{\displaystyle A}
from the domain
E
.
{\displaystyle E.}
It is sometimes denoted
A
{\displaystyle A}
⩤
R
.
{\displaystyle R.}
Similarly, the range anti-restriction (or range subtraction) of a function or binary relation
R
{\displaystyle R}
by a set
B
{\displaystyle B}
is defined as
R
▹
(
F
∖
B
)
{\displaystyle R\triangleright (F\setminus B)}
; it removes all elements of
B
{\displaystyle B}
from the codomain
F
.
{\displaystyle F.}
It is sometimes denoted
R
{\displaystyle R}
⩥
B
.
{\displaystyle B.}
See also
Constraint – Condition of an optimization problem which the solution must satisfy
Deformation retract – Continuous, position-preserving mapping from a topological space into a subspacePages displaying short descriptions of redirect targets
Local property
Function (mathematics) § Restriction and extension
Binary relation § Restriction
Relational algebra § Selection (σ)
References