bbm402-lecture 1: turing machinesozkahya/classes/... · turing machines x 1 x 2 x n t t nite-state...
TRANSCRIPT
![Page 1: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/1.jpg)
BBM402-Lecture 1: Turing Machines
Lecturer: Lale Özkahya
Resources for the presentation:https://courses.engr.illinois.edu/cs373/fa2010/lectureshttps://courses.engr.illinois.edu/cs498374/lectures.html
![Page 2: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/2.jpg)
David Hilbert • Early 1900s – crisis in math founda@ons – a[empts to formalize resulted in paradoxes, etc.
• 1920, Hilbert’s Program: “mechanize” mathema@cs
• Finite axioms, inference rules turn crank, determine truth needed: axioms consistent & complete
This slide recycled from Lecture 1
![Page 3: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/3.jpg)
Kurt Gödel
• German logician, at age 25 (1931) proved: “There are true statements that can’t be proved”
(i.e., “no” to Hilbert)
• Shook the founda@ons of – mathema@cs – philosophy – science – everything
This slide recycled from Lecture 1
![Page 4: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/4.jpg)
Alan Turing
• Bri@sh mathema@cian – cryptanalysis during WWII
– arguably, father of AI, Theory – several books, movies
• Defined “computer”, “program”
and (1936) provided founda@ons for inves@ga@ng fundamental ques@on of what is computable, what is not computable.
This slide recycled from Lecture 1
![Page 5: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/5.jpg)
• DFA with (infinite) tape. • One move: read, write, move, change state.
![Page 6: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/6.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tape
A finite state machine that reads/writes symbols on the tapeCan read/write anywhere on the tapeTape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.Transition (based on current state and symbol under head):
Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 7: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/7.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tapeA finite state machine that reads/writes symbols on the tape
Can read/write anywhere on the tapeTape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.Transition (based on current state and symbol under head):
Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 8: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/8.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tapeA finite state machine that reads/writes symbols on the tapeCan read/write anywhere on the tape
Tape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.Transition (based on current state and symbol under head):
Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 9: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/9.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tapeA finite state machine that reads/writes symbols on the tapeCan read/write anywhere on the tapeTape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.Transition (based on current state and symbol under head):
Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 10: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/10.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tapeA finite state machine that reads/writes symbols on the tapeCan read/write anywhere on the tapeTape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.
Transition (based on current state and symbol under head):Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 11: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/11.jpg)
Turing Machines
X1 X2 · · · Xn t t
finite-statecontrol
tape
head
Unrestricted memory: an infinite tapeA finite state machine that reads/writes symbols on the tapeCan read/write anywhere on the tapeTape is infinite in one direction only (other variants possible)
Initially, tape has input and the machine is reading (i.e., tapehead is on) the leftmost input symbol.Transition (based on current state and symbol under head):
Change control stateOverwrite a new symbol on the tape cell under the headMove the head left, or right.
Agha-Viswanathan CS373
![Page 12: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/12.jpg)
Example
Let M1 be a Turing machine that tests if an input string is in the
language B, where B = {w#w |w ∈ {0, 1}∗}.M1 zig-zags across the tape: if no # is found, reject. Cross o�
symbols as they are checked to keep track.
When all symbols to the left of the # have been crossed o�, check
for any remaining symbols to the right of the #. If any symbol
remained, reject, otherwise accept.
![Page 13: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/13.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 14: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/14.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 15: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/15.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 16: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/16.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 17: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/17.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 18: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/18.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 19: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/19.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 20: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/20.jpg)
Turing MachinesFormal Definition
A Turing machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q is a finite set of control states
Σ is a finite set of input symbols
Γ ⊇ Σ is a finite set of tape symbols. Also, a blank symbolt ∈ Γ \ Σ
q0 ∈ Q is the initial state
qacc ∈ Q is the accept state
qrej ∈ Q is the reject state, where qrej 6= qacc
δ : Q × Γ→ Q × Γ× {L,R} is the transition function.Given the current state and symbol being read, the transitionfunction describes the next state, symbol to be written anddirection (left or right) in which to move the tape head.
Agha-Viswanathan CS373
![Page 21: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/21.jpg)
Transition Function
q1 q2
X → Y , L
δ(q1,X ) = (q2,Y , L): Read transition as “the machine when instate q1, and reading symbol X under the tape head, will move tostate q2, overwrite X with Y , and move its tape head to the left”
In fact δ : (Q \ {qacc, qrej})× Γ→ Q × Γ× {L,R}. Notransition defined after reaching qacc or qrej
Transitions are deterministic
Convention: if δ(q,X ) is not explicitly specified, it is taken asleading to qrej, i.e., say δ(q,X ) = (qrej,t,R)
Agha-Viswanathan CS373
![Page 22: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/22.jpg)
Transition Function
q1 q2
X → Y , L
δ(q1,X ) = (q2,Y , L): Read transition as “the machine when instate q1, and reading symbol X under the tape head, will move tostate q2, overwrite X with Y , and move its tape head to the left”
In fact δ : (Q \ {qacc, qrej})× Γ→ Q × Γ× {L,R}.
Notransition defined after reaching qacc or qrej
Transitions are deterministic
Convention: if δ(q,X ) is not explicitly specified, it is taken asleading to qrej, i.e., say δ(q,X ) = (qrej,t,R)
Agha-Viswanathan CS373
![Page 23: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/23.jpg)
Transition Function
q1 q2
X → Y , L
δ(q1,X ) = (q2,Y , L): Read transition as “the machine when instate q1, and reading symbol X under the tape head, will move tostate q2, overwrite X with Y , and move its tape head to the left”
In fact δ : (Q \ {qacc, qrej})× Γ→ Q × Γ× {L,R}. Notransition defined after reaching qacc or qrej
Transitions are deterministic
Convention: if δ(q,X ) is not explicitly specified, it is taken asleading to qrej, i.e., say δ(q,X ) = (qrej,t,R)
Agha-Viswanathan CS373
![Page 24: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/24.jpg)
Transition Function
q1 q2
X → Y , L
δ(q1,X ) = (q2,Y , L): Read transition as “the machine when instate q1, and reading symbol X under the tape head, will move tostate q2, overwrite X with Y , and move its tape head to the left”
In fact δ : (Q \ {qacc, qrej})× Γ→ Q × Γ× {L,R}. Notransition defined after reaching qacc or qrej
Transitions are deterministic
Convention: if δ(q,X ) is not explicitly specified, it is taken asleading to qrej, i.e., say δ(q,X ) = (qrej,t,R)
Agha-Viswanathan CS373
![Page 25: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/25.jpg)
Transition Function
q1 q2
X → Y , L
δ(q1,X ) = (q2,Y , L): Read transition as “the machine when instate q1, and reading symbol X under the tape head, will move tostate q2, overwrite X with Y , and move its tape head to the left”
In fact δ : (Q \ {qacc, qrej})× Γ→ Q × Γ× {L,R}. Notransition defined after reaching qacc or qrej
Transitions are deterministic
Convention: if δ(q,X ) is not explicitly specified, it is taken asleading to qrej, i.e., say δ(q,X ) = (qrej,t,R)
Agha-Viswanathan CS373
![Page 26: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/26.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 27: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/27.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state
: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 28: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/28.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 29: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/29.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head
: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 30: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/30.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 31: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/31.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells.
Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 32: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/32.jpg)
Configurations
The configuration (or “instantaneous description”) contains all theinformation to exactly capture the “current state of thecomputation”
X1X2 · · ·Xi−1qXi · · ·Xn
Includes the current state: q
Position of the tape head: Scanning i th symbol Xi
Contents of all the tape cells till the rightmost nonblanksymbol. This is will always be finitely many cells. Thosesymbols are X1X2 · · ·Xn, where Xn 6= t unless the tape headis on it.
Agha-Viswanathan CS373
![Page 33: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/33.jpg)
Special Configurations
Start configuration: q0X1 · · ·Xn, where the input is X1 · · ·Xn
Accept and reject configurations: The state q is qacc or qrej,respectively . These configurations are halting configurations,because there are no transitions possible from them.
Agha-Viswanathan CS373
![Page 34: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/34.jpg)
Special Configurations
Start configuration: q0X1 · · ·Xn, where the input is X1 · · ·Xn
Accept and reject configurations: The state q is qacc or qrej,respectively
. These configurations are halting configurations,because there are no transitions possible from them.
Agha-Viswanathan CS373
![Page 35: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/35.jpg)
Special Configurations
Start configuration: q0X1 · · ·Xn, where the input is X1 · · ·Xn
Accept and reject configurations: The state q is qacc or qrej,respectively . These configurations are halting configurations,because there are no transitions possible from them.
Agha-Viswanathan CS373
![Page 36: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/36.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 37: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/37.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then
qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 38: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/38.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 39: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/39.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then
X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 40: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/40.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 41: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/41.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 42: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/42.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then
X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 43: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/43.jpg)
Single Step
Definition
We say one configuration (c1) yields another (c2), denoted asc1 ` c2, if one of the following holds.
If δ(q,Xi ) = (p,Y , L) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−2pXi−1YXi+1 · · ·Xn
Boundary Cases:
If i = 1 then qX1X2 · · ·Xn ` pYX2 · · ·Xn
If i = n and Y = t then X1 · · ·Xn−1qXn ` X1 · · · pXn−1
If δ(q,Xi ) = (p,Y ,R) then
X1X2 · · ·Xi−1qXiXi+1 · · ·Xn ` X1X2 · · ·Xi−1YpXi+1 · · ·Xn
Boundary Case:
If i = n then X1 · · ·Xn−1qXn ` X1 · · ·Xn−1Ypt
Agha-Viswanathan CS373
![Page 44: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/44.jpg)
Computations
Definition
We say c1`∗c2 if the machine can move from c1 to c2 in zero ormore steps.
i.e., c1 = c2 or there exist c′1, . . . ,c′n such that
c1 = c′1, c2 = c′n and c′i ` c′i+1
Agha-Viswanathan CS373
![Page 45: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/45.jpg)
Computations
Definition
We say c1`∗c2 if the machine can move from c1 to c2 in zero ormore steps. i.e., c1 = c2 or there exist c′1, . . . ,c
′n such that
c1 = c′1, c2 = c′n and c′i ` c′i+1
Agha-Viswanathan CS373
![Page 46: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/46.jpg)
Acceptance and Recognition
Definition
A Turing machine M accepts w iff q0w`∗α1qaccα2, where α1, α2
are some strings. In other words, the machine M when started inits intial state and with w as input, reaches the accept state.
Note: The machine may not read all the symbols in w . It maypass back and forth over some symbols of w several times. Finally,w may have been completely overwritten.
Definition
For a Turing machine M, define L(M) = {w |M accepts w}. M issaid to accept or recognize a language L if L = L(M).
Agha-Viswanathan CS373
![Page 47: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/47.jpg)
Acceptance and Recognition
Definition
A Turing machine M accepts w iff q0w`∗α1qaccα2, where α1, α2
are some strings. In other words, the machine M when started inits intial state and with w as input, reaches the accept state.
Note: The machine may not read all the symbols in w . It maypass back and forth over some symbols of w several times. Finally,w may have been completely overwritten.
Definition
For a Turing machine M, define L(M) = {w |M accepts w}. M issaid to accept or recognize a language L if L = L(M).
Agha-Viswanathan CS373
![Page 48: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/48.jpg)
Acceptance and Recognition
Definition
A Turing machine M accepts w iff q0w`∗α1qaccα2, where α1, α2
are some strings. In other words, the machine M when started inits intial state and with w as input, reaches the accept state.
Note: The machine may not read all the symbols in w . It maypass back and forth over some symbols of w several times. Finally,w may have been completely overwritten.
Definition
For a Turing machine M, define L(M) = {w |M accepts w}.
M issaid to accept or recognize a language L if L = L(M).
Agha-Viswanathan CS373
![Page 49: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/49.jpg)
Acceptance and Recognition
Definition
A Turing machine M accepts w iff q0w`∗α1qaccα2, where α1, α2
are some strings. In other words, the machine M when started inits intial state and with w as input, reaches the accept state.
Note: The machine may not read all the symbols in w . It maypass back and forth over some symbols of w several times. Finally,w may have been completely overwritten.
Definition
For a Turing machine M, define L(M) = {w |M accepts w}. M issaid to accept or recognize a language L if L = L(M).
Agha-Viswanathan CS373
![Page 50: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/50.jpg)
Example 1: TM for {0n1n | n > 0}
Design a TM to accept the language L = {0n1n | n > 0}
High level description
On input string w
while there are unmarked 0s, do
Mark the left most 0
Scan right till the leftmost unmarked 1;
if there is no such 1 then crash
Mark the leftmost 1
done
Check to see that there are no unmarked 1s;
if there are then crash
accept
Agha-Viswanathan CS373
![Page 51: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/51.jpg)
Example 1: TM for {0n1n | n > 0}
Design a TM to accept the language L = {0n1n | n > 0}
High level description
On input string w
while there are unmarked 0s, do
Mark the left most 0
Scan right till the leftmost unmarked 1;
if there is no such 1 then crash
Mark the leftmost 1
done
Check to see that there are no unmarked 1s;
if there are then crash
accept
Agha-Viswanathan CS373
![Page 52: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/52.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 53: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/53.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 `
Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 54: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/54.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 `
A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 55: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/55.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 `
Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 56: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/56.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `
q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 57: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/57.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 `
Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 58: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/58.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 `
AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 59: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/59.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 `
AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 60: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/60.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 `
AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 61: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/61.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `
Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 62: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/62.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB `
AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 63: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/63.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB `
AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 64: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/64.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B `
AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 65: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/65.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t `
AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 66: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/66.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacct
Rejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 67: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/67.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t `
A0 t qrejt
Agha-Viswanathan CS373
![Page 68: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/68.jpg)
Example 1: TM for {0n1n | n > 0}
q0 q1 q2
q3 qacc
0→ A,R
0 → 0,RB → B,R
1→ B, L
B → B, L0→ 0, L
A→ A,R
B → B,R
B → B,R
t → t,R
Accepts input 0011: q00011 ` Aq1011 ` A0q111 ` Aq20B1 `q2A0B1 ` Aq00B1 ` AAq1B1 ` AABq11 ` AAq2BB `Aq2ABB ` AAq0BB ` AABq3B ` AABBq3t ` AABBtqacctRejects input 00: q000 ` Aq10 ` A0q1t ` A0 t qrejt
Agha-Viswanathan CS373
![Page 69: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/69.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}Σ = {0, 1}, and Γ = {0, 1,A,B,t}δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R). So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 70: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/70.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}
Σ = {0, 1}, and Γ = {0, 1,A,B,t}δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R). So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 71: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/71.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}Σ = {0, 1}, and
Γ = {0, 1,A,B,t}δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R). So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 72: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/72.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}Σ = {0, 1}, and Γ = {0, 1,A,B,t}
δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R). So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 73: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/73.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}Σ = {0, 1}, and Γ = {0, 1,A,B,t}δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R).
So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 74: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/74.jpg)
Example: {0n1n | n > 0}Formal Definition
The machine is M = (Q,Σ, Γ, δ, q0, qacc, qrej) where
Q = {q0, q1, q2, q3, qacc, qrej}Σ = {0, 1}, and Γ = {0, 1,A,B,t}δ is given as follows
δ(q0, 0) = (q1,A,R) δ(q0,B) = (q3,B,R)δ(q1, 0) = (q1, 0,R) δ(q1,B) = (q1,B,R)δ(q1, 1) = (q2,B, L) δ(q2,B) = (q2,B, L)δ(q2, 0) = (q2, 0, L) δ(q2,A) = (q0,A,R)δ(q3,B) = (q3,B,R) δ(q3,t) = (qacc,t,R)
In all other cases, δ(q,X ) = (qrej,t,R). So for example,δ(q0, 1) = (qrej,t,R).
Agha-Viswanathan CS373
![Page 75: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/75.jpg)
Example 2: TM for {0n1n2n | n > 0}Design a TM to accept the language L = {0n1n2n | n > 0}
High level description
On input string w
while there are unmarked 0s, do
Mark the left most 0
Scan right to reach the leftmost unmarked 1;
if there is no such 1 then crash
Mark the leftmost 1
Scan right to reach the leftmost unmarked 2;
if there is no such 2 then crash
Mark the leftmost 2
done
Check to see that there are no unmarked 1s or 2s;
if there are then crash
accept
Agha-Viswanathan CS373
![Page 76: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/76.jpg)
Example 2: TM for {0n1n2n | n > 0}Design a TM to accept the language L = {0n1n2n | n > 0}
High level description
On input string w
while there are unmarked 0s, do
Mark the left most 0
Scan right to reach the leftmost unmarked 1;
if there is no such 1 then crash
Mark the leftmost 1
Scan right to reach the leftmost unmarked 2;
if there is no such 2 then crash
Mark the leftmost 2
done
Check to see that there are no unmarked 1s or 2s;
if there are then crash
accept
Agha-Viswanathan CS373
![Page 77: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/77.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2 ` Aq00B1C2`∗AAq0BBCC `∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373
![Page 78: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/78.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2
`∗q3A0B1C2 ` Aq00B1C2`∗AAq0BBCC `∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373
![Page 79: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/79.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2
` Aq00B1C2`∗AAq0BBCC `∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373
![Page 80: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/80.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2 ` Aq00B1C2
`∗AAq0BBCC `∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373
![Page 81: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/81.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2 ` Aq00B1C2`∗AAq0BBCC
`∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373
![Page 82: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/82.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2 ` Aq00B1C2`∗AAq0BBCC `∗AABBCCq4t
` AABBCCtqacct
Agha-Viswanathan CS373
![Page 83: BBM402-Lecture 1: Turing Machinesozkahya/classes/... · Turing Machines X 1 X 2 X n t t nite-state control tape head Unrestricted memory: an in nite tape A nite state machine that](https://reader034.vdocuments.mx/reader034/viewer/2022042420/5f37db5af2980e44771cb213/html5/thumbnails/83.jpg)
Example 2: TM for {0n1n2n | n > 0}
q0 q1 q2 q3
q4 qacc
0→A,R
0→0,RB→B,R
1→B,R
1→1,RC→C ,R
2→C , L
C→C , L1→1, LB→B, L0→0, L
A→A,R
B→B,R
B→B,RC→C ,R
t→t,R
e.g.: q0001122`∗A0Bq31C2 `∗q3A0B1C2 ` Aq00B1C2`∗AAq0BBCC `∗AABBCCq4t ` AABBCCtqacct
Agha-Viswanathan CS373