Increasing the power of FSAs

Size: px
Start display at page:

Download "Increasing the power of FSAs"

Transcription

1 PDA 1 Increasing the power of FSAs The mechanical view Input tape Finite state control device Output tape

2 PDA 2 Now let us enrich it : a Input tape stack memory Finite state control device x q Output tape p A B Z 0

3 PDA 3 What is a stack? New symbols are inserted to the top The stack is read from the top A read symbol is extracted from the stack LIFO policy Z 0

4 PDA 4 Example Insert in the following order the symbols a b c Z 0

5 PDA 5 Example Insert in the following order the symbols a b c a Z 0

6 PDA 6 Example Insert in the following order the symbols a b c b a Z 0

7 PDA 7 Example Insert in the following order the symbols a b c c b a Z 0

8 PDA 8 Example Insert in the following order the symbols a b c c b a Read from the stack Z 0

9 PDA 9 Example Insert in the following order the symbols a b c c c b a Read from the stack Z 0

10 PDA 10 Pushdown automata Finite state automata can be enriched with a stack Pushdown Automata (PDA) PDAs differ from finite state machines in two ways: They can use the top of the stack to decide which transivon has to be made They can manipulate the stack as part of performing a transivon

11 PDA 11 Moves of a PDA Depending on the symbol read from the input (but it could also not read anything) the symbol read from the top of the stack the state of the control device the PDA changes its state moves ahead the scanning head changes the symbol read from the stack with a string α (possibly empty)

12 PDA 12 Acceptance The input string x is recognized (accepted) if the PDA scans it completely upon reaching the end of x, it is in an accepvng state Input tape stack memory Finite state control device q p A B Z 0

13 PDA 13 PDA: a first example L={a n b n n>0} a,a/aa b,a ε a,z 0 / BZ 0 q b,a ε 0 q b,b ε 1 q 2 q 3 a,b/ab b,b ε

14 PDA 14 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε a a a b b b Z 0

15 PDA 15 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε a a a b b b B Z 0

16 PDA 16 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε A a a a b b b B Z 0

17 PDA 17 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε A A a a a b b b B Z 0

18 PDA 18 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε A a a a b b b B Z 0

19 PDA 19 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε a a a b b b B Z 0

20 PDA 20 Example (2) a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 a,b/ab b,b ε a a a b b b Z 0

21 PDA 21 Formally A PDA is a tuple <Q, I, Γ, δ, q 0, Z 0, F> Q is a finite set of states I is the input alphabet Γ is the stack alphabet δ is the transivon funcvon q 0 Q is the inival state Z 0 Γ is inival stack symbol F Q is the set of final states

22 PDA 22 TransiVon funcvon δ is the transivon funcvon δ: Q (I {ε}) Γ Q Γ * δ(q, i, A)=<p, α> Graphical notavon: q i,a/α p

23 PDA 23 Remarks Q, I, q 0 and F are defined as in FSAs δ is a parval funcvon Z 0 is the inival symbol of the stack, but it is not essenval It is useful to simplify definivons δ(q, ε, A)=<p, α>? An ε move is a spontaneous move ε does not mean that the input is empty!

24 PDA 24 Example Again L={a n b n n>0} a,a/aa b,a/ε a,z 0 / AZ 0 q 0 q 1 q 2 q 3 b,a/ε ε, Z 0 / Z 0

25 PDA 25 Informally A configuravon is a generalizavon of the novon of state A configuravon shows the current state of the control device, the porvon of the input string that starts from the head the stack It is a snapshot of the PDA

26 PDA 26 Formally A configuravon c is <q, x, γ> q Q is the current state of the control device x I * is the unread porvon of the input string γ Γ * is the string of symbols in the stack Stack convenvon High-lej, low-right The other way around is possible, but it is important to be coherent!

27 PDA 27 Example c=<q 1, abbb, ABZ 0 > a,a/aa b,a ε a,z 0 / BZ 0 q 0 q 1 b,a ε q 2 b,b ε q 3 A B Z 0 a,b/ab a a a b b b b,b ε

28 PDA 28 TransiVons TransiVons between configuravons ( ) depend on the transivon funcvon The transivon funcvon shows how to commute from a PDA snapshot to another There are two cases The transivon funcvon is defined for an input symbol The transivon funcvon is defined for an ε move

29 PDA 29 TransiVons: case 1 δ(q, i, A) = <q,α> is defined c=<q,x,γ> c =<q, x, γ > γ=aβ x=iy then γ = αβ x =y

30 PDA 30 TransiVons: case 2 δ(q, ε, A) = <q,α> is defined c=<q,x,γ> c =<q, x, γ > γ=aβ then γ = αβ x =x

31 PDA 31 Important remark An ε move is a spontaneous move If δ(q,ε,a) and A is the top symbol on the stack, the transivon can always be performed If δ(q,ε,a), then i I δ(q,i,a)= If this property was not savsfied, both the transivons would be allowed Nondeterminism

32 PDA 32 Acceptance condivon Let * be the reflexive transivve closure of the relavon Acceptance condivon: x I * (x L c 0 =<q 0,x,Z 0 > * c F =<q,ε,γ> and q F) Informally, a string is accepted by a PDA if there is a path coherent with x on the PDA that goes from the inival state to the final state The input string has to be read completely

33 PDA 33 Example L = {wcw R w {a,b} + } We need to use a LIFO policy to memorize w PUSH b,a/ba b,b/bb a,a/aa a,b/ab c,b/b c,a/a a,a/ε b,b/ε ε,z0/z0 q0 q1 q2 POP a,z0/az0 b,z0/bz0

34 PDA 34 PDA vs FSA (1) We know that a n b n cannot be recognized by any FSA Pumping Lemma but it can be recognized by a PDA Every regular language can be recognized by a PDA Given an FSA A=<Q,I,δ,q 0,F> it is straighporward to build a PDA A =<Q,I,Γ,δ,q 0,Z 0,F > such that L(A)=L(A )

35 PDA 35 PDA vs FSA (2) PDAs are more expressive than FSAs a n b n Regular languages wcw R Languages recognized by PDAs

36 PDA 36 Loops in PDAs Unlike FSAs, PDAs may not necessarily stop ajer a finite number of moves Loops of ε-moves are possible Example: a,z 0 AZ 0 ε,a ΑΑ Yet, looping PDAs do not add expressive power to the class of PDAs We can get rid of such PDAs Let s see how q

37 Loop-free PDA <q,x,α> * d <q,y,β> means that <q,x,α> * <q,y,β> and, for β=zβ, δ(q,ε,z)= * d is a sequence of moves that needs a symbol to proceed A PDA is loop free if and only if x I * q γ such that <q 0,x,Z 0 > * d <q,ε,γ> it always reads the whole input string and then stops i.e., it is unable to loop indefinitely with ε-moves Every PDA can be transformed into an equivalent loop-free PDA PDA 37

38 PDA 38 Complement The class of languages recognized by PDAs is closed under complement The complement can be built by eliminavng loops adding error states taking care of ε-moves connecvng final and nonfinal states swapping final and non-final states

39 PDA 39 Loop-free PDAs Loop eliminavon is essenval, otherwise the end of the string might never be reached What if there are sequences of ε-moves traversing some final and some non-final states (and the input is envrely read)? We might want to force acceptance only at the end of a (necessarily finite) sequence of ε-moves Otherwise swapping final and non-final states to obtain the complement will not work With these precauvons, we are sure that either the PDA or its complement will accept the string

40 PDA 40 Union The class of languages recognized by PDAs is not closed under union There is no PDA that recognizes {a n b n n 1} {a n b 2n n 1}, but {a n b n n 1} is recognizable by PDA {a n b 2n n 1} is recognizable by PDA IntuiVve sketch of proof If the stack is empved with n b s, then, if there are other b s, n is forgoven If the stack is half empved with the b s, then, if there are no more b s, it is impossible to know whether the stack contains n symbols

41 PDA 41 Other operavons The class of languages recognized by PDAs is not closed under intersecvon A B=(A c B c ) c Since PDA languages are closed under complement, if they were closed under intersecvon, they should be closed under union as well The class of languages recognized by PDAs is not closed under difference A B=A-B c Since PDA languages are closed under complement, if they were closed under difference, they should be closed under intersecvon as well

42 PDA 42 DefiniVon A PD transducer (PDT) is a tuple <Q, I, Γ, δ, q 0, Z 0, F, O, η> Q is a finite set of states F Q is the set of final states O is the output alphabet η: Q (I {ε}) Γ O * δ(q,i,a)=<p,α> η(q,i,a)=w q i,a/α,w p

43 PDA 43 Remarks Q, I, Γ, δ, q 0, Z 0 and F are defined as in acceptor PDAs η is defined only where δ is defined The stack can be necessary for two reasons: The language to be recognized requires it The translavon requires it

44 PDA 44 ConfiguraVon A configuravon c is <q, x, γ, z> q Q is the current state of the control device x I * is the unread porvon of the input string γ Γ * is the string of symbols in the stack z is the string already wriven on the output tape

45 PDA 45 TransiVons c=<q, x, γ, z> c =<q, x, γ, z > Case 1: δ(q, i, A) = <q,α> is defined and η(q, i, A)=w γ=aβ x=iy then γ = αβ x =y z =zw Case 2: δ(q, ε, A) = <q,α> is defined and η(q, ε, A)=w γ=aβ x=y then γ = αβ x =y z =zw

46 PDA 46 Acceptance condivon x I * (x L z= τ(x) c 0 =<q 0,x,Z 0, ε> * c F =<q,ε,γ,z> and q F) NoVce that the translavon of x is defined only if the string x is accepted

47 PDA 47 Example L={wc w {a,b} + } and τ(wc)=w R a,z 0 / AZ 0,ε a,a/ AA,ε a,b/ AB,ε b,z 0 / BZ 0,ε b,b/ BB,ε b,a/ BA,ε ε,a/ ε, a ε,b/ ε, b c,a/ ε, a ε,z 0 / Z 0,ε q 0 c,b/ ε, b q q 2 1

48 PDA 48 PDAs and compilers PDAs are at the heart of compilers Stack memory has a LIFO policy LIFO is suitable to analyze nested syntacvc structures ArithmeVcal expressions Compound instrucvons AcVvaVon records

49 PDA 49 Example PDA to recognize well parenthesized strings (()(()())) OK )())())) NO (,P/ PP ),P/ ε (,Z 0 / PZ 0 ε,z 0 / Z q 0 0 q q 2 1 Homework: try to build a PDA that recognizes the complement of this language

Pushdown Automata. Chapter 12

Pushdown Automata. Chapter 12 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 what it needs is a stack, which gives it an unlimited

More information

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

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Pushdown Automata We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Next we consider a more powerful computation model, called a

More information

FINITE STATE AUTOMATA

FINITE STATE AUTOMATA FINITE STATE AUTOMATA States An FSA has a finite set of states A system has a limited number of configurations Examples {On, Off}, {1,2,3,4,,k} {TV channels} States can be graphically represented as follows:

More information

Part I: Definitions and Properties

Part I: Definitions and Properties Turing Machines Part I: Definitions and Properties Finite State Automata Deterministic Automata (DFSA) M = {Q, Σ, δ, q 0, F} -- Σ = Symbols -- Q = States -- q 0 = Initial State -- F = Accepting States

More information

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

Introduction to Formal Languages, Automata and Computability p.1/42 Introduction to Formal Languages, Automata and Computability Pushdown Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/42 Introduction We have considered

More information

Languages, regular languages, finite automata

Languages, regular languages, finite automata Notes on Computer Theory Last updated: January, 2018 Languages, regular languages, finite automata Content largely taken from Richards [1] and Sipser [2] 1 Languages An alphabet is a finite set of characters,

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY 15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be

More information

Accept or reject. Stack

Accept or reject. Stack Pushdown Automata CS351 Just as a DFA was equivalent to a regular expression, we have a similar analogy for the context-free grammar. A pushdown automata (PDA) is equivalent in power to contextfree grammars.

More information

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

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton

More information

Theory of Computation (IV) Yijia Chen Fudan University

Theory of Computation (IV) Yijia Chen Fudan University Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton

More information

CISC4090: Theory of Computation

CISC4090: Theory of Computation CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter

More information

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

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM) Proposed by Alan Turing in 936 finite-state control + infinitely long tape A stronger

More information

Chapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009

Chapter 1. Formal Definition and View. Lecture Formal Pushdown Automata on the 28th April 2009 Chapter 1 Formal and View Lecture on the 28th April 2009 Formal of PA Faculty of Information Technology Brno University of Technology 1.1 Aim of the Lecture 1 Define pushdown automaton in a formal way

More information

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I

GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I GEETANJALI INSTITUTE OF TECHNICAL STUDIES, UDAIPUR I Internal Examination 2017-18 B.Tech III Year VI Semester Sub: Theory of Computation (6CS3A) Time: 1 Hour 30 min. Max Marks: 40 Note: Attempt all three

More information

Pushdown Automata. Reading: Chapter 6

Pushdown Automata. Reading: Chapter 6 Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?

More information

Computability and Complexity

Computability and Complexity Computability and Complexity Push-Down Automata CAS 705 Ryszard Janicki Department of Computing and Software McMaster University Hamilton, Ontario, Canada janicki@mcmaster.ca Ryszard Janicki Computability

More information

Fundamentele Informatica II

Fundamentele Informatica II Fundamentele Informatica II Answer to selected exercises 5 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 5.1.a (q 0, ab, Z 0 ) (q 1, b,

More information

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

Automata Theory (2A) Young Won Lim 5/31/18 Automata Theory (2A) Copyright (c) 2018 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later

More information

Section: Pushdown Automata

Section: Pushdown Automata Section: Pushdown Automata Ch. 7 - Pushdown Automata ADFA=(Q,Σ,δ,q 0,F) input tape a a b b a b tape head head moves current state 0 1 1 Modify DFA by adding a stack. New machine is called Pushdown Automata

More information

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

Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. Pushdown Automata. The stack A pushdown automata (PDA) is essentially: An NFA with a stack A move of a PDA will depend upon Current state of the machine Current symbol being read in Current symbol popped off the top of the stack With

More information

ECS 120 Lesson 15 Turing Machines, Pt. 1

ECS 120 Lesson 15 Turing Machines, Pt. 1 ECS 120 Lesson 15 Turing Machines, Pt. 1 Oliver Kreylos Wednesday, May 2nd, 2001 Before we can start investigating the really interesting problems in theoretical computer science, we have to introduce

More information

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

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine) CS537 Theory of Computation Lecture : Computability Theory I (Turing Machine) Objectives Introduce the Turing Machine (TM)? Proposed by Alan Turing in 936 finite-state control + infinitely long tape A

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013 Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction

More information

Pushdown Automata (2015/11/23)

Pushdown Automata (2015/11/23) Chapter 6 Pushdown Automata (2015/11/23) Sagrada Familia, Barcelona, Spain Outline 6.0 Introduction 6.1 Definition of PDA 6.2 The Language of a PDA 6.3 Euivalence of PDA s and CFG s 6.4 Deterministic PDA

More information

Nondeterministic Finite Automata

Nondeterministic Finite Automata Nondeterministic Finite Automata Not A DFA Does not have exactly one transition from every state on every symbol: Two transitions from q 0 on a No transition from q 1 (on either a or b) Though not a DFA,

More information

input tape head moves current state a a

input tape head moves current state a a CPS 140 - Mathematical Foundations of CS Dr. S. Rodger Section: Pushdown Automata (Ch. 3.3-3.4) (handout) Pushdown Automata ADFA=(K,,,q 0,F) input tape a a b b a b tape head head moves current state 0

More information

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,

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, 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, v, x, y, z as per the pumping theorem. 3. Prove that

More information

CpSc 421 Final Exam December 15, 2006

CpSc 421 Final Exam December 15, 2006 CpSc 421 Final Exam December 15, 2006 Do problem zero and six of problems 1 through 9. If you write down solutions for more that six problems, clearly indicate those that you want graded. Note that problems

More information

Formal Definition of a Finite Automaton. August 26, 2013

Formal Definition of a Finite Automaton. August 26, 2013 August 26, 2013 Why a formal definition? A formal definition is precise: - It resolves any uncertainties about what is allowed in a finite automaton such as the number of accept states and number of transitions

More information

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

More information

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where Recitation 11 Notes Context Free Grammars Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x A V, and x (V T)*. Examples Problem 1. Given the

More information

Computational Models - Lecture 4

Computational Models - Lecture 4 Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push

More information

Introduction to Theory of Computing

Introduction to Theory of Computing CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages

More information

UNIT-VI PUSHDOWN AUTOMATA

UNIT-VI PUSHDOWN AUTOMATA Syllabus R09 Regulation UNIT-VI PUSHDOWN AUTOMATA The context free languages have a type of automaton that defined them. This automaton, called a pushdown automaton, is an extension of the nondeterministic

More information

Mildly Context-Sensitive Grammar Formalisms: Embedded Push-Down Automata

Mildly Context-Sensitive Grammar Formalisms: Embedded Push-Down Automata Mildly Context-Sensitive Grammar Formalisms: Embedded Push-Down Automata Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Sommersemester 2011 Intuition (1) For a language L, there is a TAG G with

More information

CS 455/555: Finite automata

CS 455/555: Finite automata CS 455/555: Finite automata Stefan D. Bruda Winter 2019 AUTOMATA (FINITE OR NOT) Generally any automaton Has a finite-state control Scans the input one symbol at a time Takes an action based on the currently

More information

Computational Models - Lecture 5 1

Computational Models - Lecture 5 1 Computational Models - Lecture 5 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 10/22, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice

More information

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2016 1 / 22 CFG (1) Example: Grammar G telescope : Productions: S NP VP NP

More information

MTH401A Theory of Computation. Lecture 17

MTH401A Theory of Computation. Lecture 17 MTH401A Theory of Computation Lecture 17 Chomsky Normal Form for CFG s Chomsky Normal Form for CFG s For every context free language, L, the language L {ε} has a grammar in which every production looks

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Fall 28 Alexis Maciel Department of Computer Science Clarkson University Copyright c 28 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

Lecture 17: Language Recognition

Lecture 17: Language Recognition Lecture 17: Language Recognition Finite State Automata Deterministic and Non-Deterministic Finite Automata Regular Expressions Push-Down Automata Turing Machines Modeling Computation When attempting to

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2017 http://cseweb.ucsd.edu/classes/sp17/cse105-ab/ Review of CFG, CFL, ambiguity What is the language generated by the CFG below: G 1 = ({S,T 1,T 2 }, {0,1,2}, { S

More information

Computation Histories

Computation Histories 208 Computation Histories The computation history for a Turing machine on an input is simply the sequence of configurations that the machine goes through as it processes the input. An accepting computation

More information

Theory of Computation (Classroom Practice Booklet Solutions)

Theory of Computation (Classroom Practice Booklet Solutions) Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression

More information

Theory of Computation

Theory of Computation Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L

More information

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

October 6, Equivalence of Pushdown Automata with Context-Free Gramm Equivalence of Pushdown Automata with Context-Free Grammar October 6, 2013 Motivation Motivation CFG and PDA are equivalent in power: a CFG generates a context-free language and a PDA recognizes a context-free

More information

C6.2 Push-Down Automata

C6.2 Push-Down Automata Theory of Computer Science April 5, 2017 C6. Context-free Languages: Push-down Automata Theory of Computer Science C6. Context-free Languages: Push-down Automata Malte Helmert University of Basel April

More information

Lecture 13: Turing Machine

Lecture 13: Turing Machine Lecture 13: Turing Machine Instructor: Ketan Mulmuley Scriber: Yuan Li February 19, 2015 Turing machine is an abstract machine which in principle can simulate any computation in nature. Church-Turing Thesis:

More information

Context-Free Languages

Context-Free Languages CS:4330 Theory of Computation Spring 2018 Context-Free Languages Pushdown Automata Haniel Barbosa Readings for this lecture Chapter 2 of [Sipser 1996], 3rd edition. Section 2.2. Finite automaton 1 / 13

More information

5 Context-Free Languages

5 Context-Free Languages CA320: COMPUTABILITY AND COMPLEXITY 1 5 Context-Free Languages 5.1 Context-Free Grammars Context-Free Grammars Context-free languages are specified with a context-free grammar (CFG). Formally, a CFG G

More information

Equivalence of CFG s and PDA s

Equivalence of CFG s and PDA s Equivalence of CFG s and PDA s Mridul Aanjaneya Stanford University July 24, 2012 Mridul Aanjaneya Automata Theory 1/ 53 Recap: Pushdown Automata A PDA is an automaton equivalent to the CFG in language-defining

More information

DM17. Beregnelighed. Jacob Aae Mikkelsen

DM17. Beregnelighed. Jacob Aae Mikkelsen DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................

More information

Automata and Computability. Solutions to Exercises

Automata and Computability. Solutions to Exercises Automata and Computability Solutions to Exercises Spring 27 Alexis Maciel Department of Computer Science Clarkson University Copyright c 27 Alexis Maciel ii Contents Preface vii Introduction 2 Finite Automata

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: a b c b d e a Not-regular: c n bd

More information

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

Please give details of your answer. A direct answer without explanation is not counted. Please give details of your answer. A direct answer without explanation is not counted. Your answers must be in English. Please carefully read problem statements. During the exam you are not allowed to

More information

Chapter Five: Nondeterministic Finite Automata

Chapter Five: Nondeterministic Finite Automata Chapter Five: Nondeterministic Finite Automata From DFA to NFA A DFA has exactly one transition from every state on every symbol in the alphabet. By relaxing this requirement we get a related but more

More information

CPS 220 Theory of Computation

CPS 220 Theory of Computation CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 14 SMALL REVIEW FOR FINAL SOME Y/N QUESTIONS Q1 Given Σ =, there is L over Σ Yes: = {e} and L = {e} Σ Q2 There are uncountably

More information

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

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1

More information

Undecidable Problems and Reducibility

Undecidable Problems and Reducibility University of Georgia Fall 2014 Reducibility We show a problem decidable/undecidable by reducing it to another problem. One type of reduction: mapping reduction. Definition Let A, B be languages over Σ.

More information

Formal Languages and Automata

Formal Languages and Automata Formal Languages and Automata Lecture 6 2017-18 LFAC (2017-18) Lecture 6 1 / 31 Lecture 6 1 The recognition problem: the Cocke Younger Kasami algorithm 2 Pushdown Automata 3 Pushdown Automata and Context-free

More information

Variants of Turing Machine (intro)

Variants of Turing Machine (intro) CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples, Turing-recognizable and Turing-decidable languages Variants of Turing Machine Multi-tape Turing machines, non-deterministic

More information

COM364 Automata Theory Lecture Note 2 - Nondeterminism

COM364 Automata Theory Lecture Note 2 - Nondeterminism COM364 Automata Theory Lecture Note 2 - Nondeterminism Kurtuluş Küllü March 2018 The FA we saw until now were deterministic FA (DFA) in the sense that for each state and input symbol there was exactly

More information

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

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 3.3, 4.1 State and use the Church-Turing thesis. Give examples of decidable problems.

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman

CSE 211. Pushdown Automata. CSE 211 (Theory of Computation) Atif Hasan Rahman CSE 211 Pushdown Automata CSE 211 (Theory of Computation) Atif Hasan Rahman Lecturer Department of Computer Science and Engineering Bangladesh University of Engineering & Technology Adapted from slides

More information

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 5 CHAPTER 2 FINITE AUTOMATA 1. Deterministic Finite Automata DFA 2. Nondeterministic Finite Automata NDFA 3. Finite Automata

More information

CFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa.

CFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa. CFGs and PDAs are Equivalent We provide algorithms to convert a CFG to a PDA and vice versa. CFGs and PDAs are Equivalent We now prove that a language is generated by some CFG if and only if it is accepted

More information

Introduction to Turing Machines. Reading: Chapters 8 & 9

Introduction to Turing Machines. Reading: Chapters 8 & 9 Introduction to Turing Machines Reading: Chapters 8 & 9 1 Turing Machines (TM) Generalize the class of CFLs: Recursively Enumerable Languages Recursive Languages Context-Free Languages Regular Languages

More information

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

Automata and Formal Languages. Push Down Automata. Sipser pages Lecture 13. Tim Sheard 1 Automata and Formal Languages Push Down Automata Sipser pages 111-117 Lecture 13 Tim Sheard 1 Push Down Automata Push Down Automata (PDAs) are ε-nfas with stack memory. Transitions are labeled by an input

More information

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

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 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 4.3.1 Acceptance by final state 4.3.2 Acceptance by empty stack

More information

Homework Assignment 6 Answers

Homework Assignment 6 Answers Homework Assignment 6 Answers CSCI 2670 Introduction to Theory of Computing, Fall 2016 December 2, 2016 This homework assignment is about Turing machines, decidable languages, Turing recognizable languages,

More information

CS21 Decidability and Tractability

CS21 Decidability and Tractability CS21 Decidability and Tractability Lecture 8 January 24, 2018 Outline Turing Machines and variants multitape TMs nondeterministic TMs Church-Turing Thesis So far several models of computation finite automata

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

SCHEME FOR INTERNAL ASSESSMENT TEST 3

SCHEME FOR INTERNAL ASSESSMENT TEST 3 SCHEME FOR INTERNAL ASSESSMENT TEST 3 Max Marks: 40 Subject& Code: Automata Theory & Computability (15CS54) Sem: V ISE (A & B) Note: Answer any FIVE full questions, choosing one full question from each

More information

Outline 1 PCP. 2 Decision problems about CFGs. M.Mitra (ISI) Post s Correspondence Problem 1 / 10

Outline 1 PCP. 2 Decision problems about CFGs. M.Mitra (ISI) Post s Correspondence Problem 1 / 10 Outline 1 PCP 2 Decision problems about CFGs M.Mitra (ISI) Post s Correspondence Problem 1 / 10 PCP reduction Given: M, w in encoded form To construct: an instance (A, B) of MPCP such that M accepts w

More information

Closure under the Regular Operations

Closure under the Regular Operations September 7, 2013 Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have shown this closure

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Define push down automata Trace the computation of a push down automaton Design

More information

CISC 4090 Theory of Computation

CISC 4090 Theory of Computation CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: Captured by Regular Operations a b

More information

CA320 - Computability & Complexity

CA320 - Computability & Complexity CA320 - Computability & Complexity Dav Sinclair Context-Free Grammars A context-free grammar (CFG) is a 4-tuple G = (N,Σ,S,P) where N is a set of nonterminal symbols, or variables, Σ is a set of terminal

More information

Foundations of Informatics: a Bridging Course

Foundations of Informatics: a Bridging Course Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html

More information

Further discussion of Turing machines

Further discussion of Turing machines Further discussion of Turing machines In this lecture we will discuss various aspects of decidable and Turing-recognizable languages that were not mentioned in previous lectures. In particular, we will

More information

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION CSE 105 THEORY OF COMPUTATION Spring 2016 http://cseweb.ucsd.edu/classes/sp16/cse105-ab/ Today's learning goals Sipser Ch 2 Design a PDA and a CFG for a given language Give informal description for a PDA,

More information

Computational Models: Class 5

Computational Models: Class 5 Computational Models: Class 5 Benny Chor School of Computer Science Tel Aviv University March 27, 2019 Based on slides by Maurice Herlihy, Brown University, and modifications by Iftach Haitner and Yishay

More information

Uses of finite automata

Uses of finite automata Chapter 2 :Finite Automata 2.1 Finite Automata Automata are computational devices to solve language recognition problems. Language recognition problem is to determine whether a word belongs to a language.

More information

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata

CISC 4090: Theory of Computation Chapter 1 Regular Languages. Section 1.1: Finite Automata. What is a computer? Finite automata CISC 4090: Theory of Computation Chapter Regular Languages Xiaolan Zhang, adapted from slides by Prof. Werschulz Section.: Finite Automata Fordham University Department of Computer and Information Sciences

More information

CPS 220 Theory of Computation Pushdown Automata (PDA)

CPS 220 Theory of Computation Pushdown Automata (PDA) CPS 220 Theory of Computation Pushdown Automata (PDA) Nondeterministic Finite Automaton with some extra memory Memory is called the stack, accessed in a very restricted way: in a First-In First-Out fashion

More information

The Idea of a Pushdown Automaton

The Idea of a Pushdown Automaton Pushdown Automata 5DV037 Fundamentals of Computer Science Umeå University Department of Computing Science Stephen J. Hegner hegner@cs.umu.se http://www.cs.umu.se/~hegner The Idea of a Pushdown Automaton

More information

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX

Part 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX

More information

Finite Automata and Regular languages

Finite Automata and Regular languages Finite Automata and Regular languages Huan Long Shanghai Jiao Tong University Acknowledgements Part of the slides comes from a similar course in Fudan University given by Prof. Yijia Chen. http://basics.sjtu.edu.cn/

More information

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages

More information

The Pumping Lemma (cont.) 2IT70 Finite Automata and Process Theory

The Pumping Lemma (cont.) 2IT70 Finite Automata and Process Theory The Pumping Lemma (cont.) 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 4, 2016 The Pumping Lemma theorem if L Σ is a regular language then m > 0 : w L, w m : x,y,z : w

More information

Section 1 (closed-book) Total points 30

Section 1 (closed-book) Total points 30 CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes

More information

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

Introduction to Formal Languages, Automata and Computability p.1/51 Introduction to Formal Languages, Automata and Computability Finite State Automata K. Krithivasan and R. Rama Introduction to Formal Languages, Automata and Computability p.1/51 Introduction As another

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

Equivalent Variations of Turing Machines

Equivalent Variations of Turing Machines Equivalent Variations of Turing Machines Nondeterministic TM = deterministic TM npda = pushdown automata with n stacks 2PDA = npda = TM for all n 2 Turing machines with n tapes (n 2) and n tape heads has

More information

Pumping Lemma for CFLs

Pumping Lemma for CFLs Pumping Lemma for CFLs v y s Here we go again! Intuition: If L is CF, then some CFG G produces strings in L If some string in L is very long, it will have a very tall parse tree If a parse tree is taller

More information

Closure under the Regular Operations

Closure under the Regular Operations Closure under the Regular Operations Application of NFA Now we use the NFA to show that collection of regular languages is closed under regular operations union, concatenation, and star Earlier we have

More information