0

Is it possible for a language (or machine or system) to be universal or turing complete, when there is no possibility to write a program for it that halts?

Lets say we create a new language, brainfuck-nonstop, that like brainfuck with a single change: When the program pointer reaches the end, it goes back to the start and doesn't stop (like it would in brainfuck). This means there is no way for any program to ever halt. Would brainfuck-nonstop still be universal or turing complete?

3 Answers3

0

A system that does not stop does not deliver results so it can be neither universal nor complete: it is rather a non-system.

  • Just because it does not stop does not mean it does not deliver results. – 12431234123412341234123 Sep 15 '23 at 13:17
  • Can you explain that? That is rather new and confusing statement for me. Lets say you write a program, that reads a input, does some calculation based on it, outputs it and waits for more input. Now it didn't halt (since it is still waiting for input) but it delivered the result for the previous input. – 12431234123412341234123 Sep 15 '23 at 13:23
  • Or even a machine that does not wait on input. What stops a universal machine of calculating something, outputting its result and then does some other calculation (with no new input) which may not halt. The machine still delivered some output without halting. – 12431234123412341234123 Sep 15 '23 at 13:27
  • So, since according to your logic, delivering results equals halting, a machine halts as soon as it outputs 1 bit? That would mean a single program is not a single program anymore but N programs, where N is the number of bits it outputs. Or in the case of the turing machine, that uses the tape as output, it halts after every single step (since ever steps writes to the tape and therefore generated a result). – 12431234123412341234123 Sep 15 '23 at 13:37
  • Ok, then you can reword your answer. To something like "If the output is complete, you can consider it halted. So even a brainfuck-nonstop program could halt by finishing its output and end in a state where no further output is possible" – 12431234123412341234123 Sep 15 '23 at 14:48
  • @12431234123412341234123: also consider deleting your question. –  Sep 15 '23 at 14:59
  • I can't asdfasfasfdasfsaf – 12431234123412341234123 Sep 18 '23 at 11:47
0

Yes, you can define a programming language that is Turing-complete even though there is no way for any program to halt.

Consider a variant of a standard programming language, with the restriction that every valid program has to be wrapped in an outermost "while True {...}" loop. Assuming this language has the ability to produce output. Such a programming language is Turing complete. For instance, you can add a boolean variable (initially True) that records whether the program is "done", and write a program of the following form:

while True {
    if !done {
        ...
    }
}

where you fill in "..." with anything you want. Now any time you would ordinarily halt, instead just set "done" to False. For instance, you can simulate a Turing machine; when the Turing machine halts, you output whether it accepted or rejected, set "done" to False, and let the program continue running but doing nothing.

There might be a little confusion about terminology. A programming language can be Turing-complete (or not). A Turing machine can be universal (or not). But there is no meaning of "universal" for programming languages; it doesn't make sense to ask whether a programming language is universal.

D.W.
  • 159,275
  • 20
  • 227
  • 470
-1

Automata (e.g. of the Büchi variety) for accepting infinite words necessarily run forever. Looking into those might be a good starting point.

Kai
  • 865
  • 5
  • 16