In order to prove the fgoagog thing we need to be able to do computations on trees at a low level of the Grzegorczyk hierarchy, so it doesn’t mess up the complexity of the whole group computation. I will give a model of finite trees that lies in ${E}_{3}$, the same level as Cannonito/Gatterdam’s standard index for the free group. (( this post has been sitting as a draft since the beginning of May because I wanted to make some nice tree pictures, but I’d rather just publish it now. So, the trees section is copied out of my notes and might not make sense ))

## Lists

First of all, I’ll show how to encode sequences of numbers so that they can be manipulated and read by ${E}_{3}$ functions. Let $({x}_{1},\dots ,{x}_{n})$ be a sequence of $n$ non-negative numbers.

First encode the list as a Gödel number:

$$encode({x}_{1},\dots ,{x}_{n})=\mathbf{x}=\prod _{i=1}^{n}({p}_{i}{)}^{{x}_{n}+1},$$

where ${p}_{i}$ is the ${i}^{\text{th}}$ prime. (( it’s just occurred to me that I haven’t shown that things such as finding primes and divisiblity tests and so on are ${E}_{3}$ computable. I’ll do another post after this one with suitable definitions for all that stuff ))

In order to actually do anything with this encoded list, we need to be able to find out its length and the value of the entry at any given position. $plog(\mathbf{x},p)$ return the exponent of the prime $p$ in $\mathbf{x}$:

$$\begin{array}{rcl}plog(\mathbf{x},p)& =& \{\begin{array}{lr}1+plog(\frac{{}^{\prime}{}^{\prime}\mathbf{x}}{p},p),& p\nmid \mathbf{x},\\ 0,& p\nmid \mathbf{x}.\end{array}\\ (\mathbf{x}{)}_{i}& =& plog(\mathbf{x},{p}_{i})\u20131\end{array}$$

I’m using $(\mathbf{x}{)}_{i}$ instead of ${x}_{i}$ to denote the ${i}^{\text{th}}$ element of an encoded list, just so it’s clear that’s what’s happening later on.

$lh(\mathbf{x})$ finds the length of an encoded list:

$$lh(\mathbf{x})=\underset{i\le \mathbf{x}}{\mu}(({p}_{i}\nmid \mathbf{x})\u20131)$$

Note that $\underset{i\le \mathbf{x}}{\mu}P(i)=\mathbf{x}+1$ if there is no $i\le \mathbf{x}$ such that $P(i)$ holds. The $i\le \mathbf{x}$ bit in the minimisation is so that the function is bounded – it doesn’t matter what upper bound I pick as long as it’s “enough”.

$find(\mathbf{x},n)$ returns the first occurence of $n$ in an encoded list $\mathbf{x}$:

$$find(\mathbf{x},n)=\underset{i\le \mathbf{x}}{\mu}(\mathbf{x}{)}_{i}=n$$

Make use of $find$ to determine whether an encoded list contains a given value:

$$contains(\mathbf{x},n)\iff (\mathbf{x}{)}_{find(\mathbf{x},n)}=n$$

This function to find the largest element of a list $\mathbf{x}$, $biggest(\mathbf{x})$, is defined by using a helper function $bigges{t}^{\prime}(\mathbf{x},n)$, which gives the biggest element up to $(\mathbf{x}{)}_{n}$:

$$\begin{array}{rcl}biggest(\mathbf{x})& =& bigges{t}^{\prime}(\mathbf{x},lh(\mathbf{x}))\\ \\ bigges{t}^{\prime}(\mathbf{x},0)& =& (\mathbf{x}{)}_{0}\\ bigges{t}^{\prime}(\mathbf{x},n+1)& =& max((\mathbf{x}{)}_{n+1},bigges{t}^{\prime}(\mathbf{x},n))\end{array}$$

$slice(\mathbf{x},s,e)$, which I will also write $\mathbf{x}[s\dots e]$, gives you the sublist of $\mathbf{x}$ starting at position $s$ and ending at position $e$. The max/min stuff is to make sure this function works sensibly even when given wrong inputs:

\[ $$\begin{array}{rcl}slice(\mathbf{x},s,e)& =& \prod _{i={s}^{\prime}}^{{e}^{\prime}}({p}_{i+1-{s}^{\prime}}{)}^{(\mathbf{x}{)}_{i}+1}\\ {e}^{\prime}& =& max(1,min(e,lh(\mathbf{x})))\\ {s}^{\prime}& =& max(1,min(s,{e}^{\prime}))\end{array}$$

$splice(\mathbf{x},n)$, also written $\mathbf{x}:n$, appends a value $n$ to the end of an encoded list $\mathbf{x}$:

$$splice(\mathbf{x},n)=\mathbf{x}\cdot {p}_{lh(\mathbf{x})+1}^{n+1}$$

## Trees

A tree consists of a set of vertices $V$ and a set of edges $E$ connecting pairs of vertices, with no loops.

A *rooted* tree has a unique vertex ${v}_{0}$ said to be at the ‘top’. In an *ordered* tree, the set of children of each vertex is ordered, so there is a leftmost child, and so on. A *plane recursive tree* is a rooted, ordered tree constructed by a process which begins with the root node and recursively adds vertices below existing ones.

We can assign a labelling to a plane recursive tree by giving vertices labels corresponding to the order in which they were added to the tree, beginning with $0$ for the root. This way, the sequence of labels encountered heading outwards from the root is always increasing. Every edge can also be given a unique labelling by saying that the edge ${e}_{ij}$, connecting vertex ${v}_{i}$ to ${v}_{j}$, has label $max(i,j)$.

Suppose we have a tree $T=(V,E)$ with root vertex ${v}_{0}$. $T$ is ${E}_{n}$ computable if there is an ${E}_{n}$-decidable labelling $i:V\to \mathbb{N}$ (we can assume $i({v}_{0})=0$) and an ${E}_{n}$-computable “parent function” ${p}_{T}:i(V)\to i(V)$ which gives the label of the parent of a vertex. We also require that ${p}_{T}({v}_{0})=0$.

A finite plane recursive tree can be entirely described in a canonical way by a *depth-first walk*. Note that every node has a single parent and a finite ordered set of children. The process on ‘visiting’ a vertex ${v}_{i}$ goes as follows: for each child node ${v}_{j}$, travel along ${e}_{ij}$ and visit ${v}_{j}$, then travel backwards along ${e}_{ij}$. The sequence of labelled edges travelled along by beginning this process at ${v}_{0}$ is the depth-first walk of the tree. Note that each edge is visited exactly twice – once heading outwards, and again heading back towards the root.

This sequence can then be encoded as a Gödel number by the method in Section 1. We will define a function $\varphi (\mathbf{x},n)$ which takes an encoded tree $\mathbf{x}$ and gives the parent of the vertex with label $n$. Note that the root vertex’s label will not appear in this sequence because it has no associated edge.

Some functions to work with encoded trees:

To find the first and second occurrences of the edge with label $n$ in the walk:

$$\begin{array}{rcl}fst(\mathbf{x},n)& =& find(\mathbf{x},n)\\ snd(\mathbf{x},n)& =& find(\mathbf{x}[fst(\mathbf{x},n)+1\dots lh(\mathbf{x})],n)\end{array}$$

To get the label of the ${n}^{\text{th}}$ child of the root:

$$\begin{array}{rcl}child(\mathbf{x},0)& =& (\mathbf{x}{)}_{0}\\ child(\mathbf{x},n+1)& =& (\mathbf{x}{)}_{snd(\mathbf{x},child(\mathbf{x},n))+1}\end{array}$$

To find the subtree descended from the ${n}^{\text{th}}$ child node:

$$\begin{array}{rcl}subtree(\mathbf{x},n)& =& \mathbf{x}[fst(child(\mathbf{x},n))+1\dots snd(child(\mathbf{x},n))-1]\end{array}$$

The number of children of the root node:

$$numchildren(\mathbf{x})=\underset{i<\mathbf{x}}{\mu}child(\mathbf{x},i)=0$$

Whether the root has a child with label $n$:

$$haschild(\mathbf{x},n)=\underset{i<numchildren(\mathbf{x})}{\mu}child(\mathbf{x},i)=n$$

Finally, the parent function. The idea is to basically do the depth-first walk, remembering which vertex you just came from. If you reach a subtree which doesn’t contain $n$ then turn back, or if you reach the required vertex then return the label of the vertex you just came from.

$$\begin{array}{rcl}{p}_{\mathbf{x}}(0)& =& 0\\ {p}_{\mathbf{x}}(n)& =& parent(\mathbf{x},n,0)\\ parent(\mathbf{x},n,p)& =& \{\begin{array}{lr}0,& \mathrm{\neg}(contains(\mathbf{x},n)),\\ p,& haschild(\mathbf{x},n),\\ parent(subtree(\mathbf{x},z),n,child(\mathbf{x},z)),& \text{otherwise.}\end{array}\end{array}$$

where $z:=\underset{i<numchildren(\mathbf{x})}{\mu}contains(subtree(\mathbf{x},i),n)$.

We will also need to know if the tree contains an edge ${e}_{ij}$:

$$hasedge(\mathbf{x},i,j)\iff {p}_{\mathbf{x}}(i)=j\wedge {p}_{\mathbf{x}}(j)=i$$

## Theorem

A finite ordered tree is ${E}_{3}$ computable.

### Proof

As the tree is finite, of course its labelling is ${E}_{3}$-decidable, and ${p}_{bfx}(n)$ as defined above is ${E}_{3}$-computable. $\u25fb$