ATM {w in (0 + 1)* : n0(w) = n1(w) } 0 1 // input alphabet, note such comments are permitted at the end of the line 0 1 B // tape alphabet 1 // number of tapes 2 // number of tracks on tape 0 1 // tape 0 is 1-way infinite q0 // the initial state q5 // final state q0 0+B q1 0+0 r // q1: go right, look for 1 q0 1+B q2 1+1 r // q2: go right, look for 0 q0 0+0 q0 0+0 r q0 1+1 q0 1+1 r q0 B+B q5 B+B r q1 0+B q1 0+B r q1 0+0 q1 0+0 r q1 1+1 q1 1+1 r q1 1+B q3 1+1 l // q3: match 1 go back to start q2 0+B q4 0+0 l // q4: match 0 go back to start q2 0+0 q2 0+0 r q2 1+1 q2 0+1 r q2 1+B q2 1+B r q3 0+B q3 0+B l q3 1+B q3 1+B l q3 0+0 q0 0+0 r q3 1+1 q3 1+1 l q4 0+B q4 0+B l q4 1+B q4 1+B l q4 0+0 q4 0+0 l q4 1+1 q0 1+1 r end //required