TITLE: What is the best way to make notation in multi-variable calculus rigorous?
QUESTION [5 upvotes]: (Warning: long post worrying about formalism, may seem totally pointless to many.)
Related to "Can the idea of a 'function of a variable' be made rigorous?".
There is a disconnect in how mathematics is usually formalized and how mathematicians tend to write about derivatives. For example, it's not uncommon to see notation like:
\begin{alignat}{1}    v &= a^2b + 3ab
\\[5pt] \frac{\partial v}{\partial a} &= 2ab + 3b
\\[5pt] \frac{\partial v}{\partial b} &= a^2 + 3a
\\[5pt] a &= x^2 + y^2
\\[5pt] b &= xy
\\[5pt] \frac{\partial v}{\partial x} &= \frac{\partial v}{\partial a}\frac{\partial a}{\partial x} + \frac{\partial v}{\partial b}\frac{\partial b}{\partial x}
  \end{alignat}
This notation assumes that

A function 'knows' its variables, so that $\frac{\partial v}{\partial a}$ and $\frac{\partial v}{\partial b}$ are both well-defined and different
Different Variables refer to different objects, so that $v(a,b)$ and $v(x,y)$ are both well-defined and different
The same object can be both a function and a parameter, i.e., $a$ appears in the formulas $v=a^2b + 3ab$ and $a=x^2+y^2$

However, in the classical formalism, a function $f : \mathbb{R} \rightarrow \mathbb{R}$, say the one that doubles all inputs, is just a set of tuples $\{(1,2), (2,4), (3,6), ...\}$. (Alternatively, it may be a triple (domain, codomain, set-of-tuples), but this difference doesn't matter for this post.) This formalism doesn't support any of the above things:

If $v = \{((1,1),4), ...\}$, then $a$ and $b$ aren't objects of any kind. The function $v$ may be defineed using notation where 'a' an 'b' appear as bound variables, such as $v = \{((a,b),a^2b + 3ab) \;|\; (a,b) \in \mathbb R^2\}$, but they're only bound within the expression that defines the set $v$. This makes it "impossible" for $a = x^2 + y^2$ to refer to the $a$ that was used in $v = a^2b + 3ab$.
For the same reason, $v(a,b)$ and $v(x,y)$ cannot refer to different objects.
If a function's domain consists of real numbers, it doesn't consist of functions, so if $a$ and $b$ are functions, one can never evaluate $v(a,b)$.

I see three ways to deal with this disconnect

Ignore it and continue to do calculations that lead to correct results. That is, until one gets confused about things like 'wait $\frac{\partial v}{\partial a}$ is a function from what to what?'. In such a case, always stare at the expression long enough to figure it out. Proceed to pretend that there is no problem. Alternatively, never get confused, somehow (do people really do this?)
Try to interpret all notation as shorthands that talk about sets
Think of the notation as being grounded in a different formalism

I've been doing #1.1 ever since learning about set theory, but I'm no longer satisfied with that.
The problem with #2 is that it doesn't seem to correspond to how people think about what they're doing. Consider the fact that serious mathematicians write things like $v = v(a,b)$ or "$f$ is a function of $x$, and $g$ is a function of $y$". These statements have no meaning in terms of the underlying formalism (except to state that the domain of $f$ is one-dimensional): if one writes $f(x) = x^2$, then $f$ is a well-defined set, but $x$ is nothing whatsover (except a bound variable in a formula that defines the set $f$). This would make the statement "$f$ is a function of $x$" merely a hint for how to interpret future notation, similar to a statement like "we write $p(x)$ for $p(\{x\})$". Again, this does not seem to correspond to how people are thinking about the material.
#3 is something I'm very interested in but don't know much about.
My question: is there a satisfying solution for #2 or #3? Could $\lambda$-calculus be a candidate?

REPLY [2 votes]: This is more of an extended comment than an alternative answer. It all depends what you want to calculate. If you want to deal with implicit regions given by multiple equations without biased pairings/groupings of variables, then you'd need a bit more than are covered by the two answers at the time of writing.

I'll steal $a=x^{2}+y^{2}$ and $b=xy$ from the question and some notation from silver's answer. If you want to keep $a$ and $b$ paired and $x$ and $y$ paired, then Eike Schulte's answer seems like the tidiest approach, and I believe it covers the calculations that would appear in essentially all math texts.
With $x$ and $y$ paired, then there is no question that $\dfrac{\partial b}{\partial y}=x$ since $b=xy$ is suggesting a function $B:(x,y)\mapsto xy$ (or similarly $\widetilde{B}:\left(y,x\right)\mapsto xy$) and $\dfrac{\partial b}{\partial y}$ really means something like $\left(D_{2}B\right)\left(x,y\right)$ where $D_{2}$ means “partial with respect to the second argument” since $x$ is paired with $y$ (or similarly $\left(D_{1}\widetilde{B}\right)\left(y,x\right)$).
But we can do more than one calculation if we are agnostic about variable relationships. Suppose we just have $S=\left\{ \left(x,y,a,b\right):a=x^{2}+y^{2}\text{ and }b=xy\right\}$. This is a 2D surface in 4D space, and all the partial derivatives we might care about are slopes of relevant slices at various points.
One “partial derivative $\dfrac{\partial b}{\partial y}$” would be obtained as follows: Fix $x=x_{0}$ so that we have $\left\{ \left(x_{0},y,x_{0}^{2}+y^{2},x_{0}y\right):x\in\mathbb{R}\right\}$. Write the $b$ coordinate locally as a function of $y$ (i.e. $B(y)=x_{0}y$), and differentiate so that at any point $\left(x_{0},y_{0},x_{0}^{2}+y_{0}^{2},x_{0}y_{0}\right)$ we have $\dfrac{\partial b}{\partial y}=x_{0}$.
But another “partial derivative $\dfrac{\partial b}{\partial y}$” would be something like the following : Fix $a=a_{0}$ so that in a neighborhood of a point $\left(x,y,a_{0},b\right)\in S$ with $x\ne0$, we have (in generality by the implicit function theorem) $x=\pm\sqrt{a_{0}-y^{2}}$ (for an appropriate sign choice). Then we can write the $b$ coordinate locally as a function of $y$ (i.e. $B(y)=\pm y\sqrt{a_{0}-y^{2}}$) and differentiate. Thus, we would find that at $\left(x_{0},y_{0},a_{0},b_{0}\right)\in S$, $\dfrac{\partial b}{\partial y}=\pm\sqrt{a_{0}-y_{0}^{2}}\mp\dfrac{y_{0}^{2}}{\sqrt{a_{0}-y_{0}^{2}}}=\dfrac{a_{0}-2y_{0}^{2}}{\pm\sqrt{a_{0}-y_{0}^{2}}}=\dfrac{x_{0}^{2}-y_{0}^{2}}{x_{0}}=x_{0}-\dfrac{y_{0}^{2}}{x_{0}}$.
In thermodynamics (and some related fields?), it is common to distinguish these calculations by using subscripts to show the variable(s) being fixed initially. One might write $\left(\dfrac{\partial b}{\partial y}\right)_{x}=x$ and $\left(\dfrac{\partial b}{\partial y}\right)_{a}=x-\dfrac{y^{2}}{x}$.