Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Loading in …5
×

# Theory of computation Lec7 pda

1,412 views

Published on

Theory of computation PDA

Published in: Education
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• axchi hai slides.....

Are you sure you want to  Yes  No
Your message goes here

### Theory of computation Lec7 pda

1. 1. Dr. Hussien Sharaf Computer Science Department dr.sharaf@from-masr.com
2. 2. p.434: Regular Languages and non- regular languages Dr. Hussien M. Sharaf 2 Language Defined by Corresponding Accepting Machine Nondeter- minism= Determinism Language Closed Under What Can Be Decided? Examples of Applications Regular expression Finite automaton, transition graph Yes Union,productKl eene star, intersection, complement Equivalence, emptiness, finiteness, membership Text editors, sequential circuits, verification Context- free grammar Pushdown automaton No Union, product, Kleene star Emptiness, finiteness, membership Parsing, compilers Type 0 grammar Turing machine, Post machine, Pushdown automaton Yes Union, product, Kleene star Not much Computers
3. 3. PDA  A Pushdown Automata (PDA ) is a DFA equipped with a single stack. Dr. Hussien M. Sharaf 3 1 4 3 2 1 2 3 4 Input Tape Tape cells
4. 4. PDA Dr. Hussien M. Sharaf 4 1. Q : A finite set of states (Q). 2. Σ : A set of input alphabet. 3. Γ (capital Gammma): A set of stack alphabet. 4. (delta): A transition function represents the set of transitions that moves PDA to the next states. : Q x Σ x Γ →Q. 5. q0 Q : start state. 6. F ⊆ Q is the set of final states. ε Γ and Σ : start symbol for the stack and end symbol for the Input Tape.   
5. 5.  FA = “a 5-tuple “ (Q, Σ, , q0, F) 1. Q: {q0, q1, q2, …} is set of states. 2. Σ: {a, b, …} set of alphabet. 3. (delta): represents the set of transitions that FA can take between its states. : Q x Σ→Q 4. q0 Q is the start state. 5. F Q is the set of final/accepting states. Dr. Hussien M. Sharaf Remember and compare FA   5
6. 6. PDA as a deterministic machine Its inputs are 1. The current state (of its “NFA”), 2. The current input symbol (or Λ), and 3. The current symbol on top of its stack. Dr. Hussien M. Sharaf 6 1 4 3 2 Its actions are: 1. Change state. 2. Change stack if needed.
7. 7. Power of PDA Dr. Hussien M. Sharaf 7
8. 8. Ex1 P.295 cohen Edition 2:  Consider the following PDA for anbn Dr. Hussien M. Sharaf 8
9. 9. Ex1 P.295:  Consider the following Input Dr. Hussien M. Sharaf 9 Δ a a Input Tape a b b b Δ Start ReadPush Δa b
10. 10. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 10 a a a Input Tape a b b b Δ Start ReadPush Δa b Δ
11. 11. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 11 a a a Input Tape a b b b Δ Start ReadPush Δa b Δ a a
12. 12. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 12 a a a Input Tape a b b b Δ POP ab, Δ a Δ a Read Δ b b Reject Reject
13. 13. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 13 a a a Input Tape a b b b Δ POP ab, Δ a Δ Read Δ b b Reject Reject
14. 14. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 14 a a Input Tape a b b b Δ POP ab, Δ a Δ Read Δ b b Reject Reject
15. 15. Ex1 P.295:  Consider the following PDA Dr. Hussien M. Sharaf 15 a a Input Tape a b b b Δ Read Δ Pop a,b Accept Δ Reject
16. 16. Ex2: Even Palindrome P.304  Can you list samples of words in even palindrome? Dr. Hussien M. Sharaf 16 PUSH a READ2READ1 POP3 POP2 POP1 START ACCEPT PUSH b a b a a a b b b Δ Δ Δ
17. 17. Ex2: Even Palindrome Dr. Hussien M. Sharaf 17  Consider babbab
18. 18. Ex2: Even Palindrome Dr. Hussien M. Sharaf 18  Jump to the right part
19. 19. Ex2: Even Palindrome Dr. Hussien M. Sharaf 19  We have just read first many blanks on the TAPE
20. 20. Assignment #5  Read Example P.308 in Cohen’s book and hand in a stack table for input 4 * 4 + 4.  The assignment must be hand written. Dr. Hussien M. Sharaf 20
21. 21. PDA for Balanced strings State diagram for L = {0n 1n | n >= 0} Dr. Hussien M. Sharaf 21 0,ε 0 q4 q1 (delta) is shown in the state diagram "ε“ or “Λ” means ignore or don’t care for both input and stack. \$ means end for both input or stack q3 q2 0,0 0 1,0 pop 1,0 pop\$ , \$ no Action \$ , \$ no Action
22. 22. Thank you Dr. Hussien M. Sharaf 22