%! TEX root = LST.tex
% vim: tw=50
% 27/01/2024 09AM

\begin{flashcard}[ordisom-is-unique-prop]
\begin{proposition}
  Let $X$, $Y$ be \glsref[wellord]{well-ordered} sets
  that are \gls{ordisic}. Then there exists unique
  \gls{ordisism} $X \to Y$.
\end{proposition}

\fcscrap{
\begin{remark*}
  Not true in general for \glsref[linord]{linearly
  ordered} sets. For example for $\ZZ \to \ZZ$ we
  can take $n \mapsto n$ or $n \mapsto n + 17$,
  and for $[0, \infty) \to [0, \infty)$ can take
  $x \mapsto x$ or $x \mapsto x^2$.
\end{remark*}
}

\begin{proof}
  \cloze{Let $f, g : X \to Y$ be \glspl{ordisism}. We
  prove that $\forall x \in X$, $f(x) = g(x)$ by
  \gls{induction}. Let $x \in X$. Assume $f(y) = g(y)$
  for all $y \wlt x$ (\gls{induction} hypothesis).
  By \cref{ordisism_min_lemma},
  \begin{align*}
    f(x)
    &= \min(Y \setminus \{f(y) \st y \wlt x\}) \\
    g(x)
    &= \min(Y \setminus \{g(y) \st y \wlt x\})
  \end{align*}
  By \gls{induction} hypothesis,
  \[ \{f(y) \st y \wlt x\} = \{g(y) \st y \wlt x\} .\]
  So $f(x) = g(x)$.}
\end{proof}
\end{flashcard}

\begin{remark*}
  \glsref[induction]{Induction} proves things. We
  need a tool to construct things. This will be
  \emph{recursion}.
\end{remark*}

\begin{note*}
  A function from a set $X$ to a set $Y$ is a
  subset $f$ of $X \times Y$ such that:
  \begin{enumerate}[(i)]
    \item $\forall x \in X$, $\exists y \in Y$
      such that $(x, y) \in f$.
    \item $\forall x \in X$, $\forall y, z \in Y$
      $((x, y) \in f \wedge (x, z) \in f) \implies
      (y = z)$.
  \end{enumerate}
  Of course we write `$y = f(x)$' instead of `$(x,
  y) \in f$'. Note that $f \in \PP(X \times Y)$.
  For $Z \subset X$, the restriction of $f$ to $Z$
  is $f|_Z = \{(x, y) \in f \st x \in Z\}$. $f|_Z$
  is a function $Z \to Y$, so $f|_Z \subset Z
  \times Y \subset X \times Y$, so $f|_Z \in \PP(X
  \times Y)$.
\end{note*}

\begin{flashcard}[definition-by-recursion-thm]
\begin{theorem}[Definition by recursion]
  \label{recursion}
  \cloze{Let $X$ be a \glsref[wellord]{well-ordered} set
  and $Y$ be an arbitrary set. Then for any
  function $G : \PP(X \times Y) \to Y$ there is a
  unique function $f : X \to Y$ such that $f(x) =
  G(f|_{\I_x})$ for every $x \in X$.}
\end{theorem}

\begin{proof}
  \cloze{\textbf{Uniqueness:} Assume $f, g$ both satisfy
  the conclusion. Given $x \in X$, if $f(y) =
  g(y)$ for all $y \wlt x$, then $f(x) = G(f|_{\I_x})
  = G(g|_{\I_x}) = g(x)$. So by induction, $f =
  g$.

  \textbf{Existence:} Say $h$ is an \emph{attempt}
  if $h$ is a function $I \to Y$ for some \gls{is}
  $I$ of $X$ such that $\forall x \in I$, $h(x) =
  G(h|_{\I_x})$ (note $\I_x \subset I$). Let $h,
  h'$ be attempts. We show that $\forall x \in X$,
  if $x \in \dom(h) \cap \dom(h')$, then $h(x) =
  h'(x)$. Here, $\dom(h)$ is the domain of $h$,
  i.e. $I$ as above. Fix $x \in \dom(h) \cap
  \dom(h')$ and assume $h(y) = h'(y)$ for every $y
  \wlt x$ (note $y \wlt x$ implies $y \in \dom(h) \cap
  \dom(h')$). Then $h|_{\I_x} = h'|_{\I_x}$, so
  $h(x) = G(h|_{\I_x}) = G(h'|_{\I_x}) = h'(x)$.
  Then done by induction.

  What we have left to show for existence is that
  $\forall x \in X$ there exists an attempt $h$
  such that $x \in \dom h$. We prove this by
  induction. Fix $x \in X$ and assume that for $y
  \wlt x$ there is an attempt defined at $y$, and let
  $h_y$ be the unique attempt with domain $\{z \in
  X \st z \wle y\} = \I_y \cup \{y\}$. Then $h =
  \bigcup_{y \wlt x} h_y$ is a well-defined
  function on $\I_x$ and it is an attempt since
  fo$ y \wlt x$, $h(y) = h_y(y) = G(h_y|_{\I_x}) =
  G(h|_{\I_y})$. Then $h \cup \{(x, G(h))\}$ is an
  attempt with domain $\I_x \cup \{x\}$. Finally,
  define $f : X \to Y$, $f(x) = h(x)$ where $h$ is
  any attempt defined at $x$. This is well-defined
  by above and $f(x) = h(x) = G(h|_{\I_x}) =
  G(f|_{\I_x})$.}
\end{proof}
\end{flashcard}

\begin{flashcard}[subset-collapse-prop]
\begin{proposition}[Subset collapse]
  \label{subset_collapse}
  \cloze{Let $Y$ be a \glsref[wellord]{well-ordered} set
  and $X \subset Y$. Then $X$ is \gls{ordisic} to
  a unique \gls{is} of $Y$.}
\end{proposition}

\begin{proof}
  \cloze{Without loss of generality, $X \neq \emptyset$.

  \textbf{Uniqueness:} Assume $f : X \to I$ is an
  \gls{ordisism} where $I$ is an \gls{is} of $Y$.
  By \cref{ordisism_min_lemma}, $f(x) = \min(Y
  \setminus \{f(y) \st y \wlt x, y \in X\})$. So
  by induction, $f$ and hence $I$ are uniquely
  determined.

  \textbf{Existence:} Fix $y_0 \in Y$. By
  \cref{recursion}, there's a function $f : X \to
  Y$ such that
  \[ f(x) = \begin{cases}
    \min(Y \setminus \{f(y) \st y \in X, y \wlt
    x\}) & \text{if it exists} \\
    y_0 & \text{otherwise}
  \end{cases} \]
  We first prove that the `otherwise' clause never
  occurs. We prove that $\forall x \in X$, $f(x)
  \wle x$. If $\forall y \in X$, $y \wlt x$
  implies $f(y) \wle y$, then $x \in Y\setminus
  \{f(y) \st y \in X, y \wlt x\}$, so $f(x) \wle
  x$. Done by induction. This also shows that $f$
  is injective.

  $f$ order preserving: Given $y \wlt x$ in $X$,
  $f(x) \in Y \setminus \{f(z) \st z \in X, z \wlt
  x\} \subset Y \setminus \{f(z) \st z \in X, z
  \wlt y\}$. So $f(y) \wle f(x)$, and hence $f(y)
  \wlt f(x)$ by injectivity.

  $\Im f$ is an \gls{is} of $Y$: Assume $a \in Y
  \setminus \Im f$. We show $f(x) \wlt a$ for all
  $x \in X$. If $f(y) < a$ for all $y \in X$, $y <
  x$, then $a \in Y \setminus \{f(y) \st y \in X,
  y \wlt x\}$, so $f(x) \wle a$ and hence $f(x)
  \wlt a$. Done by induction.}
\end{proof}
\end{flashcard}

\begin{remark*}
  A \glsref[wellord]{well-ordered} set $X$ is not
  \gls{ordisic} to a proper \gls{is} of $X$ (by
  uniqueness). But $X$ is of course \gls{ordisic}
  to $X$.
\end{remark*}

\begin{notation*}
  \glssymboldefn{wole}{$\le$}{$\le$}
  Let $X$, $Y$ be \glsref[wellord]{well-ordered}
  sets. Write $X \wle Y$ if $X$ is \gls{ordisic}
  to an \gls{is} of $Y$.
\end{notation*}

\begin{example*}
  If $A = \left\{ \frac{1}{2}, \frac{2}{3},
  \frac{3}{4}, \ldots \right\} \cup \{1\}$. Then
  $\NN \wole A$.
\end{example*}

\begin{flashcard}[well-ordered-sets-form-a-well-order-thm]
\begin{theorem}
  \label{wole_leq_or_geq}
  Let $X, Y$ be \glsref[wellord]{well-ordered}
  sets. Then $X \wole Y$ or $Y \wole X$.
\end{theorem}

\begin{proof}
  \cloze{Assume $Y \not\wole X$. Then $Y \neq \emptyset$
  and we can fix $y_0 \in Y$. We recursively
  define $f : X \to Y$ by
  \[ f(x) = \begin{cases}
    \min(Y \setminus \{f(y) \st y \wlt x\}) &
    \text{if it exists} \\
    y_0 & \text{otherwise}
  \end{cases} \]
  If the `otherwise' clause occurs, let $x$ be the
  least element of $X$ when this happens. Then
  $f(\I_x) = Y$ and as in \cref{subset_collapse},
  $f$ is an \gls{ordisism} $\I_x \to Y$, which
  contradicts $Y \not \wole X$. So the `otherwise'
  clause never occurs. So as in proof of
  \cref{subset_collapse}, $f$ is an \gls{ordisism}
  to an \gls{is} of $Y$, i.e. $X \wole Y$.}
\end{proof}
\end{flashcard}

\begin{flashcard}[wole-wole-implies-ordisic-prop]
\begin{proposition}
  \label{wole_leq_geq_impl_eq}
  Let $X$, $Y$ be \glsref[wellord]{well-ordered}
  sets. If $X \wole Y$ and $Y \wole X$ then $X$
  and $Y$ are \gls{ordisic}.
\end{proposition}

\begin{proof}
  \cloze{Let $f : X \to Y$, $g : Y \to X$ be
  \glspl{ordisism} onto \gls{is} of $Y$, $X$
  respectively. Then $g \circ f$ is an
  \gls{ordisism} between $X$ and an \gls{ordisism} of
  $X$, so $g \circ f = \id_X$ by uniqueness in
  \cref{subset_collapse}. Similarly $f \circ g =
  \id_Y$.}
\end{proof}
\end{flashcard}
