Solution (source code)

= Solution

Let $v=\operatorname{prox}_J(u)$ and $p=u-v$. The <proximal operator> optimality condition gives $p\in\partial J(v)$. By <subgradient inversion under convex conjugacy>, $v\in\partial J^*(p)$. Since $v=u-p$, this is exactly the optimality condition defining $p=\operatorname{prox}_{J^*}(u)$. Uniqueness of both Hilbert proximal minimizers proves <Moreau decomposition>:
$$
\boxed{u=\operatorname{prox}_J(u)+\operatorname{prox}_{J^*}(u).}
$$
Both terms belong to the same <Hilbert space> after dual identification. No orthogonality of the two terms is asserted for a general convex $J$; that stronger property pertains to special indicator/cone cases.