Rumination on the Formal Definition of DPDA

Similar documents
Theory of Computation

Please give details of your answer. A direct answer without explanation is not counted.

Reducability. Sipser, pages

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Turing Machines Part III

CSE 105 THEORY OF COMPUTATION

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

Deterministic Finite Automata. Non deterministic finite automata. Non-Deterministic Finite Automata (NFA) Non-Deterministic Finite Automata (NFA)

Undecidable Problems and Reducibility

Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. The stack

CSE 105 THEORY OF COMPUTATION

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Theory of Computation (Classroom Practice Booklet Solutions)

Theory of Computation Turing Machine and Pushdown Automata

Turing machines and linear bounded automata

UNIT-VIII COMPUTABILITY THEORY

MA/CSSE 474 Theory of Computation

Notes for Comp 497 (Comp 454) Week 12 4/19/05. Today we look at some variations on machines we have already seen. Chapter 21

Turing Machine Variants

Turing machines and linear bounded automata

Turing machines and linear bounded automata

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Part I: Definitions and Properties

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

TAFL 1 (ECS-403) Unit- IV. 4.1 Push Down Automata. 4.2 The Formal Definition of Pushdown Automata. EXAMPLES for PDA. 4.3 The languages of PDA

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Automata Theory - Quiz II (Solutions)

Clarifications from last time. This Lecture. Last Lecture. CMSC 330: Organization of Programming Languages. Finite Automata.

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

Lecture 17: Language Recognition

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

October 6, Equivalence of Pushdown Automata with Context-Free Gramm

Theory of Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Push-down Automata = FA + Stack

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Pushdown Automata (2015/11/23)

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

CSCE 551 Final Exam, Spring 2004 Answer Key

I have read and understand all of the instructions below, and I will obey the University Code on Academic Integrity.

CS21 Decidability and Tractability

Introduction to Languages and Computation

Accept or reject. Stack

Theory of Computation (IX) Yijia Chen Fudan University

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Computability and Complexity

CSE 105 THEORY OF COMPUTATION

CS 21 Decidability and Tractability Winter Solution Set 3

Theory of Computation

Pushdown Automata. Chapter 12

CSE 105 THEORY OF COMPUTATION

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

V Honors Theory of Computation

Introduction to Turing Machines. Reading: Chapters 8 & 9

Theory Bridge Exam Example Questions

Computability Theory. CS215, Lecture 6,

Computability Theory

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Homework 8. a b b a b a b. two-way, read/write

Turing Machines. Fall The Chinese University of Hong Kong. CSCI 3130: Formal languages and automata theory

CSCE 551: Chin-Tser Huang. University of South Carolina

Homework Assignment 6 Answers

Computability and Complexity

UNIT-I. Strings, Alphabets, Language and Operations

Automata Theory CS S-12 Turing Machine Modifications

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

(pp ) PDAs and CFGs (Sec. 2.2)

Final Exam Comments. UVa - cs302: Theory of Computation Spring < Total

CS375: Logic and Theory of Computing

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Theory of Computation. Copyright By NODIA & COMPANY

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Decidability and Undecidability

Chapter 3: The Church-Turing Thesis

Equivalent Variations of Turing Machines

Languages, regular languages, finite automata

The Pumping Lemma. for all n 0, u 1 v n u 2 L (i.e. u 1 u 2 L, u 1 vu 2 L [but we knew that anyway], u 1 vvu 2 L, u 1 vvvu 2 L, etc.

UNRESTRICTED GRAMMARS

NFA and regex. the Boolean algebra of languages. regular expressions. Informatics 1 School of Informatics, University of Edinburgh

Automata Theory (2A) Young Won Lim 5/31/18

Further discussion of Turing machines

Languages. Non deterministic finite automata with ε transitions. First there was the DFA. Finite Automata. Non-Deterministic Finite Automata (NFA)

CPS 220 Theory of Computation Pushdown Automata (PDA)

Pumping Lemma for CFLs

(pp ) PDAs and CFGs (Sec. 2.2)

Decision, Computation and Language

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Context-Free Languages

UNIT-VI PUSHDOWN AUTOMATA

Fundamentele Informatica II

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

CSCE 551: Chin-Tser Huang. University of South Carolina

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Announcements. Problem Set 7 graded; will be returned at end of lecture. Unclaimed problem sets and midterms moved!

Foundations of

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

CSE 311: Foundations of Computing. Lecture 23: Finite State Machine Minimization & NFAs

Transcription:

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. (ε, A/CA) p r (a, A/BA) p q 56

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, e, 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. 57

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/ε ). (Y, X/YX ) (X, Z0 /X Z 0 ) q 1 (ε, X/X ) ( ε, Z 0 /Z 0 ) q 3 q 2 q 0 start (X, X/ε ) 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. 58

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. Figure (a) Figure (b) ( ;, Z 0 /Z 0 ) 59

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. 60