56 Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, , ,

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

CS 345: Chapter 9 Algorithmic Universality and Its Robustness
4b Lexical analysis Finite Automata
Variants of Turing machines
Pushdown Automata Chapter 12. Recognizing Context-Free Languages We need a device similar to an FSM except that it needs more power. The insight: Precisely.
142 Parsing start (a, Z 0 /aZ 0 ) ( a, a/aa ) (b, a/  ) ( , Z 0 /Z 0 ) For a given CFG G, parsing a string w is to check if w  L(G) and, if it is,
CS21 Decidability and Tractability
1 Introduction to Computability Theory Lecture12: Reductions Prof. Amos Israeli.
Introduction to Computability Theory
CS5371 Theory of Computation
Costas Busch - RPI1 Pushdown Automata PDAs. Costas Busch - RPI2 Pushdown Automaton -- PDA Input String Stack States.
61 Nondeterminism and Nodeterministic Automata. 62 The computational machine models that we learned in the class are deterministic in the sense that the.
Courtesy Costas Busch - RPI1 Pushdown Automata PDAs.
start 0, 4, 8 1, 5, 9 2, 6 3, 7 2 0,4,8 2, 6 3, 7 1, 5, 9 to state 2 to state 3 to state 1 to state 0 to state 1 to state 3 to state 0 to state.
Fall 2004COMP 3351 Pushdown Automata PDAs. Fall 2004COMP 3352 Pushdown Automaton -- PDA Input String Stack States.

CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
CS5371 Theory of Computation Lecture 8: Automata Theory VI (PDA, PDA = CFG)
1 Non-Deterministic Finite Automata. 2 Alphabet = Nondeterministic Finite Automaton (NFA)
Finite State Machines Data Structures and Algorithms for Information Processing 1.
Formal Language Finite set of alphabets Σ: e.g., {0, 1}, {a, b, c}, { ‘{‘, ‘}’ } Language L is a subset of strings on Σ, e.g., {00, 110, 01} a finite language,
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
NFA ε - NFA - DFA equivalence. What is an NFA An NFA is an automaton that its states might have none, one or more outgoing arrows under a specific symbol.
CSE202: Introduction to Formal Languages and Automata Theory Chapter 9 The Turing Machine These class notes are based on material from our textbook, An.
CSCI 2670 Introduction to Theory of Computing September 28, 2005.
Pushdown Automata (PDAs)
4b 4b Lexical analysis Finite Automata. Finite Automata (FA) FA also called Finite State Machine (FSM) –Abstract model of a computing entity. –Decides.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 1. Let A ={r, p, i } and B = { w, o, r, l, d }. What does each of the following (a), (b) and (c) denote? Briefly explain in plain English. (a) A * B.
 2005 SDU Lecture13 Reducibility — A methodology for proving un- decidability.
PZ03A Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03A - Pushdown automata Programming Language Design.
PushDown Automata. What is a stack? A stack is a Last In First Out data structure where I only have access to the last element inserted in the stack.
CSCI 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Pushdown.
1 Section 13.1 Turing Machines A Turing machine (TM) is a simple computer that has an infinite amount of storage in the form of cells on an infinite tape.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
98 Nondeterministic Automata vs Deterministic Automata We learned that NFA is a convenient model for showing the relationships among regular grammars,
1 Recap lecture 28 Examples of Myhill Nerode theorem, Quotient of a language, examples, Pseudo theorem: Quotient of a language is regular, prefixes of.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
Lecture #4 Thinking of designing an abstract machine acts as finite automata. Advanced Computation Theory.
1 Key to Homework #3 (Models of Computation, Spring, 2001) Finite state control with a 4-way read/write head Figure (a)Figure (b) (over)
Lecture 11  2004 SDU Lecture7 Pushdown Automaton.
Lecture #5 Advanced Computation Theory Finite Automata.
Modeling Arithmetic, Computation, and Languages Mathematical Structures for Computer Science Chapter 8 Copyright © 2006 W.H. Freeman & Co.MSCS SlidesTuring.
Lecture # 21.
Theory of Computation Pushdown Automata pda Lecture #10.
Lexical analysis Finite Automata
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
PDA’s - A new format for FAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata PDAs
Pushdown Automata.
Pushdown Automata.
PZ03A - Pushdown automata
Pushdown Automata (PDA). Part 3
Hierarchy of languages
Jaya Krishna, M.Tech, Assistant Professor
Decidable Languages Costas Busch - LSU.
4b Lexical analysis Finite Automata
Midterm (Models of Computation, Fall, 2000)
ReCap Chomsky Normal Form, Theorem regarding CNF, examples of converting CFG to be in CNF, Example of an FA corresponding to Regular CFG, Left most and.
4b Lexical analysis Finite Automata
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Variants of Turing machines
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Pushdown automata Programming Language Design and Implementation (4th Edition) by T. Pratt and M. Zelkowitz Prentice Hall, 2001 Section
Presentation transcript:

56 Rumination on the Formal Definition of DPDA In the definition of DPDA, there are some parts that do not agree with our intuition. Let M = (Q, , , , q 0, Z 0, F ) be a DPDA. According to the definition, M has the following restrictions. (1) For a state p  Q and a stack top symbol A , if  (q, a, A) is defined, then  ( p, , A) must be undefined, and vice versa, i.e., the machine cannot have both  -move and non-  -move in the same state with the same stack top symbol. (2) M is not allowed to read the blank symbol next to the end of input string to check whether the whole input string has been read. Notice that the blank symbol is not an input symbol. (Recall that the same restriction is applied for FA's.) About Restriction (1): Suppose that  (p, a, A) = (q, BA) and  ( p, , A) = (r, CA), for some p, q, r  Q and A,B,C  . Transition  (p, a, A) = (q, BA) (also see the figure at right) denotes the following: (a) in state p reads the stack top, and if it is A, (b) reads the input, and if it is a, (c) enters state q and pushes B on top of the stack. Transition  (p, , A) = (r, CA) denote the following: (a) in state p reads the stack top, and if it is A, (b) does not read the input, and (c) enters state r and pushes C on top of the stack. p q (a, A/BA) p r ( , A/CA)

57 Rumination on the Formal Definition of DPDA (cont’ed) Notice that each PDA transition involves three actions: (a) Reads the stack top. This is always done in every transition. (b) Either read (e.g.,  (p, a, A) is defined) or does not read (e.g.,  ( p, , A) is defined). (c) Enters a state and changes stack top (i.e., pushes, pops or replaces the top stack symbol). If a PDA has both  (p, a, A) and  ( p, , A) defined, then these two transitions imply that the machine, in state p with stack top symbol A, reads and does not read(sounds strange?) the input. This machine operates nondeterministically, i.e., with the same cause (i.e., p and A) it shows two different responses (or actions), i.e., reads and does not read. If a machine is defined such that it takes multiple actions for the same cause, we call it a nondeterministic machine. Note that these multiple actions do not have to be "contradictory", like read and not read, live and die, etc. For example, if an FA has both transitions  (p, a) = r and  (p, a) = s, it is a nondeterministic FA (NFA) since the machine, reading the same symbol a in state p(i.e., with the same cause), enters two different states. If a PDA has transitions  (p, a, A) = (q, BA) and  (p, a, A) = (q, CA), then this PDA operates nondeterministically because for the same cause p, a and A, it takes two different responses; one pushing B and the other pushes C. Nondeterministic machines are conceptual models that cannot be realized. We use them as tools for designing and analyzing real machines. We will study such models as our next topic.

58 Rumination on the Formal Definition of DPDA (cont’ed) q0q0 q1q1 q2q2 q3q3 (X, Z 0 /X Z 0 ) (Y, X/YX ) ( , X/X ) (X, X/  ) ( , Z 0 /Z 0 ) start In general nondeterministic PDA are more powerful than deterministic ones. The following example shows how we can use nondeterministic transitions and make a PDA more powerful. Consider the language L = {xx R | x  {a,b} + }. It has been proved that no deterministic PDA can accept L. (Try to build one.) However, if we allow a PDA to have both  (p, a, A) and  ( p, , A) defined, for some state p, an input symbol a and stack symbol A, we can construct a PDA M that recognizes L as shown below. In the state transition graph, for the notational convenience, we use X, Y  {a, b}. Notice that X and Y are not necessarily distinct. So (Y, X/YX) denotes four cases; (a, b/ab), (b, a/ba), (a, a/aa) or (b, b/bb), and (X, X/  ) denotes two cases; (a, a/  ), or (b, b/  ). About the Restriction (2): Recall that by definition we say that an input string is accepted by a PDA if it satisfies the following two conditions: (a) The machine is in an accepting state. (b) The whole input string has been read (i.e., processed), which implies that the input head read the last symbol of the input string, and moved onto its right neighboring blank cell.

59 Rumination on the Formal Definition of DPDA (cont’ed) Notice that a PDA can be in an accepting state in the middle of the computation. Being only in an accepting state (i.e., condition (a)) doesn't necessarily mean that the input is accepted. We need additional condition (b) above. Also notice that deciding whether the input is accepted or not is supposed to be made by us, not by the machine. The decision is made by examining the status (i.e., (a) and (b) above by definition) of the machine. When we design a PDA, because of condition (b) above, we are tempted to have our PDA check if the input symbol read is a blank before it accepts (or rejects) by (not) entering an accepting state depending on the current state of the machine. In other words, we are tempted to use an end-of-input marker, like we put a semicolon at the end of every statement of C programming language. Consider a simple example; Clearly, the DPDA in Figure (a) below recognizes language {a i | i > 0 } by satisfying the two conditions (a) and (b) above. Notice that whatever the number of a’s in the input, the machine reads the whole input, if it has only a’s. You may feel uncomfortable with condition (b), because you want to know if the machine accepts the input just by watching whether it enters an accepting state or not, like what we do for Turing machines. However, it is impossible for the machine, while reading a’s, to know whether the a just read is the last one or not until it reads special end marker, like the blank or semicolon. So, if we do not like condition (b) above, we need a marker put at the end of every string. The above language should be modified as {a i ; | i > 0 }, if we want to use semicolon as the end-of-string marker. This language can be recognized by the DPDA shown in Figure (b) below. In real world, each string (which corresponds to a program) of the language is provided by the users of the machine. Now, we can raise the following question; “Can we rely on them to put the special marker at the end of every string?” In a sense, we are transferring part of our burden for designing the machine to the user. (a, Z 0 /Z 0 ) Figure (a) (a, Z 0 /Z 0 ) ( ;, Z 0 /Z 0 ) Figure (b)

60 Rumination on the Formal Definition of DPDA (cont’ed) Notice that a PDA can be in an accepting state in the middle of its computation. If we restrict a PDA such that it cannot enter an accepting state in the middle of the computation, then obviously no DPDA can do any meaningful computation without checking the end-of-input marker. For example, it is easy to see that no DPDA can accept the language {a i | i > 0} with this restriction, because it is impossible to identify the last a without reading the blank symbol from its right neighboring cell, which is not allowed. Finally, you may ask; “Why Turing machines and LBA have only one accepting condition?” Recall that Turing machines and LBA accept the input if it enters an accepting state, with no regard to the position of the input head. They are two-way machines and are allowed to read blank cells (for Turing machines) or the boundary marker ( for LBA). By definition they can check the end of string. Thus we can design a TM or an LBA such that the acceptance can be decided by its state only.