SlideShare a Scribd company logo
1 of 33
EECS 2001: Introduction to the
Theory of Computation
Muhammad Umair Khan
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Unlimited memory
 Very close to the current computers
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Unlimited memory
 Very close to the current computers
 Comparing with FA
 Write onto and read from a tape
 Read-write head can move both to the left or right on the tape (no
limitations of stack and queue)
 Tape is memory which is infinite
 Accept and reject states
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Formal definition
A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are
all finite sets and
1. Q is the set of states, {q1, q2, q4, …., qaccept, qreject}
2. Σ is the input alphabet not containing the blank symbol ␣ {1, 2, 3}
3. Γ is the tape alphabet, where ␣ ∈ Γ and Σ ⊆ Γ, {1, 2, 3, x, ␣}
4. δ : Q × Γ−→Q × Γ×{L,R} is the transition function, q1 x 1  q2 x 1 x L
5. q0 ∈ Q is the start state,
6. qaccept ∈ Q is the accept state, and
7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Input words are on the leftmost places on the tape
 Remaining tape is blank
 At the beginning, the read /write head is on the leftmost place on the tape
 A blank symbol will indicate the end of input as the blank symbol is not part
of the input alphabet
 Moving left from the leftmost place keeps you in the same place
 As the Turing machine processes, the contents of the tape change
 Current state, current location of the head, and current contents of the tape
constitute the configuration of the Turing machine.
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Consider the language B = {w#w| w ∈ {0,1}*} i.e., two
identical strings separated by a #
 The algorithms using a Turing machine will look as follows
Zig-zag across the tape to corresponding positions on either side of the # symbol to
check whether these positions contain the same symbol. If they do not, or if no # is
found, reject. Cross off symbols as they are checked to keep track of which symbols
correspond.
When all symbols to the left of the # have been crossed off, check for any remaining
symbols to the right of the #. If any symbols remain, reject; otherwise, accept .
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Consider the language B = {w#w| w ∈ {0,1}*} i.e., two
identical strings separated by a #
Turing Machines
EECS 2001 Introduction to Theory of Computation
 Formal Definition of M which recognizes B = {w#w| w ∈
{0,1}*}
 Q = {p1, . . . , p8, paccept, preject},
 Σ = {0, 1, #}, and Γ = {0, 1, #, x, ␣}.
 We describe δ with a state diagram (see the following figure).
 The start, accept, and reject states are p1, paccept, and preject,
respectively.
Turing Machine (w#w)
EECS 2001 Introduction to Theory of Computation
x  L
0  x, R
0  x, L
0,1  R
x  R
#  R
#  L
Turing Machine (w#w)
EECS 2001 Introduction to Theory of Computation
x  L
0  x, R
0  x, L
0,1  R
x  R
#  R
#  L
0,1  L
x  R
Turing Machine (w#w)
EECS 2001 Introduction to Theory of Computation
1  x, R
x  L
0  x, R
0  x, L
0,1  R
x  R
#  R
0,1  R
#  R
x  R
1  x, L
#  L
0,1  L
x  R
Turing Machine (w#w) 101#100_
EECS 2001 Introduction to Theory of Computation
1  x, R
x  L
0  x, R
0  x, L
0,1  R
x  R
#  R
0,1  R
#  R
x  R
#  R
1  x, L
#  L
0,1  L
␣  R
x  R
x  R
Turing Machines – variant 1
EECS 2001 Introduction to Theory of Computation
The head of the tape does not need to move i.e., it can stay where
it is
A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are
all finite sets and
1. Q is the set of states,
2. Σ is the input alphabet not containing the blank symbol ␣
3. Γ is the tape alphabet, where ␣ ∈ Γ and Σ ⊆ Γ,
4. δ : Q × Γ→Q × Γ×{L,R,S} is the transition function,
5. q0 ∈ Q is the start state,
6. qaccept ∈ Q is the accept state, and
7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
Turing Machines – variant 1
EECS 2001 Introduction to Theory of Computation
The head of the tape does not need to move i.e., it can stay where
it is
Does this increase the power of the Turing machine?
No, the Turing machine can be translated to the one where we can
only have a L or R as allowed head movements.
How? Stay transition is split into two transitions: move right then
left.
Turing Machines – variant 2
EECS 2001 Introduction to Theory of Computation
The Turing machine has multiple tapes from which it can read
and to which it can write
A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are
all finite sets and
1. Q is the set of states,
2. Σ is the input alphabet not containing the blank symbol ␣
3. Γk is the tape alphabet, where ␣ ∈ Γk and Σ ⊆ Γk,
4. δ : Q × Γk→Q × Γk ×{L,R} k is the transition function,
5. q0 ∈ Q is the start state,
6. qaccept ∈ Q is the accept state, and
7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
Turing Machines – variant 2
EECS 2001 Introduction to Theory of Computation
The Turing machine has multiple tapes from which it can read
and to which it can write
Is this variant more powerful? No
This Turing Machine can be translated into one where we have a
single tape
How? The contents of multiple tapes can be copied on a single
tape and placing markers as to where one ends and the other
starts
Turing Machines – variant 2
EECS 2001 Introduction to Theory of Computation
The Turing machine has multiple tapes from which it can read
and to which it can write
δ (qi, a1, …, ak) = (qj, b1, …, bk, L, R, L, …., L)
Turing Machines – variant 3
EECS 2001 Introduction to Theory of Computation
Two-way Infinite Tape Turing Machines
Number the cells on the tape as … -3, -2, -1, 0, 1, 2, 3, …
Are these more powerful? No. These can also be translated
We can store the contents of such Turing Machines on a 2 tape
TM and then convert to a one tape TM
Non-Deterministic Turing Machines – variant 4
EECS 2001 Introduction to Theory of Computation
 Like NFA or NPDA, at any point in the computation, the TM
may proceed according to several possibilities available to it.
The transition function looks like this
δ : Q × Γ→𝒫(Q × Γ×{L,R}).
Theorem 3.16: every NTM has an equivalent TM
Non-Deterministic Turing Machines – variant 4
EECS 2001 Introduction to Theory of Computation
 Consider the NTM’s computation as branches of a tree.
 We are looking for the branch that accepts
 Two options to traverse: depth first or breadth first
 Depth first might take us into an infinite loop without exploring any
other branches, one of which might accept very quickly
 Breadth first, first explores all the branches to a certain level and then
moves to the next level.
 May seem computationally more expensive however we can quit as soon as
we find an accepting branch
Non-Deterministic Turing Machines – variant 4
EECS 2001 Introduction to Theory of Computation
 NTM to TM conversion (Theorem 3.16)
 Three tapes
 Input tape – keeps the original input and the contents are never
changed/altered
 Simulation tape – current contents of the tape for a particular branch
 Address tape – address of the node in a particular branch
Turing Machine – some important points
EECS 2001 Introduction to Theory of Computation
 All the discussed variants are equivalent to each other
 i.e., one can be converted to another
 i.e., the language recognized by one can be recognized by the other
 This indicates that the concept of a TM is very robust i.e.,
minor changes in its definition do not affect its power.
Turing Machine – some important points
EECS 2001 Introduction to Theory of Computation
 A language is called Turing recognizable if a TM recognizes it.
 Also called recursively enumerable language
 A language is recognizable iff a NTM recognizes it
 A language is recognizable iff a multi-tape TM recognizes it
Turing Machine – some important points
EECS 2001 Introduction to Theory of Computation
 A language is called Turing decidable if a TM decides it.
 Also called recursive language
 Every decidable language is Turing recognizable
Turing Machine – some important points
EECS 2001 Introduction to Theory of Computation
 A TM can have three outcomes: accept, reject, or loop.
 Loop means that the TM never stops (halts)
 How do we decide that the TM has gone in a loop or is
simply taking a long time to accept or reject?
 TMs that never loop are also called deciders.
 Such machines are preferable as we will always have an answer:
accept or reject.
TMs vs. programming languages
EECS 2001 Introduction to Theory of Computation
 Of all the programming languages you know, is there any
algorithm which can be implemented in one and not the other?
 Think of a language which can be described on one of the
abovementioned variants and not the other.
Definition of an algorithm
EECS 2001 Introduction to Theory of Computation
 Algorithm: a collection of steps (think transitions) to achieve a
goal (think accept or reject)
 Alonzo Church, in 1936, used lambda calculus notation to define an
algorithm
 Alan Turing defined algorithms with his machines
 Both these definitions are equivalent (one is formal, the other is
informal) – now called Church-Turing Thesis
Definition of an algorithm
EECS 2001 Introduction to Theory of Computation
 Hilbert’s tenth problem
 Is it possible to devise an algorithm to decide whether a polynomial
has an integral root
 Integral Root is the assignment of integer values to variables such that the
polynomial evaluates to 0
 An example of a polynomial is 6x3yz2 + 3xy2 − x3 − 10
Definition of an algorithm
EECS 2001 Introduction to Theory of Computation
 Let us first consider a polynomial with only one variable
4x3 – 2x2 + x – 7
 In our terminology: D = {p | p is a polynomial over x with an integral
root}
 The steps of the TM which recognizes D is
 Assign values 0, 1, -1, 2, -2, … to x in p
 Accept if the p evaluates to zero
 If there is a value for x for which p evaluates to zero, the TM will
find it, otherwise it will keep trying forever
Definition of an algorithm
EECS 2001 Introduction to Theory of Computation
 Let us first consider a polynomial with only one variable
4x3 – 2x2 + x – 7
 Can this TM be a decider? Yes
 Because we can calculate the upper and lower limits of the root for a
single variable polynomial. The search for the root will be restricted.
 If a root is not found within these limits then the root does not exist.
If it does exist, it will be found within these limits. Hence the TM
can be used as a decider
How about the multivariable polynomial?
EECS 2001 Introduction to Theory of Computation
 Hilbert’s tenth problem
 Is it possible to devise an algorithm to decide whether a
(multivariable) polynomial has an integral root?
6x3yz2 + 3xy2 − x3 − 10
 No, it can be recognized by a TM similar to the one for the single
variable TM, but a decider cannot be made as the limits of the probable
roots are not and cannot be defined (Matijasevi˘c’s theorem)
Connected graphs problem
EECS 2001 Introduction to Theory of Computation
Let A be the language consisting of all strings representing undirected graphs that are
connected. Recall that a graph is connected if every node can be reached from every other
node by traveling along the edges of the graph. We write
A = {⟨G⟩| G is a connected undirected graph}.
<n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>
 <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>
 <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>
 <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>
 <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>
The following is a high-level description of a TM M that decides A.
M = “On input ⟨G⟩, the encoding of a graph G:
 1. Select the first node of G and mark it.
 2. Repeat the following stage until no new nodes are marked:
 2.1 For each node in G, mark it if it is attached by an edge to a node that is already marked.
 3. Scan all the nodes of G to determine whether they all are marked. If they are, accept;
otherwise, reject .”
References
EECS 2001 Introduction to Theory of Computation
Many examples in this tutorial and their solutions
have been taken from Prof. Jeffery Edmonds’ Lecture
notes for the same course (EECS 2001)
Some examples and points also have been taken from
Prof. Datta’ lecture notes
Additional resources used include Textbook by Sipser
and the internet

More Related Content

Similar to Winter 8 TM.pptx

Simulating Turing Machines Using Colored Petri Nets with Priority Transitions
Simulating Turing Machines Using Colored Petri Nets with Priority TransitionsSimulating Turing Machines Using Colored Petri Nets with Priority Transitions
Simulating Turing Machines Using Colored Petri Nets with Priority Transitionsidescitation
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Editor IJARCET
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Editor IJARCET
 
Winter 10 Undecidability.pptx
Winter 10 Undecidability.pptxWinter 10 Undecidability.pptx
Winter 10 Undecidability.pptxHarisPrince
 
souraj Toc.pptx
souraj Toc.pptxsouraj Toc.pptx
souraj Toc.pptxLifo4
 
C++ Standard Template Library
C++ Standard Template LibraryC++ Standard Template Library
C++ Standard Template LibraryIlio Catallo
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練Abner Huang
 
Some New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing MachineSome New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing Machinerahulmonikasharma
 
Some New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing MachineSome New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing Machinerahulmonikasharma
 
TM - Techniques
TM - TechniquesTM - Techniques
TM - TechniquesRajendran
 

Similar to Winter 8 TM.pptx (20)

Simulating Turing Machines Using Colored Petri Nets with Priority Transitions
Simulating Turing Machines Using Colored Petri Nets with Priority TransitionsSimulating Turing Machines Using Colored Petri Nets with Priority Transitions
Simulating Turing Machines Using Colored Petri Nets with Priority Transitions
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
 
Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207Volume 2-issue-6-2205-2207
Volume 2-issue-6-2205-2207
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
TuringMachines.pdf
TuringMachines.pdfTuringMachines.pdf
TuringMachines.pdf
 
Turing Machine.pptx
Turing Machine.pptxTuring Machine.pptx
Turing Machine.pptx
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Winter 10 Undecidability.pptx
Winter 10 Undecidability.pptxWinter 10 Undecidability.pptx
Winter 10 Undecidability.pptx
 
souraj Toc.pptx
souraj Toc.pptxsouraj Toc.pptx
souraj Toc.pptx
 
Turing machine
Turing machineTuring machine
Turing machine
 
Turing machines
Turing machinesTuring machines
Turing machines
 
C++ Standard Template Library
C++ Standard Template LibraryC++ Standard Template Library
C++ Standard Template Library
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練2009 CSBB LAB 新生訓練
2009 CSBB LAB 新生訓練
 
NP completeness
NP completenessNP completeness
NP completeness
 
Some New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing MachineSome New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing Machine
 
Some New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing MachineSome New Exercises on Computability Theory Associated with Turing Machine
Some New Exercises on Computability Theory Associated with Turing Machine
 
TM - Techniques
TM - TechniquesTM - Techniques
TM - Techniques
 

More from HarisPrince

Winter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptxWinter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptxHarisPrince
 
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptxWinter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptxHarisPrince
 
Winter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptxWinter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptxHarisPrince
 
Winter 9 Decidability.pptx
Winter 9 Decidability.pptxWinter 9 Decidability.pptx
Winter 9 Decidability.pptxHarisPrince
 
Winter 9 Tutorial Decidability.pptx
Winter 9 Tutorial Decidability.pptxWinter 9 Tutorial Decidability.pptx
Winter 9 Tutorial Decidability.pptxHarisPrince
 
Winter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptxWinter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptxHarisPrince
 

More from HarisPrince (7)

Essays.pptx
Essays.pptxEssays.pptx
Essays.pptx
 
Winter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptxWinter 12 Lecture Mapping Reducibility.pptx
Winter 12 Lecture Mapping Reducibility.pptx
 
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptxWinter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
Winter 10 Lecture 2 ATM Undecidability - Formal Proof.pptx
 
Winter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptxWinter 11 Tutorial Reducibility.pptx
Winter 11 Tutorial Reducibility.pptx
 
Winter 9 Decidability.pptx
Winter 9 Decidability.pptxWinter 9 Decidability.pptx
Winter 9 Decidability.pptx
 
Winter 9 Tutorial Decidability.pptx
Winter 9 Tutorial Decidability.pptxWinter 9 Tutorial Decidability.pptx
Winter 9 Tutorial Decidability.pptx
 
Winter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptxWinter 11 Lecture Reducibility.pptx
Winter 11 Lecture Reducibility.pptx
 

Recently uploaded

Triangle Vinyl Record Store, Clermont Florida
Triangle Vinyl Record Store, Clermont FloridaTriangle Vinyl Record Store, Clermont Florida
Triangle Vinyl Record Store, Clermont FloridaGabrielaMiletti
 
Benjamin Portfolio Process Work Slideshow
Benjamin Portfolio Process Work SlideshowBenjamin Portfolio Process Work Slideshow
Benjamin Portfolio Process Work Slideshowssuser971f6c
 
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | DelhiMalviyaNagarCallGirl
 
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service AkolaAkola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service Akolasrsj9000
 
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | DelhiMalviyaNagarCallGirl
 
FULL ENJOY - 9953040155 Call Girls in Noida | Delhi
FULL ENJOY - 9953040155 Call Girls in Noida | DelhiFULL ENJOY - 9953040155 Call Girls in Noida | Delhi
FULL ENJOY - 9953040155 Call Girls in Noida | DelhiMalviyaNagarCallGirl
 
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 60009654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000Sapana Sha
 
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call GirlsPragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
San Jon Motel, Motel/Residence, San Jon NM
San Jon Motel, Motel/Residence, San Jon NMSan Jon Motel, Motel/Residence, San Jon NM
San Jon Motel, Motel/Residence, San Jon NMroute66connected
 
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...dajasot375
 
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | DelhiFULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | DelhiMalviyaNagarCallGirl
 
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiFULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiMalviyaNagarCallGirl
 
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | DelhiMalviyaNagarCallGirl
 
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | Delhi
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | DelhiFULL ENJOY - 9953040155 Call Girls in Karol Bagh | Delhi
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | DelhiMalviyaNagarCallGirl
 
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Availabledollysharma2066
 
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Moti Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | DelhiMalviyaNagarCallGirl
 
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp Anytime
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp AnytimeRussian Call Girls Delhi NCR 9999965857 Call or WhatsApp Anytime
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp AnytimeKomal Khan
 
Govindpuri Call Girls : ☎ 8527673949, Low rate Call Girls
Govindpuri Call Girls : ☎ 8527673949, Low rate Call GirlsGovindpuri Call Girls : ☎ 8527673949, Low rate Call Girls
Govindpuri Call Girls : ☎ 8527673949, Low rate Call Girlsashishs7044
 
Call Girls in Islamabad | 03274100048 | Call Girl Service
Call Girls in Islamabad | 03274100048 | Call Girl ServiceCall Girls in Islamabad | 03274100048 | Call Girl Service
Call Girls in Islamabad | 03274100048 | Call Girl ServiceAyesha Khan
 

Recently uploaded (20)

Triangle Vinyl Record Store, Clermont Florida
Triangle Vinyl Record Store, Clermont FloridaTriangle Vinyl Record Store, Clermont Florida
Triangle Vinyl Record Store, Clermont Florida
 
Benjamin Portfolio Process Work Slideshow
Benjamin Portfolio Process Work SlideshowBenjamin Portfolio Process Work Slideshow
Benjamin Portfolio Process Work Slideshow
 
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Laxmi Nagar | Delhi
 
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service AkolaAkola Call Girls #9907093804 Contact Number Escorts Service Akola
Akola Call Girls #9907093804 Contact Number Escorts Service Akola
 
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Lajpat Nagar | Delhi
 
FULL ENJOY - 9953040155 Call Girls in Noida | Delhi
FULL ENJOY - 9953040155 Call Girls in Noida | DelhiFULL ENJOY - 9953040155 Call Girls in Noida | Delhi
FULL ENJOY - 9953040155 Call Girls in Noida | Delhi
 
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 60009654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000
9654467111 Call Girls In Noida Sector 62 Short 1500 Night 6000
 
call girls in Noida New Ashok Nagar 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Noida New Ashok Nagar 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...call girls in Noida New Ashok Nagar 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
call girls in Noida New Ashok Nagar 🔝 >༒8448380779 🔝 genuine Escort Service 🔝...
 
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call GirlsPragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
Pragati Maidan Call Girls : ☎ 8527673949, Low rate Call Girls
 
San Jon Motel, Motel/Residence, San Jon NM
San Jon Motel, Motel/Residence, San Jon NMSan Jon Motel, Motel/Residence, San Jon NM
San Jon Motel, Motel/Residence, San Jon NM
 
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...
Call Girl in Bur Dubai O5286O4116 Indian Call Girls in Bur Dubai By VIP Bur D...
 
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | DelhiFULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | Delhi
FULL ENJOY - 9953040155 Call Girls in Gandhi Vihar | Delhi
 
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | DelhiFULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
FULL ENJOY - 9953040155 Call Girls in Mahipalpur | Delhi
 
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in New Ashok Nagar | Delhi
 
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | Delhi
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | DelhiFULL ENJOY - 9953040155 Call Girls in Karol Bagh | Delhi
FULL ENJOY - 9953040155 Call Girls in Karol Bagh | Delhi
 
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available
8377087607, Door Step Call Girls In Gaur City (NOIDA) 24/7 Available
 
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | DelhiFULL ENJOY - 9953040155 Call Girls in Moti Nagar | Delhi
FULL ENJOY - 9953040155 Call Girls in Moti Nagar | Delhi
 
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp Anytime
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp AnytimeRussian Call Girls Delhi NCR 9999965857 Call or WhatsApp Anytime
Russian Call Girls Delhi NCR 9999965857 Call or WhatsApp Anytime
 
Govindpuri Call Girls : ☎ 8527673949, Low rate Call Girls
Govindpuri Call Girls : ☎ 8527673949, Low rate Call GirlsGovindpuri Call Girls : ☎ 8527673949, Low rate Call Girls
Govindpuri Call Girls : ☎ 8527673949, Low rate Call Girls
 
Call Girls in Islamabad | 03274100048 | Call Girl Service
Call Girls in Islamabad | 03274100048 | Call Girl ServiceCall Girls in Islamabad | 03274100048 | Call Girl Service
Call Girls in Islamabad | 03274100048 | Call Girl Service
 

Winter 8 TM.pptx

  • 1. EECS 2001: Introduction to the Theory of Computation Muhammad Umair Khan
  • 2. Turing Machines EECS 2001 Introduction to Theory of Computation  Unlimited memory  Very close to the current computers
  • 3. Turing Machines EECS 2001 Introduction to Theory of Computation  Unlimited memory  Very close to the current computers  Comparing with FA  Write onto and read from a tape  Read-write head can move both to the left or right on the tape (no limitations of stack and queue)  Tape is memory which is infinite  Accept and reject states
  • 4. Turing Machines EECS 2001 Introduction to Theory of Computation  Formal definition A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite sets and 1. Q is the set of states, {q1, q2, q4, …., qaccept, qreject} 2. Σ is the input alphabet not containing the blank symbol ␣ {1, 2, 3} 3. Γ is the tape alphabet, where ␣ ∈ Γ and Σ ⊆ Γ, {1, 2, 3, x, ␣} 4. δ : Q × Γ−→Q × Γ×{L,R} is the transition function, q1 x 1  q2 x 1 x L 5. q0 ∈ Q is the start state, 6. qaccept ∈ Q is the accept state, and 7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
  • 5. Turing Machines EECS 2001 Introduction to Theory of Computation  Input words are on the leftmost places on the tape  Remaining tape is blank  At the beginning, the read /write head is on the leftmost place on the tape  A blank symbol will indicate the end of input as the blank symbol is not part of the input alphabet  Moving left from the leftmost place keeps you in the same place  As the Turing machine processes, the contents of the tape change  Current state, current location of the head, and current contents of the tape constitute the configuration of the Turing machine.
  • 6. Turing Machines EECS 2001 Introduction to Theory of Computation  Consider the language B = {w#w| w ∈ {0,1}*} i.e., two identical strings separated by a #  The algorithms using a Turing machine will look as follows Zig-zag across the tape to corresponding positions on either side of the # symbol to check whether these positions contain the same symbol. If they do not, or if no # is found, reject. Cross off symbols as they are checked to keep track of which symbols correspond. When all symbols to the left of the # have been crossed off, check for any remaining symbols to the right of the #. If any symbols remain, reject; otherwise, accept .
  • 7. Turing Machines EECS 2001 Introduction to Theory of Computation  Consider the language B = {w#w| w ∈ {0,1}*} i.e., two identical strings separated by a #
  • 8. Turing Machines EECS 2001 Introduction to Theory of Computation  Formal Definition of M which recognizes B = {w#w| w ∈ {0,1}*}  Q = {p1, . . . , p8, paccept, preject},  Σ = {0, 1, #}, and Γ = {0, 1, #, x, ␣}.  We describe δ with a state diagram (see the following figure).  The start, accept, and reject states are p1, paccept, and preject, respectively.
  • 9. Turing Machine (w#w) EECS 2001 Introduction to Theory of Computation x  L 0  x, R 0  x, L 0,1  R x  R #  R #  L
  • 10. Turing Machine (w#w) EECS 2001 Introduction to Theory of Computation x  L 0  x, R 0  x, L 0,1  R x  R #  R #  L 0,1  L x  R
  • 11. Turing Machine (w#w) EECS 2001 Introduction to Theory of Computation 1  x, R x  L 0  x, R 0  x, L 0,1  R x  R #  R 0,1  R #  R x  R 1  x, L #  L 0,1  L x  R
  • 12. Turing Machine (w#w) 101#100_ EECS 2001 Introduction to Theory of Computation 1  x, R x  L 0  x, R 0  x, L 0,1  R x  R #  R 0,1  R #  R x  R #  R 1  x, L #  L 0,1  L ␣  R x  R x  R
  • 13. Turing Machines – variant 1 EECS 2001 Introduction to Theory of Computation The head of the tape does not need to move i.e., it can stay where it is A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite sets and 1. Q is the set of states, 2. Σ is the input alphabet not containing the blank symbol ␣ 3. Γ is the tape alphabet, where ␣ ∈ Γ and Σ ⊆ Γ, 4. δ : Q × Γ→Q × Γ×{L,R,S} is the transition function, 5. q0 ∈ Q is the start state, 6. qaccept ∈ Q is the accept state, and 7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
  • 14. Turing Machines – variant 1 EECS 2001 Introduction to Theory of Computation The head of the tape does not need to move i.e., it can stay where it is Does this increase the power of the Turing machine? No, the Turing machine can be translated to the one where we can only have a L or R as allowed head movements. How? Stay transition is split into two transitions: move right then left.
  • 15. Turing Machines – variant 2 EECS 2001 Introduction to Theory of Computation The Turing machine has multiple tapes from which it can read and to which it can write A Turing machine is a 7-tuple, (Q,Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite sets and 1. Q is the set of states, 2. Σ is the input alphabet not containing the blank symbol ␣ 3. Γk is the tape alphabet, where ␣ ∈ Γk and Σ ⊆ Γk, 4. δ : Q × Γk→Q × Γk ×{L,R} k is the transition function, 5. q0 ∈ Q is the start state, 6. qaccept ∈ Q is the accept state, and 7. qreject ∈ Q is the reject state, where qreject ≠ qaccept.
  • 16. Turing Machines – variant 2 EECS 2001 Introduction to Theory of Computation The Turing machine has multiple tapes from which it can read and to which it can write Is this variant more powerful? No This Turing Machine can be translated into one where we have a single tape How? The contents of multiple tapes can be copied on a single tape and placing markers as to where one ends and the other starts
  • 17. Turing Machines – variant 2 EECS 2001 Introduction to Theory of Computation The Turing machine has multiple tapes from which it can read and to which it can write δ (qi, a1, …, ak) = (qj, b1, …, bk, L, R, L, …., L)
  • 18. Turing Machines – variant 3 EECS 2001 Introduction to Theory of Computation Two-way Infinite Tape Turing Machines Number the cells on the tape as … -3, -2, -1, 0, 1, 2, 3, … Are these more powerful? No. These can also be translated We can store the contents of such Turing Machines on a 2 tape TM and then convert to a one tape TM
  • 19. Non-Deterministic Turing Machines – variant 4 EECS 2001 Introduction to Theory of Computation  Like NFA or NPDA, at any point in the computation, the TM may proceed according to several possibilities available to it. The transition function looks like this δ : Q × Γ→𝒫(Q × Γ×{L,R}). Theorem 3.16: every NTM has an equivalent TM
  • 20. Non-Deterministic Turing Machines – variant 4 EECS 2001 Introduction to Theory of Computation  Consider the NTM’s computation as branches of a tree.  We are looking for the branch that accepts  Two options to traverse: depth first or breadth first  Depth first might take us into an infinite loop without exploring any other branches, one of which might accept very quickly  Breadth first, first explores all the branches to a certain level and then moves to the next level.  May seem computationally more expensive however we can quit as soon as we find an accepting branch
  • 21. Non-Deterministic Turing Machines – variant 4 EECS 2001 Introduction to Theory of Computation  NTM to TM conversion (Theorem 3.16)  Three tapes  Input tape – keeps the original input and the contents are never changed/altered  Simulation tape – current contents of the tape for a particular branch  Address tape – address of the node in a particular branch
  • 22. Turing Machine – some important points EECS 2001 Introduction to Theory of Computation  All the discussed variants are equivalent to each other  i.e., one can be converted to another  i.e., the language recognized by one can be recognized by the other  This indicates that the concept of a TM is very robust i.e., minor changes in its definition do not affect its power.
  • 23. Turing Machine – some important points EECS 2001 Introduction to Theory of Computation  A language is called Turing recognizable if a TM recognizes it.  Also called recursively enumerable language  A language is recognizable iff a NTM recognizes it  A language is recognizable iff a multi-tape TM recognizes it
  • 24. Turing Machine – some important points EECS 2001 Introduction to Theory of Computation  A language is called Turing decidable if a TM decides it.  Also called recursive language  Every decidable language is Turing recognizable
  • 25. Turing Machine – some important points EECS 2001 Introduction to Theory of Computation  A TM can have three outcomes: accept, reject, or loop.  Loop means that the TM never stops (halts)  How do we decide that the TM has gone in a loop or is simply taking a long time to accept or reject?  TMs that never loop are also called deciders.  Such machines are preferable as we will always have an answer: accept or reject.
  • 26. TMs vs. programming languages EECS 2001 Introduction to Theory of Computation  Of all the programming languages you know, is there any algorithm which can be implemented in one and not the other?  Think of a language which can be described on one of the abovementioned variants and not the other.
  • 27. Definition of an algorithm EECS 2001 Introduction to Theory of Computation  Algorithm: a collection of steps (think transitions) to achieve a goal (think accept or reject)  Alonzo Church, in 1936, used lambda calculus notation to define an algorithm  Alan Turing defined algorithms with his machines  Both these definitions are equivalent (one is formal, the other is informal) – now called Church-Turing Thesis
  • 28. Definition of an algorithm EECS 2001 Introduction to Theory of Computation  Hilbert’s tenth problem  Is it possible to devise an algorithm to decide whether a polynomial has an integral root  Integral Root is the assignment of integer values to variables such that the polynomial evaluates to 0  An example of a polynomial is 6x3yz2 + 3xy2 − x3 − 10
  • 29. Definition of an algorithm EECS 2001 Introduction to Theory of Computation  Let us first consider a polynomial with only one variable 4x3 – 2x2 + x – 7  In our terminology: D = {p | p is a polynomial over x with an integral root}  The steps of the TM which recognizes D is  Assign values 0, 1, -1, 2, -2, … to x in p  Accept if the p evaluates to zero  If there is a value for x for which p evaluates to zero, the TM will find it, otherwise it will keep trying forever
  • 30. Definition of an algorithm EECS 2001 Introduction to Theory of Computation  Let us first consider a polynomial with only one variable 4x3 – 2x2 + x – 7  Can this TM be a decider? Yes  Because we can calculate the upper and lower limits of the root for a single variable polynomial. The search for the root will be restricted.  If a root is not found within these limits then the root does not exist. If it does exist, it will be found within these limits. Hence the TM can be used as a decider
  • 31. How about the multivariable polynomial? EECS 2001 Introduction to Theory of Computation  Hilbert’s tenth problem  Is it possible to devise an algorithm to decide whether a (multivariable) polynomial has an integral root? 6x3yz2 + 3xy2 − x3 − 10  No, it can be recognized by a TM similar to the one for the single variable TM, but a decider cannot be made as the limits of the probable roots are not and cannot be defined (Matijasevi˘c’s theorem)
  • 32. Connected graphs problem EECS 2001 Introduction to Theory of Computation Let A be the language consisting of all strings representing undirected graphs that are connected. Recall that a graph is connected if every node can be reached from every other node by traveling along the edges of the graph. We write A = {⟨G⟩| G is a connected undirected graph}. <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>  <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>  <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>  <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)>  <n1, n2, n3, n4, (n1, n2), (n2, n3), (n3, n4)> The following is a high-level description of a TM M that decides A. M = “On input ⟨G⟩, the encoding of a graph G:  1. Select the first node of G and mark it.  2. Repeat the following stage until no new nodes are marked:  2.1 For each node in G, mark it if it is attached by an edge to a node that is already marked.  3. Scan all the nodes of G to determine whether they all are marked. If they are, accept; otherwise, reject .”
  • 33. References EECS 2001 Introduction to Theory of Computation Many examples in this tutorial and their solutions have been taken from Prof. Jeffery Edmonds’ Lecture notes for the same course (EECS 2001) Some examples and points also have been taken from Prof. Datta’ lecture notes Additional resources used include Textbook by Sipser and the internet