Grzegorczyk hierarchy

The Grzegorczyk hierarchy, named after the Polish logician Andrzej Grzegorczyk, is a hierarchy of functions used in computability theory. Every function in the Grzegorczyk hierarchy is a primitive recursive function, and every primitive recursive function appears in the hierarchy at some level. The hierarchy deals with the rate at which the values of the functions grow; intuitively, functions in lower levels of the hierarchy grow slower than functions in the higher levels.

Definition
First we introduce an infinite set of functions, denoted Ei for some natural number i. We define

\begin{array}{lcl} E_0(x,y) & = & x + y \\ E_1(x) & = & x^2 + 2 \\ E_{n+2}(0) & = & 2 \\ E_{n+2}(x+1) & = & E_{n+1}(E_{n+2}(x)) \\ \end{array} $$ $$E_0$$ is the addition function, and $$E_1$$ is a unary function which squares its argument and adds two. Then, for each n greater than 1, $$E_n(x)=E^{x}_{n-1}(2)$$, i.e. the x-th iterate of $$E_{n-1}$$ evaluated at 2.

From these functions we define the Grzegorczyk hierarchy. $$\mathcal{E}^n$$, the n-th set in the hierarchy, contains the following functions:
 * 1) Ek for k < n
 * 2) the zero function (Z(x) = 0);
 * 3) the successor function (S(x) = x + 1);
 * 4) the projection functions ($$ p_i^m(t_1, t_2, \dots, t_m) = t_i $$);
 * 5) the (generalized) compositions of functions in the set (if h, g1, g2, ... and gm  are in $$\mathcal{E}^n$$, then $$ f(\bar{u}) = h(g_1(\bar{u}), g_2(\bar{u}), \dots, g_m(\bar{u})) $$ is as well); and
 * 6) the results of limited (primitive) recursion applied to functions in the set, (if g, h and j are in $$\mathcal{E}^n$$ and $$f(t, \bar{u}) \leq j(t, \bar{u})$$ for all t and $$\bar{u}$$, and further $$f(0, \bar{u}) = g(\bar{u})$$ and $$f(t+1, \bar{u}) = h(t,\bar{u},f(t,\bar{u}))$$, then f is in $$\mathcal{E}^n$$ as well).

In other words, $$\mathcal{E}^n$$ is the closure of set $$B_n = \{Z, S, (p_i^m)_{i \le m}, E_k : k < n\}$$ with respect to function composition and limited recursion (as defined above).

Properties
These sets clearly form the hierarchy
 * $$ \mathcal{E}^0 \subseteq \mathcal{E}^1 \subseteq \mathcal{E}^2 \subseteq \cdots $$

because they are closures over the $$B_n$$'s and $$ B_0 \subseteq B_1 \subseteq B_2 \subseteq \cdots$$.

They are strict subsets. In other words
 * $$ \mathcal{E}^0 \subsetneq \mathcal{E}^1 \subsetneq \mathcal{E}^2 \subsetneq \cdots $$

because the hyperoperation $$H_n$$ is in $$\mathcal{E}^n$$ but not in $$\mathcal{E}^{n-1}$$.


 * $$\mathcal{E}^0$$ includes functions such as x+1, x+2, ...
 * Every unary function f(x) in $$\mathcal{E}^0$$ is upper bounded by some x+n. However, $$\mathcal{E}^0$$ also includes more complicated functions like x∸1, x∸y (where ∸ is the monus sign defined as x∸y = max(x-y, 0)), $x mod y$, etc.
 * $$\mathcal{E}^1$$ provides all addition functions, such as x+y, 4x, ...
 * $$\mathcal{E}^2$$ provides all multiplication functions, such as xy, x4
 * $$\mathcal{E}^3$$ provides all exponentiation functions, such as xy, 22 2 x, and is exactly the elementary recursive functions.
 * $$\mathcal{E}^4$$ provides all tetration functions, and so on.

Notably, both the function $$U$$ and the characteristic function of the predicate $$T$$ from the Kleene normal form theorem are definable in a way such that they lie at level $$\mathcal{E}^0$$ of the Grzegorczyk hierarchy. This implies in particular that every recursively enumerable set is enumerable by some $$\mathcal{E}^0$$-function.

Relation to primitive recursive functions
The definition of $$\mathcal{E}^n$$ is the same as that of the primitive recursive functions,, except that recursion is limited ($$f(t, \bar{u}) \leq j(t, \bar{u})$$ for some j in $$\mathcal{E}^n$$) and the functions $$(E_k)_{k<n}$$ are explicitly included in $$\mathcal{E}^n$$. Thus the Grzegorczyk hierarchy can be seen as a way to limit the power of primitive recursion to different levels.

It is clear from this fact that all functions in any level of the Grzegorczyk hierarchy are primitive recursive functions (i.e. $$ \mathcal{E}^n \subseteq \mathsf{PR} $$) and thus:
 * $$ \bigcup_n{\mathcal{E}^n} \subseteq \mathsf{PR} $$

It can also be shown that all primitive recursive functions are in some level of the hierarchy, thus
 * $$ \bigcup_n{\mathcal{E}^n} = \mathsf{PR} $$

and the sets $$ \mathcal{E}^0, \mathcal{E}^1 - \mathcal{E}^0, \mathcal{E}^2 - \mathcal{E}^1, \dots, \mathcal{E}^n - \mathcal{E}^{n-1}, \dots $$ partition the set of primitive recursive functions,.

Meyer and Ritchie introduced another hierarchy subdividing the primitive recursive functions, based on the nesting depth of loops needed to write a LOOP program that computes the function. For a natural number $$i$$, let $$\mathcal{L}_i$$ denote the set of functions computable by a LOOP program with  and   commands nested no deeper than $$i$$ levels. Fachini and Maggiolo-Schettini showed that $$\mathcal{L}_i$$ coincides with $$\mathcal{E}_{i+1}$$ for all integers $$i>1$$. p.63

Extensions
The Grzegorczyk hierarchy can be extended to transfinite ordinals. Such extensions define a fast-growing hierarchy. To do this, the generating functions $$E_\alpha$$ must be recursively defined for limit ordinals (note they have already been recursively defined for successor ordinals by the relation $$ E_{\alpha+1}(n) = E_\alpha^n(2) $$). If there is a standard way of defining a fundamental sequence $$\lambda_m$$, whose limit ordinal is $$\lambda$$, then the generating functions can be defined $$ E_\lambda(n) = E_{\lambda_n}(n) $$. However, this definition depends upon a standard way of defining the fundamental sequence. suggests a standard way for all ordinals α < ε0.

The original extension was due to Martin Löb and Stan S. Wainer and is sometimes called the Löb–Wainer hierarchy.