34

# TM_Universal October 06, 2022

## Transcript

1. Turing Machines and Regular Languages
We’ll do this on a 4 tape TM. Our TM’s ﬁrst task is to move
things onto the right tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
5 / 40

2. Turing Machines and Regular Languages
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
We search tape 0 for the current state (as recorded on tape 2)
6 / 40

3. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Then we search tape 0 for the input symbol (as found on tape 3)
We use the TM’s state to keep track of whether we are after a ,
or an =.
7 / 40

4. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Then we move across the = on tape 0, ﬁnd the state number
and update Tape 2
(no change on tape 2: already in state 0)
8 / 40

5. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Then we scan back to the start of Tape 0, and advance Tape 3
by one position
Tape 3’s movement is the DFA going to the next character of
input.
9 / 40

6. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Already at state 0’s description, so ﬁnd 1
10 / 40

7. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Go after the =, and update state number (tape 2)
11 / 40

8. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Scan to left of Tape 0, advance on Tape 3.
12 / 40

9. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Now, we search for state 1’s description on Tape 0
Use TM state to remember if we just crossed a ;
13 / 40

10. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Find input symbol (1 from Tape 3)
14 / 40

11. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Find destination state (0) and update tape 2.
15 / 40

12. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
Scan to left on Tape 0 and move right one on Tape 3.
16 / 40

13. Turing Machines and Regular Languages
Tapes:
Tape 0: Transition function
Tape 1: Accepting states
Tape 2: Current state (starts at 0)
Tape 3: Input to DFA
t 0 : 1 = 1 , 0 = 0 ; 1 : 1 = 0 , 0 = 1 t
t 1 t t t t t t t t t t t t t t t t t t t
t 1 t t t t t t t t t t t t t t t t t t t
t 0 1 1 0 1 t t t t t t t t t t t t t t t
When Tape 3 sees t, we have reached the end of the DFAs
input
We need to see if the current state (recorded on Tape 2) is
accepting (listed on tape 1)
If we ﬁnd it, we accept, if not, we reject (here we accept)
17 / 40