%! TEX root = GT.tex
% vim: tw=50
% 14/10/2023 09AM

\begin{flashcard}[halls-marriage-thm]
\begin{theorem}[Hall's Marriage Theorem]
  \label{halls_thm}
  \cloze{Let $G$ be a bipartite graph, vertex classes
  $X$, $Y$. Then $G$ has a matching from $X$ to
  $Y$ if and only if $|\Gamma(A)| \ge |A| ~\forall
  A \subset X$ (this condition is sometimes called
  ``Hall's condition'').}
\end{theorem}

\begin{proof}[Proof 1]
  \cloze{
  Induction on $|X|$, noting $|X| = 1$ is trivial.
  Given $G$ with $|X| > 1$:

  \textbf{Question:} Do we have $|\Gamma(A)| >
  |A|$ for all $A \subset X$ ($A \neq \emptyset,
  X$)?

  If yes, pick $x \in X$ and $y \in \Gamma(x)$ and
  set $G' = G - x - y$. Then $\forall A \subset X
  - \{x\}$, $|\Gamma_{G'}(A)| \ge |A|$, because
  $|\Gamma_G(A)| \ge |A| + 1$ ($A \neq
  \emptyset$). So $G'$ has a matching from $X -
  \{x\}$ to $Y - \{y\}$ by induction hypothesis.
  Together with $xy$, this gives a matching from
  $X$ to $Y$.

  If no, then we have some $A \subset X$ ($A \neq
  \emptyset, X$) with $|\Gamma(A)| = |A|$. Let $B
  = \Gamma(A)$. Let $G' = G[A \cup B]$, $G'' = G[X
  \setminus A \cup Y \setminus B]$. For $C \subset
  A$, we have $|\Gamma_G(C)| \ge |C|$, so
  $|\Gamma_{G'}(C)| \ge |C|$ (as $\Gamma(A) = B$),
  so by induction, $G'$ has a matching from $A$ to
  $B$. For $C \subset X \setminus A$, we have
  $|\Gamma_G(C \cup A)| \ge |C| + |A|$, so
  $|\Gamma_G(C \cup A)$ contains at least $|C|$
  points of $Y \setminus B$ (as $\Gamma(A) = B$
  and $|B| = |A|$). But $\Gamma(A)$ is disjoint
  from $Y \setminus B$, so $|\Gamma_{G''}(C)| \ge
  C$, so by induction, $G''$ has a matching.
  }
\end{proof}
\end{flashcard}

\begin{proof}[Proof 2]
  Form a directed network by adding source $s$,
  joined to each $x \in X$ by an edge of capacity
  $1$. Add a sink $t$ joined to each $y \in Y$ by
  an edge of capacity $1$, and direct each $xy \in
  G$ from $X$ to $Y$ with capacity $\infty$ (some
  large integer).

  Then a matching is precisely an integer-valued
  flow of value $|X|$, so done by integrality form
  of max flow min cut if every cut has capacity
  $\ge |X|$.

  \begin{center}
      \includegraphics[width=0.6\linewidth]
      {images/4604edb06a6c11ee.png}
  \end{center}

  Suppose there is a cut $(S, S^c)$, where $S = \{s\} \cup A
  \cup B$ with capacity $< |X|$ ($A \subset X$, $B
  \subset Y$). We must have $\Gamma(A) \subset B$
  (else $S$ has infinite capacity). Hence $S$ has
  capacity $|X| - |A| + |B| \ge |X|$ since $|B|
  \ge |A|$ (as $B \supset \Gamma(A)$). So a cut of
  capacity less than $|X|$ is impossible.
\end{proof}

\begin{flashcard}[deficient-matching-defn]
\begin{definition*}[deficient matching]
  \cloze{A \emph{matching of deficiency $d$} in bipartite
  $G$ on $X$, $Y$ consists of $|X| - d$
  independent edges.}
\end{definition*}
\end{flashcard}

\begin{flashcard}[defect-hall-coro]
\begin{corollary}[Defect Hall]
  \label{defect_hall}
  \cloze{Let $G$ be a bipartite graph with classes
  $X$, $Y$. Then $G$ has a matching from $X$ to
  $Y$ of deficiency $d$ if and only if
  $|\Gamma(A)| \ge |A| - d ~\forall A \subset X$.}
\end{corollary}

\begin{proof}
  \phantom{}
  \begin{enumerate}[$\Rightarrow$]
    \item[$\Rightarrow$] \cloze{Trivial.}
    \item[$\Leftarrow$] \cloze{Form $G'$ from $G$ by
      adding $d$ new points to $Y$, joined to all
      points of $X$. Then $\forall A \subset X$,
      $\Gamma_{G'}(A)| \ge |A|$, so $G'$ has a
      matching (\nameref{halls_thm}). In this
      matching, at least $|X| - d$ are paired into
      $Y$.} \qedhere
  \end{enumerate}
\end{proof}
\end{flashcard}

\begin{flashcard}[transversal-defn]
\begin{definition*}[transversal]
  \cloze{
  A \emph{transversal} for sets $S_1, \ldots, S_n$
  consists of some distinct $x_1, \ldots, x_n$ with
  $x_i \in S_i ~\forall i$.
  }
\end{definition*}
\end{flashcard}

\begin{example*}
  $S_1 = \{a, b, c\}$, $S_2 = \{a, b\}$, $S_3 =
  \{c, d\}$, $S_4 = \{b, d\}$. Then $x_1 = b$,
  $x_2 = a$, $x_3 = c$, $x_4 = d$ is a
  transversal.
\end{example*}
\vspace{-1em}

When is there a transversal? Clearly need
\[ \left| \bigcup_{i \in A} S_i \right| \ge |A|
\qquad \forall A \subset \{1, \ldots, n\} \]
This should remind you of \nameref{halls_thm}.

\begin{flashcard}[transversal-coro]
\begin{corollary}
  \label{transversal_coro}
  Sets $S_1, \ldots, S_n$ have a transversal if
  and only if
  \[ \cloze{\left| \bigcup_{i \in A} S_i \right| \ge |A|
  \qquad \forall A \subset \{1, \ldots, n\}} \]
\end{corollary}

\begin{proof}
  \begin{enumerate}[$\Rightarrow$]
    \item[$\Rightarrow$] \cloze{Trivial.}
    \item[$\Leftarrow$] \cloze{WLOG each $S_i$
      finite. Form a bipartite graph $G$ with
      vertex classes $X = \{1, \ldots, n\}$ and $Y
      = \bigcup_i S_i$ by joining $i \in X$ to $j
      \in Y$ if $j \in S_i$. Then a transversal of
      $S_1, \ldots, S_n$ is precisely a matching
      from $X$ to $Y$. But
    \[ |\Gamma_G(A)| = \left| \bigcup_{i \in A}
      S_i \right| \ge |A| \qquad \forall A \subset
      X ,\]
      so done by \nameref{halls_thm}.} \qedhere
  \end{enumerate}
\end{proof}
\end{flashcard}

\begin{remark*}
  \cref{transversal_coro} is actually
  \emph{equivalent} to Hall, since if $G$ is
  bipartite, classes $X$ and $Y$ with $X = \{x_1,
  \ldots, x_n\}$, then a matching from $X$ to $Y$
  is exactly a transversal of the sets
  $\Gamma(x_1), \ldots, \Gamma(x_n)$.
\end{remark*}
