Proof (recursion)
Call
-
a subset $Y \subseteq X$ downwards closed if for all $y\in Y$, $\op{pred}(y)\subseteq Y$; and
-
a function $f$ with domain $Y \subseteq X$ an attempt if for all $y\in Y$, we have $f(y) = z$ iff $ϕ(y, f|_{\op{pred}(y)}, z)$ holds.
We need to produce an attempt with domain $X$.
If $f$ and $g$ are attempts with $x\in \op{dom}(f)\cap \op{dom}(g)$, then $f(x) = g(x)$
Prove this by order induction. Suppose $x\in \op{dom}(f) \cap \op{dom}(g)$ is such that the claim holds for all $y<x$, so $f|_{\op{pred}(x)} = g|_{\op{pred}(x)}$. Then $f(x) = z$ iff $ϕ(x, f|_{\op{pred}(x)}, z)$ iff $ϕ(x, g|_{\op{pred}(x)}, z)$ iff $g(x) = z$, proving $f(x) = g(x)$.
This proves the uniqueness claim.
If $Y\subseteq X$ is downwards closed and such that for all $y\in Y$, there is an attempt with domain containing $y$, then there is an attempt with domain $Y$
Let $ψ(y,z)$ be the formula "there is an attempt $f$ with $y \in \op{dom}(f)$ and $f(y) = z$". $ψ$ is functional by our previous claim and total by hypothesis.
-
If we assume $\mathsf{Repl}$ holds, then find a set $r$ such that for all $y\in Y$ and $z$, if $ψ(y,z)$ holds, then $z\in r$.
-
If we a priori have a set $r$, then this is already satisfied.
Use $\mathsf{Sep}$ to construct $$ \begin{align*} f := \sb{(y,z)\in Y \times r}{ψ(y,z)}. \end{align*} $$ $f$ is an attempt with domain $Y$.
For all $x\in X$, there is an attempt with domain containing $x$
Prove by order induction. Suppose $x\in X$ is such that for all $y<x$, there is an attempt with domain containing $y$. By the last claim, there is an attempt $f$ with domain $\op{pred}(x)$. By totality of $ϕ$, find $z$ such that $ϕ(x, f, z)$ holds. Then $g := f \cup \set{(x,z)}$ is an attempt with domain $\op{pred}(x) \cup \set{x}$, which is downwards closed.
This together with the last claim proves there is an attempt with domain $X$.