Deterministic PDA s. Deepak D Souza. 08 Nov Department of Computer Science and Automation Indian Institute of Science, Bangalore.

Similar documents
Deterministic PDA s. Deepak D Souza. 21 October Department of Computer Science and Automation Indian Institute of Science, Bangalore.

Introduction to Turing Machines

Theory of Computation (Classroom Practice Booklet Solutions)

CS481F01 Solutions 6 PDAS

Theory of Computation (IV) Yijia Chen Fudan University

Pushdown Automata. Chapter 12

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

MA/CSSE 474 Theory of Computation

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

CSE 105 THEORY OF COMPUTATION

Pushdown Automata (2015/11/23)

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

Computational Models - Lecture 5 1

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

CSE 105 THEORY OF COMPUTATION

Comment: The induction is always on some parameter, and the basis case is always an integer or set of integers.

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

Foundations of Informatics: a Bridging Course

Properties of Context Free Languages

CS481F01 Prelim 2 Solutions

CS500 Homework #2 Solutions

CS375: Logic and Theory of Computing

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Chapter 7 Turing Machines

Turing Machines Part III

Automata and Computability. Solutions to Exercises

Fundamentele Informatica II

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

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

Homework 5 - Solution

Automata and Computability. Solutions to Exercises

CSE 105 THEORY OF COMPUTATION

On Model Checking for Visibly Pushdown Automata

Final exam study sheet for CS3719 Turing machines and decidability.

Introduction to Formal Languages, Automata and Computability p.1/42

Further discussion of Turing machines

Question Bank UNIT I

UNIT-VI PUSHDOWN AUTOMATA

Context Free Languages: Decidability of a CFL

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

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

On Stateless Restarting Automata

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Visibly Linear Dynamic Logic

Context-Free Languages (Pre Lecture)

Computational Models: Class 5

Equivalent Variations of Turing Machines

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Decidability (intro.)

Theory of Computation

Pushdown Automata (Pre Lecture)

Ogden s Lemma for CFLs

Theory of Computation

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

The Post Correspondence Problem

Languages, regular languages, finite automata

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

CSE 105 THEORY OF COMPUTATION

Lecture 3: Nondeterministic Finite Automata

Section: Pushdown Automata

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

Languages. A language is a set of strings. String: A sequence of letters. Examples: cat, dog, house, Defined over an alphabet:

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

MA/CSSE 474 Theory of Computation

Finite Automata and Regular languages

This lecture covers Chapter 7 of HMU: Properties of CFLs

Lecture 23 : Nondeterministic Finite Automata DRAFT Connection between Regular Expressions and Finite Automata

Automata-based Verification - III

Decidability (What, stuff is unsolvable?)

Regular Expressions Kleene s Theorem Equation-based alternate construction. Regular Expressions. Deepak D Souza

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

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

Computational Models - Lecture 4

CS 455/555: Finite automata

Computability Theory

Pushdown Automata: Introduction (2)

input tape head moves current state a a

Properties of Context-Free Languages. Closure Properties Decision Properties

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

Automata and Languages

Decidability and Undecidability

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

Extending Supervisory Controller Synthesis to Deterministic Pushdown Automata Enforcing Controllability Least Restrictively

ECS 120: Theory of Computation UC Davis Phillip Rogaway February 16, Midterm Exam

Alternating nonzero automata

CSE 105 Theory of Computation

Lecture Notes On THEORY OF COMPUTATION MODULE -1 UNIT - 2

CS Pushdown Automata

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Sri vidya college of engineering and technology

Fundamentele Informatica 3 Antwoorden op geselecteerde opgaven uit Hoofdstuk 7 en Hoofdstuk 8

FLAC Context-Sensitive Grammars

Context Sensitive Grammar

Variable Automata over Infinite Alphabets

Formal Languages, Automata and Models of Computation

Computability and Complexity

Transcription:

Deterministic PDA s Deepak D Souza Department of Computer Science and Automation Indian Institute of Science, Bangalore. 08 Nov 2016

Outline 1 Deterministic PDA s 2 Closure properties of DCFL s 3 Complementing DPDA s

Deterministic PDA s b a b a a b a a a b p X Y X X A PDA with restrictions that: At most one move possible in any configuration. For any state p, a A, and X Γ: at most one move of the form (p, a, X) (q, γ) or (p, ɛ, X) (q, γ). Effectively, a DPDA must see the current state, and top of stack, and decide whether to make an ɛ-move or read input and move. Accepts by final state. We need a right-end marker for the input.

Example DPDA Example DPDA for {a n b n n 0} (s, a, ) (p, A ) (p, a, A) (p, AA) (p, b, A) (q, ɛ) (q, b, A) (q, ɛ) (q,, ) (t, ) (s,, ) (t, ). State Diagram of DPDA / /ɛ s a/ /A p b/a/ɛ q / / a/a/aa b/a/ɛ t

Example DPDA Example DPDA for {a n b n n 0} (s, a, ) (p, A ) (p, a, A) (p, AA) (p, b, A) (q, ɛ) (q, b, A) (q, ɛ) (q,, ) (t, ) (s,, ) (t, ). State Diagram of DPDA / /ɛ s a/ /A p b/a/ɛ q / / a/a/aa b/a/ɛ t Class of languages accepted by DPDA s are called DCFL s.

Closure Properties of DCFL s All languages over A CFL DCFL Regular anbncn a n n b a n b n c n Closed? Complementation

Closure Properties of DCFL s All languages over A CFL DCFL Regular anbncn a n n b a n b n c n Closed? Complementation Union

Closure Properties of DCFL s All languages over A CFL DCFL Regular anbncn a n n b a n b n c n Closed? Complementation Union Intersection X

Closure Properties of DCFL s All languages over A CFL DCFL Regular anbncn a n n b a n b n c n Closed? Complementation Union Intersection X X

DCFL s are closed under complementation Theorem (Closure under complementation) The class of languages definable by Deterministic Pushdown Automata (i.e. DCFL s) is closed under complementation.

Problem with complementing a DPDA Try flipping final and non-final states. Problems? Loops denote an infinite sequence of ɛ-moves.

Desirable form of DPDA Goal is to convert the DPDA into the form: f r That is, always reads its input and reaches a final/reject sink state. Then we can make r the unique accepting state, to accept the complement of M.

Construction - Step 1 Let M = (Q, A, Γ, s, δ,, F) be given DPDA. First construct DPDA M which Does not get stuck due to no transition or stack empty. Has only sink final states.

Construction - Step 1 Define M = (Q Q {s 1, r, r }, A, Γ { }, s 1, δ,, F ) where Q = {q q Q} and F = {f f F}. δ is obtained from δ as follows: Assume M is complete (does not get stuck due to no transition). (If not, add a dead state and add transitions to it.) Make sure M never empties its stack, keep track of whether we have seen end of input (primed states) or not (unprimed states): (s 1, ɛ, ) (s, ) (p, ɛ, ) (r, ) (p Q) (p, ɛ, ) (r, ) (p F ) (p,, X) (q, γ) if (p,, X) (q, γ) δ. (p, ɛ, X) (q, γ) if (p, ɛ, X) (q, γ) δ. (r, a, X) (r, X) (r,, X) (r, X) (r, ɛ, X) (r, X) (f, ɛ, X) (f, X) (f F) Also drop trans. going from f.

After Step 1 DPDA M only has the following kinds of behaviours now: f r Loops denote an infinite sequence of ɛ-moves.

Construction - Step 2 A spurious transition in M is a transition of the form (p, ɛ, X) (q, γ) such that for some stack contents α. (p, ɛ, X) (p, ɛ, Xα) X p X p Identify spurious transitions in M and remove them: If (p, ɛ, X) (q, γ) is a spurious transition, replace it with (p, ɛ, X) (r, X) If p Q (p, ɛ, X) (r, X) If p Q F.

Correctness Argue that: Deleting a spurious transition (starting from a non-f -final state) does not change the language of M. All infinite loops use a spurious transition. Look at graph of stack height along infinite loop, and argue that there are infinitely many future minimas. Further look at transitions applied at these points and observe that one must repeat. Thus replacing spurious transitions as described earlier will remove the remaining undesirable loops from M s behaviours.

Complementing Resulting M has the desired behaviour (every run either reaches a final sink state or the reject sink state r.). f r Now make r unique final state to complement the language of M.

Detecting spurious transitions Question: How can we effectively detect spurious transitions?

Detecting spurious transitions Question: How can we effectively detect spurious transitions? Use algorithm for pushdown reachablity.