96. Restrictions and extensions
96.1 Definition: restriction
Suppose $F\colon A \to B$ is a function and $A' \subseteq A$. The restriction of $F$ to $A'$ is a function denoted $F|A'\colon A' \to B$, whose value $(F|A')(a)$ for $a \in A'$ is $F(a)$.
96.1.1 Remark Note that the codomain of the restriction is the codomain of the function.
96.1.2 Example Let $F\colon \{1,2,3\} \to \{2,4,5,6\}$ be defined by $F(1) = 4$ and $F(2) = F(3) = 5$, as before. Then $F$ restricted to $\{2,3\}$ has graph $\bigl\{\langle 2,5\rangle, \langle 3,5\rangle\bigr\}$ and $F|\{1,3\}$ has graph $\bigl\{\langle 1,4\rangle, \langle 3,5\rangle\bigr\}$. Observe that $F|\{2,3\}$ is a constant function and $F|\{1,3\}$ is injective, whereas $F$ is neither constant nor injective.
96.2 Definition: extension of a function
Let $F\colon A \to B$ and let $C$ be a set containing $A$ as a subset. Any function $G\colon C \to B$ for which $G|A = F$ is called an extension of $F$ to $C$.
96.2.1 Remark Note that both “restriction” and “extension” have to do with the domain.
96.2.2 Example Let $F\colon \{1,2,3\} \to \{2,4,5,6\}$ be defined by $F(1) = 4$ and $F(2) = F(3) = 5$, as before. Then $F$ has four extensions $F_{1}$, $F_{2}$, $F_{3}$, and $F_{4}$, to $\{1,2,3,7\}$, defined by $F_{1}(7) = 2$, $F_{2}(7) = 4$, $F_{3}(7) = 5$ and $F_{4}(7) = 6$. (Of course in all cases $F_{i}(n)$ is the same as $F(n)$ for $n = 1,2,3$).
96.2.3 Example The absolute value function $\mathrm{ABS}\colon \mathrm{R} \to \mathrm{R}$ is an extension of the inclusion of $\mathrm{R}^{+}$ into $\mathrm{R}$, and $\mathrm{id}_{\mathrm{R}}$ is a different extension of the same function.
96.2.4 Usage The meaning just given of “extension” is a different usage of the word from the meaning used in Definition 18.1 of the set of data items for which a predicate is true.
You may wonder how the word “extension” got two such different meanings. The answer is that the concept of extension of a predicate was named by logicians, whereas the concept of extension of a function was named by mathematicians.
96.2.5 Exercise For each of these functions from $\mathrm{R}$ to $\mathrm{R}$, state whether the function is injective or surjective, and state whether its restriction to $\mathrm{R}^{+} = \{r \in \mathrm{R} \mid r \geq 0\}$ is injective or surjective.
a) $x \mapsto x^{2}$.
b) $\lambda x.x+1$.
c) $\lambda x.1-x$.
(Answer on page 248.)
Pages 137–138 of the book (PDF).