Decision Properties of RLs & Automaton Minimization

Similar documents
Automating Construction of Lexers

Introduction to Formal Languages

Finite Automata Part Three

Finite automata. We have looked at using Lex to build a scanner on the basis of regular expressions.

Ambiguous Grammars and Compactification

Regular Languages and Regular Expressions

CSE450. Translation of Programming Languages. Lecture 20: Automata and Regular Expressions

NFAs and Myhill-Nerode. CS154 Chris Pollett Feb. 22, 2006.

CS402 Theory of Automata Solved Subjective From Midterm Papers. MIDTERM SPRING 2012 CS402 Theory of Automata

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

JNTUWORLD. Code No: R

Lexical Analysis - 2

CSE450. Translation of Programming Languages. Automata, Simple Language Design Principles

CS2 Language Processing note 3

Finite Automata Part Three

2010: Compilers REVIEW: REGULAR EXPRESSIONS HOW TO USE REGULAR EXPRESSIONS

Formal Languages and Compilers Lecture IV: Regular Languages and Finite. Finite Automata

Final Course Review. Reading: Chapters 1-9

Converting a DFA to a Regular Expression JP

FAdo: Interactive Tools for Learning Formal Computational Models

1. (10 points) Draw the state diagram of the DFA that recognizes the language over Σ = {0, 1}

6 NFA and Regular Expressions

Introduction to Lexical Analysis

2. Lexical Analysis! Prof. O. Nierstrasz!

Definition: A context-free grammar (CFG) is a 4- tuple. variables = nonterminals, terminals, rules = productions,,

Computer Sciences Department

Lexical Analysis. Implementation: Finite Automata

Languages and Finite Automata

Rational subsets in HNN-extensions

CSE 431S Scanning. Washington University Spring 2013

(Refer Slide Time: 0:19)

[Lexical Analysis] Bikash Balami

Theory of Computation

DHANALAKSHMI SRINIVASAN INSTITUTE OF RESEARCH AND TECHNOLOGY SIRUVACHUR, PERAMBALUR DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Deterministic automata for extended regular expressions

Lexical Analysis. Lecture 3-4

Chapter Seven: Regular Expressions. Formal Language, chapter 7, slide 1

MIT Specifying Languages with Regular Expressions and Context-Free Grammars. Martin Rinard Massachusetts Institute of Technology

MIT Specifying Languages with Regular Expressions and Context-Free Grammars

Chapter Seven: Regular Expressions

CS 432 Fall Mike Lam, Professor. Finite Automata Conversions and Lexing

Implementation of Lexical Analysis

Implementation of Lexical Analysis

CIT3130: Theory of Computation. Regular languages

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

Lexical Analysis. Chapter 2

CSE 105 THEORY OF COMPUTATION

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

Derivations of a CFG. MACM 300 Formal Languages and Automata. Context-free Grammars. Derivations and parse trees

Regular Languages. MACM 300 Formal Languages and Automata. Formal Languages: Recap. Regular Languages

Chapter 3: Lexing and Parsing

Kinder, Gentler Nation

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Computer Science 236 Fall Nov. 11, 2010

CMPSCI 250: Introduction to Computation. Lecture 20: Deterministic and Nondeterministic Finite Automata David Mix Barrington 16 April 2013

Formal Languages and Automata

Finite Automata Part Three

Lexical Analysis. Prof. James L. Frankel Harvard University

Non-deterministic Finite Automata (NFA)

Languages and Compilers

Lexical Analysis. Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast!

Regular Languages (14 points) Solution: Problem 1 (6 points) Minimize the following automaton M. Show that the resulting DFA is minimal.

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Dr. D.M. Akbar Hussain

Solutions to Homework 10

Lexical Analysis. Lecture 2-4

Implementation of Lexical Analysis

Last lecture CMSC330. This lecture. Finite Automata: States. Finite Automata. Implementing Regular Expressions. Languages. Regular expressions

Lexical Analysis. COMP 524, Spring 2014 Bryan Ward

CT32 COMPUTER NETWORKS DEC 2015

Implementation of Lexical Analysis. Lecture 4

UNIT I PART A PART B

Compiler Construction

CS 314 Principles of Programming Languages. Lecture 3

CSE 105 THEORY OF COMPUTATION

QUESTION BANK. Formal Languages and Automata Theory(10CS56)

Lexical Analysis. Finite Automata. (Part 2 of 2)

We ve studied the main models and concepts of the theory of computation:

Context-Free Languages & Grammars (CFLs & CFGs) Reading: Chapter 5

LR Parsing - The Items

More Closure Properties, Algorithms, and the Pumping Lemma. CS154 Chris Pollett Feb 21, 2007.

Lexical Analysis. Introduction

LR Parsing, Part 2. Constructing Parse Tables. An NFA Recognizing Viable Prefixes. Computing the Closure. GOTO Function and DFA States

LOGIC SYNTHESIS AND VERIFICATION ALGORITHMS. Gary D. Hachtel University of Colorado. Fabio Somenzi University of Colorado.

Lecture 4: Syntax Specification

Compiler Construction

Regular Expression Constrained Sequence Alignment

Automata. Manuel Delgado Steve Linton. ( Version 1.12 ) Manuel Delgado Homepage:

R10 SET a) Construct a DFA that accepts an identifier of a C programming language. b) Differentiate between NFA and DFA?

Lecture 3: Lexical Analysis

Timo Latvala. January 28, 2004

Computation Engineering Applied Automata Theory and Logic. Ganesh Gopalakrishnan University of Utah. ^J Springer

SC/MATH Boolean Formulae. Ref: G. Tourlakis, Mathematical Logic, John Wiley & Sons, York University

Interpreter. Scanner. Parser. Tree Walker. read. request token. send token. send AST I/O. Console

Midterm Exam. CSCI 3136: Principles of Programming Languages. February 20, Group 2

HKN CS 374 Midterm 1 Review. Tim Klem Noah Mathes Mahir Morshed

lec3:nondeterministic finite state automata

Midterm I review. Reading: Chapters 1-4

CS402 - Theory of Automata Glossary By

CHENNAI MATHEMATICAL INSTITUTE M.Sc. / Ph.D. Programme in Computer Science

Transcription:

Decision Properties of RLs & Automaton Minimization Martin Fränzle formatics and Mathematical Modelling The Technical University of Denmark Languages and Parsing MF Fall p./ What you ll learn. Decidable properties of DFA NFA -NFA RE: Language emptiness universality inclusion. Automaton minimization: An algorithm for reducing the state set of DFA Applicability to NFA Languages and Parsing MF Fall p./

Converting between descriptions Translation RE (ijk) construction Determinization Determ. DFA Embedding eps NFA Embedding NFA Languages and Parsing MF Fall p./ Worst-case cost of conversion -NFA to NFA: NFA to DFA: where is the number of states DFA to NFA: DFA to RE: since there are REs to be constructed and each of the rounds can quadruple the size RE to -NFA: where is the length of the RE Languages and Parsing MF Fall p./

Decision procedures: Language emptiness Languages and Parsing MF Fall p./ Emptiness check ~enter ~enter ~enter enter enter ~enter leave leave Appr. Appr. Appr. Appr. Languages and Parsing MF Fall p./

! " The coloring algorithm The set of reachable states of a (D/N/ smallest set satisfying Base case: Recursion: if N)FA and there is ( (or respectively) then is the respectively) s.t.. Adding some bookkeeping to avoid reexamination of already visited states above rules yield an algorithm for computing the reachable states. Complexity: where is the number of state pairs connected via transitions in the automaton; when is the number of states. Languages and Parsing MF Fall p.7/ Direct emptiness test on REs Base case: For atomic REs we have true false a false Recursion: For compound REs: false Languages and Parsing MF Fall p.8/

" ' ' ' ( & " # ) Membership test Whether a string is in the language can be tested by running the automaton on of some automaton #. Languages and Parsing MF Fall p.9/ Other decidable properties Due to the closure properties of regular languages the emptiness test can be used to decide universality is "? Kleene-closedness is inclusion is disjointness is image is??? for some given homomorphism )? Furthermore (in-)finiteness of is decidable e.g. by analysing the RE does it contain a Kleene star over a language different from and? Languages and Parsing MF Fall p./

. # * # * & +. # / - + / Automaton Minimization Languages and Parsing MF Fall p./ State equivalence Def: Two states and of a DFA are called equivalent iff iff holds for all ". Deciding equivalence: The set of distinguishable state pairs is the smallest set satisfying Base case: If and or vice versa then +. Recursion: If then - and there is +. s.t and Theorem: and are equivalent iff +. Languages and Parsing MF Fall p./

Automaton minimization Obviously equivalent states can be merged into a single one as no string distinguishes the two. We will now see that the resulting automaton is minimal in the following sense:. There is no DFA with fewer states accepting the same language.. It is isomorphic (in the sense that the automata differ only in their state names) to all other DFAs with the same number of states that accept the same language. Languages and Parsing MF Fall p./ The minimal automaton Let be a DFA its set of reachable states and let + be the set of its equivalent state pairs. induces equivalence classes on :. The automaton defined by ( is called the minimization of. is well-defined as implies. Languages and Parsing MF Fall p./

' ; 9 9 8 8 : 7 Minimality is a DFA and the DFA constructed from minimization algorithm then... Lemma: If by the is a DFA and the DFA constructed from minimization algorithm then. for each DFA 'with. Theorem: If by the Languages and Parsing MF Fall p./ The NFA A B C has no equivalent states. Yet it is non-minimal: state is redundant. Minimization algorithm based on state equiv. applies to DFA only! Languages and Parsing MF Fall p./