Automata and Formal Languages. Push Down Automata. Sipser pages 109-114. Lecture 13. Tim Sheard 1



Similar documents
Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Regular Languages and Finite State Machines

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Reading 13 : Finite State Automata and Regular Expressions

CS 3719 (Theory of Computation and Algorithms) Lecture 4

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Automata and Computability. Solutions to Exercises

On Winning Conditions of High Borel Complexity in Pushdown Games


3515ICT Theory of Computation Turing Machines

Computability Theory

Pushdown Automata. International PhD School in Formal Languages and Applications Rovira i Virgili University Tarragona, Spain

6.2 Permutations continued

Automata on Infinite Words and Trees

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

Finite Automata. Reading: Chapter 2

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Introduction to Automata Theory. Reading: Chapter 1

Automata and Formal Languages

Introduction to Turing Machines

Notes on Complexity Theory Last updated: August, Lecture 1

Compiler Construction

Turing Machines: An Introduction

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Model 2.4 Faculty member + student

Computational Models Lecture 8, Spring 2009

T Reactive Systems: Introduction and Finite State Automata

Math 319 Problem Set #3 Solution 21 February 2002

Deterministic Finite Automata

The Ergodic Theorem and randomness

Informatique Fondamentale IMA S8

C H A P T E R Regular Expressions regular expression

Lecture 2: Universality

CS5236 Advanced Automata Theory

24 Uses of Turing Machines

Lecture I FINITE AUTOMATA

The Halting Problem is Undecidable

The Optimum One-Pass Strategy for Juliet

Finite Automata. Reading: Chapter 2

Syntaktická analýza. Ján Šturc. Zima 208

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

GENTLY KILLING S SPACES TODD EISWORTH, PETER NYIKOS, AND SAHARON SHELAH

Regular Languages and Finite Automata

Mathematical Induction. Lecture 10-11

Push-down Automata and Context-free Grammars

A Uniform Asymptotic Estimate for Discounted Aggregate Claims with Subexponential Tails

This asserts two sets are equal iff they have the same elements, that is, a set is determined by its elements.

minimal polyonomial Example

Bottom-Up Syntax Analysis LR - metódy

Triangle deletion. Ernie Croot. February 3, 2010

Modeling of Graph and Automaton in Database

University of Maryland Fraternity & Sorority Life Spring 2015 Academic Report

Introduction to Finite Automata

CHAPTER 7 GENERAL PROOF SYSTEMS

Techniques algébriques en calcul quantique

Genetic programming with regular expressions

1. Prove that the empty set is a subset of every set.

Reducing Clocks in Timed Automata while Preserving Bisimulation

Finite Automata and Regular Languages

How To Compare A Markov Algorithm To A Turing Machine

ASSIGNMENT ONE SOLUTIONS MATH 4805 / COMP 4805 / MATH 5605

CHAPTER 6. Shannon entropy

Intrusion Detection via Static Analysis

A characterization of trace zero symmetric nonnegative 5x5 matrices

Stochastic Models for Inventory Management at Service Facilities

CONTINUED FRACTIONS AND PELL S EQUATION. Contents 1. Continued Fractions 1 2. Solution to Pell s Equation 9 References 12

Simulation-Based Security with Inexhaustible Interactive Turing Machines

ER E P M A S S I CONSTRUCTING A BINARY TREE EFFICIENTLYFROM ITS TRAVERSALS DEPARTMENT OF COMPUTER SCIENCE UNIVERSITY OF TAMPERE REPORT A

n k=1 k=0 1/k! = e. Example 6.4. The series 1/k 2 converges in R. Indeed, if s n = n then k=1 1/k, then s 2n s n = 1 n

GENERATING THE FIBONACCI CHAIN IN O(log n) SPACE AND O(n) TIME J. Patera

Scanner. tokens scanner parser IR. source code. errors

FACTORING AFTER DEDEKIND

Overview of E0222: Automata and Computability

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Web Data Extraction: 1 o Semestre 2007/2008

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Regular Expressions with Nested Levels of Back Referencing Form a Hierarchy

On the Unique Games Conjecture

t := maxγ ν subject to ν {0,1,2,...} and f(x c +γ ν d) f(x c )+cγ ν f (x c ;d).

THEORY of COMPUTATION


Solutions to In-Class Problems Week 4, Mon.

A Propositional Dynamic Logic for CCS Programs

Moreover, under the risk neutral measure, it must be the case that (5) r t = µ t.

1 Approximating Set Cover

6.080/6.089 GITCS Feb 12, Lecture 3

Monitoring Metric First-order Temporal Properties

THE NUMBER OF GRAPHS AND A RANDOM GRAPH WITH A GIVEN DEGREE SEQUENCE. Alexander Barvinok

Theory of Computation Class Notes 1

Transcription:

Automata and Formal Languages Push Down Automata Sipser pages 109-114 Lecture 13 Tim Sheard 1

Push Down Automata Push Down Automata (PDAs) are ε-nfas with stack memory. Transitions are labeled by an input symbol together with a pair of the form X/α. The transition is possible only if the top of the stack contains the symbol X After the transition, the stack is changed by replacing the top symbol X with the string of symbols α. (Pop X, then push symbols of α.)

Example PDAs can accept languages that are not regular. The following one accepts: L={0 i 1 j 0 i j} 0, X/XX 1, X/ε 1, Z 0 /Z 0 s 0, Z 0 /XZ 0 1, X/ε ε, Z p 0 /Z 0 q ε, Z 0 /Z 0

Definition A PDA is a 6-tuple P=(Q,Σ,Γ,δ,q 0,F) where Q, Σ, q 0, F are as in NFAs, and Γ is the stack alphabet. It is assumed that initially the stack is empty. δ: Q Σ ε Γ ε P(Q Γ ε * ) is the transition function: given a state, an input symbol (or ε), and a stack symbol, Γ ε, it gives us a finite number of pairs (q,α), where q is the next state and α is the string of stack symbols that will replace X on top of the stack. Recall Σ ε =(Σ {ε}) Γ ε =(Γ {ε})

In our example, the transition from s to s labeled (0,Z 0 /XZ 0 ) corresponds to the fact (s,xz 0 ) δ(s,0,z 0 ). A complete description of the transition function in this example is given by δ(s,0,z 0 ) = {(s,xz 0 )} δ(s,0,x) = {(s,xx)} δ(s,ε,z 0 ) = {(q,z 0 )} δ(s,1,x) = {(p,ε)} δ(p,1,x) = {(p,ε)} δ(p,ε,z 0 ) = {(q,z 0 )} δ(q,1,z 0 ) = {(q,z 0 )} and δ(q,a,y)= 0, X/XX 0, Z 0 /XZ 0 for all other possibilities. s 1, X/ε 1, X/ε ε, Z 0 /Z 0 p ε, Z 0 /Z 0 1, Z 0 /Z 0 q

Sipser style acceptance Suppose a string w can be written: w 1 w 2 w m W i Σ ε Some of the w i are allowed to be ε I.e. One may write abc as a ε b c ε If there exist two sequences s 0 r 1 r m Q s 0 s 1 s m Γ (The s i represent the stack contents at step i) 1. r 0 =q 0 and s 0 = ε 2. (r i +1,b) δ(r i,w i +1,a) s i = at s i+1 = bt 3. R m F

Instantaneous Descriptions and Moves of PDAs IDs (also called configurations) describe the execution of a PDA at each instant. An ID is a triple (q,w,α), with this intended meaning: q is the current state w is the remaining part of the input α is the current content of the stack, with top of the stack on the left.

The relation - describes possible moves from one ID to another during execution of a PDA. If δ(q,a,x) contains (p,α), then (q,aw,xβ) - (p,w,αβ) is true for every w and β. The relation - * is the reflexive-transitive closure of - We have (q,w,a) - * (q',w',a') when (q,w,a) leads through a sequence (possibly empty) of moves to (q',w',a')

Automata and Formal Languages 0, X/XX 0, Z 0 /XZ 0 1, X/ε 1, Z 0 /Z 0 s 1, X/ε Λ, Z 0 /Z 0 p q Λ, Z 0 /Z 0 (s,011,z) - (s,11,xz) - (P,1,z) -(q,1,z) - (q,,z) (s,011,z) - (q,011,z) Lecture 13 Tim Sheard 9

Property 1. If Then Properties of - (q,x,α) -* (p,y,β) (q,xw,αγ) -* (p,yw,βγ) If you only need some prefix of the input (x) and stack (α) to make a series of transitions, you can make the same transitions for any longer input and stack. Property 2. If Then (q,xw,α) -* (p,yw,β) (q,x,α) -* (p,y,β) It is ok to remove unused input, since a PDA cannot add input back on once consumed.

Another notion of acceptance A PDA as above accepts the string w iff (q 0,w,ε) - * (p,ε,α) is true for some final state p and some α. (We don't care what's on the stack at the end of input.) The language L(P) of the PDA P is the set of all strings accepted by P.

Here is the chain of IDs showing that the string 001111 is accepted by our example PDA: (s,001111,ε) - (s,01111,xz 0 ) - (s, 1111,XXZ 0 ) - (p,111,xz 0 ) - (p,11,z 0 ) - (q,11,z 0 ) - (q,1,z 0 ) - (q,ε,z 0 ) 0, X/XX 0, ε/xz 0 s 1, X/ε 1, X/ε Λ, Z 0 /Z 0 p Λ, Z 0 /Z 0 1, Z 0 /Z 0 q

The language of the following PDA is {0 i 1 j 0 < i j} *. How can we prove this? s 0, X/XX 0, Z 0 /XZ 0 1, X/ε p 1, X,ε 1, Z 0 /Z 0 q Λ, Z 0 /Z 0

Example A PDA for the language of balanced parentheses: (, Z 0 /XZ 0 (, X/XX p Λ, Z 0 /Z 0 q ), X/ε

Acceptance by Empty Stack Define N(P) to be the set of all strings w such that (q 0,w,ε) - * (q,ε,ε) for some state q. These are the strings P accepts by empty stack. Note that the set of final states plays no role in this definition. Theorem. A language is L(P 1 ) for some PDA P 1 if and only if it is N(P 2 ) for some PDA P 2.

Proof 1 1. From empty stack to final state. Given P 2 that accepts by empty stack, get P 1 by adding a new start state and a new final state as in the picture below. We also add a new stack symbol X 0 and make it the start symbol for P 1 's stack. P 2 p 0 ε, X 0 /Z 0 X 0 q 0 ε, X 0 /ε (add this transition from all states of P2 to new state P f ) P f

Proof 2 2. From final state to empty stack. Given P 1, we get P 2 again by adding a new start state, final state and start stack symbol. New transitions are seen in the picture. P 2 p 0 ε, X 0 /Z 0 X 0 q 0 ε, Γ/ε ε, Γ/ε P ε, Γ/ε