Solution (source code)

= Solution

Use the <extended real numbers> $\overline{\mathbb R}=\mathbb R\cup\{-\infty,+\infty\}$. A <proper convex function> never takes $-\infty$ and is finite somewhere. Its <effective domain> is
$$
\boxed{\operatorname{dom}f=\{x\in\mathbb R^n:f(x)<+\infty\}}.
$$
For a <proper extended-real function>, <convexity> means
$$
f((1-t)x+ty)\leq(1-t)f(x)+tf(y),\qquad x,y\in\mathbb R^n,\quad0<t<1.
$$
The endpoint cases are identities; taking $0<t<1$ avoids the ambiguous product $0\cdot(+\infty)$. Equivalently, its <epigraph> is a <convex set>. In particular, the <effective domain> is a <convex set>. Properness is an additional condition: it rules out the identically $+\infty$ function and all $-\infty$ values, rather than requiring finiteness everywhere.

For $x\in\operatorname{dom}f$, the <subdifferential> is the set of supporting slopes
$$
\boxed{\partial f(x)=\{p\in\mathbb R^n:f(u)\geq f(x)+\langle p,u-x\rangle\ \text{for every }u\in\mathbb R^n\}}.
$$
Each element is a <subgradient>. Define $\partial f(x)=\varnothing$ outside $\operatorname{dom}f$. The defining <subgradient inequality> must hold globally, not merely in a neighborhood of $x$. For a differentiable finite <convex function>, $\partial f(x)=\{\nabla f(x)\}$.