CS 461 / THEORY OF COMPUTATION
The M2 constructor
Paste an encoding of ⟨M, w⟩. Generate a new Turing machine, M2, as a seven-tuple.
Ready. Edit the example or paste your own encoding.
Input notation and requirements
Enter (Q, Σ, Γ, δ, q₀, qaccept, qreject),w. Use braces for sets and parentheses for tuples. Optional outer angle brackets are accepted.
- Write each transition as
((state,read),(nextState,write,L))or useR. For example,((q0,1),(q1,1,R))means: in q0 reading 1, write 1, move right, and enter q1. _means blank, not a space. Γ must contain it. Do not append blank cells or an ellipsis to w.- Σ contains single digits; w uses only symbols in Σ. Use
eps,ε, or nothing after the final comma for the empty word. - State and tape-symbol names may contain letters, digits, and underscores. Declare a transition for every nonhalting state and tape symbol. Accept and reject states have no outgoing transitions.
- The tape extends to the right. A left move at its first cell stays at that cell.
What does M2 do?
- Check whether x belongs to {0ⁿ1ⁿ | n ≥ 0}. The empty word qualifies.
- If it does, accept.
- Otherwise, erase x, write the fixed word w, and simulate M. Accept when M accepts; reject when M rejects. If M loops, M2 loops too.
M2 has input alphabet {0,1}. Its output includes extra states and tape symbols for checking, cleanup, and simulation. The constructor generates transitions; it does not run M on w.
For the supplied example, M accepts 11011, so the generated M2 accepts every binary input.
Runs entirely in your browser. Save this HTML file or upload it to your website; no server or installation is required.