Suppose I have an equation (this is a "legendre transform"):
$$f(x)=yx-g(x)\Huge {|}\large _{y=\frac {\partial g}{\partial x}}$$
Then intuitively, I can interpret the "such that" bar as a meta-operation: The formula on the right should replaced with the one where the $y$ is substituted with $\frac {\partial g}{\partial x}$.
But suppose instead that we have $f$ as a function of $y$:
$$f(y)=yx-g(x)\Huge {|}\large _{y=\frac {\partial g}{\partial x}}$$
Then it is unclear to me what this means formally, since if we just replace $y$ with $\frac {\partial g}{\partial x}$, $f(y)$ is not given as a function of $y$. Intuitively, I can think of the right hand side as: "the formula that you get when you substitute away $x$ from $yx-g(x)$ given the assumption that $y=\frac {\partial g}{\partial x}$". But it is unclear to me how this is interpreted formally/rigorously. (I am aware that such a formula doesn't always exist).
Context: The Legendre transform is used in the context of physics, see e.g. this answer.
In convex analysis, the Legendre transform of a convex function $g$ is the function $f$ defined by $$ \tag{1} f(z) = \sup_x \, \langle z, x \rangle - g(x). $$ (Technically, we should also assume that $g$ is lower semicontinuous in order to guarantee that $f$ is well-defined.)
If $g: \mathbb R^n \to \mathbb R$ is differentiable, we can evaluate the expression on the right by setting the gradient with respect to $x$ equal to $0$, which yields $$ \tag{2} z = \nabla g(x). $$ Assuming that $x$ has been chosen so that $(2)$ is satisfied, we have $$ f(\nabla g(x)) = \langle \nabla g(x), x \rangle - g(x). $$ However, it seems to me that (1) is a much more clear definition of $f$.