For applications of Turing machines, see the section on |
To insert a sample Turing machine into your document, select from the editor |
Description | Math notation | Grafstate code | ||
---|---|---|---|---|
| Q={s,a,q1,q2}. | Q={s,a,q1,q2} | ||
| Σ={a,b}. | S={a,b} | ||
| Τ={a,b,␣} | T={a,b,\_} | ||
| q1⟶q2∶b⟶␣,R | q1->q2:b->\_,R | ||
| q0=qs. | q0=qs |
|
|
|
|
|
|
|
You may give a Turing machine an optional title to be displayed on the state diagram using the title instruction. title place a title here . |
You can add a comment to any line of the Turing machine code by typing /* followed by the comment. |
Code |
---|
q1-q2: a->a, R |
Code |
---|
q1->q2: a, R |
Code |
---|
q1-q2: a->\_, R q1->q2: b->\_, R |
Code |
---|
q1->q2: {a,b}->\_, R |
Code |
---|
q1-q2: a->a, R q1->q2: b->b, R |
Code |
---|
q1->q2: {a,b}, R |
Example |
Code |
---|
:+ tm Mab Q={q0,q1,q2,qa,qr,q3} S={a,b} T={X,\_,a,b} q0=q0 q0->q1:a->\_,R /* mark the beginning of the "data" q0->qr:b->b,S /* starts with b or more b's than a's q0:X->X,R /* skip the marked symbols q0->qa:\_->\_,S /* accept q1:a->a,R /* looking for b's so do not change a's q1:X->X,R /* skip the marked b's q1->qr:\_->\_,S /* more a's than b's q1->q2:b->X,R /* mark this b to match the a q2:b->b,R /* prepare to repeat q2->qr:a->\_,S /* a comes after b q2->q3:\_->\_,L /* prepare to rewind q3:b->b,L /* rewind past b's q3:X->X,L /* rewind past marks q3:a->a,L /* rewind past a's q3->q0:\_->\_,R /* found beginning of "data" done. |