Can someone check if the reasoning below is correct? Thank you in advance.
Suppose $X$ is open in $\Bbb R^k$ and $Y$ is open and bounded in $\Bbb R^n$. Further suppose $f\in C(\overline{X\times Y},\Bbb R)$ is differentiable in $X\times Y$ and there is a $\xi\in C^1(X,\Bbb R^n)$ such that $\xi(X)\subset Y$ and $$m(x):=\min_{y\in\overline Y}f(x,y)=f(x,\xi(x))$$ Find the gradient of $m:X\to \Bbb R$.
What I did was: observe first that $m$ seems well-defined under the conditions of the exercise, and because $f$ and $\xi$ are differentiable then $m$ describe local extrema of $f(x,\cdot)$ for some fixed $x\in X$, that is, we have that $D_x f(x,\xi(x))=0$, what by the differentiability of $f$ implies that $\partial f(x,\xi(x))=0$, thus $\nabla m(x)=0$ when $y\in Y$ by the characterization of critical points on differentiable functions.
However if $y\in\partial Y$ then $\nabla m(x)$ is not necessarily zero or defined because $f$ is not necessarily differentiable in $\overline{X\times Y}$. The image of $\xi$ is supposed to be a subset of $Y$, not of $\overline Y$... this seems a bit confuse.
In other words: it is possible that the two definitions of $m$ are not equivalent? It is required that $\xi(X)=\overline Y$, right? Otherwise the second definition of $m$ doesnt necessarily correspond to the first one.