\section{Conjugate Functions}
\label{section:legendre}

\begin{definition}[Conjugate Function]
\label{definition:conjugate-function}
    Let $\dpn{E, F}{\lambda}$ be a duality over $\real$ and $f: E \to (-\infty, \infty]$ with $f \ne \infty$, then for each $\phi \in F$, 
    \[
    \sup_{x \in E}\dpn{x, \phi}{\lambda} - f(x) = \inf\bracsn{\alpha \in \real| \dpn{\cdot, \phi}{\lambda} - \alpha \le f}
    \]

    The mapping
    \[
    f^*: F \to (-\infty, \infty] \quad \phi \mapsto \sup_{x \in E}\dpn{x, \phi}{\lambda} - f(x)
    \]

    is the \textbf{conjugate function} of $f$ with respect to the duality $\dpn{E, F}{\lambda}$. 
\end{definition}
\begin{proof}
    Fix $\phi \in F$. Let $\alpha \in  \real$ such that $\dpn{x, \phi}{\lambda} - \alpha \le f(x)$ for all $x \in E$, then for any $x \in E$,  
    \[
    \dpn{x, \phi}{\lambda} - f(x) \le \dpn{x, \phi}{\lambda} - \dpn{x, \phi}{\lambda} + \alpha = \alpha
    \]

    so
    \[
    \sup_{x \in E}\dpn{x, \phi}{\lambda} - f(x) \le \inf\bracsn{\alpha \in \real| \dpn{x, \phi}{\lambda} - \alpha \le f(x) \forall x \in E}
    \]

    On the other hand, suppose that $\alpha = \sup_{x \in E} \dpn{x, \phi}{\lambda} - f(x) < \infty$, then
    \[
    \dpn{x, \phi}{\lambda} - \alpha \le f(x)
    \]

    for all $x \in E$. Therefore
    \[
    \sup_{x \in E}\dpn{x, \phi}{\lambda} - f(x) = \inf\bracsn{\alpha \in \real| \dpn{x, \phi}{\lambda} - \alpha \le f(x) \forall x \in E}
    \]
\end{proof}

\begin{lemma}
\label{lemma:conjugate-function-gymnatics}
    Let $\dpn{E, F}{\lambda}$ be a duality over $\real$ and $f, g: E \to (-\infty, \infty]$ with $f, g \ne \infty$, then
    \begin{enumerate}
        \item $f^*$ is convex and lower semicontinuous. 
        \item If $f \le g$, then $f^* \ge g^*$. 
        \item If $f^* \ne \infty$, then $f^{**} \le f$. 
    \end{enumerate}
\end{lemma}
\begin{proof}
    (1): By \autoref{proposition:convex-extension} and \autoref{proposition:semicontinuous-properties}. 

    (3): For each $x \in E$ and $\phi \in F$, 
    \begin{align*}
        \dpn{x, \phi}{\lambda} - f^*(\phi) &= \dpn{x, \phi}{\lambda} - \braks{\sup_{z \in E}\dpn{z, \phi}{\lambda} - f(z)} \\
        &= \dpn{x, \phi}{\lambda} + \braks{\inf_{z \in E}f(z) - \dpn{z, \phi}{\lambda}} \\
        &\le \dpn{x, \phi}{\lambda} + f(x) - \dpn{x, \phi}{\lambda} = f(x)
    \end{align*}

    As the above holds for all $\phi \in F$, $f^{**} \le f$.     
\end{proof}

\begin{theorem}[Fenchel's Inequality]
\label{theorem:fenchel-inequality}
    Let $\dpn{E, F}{\lambda}$ be a duality over $\real$ and $f: E \to (-\infty, \infty]$ with $f \ne \infty$, then for any $x \in E$ and $\phi \in F$, 
    \[
    \dpn{x, \phi}{\lambda} \le f(x) + f^*(\phi)
    \]

    with equality if and only if $\phi \in \partial f(x)$. 
\end{theorem}
\begin{proof}
    Let $x \in E$ and $\phi \in F$ with $f(x) < \infty$, then
    \[
        f(x) + f^*(\phi) \ge f(x) + \dpn{x, \phi}{\lambda} - f(x) = \dpn{x, \phi}{\lambda}
    \]

    For the equivalence, 
    \begin{align*}
        f(x) + f^*(\phi) &= \dpn{x, \phi}{\lambda} \\
        f^*(\phi) &= \dpn{x, \phi}{\lambda} - f(x) 
    \end{align*}

    if and only if for every $h \in E$, 
    \begin{align*}
        \dpn{x, \phi}{\lambda} - f(x) &\ge \dpn{x+h, \phi}{\lambda} - f(x+h) \\
        f(x + h) - f(x) &\ge \dpn{h, \phi}{\lambda} 
    \end{align*}

    if and only if $y \in \partial f(x)$. 
\end{proof}

\begin{lemma}
\label{lemma:closed-convex-epigraph}
    Let $E$ be a locally convex space over $\real$ and $f: E \to (-\infty, \infty]$ with $f \ne \infty$, then for each $(x, \alpha) \in \ol{\text{Conv}}(\text{epi}(f))$, $\bracs{x} \times [\alpha, \infty) \subset \ol{\text{Conv}}(\text{epi}(f))$. 
\end{lemma}
\begin{proof}
    First consider $\text{Conv}(\text{epi}(f))$. Let $(x, \alpha), (y, \beta) \in \text{Conv}(\text{epi}(f))$ such that
    \[
    \bracs{x} \times [\alpha, \infty), \bracs{y} \times [\beta, \infty) \subset \text{Conv}(\text{epi}(f))
    \]

    then for any $t \in [0, 1]$ and $\gamma \ge (1 - t)\alpha + t\beta$, there exists $\alpha' \ge \alpha$ and $\beta' \ge \beta$ such that $\gamma = (1 - t)\alpha' + t\beta'$. In which case, 
    \[
    ((1 - t)x + ty, \gamma) = ((1 - t)x + ty, (1 - t)\alpha' + t\beta') \in \text{Conv}(\text{epi}(f))
    \]

    so $\bracs{(1 - t)x + ty} \times [\gamma, \infty] \subset \text{Conv}(\text{epi}(f))$. 

    Since the set of points that satisfy the lemma is convex, and contains $\text{epi}(f)$, the lemma holds for all points in $\text{Conv}(\text{epi}(f))$. 

    Now consider $\ol{\text{Conv}}(\text{epi}(f))$. Let $(x, \alpha) \in \ol{\text{Conv}}(\text{epi}(f))$, $U \in \cn_E(0)$, and $\eps > 0$, then there exists $(y, \beta) \in \text{Conv}(\text{epi}(f))$ such that $x - y \in U$ and $|\alpha - \beta| < \eps$. As such a pair exists for all $U \in \cn_E(0)$ and $\eps > 0$, 
    \[
    \bracs{x} \times (\alpha, \infty) \subset \ol{\text{Conv}}(\text{epi}(f))
    \]
\end{proof}

\begin{proposition}
\label{proposition:lsc-affine-minorant}
    Let $E$ be a locally convex space over $\real$ and $f: E \to (-\infty, \infty]$ be convex and lower semicontinuous with $f \ne \infty$, then:
    \begin{enumerate}
        \item There exists $\phi \in E^*$ and $\alpha \in \real$ such that $\dpn{\cdot, \phi}{E} + \alpha \le f$. 
        \item $f^* \ne \infty$. 
    \end{enumerate}
    
\end{proposition}
\begin{proof}
    (1): Let $(x, \alpha) \in \bracs{f < \infty} \times \real \setminus \text{epi}(f)$. By the \hyperref[Hahn-Banach Theorem]{theorem:hahn-banach-geometric-2}, there exists $\phi \in F$ and $\mu \in \real$ such that
    \[
    \sup_{(y, \beta) \in \text{epi}(f)}\dpn{y, \phi}{E} + \mu \beta < \dpn{x, \phi}{E} + \mu \alpha
    \]

    Since for any $(y, \beta) \in A$, $\beta$ may be arbitrarily large by \autoref{lemma:closed-convex-epigraph}, $\mu < 0$. Thus for each $y \in E$, 
    \begin{align*}
        \dpn{x, \phi}{E} + \mu\alpha &> \dpn{y, \phi}{E} + \mu f(y) \\
        \dpn{x, \mu^{-1}\phi}{E} + \alpha & < \dpn{y, \mu^{-1}\phi}{E} + f(y) \\
        -\dpn{y, \mu^{-1}\phi}{E} + \dpn{x, \mu^{-1}\phi}{E} + \alpha &< f(y)
    \end{align*}

    so $-\dpn{\cdot, \mu^{-1}\phi}{E} + \dpn{x, \mu^{-1}\phi}{E} + \alpha \le f$.
\end{proof}



\begin{theorem}[Fenchel-Moreau]
\label{theorem:fenchel-moreau}
    Let $\dpn{E, F}{\lambda}$ be a duality over $\real$, and $f: E \to (-\infty, \infty]$ with $f \ne \infty$ and $f^{*} \ne \infty$, then:
    \begin{enumerate}
        \item For each $(\phi, \alpha) \in F \times \real$, denote $(\phi, \alpha) \le f$ if $\dpn{\cdot, \phi}{\lambda} - \alpha \le f$, then for each $x \in E$,  
        \[
        f^{**}(x) = \sup\bracs{\dpn{x, \phi}{\lambda} - \alpha|(\phi, \alpha) \in F \times \real, (\phi, \alpha) \le f}
        \]
        \item $\text{epi}(f^{**})$ is the $\sigma(E \times \real, F \times \real)$-closed convex hull of $\text{epi}(f)$. 
        \item The biconjugate $f^{**}$ is the greatest convex and $\sigma(E, F)$-lower semicontinuous function bounded above by $f$. 
        \item $f = f^{**}$ if and only if $f$ is convex and $\sigma(E, F)$-lower semicontinuous.  
    \end{enumerate}
\end{theorem}
\begin{proof}
    (1): Let $\phi \in F$ such that $f^*(\phi) < \infty$, then for each $x \in E$, 
    \[
    \dpn{x, \phi}{\lambda} - f^*(\phi) \le f(x)
    \]

    so $\dpn{\cdot, \phi}{\lambda} - f^*(\phi) \le f$, and
    \begin{align*}
    f^{**}(x) &= \sup_{\phi \in F} \dpn{x, \phi}{\lambda} - f^*(\phi) = \sup_{\substack{\phi \in F \\ f^*(\phi) < \infty}} \dpn{x, y}{\lambda} - f^*(\phi) \\
    &\le \sup\bracs{\dpn{x, \phi}{\lambda} - \alpha|(\phi, \alpha) \in F \times \real, (\phi, \alpha) \le f}
    \end{align*}
    
    On the other hand, let $\phi \in F$ and $\alpha \in \real$ such that $(\phi, \alpha) \le f$, then $f^*(\phi) \le \alpha$, and
    \[
    f^{**}(x) \ge \dpn{x, \phi}{\lambda} - f^*(\phi) \ge \dpn{x, \phi}{\lambda} - \alpha
    \]

    Therefore
    \[
        f^{**}(x) \ge \sup\bracs{\dpn{x, \phi}{\lambda} - \alpha| \phi \in F, \alpha \in \real, \dpn{\cdot, y}{\lambda} - \alpha \le f}
    \]

    (2): Let $A = \ol{\text{Conv}}(\text{epi}(f))$ and $(x, \alpha) \in E \times \real \setminus A$. By the \hyperref[Hahn-Banach Theorem]{theorem:hahn-banach-geometric-2}, there exists $\phi \in F$ and $\mu \in \real$ such that
    \[
    \sup_{(y, \beta) \in A}\dpn{y, \phi}{\lambda} + \mu \beta < \dpn{x, \phi}{\lambda} + \mu \alpha
    \]

    Since for any $(y, \beta) \in A$, $\beta$ may be arbitrarily large by \autoref{lemma:closed-convex-epigraph}, $\mu \le 0$. 

    In the case that $\mu < 0$, for each $y \in E$, 
    \begin{align*}
        \dpn{x, \phi}{\lambda} + \mu\alpha &> \dpn{y, \phi}{\lambda} + \mu f(y) \\
        \dpn{x, \mu^{-1}\phi}{\lambda} + \alpha & < \dpn{y, \mu^{-1}\phi}{\lambda} + f(y) \\
        -\dpn{y, \mu^{-1}\phi}{\lambda} + \dpn{x, \mu^{-1}\phi}{\lambda} + \alpha &< f(y)
    \end{align*}

    so $(-\mu^{-1}\phi, -\dpn{x, \mu^{-1}\phi}{\lambda} - \alpha) \le f$ and
    \[
    f^{**}(x) \ge -\dpn{x, \mu^{-1}\phi}{\lambda} + \dpn{x, \mu^{-1}\phi}{\lambda} + \alpha \ge \alpha
    \]

    Given that $f^* \ne \infty$, there exists at least one pair $(\phi_0, \gamma_0) \in F \times \real$ such that $(\phi_0, \gamma_0) \le f$. 
    
    Now suppose that $\mu = 0$ and let
    \[
    \gamma = \sup_{(y, \beta) \in A}\dpn{y, \phi}{\lambda} < \dpn{x, \phi}{\lambda}
    \]

    For each $t > 0$, let $\Phi_t = \phi_0 + t\phi$ and $\Gamma_t = t\gamma + \gamma_0$, then for each $y \in \bracs{f < \infty}$, 
    \[
    \dpn{y, \Phi_t}{\lambda} - \Gamma_t \le f(y) + t\dpn{y, \phi}{\lambda} - t\gamma \le f(y)
    \]

    so $(\Phi_t, \Gamma_t) \le f$. By (1), 
    \[
        f^{**}(x) \ge \dpn{x, \Phi_t}{\lambda} - \Gamma_t = \dpn{x, \phi_0}{\lambda} + \gamma_0  + t\underbrace{(\dpn{x, \phi}{\lambda} - \gamma)}_{> 0}
    \]

    As the above holds for all $t > 0$, $f^{**}(x) = \infty \ge \alpha$. Since $f^{**}(x) \ge \alpha$ for all $(x, \alpha) \in E \times \real \setminus A$, $\text{epi}(f^{**}) \subset \ol{\text{Conv}}(\text{epi}(f))$. 

    By \autoref{lemma:conjugate-function-gymnatics}, $f^{**}$ is lower semicontinuous and convex with so $f^{**} \le f$, so $\text{epi}(f^{**}) \supset \text{epi}(f)$ and $\text{epi}(f^{**}) \supset \ol{\text{Conv}}(\text{epi}(f))$.    
\end{proof}

\begin{corollary}
\label{corollary:separable-legendre}
    Let $\dpn{E, F}{\lambda}$ be a duality over $\real$, and $f: E \to (-\infty, \infty]$ with $f \ne \infty$ be convex and lower semicontinuous, then there exists $\seq{(\phi_n, \alpha_n)} \subset F \times \real$ such that for each $x \in E$, 
    \[
    f(x) = \sup_{n \in \natp} \dpn{x, \phi_n}{\lambda} - \alpha_n
    \]
\end{corollary}
\begin{proof}
    For each $(\phi, \alpha) \in F \times \real$, denote $(\phi, \alpha) \le f$ if $\dpn{\cdot, \phi}{\lambda} - \alpha \le f$. By the \hyperref[Fenchel-Moreau Theorem]{theorem:fenchel-moreau},  
    \[
    f^{**}(x) = \sup\bracs{\dpn{x, \phi}{\lambda} - \alpha|(\phi, \alpha) \in F \times \real, (\phi, \alpha) \le f}
    \]

    for all $x \in E$. By \autoref{proposition:separable-dual},
    \[
    S = \bracs{(\phi, \alpha) \in F \times \real| (\phi, \alpha) \le f}
    \]

    is separable with respect to $\sigma(F \times \real, E \times \real)$. Therefore there exists $\seq{(\phi_n, \alpha_n)} \subset S$ such that for each $x \in E$, 
    \[
    f(x) = \sup_{n \in \natp} \dpn{x, \phi_n}{\lambda} - \alpha_n
    \]
\end{proof}


