Solutions Problem Set 2. Problem (a) Let M denote the DFA constructed by swapping the accept and non-accepting state in M.

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

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

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

Homework 3 Solutions

Theory of Computation Regular Languages

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

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

First Midterm Examination

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

First Midterm Examination

Finite Automata-cont d

Non-deterministic Finite Automata

Worked out examples Finite Automata

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

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

Lecture 08: Feb. 08, 2019

Harvard University Computer Science 121 Midterm October 23, 2012

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

Non-deterministic Finite Automata

Homework Solution - Set 5 Due: Friday 10/03/08

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

CSE 355 Homework Two Solutions

CSCI565 - Compiler Design

1 From NFA to regular expression

Formal languages, automata, and theory of computation

Minimal DFA. minimal DFA for L starting from any other

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

CS375: Logic and Theory of Computing

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.

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

CSE396 Prelim I Answer Key Spring 2017

Some Theory of Computation Exercises Week 1

E 1 (n) = E 0 (n-1) E 0 (n) = E 0 (n-1)+e 0 (n-2) T(n -1)=2E 0 (n-2) + E 0 (n-3)

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

CHAPTER 1 Regular Languages. Contents

1.3 Regular Expressions

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

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

Name Ima Sample ASU ID

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

1.4 Nonregular Languages

Revision Sheet. (a) Give a regular expression for each of the following languages:

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

CS375: Logic and Theory of Computing

State Minimization for DFAs

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

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

CS 330 Formal Methods and Models

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

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

Nondeterminism and Nodeterministic Automata

Convert the NFA into DFA

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

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

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.

Thoery of Automata CS402

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

NFAs continued, Closure Properties of Regular Languages

Fundamentals of Computer Science

Deterministic Finite Automata

1 Structural induction, finite automata, regular expressions

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CSCI FOUNDATIONS OF COMPUTER SCIENCE

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

Recursively Enumerable and Recursive. Languages

Formal Languages and Automata

Myhill-Nerode Theorem

Bases for Vector Spaces

Finite-State Automata: Recap

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

CS 330 Formal Methods and Models

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

2.4 Linear Inequalities and Interval Notation

CMSC 330: Organization of Programming Languages

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

Languages & Automata

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

FABER Formal Languages, Automata and Models of Computation

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

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

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

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

1 Structural induction

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

Lexical Analysis Finite Automate

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

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

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.

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

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

1 Nondeterministic Finite Automata

Deterministic Finite-State Automata

CS311 Computational Structures Regular Languages and Regular Grammars. Lecture 6

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

GNFA GNFA GNFA GNFA GNFA

Closure Properties of Regular Languages

Let's start with an example:

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

Formal Language and Automata Theory (CS21004)

CS103 Handout 32 Fall 2016 November 11, 2016 Problem Set 7

Transcription:

Solution Prolem Set 2 Prolem.4 () Let M denote the DFA contructed y wpping the ccept nd non-ccepting tte in M. For ny tring w B, w will e ccepted y M, tht i, fter conuming the tring w, M will e in n ccepting tte. However, M will e in n non-ccpeting tte fter conuming the me tring w. So, M will reject w. For ny tring w B, w will e rejected y M, tht i, fter conuming the tring w, M will e in n ccepting tte. However, M will e in n non-ccpeting tte fter conuming the me tring w. So, M will reject w. Therefore, M recognize the complement of B (tht i thoe tring not in B). Thu, for ny lnguge L ccepted y DFA (i.e., for ny regulr lnguge L) there exit DFA which recognize the complement of L. Hence the cl of regulr lnguge i cloed under complement..4 (). Conider the NFA given elow. The tring i ccepted y oth mchine. Therefore, wpping the ccepting nd non-ccepting tte of n NFA which recognize the lnguge C doe not necerily yield nd NFA which recognize the complement of C.,, M M But till the cl of lnguge recognized y NFA re cloed under complement ecue the lnguge recognized y NFA re the me et of lnguge recognized y DFA. Prolem 2. memer:, not-memer:,. memer:,

not-memer:, c. memer:, not-memer:, d. memer:, not-memer:, e. memer:, not-memer:, f. memer:, not-memer:, g. memer:, not-memer:, g. memer:, not-memer:, Prolem 3 () {w w egin with nd end with } ( )* () {w w contin t let three } ( )*( )*( )*( )* (c) {w the length of w i t mot 5} ( )( )( )( )( ) (d) {w w contin n even numer of, or contin exctly two } w contin n even numer of : (***)* w contin exctly two : *** w contin n even numer of, or contin exctly two : (***)* *** 2

Prolem 4 Prt () ()* (()*()) 3

(()*()) ((()*()) )* Prt () Let u give the following nme to ech tte: c d e f g h i j k l m n o 4

Then the DFA correponding to the NFA ove i:, k,l,h i,j,,c,g,h,l m,n d,e,i,j f,,c,g,h,l o,,c,g,h,l Prolem 5 Prt () 2 Firt, convert to n equivlent GNFA 2 5

Next, eliminte tte (except nd ) one y one. We will firt eliminte tte * 2 (*) Then eliminte tte 2. *( (*))* Hence the regulr expreion correponding to the given DFA i: *( (*))* Prt (), 2 3 Firt, convert to n equivlent GNFA 2 3 6

Next, eliminte tte (except nd ) one y one. The order in which the tte re eliminted doe not mtter. However, eliminting tte in different order my reult in different (ut lo correct) regulr expreion. Firt eliminte tte 2 ( ) 3 Next, eliminte tte 2 ( )* 3 ( )* Next, eliminte tte 3 (( )* )( ( )*)*( ) Hence the regulr expreion correponding to the given DFA i: (( )*)( ( )*)*( ) 7

Prolem 6,,/ # / # # /,,#,,/,,,/,# Prt () /#(( /) (#*( )))*#/ Prolem 7 Solution to prt () nd (c) re given in textook (p. 96) Prt () Aume tht A 2 i regulr. Chooe = p p p Since, ccording to pumping lemm, xy < p the pumping tring y cn conit of only of. When we pump y the numer of leding will e lrger thn the ret which men tht the new tring will not e in the lnguge A 2. Thi i contrdiction. So A 2 i not regulr. Prolem 8 In exmple.73 the lnguge i { n n n }. But in thi prolem the lnguge i **. When the tring i pumped the reultnt tring i till in ** ince thi lnguge conit of thoe tring in which ny numer of i followed y ny numer of (the numer of cn e lrger thn the numer of, they don t need to e equl). 8

Prolem 9.6c,.6e,,,,.6g,,,,,,,.6h Firt drw the DFA which ccept only nd then tke the complement y wpping the ccepting nd nonccepting tte. The finl DFA i given elow.,, 9

.6j Firt drw the DFA for tring coniting of t let two., x y z String conit of exctly one,, c Now drw the finl DFA which imulte thee two DFA nd ccept only when oth of thee DFA re in n ccept tte., y z zc x xc yc y z

.7 The DFA in.6c i lredy with five tte. Since ll DFA re lo NFA the olution i the me in.6c.7d.7e.7f The olution i given in your textook p.95.