Push-down Automata = FA + Stack

Similar documents
Pushdown Automata (Pre Lecture)

CPS 220 Theory of Computation Pushdown Automata (PDA)

Theory of Computation (IV) Yijia Chen Fudan University

Einführung in die Computerlinguistik

Pushdown Automata (2015/11/23)

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

CS Pushdown Automata

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,

Context-Free Languages

CSE 105 THEORY OF COMPUTATION

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

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.

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

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

Accept or reject. Stack

(pp ) PDAs and CFGs (Sec. 2.2)

Pushdown Automata. Chapter 12

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

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

CSE 105 THEORY OF COMPUTATION

(pp ) PDAs and CFGs (Sec. 2.2)

Pushdown Automata: Introduction (2)

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Intro to Theory of Computation

C6.2 Push-Down Automata

Fundamentele Informatica II

Foundations of Informatics: a Bridging Course

C2.1 Regular Grammars

C2.1 Regular Grammars

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

UNIT-VI PUSHDOWN AUTOMATA

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

Homework. Context Free Languages. Announcements. Before We Start. Languages. Plan for today. Final Exam Dates have been announced.

CS 455/555: Finite automata

Theory of Computation (I) Yijia Chen Fudan University

Theory of Computation Turing Machine and Pushdown Automata

PUSHDOWN AUTOMATA (PDA)

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

CISC4090: Theory of Computation

Inf2A: Converting from NFAs to DFAs and Closure Properties

Classes and conversions

Pushdown Automata (PDA) The structure and the content of the lecture is based on

Equivalence of CFG s and PDA s

COM364 Automata Theory Lecture Note 2 - Nondeterminism

5 Context-Free Languages

Lecture 17: Language Recognition

input tape head moves current state a a

Theory of Computation (VI) Yijia Chen Fudan University

Computational Models - Lecture 5 1

Rumination on the Formal Definition of DPDA

CISC 4090 Theory of Computation

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

CS 154, Lecture 2: Finite Automata, Closure Properties Nondeterminism,

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Finite Automata. Seungjin Choi

DM17. Beregnelighed. Jacob Aae Mikkelsen

CS481F01 Prelim 2 Solutions

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

CPS 220 Theory of Computation

MA/CSSE 474 Theory of Computation

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

MTH401A Theory of Computation. Lecture 17

Introduction to the Theory of Computation. Automata 1VO + 1PS. Lecturer: Dr. Ana Sokolova.

Nondeterministic Finite Automata

Pushdown Automata. Reading: Chapter 6

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

CS311 Computational Structures More about PDAs & Context-Free Languages. Lecture 9. Andrew P. Black Andrew Tolmach

Part I: Definitions and Properties

Everything You Always Wanted to Know About Parsing

Nondeterministic Finite Automata

Computability and Complexity

Computational Models: Class 5

Everything You Always Wanted to Know About Parsing

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

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

CS375: Logic and Theory of Computing

Theory of Computation

Theory of Languages and Automata

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

Section: Pushdown Automata

Automata Theory - Quiz II (Solutions)

Automata and Languages

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

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

Introduction to Theory of Computing

CSE 105 THEORY OF COMPUTATION

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer.

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

Recitation 2 - Non Deterministic Finite Automata (NFA) and Regular OctoberExpressions

Chapter 3. Regular grammars

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},

Undecidable Problems and Reducibility

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

Properties of Context Free Languages

Theory of Computation

Transcription:

Push-down Automata = FA + Stack

PDA Definition A push-down automaton M is a tuple M = (Q,, Γ, δ, q0, F) where Q is a finite set of states is the input alphabet (of terminal symbols, terminals) Γ is the stack alphabet δ: Q x ε x Γ ε P(Q x Γ ε ) is the transition function q0 is the initial state, q0 Q F is a set of final states, F Q

PDA intrinsically nondeterministic Definition A push-down automaton M is a tuple M = (Q,, Γ, δ, q0, F) where Q is a finite set of states is the input alphabet (of terminal symbols, terminals) Γ is the stack alphabet δ: Q x ε x Γ ε P(Q x Γ ε ) is the transition function q0 is the initial state, q0 Q F is a set of final states, F Q

PDA intrinsically nondeterministic Definition A push-down automaton M is a tuple M = (Q,, Γ, δ, q0, F) where Q is a finite set of states is the input alphabet (of terminal symbols, terminals) Γ is the stack alphabet δ: Q x ε x Γ ε P(Q x Γ ε ) is the transition function q0 is the initial state, q0 Q F is a set of final states, F Q (r,c) δ(q,a,b) means that in a state q, reading input symbol a and popping b from the stack, the PDA may change to state r and push c on the stack

PDA Compute via configurations

PDA Compute via configurations Given M = (Q,, Γ, δ, q0, F) a configuration of M is an element in Q x * x Γ * an initial configuration is (q0, w, ε).

PDA Compute via configurations Given M = (Q,, Γ, δ, q0, F) a configuration of M is an element in Q x * x Γ * an initial configuration is (q0, w, ε). (q,w,u) (r,w1, u1) if and only if w = aw1, u = bu2, and u1 = cu2

PDA Compute via configurations Given M = (Q,, Γ, δ, q0, F) a configuration of M is an element in Q x * x Γ * one-step computation an initial configuration is (q0, w, ε). (q,w,u) (r,w1, u1) if and only if w = aw1, u = bu2, and u1 = cu2

PDA Compute via configurations Given M = (Q,, Γ, δ, q0, F) a configuration of M is an element in Q x * x Γ * one-step computation an initial configuration is (q0, w, ε). (q,w,u) (r,w1, u1) if and only if w = aw1, u = bu2, and u1 = cu2 Definition The language recognised / accepted by a push-down automaton M = (Q,, Γ, δ, q0, F) is L(M) = {w * (q0, w, ε) * (f, ε, ε) for some f F}

PDA Compute via configurations Given M = (Q,, Γ, δ, q0, F) a configuration of M is an element in Q x * x Γ * one-step computation an initial configuration is (q0, w, ε). (q,w,u) (r,w1, u1) if and only if w = aw1, u = bu2, and u1 = cu2 Definition zero-or-more-steps computation The language recognised / accepted by a push-down automaton M = (Q,, Γ, δ, q0, F) is L(M) = {w * (q0, w, ε) * (f, ε, ε) for some f F}

PDA vs. CFG Theorem PDA-CFG A language is context-free if and only if it is recognised by a push-down automaton.

PDA vs. CFG Theorem PDA-CFG A language is context-free if and only if it is recognised by a push-down automaton. context-free languages generated by CFG recognized by PDA regular languages recognised by FA generated by regular grammars

DPDA Definitions

DPDA Definitions Two words u, v * are consistent if none is a prefix of the other. Two PDA transitions ((q,a,b),(r,c)) and ((p,d,e),(s,g)) are compatible if a and d, as well as b and e are inconsistent. A PDA M is deterministic if no two different transitions are compatible.

DPDA Definitions (r,c) δ(q,a,b) Two words u, v * are consistent if none is a prefix of the other. Two PDA transitions ((q,a,b),(r,c)) and ((p,d,e),(s,g)) are compatible if a and d, as well as b and e are inconsistent. A PDA M is deterministic if no two different transitions are compatible.

DPDA Definitions (r,c) δ(q,a,b) Two words u, v * are consistent if none is a prefix of the other. Two PDA transitions ((q,a,b),(r,c)) and ((p,d,e),(s,g)) are compatible if a and d, as well as b and e are inconsistent. A PDA M is deterministic if no two different transitions are can compatible. fire the same time

DPDA Definitions (r,c) δ(q,a,b) Two words u, v * are consistent if none is a prefix of the other. Two PDA transitions ((q,a,b),(r,c)) and ((p,d,e),(s,g)) are compatible if a and d, as well as b and e are inconsistent. A PDA M is deterministic if no two different transitions are can compatible. fire the same time Definition A language L is a deterministic context-free language if there exists a DPDA M that recognises L$ = {w$ w L} We say then that M recognises L and write L = L(M).

DPDA Definitions (r,c) δ(q,a,b) Two words u, v * are consistent if none is a prefix of the other. Two PDA transitions ((q,a,b),(r,c)) and ((p,d,e),(s,g)) are compatible if a and d, as well as b and e are inconsistent. A PDA M is deterministic if no two different transitions are can compatible. fire the same time Definition A language L is a deterministic context-free language if there exists a DPDA M that recognises L$ = {w$ w L} We say then that M recognises L and write L = L(M). $ is a fresh symbol, not in