CS 461 / THEORY OF COMPUTATION

The M2 constructor

Paste an encoding of ⟨M, w⟩. Generate a new Turing machine, M2, as a seven-tuple.

01 · Input

A machine M followed by a comma and its fixed input word w.

02 · Generated machine

M2 checks its own input x for 0ⁿ1ⁿ, then runs M on w if the check fails.

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.

What does M2 do?
  1. Check whether x belongs to {0ⁿ1ⁿ | n ≥ 0}. The empty word qualifies.
  2. If it does, accept.
  3. 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.