\lecture{09}{2023-11-16}{}


\begin{definition}
    Let $R$  be a binary relation.
    $R$ is called \vocab{well-founded}
    if for all classes $X$,
    there is an $R$-least $y$ such that
    there is no $z \in X$ with $(z,y) \in R$.
\end{definition}

\begin{theorem}[Induction (again, but now with classes)]
    Suppose that $R$ is a well-founded relation.
    Let $X$ be a class such that for all sets $x$,
    \[
    \{y : (y,x) \in R\} \subseteq X \implies x \in X.
    \]
    Then $X$ contains all sets.
\end{theorem}
\begin{proof}
    Assume otherwise.
    Consider $Y = \{x : x \not\in X\} \neq \emptyset$.
    By hypothesis, there is some
    $x \in Y$ such that $(y,x) \not\in R$ for all $y  \in Y$.
    In other words, if $(y,x) \not\in R$,
    then $x \not\in Y$, i.e.~$x \in X$.
    Thus $\{y: (y,x) \in R\} \subseteq X$.
    Hence $x \in X \lightning$.
\end{proof}

An alternative way of formulating this is
\begin{theorem}
    Suppose $R$ is a well-founded binary relation on $A$,
    i.e.~$R \subseteq A \times A$.
    Suppose for all $\overline{A} \subseteq  A$
    is such that for all $x \in X$,
    \[
    \{y \in  A: (y,x) \in R\}  \subseteq \overline{A} \implies x \in \overline{A}.
    \]
    Then $\overline{A} = A$.
\end{theorem}

\begin{definition}
    Let $R$ be a binary relation.
    $R$ is called  \vocab{set-like}
    iff for all $x$,
    $\{y : (y,x) \in R\}$ is a set.
\end{definition}

\begin{theorem}
    \yalabel{Recursion Theorem}{recursion}{thm:recursion}
    Let $R$ be a well-founded
    and set-like relation on $A$ (i.e.~$R \subseteq  A \times A$).

    Let $D$ be a class of triples
    such that for all $u,x$ there is exactly
    one $y$ with $(u,x,y) \in D$
    (basically $(u,x) \mapsto y$ is a function).

    Then there is a unique function $f$ on $A$
    such that for all $x \in A$,
    \[
        (F\defon{ \{y \in A : (y,x) \in R\}}, x, F(x)) \in D\gist{,}{.}
    \]
    \gist{i.e.~$F(x)$ is computed from $F\defon{\{y \in A: (y,x) \in R\}}$.}{}
\end{theorem}
\begin{proof}
\gist{%
    Uniqueness:

    Let $F, F'$ be two such functions.
    Suppose that $\overline{A} = \{ x \in A : F(x) \neq F'(x)\} \neq \emptyset$.
    As $R$ is well-founded,
    there is some $x \in \overline{A}$
    such that $y \not\in  \overline{A}$
    for all $y \in A, (y,x) \in R$.
    I.e. $F(y) = F'(y)$
    for all $y \in A$, $(y,x) \in R$.

    But then $F(x)$
    is the unique $y$
    with $(F\defon{\{z\colon (z,x) \in R\}}, x, y) \in D$,
    in particular it is the same as $F'(x) \lightning$


    Existence:

    Let us call a (set) function $f$
    \emph{good},
    if
    \begin{itemize}
        \item $\dom(f) \subseteq A$,
        \item if $x \in \dom(f)$ and $y \in A, (y,x) \in R$,
            then $y \in \dom(f)$ and
        \item for all $x \in \dom(f)$ :
            \[
                (f\defon{\{y \in A: (y,x) \in R\}}, x, f(x)) \in D.
            \]
    \end{itemize}


    By the proof of uniqueness,
    we have that all good functions are coherent,
    i.e.~$f(x) = f'(x)$ for good functions
     $f,f'$ and all $x \in \dom(f) \cap \dom(f')$.
    We may now let $F = \bigcup \{f: f \text{ is good}\}$,
    this exists by comprehension.

    If $x \in \dom(F)$ and $y \in A$ with $(y,x) \in R$,
    then $y \in \dom(F)$
    and \[(F\defon{\{y : (y,x) \in R\}}, x,F(x)) \in D.\]

    We need to show that $\dom(F) = A$.
    This holds by induction:
    Suppose for a contradiction that $A \setminus \dom(F) \neq  \emptyset$.
    Then there exists an $R$-least element $x$ in this set,
    i.e.$x \not\in \dom(F)$,
    but $y \in \dom(F)$ for all $(y,x) \in R$.
    For each $y \in A$ with $(y,x) \in R$,
    pick some good function $f_y$ with $y \in \dom(f_y)$
    Since $R$ is set-like,
    we have that $f = \bigcup_y f_y$ is a good function.
    But then $f \cup (x,z)$,
    where $z$ is unique such that $(f\defon{\{y : (y,x) \in R\}}, x, z) \in D$,
    is good $\lightning$.
}{
    \begin{itemize}
        \item Uniqueness:

            Consider $\overline{A} \coloneqq \{x \in A : F(x) \neq  F'(x)\}$
            for two such functions. If $\overline{A} \neq \emptyset$,
            there is a minimal element $\lightning$.
        \item Existence:

            \begin{itemize}
                \item call set-function $f$ \emph{good} iff:
                    \begin{itemize}
                        \item $\dom(f) \subseteq A$,
                        \item $x \in \dom(f), y <_R x \implies y \in \dom(f)$,
                        \item $\forall x \in \dom(f).~(f\defon{\{y \in A : y <_R x\}}, x, f(x)) \in D$.
                    \end{itemize}
                \item $F \coloneqq \bigcup \{f : f \text{ good}\}$ (comprehension)
                \item $\dom F = A$ (induction).
            \end{itemize}

    \end{itemize}
}
\end{proof}
