1
Given a number n
, calculates BB(n)
(the maximum number of 1
s finally on the tape, among all halting 2-symbol n-state Turing machines with tape of zeros).
To solve the problem, you are given an extra (black-box) function H as input, which takes a function in your language (f) and returns a truthy/falsy value indicates whether this function will halt. However, the function f must not have any side-effects (I/O operations, timing, etc.) or call the halting function H.
Note that, there is no restriction on how you use the function H. A possible way is to use the function H to check if each Turing machine halts, and then simulate those to calculate the maximum, but there are other ways to compute BB(n)
.
You need to prove that it solves such a problem. Shortest code in bytes wins.
Definition of Turing Machine:
Turing machines, each member of which is required to meet the following design specifications:
The machine has n "operational" states plus a Halt state, where n is a positive integer, and one of the n states is distinguished as the starting state. (Typically, the states are labelled by 1, 2, ..., n, with state 1 as the starting state, or by A, B, C, ..., with state A as the starting state.)
The machine uses a single two-way infinite (or unbounded) tape.
The tape alphabet is {0, 1}, with 0 serving as the blank symbol.
The machine's transition function takes two inputs:
the current non-Halt state,
the symbol in the current tape cell,
and produces three outputs:
a symbol to write over the symbol in the current tape cell (it may be the same symbol as the symbol overwritten),
a direction to move (left or right; that is, shift to the tape cell one place to the left or right of the current cell), and
a state to transition into (which may be the Halt state).
There are thus (4n + 4)2n n-state Turing machines meeting this definition.
The transition function may be seen as a finite table of 5-tuples, each of the form
(current state, current symbol, symbol to write, direction of shift, next state).
Comments are not for extended discussion; this conversation has been moved to chat.
– Mego – 2018-03-13T23:21:22.943How can we test / prove that some answer is correct without having such an
H
function? – tsh – 2018-03-14T02:06:02.353@tsh That's what
You need to prove that it solves such a problem.
mean. If can't make sure it works, it doesn't count. – l4m2 – 2018-03-14T03:22:46.147