1

Is there a universal language restricted to the primitive recursive functions - without while loops or goto etc - that can effectively model all other languages similarly so restricted?

Is there something analogous to the notion of Turing Complete, but for languages restricted to primitive recursive functions?

To be clear, I'm only talking about languages that do not allow total functions which are not primitive recursive functions.

I think this is similar to this question, but for PR instead of allowing total functions.

  • 2
    Note that there is no "universal primitive recursive" function - that is, there is no primitive recursive $f$ of two variables such that for every primitive recursive $p$ of one variable, there is some $n$ such that $p=f(n,-)$. (Otherwise, consider $k\mapsto f(k,k)+1$ ...) This rules out what is for me the most straightforward interpretation of your question; is this satisfying? – Noah Schweber Sep 07 '18 at 20:01
  • @NoahSchweber the question is similar to the one linked where a proof was shown that no turing-like completeness could be found for the family of total programming languages. I'm asking if we restrict the languages further to just those that only allow the primitive recursive functions would the answer differ? Can a language that can model all the primitive recursive functions of any arity be simulated by any other such language. ie, in the same way that the untyped lambda calculus and SKI combinators were found equally powerful. ie., they can each embed the other? –  Sep 07 '18 at 20:16
  • @YesheTenley If you are looking for a simple "programming language" that calculates "exactly" the p.r. functions of any arity (and nothing else), then the answer is yes. Here is the relevant link: https://people.csail.mit.edu/meyer/meyer-ritchie.pdf. If the question was about something else, then I guess this isn't relevant. – SSequence Sep 07 '18 at 20:52
  • @SSequence, thanks that is interesting. Here is another language which seems similar: https://en.m.wikipedia.org/wiki/BlooP_and_FlooP the question is if LOOP and BlooP are Turing-like equivalent for some analogue of Turing - completeness for only languages restricted to PR. –  Sep 07 '18 at 21:28
  • @YesheTenley I would just briefly mention though that the language you linked ("Bloop" .... let's call it L2) really seems to be same one I just linked to (call it L1). Apparently (since I haven't looked carefully enough), it seems one can simulate all the "extra" instructions of L2 within L1 somewhat easily. If you are saying whether both prog. languages can simulate each other, yes of course. That's because the collection of function they compute are the same. But I am not certain what you mean. – SSequence Sep 07 '18 at 21:50

1 Answers1

1

No, there is no such language

There is a nice proof by contradiction here. Let $f_n$ be the nth primitively recursive function (under some ordering, like alphabetical BlooP programs). Now define $$f(n)=f_n(n)+1$$ $f$ isn't a primitively recursive function because it's value differs from $f_n$ at $f(n)$.

Now suppose there is a primitively recursive language that could model other primitively recursive languages. It would be able to calculate the value of $f(n)$ by simulating the nth primitively recursive program*. But we know $f$ isn't primitively recursive so the language can't be primitively recursive.

*Primitively recursive languages have bounded loops this means they all halt. The halting problem prevents us from using this construction on Turing Machines.

fejfo
  • 430
  • Support the part, "it would be able to calculate the values of f" please. I do not think that follows. Why would you suppose that f can be calculated from such a language? –  Sep 11 '18 at 15:18
  • @YesheTenley Because a universal language would be able to calculate $f(n)$ by simulating $f_n$ with input $n$ and adding 1. – fejfo Sep 12 '18 at 22:04