What’s the difference between coding in second-order arithmetic and first-order arithmetic

computabilityproof-theoryreverse-math

I am trying to understand the difference in developing coding in first-order arithmetic and second-order arithmetic. I have read various kinds of phrases like "coding can be done in $I\Sigma_0$" and "coding can be done in $RCA_0$" which have confused me a bit since $I\Sigma_0$ is first-order and $RCA_0$ is second-order. For background, I have seen coding developed in an introductory logic course for proving the Incompleteness theorems.

I think the difference is that in an introductory logic textbook one is defining the coding functions, say, between finite sets and natural numbers $code:FiniteSet\rightarrow\mathbb{N}$ in ZFC, but you could do this in a much weaker meta-theory if you can talk about sets of natural numbers such as in a second-order theory like $RCA_0$.

In other words, I can define the function $code$ and prove it is injective, and so on within the formal theory $RCA_0$, but I cannot do this in a first-order theory. All I can do in the first-order setting is talk about codes directly, but the actual act of defining and making statements about coding functions cannot be expressed in this setting.

Is this a correct understanding of the situation? Extra comments and examples are welcome.

Best Answer

Recall that $\textbf{RCA}_0$ can only really talk about numbers an sets of numbers. So in particular you can only talk about other objects by means of codes. The set of all finite sets of natural numbers is a third order object. This means you cannot formalize $code$ as a second order object in $\textbf{RCA}_0$ since, without $code$, the theory $\textbf{RCA}_0$ cannot refer to the set of finite sequences or sets. Usually when we say in $\textbf{RCA}_0$, or any other fragment of second order arithmetic, that a function $f$ has as domain the set of all finite sets what we actually mean is that $f$ has domain equal to the range of $code$. We can, however, take $code$ to be defined by a formula of second order arithmetic. In that case you are correct that a theory $\textbf{RCA}_0$ can prove $code$ is injective.

To be precise, lets fix some coding of the finite sets. I prefer the Ackermann interpretation in which $x\in_{Ack} y$ if the $x$-th digit of the binary representation of $y$ is $1$. This has the advantage that any number will be the code for a finite set over $\textbf{I}\Delta^0_0 +\text{exp}$. Let $Code(X,y)$ be the formula : \begin{equation} \forall n\, (n\in X \leftrightarrow n\in_{Ack} y) \end{equation} which states that $y$ codes $X$. Let $IsFin(X)$ be the formula: \begin{equation} \exists k\,\forall n\, (n\in X\rightarrow n\leq k) \end{equation} It is straight forward to show that $\textbf{RCA}$ proves that: \begin{equation} \forall X\, (IsFin(X)\rightarrow \exists! y \, Code(X,y)) \end{equation} that is $Code$ is the graph of a function from $\{X\subseteq \mathbb{N}:IsFin(X)\}\rightarrow \mathbb{N}$

\begin{equation} \forall X,Y\, \forall z\,((IsFin(X)\wedge IsFin(Y)\wedge Code(X,z)\wedge Code (Y,z))\rightarrow X=Y) \end{equation} which states informally that $Code$ is the graph of an injection. We can also show that $Code$ is bijective, that is, for any number $x$ there exists a finite set $F$ such that $x$ is the code of $F$.

Of course we cannot quantify over the finite sets without the use of coding in a theory of first order arithmetic. So in particular, as you noted, you cannot formalize the statements above.

There are a few final considerations. The first is that the technical details of how finite sets are coded as numbers is almost always the same over fragments of second order arithmetic such as $\textbf{RCA}_0$ and fragments of first order arithmetic like $\textbf{I}\Delta^0_0 + \text{exp}$. You might wonder why would one would need to code finite sets as numbers in the context of second order arithmetic if we already have finite sets. The answer is that it lowers the order of the objects one is working with. For example, to formalize Konig's lemma I need to be able to formalize what a tree is in second order arithmetic. Usually a tree is taken to be a subset of $\mathbb{N}^{<\mathbb{N}}$ which is closed under initial segments. But this is an issue since $\mathbb{N}^{<\mathbb{N}}$ is a third order object if I just have codes for pairs.

Related Question