SlideShare a Scribd company logo
1 of 99
1
Abhishek Shivhare
Deptt.Of CSE
ITSEC, Gr. Noida
2
Recall that DFAs accept regular
languages(for e.g. an)
We want to design more powerful
machines similar to DFAs that will accept
context-free languages(for e.g. anbn ).
Final
state
a
 An illusion : anbn is accepted by:
 It doesn’t guarantee equal nos. of a’s and b’s:
 It can accept any no. of a’s and any no. of
b’s(a’s = b’s OR a’s ≠ b’s )
4
Initial
State
Final
state
a b
b
To handle a language like {anbn | n  0},
the machine needs to “remember” the
number of a’s.
To do this, we use a stack.
A push-down automaton (PDA) is
essentially an NFA with a stack.
5
A push-down automaton (PDA) is a six-
tuple (K, Σ, Γ, Δ, s, F) where
• K is a finite set of states.
• Σ is a finite alphabet of tape symbols.
• Γ is a finite alphabet of stack symbols.
• s  K is the start state.
• F  K is the set of final states.
• Δ is the transition relation, i.e., Δ is a finite subset
of
(K  (Σ  {e})  Γ*)  (K  Γ*).
…a1a2
Control
Input
Stack
Let ((p, a, β), (q, γ))  Δ be a transition.
It means that we
• Move from state p.
• Read a from the tape,
• Pop the string β off the stack,
• Move to state q,
• Push string γ onto the stack.
The first three (p, a, β), are “input.”
The last two (q, γ) are “output.”
A configuration fully describes the current
“state” of the PDA.
• The current state p.
• The remaining input w.
• The current stack contents .
Thus, a configuration is a triple
(p, w, )  (K, *, *).
∆(q0, a, $)= (q1, a$)
∆(q0, b, $)= (q1, b$)
PUSH starting symbol onto stack (a/b) and
change state
10
Input:
a a b b c b b a a
$
∆(q1, a, a)= (q1, aa)
∆(q1, b, b)= (q1, bb)
∆(q1, a, b)= (q1, ab)
∆(q1, b, a)= (q1, ba)
PUSH moves continue till occurrence of ‘c’
11
Input:
a a b b c b b a
a$
∆(q1, c, b)= (q2, b)
∆(q1, c, a)= (q2, a)
No movement in stack but state changed
12
Input:
a a b b c
b b a a $
∆(q2, b, b)= (q2, €)
∆(q2, a, a )= (q2, €)
POP moves start as c is passed
13
Input:
a a b b
b b a a $
∆(q2, a, a)= (q2, €)
∆(q2, b, b)= (q2, €)
POP moves continue until a mismatch
14
Input:
a a
a a $
∆(q2, €, $)= (qf, $)
Final state comes into picture as input
exhausts and stack becomes empty!
Hence our string is accepted as valid
15
Input:
€
$
 ∆(q0, a, $)= (q1, a$)
 ∆(q0, b, $)= (q1, b$)
 ∆(q1, a, a)= (q1, aa)
 ∆(q1, b, b)= (q1, bb)
 ∆(q1, a, b)= (q1, ab)
 ∆(q1, b, a)= (q1, ba)
 ∆(q1, a, c)= (q2, a)
 ∆(q1, b, c)= (q2, b)
 ∆(q2, a, a)= (q2, €)
 ∆(q2, b, b)=(q2, €)
 ∆(q2, €, $)= (qf, $)
16
Initial (PUSH)
move
PUSH Move
No Stack
Operation
POP Move
Acceptance
All a’s are pushed into stack
On finding b on input, popping off a’s may
be achieved
At last if all input is exhausted and stack
becomes empty result achieved.
17
Stack uses LIFO, works best for strings
like:
 ambncndm | m  0, n  0,
 ambmcndn | m  0, n  0,
 ambncpdq | m + n = p + q and
 ambnck | m = n or n = k
18
But has a disadvantage, cannot work for
followings:
 anb2ncn | m  0, n  0,
 ambm+ncn | m  0, n  0 and
 anbncn | n  0 (Turing machines are
efficient for this type of language)
19
A: Use a three phase process:
1. Push mode: Before reading “#”, push
everything on the stack.
2. Reading “#” switches modes.
3. Pop mode: Read remaining symbols making
sure that each new read symbol is identical to
symbol popped from stack.
Accept if able to empty stack completely.
Otherwise reject, and reject if could not pop
somewhere.
20
21
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
22
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
Input:
aaab#baa
23
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a
Input:
aaab#baa
24
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a
Input:
aaab#baa
25
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a a
Input:
aaab#baa
26
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
b a a a
Input:
aaab#baa
27
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
b a a a
Input:
aaab#baa
28
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a a
Input:
aaab#baa
29
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a
Input:
aaab#baa
30
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a
Input:
aaab#baa
REJECT (nonempty stack)
31
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a
Input:
aaab#baaa
32
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a
Input:
aaab#baaa
33
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
Input:
aaab#baaa
Pause input
34
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
Input:
aaab#baaa
ACCEPT
35
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a a
Input:
aaab#baaaa
36
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
a
Input:
aaab#baaaa
37
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
Input:
aaab#baaaa
Pause input
38
(1)
PUSH
(3)
POP
read a or b ?
Push it
ACCEPT
(2)
read # ?
(ignore stack)
read == peek ?
Pop
Else: CRASH!
empty
stack?
Input:
aaab#baaaa
CRASH
39
e , e$
a , ea
b , eb
#, ee e , $e
a , ae
b , be
Input:
aaab#baaa
ACCEPT!
•Automata accepts regular languages only
For example, {anbn : n = 0, 1, …} is not regular
•Pushdown Automata accepts context-free languages only
For example, {anbncn : w  *} is not context-free
Turing decomposed operations in the device as follows:
•Computational steps erase a symbol
observed by the pencil and write a new one
in its place
•The decision about which symbol should be
written and which will be observed next
depend on:
•A pencil will be “observing” symbols from a paper
1. The current symbol being observed
2. The “state of mind” of the device
This device is called a Turing Machine
•The pencil can move left and right
•TMs can simulate any data structure
•TMs can simulate major components of imperative
languages: sequence, branching and loop
•TMs can control branching and loops
…a1 a2
Control
Tape
cell
head
The head:
•Reads the symbol from the cell it is
pointing to, and
•Either:
•Writes a new symbol in the cell,
or
•Moves one cell to the left or
•New cells can be added to the right of the tape as
needed (similar to RAM memory)
•These new cells contain the blank symbol, #
•The tape is bounded to the left
• denotes the alphabet of characters in language as
usual.
• denotes the set of symbols that can be written on tape
•It contains # and all symbols in 
• Transitions can be described by (Case I):
((s,a),(bRq)) If the machine is in state s and the
current cell has an a then jump to
state q and write b in the current cell
and moves head to right
• Transitions can be described by (Case II):
((s,a),(bLq)) If the machine is in state s and the
current cell has an a then jump to
state q and write b in the current cell
and moves head to left
Definition. A Turing machine is a 7-tuple (Q, , , , q0, qaccept, q
where:
•Q is a set of states
• is a set of symbols (the alphabet)
• is a set of symbols that can be written in tape, #   and
  
•q0  Q is the initial state
• qaccept is the accepting state
• qreject is the rejecting state, qreject  qaccept
•  is a collection of transitions defined by the
function:
: (Q  {qaccept, qreject })    Q    {L , R}
 Lets take a case of a3b3c3
 Moves are :
 aaabbbccc
 #aabbbccc
 #aa#bbccc
 #aa#bb#cc
 ##a#bb#cc
 ##a##b#cc
 ##a##b##c
 #####b##c
 ########c
 #########
50
a b c #
q1 #Rq2
q2
q3
q4
q5
q6
q7
51q7
a b c #
q1 #Rq2
q2 aRq2
q3
q4
q5
q6
q7
52q7
a b c #
q1 #Rq2
q2 aRq2
q3
q4
q5
q6
q7
53q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3
q4
q5
q6
q7
54q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3
q4
q5
q6
q7
55q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3
q4
q5
q6
q7
56q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4
q5
q6
q7
57q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cLq5
q5
q6
q7
58q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cLq5
q5 #Lq5
q6
q7
59q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cLq5
q5 bLq5 #Lq5
q6
q7
60q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cLq5
q5 bLq5 #Lq5
q6
q7
61q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cLq5
q5 bLq5 #Lq5
q6
q7
62q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3
q3 bRq3 #Rq4
q4 cL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#Rq3
q4 cLq5
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
84q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3 #Rq2
q3 bRq3 #Rq4 #Rq3
q4 cLq5
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
85q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3 #Rq2
q3 bRq3 #Rq4 #Rq3
q4 cLq5
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
86q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3 #Rq2
q3 bRq3 #Rq4 #Rq3
q4 cLq5
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
87q7
a b c #
q1 #Rq2
q2 aRq2 #Rq3 #Rq2
q3 bRq3 #Rq4 #Rq3
q4 cLq5 #Lq7
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
88q7
a b c #
q1 #Rq2 #Rq1
q2 aRq2 #Rq3 #Rq2
q3 bRq3 #Rq4 #Rq3
q4 cLq5 #Lq7
q5 aLq6 bLq5 #Lq5
q6 aLq6 #Rq1
q7
89q7
90
Device
Separate
Input?
Read/Write Data
Structure
Deterministic
by default?
FA
PDA
TM
91
Device
Separate
Input?
Read/Write Data
Structure
Deterministic
by default?
FA Yes None Yes
PDA
TM
92
Device
Separate
Input?
Read/Write Data
Structure
Deterministic
by default?
FA Yes None Yes
PDA Yes LIFO Stack No
TM
93
Device
Separate
Input?
Read/Write Data
Structure
Deterministic
by default?
FA Yes None Yes
PDA Yes LIFO Stack No
TM No
1-way infinite
tape. 1 cell
access per step.
Yes
(but will also
allow crashes)
94
Device Type of
Grammar
String/
Language
Finite
Automata
Regular
(Type 3)
an
95
Device Type of
Grammar
String/
Language
Finite
Automata
Regular
(Type 3)
an
Push Down
Automata
Context Free
(Type 2)
anbn
96
Device Type of
Grammar
String/
Language
Finite
Automata
Regular
(Type 3)
an
Push Down
Automata
Context Free
(Type 2)
anbn
Linear
Bounded
Automata
Context Sensitive
(Type 1) N.A.
97
Device Type of
Grammar
String/
Language
Finite
Automata
Regular
(Type 3)
an
Push Down
Automata
Context Free
(Type 2)
anbn
Linear
Bounded
Automata
Context Sensitive
(Type 1) N.A.
Turing
Machine
Unrestricted
(Type 0)
anbncn
98
99

More Related Content

What's hot

Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Abhimanyu Mishra
 
Dma transfer
Dma transferDma transfer
Dma transfergmnithya
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And SubtractionKeyur Vadodariya
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionswarda aziz
 
TM - Techniques
TM - TechniquesTM - Techniques
TM - TechniquesRajendran
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in CompilersMahbubur Rahman
 
Recursive Descent Parsing
Recursive Descent Parsing  Recursive Descent Parsing
Recursive Descent Parsing Md Tajul Islam
 
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsAshu
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Bilal Amjad
 
assembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUEducation
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFAMaulik Togadiya
 
Two-way Deterministic Finite Automata
Two-way Deterministic Finite AutomataTwo-way Deterministic Finite Automata
Two-way Deterministic Finite AutomataHafsa.Naseem
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded searchHema Kashyap
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computationBipul Roy Bpl
 

What's hot (20)

Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
Dma transfer
Dma transferDma transfer
Dma transfer
 
Signed Addition And Subtraction
Signed Addition And SubtractionSigned Addition And Subtraction
Signed Addition And Subtraction
 
8086 alp
8086 alp8086 alp
8086 alp
 
Undecidabality
UndecidabalityUndecidabality
Undecidabality
 
Turing machine-TOC
Turing machine-TOCTuring machine-TOC
Turing machine-TOC
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
TM - Techniques
TM - TechniquesTM - Techniques
TM - Techniques
 
Ll(1) Parser in Compilers
Ll(1) Parser in CompilersLl(1) Parser in Compilers
Ll(1) Parser in Compilers
 
Recursive Descent Parsing
Recursive Descent Parsing  Recursive Descent Parsing
Recursive Descent Parsing
 
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 SolutionsIntroduction to Computer theory Daniel Cohen Chapter 2 Solutions
Introduction to Computer theory Daniel Cohen Chapter 2 Solutions
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 8 (The Stack and...
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
assembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YUassembly language programming and organization of IBM PC" by YTHA YU
assembly language programming and organization of IBM PC" by YTHA YU
 
Planning
PlanningPlanning
Planning
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFA
 
Two-way Deterministic Finite Automata
Two-way Deterministic Finite AutomataTwo-way Deterministic Finite Automata
Two-way Deterministic Finite Automata
 
Post Machine
Post MachinePost Machine
Post Machine
 
Lecture 16 memory bounded search
Lecture 16 memory bounded searchLecture 16 memory bounded search
Lecture 16 memory bounded search
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 

Viewers also liked

Push down automata
Push down automataPush down automata
Push down automataSomya Bagai
 
Undecidable Problem
Undecidable ProblemUndecidable Problem
Undecidable ProblemMGoodhew
 
Push Down Automata (PDA)
Push Down Automata (PDA)Push Down Automata (PDA)
Push Down Automata (PDA)dhea zafarina
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Abhimanyu Mishra
 
Quanttech(About Us)
Quanttech(About Us)Quanttech(About Us)
Quanttech(About Us)liu ming
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdfDilouar Hossain
 
Backus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsBackus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsAshutosh Pandey
 
Pushdown Automata - Materi 8 - TBO
Pushdown Automata - Materi 8 - TBOPushdown Automata - Materi 8 - TBO
Pushdown Automata - Materi 8 - TBOahmad haidaroh
 
Bakus naur form
Bakus naur formBakus naur form
Bakus naur formgrahamwell
 
Edited alan turing-presentation
Edited alan turing-presentationEdited alan turing-presentation
Edited alan turing-presentationdottuta
 
Automata languages and computation
Automata languages and computationAutomata languages and computation
Automata languages and computationKarthik Velou
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
Automata
AutomataAutomata
AutomataGaditek
 
Partial compute function
Partial compute functionPartial compute function
Partial compute functionRajendran
 

Viewers also liked (20)

Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
 
Push down automata
Push down automataPush down automata
Push down automata
 
Turing machine by_deep
Turing machine by_deepTuring machine by_deep
Turing machine by_deep
 
Undecidable Problem
Undecidable ProblemUndecidable Problem
Undecidable Problem
 
Push Down Automata (PDA)
Push Down Automata (PDA)Push Down Automata (PDA)
Push Down Automata (PDA)
 
Pushdown autometa
Pushdown autometaPushdown autometa
Pushdown autometa
 
Pda
PdaPda
Pda
 
Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4Theory of automata and formal languages Unit 4
Theory of automata and formal languages Unit 4
 
Quanttech(About Us)
Quanttech(About Us)Quanttech(About Us)
Quanttech(About Us)
 
Юлия Киселева (ДонНТУ). "2012 - год Алана Тьюринга"
Юлия Киселева (ДонНТУ). "2012 - год Алана Тьюринга" Юлия Киселева (ДонНТУ). "2012 - год Алана Тьюринга"
Юлия Киселева (ДонНТУ). "2012 - год Алана Тьюринга"
 
Theory of computation Lec7 pda
Theory of computation Lec7 pdaTheory of computation Lec7 pda
Theory of computation Lec7 pda
 
Regular expressions and languages pdf
Regular expressions and languages pdfRegular expressions and languages pdf
Regular expressions and languages pdf
 
Backus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsBackus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal Forms
 
Pushdown Automata - Materi 8 - TBO
Pushdown Automata - Materi 8 - TBOPushdown Automata - Materi 8 - TBO
Pushdown Automata - Materi 8 - TBO
 
Bakus naur form
Bakus naur formBakus naur form
Bakus naur form
 
Edited alan turing-presentation
Edited alan turing-presentationEdited alan turing-presentation
Edited alan turing-presentation
 
Automata languages and computation
Automata languages and computationAutomata languages and computation
Automata languages and computation
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
Automata
AutomataAutomata
Automata
 
Partial compute function
Partial compute functionPartial compute function
Partial compute function
 

Similar to PUSH DOWN AUTOMATA VS TURING MACHINE

Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughterQuinn Wilton
 
Phttp://www.cw360ms.com/pmsurveyresults/index.aspda
Phttp://www.cw360ms.com/pmsurveyresults/index.aspdaPhttp://www.cw360ms.com/pmsurveyresults/index.aspda
Phttp://www.cw360ms.com/pmsurveyresults/index.aspdaHafeez Rehman
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLPkartikaVashisht
 
Lec 3 ---- dfa
Lec 3  ---- dfaLec 3  ---- dfa
Lec 3 ---- dfaAbdul Aziz
 
The Dark Side of Programming Languages
The Dark Side of Programming LanguagesThe Dark Side of Programming Languages
The Dark Side of Programming LanguagesJean-Baptiste Mazon
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfSergioUlisesRojasAla
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...venkatapranaykumarGa
 
Lecture 3 RE NFA DFA
Lecture 3   RE NFA DFA Lecture 3   RE NFA DFA
Lecture 3 RE NFA DFA Rebaz Najeeb
 
Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)Yan Cui
 
BOTTOM UP PARSING GROUP 3.pptx
BOTTOM UP PARSING GROUP 3.pptxBOTTOM UP PARSING GROUP 3.pptx
BOTTOM UP PARSING GROUP 3.pptxSnehaTiwari84
 
Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Iffat Anjum
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview QuestionsGradeup
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automataeugenesri
 

Similar to PUSH DOWN AUTOMATA VS TURING MACHINE (20)

Stack data structure
Stack data structureStack data structure
Stack data structure
 
Software to the slaughter
Software to the slaughterSoftware to the slaughter
Software to the slaughter
 
Phttp://www.cw360ms.com/pmsurveyresults/index.aspda
Phttp://www.cw360ms.com/pmsurveyresults/index.aspdaPhttp://www.cw360ms.com/pmsurveyresults/index.aspda
Phttp://www.cw360ms.com/pmsurveyresults/index.aspda
 
Pda
PdaPda
Pda
 
Lex analysis
Lex analysisLex analysis
Lex analysis
 
PARSING.ppt
PARSING.pptPARSING.ppt
PARSING.ppt
 
Syntactic analysis in NLP
Syntactic analysis in NLPSyntactic analysis in NLP
Syntactic analysis in NLP
 
Lecture2 B
Lecture2 BLecture2 B
Lecture2 B
 
Lec 3 ---- dfa
Lec 3  ---- dfaLec 3  ---- dfa
Lec 3 ---- dfa
 
The Dark Side of Programming Languages
The Dark Side of Programming LanguagesThe Dark Side of Programming Languages
The Dark Side of Programming Languages
 
Lecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.pptLecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.ppt
 
Nondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdfNondeterministic Finite Automata AFN.pdf
Nondeterministic Finite Automata AFN.pdf
 
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
4-Regular expression to Deterministic Finite Automata (Direct method)-05-05-2...
 
push down automata
push down automatapush down automata
push down automata
 
Lecture 3 RE NFA DFA
Lecture 3   RE NFA DFA Lecture 3   RE NFA DFA
Lecture 3 RE NFA DFA
 
Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)Fear and loathing with APL (oredev)
Fear and loathing with APL (oredev)
 
BOTTOM UP PARSING GROUP 3.pptx
BOTTOM UP PARSING GROUP 3.pptxBOTTOM UP PARSING GROUP 3.pptx
BOTTOM UP PARSING GROUP 3.pptx
 
Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4Lecture 07 08 syntax analysis-4
Lecture 07 08 syntax analysis-4
 
C Programming Interview Questions
C Programming Interview QuestionsC Programming Interview Questions
C Programming Interview Questions
 
Pushdown automata
Pushdown automataPushdown automata
Pushdown automata
 

Recently uploaded

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANJALI) Dange Chowk Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 

PUSH DOWN AUTOMATA VS TURING MACHINE

  • 1. 1
  • 3. Recall that DFAs accept regular languages(for e.g. an) We want to design more powerful machines similar to DFAs that will accept context-free languages(for e.g. anbn ). Final state a
  • 4.  An illusion : anbn is accepted by:  It doesn’t guarantee equal nos. of a’s and b’s:  It can accept any no. of a’s and any no. of b’s(a’s = b’s OR a’s ≠ b’s ) 4 Initial State Final state a b b
  • 5. To handle a language like {anbn | n  0}, the machine needs to “remember” the number of a’s. To do this, we use a stack. A push-down automaton (PDA) is essentially an NFA with a stack. 5
  • 6. A push-down automaton (PDA) is a six- tuple (K, Σ, Γ, Δ, s, F) where • K is a finite set of states. • Σ is a finite alphabet of tape symbols. • Γ is a finite alphabet of stack symbols. • s  K is the start state. • F  K is the set of final states. • Δ is the transition relation, i.e., Δ is a finite subset of (K  (Σ  {e})  Γ*)  (K  Γ*).
  • 8. Let ((p, a, β), (q, γ))  Δ be a transition. It means that we • Move from state p. • Read a from the tape, • Pop the string β off the stack, • Move to state q, • Push string γ onto the stack. The first three (p, a, β), are “input.” The last two (q, γ) are “output.”
  • 9. A configuration fully describes the current “state” of the PDA. • The current state p. • The remaining input w. • The current stack contents . Thus, a configuration is a triple (p, w, )  (K, *, *).
  • 10. ∆(q0, a, $)= (q1, a$) ∆(q0, b, $)= (q1, b$) PUSH starting symbol onto stack (a/b) and change state 10 Input: a a b b c b b a a $
  • 11. ∆(q1, a, a)= (q1, aa) ∆(q1, b, b)= (q1, bb) ∆(q1, a, b)= (q1, ab) ∆(q1, b, a)= (q1, ba) PUSH moves continue till occurrence of ‘c’ 11 Input: a a b b c b b a a$
  • 12. ∆(q1, c, b)= (q2, b) ∆(q1, c, a)= (q2, a) No movement in stack but state changed 12 Input: a a b b c b b a a $
  • 13. ∆(q2, b, b)= (q2, €) ∆(q2, a, a )= (q2, €) POP moves start as c is passed 13 Input: a a b b b b a a $
  • 14. ∆(q2, a, a)= (q2, €) ∆(q2, b, b)= (q2, €) POP moves continue until a mismatch 14 Input: a a a a $
  • 15. ∆(q2, €, $)= (qf, $) Final state comes into picture as input exhausts and stack becomes empty! Hence our string is accepted as valid 15 Input: € $
  • 16.  ∆(q0, a, $)= (q1, a$)  ∆(q0, b, $)= (q1, b$)  ∆(q1, a, a)= (q1, aa)  ∆(q1, b, b)= (q1, bb)  ∆(q1, a, b)= (q1, ab)  ∆(q1, b, a)= (q1, ba)  ∆(q1, a, c)= (q2, a)  ∆(q1, b, c)= (q2, b)  ∆(q2, a, a)= (q2, €)  ∆(q2, b, b)=(q2, €)  ∆(q2, €, $)= (qf, $) 16 Initial (PUSH) move PUSH Move No Stack Operation POP Move Acceptance
  • 17. All a’s are pushed into stack On finding b on input, popping off a’s may be achieved At last if all input is exhausted and stack becomes empty result achieved. 17
  • 18. Stack uses LIFO, works best for strings like:  ambncndm | m  0, n  0,  ambmcndn | m  0, n  0,  ambncpdq | m + n = p + q and  ambnck | m = n or n = k 18
  • 19. But has a disadvantage, cannot work for followings:  anb2ncn | m  0, n  0,  ambm+ncn | m  0, n  0 and  anbncn | n  0 (Turing machines are efficient for this type of language) 19
  • 20. A: Use a three phase process: 1. Push mode: Before reading “#”, push everything on the stack. 2. Reading “#” switches modes. 3. Pop mode: Read remaining symbols making sure that each new read symbol is identical to symbol popped from stack. Accept if able to empty stack completely. Otherwise reject, and reject if could not pop somewhere. 20
  • 21. 21 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack?
  • 22. 22 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? Input: aaab#baa
  • 23. 23 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a Input: aaab#baa
  • 24. 24 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a Input: aaab#baa
  • 25. 25 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a a Input: aaab#baa
  • 26. 26 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? b a a a Input: aaab#baa
  • 27. 27 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? b a a a Input: aaab#baa
  • 28. 28 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a a Input: aaab#baa
  • 29. 29 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a Input: aaab#baa
  • 30. 30 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a Input: aaab#baa REJECT (nonempty stack)
  • 31. 31 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a Input: aaab#baaa
  • 32. 32 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a Input: aaab#baaa
  • 33. 33 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? Input: aaab#baaa Pause input
  • 34. 34 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? Input: aaab#baaa ACCEPT
  • 35. 35 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a a Input: aaab#baaaa
  • 36. 36 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? a Input: aaab#baaaa
  • 37. 37 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? Input: aaab#baaaa Pause input
  • 38. 38 (1) PUSH (3) POP read a or b ? Push it ACCEPT (2) read # ? (ignore stack) read == peek ? Pop Else: CRASH! empty stack? Input: aaab#baaaa CRASH
  • 39. 39 e , e$ a , ea b , eb #, ee e , $e a , ae b , be Input: aaab#baaa ACCEPT!
  • 40.
  • 41. •Automata accepts regular languages only For example, {anbn : n = 0, 1, …} is not regular •Pushdown Automata accepts context-free languages only For example, {anbncn : w  *} is not context-free
  • 42. Turing decomposed operations in the device as follows: •Computational steps erase a symbol observed by the pencil and write a new one in its place •The decision about which symbol should be written and which will be observed next depend on: •A pencil will be “observing” symbols from a paper 1. The current symbol being observed 2. The “state of mind” of the device This device is called a Turing Machine •The pencil can move left and right
  • 43. •TMs can simulate any data structure •TMs can simulate major components of imperative languages: sequence, branching and loop •TMs can control branching and loops
  • 44. …a1 a2 Control Tape cell head The head: •Reads the symbol from the cell it is pointing to, and •Either: •Writes a new symbol in the cell, or •Moves one cell to the left or
  • 45. •New cells can be added to the right of the tape as needed (similar to RAM memory) •These new cells contain the blank symbol, # •The tape is bounded to the left
  • 46. • denotes the alphabet of characters in language as usual. • denotes the set of symbols that can be written on tape •It contains # and all symbols in  • Transitions can be described by (Case I): ((s,a),(bRq)) If the machine is in state s and the current cell has an a then jump to state q and write b in the current cell and moves head to right
  • 47. • Transitions can be described by (Case II): ((s,a),(bLq)) If the machine is in state s and the current cell has an a then jump to state q and write b in the current cell and moves head to left
  • 48. Definition. A Turing machine is a 7-tuple (Q, , , , q0, qaccept, q where: •Q is a set of states • is a set of symbols (the alphabet) • is a set of symbols that can be written in tape, #   and    •q0  Q is the initial state • qaccept is the accepting state • qreject is the rejecting state, qreject  qaccept
  • 49. •  is a collection of transitions defined by the function: : (Q  {qaccept, qreject })    Q    {L , R}
  • 50.  Lets take a case of a3b3c3  Moves are :  aaabbbccc  #aabbbccc  #aa#bbccc  #aa#bb#cc  ##a#bb#cc  ##a##b#cc  ##a##b##c  #####b##c  ########c  ######### 50
  • 51. a b c # q1 #Rq2 q2 q3 q4 q5 q6 q7 51q7
  • 52. a b c # q1 #Rq2 q2 aRq2 q3 q4 q5 q6 q7 52q7
  • 53. a b c # q1 #Rq2 q2 aRq2 q3 q4 q5 q6 q7 53q7
  • 54. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 q4 q5 q6 q7 54q7
  • 55. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 q4 q5 q6 q7 55q7
  • 56. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 q4 q5 q6 q7 56q7
  • 57. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 #Rq4 q4 q5 q6 q7 57q7
  • 58. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 #Rq4 q4 cLq5 q5 q6 q7 58q7
  • 59. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 #Rq4 q4 cLq5 q5 #Lq5 q6 q7 59q7
  • 60. a b c # q1 #Rq2 q2 aRq2 #Rq3 q3 bRq3 #Rq4 q4 cLq5 q5 bLq5 #Lq5 q6 q7 60q7
  • 61. a b c # q1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q6 #Rq1 q7 81q7
  • 82. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 82q7
  • 83. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 83q7
  • 84. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 84q7
  • 85. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 85q7
  • 86. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 86q7
  • 87. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 87q7
  • 88. a b c # q1 #Rq2 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 #Lq7 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 88q7
  • 89. a b c # q1 #Rq2 #Rq1 q2 aRq2 #Rq3 #Rq2 q3 bRq3 #Rq4 #Rq3 q4 cLq5 #Lq7 q5 aLq6 bLq5 #Lq5 q6 aLq6 #Rq1 q7 89q7
  • 93. 93 Device Separate Input? Read/Write Data Structure Deterministic by default? FA Yes None Yes PDA Yes LIFO Stack No TM No 1-way infinite tape. 1 cell access per step. Yes (but will also allow crashes)
  • 95. 95 Device Type of Grammar String/ Language Finite Automata Regular (Type 3) an Push Down Automata Context Free (Type 2) anbn
  • 96. 96 Device Type of Grammar String/ Language Finite Automata Regular (Type 3) an Push Down Automata Context Free (Type 2) anbn Linear Bounded Automata Context Sensitive (Type 1) N.A.
  • 97. 97 Device Type of Grammar String/ Language Finite Automata Regular (Type 3) an Push Down Automata Context Free (Type 2) anbn Linear Bounded Automata Context Sensitive (Type 1) N.A. Turing Machine Unrestricted (Type 0) anbncn
  • 98. 98
  • 99. 99