\documentclass[t,aspectratio=169]{beamer}
\usetheme{metropolis}
\metroset{block=fill}

\input{../../_assets/basicslide1}
\input{../../_assets/macros}

\author{Samuel Vaiter}
\date{}
\institute{
Created: 2023-11-08.\\
Last update: 2023-11-08.\\
Status: inprogress.}
\title{Convex set}

\begin{document}

\begin{frame}
  \titlepage
\end{frame}

\begin{frame}
  \frametitle{Convex set}

  A set $C$ is convex if every\only<2->{\alert{ open}} segment of $C$ is contained in $C$.
  \vspace{-0.5cm}
  \begin{center}
    \begin{tikzpicture}
      \draw[open set] (0,0) .. controls (1,1) and (2,1) .. (3,0) .. controls (2,-1) and (1,-1) .. (0,0);

      \coordinate[label=below:$x$] (x) at (0.6,0.25);
      \coordinate[label=$y$] (y) at (2.3,-0.25);

      \fill (x) circle [radius=2pt];
      \fill (y) circle [radius=2pt];
      \draw (x) -- (y);

      \node[below] at (0,0) {$C$};
    \end{tikzpicture}
    \qquad
    \begin{tikzpicture}
      \draw[open set] (0,0) .. controls (0.5,2) and (0.6,-1) .. (3,0) .. controls (2,-1) and (1,-1) .. (0,0);

      \coordinate[label=below:$x$] (x) at (0.6,0.25);
      \coordinate[label=$y$] (y) at (2.3,-0.25);

      \fill (x) circle [radius=2pt];
      \fill (y) circle [radius=2pt];
      \draw (x) -- (y);

      \node[below] at (3,0) {$D$};
    \end{tikzpicture}
  \end{center}

  \begin{definition}[Convex set]
    A set $C \subseteq \mathcal{X}$ is \alert{convex} if
    \[
      \forall (x,y) \in C^{2}, \forall \lambda \in \alt<2>{\alert{(0,1)}}{[0,1]},
      \quad
      \lambda x + (1-\lambda) y \in C
    \]
  \end{definition}

  {\color{gray}\small Exercice: Prove the equivalence between $[0,1]$ and $(0,1)$.}
\end{frame}

\begin{frame}
  \frametitle{Examples of convex sets}

  % \begin{tcbraster}[raster columns=2,raster equal height,nobeforeafter]
  \begin{columns}
    \begin{column}{0.45\linewidth}
      \begin{tcolorbox}[title={Convex sets of $\RR$ = intervals}]
        \begin{tikzpicture}
          \draw (-1,0) -- (4,0);
          \draw[[-), thick, blue] (0,0) -- (1,0);
          \draw (-1,-0.5) -- (4,-0.5);
          \draw[[-, thick, blue] (-0.25,-0.5) -- (4,-0.5);
        \end{tikzpicture}
      \end{tcolorbox}
      \begin{tcolorbox}[title={Simplex \& Orthant}]
        nonnegative orthant \[\RR_{\geq 0}^{d} = \setcond{x}{x_{i} \geq 0}\]
        simplex \[\Delta^{d-1} = \RR_{\geq 0}^{d} \cap \setcond{x}{\textstyle\sum_{i} x_{i} = 1}\]
      \end{tcolorbox}
    \end{column}
    \begin{column}{0.55\linewidth}
      \begin{tcolorbox}[title={Affine hyperplanes \& half-spaces}]
        $\varphi$: linear functional over $\Xx$\\
        hyperplane $H = \setcond{x \in \Xx}{\varphi(x) = \alpha}$
        half-space $H^{-} = \setcond{x \in \Xx}{\varphi(x) \leq \alpha}$
      \end{tcolorbox}
      \begin{center}
        \begin{tikzpicture}
          \fill[fill=gray!50] (0,0) rectangle (3,1.5) node[right] {$\RR_{\geq 0}^{2}$}; %orthant
          \fill[fill=gray!50] (-3,0.5) -- (3,-1.1) -- (3,-1.5) -- (-3,-1.5) node[above right] {$H^{-}$} -- cycle; %half-space

          \draw[->] (-3,0) -- (3,0);
          \draw[->] (0,-1.5) -- (0,1.5);

          \draw (0,1) -- (1,0) node[above right] {$\Delta^{1}$};
          \fill (0,1) circle [radius=2pt];
          \fill (1,0) circle [radius=2pt];

          \draw (-3,0.5) -- (3,-1.1) node[right] {$H$};
        \end{tikzpicture}
      \end{center}
    \end{column}
  \end{columns}
\end{frame}

\end{document}