CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Similar documents
CISC 4090 Theory of Computation

CHAPTER 1 Regular Languages. Contents

CHAPTER 1 Regular Languages. Contents

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Lecture 08: Feb. 08, 2019

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Let's start with an example:

Deterministic Finite Automata

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Convert the NFA into DFA

Theory of Computation Regular Languages

Regular expressions, Finite Automata, transition graphs are all the same!!

Designing finite automata II

Minimal DFA. minimal DFA for L starting from any other

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Finite Automata-cont d

Fundamentals of Computer Science

Languages & Automata

Finite-State Automata: Recap

Non-deterministic Finite Automata

Formal Languages and Automata

Java II Finite Automata I

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Formal Language and Automata Theory (CS21004)

Some Theory of Computation Exercises Week 1

Worked out examples Finite Automata

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Harvard University Computer Science 121 Midterm October 23, 2012

Non-deterministic Finite Automata

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

3 Regular expressions

Nondeterminism and Nodeterministic Automata

CMSC 330: Organization of Programming Languages

Chapter 2 Finite Automata

Homework 3 Solutions

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

CS375: Logic and Theory of Computing

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

NFAs continued, Closure Properties of Regular Languages

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Coalgebra, Lecture 15: Equations for Deterministic Automata

1 Nondeterministic Finite Automata

Lexical Analysis Finite Automate

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

input tape head moves current state

First Midterm Examination

Thoery of Automata CS402

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. Comparing DFAs and NFAs (cont.) Finite Automata 2

Name Ima Sample ASU ID

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

First Midterm Examination

State Minimization for DFAs

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

ɛ-closure, Kleene s Theorem,

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

GNFA GNFA GNFA GNFA GNFA

Today s Topics Automata and Languages

Automata and Languages

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

In-depth introduction to main models, concepts of theory of computation:

Deterministic Finite-State Automata

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) - Spring L. Blum

Context-Free Grammars and Languages

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Nondeterminism. Nondeterministic Finite Automata. Example: Moves on a Chessboard. Nondeterminism (2) Example: Chessboard (2) Formal NFA

NFAs continued, Closure Properties of Regular Languages

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

1 From NFA to regular expression

Automata Theory 101. Introduction. Outline. Introduction Finite Automata Regular Expressions ω-automata. Ralf Huuck.

CS375: Logic and Theory of Computing

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

More on automata. Michael George. March 24 April 7, 2014

Lecture 9: LTL and Büchi Automata

Myhill-Nerode Theorem

Formal languages, automata, and theory of computation

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Scanner. Specifying patterns. Specifying patterns. Operations on languages. A scanner must recognize the units of syntax Some parts are easy:

NFA DFA Example 3 CMSC 330: Organization of Programming Languages. Equivalence of DFAs and NFAs. Equivalence of DFAs and NFAs (cont.

Transcription:

Finite Automt (FA or DFA) CHAPTER Regulr Lnguges Contents definitions, exmples, designing, regulr opertions Non-deterministic Finite Automt (NFA) definitions, equivlence of NFAs DFAs, closure under regulr opertions Regulr expressions definitions, equivlence with finite utomt Non-regulr Lnguges the pumping lemm for regulr lnguges Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University Finite Automt A simplest computtionl model Models computers with very smll mount of memory vrious electromechnicl devices rer Exmple: utomtic door controller front i.e., entries, exits in supermrkets Two sttes: open, closed 4 possile inputs (from two sensors) front oth rer neither Stte trnsition tle Input signl neither front rer oth Stte digrm rer oth neither front front rer oth Stte closed closed open closed closed open closed open open open closed open neither Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University

Finite Automt Other exmples: elevtor controller, dish wshers, digitl wtches, clcultors Next we will give definition of FA from mthemticl prospective terminology for descriing mnipulting FA theoretic results descriing their power limittion A finite utomton M tht hs three sttes q q, Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 3 (Deterministic) Finite Automt: Definition An importnt wy to descrie certin simple ut highly useful lnguges clled regulr lnguges. It is A grph with finite numer of nodes, clled sttes. Arcs re leled with one or more symols from some lphet. One stte is chosen s the strt stte or initil stte. Some sttes re finl sttes or ccepting sttes. The lnguge of the FA is the set of strings tht lel pths tht go from the strt stte to some finl stte. Exmple: finite utomton M tht hs three sttes q q, Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 4

Forml Definition of DFAs A deterministic finite utomton (DFA) is specified y 5-tuple ( Q, δ, q, where, F) Q is finite set of sttes, Q = { q, q, } Σ is finite lphet, Σ = {,} δ : Q Σ Q is the trnsition function, δ ( q,) = q, δ (,) = q,... q Q is the initil stte, q = q F Q is the set of finl sttes. F = {q} A DFA is usully represented y directed leled grph (so clled trnsition digrm) nodes = sttes, rc from q to p is leled y the set of input symols such tht δ ( q, ) = p no rc if no such, strt stte indicted y word strt n rrow, ccepting sttes get doule circles. For DFA we hve q q M Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 5, Acceptnce of Strings the Lnguge of DFA Let M= ( Q, Σ, δ, q, F ) e finite utomton Let w = w, w e string over,..., w n Σ M ccepts w if sequence of sttes r, r, r,..., the following three conditions:. r = q,. δ ( ri, wi + ) = ri + for i =,..., n, 3. r n F If L is set of strings tht M ccepts, we sy tht L is the lnguge of mchine M write L=L(M). We sy M recognizes L or M ccepts L. In our exmple, L( M )=L, where L={w: w contins t lest one n even numer of s follow the lst } exists in Q with Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 6 q r n q, 3

Regulr Lnguges A lnguge is clled regulr lnguge if some finite utomton recognizes it. Min questions is: Given lnguge L, construct, if possile, FA M which recognizes L, i.e., L(M)=L. (Is L regulr lnguge?) Another question is Given FA M, descrie its lnguge L(M) s set of strings over its lphet. First consider some exmples: q q L( M )={w: w ends in } L( )={w: w is ε or ends in } M 3 L( M 4 )={w: w strts ends with the sme symol} Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 7 q s r r Design of DFAs Given lnguge, design finite utomton tht recognizes it. This is cretive process, is rt. No simple universl methods. One intuitive wy: put yourself in the plce of the mchine you re trying to design see how you would go out performing the mchine s tsk. we need to receive string to determine whether it is memer of the lnguge. we get to see the symols in the string one y one. fter ech symol we must decide whether the string seen so fr is in the lnguge (we don t know when the end of the string is coming, so we must lwys e redy with the nswer). we hve finite memory, so we hve to figure out wht we need to rememer out the string s we re reding it (we cnnot rememer ll we hve seen). In this wy we will find out how mny sttes our utomton will hve ( wht re the sttes). Exmple: the lnguge consists of ll strings over lphet {,} with odd numer of s. Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 8 4

qe qo Two possiilities:. Even so fr,. Odd so fr. Hence two sttes. Design of FA for L={strings contining } We scn our string. There re four possiilities:. hve not just seen ny symol of the pttern,. hve just seen, 3. hve just seen, or 4. hve seen the entire pttern. So, four sttes q, q, q, q Therefore, L={strings with odd numer of s}, q q q q Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 9 Regulr Opertions Let L L e lnguges. We define the regulr opertions union, intersection, conctention, str s follows. Union: Intersection: Conctention: Str: L L = { w: L L L = { w: L Lo L = { wv : L * L = { w w... w : k L}. L}. v L}. ech w L}. Exmple: Let the lphet Σ e the strd 6 letters {,,,z}. If L={good, d} L= {oy, girl}, then L L = {good, d, oy, girl}. k or L L = Lo L = {goodoy, doy, goodgirl, dgirl}. * {, good, d, goodgood, dgood, dd, goodd, L = ε goodgoodgood, goodgoodd, gooddd, } i Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 5

Product construction It would e useful if we cn construct FAs for L L from FAs for L L, no mtter wht L L. This would give systemtic wy of constructing from the utomt M M n utomton tht checks if the input contins n odd numer of s or the sustring s well s L L if the input contins n odd numer of s the sustring. qeven qodd q L(M)={w: w contins n odd numer of s} L( M)={w: w contins sustring } q q q we cn run oth utomt in prllel, y rememering the sttes of oth utomt while reding the input. This is chieved y the product construction, Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University Product construction Let M= ( Q, Σ, δ, q, F ) M= ( Q, δ,, F ) e two FA with the sme lphet. We define finite utomton M such tht L( M ) = L( M) L( M ) such tht L( M ) = L( M) L( M ) s follows. M M M A,R B,R = ( Q, δ, q, F = ( Q, δ, q, F L( M ) = L( M) L( M ) ) ) where Q = Q Q, δ (( q, q ), ) = ( δ ( q, ), δ ( q, )), ( q, q ) F ( q, q ) F Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University q = ( q, q A,S A,T A,U B,S B,T B,U ), iff q F iff q F q F, or q F. Here, A=qood B=qeven R=q S=q T=q U=q ={w: w contins n odd numer of s the sustring } 6

Product construction A,R B,R A,S A,T A,U B,S B,T B,U L( M ) = L( M) L( M ) ={w: w contins n odd numer of s or the sustring } We hve proved y construction tht Theorem. The clss of regulr lnguges is closed under the union opertion. Theorem. The clss of regulr lnguges is closed under the intersection opertion. Lter we will show tht they re closed under conctention str opertions. Automt & Forml Lnguges, Feodor F. Drgn, Kent Stte University 3 7