Inverse image as a function I'm trying to understand the below paragraph from Aluffi's "Chapter 0" textbook.

The standard notation for the inverse of a bijection $f$ is $f^{-1}$. This symbol is also used for functions that are not bijections, but in a slightly different context: if $f: A \to B$ is any function and $T \subseteq B$ is a subset of $B$, then $f^{-1} (T)$ denotes the subset of $A$ of `all elements that map to $T$'; that is,
$$f^{-1} (T) = \{a \in A \mid f(A) \in T\}.$$

In what sense, though, is the inverse image a function? It surely isn't a function on elements $B \to A$ since $f$ map not be injective. $T$ is a subset of $B$ and $f^{-1} (T)$ a subset of $A$, so can we say that $f^{-1}$ is a function from $\mathcal{P}(B)$ to $\mathcal{P}(A)$? I assume we have to require that both $A$ and $B$ are nonempty in this case.
 A: You're right that the inverse image of $f: A \longrightarrow B$ is a function on power sets $f^{-1}: \mathcal P(B) \longrightarrow \mathcal P(A)$, but there's no more of a concern about $A$ or $B$ being empty than there is for the existence of the function $f: A \longrightarrow B$ itself. The only issue that could arise is if $B = \emptyset$ but $A \neq \emptyset$. Then there is no function $f: A \longrightarrow B$ so there is no inverse image function $f^{-1}: \mathcal P(B) \longrightarrow \mathcal P(A)$. So long as $B \neq \emptyset$ or $A = \emptyset$ we can have functions $f: A \longrightarrow B$, so we can induce functions $f^{-1}: \mathcal P(B) \longrightarrow \mathcal P(A)$.
For instance, we have the identity function $f: \emptyset \longrightarrow \emptyset$. Since you are reading Aluffi, it is important that this exists, as it allows us to form the category of $\mathbf{Sets}$. The power set $\mathcal P(\emptyset) = \{\emptyset\}$, and the inverse image function $f^{-1}: \mathcal P(\emptyset) \longrightarrow \mathcal P(\emptyset)$ simply takes $f^{-1}(\emptyset) = \emptyset$. More generally, if $A = \emptyset$ and $B$ is any set, then there is a unique function $\emptyset \longrightarrow B$ (it is the only subset of $\emptyset \times B$ and is vacuously a function). Then the inverse image function takes $f^{-1}: \mathcal P(B) \longrightarrow \mathcal P(\emptyset) = \{\emptyset\}$ taking eveery subset $S \in \mathcal P(B)$ to $f^{-1}(S) = \emptyset$.
A: The quotation is commenting on the multiple uses of $f^{-1}$ for the inverse function (which need not exist, as you point out) and the inverse image (which is always a function).
We can always check that something is a function by running back to the definition of a function. One possible way to do that is using the ordered triple definition of a function.

First, let's define a function as an ordered triple consisting of a domain, a codomain and a set of ordered pairs.
If $f$ is a function from $X$ to $Y$ whose graph is $F$, then $f = (X, Y, F)$. Additionally, $F$ is constrained to have exactly one pair for each element of $X$.
$$f \;\;\text{is a function from $X$ to $Y$} \\ \textit{if and only if} \\ \forall x \in X \mathop. \Big(\text{$x$ is the first element of a unique $a$ in $F$ and the second element is in $Y$.}\Big)$$
I'm rather fond of the notations $f^\to$ for the direct image of $f$ and $f^\leftarrow$ for the inverse image of $f$.
We can define $f^\to$ as follows, where $f$ is a function from $X$ to $Y$.
$$ f^\to = (2^X, 2^Y, \,\{(W, \{f(a) \mathop| a \in W\}) \mathop| W \subset X \}\,) $$
We can define $f^\leftarrow$ as follows
$$ f^\leftarrow = (2^Y, 2^X, \,\{(K, \{a \mathop| a \in X \land f(a) \in K \}) \mathop| K \subset X \}) $$
$f^\rightarrow$ and $f^\leftarrow$ both have exactly one pair in their graph for every element of their domain, by construction. In addition, the fact that $f$ is a function means that the right elements of all the pairs are all elements of the codomain as desired.
