TITLE: How to express “b is a power of 10” – Typographical Number Theory in Gödel Escher Bach
QUESTION [15 upvotes]: The book Gödel, Escher, Bach (GEB) by Douglas R. Hofstadter introduces a formal system called “Typographical Number Theory” (TNT). It's essentially first order predicate logic over the universe of natural numbers, with addition and multiplication but no exponentiation. Numbers are encoded using zero and the successor function $S$.
In one excercise, explicitely described as hard, one is asked to formalize the condition that a given number is a power of $10$.
My solution seems too simple, and GEB has been my first introduction to TNT, so I am doubtful that I have gotten this problem correct. Of course, due to my position on the learning curve, I think the Dunning-Kruger effect limits me from noticing my own flaw in this solution. Can anyone tell me how this is wrong, or if it is somehow miraculously correct?
$d$ is a power of $10$ iff:
$$\exists! a: \exists! b: \exists c: \exists d: (((a = SS0) \land (b = SSSSS0)) \land (((a \cdot c) \cdot (b \cdot c)) = d)) \\
$$

REPLY [5 votes]: Step 1: We can encode any finite sequence in just a few numbers
Any finite sequence $a_0,a_2,\ldots,a_n$ of (natural) numbers can be encoded as a predicate
$$\begin{align}P(x,k,\alpha,\beta,n)&\iff x\text{ is the $k$th term of thes given equence $a_0,\ldots,a_n$}\\&\iff k\le n\land x=\alpha\bmod{((k+1)\beta+1)}\\&\iff\exists t\colon n=k+t\land \exists t\colon \alpha\cdot x+t\cdot S(\beta\cdot Sk)\land \exists t\colon x+t=\beta\cdot Sk\end{align}$$
where the existence of suitable $\alpha,\beta$ is guaranteed by the Chinese Remainder Theorem. All we need is that the numbers $\beta+1,2\beta+1,\ldots,(n+1)\beta+1$ are coprime and $>a_k$, which can be achieved by letting $\beta$ a multiple of $(n+1)!$.
Example: $\alpha=1981297324554360860$, $\beta=2016$ can be used to encode (any inital seqgment of) the sequence $1,10,100,1000,10000,7101,6944,15819,\ldots$; especially, the first few terms happen to coincide with the first few powers of ten.
Step 2: We can talk about recursive sequences by using finite sequences
Assume we define a sequence by its initial term $a_0$ and a recursion $a_n=f(a_{n-1})$ (where we can express $f$ in TNT). Then we can encode the property that $x$ equals $a_n$ as
$$\begin{align}R(x,n)\iff\exists \alpha\exists\beta\colon &\quad P(a_0,0,\alpha,\beta,n)\\&\land P(x,n,\alpha,\beta,n)\\&\land\forall k\forall y\colon\bigl(( k<n\land P(y,k,\alpha,\beta,n))\to P(f(y),Sk,\alpha,\beta,n)\bigr)\\  \end{align}$$
Example: If $f(y)=10\cdot y$ and $a_0=1$, then the numbers $\alpha,\beta$ from the previous example make the statement $R(10000,4)$ true.
Step 3: We can encode "$b$ is a power of $10$"
This is just $$\exists n\colon R(b,n) $$
where $R$ is defined as in step 2 using $f(y)=10y$ and $a_0=1$.
Exercise: Recognize the methods of the two steps just described in the following:
∃n:∃a:∃c:∃d:∃e: ∀p:∀q:∀r:∀s:∀t: ∃f:∃g: 〈〈S(a· SSc)=(b+ (d· S(Sc· Sn))) ∧ (b+ e)=(Sc· Sn)〉 ∧ 〈〈〈¬S(p+ r)=n ∨ ¬S(a· SSc)=(q+ (s· S(Sc· Sp)))〉 ∨ ¬(q+ t)=(Sc· Sp) 〉 ∨ 〈S(a· SSc)=((SSSSSSSSSS0· q)+ (f· S(Sc· SSp))) ∧ ((SSSSSSSSSS0· q)+ g)=(Sc· SSp)〉〉〉