This exercise uses the notion of elementary extension, which will be introduced in Chapter 8 on model theory.
Let $\mathcal{M}$ be a non-standard model of $\mathcal{P}$, and let $A$ be a subset of the underlying set, $M$, of $\mathcal{M}$. We say that a function $f$ from $M^{p}$ into $M$ is definable with parameters from $A$ if there exists a formula $F\left[v_{0}, v_{1}, \ldots, v_{p}\right]$ of $\mathcal{L}_{0}$ with parameters in $A$ such that, for all $a_{1}, a_{2}, \ldots, a_{p}$ belonging to $M$, we have
$$
\mathcal{M} \vDash \forall v_{0}\left(F\left[a_{0}, a_{1}, \ldots, a_{p}\right] \Leftrightarrow v_{0} \simeq f\left(a_{0}, a_{1}, \ldots, a_{p}\right)\right)
$$
(a) Let $\mathcal{N}$ be a substructure of $\mathcal{M}$ whose underlying set, $N$, is closed under functions that are definable with parameters from $N$; in other words, it is such that for all $p \in \mathbb{N}$, for every function $f$ from $M^{p}$ into $M$ that is definable with parameters from $N$, and for all $a_{1}, a_{2}, \ldots, a_{p}$ belonging to $N$,
$$
f\left(a_{1}, \ldots, a_{p}\right) \in N
$$
Show that $\mathcal{N}$ is an elementary substructure of $\mathcal{M}$ (and is therefore a model of $\mathcal{P}$ ).
(b) Next, we say that a subset $X$ of $M^{p}$ is definable with parameters from $A$ if there exists a formula $G\left[v_{1}, \ldots, v_{p}\right]$ of $\mathcal{L}_{0}$ with parameters in $A$ such that, for all $a_{1}, a_{2}, \ldots, a_{p}$ belonging to $M$,
$$
\left(a_{0}, a_{1}, \ldots, a_{p}\right) \in X \quad \text { if and only if } \quad \mathcal{M} \models G\left[a_{1}, \ldots, a_{p}\right]
$$
Show that the collection of subsets of $M$ that are definable with parameters from $A$ forms a Boolean subalgebra of the algebra of all subsets of $M$.
Show that if $f$ and $g$ are functions from $M$ into $M$ that are definable with parameters from $A$, then the set $\{a \in M: f(a)=g(a)\}$ is definable with parameters from $A$.
(c) Let $F$ and $G$ be two maps from $M$ into $M$. Define the maps $S f, f+g$, and $f \times g$ from $M$ into $M$ by
$$
\begin{aligned}
S f(x) &=f(x)+1 \\
(f+g)(x) &=f(x)+g(x) \\
(f \times g)(x) &=f(x) \times g(x)
\end{aligned}
$$
Show that the set of functions definable with parameters from $A$ is closed under these operations.
(d) Let $\mathcal{B}$ be the Boolean algebra of subsets of $M$ that are definable with parameters from $A$, let $\mathcal{U}$ be an ultrafilter on this algebra, and let $\mathcal{F}$ be the set of functions from $M$ into $M$ that are definable with parameters from $M$.
Show that the relation $\approx$ on $\mathcal{F}$ defined by
$f \approx g \quad$ if and only if $\quad\{a \in M: f(a)=g(a)\} \in \mathcal{U}$
is an equivalence relation and that if $f \approx f^{\prime}$ and $g \approx g^{\prime}$, then
$$
S f \approx S f^{\prime}, \quad f+g \approx f^{\prime}+g^{\prime}, \quad f \times g \approx f^{\prime} \times g^{\prime} .
$$
If $f \in \mathcal{F}$, we let $f / \mathcal{U}$ denote the equivalence class of $f$ relative to $\approx$ and we let $\mathcal{F} / \mathcal{U}$ denote the set of equivalence classes relative to $\approx$.We then observe that it is possible to define the operations $S,+$, and $\times$ on $\mathcal{F} / \mathcal{U}$. The zero element, 0 , of $\mathcal{F} / \mathcal{U}$ will be, by definition, the equivalence class of the constant function equal to 0 . This allows us to treat $\mathcal{F} / \mathcal{U}$ as an $\mathcal{L}_{0}$-structure.
(e) For every element $a \in M$, let $\bar{a}$ denote the element of $\mathcal{F} / \mathcal{U}$ that is the equivalence class relative to $\approx$ of the constant function equal to $a$.
Show that the map from $\mathcal{M}$ into $\mathcal{F} / \mathcal{U}$ that sends $a \in M$ into $\bar{a} \in \mathcal{F} / \mathcal{U}$ is a homomorphism of $\mathcal{L}_{0}$-structures.
(f) Show that for every $p \in \mathbb{N}$, for every formula $F\left[v_{1}, \ldots, v_{p}\right]$ of $\mathcal{L}_{0}$, and for all $f_{1}, f_{2}, \ldots, f_{p}$ in $\mathcal{F}$, we have
$$
\mathcal{F} / \mathcal{U} \vDash F\left[f_{1} / \mathcal{U}, f_{2} / \mathcal{U}, \ldots, f_{p} / \mathcal{U}\right]
$$
if and only if
$$
\left\{a \in M: \mathcal{M} \vDash F\left[f_{1}(a), f_{2}(a), \ldots, f_{p}(a)\right]\right\} \in \mathcal{U}
$$
Conclude that the map from $\mathcal{M}$ into $\mathcal{F} / \mathcal{U}$ that sends $a \in M$ into $\bar{a} \in \mathcal{F} / \mathcal{U}$ is elementary (see Chapter 8).
(g) Suppose that $\mathbb{N}$ is an elementary substructure of $\mathcal{M}$. Show that if $f$ is a function from $M$ into $M$ that is definable with parameters from $\mathcal{M}$ and if $a \in M$, then there exists $b \in M$ such that
$$
\mathcal{M} \vDash \forall v_{0}\left(v_{0}<a \Rightarrow f\left(v_{0}\right)<b\right)
$$
(h) Let $\mathcal{M}$ be a proper elementary extension of $\mathbb{N}$. Show that there exists a proper elementary extension $\mathcal{N}$ of $\mathcal{M}$, with base set $N$, which satisfies
for all $a \in N$, there exists $b \in M$ such that $\mathcal{N} \vDash a<b$.