I'm looking for the mathematical name of a particular function which is available in several functional programming languages.
If $f$ is a function $f:X\to Y$, then define $g : Y \to 2^X$ as follows.
$g(y) = \{x \in X \mid f(x) = y\}$
For example, if $f(0) = 1, f(1) = 2, f(2) = 1, f(3) = 3$, then $g(0) = \emptyset, g(1)=\{0,2\}, g(2) = \{1\}, g(3)=\{3\}$.
Well, given a function $f:X\rightarrow Y$. Define the relation $$x\equiv x':\Longleftrightarrow f(x)=f(x').$$ This is an equivalence relation on $X$ and the equivalence class $\bar x = \{x'\in X\mid x\equiv x'\}$ of $x\in X$ is the fibre of $x$ w.r.t. $f$.
Then the function $g:Y\rightarrow 2^X$ is given by $g(y) = f^{-1}(y)$, where $f^{-1}(y)=\{x\in X\mid f(x)=y\}$ is the preimage of $y\in Y$ in $f$. This preimage is given by a fibre, i.e., if $f(x)=y$, then $f^{-1}(y) = \bar x$. Note that $g(y)=\emptyset$ if $y$ is not in the image of $f$.