This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Computing with and without arbitrary large numbers
(Extended abstract)

Michael Brand
michael.brand@alumni.weizmann.ac.il
Faculty of IT, Monash University
Clayton, VIC 3800
Australia
(September 4, 2025)
Abstract

In the study of random access machines (RAMs) it has been shown that the availability of an extra input integer, having no special properties other than being sufficiently large, is enough to reduce the computational complexity of some problems. However, this has only been shown so far for specific problems. We provide a characterization of the power of such extra inputs for general problems.

To do so, we first correct a classical result by Simon and Szegedy (1992) as well as one by Simon (1981). In the former we show mistakes in the proof and correct these by an entirely new construction, with no great change to the results. In the latter, the original proof direction stands with only minor modifications, but the new results are far stronger than those of Simon (1981).

In both cases, the new constructions provide the theoretical tools required to characterize the power of arbitrary large numbers.

1 Introduction

The Turing machine (TM), first introduced in [17], is undoubtedly the most familiar computational model. However, for algorithm analysis it often fails to adequately represent real-life complexities, for which reason the random access machine (RAM), closely resembling the intuitive notion of an idealized computer, has become the common choice in algorithm design. Ben-Amram and Galil [2] write “The RAM is intended to model what we are used to in conventional programming, idealized in order to be better accessible for theoretical study.”

Here, “what we are used to in conventional programming” refers, among other things, to the ability to manipulate high-level objects by basic commands. However, this ability comes with some unexpected side effects. For example, one can consider a RAM that takes as an extra input an integer that has no special property other than being “large enough”. Contrary to intuition, it has been shown that such arbitrary large numbers (ALNs) can lower problem time complexities. For example, [4] shows that the availability of ALNs lowers the arithmetic time complexity111Arithmetic complexity is the computational complexity of a problem under the RAM[+,,×,÷]\text{RAM}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\div] model, which is defined later on in this section. of calculating 22x2^{2^{x}} from Θ(x)\mathop{\mathrm{\Theta}}(x) to Θ(x)\mathop{\mathrm{\Theta}}(\sqrt{x}). However, all previous attempts to characterize the contribution of ALNs dealt with problem-specific methods of exploiting such inputs, whereas the present work gives, for the first time, a broad characterization of the scenarios in which arbitrary numbers do and those in which they do not increase computational power.

In order to present our results, we first redefine, briefly, the RAM model. (See [1] for a more formal introduction.)

Computations on RAMs are described by programs. RAM programs are sets of commands, each given a label. Without loss of generality, labels are taken to be consecutive integers. The bulk of RAM commands belong to one of two types. One type is an assignment. It is described by a triplet containing a kk-ary operator, kk operands and a target. The other type is a comparison. It is given two operands and a comparison operator, and is equipped with labels to proceed to if the comparison is evaluated as either true or false. Other command-types include unconditional jumps and execution halt commands.

The execution model for RAM programs is as follows. The RAM is considered to have access to an infinite set of registers, each marked by a non-negative integer. The input to the program is given as the initial state of the first registers. The rest of the registers are initialized to 0. Program execution begins with the command labeled 11 and proceeds sequentially, except in comparisons (where execution proceeds according to the result of the comparison) and in jumps. When executing assignments, the kk-ary operator is evaluated based on the values of the kk operands and the result is placed in the target register. The output of the program is the state of the first registers at program termination.

In order to discuss the computational power of RAMs, we consider only RAMs that are comparable in their input and output types to TMs. Namely, these will be the RAMs whose inputs and outputs both lie entirely in their first register. We compare these to TMs working on one-sided-infinite tapes over a binary alphabet, where “0” doubles as the blank. A RAM will be considered equivalent to a TM if, given as an input an integer whose binary encoding is the initial state of the TM’s tape, the RAM halts with a non-zero output value if and only if the TM accepts on the input.

Furthermore, we assume, following e.g. [6], that all explicit constants used as operands in RAM programs belong to the set {0,1}\{0,1\}. This assumption does not make a material difference to the results, but it simplifies the presentation.

In this paper we deal with RAMs that use non-negative integers as their register contents. This is by far the most common choice. A RAM will be indicated by RAM[op]\text{RAM}[\textit{op}], where op is the set of basic operations supported by the RAM. These basic operations are assumed to execute in a single unit of time. We use the syntax f(n)-RAM[op]\text{$f(n)$-RAM}[\textit{op}] to denote the set of problems solvable in f(n)f(n) time by a RAM[op]\text{RAM}[\textit{op}], where nn is the bit-length of the input. Replacing “RAM[op]\text{RAM}[\textit{op}]” by “TM” indicates that the computational model used is a Turing machine.

Note that because registers only store non-negative integers, such operations as subtraction cannot be supported without tweaking. The customary solution is to replace subtraction by “natural subtraction”, denoted “\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}” and defined by ab=defmax(ab,0)a\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}b\stackrel{{\scriptstyle\text{def}}}{{=}}\max(a-b,0). We note that if the comparison operator “\leq” (testing whether the first operand is less than or equal to the second operand) is not supported by the RAM directly, the comparison “aba\leq b” can be simulated by the equivalent equality test “ab=0a\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}b=0”. Testing for equality is always assumed to be supported.

By the same token, regular bitwise negation is not allowed, and ¬a\lnot a is tweaked to mean that the bits of aa are negated only up to and including its most significant “11” bit.

Operands to each operation can be explicit integer constants, the contents of explicitly named registers or the contents of registers whose numbers are specified by other registers. This last mode, which can also be used to define the target register, is known as “indirect addressing”. In [3] it is proved that for the RAMs considered here indirect addressing has no effect. We therefore assume throughout that it is unavailable to the RAMs.

The following are two classical results regarding RAMs. Operations appearing in brackets within the operation list are optional, in the sense that the theorem holds both when the operation is part of op and when it is not.

Theorem 1 ([14]).

PTIME-RAM[+,[],[×],,[],Bool]=PSPACE\text{PTIME-RAM}[+,[\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}],[\times],\leftarrow,[\rightarrow],\textit{Bool}]=\text{PSPACE}

and

Theorem 2 ([13]).

PTIME-RAM[+,,/,,Bool;]=ER\text{PTIME-RAM}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},/,\leftarrow,\textit{Bool};\leq]=\text{ER}, where ER is the set of problems solvable by Turing machines in

222}n\left.2^{2^{\iddots^{2}}}\right\}n

time, where nn is the length of the input.

Here, “//” indicates exact division, which is the same as integer division (denoted “÷\div”) but is only defined when the two operands divide exactly. The operations “\leftarrow” and “\rightarrow” indicate left shift (ab=a×2ba\leftarrow b=a\times 2^{b}) and right shift (ab=a÷2ba\rightarrow b=a\div 2^{b}), and Bool is shorthand for the set of all bitwise Boolean functions.

In this paper, we show that while Theorem 1 is correct, its original proof is not. Theorem 2, on the other hand, despite being a classic result and one sometimes quoted verbatim (see, e.g., [16]), is, in fact, erroneous.

We re-prove the former here, and replace the latter by a stronger result, for the introduction of which we first require several definitions.

Definition 1 (Expansion Limit).

Let M=Mop(t,inp)M=M_{\textit{op}}(t,\textit{inp}) be the largest number that can appear in any register of a RAM[op]\text{RAM}[\textit{op}] working on inp as its input, during the course of its first tt execution steps.

We define ELop(f(n))\text{EL}_{\textit{op}}(f(n)) to be the maximum of Mop(f(n),inp)M_{\textit{op}}(f(n),\textit{inp}) over all values of inp for which len(inp)n\text{len}(\textit{inp})\leq n. This is the maximum number that can appear in any register of a RAM[op]\text{RAM}[\textit{op}] that was initialized by an input of length at most nn, after f(n)f(n) execution steps.

The subscript op may be omitted if understood from the context.

As a slight abuse of notation, we use EL(t)\text{EL}(t) to be the maximum of Mop(t,inp)M_{\textit{op}}(t,\textit{inp}) over all inp of length at most nn, when nn is understood from the context and tt is independent of nn. (The following definition exemplifies this.)

Definition 2 (RAM-Constructability).

A set of operations op is RAM-constructable if the following two conditions are satisfied: (1) there exists a RAM program that, given inp and tt as its inputs, with nn being the length of inp, returns in O(t)\mathop{\text{O}}(t) time a value no smaller than ELop(t)\text{EL}_{\textit{op}}(t), and (2) each operation in op is computable in EL(O(l))\text{EL}(\mathop{\text{O}}(l)) space on a Turing machine, where ll is the total length of all operands and of the result.

Our results are as follows.

Theorem 3.

For a RAM-constructable op{+,/,,Bool}\textit{op}\supseteq\{+,/,\leftarrow,\textit{Bool}\} and any function f(n)f(n),

O(f(n))-RAM[op]\displaystyle\text{$\mathop{\text{O}}(f(n))$-RAM}[\textit{op}] =ELop(O(f(n)))-TM\displaystyle=\text{$\text{EL}_{\textit{op}}(\mathop{\text{O}}(f(n)))$-TM}
=N-ELop(O(f(n)))-TM\displaystyle=\text{$\text{N-EL}_{\textit{op}}(\mathop{\text{O}}(f(n)))$-TM}
=ELop(O(f(n)))-SPACE-TM\displaystyle=\text{$\text{EL}_{\textit{op}}(\mathop{\text{O}}(f(n)))$-SPACE-TM}
=N-ELop(O(f(n)))-SPACE-TM,\displaystyle=\text{$\text{N-EL}_{\textit{op}}(\mathop{\text{O}}(f(n)))$-SPACE-TM,}

where the new notations refer to nondeterministic Turing machines, space-bounded Turing machines and nondeterministic space-bounded Turing machines, respectively.

Among other things, this result implies for polynomial-time RAMs that their computational power is far greater than ER, as was previously believed.

The theoretical tools built for proving Theorem 3 and re-proving Theorem 1 then allow us to present the following new results regarding the power of arbitrary large numbers.

Theorem 4.

PTIME-ARAM[+,[],[×],,[],Bool]=PSPACE\text{PTIME-ARAM}[+,[\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}],[\times],\leftarrow,[\rightarrow],\textit{Bool}]=\text{PSPACE}

Theorem 5.

Any recursively enumerable (r.e.) set can be recognized by an ARAM[+,/,,Bool]\text{ARAM}[+,/,\leftarrow,\textit{Bool}] in O(1)\mathop{\text{O}}(1) time.

Here, “ARAM” is the RAM model assisted by an arbitrary large number. Formally, we say that a set SS is computable by an ARAM[op]\text{ARAM}[\textit{op}] in f(n)f(n) time if there exists a Boolean function g(inp,x)g(\textit{inp},x), computable in f(n)f(n) time on a RAM[op]\text{RAM}[\textit{op}], such that inpS\textit{inp}\in S implies g(inp,x)0g(\textit{inp},x)\neq 0 for almost all xx (all but a finite number of xx) whereas inpS\textit{inp}\not\in S implies g(inp,x)=0g(\textit{inp},x)=0 for almost all xx. Here, nn conventionally denotes the bit length of the input, but other metrics are also applicable.

We see, therefore, that the availability of arbitrary numbers has no effect on the computational power of a RAM without division. However, for a RAM equipped with integer division, the boost in power is considerable, to the extent that any problem solvable by a Turing machine in any amount of time or space can be solved by an ARAM in O(1)\mathop{\text{O}}(1) time.

2 Models without division

2.1 Errata on [14]

We begin with a definition.

Definition 3 (Straight Line Program).

A Straight Line Program, or SLP[op]\text{SLP}[\textit{op}], is a list of tuples, s2,,sns_{2},\ldots,s_{n}, where each sis_{i} is composed of an operator, siopops_{i}^{\textit{op}}\in\textit{op}, and kk integers, si1,,siks_{i}^{1},\ldots,s_{i}^{k}, all in the range 0sij<i0\leq s_{i}^{j}<i, where kk is the number of operands taken by siops_{i}^{\textit{op}}. This list is to be interpreted as a set of computations, whose targets are v0,,vnv_{0},\ldots,v_{n}, which are calculated as follows: v0=0v_{0}=0, v1=1v_{1}=1, and for each i>1i>1, viv_{i} is the result of evaluating the operator siops_{i}^{\textit{op}} on the inputs vsi1,,vsikv_{s_{i}^{1}},\ldots,v_{s_{i}^{k}}. The output of an SLP is the value of vnv_{n}.

A technique first formulated in a general form in [11] allows results on SLPs to be generalized to RAMs. Schönhage’s theorem, as worded for the special case that interests us, is that if there exists a Turing machine, running on a polynomial-sized tape and in finite time, that takes an SLP[op]\text{SLP}[\textit{op}] as input and halts in an accepting state if and only if vnv_{n} is nonzero, then there also exists a TM running on a polynomial-sized tape that simulates a RAM[op]\text{RAM}[\textit{op}]. This technique is used both in [14] and in our new proof.

The proof of [14] follows this scheme, and attempts to create such a Turing machine. In doing so, this TM stores monomial-based representations of certain powers of two. These are referred to by the paper as “monomials” but are, for our purposes, integers.

The main error in [14] begins with the definition of a relation, called “vicinity”, between monomials, which is formulated as follows.

We define an equivalence relation called vicinity between monomials. Let M1M_{1} and M2M_{2} be two monomials. Let BB be a given parameter. If M1/M2<22BM_{1}/M_{2}<2^{2^{B}} [][\ldots], then M1M_{1} is in the vicinity of M2M_{2}. The symmetric and transitive closure of this relation gives us the full vicinity relation. As it is an equivalence relation, we can talk about two monomials being in the same vicinity (in the same equivalence class).

It is unclear from the text whether the authors’ original intention was to define this relation in a universal sense, as it applies to the set of all monomials (essentially, the set of all powers of two), or whether it is only defined over the set of monomials actually used by any given program. If the former is correct, any two monomials are necessarily in the same vicinity, because one can bridge the gap between them by monomials that are only a single order of magnitude apart. If the latter is correct, it is less clear what the final result is. The paper does not argue any claim that would characterize the symmetric and transitive closure in this case.

However, the paper does implicitly assume throughout that the vicinity relation, as originally defined (in the M1/M2<22BM_{1}/M_{2}<2^{2^{B}} sense) is its own symmetric and transitive closure. This is used in the analysis by assuming for any MiM_{i} and MjM_{j} which are in the same vicinity (in the equivalence relation sense) that they also satisfy 2(2B)<Mi/Mj<22B2^{-(2^{B})}<M_{i}/M_{j}<2^{2^{B}}, i.e. they are in the same vicinity also in the restrictive sense.

Unfortunately, this claim is untrue. It is quite possible to construct an SLP that violates this assumption, and because the assumption is central to the entire algorithm, the proof does not hold.

We therefore provide here an alternate algorithm, significantly different from the original, that bypasses the entire “vicinity” issue.

2.2 Our new construction

Our proof adapts techniques from two previous papers: [5] (which uses lazy evaluation to perform computations on operands that are too long to fit into a polynomial-sized tape) and [12] (which stores operands in a hierarchical format that notes only the positions of “interesting bits”, these being bit positions whose values are different than those of the less significant bit directly preceding them). The former method is able to handle multiplication but not bit shifting and the latter the reverse. We prove Theorem 1 using a sequence of lemmas. All algorithms described are available as C++ code in Appendix A.

Lemma 1.

In an SLP[+,,×,,,Bool]\text{SLP}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}], the number of interesting bits in the output vnv_{n} grows at most exponentially with nn. There exists a Turing machine working in polynomial space that takes such an SLP as its input, and that outputs an exponential-sized set of descriptions of bit positions, where bit positions are described as functions of v0,,vn1v_{0},\ldots,v_{n-1}, such that the set is a superset of the interesting bit positions of vnv_{n}.

The fact that the number of interesting bits grows only exponentially given this operation set was noted in [14]. Our proof follows the reasoning of the original paper.

Proof.

Consider, for simplicity, the instruction set op={+,×,}\textit{op}=\{+,\times,\leftarrow\}. Suppose that we were to change the meaning of the operator “\leftarrow”, so that, instead of calculating ab=a×2ba\leftarrow b=a\times 2^{b}, its result would be ab=aX,a\leftarrow b=aX, where XX is a formal parameter, and a new formal parameter is generated every time the “\leftarrow” operator is used. The end result of the calculation will now no longer be an integer but rather a polynomial in the formal parameters. The following are some observations regarding this polynomial.

  1. 1.

    The number of formal parameters is at most nn, the length of the SLP.

  2. 2.

    The power of each formal parameter is at most 2nk2^{n-k}, where kk is the step number in which the parameter was defined. (This exponent is at most doubled at each step in the SLP. Doubling may happen, for example, if the parameter is multiplied by itself.)

  3. 3.

    The sum of all multiplicative coefficients in the polynomial is at most 22n22^{2^{n-2}}. (During multiplication, the sum of the product polynomial’s coefficients is the product of the sums of the operands’ coefficients. As such, this value can at most square itself at each operation. The maximal value it can attain at step 22 is 22.)

If we were to take each formal variable, XX, that was created at an “aba\leftarrow b” operation, and substitute in it the value 2b2^{b} (a substitution that [14] refers to as the “standard evaluation”), then the value of the polynomial will equal the value of the SLP’s output. We claim that if pp is an interesting bit position, then there is some product of formal variables appearing as a monomial in the result polynomial such that its standard evaluation is 2x2^{x}, and pxp2np\geq x\geq p-2^{n}.

The claim is clearly true for n=0n=0 and n=1n=1. For n>1n>1, we will make the stronger claim pxp2n22p\geq x\geq p-2^{n-2}-2. To prove this, note that any monomial whose standard evaluation is greater than 2p2^{p} cannot influence the value of bit pp and cannot make it “interesting”. On the other hand, if all remaining monomials are smaller than p2n22p-2^{n-2}-2, the total value that they carry within the polynomial is smaller than 2p2n222^{p-2^{n-2}-2} times the sum of their coefficients, hence smaller than 2p22^{p-2}. Bits p1p-1 and pp, however, are both zero. Therefore, pp is not an interesting bit.

We proved the claim for the restricted operation set {+,×,}\{+,\times,\leftarrow\}. Adding logical AND (“\land”) and logical OR (“\lor”) can clearly not change the fact that bits p1p-1 and pp are both zero, nor can it make the polynomial coefficients larger than 22n22^{2^{n-2}}.

Incorporating “\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}” and “¬\lnot” into the operation set has a more interesting effect: the values of bit p1p-1 and pp can both become “1”. This will still not make bit pp interesting, but it does require a small change in the argument. Instead of considering polynomials whose coefficients are between 0 and 22n22^{2^{n-2}}, we can now consider polynomials whose coefficients are between 22n2-2^{2^{n-2}} and 22n22^{2^{n-2}}. This changes the original argument only slightly, in that we now need to argue that in taking the product over two polynomials the sum of the absolute values of the coefficients of the product is no greater than the product of the sums of the absolute values of the coefficients of the operands.

Similarly, adding “\rightarrow” into consideration, we no longer consider only formal variables of the form ab=aXa\leftarrow b=aX but also ab=aYa\rightarrow b=\lfloor aY\rfloor, where the standard evaluation of YY is 2b2^{-b} and \lfloor\cdot\rfloor is treated as a bitwise Boolean operation (in the sense that, conceptually, it zeroes all bit positions that are “to the right of the decimal point” in the product).

We can therefore index the set of interesting bits by use of a tuple, as follows. If i1,,iki_{1},\ldots,i_{k} are the set of steps for which sijop{,}s_{i_{j}}^{\textit{op}}\in\{\leftarrow,\rightarrow\}, the tuple will contain one number between 0 and 2nij2^{n-i_{j}} for each 1jk1\leq j\leq k, to indicate the exponent of the formal parameter added at step iji_{j}, and an additional k+1k+1’th element, between 0 and 2n2^{n} to indicate a bit offset from this bit position.

Though this tuple may contain many non-interesting bits, or may describe a single bit position by many names, it is a description of a super-set of the interesting bits in polynomial space. ∎

In Appendix A, such an enumeration is implemented by the method Index::next. We refer to the set of bit positions thus described as the potentially-interesting bits, or po-bits, of the SLP.

Lemma 2.

Let 𝒮,𝒮SLP[+,,×,,,Bool]\mathcal{S},\mathcal{S}^{\prime}\in\text{SLP}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}]. Let 𝒪\mathcal{O} be an Oracle that takes 𝒮\mathcal{S}^{\prime} as input and outputs the descriptions of all its po-bits in order, from least-significant to most-significant, without repetitions. There exists a TM working in polynomial space but with access to 𝒪\mathcal{O} that takes as inputs 𝒮\mathcal{S} and the description of a po-bit position, ii, of 𝒮\mathcal{S}, and that outputs the ii’th bit of the output of 𝒮\mathcal{S}.

Proof.

Given a way to iterate over the po-bits in order, the standard algorithms for most operations required work as expected. For example, addition can be performed bit-by-bit if the bits of the operands are not stored, but are, rather, calculated recursively whenever they are needed. The depth of the recursion required in this case is at most nn. (See Add::eval in Appendix A.)

The fact that iterating only over the po-bits, instead of over all bit positions, makes no difference to the results is exemplified in Figure 1.

po-bits non-po-bits po-bits
1 1 1 1 1 1 1 1 1 1
+ 1 0 0 1 1 1 1 1 1 0 1 1
1 1 1 1 1 1 1 1 0 1
1 1 0 1 1 1 1 1 1 0 0 0
Figure 1: An example of summing two numbers

As can be seen, not only are the non-po-bits all equal to the last po-bit preceding them, in addition, the carry bit going over from the last po-bit to the first non-po-bit is the same as the carry bit carried over from the last non-po-bit to the first po-bit. Because of this, the sequential carry bits across non-po-bits (depicted in light blue in Figure 1) can be replaced by a single non-contiguous carry operation (the red arrow).

This logic works just as well for subtraction and Boolean operations. The only operation acting differently is multiplication. Implementing multiplication directly leads to incorrect results. Instead, we re-encode the operand bits in a way that reflects our original observation, that the operands can be taken to be polynomials with small coefficients in absolute value, though these coefficients may not necessarily be nonnegative.

The new encoding is as follows: going from least significant bit to most significant bit, a “0” bit is encoded as a 11 if preceded by a “11” and as 0, otherwise. A “11” bit is encoded as a 0 if preceded by a “11” and as 1-1, otherwise. It is easy to see that a number, AA, encoded in regular binary notation but including a leading zero by a {0,1}\{0,1\} sequence, a0,,aka_{0},\ldots,a_{k}, denoting coefficients of a power series A=i=0kai2iA=\sum_{i=0}^{k}a_{i}2^{i}, does not change its value if the aia_{i} are switched for the bib_{i} that are the result of the re-encoding procedure described. The main difference is that now the value of all non-po-bits is 0. (See Mult::eval in Appendix A.)

Proving that multiplication works correctly after re-encoding is done by observing its base cases and bilinear properties. The carry in the calculation is exponential in size, so can be stored using a polynomial number of bits. ∎

Lemma 3.

Let 𝒬\mathcal{Q} be an Oracle that takes an 𝒮SLP[+,,×,,,Bool]\mathcal{S}\in\text{SLP}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}] and two po-bit positions of 𝒮\mathcal{S} and determines which position is the more significant. Given access to 𝒬\mathcal{Q}, Oracle 𝒪\mathcal{O}, described in Lemma 2, can be implemented as a polynomial space Turing machine.

Proof.

Given an Oracle able to compare between indices, the ability to enumerate over the indices in an arbitrary order allows creation of an ordered enumeration. Essentially, we begin by choosing the smallest value, then continue sequentially by choosing, at each iteration, the smallest value that is still greater than the current value. This value is found by iterating over all index values in an arbitrary order and trying each in turn. ∎

In Appendix A, this algorithm is implemented by the method Index::operator++.

Lemma 4.

Oracle 𝒬\mathcal{Q}, described in Lemma 3, can be implemented as a polynomial space Turing machine.

Proof.

Recall that an index position is an affine function of the coefficients of the formal variables introduced, in their standard evaluations. To determine which of two indices is larger, we subtract these, again reaching an affine function of the same form. The coefficients themselves are small, and can be stored directly. Determining whether the subtraction result is negative or not is a problem of the same kind as was solved earlier: subtraction, multiplication and addition need to be calculated over variables; in this case the variables are the coefficients, instead of the original formal variables.

However, there is a distinct difference in working with coefficients, in that they, themselves, are calculable as polynomials over formal variables. The calculation can, therefore, be transformed into addition, multiplication and subtraction, once again over the original formal variables.

Although it may seem as though this conclusion returns us to the original problem, it does not. Consider, among all formal variables, the one defined last. This variable cannot appear in the exponentiation coefficients of any of the new polynomials. Therefore, the new equation is of the same type as the old equation but with at least one formal parameter less. Repeating the process over at most nn recursion steps (a polynomial number) allows us to compare any two indices for their sizes. ∎

See the function cmp and the method Command::cmp in Appendix A for an implementation.

Proof of Theorem 1.

We begin by recalling that P-RAM[+,,Bool]=PSPACE\text{P-RAM}[+,\leftarrow,\textit{Bool}]=\text{PSPACE} was already shown in [12]. Hence, we only need to prove P-RAM[+,,×,,,Bool]PSPACE\text{P-RAM}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}]\subseteq\text{PSPACE}. This is done, as per Schönhage’s method [11], by simulating a polynomial time SLP[+,,×,,,Bool]\text{SLP}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}] on a polynomial space Turing machine.

Lemmas 14, jointly, demonstrate that this can be done. ∎

We remark that Theorem 1 is a striking result, in that right shifting is part of the SLP being simulated, and right shifting is a special case of integer division. Compare this with the power of exact division, described in Theorem 3, which is also a special case of integer division.

2.3 Incorporating arbitrary numbers

The framework described in Section 2.1 can readily incorporate simulation of arbitrary large number computation. We use it now, to prove Theorem 4.

Proof of Theorem 4.

Having proved Theorem 1, what remains to be shown is

PTIME-ARAM[+,,×,,,Bool]PSPACE.\text{PTIME-ARAM}[+,\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}},\times,\leftarrow,\rightarrow,\textit{Bool}]\subseteq\text{PSPACE}.

As in the proof of Theorem 1, it is enough to show that an SLP that is able to handle all operations can be simulated in PSPACE.

We begin by noting that because the PTIME-ARAM must work properly for all but a finite range of numbers as its ALN input, it is enough to show one infinite family of numbers that can be simulated properly. We choose X=2ωX=2^{\omega}, for any sufficiently large ω\omega. In the simulation, we treat this XX as a new formal variable, as was done with outputs of “aba\leftarrow b” operations.

Lemmas 13 continue to hold in this new model. They rely on the ability to compare between two indices, which, in the previous model, was guaranteed by Lemma 4. The technique by which Lemma 4 was previously proved was to show that comparison of two indices is tantamount to evaluating the sign of an affine combination of the exponents associated with a list of formal variables, when using their standard evaluation. This was performed recursively. The recursion was guaranteed to terminate, because at each step the new affine combination must omit at least one formal variable, namely the last one to be defined. Ultimately, the sign to be evaluated is of a scalar, and this can be performed directly.

When adding the new formal variable X=2ωX=2^{\omega}, the same recursion continues to hold, but the terminating condition must be changed. Instead of evaluating the sign of a scalar, we must evaluate the sign of a formal expression of the form aω+ba\omega+b. For a sufficiently large ω\omega (which we assume ω\omega to be), the sign is the result of lexicographic evaluation. ∎

A full C++ implementation of the solution appears in Appendix B.

3 Models with division

Our proof of Theorem 3 appears in Appendix C. It resembles [13] in that it uses Simon’s ingenious argument that, for any given nn, the value i=02n1i×2ni\sum_{i=0}^{2^{n}-1}i\times 2^{ni} can be calculated in O(1)\mathop{\text{O}}(1)-time by considering geometric series summation techniques. The result is an integer that includes, in windows of length nn bits, every possible bit-string of length nn. The simulating RAM acts by verifying whether any of these bit-strings is a valid tableau for an accepting computation by the simulated TM. This verification is performed using bitwise Boolean operations, in parallel over all options. The most salient differences between the proofs, being the errors in Simon’s original argument that this paper corrects, are as follows.

  1. 1.

    Simon does not show how a TM can simulate an arbitrary RAM in ER-time, making his result a lower-bound only.

  2. 2.

    Simon uses what he calls “oblivious Turing machines” (which are different than those of [7]) in a way that simultaneously limits the TM’s tape size and maximum execution time (only the latter condition being considered in the proof), and, moreover, are defined in a way that is non-uniform, in the sense that adding more tape may require a different TM, with potentially more states, a fact not accounted for in the proof.

  3. 3.

    Most importantly, Simon underestimates the length needed for the tableau, taking it to be the value of the input. TMs are notorious for using up far more tape than the value of their inputs (see [9]).

Ultimately, Theorem 3 proves that the power of a RAM[op]\text{RAM}[\textit{op}], where op is RAM-constructable and includes {+,/,,Bool}\{+,/,\leftarrow,\textit{Bool}\}, is limited only by the maximal size of values that it can produce (relating to the maximal tableau size that it can generate and check). Considering this, the proof of Theorem 5 becomes a trivial corollary. The full details are given in Appendix D, but the basic idea is that any accepting computation by a TM is necessarily of some finite length tt. Consider an operation set op={+,/,,Bool,A}\textit{op}=\{+,/,\leftarrow,\textit{Bool},A\}, where A()A() is a function that has no parameters and returns a number that is at least as large as tt. This places the computation in ELop(O(1))\text{EL}_{\textit{op}}(\mathop{\text{O}}(1))-TM, so by Theorem 3 it is in O(1)-RAM[op]\text{$\mathop{\text{O}}(1)$-RAM}[\textit{op}], which is a subset of O(1)-ARAM[+,/,,Bool]\text{$\mathop{\text{O}}(1)$-ARAM}[+,/,\leftarrow,\textit{Bool}].

We have shown, therefore, that while arbitrary numbers have no effect on computational power without division, with division they provide Turing completeness in O(1)\mathop{\text{O}}(1) computational resources.

References

  • [1] Alfred V. Aho, John E. Hopcroft, and Jeffrey D. Ullman. The Design and Analysis of Computer Algorithms. Addison-Wesley Publishing Co., Reading, Mass.-London-Amsterdam, 1975. Second printing, Addison-Wesley Series in Computer Science and Information Processing.
  • [2] Amir M. Ben-Amram and Zvi Galil. On the power of the shift instruction. Inf. Comput., 117:19–36, February 1995.
  • [3] Michael Brand. Does indirect addressing matter? Acta Inform., 49(7-8):485–491, 2012.
  • [4] Nader H. Bshouty, Yishay Mansour, Baruch Schieber, and Prasoon Tiwari. Fast exponentiation using the truncation operation. Comput. Complexity, 2(3):244–255, 1992.
  • [5] Juris Hartmanis and Janos Simon. On the power of multiplication in random access machines. In 15th Annual Symposium on Switching and Automata Theory (1974), pages 13–23. IEEE Comput. Soc., Long Beach, Calif., 1974.
  • [6] Yishay Mansour, Baruch Schieber, and Prasoon Tiwari. Lower bounds for computations with the floor operation. SIAM J. Comput., 20(2):315–327, 1991.
  • [7] Nicholas Pippenger and Michael J. Fischer. Relations among complexity measures. J. Assoc. Comput. Mach., 26(2):361–381, 1979.
  • [8] Vaughan R. Pratt, Michael O. Rabin, and Larry J. Stockmeyer. A characterization of the power of vector machines. In Sixth Annual ACM Symposium on Theory of Computing (Seattle, Wash., 1974), pages 122–134. Assoc. Comput. Mach., New York, 1974.
  • [9] T. Radó. On non-computable functions. Bell System Tech. J., 41:877–884, 1962.
  • [10] Walter J. Savitch. Relationships between nondeterministic and deterministic tape complexities. J. Comput. System. Sci., 4:177–192, 1970.
  • [11] Arnold Schönhage. On the power of random access machines. In Automata, Languages and Programming (Sixth Colloq., Graz, 1979), volume 71 of Lecture Notes in Comput. Sci., pages 520–529. Springer, Berlin, 1979.
  • [12] Janos Simon. On feasible numbers (preliminary version). In Conference Record of the Ninth Annual ACM Symposium on Theory of Computing (Boulder, Colo., 1977), pages 195–207. Assoc. Comput. Mach., New York, 1977.
  • [13] Janos Simon. Division in idealized unit cost RAMs. J. Comput. System Sci., 22(3):421–441, 1981. Special issue dedicated to Michael Machtey.
  • [14] Janos Simon and Mario Szegedy. On the complexity of RAM with various operation sets. In Proceedings of the twenty-fourth Annual ACM Symposium on Theory of Computing, STOC ’92, pages 624–631, New York, NY, USA, 1992. ACM.
  • [15] R. E. Stearns, J. Hartmanis, and P. M. Lewis. Hierarchies of memory limited computations. In Proceedings of the 6th Annual Symposium on Switching Circuit Theory and Logical Design (SWCT 1965), FOCS ’65, pages 179–190, 1965.
  • [16] Jerry L. Trahan, Michael C. Loui, and Vijaya Ramachandran. Multiplication, division, and shift instructions in parallel random-access machines. Theor. Comp. Sci., 100(1):1–44, Jun 22 1992.
  • [17] Alan M. Turing. On computable numbers, with an application to the Entscheidungsproblem. Proc. London Math. Soc., 42:230–265, 1936.

Appendix A Code to simulate P-RAM in PSPACE

A.1 slp.h

 

/*

Interface file to the SLP and related classes.

This class simulates a PTIME-SLP[+,-,*,<<<<,>>>>,Bool] in PSPACE on a Turing machine.

*/

#include<<algorithm>>

#include<<vector>>

classSLP;  10

classCommand;

classIndex

{

public:

Command* command;

std::vector<<Command*>>values;

std::vector<<int>>counters;

std::vector<<int>>lines;

std::vector<<int>>maxima;  20 

public:

Indexbegin() const;

Indexend() const;

Indexrbegin() const;

Indexzero() const;

Indexunity() const;

Index& next();

public:

Index() {}

Index(Command*  command, constIndex& old);  30

voidmake index(intline, Command& value);

Index& operator++();

Index& operator--();

Indexnormalize(constIndex& ref) const;

};

intcmp(constIndex& index1, constIndex& index2);

booloperator<<(constIndex& index1, constIndex& index2);

booloperator>>(constIndex& index1, constIndex& index2);  40

booloperator==(constIndex& index1, constIndex& index2);

booloperator>>=(constIndex& index1, constIndex& index2);

booloperator<<=(constIndex& index1, constIndex& index2);

booloperator!=(constIndex& index1, constIndex& index2);

Indexoperator+(constIndex& index1, constIndex& index2);

Indexoperator-(constIndex& index1, constIndex& index2);

classCommand

{  50

private:

intm line;

Indexm begin;

Indexm end;

Indexm rbegin;

protected:

virtualinteval(constIndex& index) const=0;

Indexmake index(Command& exponent);

SLP* slp;

public:  60

constIndex& begin() const { returnm begin; }

constIndex& end() const { returnm end; }

constIndex& rbegin() const { returnm rbegin; }

virtualintcmp(constIndex& index1, constIndex& index2) const;

public:

Command(SLP&  slp);

voidset slp(SLP*  slp, int line);

intoperator[ ](constIndex& index);

intis nonzero();

intline() { returnm line; }  70 

};

classConst:publicCommand

{

private:

intval;

protected:

virtualinteval(constIndex& index) const;

public:

virtualintcmp(constIndex& index1, constIndex& index2) const;  80

Const(SLP&  slp, int val) :Command( slp), val( val!=0) {}

};

classAnd:publicCommand

{

private:

Command& arg1;

Command& arg2;

protected:

virtualinteval(constIndex& index) const;  90

public:

And(SLP&  slp, int arg1, int arg2);

};

classOr:publicCommand

{

private:

Command& arg1;

Command& arg2;

protected:  100 

virtualinteval(constIndex& index) const;

public:

Or(SLP&  slp, int arg1, int arg2);

};

classNot:publicCommand

{

private:

Command& arg;

protected:  110 

virtualinteval(constIndex& index) const;

public:

Not(SLP&  slp, int arg);

};

classAdd:publicCommand

{

private:

Command& arg1;

Command& arg2;  120 

protected:

virtualinteval(constIndex& index) const;

public:

Add(SLP&  slp, int arg1, int arg2);

};

classSub:publicCommand

{

private:

Command& arg1;  130

Command& arg2;

protected:

virtualinteval(constIndex& index) const;

public:

Sub(SLP&  slp, int arg1, int arg2);

};

classMult:publicCommand

{

private:  140

Command& arg1;

Command& arg2;

intmake pn(Command& command, constIndex& index) const;

protected:

virtualinteval(constIndex& index) const;

public:

Mult(SLP&  slp, int arg1, int arg2);

};

classLShift:publicCommand  150

{

private:

Command& mantissa;

Indexexponent;

protected:

virtualinteval(constIndex& index) const;

public:

LShift(SLP&  slp, int mantissa, int exponent);

};

 160

classRShift:publicCommand

{

private:

Command& mantissa;

Indexexponent;

protected:

virtualinteval(constIndex& index) const;

public:

RShift(SLP&  slp, int mantissa, int exponent);

};  170 

classSLP

{

private:

std::vector<<Command*>>commands;

public:

SLP();

voidpush back(Command* command);

Command& operator[ ](intline) { return *commands[line]; }

intis nonzero() { return (*commands.rbegin())->>is nonzero(); }  180

˜SLP();

};

 

A.2 slp.cpp

 

/*

Implementation file of the SLP and related classes.

This class simulates a PTIME-SLP[+,-,*,<<<<,>>>>,Bool] in PSPACE on a Turing machine.

*/

#include"slp.h"

#include<<numeric>>

usingnamespacestd;  10

IndexIndex::begin() const

{

Indexrc=*this;

for(inti=0;i<<maxima.size();++i) {

rc.counters[i]=-maxima[i];

}

returnrc;

}

 20 

IndexIndex::end() const

{

Indexrc=*this;

rc.counters.clear();

rc.values.clear();

rc.maxima.clear();

returnrc;

}

IndexIndex::rbegin() const  30

{

Indexrc=*this;

for(inti=0;i<<maxima.size();++i) {

rc.counters[i]=maxima[i];

}

returnrc;

}

IndexIndex::zero() const

{  40

Indexrc=*this;

for(inti=0;i<<maxima.size();++i) {

rc.counters[i]=0;

}

returnrc;

}

IndexIndex::unity() const

{

Indexrc=zero();  50

rc.counters[counters.size()-1]=1;

returnrc;

}

Index& Index::next()

{

inti;

for (i=0;i<<maxima.size();++i) {

++counters[i];

if (counters[i]==maxima[i]+1) {  60

counters[i]=-maxima[i];

} else {

return *this;

}

}

if (i==maxima.size()) {

*this=end();

}

return *this;

}  70 

Index::Index(Command*  command, constIndex& old)

:command( command), values(old.values), counters(old.counters),

lines(old.lines), maxima(values.size())

{

for(inti=0;i<<values.size();++i) {

maxima[i]=1<<<<(command->>line()-lines[i]);

}

}

 80 

voidIndex::make index(intline, Command& value)

{

values.push back(&value);

counters.push back(0);

lines.push back(line);

maxima.push back(1<<<<(command->>line()-line));

}

Index& Index::operator++()

{  90 

if (counters.size()==0) {

return *this;

}

Indexrc=end();

for(Indexi=begin();i!=end();i.next()) {

if ((i>>*this)&&((rc==end())||||(rc>>i))) {

rc=i;

}

}

*this=rc;  100

return *this;

}

Index& Index::operator--()

{

if (counters.size()==0) {

return *this;

}

Indexrc=end();

for(Indexi=begin();i!=end();i.next()) {  110 

if ((i<<*this)&&((rc==end())||||(rc<<i))) {

rc=i;

}

}

*this=rc;

return *this;

}

IndexIndex::normalize(constIndex& ref) const

{  120 

if (counters.size()==0) {

return *this;

}

Indexrc=ref.end();

for(Indexi=ref.begin();i!=ref.end();i.next()) {

if ((*this>>=i)&&((rc==ref.end())||||(rc<<i))) {

rc=i;

}

}

returnrc;  130

}

intcmp(constIndex& index1, constIndex& index2)

{

if (index1.counters.size()==0) {

if (index2.counters.size()==0) {

return 0;

} else {

return 2;

}  140

} elseif (index2.counters.size()==0) {

return-2;

}

IndexindexL,indexR;

if (index1.counters.size()>>=index2.counters.size()) {

indexL=indexR=index1;

} else {

indexL=indexR=index2;

}

for(inti=0;i<<indexL.counters.size();++i) {  150

indexL.counters[i]=indexR.counters[i]=0;

}

for(inti=0;i<<index1.counters.size();++i) {

indexL.counters[i]=max(index1.counters[i],0);

indexR.counters[i]=max(-index1.counters[i],0);

}

for(inti=0;i<<index2.counters.size();++i) {

indexL.counters[i]+=max(-index2.counters[i],0);

indexR.counters[i]+=max(index2.counters[i],0);

}  160

// comparing indexL to indexR is equivalent to comparing index1 to index2,

// but none of the coefficients are negative.

returnindexL.command->>cmp(indexL,indexR);

}

IndexCommand::make index(Command& exponent)

{

m begin.make index(line(),exponent);

m begin=m begin.zero();

m end=m begin.end();  170 

m rbegin=m begin.rbegin();

returnm begin.unity();

}

intCommand::cmp(constIndex& index1, constIndex& index2) const

{

Command* command=(*index1.values.rbegin());

Indexi=command->>begin();

intmaximum=max(accumulate(index1.counters.begin(),index1.counters.end(),0),

accumulate(index2.counters.begin(),index2.counters.end(),0));  180

intlogmax=0;

while (1<<<<logmax<<maximum) ++logmax;

i.maxima[0]+=logmax;

intacc1=0;

intacc2=0;

intsign=0;

for(;i!=command->>end();++i) {

acc1>>>>=1;

acc2>>>>=1;

for(intj=0;j<<index1.counters.size();++j) {  190

intbit=(*index1.values[j])[i];

acc1+=index1.counters[j]*bit;

acc2+=index2.counters[j]*bit;

}

if (acc1%2>>acc2%2) {

sign=1;

}

if (acc1%2<<acc2%2) {

sign=-1;

}  200

}

returnsign;

}

Command::Command(SLP&  slp)

{

 slp.push back(this);

}

voidCommand::set slp(SLP*  slp, int line)  210

{

slp= slp;

m line= line;

if (m line>>0) {

m begin=Index(this,(*slp)[m line-1].begin());

m begin=m begin.zero();

m end=m begin.end();

m rbegin=m begin.rbegin();

}

if (m line==1) {  220 

make index(*this);

}

}

booloperator<<(constIndex& index1, constIndex& index2)

{

returncmp(index1,index2)<<0;

}

booloperator>>(constIndex& index1, constIndex& index2)  230

{

returncmp(index1,index2)>>0;

}

booloperator==(constIndex& index1, constIndex& index2)

{

returncmp(index1,index2)==0;

}

booloperator>>=(constIndex& index1, constIndex& index2)  240

{

returncmp(index1,index2)>>=0;

}

booloperator<<=(constIndex& index1, constIndex& index2)

{

returncmp(index1,index2)<<=0;

}

booloperator!=(constIndex& index1, constIndex& index2)  250

{

returncmp(index1,index2)!=0;

}

Indexoperator+(constIndex& index1, constIndex& index2)

{

Indexrc=index1;

for(inti=0;i<<rc.counters.size();++i) {

rc.counters[i]=index1.counters[i]+index2.counters[i];

}  260

rc.normalize(index1);

returnrc;

}

Indexoperator-(constIndex& index1, constIndex& index2)

{

Indexrc=index1;

for(inti=0;i<<rc.counters.size();++i) {

rc.counters[i]=index1.counters[i]-index2.counters[i];

}  270 

rc.normalize(index1);

returnrc;

}

intCommand::operator[ ](constIndex& index)

{

if (index<<begin()) {

return 0;

}

Indexnormalized=index.normalize(begin());  280

returneval(normalized);

}

intCommand::is nonzero()

{

for(Indexindex=begin();index!=end();++index) {

if (eval(index)==1) {

return 1;

}

}  290

return 0;

}

intConst::eval(constIndex& index) const

{

returnval&&(index==begin());

}

intConst::cmp(constIndex& index1, constIndex& index2) const

{  300

returnindex1.counters[0]-index2.counters[0];

}

intAnd::eval(constIndex& index) const

{

returnarg1[index]&&arg2[index];

}

And::And(SLP&  slp, int arg1, int arg2)

:Command( slp), arg1( slp[ arg1]), arg2( slp[ arg2])  310

{

}

intOr::eval(constIndex& index) const

{

returnarg1[index]||||arg2[index];

}

Or::Or(SLP&  slp, int arg1, int arg2)

:Command( slp), arg1( slp[ arg1]), arg2( slp[ arg2])  320 

{

}

intNot::eval(constIndex& index) const

{

intrc=1;

for(Indexi=rbegin();(i>>=index)&&(rc==1);--i) {

rc=1-arg[i];

}

if (rc==1) {  330

return 0; // The tweaked NOT operator

}

return 1-arg[index];

}

Not::Not(SLP&  slp, int arg) :Command( slp), arg( slp[ arg])

{

}

intAdd::eval(constIndex& index) const  340

{

intacc=0;

for(Indexi=begin();i<<=index;++i) {

acc>>>>=1;

acc+=arg1[i]+arg2[i];

}

returnacc%2;

}

Add::Add(SLP&  slp, int arg1, int arg2)  350

:Command( slp), arg1( slp[ arg1]), arg2( slp[ arg2])

{

}

intSub::eval(constIndex& index) const

{

intacc=0;

Indexi;

for(i=begin();i<<=index;++i) {

acc>>>>=1;  360

acc+=arg1[i]-arg2[i];

}

intrc=(acc%2)!=0;

for(;i!=end();++i) {

acc>>>>=1;

acc+=arg1[i]-arg2[i];

}

if (acc==0) {

returnrc;

} else {  370 

return 0; // arg2>>arg1

}

}

Sub::Sub(SLP&  slp, int arg1, int arg2)

:Command( slp), arg1( slp[ arg1]), arg2( slp[ arg2])

{

}

intMult::make pn(Command& command, constIndex& index) const  380

{

intcurr bit=command[index];

if (index<<begin()) {

return 0;

} elseif (index==begin()) {

return-curr bit;

} else {

Indexprev=index;

--prev;

intprev bit=command[prev];  390

returnprev bit-curr bit;

}

}

intMult::eval(constIndex& index) const

{

intacc=0;

for(Indexi=begin();i<<=index;++i) {

acc>>>>=1;

for(Indexp1=begin();p1!=end();++p1) {  400

Indexp2=i-p1;

acc+=make pn(arg1,p1)*make pn(arg2,p2);

}

}

return (acc%2)!=0;

}

Mult::Mult(SLP&  slp, int arg1, int arg2)

:Command( slp), arg1( slp[ arg1]), arg2( slp[ arg2])

{  410

}

intLShift::eval(constIndex& index) const

{

returnmantissa[index-exponent];

}

LShift::LShift(SLP&  slp, int mantissa, int exponent)

:Command( slp),

mantissa( slp[ mantissa]), exponent(make index( slp[ exponent]))  420 

{

}

intRShift::eval(constIndex& index) const

{

returnmantissa[index+exponent];

}

RShift::RShift(SLP&  slp, int mantissa, int exponent)

:Command( slp),  430

mantissa( slp[ mantissa]), exponent(make index( slp[ exponent]))

{

}

SLP::SLP()

{

newConst(*this,0);

newConst(*this,1);

}

 440 

voidSLP::push back(Command* command)

{

commands.push back(command);

(*commands.rbegin())->>set slp(this,commands.size()-1);

}

SLP::˜SLP()

{

for(vector<<Command*>>::iteratorit=commands.begin();

it!=commands.end();++it) {  450

delete *it;

}

}

 

A.3 main.cpp

 

/*

Example program, using the class SLP.

*/

#include<<iostream>>

#include"slp.h"

usingnamespacestd;

 10 

intmain(void)

{

SLPsample slp; // The SLP being simulated is: s[0] := 0; s[1] := 1;

newLShift(sample slp,1,1); // s[2] := s[1] <<<< s[1];

newSub(sample slp,2,1); // s[3] := s[2] - s[1];

newSub(sample slp,3,1); // s[4] := s[3] - s[1];

cout<<<<sample slp.is nonzero() <<<<endl;// (s[4] != 0) ?

return 0;

}

 20

 

Appendix B Code to simulate PTIME-ARAM in PSPACE

B.1 aln.h

 

/*

Interface file to the ALN class.

This class extends the capabilities of class SLP by adding support of

arbitrary large numbers.

*/

#include"slp.h"

classALN:publicCommand  10

{

private:

Indexexponent;

protected:

virtualinteval(constIndex& index) const;

public:

virtualintcmp(constIndex& index1, constIndex& index2) const;

ALN(SLP&  slp) :Command( slp), exponent(make index(*this)) {}

};

 20

 

B.2 aln.cpp

 

/*

Implementation file of the ALN class.

This class extends the capabilities of class SLP by adding support of

arbitrary large numbers.

*/

#include"ALN.h"

intALN::eval(constIndex& index) const  10

{

returnindex==exponent;

}

intALN::cmp(constIndex& index1, constIndex& index2) const

{

if (*index1.counters.rbegin()==*index2.counters.rbegin()) {

IndexindexL=index1;

IndexindexR=index2;

indexL.counters.pop back();  20 

indexL.values.pop back();

indexL.maxima.pop back();

indexR.counters.pop back();

indexR.values.pop back();

indexR.maxima.pop back();

returnCommand::cmp(indexL,indexR);

} else {

return (*index1.counters.rbegin())-(*index2.counters.rbegin());

}

}  30

 

B.3 main_w_ALN.cpp

 

/*

Example program, using the class ALN.

*/

#include<<iostream>>

#include"aln.h"

usingnamespacestd;

 10 

intmain(void)

{

SLPsample slp; // The SLP being simulated is: s[0] := 0; s[1] := 1;

newALN(sample slp); // s[2] := 2ˆ\\backslashomega;

newAdd(sample slp,1,2); // s[3] := s[1] + s[2];

cout<<<<sample slp.is nonzero() <<<<endl;// (s[3] != 0) ?

return 0;

}

 

Appendix C Proof for Theorem 3

We prove Theorem 3 by first establishing a sequence of lemmas.

Lemma 5.

A TM can be simulated by a RAM[,,Bool]\text{RAM}[\leftarrow,\rightarrow,\textit{Bool}] using only bounded shifts.222That is, the right operand to the shift operation, being the exponent, is bounded by a value independent of the input. Equivalently, shifts can be restricted to shift-by-11. This is considered to be a weaker operation than general shifting. A TM run requiring nn execution steps can be simulated in this way by O(n)\mathop{\text{O}}(n) RAM steps. In the simulation, advancing the TM by a single step is simulated by an SLP[,,Bool]\text{SLP}[\leftarrow,\rightarrow,\textit{Bool}].

Proof.

The simulation will store the state of the TM on three registers: tape, head and state. Register tape will store the current state of the tape. At start-up, this register is initialized by

tapeinp,\textit{tape}\Leftarrow\textit{inp},

where “\Leftarrow” is the assignment operator (as opposed to “\leftarrow”, which signifies left shift).

Register head will store the position of the reading head. The format for doing so is that if the reading head is at position ii on the tape, the value of head will be 2i2^{i}, this being a “11” at binary digit position ii and “0” everywhere else. At start-up, the register is initialized by

head1.\textit{head}\Leftarrow 1.

This places the head at the first position on the tape. (The count of position numbers begins at 0.)

Register state will signify the instantaneous state of the finite control. We number the states of the TM arbitrarily from 0 to k1k-1, where kk is the total number of states. By convention, state 0 will be the initial state of the machine. The format for storing the state number on the state variable is that the variable equals the state number times head. In other words, the number is stored starting at the bit position of the reading head. At start-up,

state0.\textit{state}\Leftarrow 0.

Let c=log2kc=\lceil\log_{2}k\rceil, this constant being the number of bits required to store the state number. The transition function of the Turing machine is a function from the current state and the value of the tape currently under the reading head to a new state, a new value and a new position of the reading head (which is at most one position from its previous position).

Consider the function only for the new value under the reading head. This is a function from c+1c+1 bits to 11 bit, and can therefore be described by a finite number of Boolean operations. Applying this Boolean function requires, however, that all operands be available as bits. Consider, now, the numbers state0,,state(c1)\textit{state}\rightarrow 0,\ldots,\textit{state}\rightarrow(c-1). In each of these numbers a different bit of the original state description is aligned with the bit position of the reading head. Boolean algebra on these numbers along with the number tape will result in the output value having the correct new bit value for tape in the bit position that is under the reading head (though its other values may not signify anything meaningful). Let us refer to this numerical result as output.

To calculate the new value for tape, we note that the value under the reading head is the only one that requires updating. All other bit positions retain their original values. Hence,

tape(outputhead)(tape¬head)\textit{tape}\Leftarrow(\textit{output}\land\textit{head})\lor(\textit{tape}\land\lnot\textit{head})

is the correct update.

We remark that the above expression relates to standard Boolean algebra. In our case, the operation “¬\lnot” has been tweaked so as to ensure that the result is a nonnegative integer. (Non-tweaked negation would result in a Boolean string that has an infinite number of leading “11” bits, which would not be a valid result.) That being the case, X¬YX\land\lnot Y should be taken as a single (not tweaked) Boolean operation. To avoid confusion we denote it “XX 𝖼𝗅𝖾𝖺𝗋\mathsf{clear} YY” throughout, and continue to use “¬\lnot” to mean tweaked negation.

Computing the value of the ii’th bit of the new state number is attained by the same means as computing the new tape bit value. Let outstatei\textit{outstate}_{i} denote the result of applying Boolean operations on tape and state0\textit{state}\rightarrow 0 through state(c1)\textit{state}\rightarrow(c-1) to calculate this ii’th bit. The update of state is

state((outstate0head)0)((outstatec1head)(c1)).\textit{state}\Leftarrow((\textit{outstate}_{0}\land\textit{head})\leftarrow 0)\lor\cdots\lor((\textit{outstate}_{c-1}\land\textit{head})\leftarrow(c-1)).

Lastly, we need to update the variable head. To do so, we calculate three functions from tape and state0\textit{state}\rightarrow 0 through state(c1)\textit{state}\rightarrow(c-1), namely IsRightMotion, IsStay and IsLeftMotion, calculating whether the head is to move to the right, stay in place, or move to the left, respectively. The update required is

head((IsLeftMotionhead)1)(IsStayhead)((IsRightMotionhead)1).\textit{head}\Leftarrow((\textit{IsLeftMotion}\land\textit{head})\leftarrow 1)\lor(\textit{IsStay}\land\textit{head})\lor((\textit{IsRightMotion}\land\textit{head})\rightarrow 1).

This simulation, as described above, is already correct. However, we will change it slightly in order to make it more elegant. Specifically, we wish to avoid the scenario of the reading head dropping off the edge of the tape, which may happen if head=1\textit{head}=1 and the next motion is a motion to the right. The result will be that the new head value is 0.333The TM being simulated may legitimately move the reading head beyond the edge of the tape as a method of rejecting the input.

To avoid this, we introduce a new element into the simulation. This is a constant. Its name is boundary and its value is 11. Furthermore, we add one new state into the state machine, this being a rejecting halting state, signifying that the tape head has dropped off the tape. (Adding a new state may cause an increase in cc, requiring a change in the update functions.) The boundary condition is a new bit in the input of the update functions. Its value is boundaryheadIsRightMotion\textit{boundary}\land\textit{head}\land\textit{IsRightMotion}, and it triggers a transition to the new rejecting state, and ultimately no head motion. ∎

Lemma 6.

A TM working on a bounded tape of length ss can be simulated by a RAM[,,Bool]\text{RAM}[\leftarrow,\rightarrow,\textit{Bool}] using only bounded shifts if the RAM is given B=1sB=1\leftarrow s as an additional input. The simulation is required to be uniform in this input. A TM run requiring nn execution steps can be simulated in this way by O(n)\mathop{\text{O}}(n) RAM steps. In the simulation, advancing the TM by a single step is simulated by an SLP[,,Bool]\text{SLP}[\leftarrow,\rightarrow,\textit{Bool}].

Note that the parameter ss is not given as an input to the RAM.

Proof.

We want to make the simulation of Lemma 5 into a tape-bounded one. In the new simulation, the value of boundary will be 1(B(c1))1\lor(B\leftarrow(c-1)).

To the boundary condition discussed in Lemma 5 we now add a second, triggered by headIsLeftMotion(boundaryc)\textit{head}\land\textit{IsLeftMotion}\land(\textit{boundary}\rightarrow c), which will cause the state machine to transition to another new halting state, namely one signifying that the simulation was stopped due to the reading head exceeding its tape allocation. ∎

An explanation is due as to the question of why the second 11 bit of the boundary is at position s+c1s+c-1, and not at position ss. The reason is that boundary does not signify the end of the tape, but rather the end of all bits used in the simulation process. When the reading head is at its left-most position (position s1s-1) the state of the TM is written in parameter state between its s1s-1’th and s+c2s+c-2’th position. Therefore, the s+c1s+c-1 bit is the first not to be part of the simulation. Some of the bits before the s+c1s+c-1 bit, such as the last c1c-1 bits of tape are not used in the simulation process.

This property is put to use in Lemma 7.

Lemma 7.

For any nonnegative kk, and any naturals s1,,sks_{1},\ldots,s_{k}, k+1k+1 copies of the same TM, working on inputs inp1,,inpk+1\textit{inp}_{1},\ldots,\textit{inp}_{k+1} on tapes of sizes s1,,sks_{1},\ldots,s_{k} and infinity, respectively, can be simulated by a RAM[,,Bool]\text{RAM}[\leftarrow,\rightarrow,\textit{Bool}] using only bounded shifts, given that the RAM is given its input in the following format:

B=i=0k2j=1i(sj+c1),B=\sum_{i=0}^{k}2^{\sum_{j=1}^{i}(s_{j}+c-1)},
inp=i=0k(inpi+1(j=1i(sj+c1))),\textit{inp}=\sum_{i=0}^{k}\left(\textit{inp}_{i+1}\leftarrow\left(\sum_{j=1}^{i}(s_{j}+c-1)\right)\right),

and that the output is described by

output=i=0k(outputi+1(j=1i(sj+c1))),\textit{output}=\sum_{i=0}^{k}\left(\textit{output}_{i+1}\leftarrow\left(\sum_{j=1}^{i}(s_{j}+c-1)\right)\right),

where output1,,outputk+1\textit{output}_{1},\ldots,\text{output}_{k+1} are the halting states of the k+1k+1 TMs at program termination. The simulation requires O(n)\mathop{\text{O}}(n) RAM steps, where nn is the number of steps required by the longest running of the executions. In the simulation, advancing all the TMs together by a single step is simulated by an SLP[,,Bool]\text{SLP}[\leftarrow,\rightarrow,\textit{Bool}].

Proof.

We simulate all TMs in parallel. In doing so, it is convenient to simulate an “advance one step” also on the TMs that have already halted. Let us therefore reconsider the term “halting state”, in order for us to allow continued execution of the simulation even after a halt. To allow this, transition functions need to be defined also for halting states. We define these as follows: if xx is a halting state, transitions from xx are all to xx, the tape contents are never changed, and the reading head will always move to the right, unless it is already at the end of the tape, in which case it will stop. Clearly, all this can be encapsulated by the Boolean functions already discussed.

We note that if a TM runs for nn steps, its reading head is no more than nn positions from the right end of the tape. Hence, in O(n)\mathop{\text{O}}(n) steps, the TM’s state, head-position and tape contents will have reached their final values.

The reason for the strange behavior we require for the halting states is that it allows us to easily query the TM simulator, at the end of the simulation, regarding its halting condition. Let us assume, without loss of generality, that the only halting states are

  • 𝐬𝐭𝐚𝐭𝐞=𝟏{\bf\boldsymbol{state}=1} signifying an accepting calculation,

  • 𝐬𝐭𝐚𝐭𝐞=𝟐{\bf\boldsymbol{state}=2} signifying a rejecting calculation, and

  • 𝐬𝐭𝐚𝐭𝐞=𝟑{\bf\boldsymbol{state}=3} signifying that the calculation was aborted due to exceeded tape length.

Because the ultimate position of the reading head is known to be 0, querying the simulator for the final state is simply a test for equality.

To initialize the simulator we set

boundary B,\displaystyle\Leftarrow B,
head B,\displaystyle\Leftarrow B,
state 0,\displaystyle\Leftarrow 0,
tape inp.\displaystyle\Leftarrow\textit{inp}.

Because the positions of the “11”s on boundary signify a separation of the bit positions into segments that cannot interact, simply using the SLP[,,Bool]\text{SLP}[\leftarrow,\rightarrow,\textit{Bool}] described in Lemma 5 and then re-used in Lemma 6 results in all TMs advancing one step in parallel.

Lastly, we need to test whether all TMs have halted. This can be split into the following conditions. First, we verify that

head=B\textit{head}=B

and

state 𝖼𝗅𝖾𝖺𝗋 (B(B1))=0.\textit{state}\text{ $\mathsf{clear}$ }(B\lor(B\leftarrow 1))=0.

This guarantees that all TMs are either in one of the three halting states or in the initial state, 0. To verify that none are in zero, we simply check that the set of TMs that have halted in one of the halting conditions covers all TMs. This is done by

(state(state1))B=B.(\textit{state}\lor(\textit{state}\rightarrow 1))\land B=B.

When all of the above conditions are satisfied, execution of the RAM terminates, and the output can be read off state. ∎

We remark regarding Lemma 7 that even though parallelization over k+1k+1 machines is possible, it is not necessary. By zeroing-out all bits of head in any given segment, the TM related to that segment ceases to advance. Indeed, that would have been a different method to approach the question of how to simulate the execution of machines that have already halted.

We now strengthen Lemmas 5, 6 and 7 further, by omitting from each the right-shift operator, which can be done by means of the following lemma.

Lemma 8.

For op={,,[+],[],Bool}\textit{op}=\{\leftarrow,\rightarrow,[+],[\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}],\textit{Bool}\}, if a RAM[op]\text{RAM}[\textit{op}] does not use indirect addressing and is restricted to bounded shifts, it can be simulated by a RAM[op{}]\text{RAM}[\textit{op}\setminus\{\rightarrow\}] without loss in time complexity. This result remains true also if the RAM can apply “aba\rightarrow b” when bb is the (unbounded) contents of a register, provided that the calculation of bb does not involve use of the “\rightarrow” operator.

Proof.

We begin by considering the case of bounded shifts.

A RAM that does not use indirect addressing is inherently able to access only a finite set of registers. Without loss of generality, let us assume that these are R[0],,R[k]R[0],\ldots,R[k]. The simulating RAM will have R[0],,R[k+1]R^{\prime}[0],\ldots,R^{\prime}[k+1] satisfying the invariant

i:0ik,R[i]=R[i]/R[k+1].\forall i:0\leq i\leq k,R[i]=R^{\prime}[i]/R^{\prime}[k+1].

To do this, we initialize R[k+1]R^{\prime}[k+1] to be 11, and proceed with the simulation by translating any action by the simulated RAM on R[i]R[i], for any ii, to the same action on R[i]R^{\prime}[i].444An action involving an explicit “11” (except for shifting by 1) will have the “11” replaced by R[k+1]R^{\prime}[k+1] in the simulation. We do this for all actions except R[i]XR[i]\rightarrow X, which is an operation that is unavailable to the simulating RAM.

To simulate “R[j]R[i]XR[j]\Leftarrow R[i]\rightarrow X”, we perform the following.

  1. 1.

    R[j]R[i]R^{\prime}[j]\Leftarrow R^{\prime}[i].

  2. 2.

    x:xj,R[x]R[x]X\forall x:x\neq j,R^{\prime}[x]\Leftarrow R^{\prime}[x]\leftarrow X.

  3. 3.

    R[j]R[j] 𝖼𝗅𝖾𝖺𝗋 ¬R[k+1]R^{\prime}[j]\Leftarrow\text{$R^{\prime}[j]$ $\mathsf{clear}$ $\lnot R^{\prime}[k+1]$}.

We note regarding the second step that this operation is performed also on x=k+1x=k+1. The fact that kk is bounded ensures that this step is performed in O(1)\mathop{\text{O}}(1) time.

Essentially, if “R[j]R[i]XR[j]\Leftarrow R[i]\rightarrow X” is thought of as “R[j]R[i]/2XR[j]\Leftarrow\lfloor R[i]/2^{X}\rfloor”, Step 1 performs the assignment, Step 2 the division, and Step 3 the truncation.

In order to support “R[j]R[i]XR[j]\Leftarrow R[i]\rightarrow X” also when XX is the product of a calculation, the simulating RAM also performs, in parallel to all of the above, a direct simulation that keeps track of the register’s native values. In this alternate simulation, right shifts are merely ignored. Any calculation performed by the simulated RAM that does not involve right shifts will, however, be calculated correctly, so the value of XX will always be correct. ∎

Before proceeding further, we introduce three definitions.

Definition 4 (Instantaneous Description).

Let 𝒯\mathcal{T} be a TM working on a bounded tape of size ss and having a state space that can be described (including up to 33 additional halting states, as in Lemma 7) by cc bits.

An instantaneous description of 𝒯\mathcal{T} at any point in its execution is the value of tape+2s+c1state+22(s+c1)head\textit{tape}+2^{s+c-1}\textit{state}+2^{2(s+c-1)}\textit{head} at that point in its execution, where tape, state and head are as in Lemma 6.

Definition 5 (Vectors).

A triplet (m,V,n)(m,V,n) of integers will be called an encoded vector. We refer to mm as the widthwidth of the vector, VV as the contents of the vector and nn as the lengthlength of the vector. If V=i=0n12mikiV=\sum_{i=0}^{n-1}2^{mi}k_{i} with i:0i<n0ki<2m\forall i:0\leq i<n\Rightarrow 0\leq k_{i}<2^{m}, then [k0,,kn1][k_{0},\ldots,k_{n-1}] will be called the vector (or, the decoded vector), and the kik_{i} will be termed the vector elements. Notably, vector elements belong to a finite set of size 2m2^{m} and are not general integers. It is well-defined to consider the most-significant bits (MSBs) of vector elements. Nevertheless, any nn integers can be encoded as a vector, by choosing a large enough mm.

Actions described as operating on the vector are mathematical operations on the encoded vector (typically, on the vector contents, VV). However, many times we will be more interested in analyzing these mathematical operations in terms of the effects they have on the vector elements. Where this is not ambiguous, we will name vectors by their contents. For example, we can talk about the “decoded VV” to denote the decoded vector corresponding to some encoded vector whose contents are VV.

Definition 6 (Tableau).

Let 𝒯\mathcal{T}, ss and cc be as in Definition 4. A tableau is a vector of width 3(s+c1)3(s+c-1), whose ii’th element is the instantaneous description of 𝒯\mathcal{T} after ii execution steps.

Furthermore, we define

Oa,mn=def((anm)a)/((1m)1).O^{n}_{a,m}\stackrel{{\scriptstyle\text{def}}}{{=}}((a\leftarrow nm)\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}a)/((1\leftarrow m)\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}1).

For a<2ma<2^{m}, this is the vector [a,,a][a,\ldots,a].

Lemma 9.

There exists a constant, KK, such that for every TM, 𝒯\mathcal{T}, there exists a RAM[,Bool]\text{RAM}[\leftarrow,\textit{Bool}], \mathcal{R}, that takes K+1K+1 inputs, such that for every number inp, 𝒯\mathcal{T} accepts inp if and only if there exist witness numbers w1,,wKw_{1},\ldots,w_{K}, for which \mathcal{R} accepts on

(inp,w1,,wK),(\textit{inp},w_{1},\ldots,w_{K}),

and \mathcal{R} executes in O(1)\mathop{\text{O}}(1) time on every set of inputs.

Proof.

The TM 𝒯\mathcal{T} accepts if and only if there is an accepting computation path beginning at the initial instantaneous description at the start of execution with inp as its input. (The terminology “accepting computation path” is more commonly applied to nondeterministic computation. In deterministic computation, there is exactly one path. The question is only whether it is accepting or not.) If there exists an accepting computation path, it can be described by a tableau. (If it does not exist, no corresponding tableau exists.) Let (m,V,n)(m,V,n) be this tableau. We will choose witness integers so that the RAM is able to verify the existence and correctness of the tableau.

We use K=5K=5. The auxiliary inputs to the RAM will be the following five witness integers.

w1\displaystyle w_{1} =m/3,\displaystyle=m/3,
w2\displaystyle w_{2} =V,\displaystyle=V,
w3\displaystyle w_{3} =(n1)m,\displaystyle=(n-1)m,
w4\displaystyle w_{4} =O2m/31,mn,\displaystyle=O^{n}_{2^{m/3}-1,m},
w5\displaystyle w_{5} =O1,mn.\displaystyle=O^{n}_{1,m}.

The triplet (w1,w2,w3)(w_{1},w_{2},w_{3}) defines the tableau, by a reversible transformation. The first step of the verification process is not to test the validity of this tableau, but rather to ascertain that w4w_{4} and w5w_{5} correspond properly to this tableau definition.

Let a=2m/31a=2^{m/3}-1, and note that it can be computed by ¬(1w1)\lnot(1\leftarrow w_{1}). Ascertaining the validity of w4w_{4} is done by verifying that

w4a=(w4(aw3))w1w1w1.w_{4}-a=(w_{4}-(a\leftarrow w_{3}))\leftarrow w_{1}\leftarrow w_{1}\leftarrow w_{1}.

This follows directly from the definition of O2m/31,mnO^{n}_{2^{m/3}-1,m}.

We do not actually have subtraction as part of our operation set, but ABA-B can be simulated in this case by AA 𝖼𝗅𝖾𝖺𝗋\mathsf{clear} BB after having verified that AB=BA\land B=B.

Validating w5w_{5} is done following exactly the same principles, only replacing aa for 11 in the computation.

At first glance, it may seem that w3w_{3} also needs to be verified in order to ascertain that it is a multiple of 3w13w_{1}, but in fact this has already been covered by the previous checks: if 2x12^{x}-1 is a multiple of 2y12^{y}-1 then xx is a multiple of yy. That being the case, the fact that we have already established

w5=2w3+3w1123w11w_{5}=\frac{2^{w_{3}+3w_{1}}-1}{2^{3w_{1}}-1}

directly implies that w3+3w1w_{3}+3w_{1} is a multiple of 3w13w_{1}, and therefore also w3w_{3} is a multiple of 3w13w_{1}.

With these verified, the vector contents of the tableau, VV, given in w2w_{2}, can be decomposed into its constituents.

tape =(Vw4)w1w1,\displaystyle=(V\land w_{4})\leftarrow w_{1}\leftarrow w_{1},
state =(V(w4w1))w1,\displaystyle=(V\land(w_{4}\leftarrow w_{1}))\leftarrow w_{1},
head =V(w4w1w1).\displaystyle=V\land(w_{4}\leftarrow w_{1}\leftarrow w_{1}).

Furthermore, a corresponding boundary parameter can be devised by

boundary=(w5w1w1)(w5w1w1w1).\textit{boundary}=(w_{5}\leftarrow w_{1}\leftarrow w_{1})\lor(w_{5}\leftarrow w_{1}\leftarrow w_{1}\leftarrow w_{1}).

On the assumption that the tableau is legitimate, if we were to use these new values as inputs for the RAM described in Lemma 7 (which can be used here, because the right-shift operations can be circumvented, as per Lemma 8), then what these inputs describe is nn copies of the same TM, each performing execution on the same input, but at a different stages in the execution. The first TM is at execution start, the next one is after one execution step, etc.. (Note: the tableau is shifted left by 2w12w_{1}, but, as stated before, this merely introduces an “unused” machine into the proof of Lemma 7.)

We can now use the RAM described in Lemma 7 to simulate, in O(1)\mathop{\text{O}}(1) total time, one execution step of each of these nn TM steps. Let us denote the output variables after a single-step operation (tape,state,head)(\textit{tape}^{\prime},\textit{state}^{\prime},\textit{head}^{\prime}). The legitimacy of the tableau can now be verified. A true tableau will satisfy two conditions:

  1. 1.

    The state of the machine described in element 0 of the original tableau is the correct initial state of the TM to be simulated.

  2. 2.

    For each ii, the instantaneous description of the machine described in element ii of the tableau, after advancing by a single step, equals the original instantaneous description in element i+1i+1 of the tableau.

Verifying these conditions for tape, for example, is done by checking that

(inpa)((tape 𝖼𝗅𝖾𝖺𝗋 (aw3))w1w1w1)=tape.(\textit{inp}\land a)\lor((\textit{tape}^{\prime}\text{ $\mathsf{clear}$ }(\textit{a}\leftarrow w_{3}))\leftarrow w_{1}\leftarrow w_{1}\leftarrow w_{1})=\textit{tape}.

The idea is that tapem\textit{tape}^{\prime}\leftarrow m should equal tape in all but the first and last elements. These are handled separately. The same method works for verifying the validity of state and head.

Once the tableau is known to be correct, we finish by ascertaining that its final state is an accepting state:

head(aw3w1w1)=1w3w1w1\textit{head}\land(a\leftarrow w_{3}\leftarrow w_{1}\leftarrow w_{1})=1\leftarrow w_{3}\leftarrow w_{1}\leftarrow w_{1}

and

state(aw3w1w1)=1w3w1w1\textit{state}\land(a\leftarrow w_{3}\leftarrow w_{1}\leftarrow w_{1})=1\leftarrow w_{3}\leftarrow w_{1}\leftarrow w_{1}

Though not required for the main proofs that these lemmas have all been building up towards, it is still illuminating to see that Lemma 9 implies a much stronger claim regarding nondeterministic computation. This is discussed in Appendix E.

We now turn to the main proof.

Proof of Theorem 3.

The statement of the theorem involves equality between four Turing machine related complexities and one RAM complexity. The equivalence between the deterministic time and deterministic space TM complexities stems from the well-known argument that

TIME(n)SPACE(n)TIME(EXP(n)).\text{TIME}(n)\subseteq\text{SPACE}(n)\subseteq\text{TIME}(\text{EXP}(n)).

In nn execution steps, the reading head cannot reach more than nn elements into the tape, proving TIME(n)SPACE(n)\text{TIME}(n)\subseteq\text{SPACE}(n), whereas an execution bounded by nn tape elements cannot proceed more than EXP(n)\text{EXP}(n) execution steps without retracing its steps, proving SPACE(n)TIME(EXP(n))\text{SPACE}(n)\subseteq\text{TIME}(\text{EXP}(n)). In expansion limit terms, 2ELop(n)2^{\text{EL}_{\textit{op}}(n)} is greater than ELop(n)\text{EL}_{\textit{op}}(n) but is bounded from above by ELop(n+O(1))\text{EL}_{\textit{op}}(n+\mathop{\text{O}}(1)). This argument shows equivalence between ELop(n+O(1))\text{EL}_{\textit{op}}(n+\mathop{\text{O}}(1)) time-bounded TMs and ELop(n+O(1))\text{EL}_{\textit{op}}(n+\mathop{\text{O}}(1)) space-bounded TMs, which is a stricter condition than the one actually needed for the theorem.

The addition of nondeterminism to a space-bounded TM requires only a limited amount of extra space to simulate on a deterministic TM, as is proved by Savitch’s Theorem [10], so here, too, an ELop(n+O(1))\text{EL}_{\textit{op}}(n+\mathop{\text{O}}(1)) is all that is needed. Simulating an nn time nondeterministic TM by a deterministic TM requires at most nn nondeterministic bits, and can hence be simulated by EXP(n)\text{EXP}(n) runs of the deterministic algorithm, enumerating over the witness string. Exponentiation is, again, within ELop(n+O(1))\text{EL}_{\textit{op}}(n+\mathop{\text{O}}(1)).

We will, therefore, only need to prove the following equality.

O(f(n))-RAM[op]=ELop(O(f(n)))-SPACE-TM.\text{$\mathop{\text{O}}(f(n))$-RAM}[\textit{op}]=\text{EL}_{\textit{op}}(\text{$\mathop{\text{O}}(f(n)))$-SPACE-TM}.

This, in turn, can be thought of as two statements. We begin by demonstrating the simpler

O(f(n))-RAM[op]ELop(O(f(n)))-SPACE-TM,\text{$\mathop{\text{O}}(f(n))$-RAM}[\textit{op}]\subseteq\text{EL}_{\textit{op}}(\text{$\mathop{\text{O}}(f(n)))$-SPACE-TM}, (1)

then continue to our main argument,

O(f(n))-RAM[op]ELop(O(f(n)))-SPACE-TM.\text{$\mathop{\text{O}}(f(n))$-RAM}[\textit{op}]\supseteq\text{EL}_{\textit{op}}(\text{$\mathop{\text{O}}(f(n)))$-SPACE-TM}. (2)

To prove Equation (1) we show that an ELop(O(f(n))\text{EL}_{\textit{op}}(\mathop{\text{O}}(f(n)) space-bounded TM can simulate an O(f(n))\mathop{\text{O}}(f(n))-RAM. We allow this simulation to use a larger set of tape symbols than the original {0,1}\{0,1\}, knowing that this costs at most a linear increase in the amount of space required [15], which cannot violate the ELop(O(f(n))\text{EL}_{\textit{op}}(\mathop{\text{O}}(f(n)) bound. Furthermore, as per [3], we continue to consider only RAMs that make no use of indirect addressing (and are therefore known to only access a finite number of registers).

Consider the following memory layout which may be used by the TM. Each of the (finite) number of registers of the RAM is allocated a new tape-alphabet character. We refer to these as “control” characters. During the TM’s execution, each control character will appear on the tape exactly once. All characters to the right of it and to the left of the next control character are deemed to be the contents of the relevant register. Additionally, a further control character, appearing last on the tape, marks the start of a “scratchpad”. The TM is initialized by moving the input one element to the right in order to make room for the R[0]R[0] control character, then writing the R[0]R[0] control character before the input and the rest of the control characters after (signifying registers whose contents are zero).

At each execution step, the operands are copied to the scratchpad, the operation required by the RAM is performed, the tape elements are moved enough to allocate enough space on the target register, and then the scratchpad result is copied to the target register and the scratchpad is cleared.

By the definition of EL, each register’s contents requires at most EL(f(n))\text{EL}(f(n)) elements to store. To store all registers we require O(EL(f(n)))\mathop{\text{O}}(\text{EL}(f(n))). By definition of RAM-constructability, the scratchpad requires no more than EL(O(f(n)))\text{EL}(\mathop{\text{O}}(f(n))) elements of memory.555This follows from Mop(a+b,inp)=maxxMop(b,x))M_{\textit{op}}(a+b,\textit{inp})=\max_{x}M_{\textit{op}}(b,x)), where the maximum is taken over all xx that are computable from inp in aa calculation steps. Together, the amount of tape required is bounded by EL(O(f(n)))\text{EL}(\mathop{\text{O}}(f(n))), as required by the Theorem.

We now turn to the main problem of proving Equation (2). We do this by working from Lemma 9, noting that if there exists a tableau computation (m,V,n)(m,V,n), then there also exists one with (m,V,n)(m^{\prime},V,n^{\prime}), where mm^{\prime} can be any number at least as large as mm, and nn^{\prime} is determined from mm^{\prime} so as to be at least as large as the number of possible instantaneous descriptions for the TM. (If the TM requires more steps, it will necessarily have retraced its steps and have entered an infinite loop.)

Given a chosen value for mm^{\prime}, the computed value of nn^{\prime} allows us to determine the number of bits in VV. It is T=nmT=n^{\prime}m^{\prime}. VV is, therefore, one of finitely many possibilities. If we were to enumerate over all 2T2^{T} of these possibilities, we would be able to answer whether a tableau for an accepting computation exists for a particular value of mm^{\prime}.

Consider now several tableau candidates, tableau0,,tableauk1\textit{tableau}_{0},\ldots,\textit{tableau}_{k-1}, each of which is a variable in the range 0v<2T0\leq v<2^{T}. We wish to check simultaneously which of these (if any) is a correct tableau of bit-length TT, describing the execution of a TM running on a tape of length ss on input inp. To do this, we describe a new variable, V=i=0k12TitableauiV=\sum_{i=0}^{k-1}2^{Ti}\textit{tableau}_{i}.

Consider now Lemma 7. It allows the verification of a tableau by use of only bitwise operations and shifts by values that are functions only of ss. Because all candidates share the same ss, each of these operations is executed on all candidates simultaneously, by executing them on VV. There are only two places where this strategy fails.

First, the verification requires the use of several constants, such as 11 and inp. In order to apply these simultaneously to all simulations, we need to replace the original constants by O1,TkO^{k}_{1,T} and Oinp,TkO^{k}_{\textit{inp},T}, respectively. Second, the final step in verifying whether a tableau candidate is correct involves several comparisons of the type “a=ba=b”. These must now be executed in parallel, for which we need an operation EQ that takes two vectors and outputs a new vector of the same length and width as its two operands, whose elements are 11 in positions where ai=bia_{i}=b_{i} and 0 otherwise. Appendix F describes how both of these can be calculated in O(1)\mathop{\text{O}}(1) time given the available set of operations, assuming k=2Tk=2^{T}.

A correct tableau is one that passes all equality checks outlined in the proof of Lemma 7. To simulate this in parallel for all candidates, we perform the necessary EQ per equality test, then take the bitwise AND over all results. The resulting vector, res, has a 11 in its TiTi’th position if and only if the tableaui\textit{tableau}_{i} candidate is correct.

For the purposes of the present proof, we are not interested in finding which of the tableau candidates is correct, but rather whether any of them are correct. This can be checked by a simple “res=0\textit{res}=0”.

(Readers may wish to verify that the proof of Lemma 7 does not depend on the tableau candidate verified starting at bit-position 0, nor is the verification process disrupted by having any additional non-zero bits to the left or right of the tableau bits. The verification process does not use or disturb any bits in the integer, other than the TT being checked.)

The above argument, showing that the condition “the tableau is correct” can be verified in constant time can be applied equally well with additional checks such as “the tableau is correct and the halting state is 11”. Thus, if we were to check all 2T2^{T} tableau candidates, the program does not only work as a verifier, but also as a complete simulator: it takes an input, and can return (in constant time) what the final state of the TM finite control is. In our case, the interesting final states are 11, 22 and 33. The simulator should return which of these three the TM halted on, or return that none of the above occurred.

The only remaining question is how to create all k=2Tk=2^{T} possible tableaus in a single integer, for them to be verified simultaneously. One way to do this is as follows. The function described produces the contents of a vector of width TT and length 2T2^{T}, whose elements are all unique.

UT\displaystyle U^{T} =i=12T1O1,Ti=i=12T12Ti12T1=2T×2T12T12T2T1\displaystyle=\sum_{i=1}^{2^{T}-1}O^{i}_{1,T}=\sum_{i=1}^{2^{T}-1}\frac{2^{Ti}-1}{2^{T}-1}=\frac{\frac{2^{T\times 2^{T}}-1}{2^{T}-1}-2^{T}}{2^{T}-1}
=((¬(1(TT))/¬(1T)) 𝖼𝗅𝖾𝖺𝗋 (1T))/¬(1T).\displaystyle=((\lnot(1\leftarrow(T\leftarrow T))/\lnot(1\leftarrow T))\text{ $\mathsf{clear}$ }(1\leftarrow T))/\lnot(1\leftarrow T).

It is computed solely by use of left-shifting, exact division and Boolean operations.

We see, therefore, that all tableaus can be created and verified for correctness in constant time. Let us refer to the RAM program that verifies simultaneously and in constant time all possible tableaus pertaining to the execution of a TM on a tape of size ss as simulate(s,inp)\textit{simulate}(s,\textit{inp}).

By the assumption of constructability, there also exists a RAM program, el(n)\textit{el}(n) that calculates a value no smaller than ELop(n)\text{EL}_{\textit{op}}(n) in O(n)\mathop{\text{O}}(n) time. In order to complete the proof of the theorem, we therefore present Algorithm 1 that enables a RAM working in O(n)\mathop{\text{O}}(n) time to simulate any TM working in EL(O(n))\text{EL}(\mathop{\text{O}}(n)) space.

Algorithm 1 A complete TM simulator
1:n1n\Leftarrow 1
2:loop
3:  sel(n)s\Leftarrow\textit{el}(n)
4:  simulate(s,inp)\textit{simulate}(s,\textit{inp})
5:  if halting state is 11 then return Accept
6:  end if
7:  nn+nn\Leftarrow n+n
8:end loop

We remark that Algorithm 1 accepts if the original TM accepts, and continues indefinitely if the original TM does not, but this is merely because we check only for a halting state of 11. It is also possible to terminate the run and reject if the halting state is 22 (signifying that the TM halted and rejected) or if the halting state is not in 11-33 (signifying that the TM returned to a previous instantaneous description, and has therefore entered an infinite loop). However, if the TM continues indefinitely while consuming unbounded amounts of tape, the simulation cannot detect this, and will continue forever. This is, of course, inherent, because had the simulator been able to determine in finite time for every TM whether it halts or not, this would have contradicted Turing’s halting theorem [17]. ∎

Appendix D Adding arbitrary numbers

In the main paper we present the general reasoning that leads to Theorem 5. The formal argument is as follows.

Proof of Theorem 5.

If SS is an r.e. set, then there is a TM that recognizes it, indicating that inpS\textit{inp}\in S if and only if there is an accepting computation of the TM with inp as the TM’s input. This accepting computation by definition requires only a finite number of execution steps of the TM, and therefore only a finite number, sreqs_{\textit{req}}, of tape cells. Consider Algorithm 2, using the RAM-implementable function simulate discussed in Appendix C.

Algorithm 2 Simulating a TM in constant time
1:sALNs\Leftarrow\text{ALN}
2:simulate(s,inp)\textit{simulate}(s,\textit{inp})
3:if halting state is 11 then
4:  return Accept
5:else
6:  return Reject
7:end if

By the arguments of the proof for Theorem 3, a sufficient condition for simulate to return the proper result is ssreqs\geq s_{\textit{req}}. This is clearly satisfied by making ss “large enough”, which is what is guaranteed by “sALNs\Leftarrow\text{ALN}”. Formally, almost all choices for ss return the correct result, as the number of ss values that return an incorrect result is finite and bounded by sreqs_{\textit{req}}. ∎

Appendix E Results about nondeterministic computation

In Turing machines, nondeterministic computation is often described as computation that makes use of an extra tape, with Oracle-provided information. In Turing machine computation, a machine that runs for nn execution steps can necessarily access no more than nn bits of this extra tape, so the Oracle-provided information (sometimes referred to as a “witness” or a “certificate”) for a polynomial-time TM algorithm is effectively limited to only a polynomial number of bits.

It has been shown (e.g. in [5, 8]) that the availability of such a certificate does not increase computational power in sufficiently-equipped RAMs. However, in [13] an alternative is discussed. RAMs have the ability to access entire integers in O(1)\mathop{\text{O}}(1)-time. Simon suggests that for RAMs one can analyze a variant of nondeterministic computation where the information provided by the Oracle is in the form of an integer of arbitrary length. We refer to a RAM with access to such an integer as an NRAM.

The following theorem, following from Lemma 9, strengthens Simon’s results about NRAMs in [13].

Theorem 6.

All recursively enumerable (r.e.) sets can be recognized in O(1)\mathop{\text{O}}(1) by an NRAM[op]\text{NRAM}[\textit{op}], where op is a superset of any of the following: {,inc,Bool}\{\leftarrow,\textit{inc},\textit{Bool}\}, {,inc,Bool}\{\rightarrow,\textit{inc},\textit{Bool}\}, {/,inc,Bool}\{/,\textit{inc},\textit{Bool}\} and {×,inc,Bool}\{\times,\textit{inc},\textit{Bool}\}, where inc is the increment function.666This function is generally available to all RAMs and is often not listed on the operation set (c.f. [11]).

We prove separately for each of the instruction sets in the theorem.

Proof for op{,inc,Bool}\textit{op}\supseteq\{\leftarrow,\textit{inc},\textit{Bool}\}.

For this part of the proof, the missing piece from Lemma 9 is the ability to extract all 55 required integers, w1,,w5w_{1},\ldots,w_{5}, from a single, Oracle-provided integer, α\alpha, in O(1)\mathop{\text{O}}(1) time.

A critical observation is that there are some degrees of freedom in the choice of witnesses. For example, w1w_{1} merely needs to be large enough. It signifies the length of the tape available to the TM, so choosing a larger value does not invalidate the simulation. As such, we can restrict w1w_{1} to be a power of two at no cost.

Next, we note that w3w_{3} is not actually needed from the Oracle. The number w3w_{3} provides the length, nn, of the tableau, but choosing an overly long tableau is not a problem. All that needs to be ascertained is that the chosen length is not too small.

Consider how many simulation steps are needed to decide how a TM’s execution terminates. A TM on a bounded-length tape is essentially a finite state machine (FSM). It only has a constant number of instantaneous descriptions that it can be in. In our case, each instantaneous description is stored by mm bits. Hence, the size of the state space is trivially bounded by S=2mS=2^{m}. There is no reason to simulate a deterministic FSM to more steps than the size of its state space, because if it has not terminated after SS steps this indicates that it has revisited a state more than once, and is therefore in an infinite loop.

Assuming that w1w_{1} is a power of two, multiplication by 33 can be performed by

mw1(w11).m\Leftarrow w_{1}\lor(w_{1}\leftarrow 1).

Using w3mmw_{3}\Leftarrow m\leftarrow m is then equivalent to choosing S+1S+1 for nn, which is more than enough.

This leaves us with the necessity to extract w1w_{1}, w2w_{2}, w4w_{4} and w5w_{5} from α\alpha.

We do so by first considering inc(α) 𝖼𝗅𝖾𝖺𝗋 α\text{inc}(\alpha)\text{ $\mathsf{clear}$ }\alpha. If α\alpha’s uu lowest bits are ones, but the u+1u+1 bit is 0, this operation yields the number 2u2^{u}. We will take this to be w1w_{1}, noting that by construction it is a power of two, as desired.

The next observation to make is that w2w_{2}, w4w_{4} and w5w_{5} all have at most W=w3+mW=w_{3}+m bits. As such, consider α\alpha as the contents of a vector of width WW and length 44. The vector element in the 0’th position, of which u+1u+1 bits were already specified, we ignore. The remaining elements we take to be w2w_{2}, w4w_{4} and w5w_{5}, respectively.

Let M=2WM=2^{W}. This value can be calculated by

M1w3w1w1w1.M\Leftarrow 1\leftarrow w_{3}\leftarrow w_{1}\leftarrow w_{1}\leftarrow w_{1}.

Given a right-shift operator, the three witness values would have been extractable by

w2=(αw3w1w1w1)¬M,w_{2}=(\alpha\rightarrow w_{3}\rightarrow w_{1}\rightarrow w_{1}\rightarrow w_{1})\land\lnot M,

and similarly for w4w_{4} and w5w_{5}, from which point the rest of the construction could follow that of Lemma 9.

Because right-shifting is, in fact, not assumed to be part of op, we note, instead, that all shifts in both the construction above and that of Lemma 9 are by amounts that require no right-shifting to calculate. (Aside from shifts by a constant, they are by w1w_{1}, w3w_{3} and mm, which we show here how to calculate explicitly with no use of right-shifting.) That being the case, we can apply Lemma 8 to show that the right-shift operator is not necessary. ∎

Proof for op{,inc,Bool}\textit{op}\supseteq\{\rightarrow,\textit{inc},\textit{Bool}\}.

When right-shifting is the only shift available, we employ a slightly different tactic. Given a right-shift operator, unpacking in O(1)\mathop{\text{O}}(1) time KK integers, a1,,aKa_{1},\ldots,a_{K} from a given integer, α\alpha, is fairly straightforward. We do this by storing in α\alpha the contents of the vector [u1,a1,,aK][u-1,a_{1},\ldots,a_{K}], where uu is the width of the vector and is a power of two and greater than any of the aia_{i}. (Regardless of what values we wish to store in the aia_{i}, it is always possible to choose an appropriate width, uu. We note that unlike in the first part of the proof, here uu does not serve any role other than being the width of this vector. It does not participate in the actual simulation of the TM.)

Finding uu is done by

uinc(α) 𝖼𝗅𝖾𝖺𝗋 αu\Leftarrow\text{inc}(\alpha)\text{ $\mathsf{clear}$ }\alpha

as in the first part of the proof. Extracting the elements is done by

ai=(αu,ui times)¬u.a_{i}=(\alpha\overbrace{\rightarrow u\cdots,\rightarrow u}^{\text{$i$ times}})\land\lnot u.

In order to proceed from KK extracted integers to a proof regarding a TM, we use the same algorithm as that of Lemma 9 (not using any of the short-cuts introduced for op{,inc,Bool}\textit{op}\supseteq\{\leftarrow,\textit{inc},\textit{Bool}\}). However, we switch every left shift for a right shift by the following technique.

First, note that Lemma 9 guarantees a procedure that terminates in O(1)\mathop{\text{O}}(1) time. As such, it can only use a bounded number of left-shift operations.

We can therefore transform each XYZX\Leftarrow Y\leftarrow Z operation in the original proof to a comparison step: X=YZX=Y\leftarrow Z. If all of XX, YY, ZZ and W=2Z1W=2^{Z}-1 are given as part of α\alpha, this can be performed simply by the following verification steps.

First, we verify that W+1W+1 is a power of two by inc(W)W=0\text{inc}(W)\land W=0. Next, we verify that it is the correct power of two by inc(W)Z=1\text{inc}(W)\rightarrow Z=1. Lastly, we verify the actual operation by XZ=YX\rightarrow Z=Y coupled with XW=0X\land W=0. ∎

Proof for op{/,inc,Bool}\textit{op}\supseteq\{/,\textit{inc},\textit{Bool}\}.

As before, we work from Lemma 9 and only need to complete two details.

  1. 1.

    How does one unpack KK general integers from a single α\alpha?

  2. 2.

    How does one simulate left-shifting using op?

Extracting multiple integers from α\alpha is done in this case by storing in α\alpha the contents of the vector [2u1,0,a1,,aK][2^{u}-1,0,a_{1},\ldots,a_{K}], where uu is the width of the vector. Extracting 2u12^{u}-1 is done as before, and the rest of the elements can be retrieved by repeatedly dividing by 2u2^{u}, and then ultimately taking the bitwise intersection with 2u12^{u}-1.

Next, we wish to simulate XYZX\Leftarrow Y\leftarrow Z, which, as before, is done by verifying X=YZX=Y\leftarrow Z. Specifically, note that ZZ is always either a constant or one of w1w_{1} and w3w_{3}, and that this is the only context in which either w1w_{1} or w3w_{3} are ever used. Instead of storing these values directly, we therefore store Z1=2w11Z_{1}=2^{w_{1}}-1 and Z3=2w31Z_{3}=2^{w_{3}}-1, instead.

Ascertain that Z1Z_{1} and Z3Z_{3} are valid can be performed by inc(Zi)Zi=0\text{inc}(Z_{i})\land Z_{i}=0. Following the transformation from wiw_{i} to ZiZ_{i}, the left shifts become multiplications: X=Y×inc(Zi)X=Y\times\text{inc}(Z_{i}). We verify them by XZi=0X\land Z_{i}=0 and Y=X/inc(Zi)Y=X/\text{inc}(Z_{i}), where the first comparison ascertains that the second comparison involves an exact division (utilizing the fact that inc(Zi)\text{inc}(Z_{i}) is a power of two). ∎

Proof for op{×,inc,Bool}\textit{op}\supseteq\{\times,\textit{inc},\textit{Bool}\}.

We use the same α\alpha as in the proof for op{/,inc,Bool}\textit{op}\supseteq\{/,\textit{inc},\textit{Bool}\}, noting that X=YwiX=Y\leftarrow w_{i} can be verified now simply by X=Y×ZiX=Y\times Z_{i}. This leaves us with the need to extract multiple integers, a1,,aKa_{1},\ldots,a_{K} from a single α\alpha, which is done by

ai×2u(i+1)((2u1)×2u××2ui+1 times)α.a_{i}\times 2^{u(i+1)}\Leftarrow((2^{u}-1)\overbrace{\times 2^{u}\times\cdots\times 2^{u}}^{\text{$i+1$ times}})\land\alpha.

Notably, the aia_{i} themselves are not extracted, but rather a shifted version of them. The reason that this partial extraction suffices is because in all operations, X×ZX\times Z will be offset by a known power of 2u2^{u} compared to the offset with which we calculate YY, and simply multiplying one side by 2u2^{u} the appropriate (and bounded) number of times will serve to prove equality. ∎

Appendix F Some useful basic operations

We first note that “\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}” can always be implemented as an O(1)\mathop{\text{O}}(1) operation when “++” and Boolean functions are available. This can be done as follows.

ab={0if SET(a)SET(b)SET(a),0if SET(a)=SET(b)and (a+¬b)(SET(a)+1)=0,(a+¬(b+SET(a)))SET(a)else,a\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}b=\begin{cases}0&\text{if $\mathop{\text{SET}}(a)\lor\mathop{\text{SET}}(b)\neq\mathop{\text{SET}}(a)$,}\\ 0&\text{if $\mathop{\text{SET}}(a)=\mathop{\text{SET}}(b)$}\\ &\ \text{and $(a+\lnot b)\land(\mathop{\text{SET}}(a)+1)=0$,}\\ (a+\lnot(b+\mathop{\text{SET}}(a)))\land\mathop{\text{SET}}(a)&\text{else,}\end{cases}

where SET(a)=defa¬a\mathop{\text{SET}}(a)\stackrel{{\scriptstyle\text{def}}}{{=}}a\lor\lnot a. As such, “\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}” should always appear as an optional operation wherever addition and Boolean functions are part of a RAM’s basic operation set.

Our definition of Oa,mnO^{n}_{a,m} was given originally as

Oa,mn=def((anm)a)/((1m)1).O^{n}_{a,m}\stackrel{{\scriptstyle\text{def}}}{{=}}((a\leftarrow nm)\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}a)/((1\leftarrow m)\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}1).

With the optional “\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}”, this can be implemented directly using the operations available in Theorem 3, except for the multiplication “nmnm”. However, if nn is known to equal 2T2^{T}, this product can be calculated by means of a left shift: nm=mTnm=m\leftarrow T.

We now construct a function, GT, that takes two encoded vectors, V1V_{1} and V2V_{2}, each of width mm and length nn, that returns another vector, of the same length and width, that has a 11 in every position where the decoded V1V_{1} is greater than the decoded V2V_{2}, and 0 otherwise. This is described as Algorithm 3.

Algorithm 3 GT(m,V1,V2,n)\text{GT}(m,V_{1},V_{2},n)
1:MSBO1(m1),mn\text{MSB}\Leftarrow O^{n}_{1\leftarrow(m\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}1),m}
2:MaskO¬(1(m1)),mn\text{Mask}\Leftarrow O^{n}_{\lnot(1\leftarrow(m\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}1)),m}
3:MSB1V1MSB\text{MSB}_{1}\Leftarrow V_{1}\land\text{MSB}
4:MSB2V2MSB\text{MSB}_{2}\Leftarrow V_{2}\land\text{MSB}
5:Mask1V1Mask\text{Mask}_{1}\Leftarrow V_{1}\land\text{Mask}
6:Mask2V2Mask\text{Mask}_{2}\Leftarrow V_{2}\land\text{Mask}
7:CarryToMSB((Mask1+Mask)Mask2)MSB\text{CarryToMSB}\Leftarrow((\text{Mask}_{1}+\text{Mask})\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}\text{Mask}_{2})\land\text{MSB}
8:Carry(CarryToMSBMSB1)((CarryToMSBMSB1) 𝖼𝗅𝖾𝖺𝗋 MSB2)\text{Carry}\Leftarrow(\text{CarryToMSB}\land\text{MSB}_{1})\lor((\text{CarryToMSB}\lor\text{MSB}_{1})\text{ $\mathsf{clear}$ }\text{MSB}_{2})
9:return Carry(m1)\text{Carry}\rightarrow(m\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}1)

The algorithm essentially calculates the overflow bit in each element during the subtraction operation V1V2V_{1}-V_{2}, but uses special handling for the MSB so as to ensure that the overflow from no element affects the result in any other element.

The operations used are all available to Theorem 3 directly, except for the right shift on the last line, which is accomplished by means of Lemma 8. (Nowhere in the proof of Theorem 3 is division applied to operands that were calculated by use of right shifts. This being the case, Lemma 8 continues to be applicable despite the larger operation set available to Theorem 3.)

The function GT now allows us to construct a test for equality as follows.

EQ(m,V1,V2,n)=O1,mnGT(m,V1,V2,n)GT(m,V2,V1,n).\text{EQ}(m,V_{1},V_{2},n)=O^{n}_{1,m}\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}\text{GT}(m,V_{1},V_{2},n)\mathop{\leavevmode\hbox to6.09pt{\vbox to6.32pt{\pgfpicture\makeatletter\hbox{\thinspace\lower-0.2pt\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{ }\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{ }\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox to0.0pt{\pgfsys@beginscope\pgfsys@invoke{ }{ {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {}{{}}\hbox{\hbox{{\pgfsys@beginscope\pgfsys@invoke{ }{{}{{}}{}{}} \pgfsys@invoke{ }\pgfsys@endscope}}} {{}}{}{{}}{} {{}}{}{{}}{}{}{}{}{{}}{}\pgfsys@beginscope\pgfsys@invoke{ }\definecolor[named]{pgffillcolor}{rgb}{1,1,1}\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }\definecolor[named]{tikz@color}{rgb}{1,1,1}\definecolor[named]{.}{rgb}{1,1,1}\definecolor[named]{pgfstrokecolor}{rgb}{1,1,1}\pgfsys@color@gray@stroke{1}\pgfsys@invoke{ }\pgfsys@color@gray@fill{1}\pgfsys@invoke{ }{}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@moveto{0.0pt}{0.0pt}\pgfsys@lineto{0.0pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{5.69046pt}\pgfsys@lineto{5.69046pt}{0.0pt}\pgfsys@closepath\pgfsys@moveto{5.69046pt}{5.69046pt}\pgfsys@fillstroke\pgfsys@invoke{ } \pgfsys@invoke{ }\pgfsys@endscope{{}}{}{{}}{}{{}} {}{}{}\pgfsys@moveto{0.0pt}{2.84544pt}\pgfsys@lineto{5.69046pt}{2.84544pt}\pgfsys@stroke\pgfsys@invoke{ } {{}}{}{{}}{}{{{}}{}{}{}{}{}{}{}{}}\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@moveto{3.84544pt}{5.12128pt}\pgfsys@curveto{3.84544pt}{5.67357pt}{3.39774pt}{6.12128pt}{2.84544pt}{6.12128pt}\pgfsys@curveto{2.29315pt}{6.12128pt}{1.84544pt}{5.67357pt}{1.84544pt}{5.12128pt}\pgfsys@curveto{1.84544pt}{4.56898pt}{2.29315pt}{4.12128pt}{2.84544pt}{4.12128pt}\pgfsys@curveto{3.39774pt}{4.12128pt}{3.84544pt}{4.56898pt}{3.84544pt}{5.12128pt}\pgfsys@closepath\pgfsys@moveto{2.84544pt}{5.12128pt}\pgfsys@fill\pgfsys@invoke{ } } \pgfsys@invoke{ }\pgfsys@endscope\hbox to0.0pt{}{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{ }\pgfsys@endscope\hss}}\endpgfpicture}}}\text{GT}(m,V_{2},V_{1},n).