So I came across an equality related to optimization in a paper and I'm having difficulty understanding why this is true.
Let $f_{1}(\mathbf{x}),\ldots,f_{m}(\mathbf{x})$ be $m$ functions, with $f_{i}(\mathbf{x}):\mathbb{R}^{n}\mapsto\mathbb{R}$ and $\mathrm{dom}\;f_{i}(\mathbf{x})=\mathcal{X}\subseteq\mathbb{R}^{n}$. Furthermore, let $f_{i}(\mathbf{x})=\underset{y_{i}\in\mathbb{R}}{\mathrm{max}\;}\hat{f}_{i}(\mathbf{x},y_{i})$. Let $g(z):\mathbb{R}\mapsto\mathbb{R}$ be a nondecreasing function, with $\mathrm{dom}\;g=\mathbb{R}$. Let $h(\mathbf{w}):\mathbb{R}^{m}\mapsto\mathbb{R}$ with $\mathrm{dom}\;h=\mathbb{R}^{n}$ with $h$ nondecreasing in each component. Then the following equality holds:
$$\underset{\mathbf{x}\in\mathcal{X}}{\mathrm{max}\;}h([g(f_{1}(\mathbf{x})),\ldots,g(f_{m}(\mathbf{x}))]^{T})=\underset{\mathbf{x}\in\mathcal{X},y_{i}\in\mathbb{R}}{\mathrm{max}\;}h([g(\hat{f}_{1}(\mathbf{x},y_{1})),\ldots,g_{m}(\hat{f}_{m}(\mathbf{x},y_{m}))]^{T})$$
My intuition is that we can somehow move the $\mathrm{max}$ operator outside since $g$ is nondecreasing and $h$ is nondecreasing in each component. I'd really appreciate if somebody could formally explain this (or let me know if my thinking is wrong!).
Thanks and cheers :)
Edit: Fixed a typo. Thanks @LinAlg!
Edit 2: I should emphasize that $\mathit{g}$ and $h$ are nondecreasing. This means that there could potentially be regions where the functions stay constant. I'd appreciate if someone could explain whether this would alter the equality in any way compared to the setting in which both $\mathit{g}$ and $h$ are strictly increasing.