Solution (source code)

= Solution

A vector $g$ is a <subgradient> of the <convex function> $f$ at $x$ when
$$
f(y)\geq f(x)+g^T(y-x)
$$
for every $y$. The set of all such vectors is the <subdifferential> $\partial f(x)$. The <proximal operator> satisfies
$$
\boxed{u=\operatorname{prox}_f(x)
\quad\Longleftrightarrow\quad x-u\in\partial f(u).}
$$
More generally, $u=\operatorname{prox}_{tf}(x)$ exactly when $(x-u)/t\in\partial f(u)$.