1 / 4

# Turing Machine Example

Turing Machine Example. 2 n. A TM M that recognizes the language: L = {0 | n ≥ 0 } PSEUDOCODE Sweep the input string from left to right, cross out every other 0 (cuts the number of 0s in half). If in step 1, the tape had only one 0 , accept .

Télécharger la présentation

## Turing Machine Example

E N D

### Presentation Transcript

1. Turing Machine Example 2n • A TM M that recognizes the language: L = {0 | n ≥ 0 } PSEUDOCODE • Sweep the input string from left to right, cross out every other 0 (cuts the number of 0s in half). • If in step 1, the tape had only one 0, accept. • Else if the tape had an odd number of 0’s, reject. • Move the head back to the first input symbol. • Go to step 1.

2. Formal description of the M recognize L • M = (Q, Σ, Γ, , q0, qaccept, qreject) where: • Q = {q0, q1, q2, q3, q4, qaccept, qreject } • Σ = {0} • Γ = {0, x} •  is described by the diagram in the next slides • The start , accept, reject states are q0, qaccept, and qreject respectively

3. State transition diagram of M x/x, L 0/0, L The symbol “x” is used to cross out symbols. q2 /,R /,L x/x, R x/x, R q0 q1 q3 0/x, R 0/, R x/x, R /, R 0/x, R 0/0, R /, R qaccept qreject q4 x/x, R /, R

4. Example run on input “0000”: q00000 q1000 xq300 x0q40x0xq3 x0q2xxq20xq2x0x q2x0x q1x0xxq10xxxq3x xxxq3 xxq2xxq2xxq2xxx q2xxx q1xxxxq1xxxxq1xxxxq1xxxqaccept References: http://www.cs.sunysb.edu/~cse350/slides/turing2.pdf http://www.cs.cmu.edu/~emc/flac09/lectures/Lecture8x.ppt http://www.cs.cmu.edu/~emc/flac09/lectures/Lecture9x.ppt

More Related