Abstract machines that compute primitive recursive functions

322 Views Asked by At

What it the simplest (least powerful) abstract machine that can compute primitive recursive sets, i.e. sets whose characteristic or indicator function is primitive recursive?

$$f:\mathbb{N}\rightarrow\mathbb{B}$$

Most descriptions of abstract machines I've found online tend to be either too powerful (e.g. Turing machines, tag systems, queue automata, etc) or too weak (e.g. pushdown automata, finite state machines, etc).

Apparently BlooP is an example of a programming language that can only express primitive recursive functions. Is there a simpler, computationally equivalent version of this language that can compute primitive recursive sets?

Alternatively, what is the basis for primitive recursive predicates?

Related: https://mathoverflow.net/questions/73068/machine-model-for-primitive-recursion

1

There are 1 best solutions below

1
On BEST ANSWER

The for language is much simpler and is able to express all primitive recursive functions :

You can have as many variables (a,b,c,...) as you want that contains a natural integer. The first variables are usually used as input (all other variable are initialised to 0) and the first variable can be used also as the output.

Operations :

  1. incr a : to increase by 1 the value of variable a
  2. decr a : to decrease by 1 a
  3. op1; op2 : to execute op1 then op2
  4. for a op done : repeat op , a times. (the value of a when the loop is started is used, even if a is changed inside the loop)

For example to compute $a+b$ :

for b incr a done

For example to compute $(a\mod 2)$ (I added line comments to explain the program after //)

for a decr a; // a=a-1 
   for b decr b done; incr b; // b=1
   for c decr b done;  // b=1-c
   for c decr c done;  for b do incr c done; // c=b
done; // now a = 0 and b = a mod 2
for b incr a done // a=b now you return a by default.