Can the idea of a 'function of a variable' be made rigorous?
When we say “$y=f(x)$”, we are stating a typographical convention that we are going to adopt in the present context: Namely, whenever the letters $x$ and $y$ appear, the values to which they refer are connected by the functional relationship $f$. The terminology “$y$ is a function of $x$” is confusing. While it is still employed by many people who use mathematics, it is often avoided by present-day mathematicians, who are aware that $y$ and $f$ refer to quite different types of mathematical object.
For example, consider the function $$f:\Bbb R\to\Bbb R_{\geqslant0}:x\mapsto f(x):= x^2.$$ In this case, $f$ may be identified with a certain subset of $\Bbb R\times\Bbb R_{\geqslant0}$. Quite separately, and in addition, we may adopt the naming convention of using $y$ instead of $f(x)$. But $y$ is just some element of $\Bbb R_{\geqslant0}$, albeit dependent on $x$, while $f$ is a quite particular subset of $\Bbb R\times\Bbb R_{\geqslant0}$ (which determines the relationship between $x$ and $y$).
In this context, the notation “$y=y(x)$” is often used, which further reinforces the confusion between $y$ and $f$. This sort of notation may be convenient for (say) practical engineering calculations, but it's not a good place to start when you want to maintain a clear mathematical concept of function.
In the above, for simplicity, I have adopted the convention of identifying a function with its graph. In some branches of mathematics this is inconvenient, and to specify a function it is necessary to specify a codomain for it (of which the range of the function is a subset).
A function is a subset $f$ of $A\times B$ with$$\forall x_1\in A\forall x_2\in B\forall x_3\in B((x_1,\,x_2)\in f\land(x_1,\,x_3)\in f\to x_2=x_3).$$(Some would say a "function" can be multivalued, but I'll address that in another paragraph.) If some $(x_1,\,x_2)\in f$, we write $x_2=f(x_1)$, thereby forgetting the set theory. But if all we know about values $x,\,y$ is $y=f(x)$ or equivalently $(x,\,y)\in f$, recalling $f$ is a set is again useful: $f$ is just the set of values of $(x,\,y)$ consistent with our knowledge. So "$y$ is a function of $x$" is shorthand for "the set of values of $(x,\,y)$ consistent with our knowledge is a function", which is a nontrivial statement because of the unique-images property of functions.
Even if a "multivalued function" is what you have in mind, knowing which function $y$ is of $x$ means knowing the set of values of $(x,\,y)$ consistent with our knowledge. (Indeed, this is true regardless of how we define "function", although in this more general case we lose the nontriviality observed above.)
Feel free to repeat this analysis for concepts other than knowledge. For example, if $x,\,y$ are related by a physical process, the "function" is the set of physically realizable values of $(x,\,y)$. (There's no need to worry about how other variables may come into play, because we can assume $x,\,y$ are tuples in their own right, thereby folding everything relevant into this discussion. Even randomness/indeterminism doesn't trip us up, if you use what are called random functions, which have a nuanced but ultimately non-ruinous effect on the discussion similar to that of multivalued functions. We might end up saying "there exists a function $f$ for which $y$ is the function $f$ of $x$, but the choice of $f$ is random, so itself has a probability space for its possible values".)