Closed-form Ackermann variant function proof by induction

computer scienceinductionrecursion

Let $A$ be a variant of the Ackermann function.

$A(m,n)$=\begin{cases}2n&\text{if }m=0\\1&\text{if }m\ge1\text{ and }n=0\\2&\text{if }m\ge1\text{ and }n=1\\A\big(m-1,A(m,n-1)\big)&\text{if }m\ge1\text{ and }n\ge2.\end{cases}

A good guess for a closed form solution to this is as follows.

$A(m,n) = 2 \uparrow^{m} n$

The up-arrow is a notation created by Knuth where a single arrow represents exponentiation, double arrow represents tetration, triple arrow represents pentation and so on.

I am trying to prove this by induction but I am stuck because there are $2$ variables to possibly induct on. I was thinking of doing double induction over $m$ and $n$ where I prove the following:

$A(m,n) \implies A(m+1,n)$

$A(m,n) \implies A(m,n+1)$

If I assume the induction hypothesis holds for some $m$ and $n$, then I find it impossible to expand expressions like $A(m, A(m+1,n-1))$ from the first implication or $A(m-1, A(m,n))$ from the second implication.

I think my assumption that my induction hypothesis holds for some $m$ and $n$ is flawed and needs to be more nuanced than that. Any advice?

Best Answer

First, I think your definition is off a little. Your second case should be $1$, because $2^0 = 1$, etc.

Once that is fixed, your hypothesis is true. I was able to prove it in Agda.

Generally speaking, to prove something like this, it's natural for the structure of the induction to mirror the structure of the recursive definition (since in some ways, they are one and the same). So, for your case, you want an induction method based on cases:

  1. $∀n. P(0,n)$
  2. $∀m. P(1+m,0)$
  3. $∀m. P(1+m,1)$
  4. $∀m. (∀ n. P(m,n)) → ∀n. P(1+m,1+n) → P(1+m,2+n)$

This doesn't exactly match the particular structure of your definition in case 4, but it matches the justification for it. One recursive call is justified by decreasing on $n$ with the same $m$, and the other is justified by decreasing on $m$ with an arbitrarily large $n$.

And this isn't too difficult to derive from the normal principle of induction. To prove $∀m\ n. P(m,n)$:

  • First do induction on $m$
    • Case 1 above covers the base case for this, where $m = 0$
    • For the inductive step, we are given $∀n. P(m,n)$ and need to prove $∀n. P(1+m,n)$, do this by induction on $n$
      • When $n = 0$, use case 2 above
      • When $n = 1$, use case 3 above
      • Finally, we are given $P(1+m,1+n)$ and need to prove $P(1+m,2+n)$. This is case 4 above, since we already have that $∀n. P(m,n)$

So, by using induction twice, it's possible to build the sort of induction principle that directly corresponds to the recursive structure of your modified Ackermann function. Then it should be relatively simple to prove your theorem using this principle.