The Hahn-Banach theorem is considered one of the most important results of functional analysis.
Theorem
Let $\mathcal X$ be a vector space over $\mathbb R$, let $p$ be a sublinear functional on $\mathcal X$, let $\mathcal M$ be a subspace of $\mathcal X$, and let $f$ be a linear functional on $\mathcal M$ such that $f\leq p$. Then there exists a linear functional $F$ on $\mathcal X$ such that $F\leq p$ and $F|_{\mathcal M}=f$.
Proof
We will first show that if $x\in\mathcal X\setminus\mathcal M$, then there exists a linear functional $g$ on $\mathcal M+\mathbb Rx$ such that $g\leq p$ and $g|_{\mathcal M}=f$.
Let $y_1,y_2\in\mathcal M$. Then$$f\left(y_1\right)+f\left(y_2\right)=f\left(y_1+y_2\right)\leq p\left(y_1+y_2\right)=p\left(y_1-x+x+y_2\right)\leq p\left(y_1-x\right)+p\left(x+y_2\right),$$which implies that$$f\left(y_1\right)-p\left(y_1-x\right)\leq p\left(x+y_2\right)-f\left(y_2\right).$$Let $\alpha$ be such that$$\sup\left\{f\left(y\right)-p\left(y-x\right):y\in\mathcal M\right\}\leq\alpha\leq\inf\left\{p\left(x+y\right)-f\left(y\right):y\in\mathcal M\right\}$$and define $g:\mathcal M+\mathbb Rx\to\mathbb R$ by $y+\lambda x\mapsto f\left(y\right)+\lambda\alpha$. Then $g$ is clearly linear and $g|_{\mathcal M}=f\leq p$.
Let $\lambda>0$. Then$$g\left(y+\lambda x\right)=f\left(y\right)+\lambda\alpha=\lambda\left[f\left(\frac{y}{\lambda}\right)+\alpha\right]\leq\lambda\left[f\left(\frac{y}{\lambda}\right)+p\left(x+\frac{y}{\lambda}\right)-f\left(\frac{y}{\lambda}\right)\right]=p\left(y+\lambda x\right).$$Let $\lambda=-\mu<0$. Then$$g\left(y+\lambda x\right)=g\left(y-\mu x\right)=f\left(y\right)-\mu\alpha=\mu\left[f\left(\frac{y}{\mu}\right)-\alpha\right]\leq\mu\left[f\left(\frac{y}{\mu}\right)-f\left(\frac{y}{\mu}\right)+p\left(\frac{y}{\mu}-x\right)\right]=p\left(y-\mu x\right)=p\left(y+\lambda x\right).$$Therefore, $g\leq p$.
Let $y_1,y_2\in\mathcal M$. Then$$f\left(y_1\right)+f\left(y_2\right)=f\left(y_1+y_2\right)\leq p\left(y_1+y_2\right)=p\left(y_1-x+x+y_2\right)\leq p\left(y_1-x\right)+p\left(x+y_2\right),$$which implies that$$f\left(y_1\right)-p\left(y_1-x\right)\leq p\left(x+y_2\right)-f\left(y_2\right).$$Let $\alpha$ be such that$$\sup\left\{f\left(y\right)-p\left(y-x\right):y\in\mathcal M\right\}\leq\alpha\leq\inf\left\{p\left(x+y\right)-f\left(y\right):y\in\mathcal M\right\}$$and define $g:\mathcal M+\mathbb Rx\to\mathbb R$ by $y+\lambda x\mapsto f\left(y\right)+\lambda\alpha$. Then $g$ is clearly linear and $g|_{\mathcal M}=f\leq p$.
Let $\lambda>0$. Then$$g\left(y+\lambda x\right)=f\left(y\right)+\lambda\alpha=\lambda\left[f\left(\frac{y}{\lambda}\right)+\alpha\right]\leq\lambda\left[f\left(\frac{y}{\lambda}\right)+p\left(x+\frac{y}{\lambda}\right)-f\left(\frac{y}{\lambda}\right)\right]=p\left(y+\lambda x\right).$$Let $\lambda=-\mu<0$. Then$$g\left(y+\lambda x\right)=g\left(y-\mu x\right)=f\left(y\right)-\mu\alpha=\mu\left[f\left(\frac{y}{\mu}\right)-\alpha\right]\leq\mu\left[f\left(\frac{y}{\mu}\right)-f\left(\frac{y}{\mu}\right)+p\left(\frac{y}{\mu}-x\right)\right]=p\left(y-\mu x\right)=p\left(y+\lambda x\right).$$Therefore, $g\leq p$.
Let $\mathcal F$ be the set of linear extensions $F$ of $f$ such that $F\leq p$. Note that elements of $\mathcal F$ are subsets of $\mathcal X\times\mathbb R$. Then $\mathcal F$ is partially ordered by inclusion. Since increasing unions of subspaces of $\mathcal X$ are subspaces of $\mathcal X$, unions of linearly ordered elements of $\mathcal F$ lie in $\mathcal F$. Thus, Zorn's lemma completes the proof.
$\blacksquare$