CSE303 - Introduction to the Theory of Computing Sample Solutions for Exercises on Finite Automata

Similar documents
FSA. CmSc 365 Theory of Computation. Finite State Automata and Regular Expressions (Chapter 2, Section 2.3) ALPHABET operations: U, concatenation, *

Notes on Finite Automata Department of Computer Science Professor Goldberg Textbooks: Introduction to the Theory of Computation by Michael Sipser

DFA (Deterministic Finite Automata) q a

Last time: introduced our first computational model the DFA.

Finite Automata. d: Q S Q. Finite automaton is M=(Q, S, d, q 0, F) Ex: an FA that accepts all odd-length strings of zeros: q 0 q 1. q i. q k.

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

Winter 2016 COMP-250: Introduction to Computer Science. Lecture 23, April 5, 2016

Theory of Computation Regular Languages

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

INTEGRALS. Chapter 7. d dx. 7.1 Overview Let d dx F (x) = f (x). Then, we write f ( x)

1 Nondeterministic Finite Automata

Formal Languages and Automata

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

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

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

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

Non-Deterministic Finite Automata

0.1. Exercise 1: the distances between four points in a graph

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

TOPIC 5: INTEGRATION

Lecture 08: Feb. 08, 2019

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

Most Complex Regular Ideal Languages

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

The Equitable Dominating Graph

Minimal DFA. minimal DFA for L starting from any other

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1

Multi-Section Coupled Line Couplers

1 Finite Automata and Regular Expressions

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

The Course covers: Lexical Analysis Syntax Analysis Semantic Analysis Runtime environments Code Generation Code Optimization. CS 540 Spring 2013 GMU 2

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

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

Garnir Polynomial and their Properties

Deterministic Finite Automata

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

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

Minimum Spanning Trees

Nondeterminism and Nodeterministic Automata

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

1.4 Nonregular Languages

Automata and Languages

COMP108 Algorithmic Foundations

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.

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

CHAPTER 1 Regular Languages. Contents

Harvard University Computer Science 121 Midterm October 23, 2012

Convert the NFA into DFA

Let's start with an example:

Section 3: Antiderivatives of Formulas

SOLVED EXAMPLES. be the foci of an ellipse with eccentricity e. For any point P on the ellipse, prove that. tan

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

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

Chapter 16. 1) is a particular point on the graph of the function. 1. y, where x y 1

Chapter 10. The singular integral Introducing S(n) and J(n)

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

CS61B Lecture #33. Administrivia: Autograder will run this evening. Today s Readings: Graph Structures: DSIJ, Chapter 12

Lecture 11 Waves in Periodic Potentials Today: Questions you should be able to address after today s lecture:

Instructions for Section 1

1.3 Regular Expressions

Walk Like a Mathematician Learning Task:

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

The Matrix Exponential

Lecture 4: Lexical and Syntax Analysis

Section 6.1. Question: 2. Let H be a subgroup of a group G. Then H operates on G by left multiplication. Describe the orbits for this operation.

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

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

The Z transform techniques

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

First Midterm Examination

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

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

The Matrix Exponential

CS 361 Meeting 12 10/3/18

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

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.

Combinatorial Networks Week 1, March 11-12

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

CONIC SECTIONS. MODULE-IV Co-ordinate Geometry OBJECTIVES. Conic Sections

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

CIVL 8/ D Boundary Value Problems - Rectangular Elements 1/7

Week 3: Connected Subgraphs

Homework 3 Solutions

Seven-Segment Display Driver

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Basic Polyhedral theory

Worked out examples Finite Automata

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

PH427/PH527: Periodic systems Spring Overview of the PH427 website (syllabus, assignments etc.) 2. Coupled oscillations.

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

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Transcription:

CSE303 - Introduction to th Thory of Computing Smpl Solutions for Exrciss on Finit Automt Exrcis 2.1.1 A dtrministic finit utomton M ccpts th mpty string (i.., L(M)) if nd only if its initil stt is finl stt. Exrcis 2.1.3 () Th following stt digrm rprsnts n utomton tht ccpts thos strings w {, } in which ch is immditly prcdd y., (c) Th following utomton ccpts thos strings w {, } tht contin nithr nor s sustring.,

Exrcis 2.1.5 () (iii) Th following 2-tp finit utomton ccpts th st {( n, n m ) : n, m 0}., () (iv) Th following 2-tp finit utomton ccpts th st {( n, m n ) : n, m 0}. (Not ll trnsitions to dd stt r shown.),

Exrcis 2.2.3 () A possil utomton for ccpting th lngug () () is: (c) Th rgulr xprssion (( ) ) gnrts th sm lngug s (( ) ). An utomton ccpting th corrsponding lngug is:, Exrcis 2.3.3 Lt M 1 = (K 1, Σ, δ 1, s 1, F 1 ) nd M 2 = (K 2, Σ, δ 2, s 2, F 2 ) dtrministic finit utomt. W construct finit utomton M tht ccpts th intrsction L(M 1 ) L(M 2 ) of th lngugs ccptd y M 1 nd M 2, rspctivly. Th utomton M is dsignd to simult th oprtion of oth M 1 nd M 2. Mor spcificlly, its stts r pirs, whr th first componnt rflcts M 1 nd th scond componnt M 2. Formlly, lt K K 1 K 2 ; lt th st of ll tripls ((q 1, q 2 ), σ, (q 1, q 2)) in K Σ K, such tht δ 1 (q 1, σ) = q 1 nd δ 2(q 2, σ) = q 2 ; nd lt F th st F 1 F 2. Th finit utomton M = (K, Σ,, (s 1, s 2 ), F) ccpts L(M 1 ) L(M 2 ).

Exrcis 2.3.6 Lt M = (K, Σ, δ, s,f) dtrministic finit utomton tht ccpts th lngug L. () Lt M th finit utomton (K, Σ, δ, s, F ), whr F = {p K : (p, w) M (f, ) for som f F nd w Σ }. Tht is, M diffrs from M only in tht its finl stts r ll thos stts from which finl stt of M cn rchd. Th utomton M ccpts th st of prfixs of (strings in) L. () Lt M th finit utomton (K, Σ,,s, F), whr = {(p, σ, q) : δ(p, σ) = q} {(s,, q) : q K nd (s, w) M (q, ) for som w Σ }. Intuitivly, M works s M, ut computtions my gin t ny stt tht cn rchd from s y M. Th utomton M ccpts th st of suffixs of (strings in) L. (d,) Lt M th finit utomton (K, Σ, δ, s,f ), whr F = {q : (q, w) M (q, ) for som w L nd som q F }. Th utomton M ccpts th right quotint L/L of L y L. Not tht this dfinition is not ffctiv. A suitl st F xists, ut it my not possil to ctully comput it. Th diffrnc twn prts (d) nd () is tht for prt (d) on cn show how to construct F. (g) Lt M th finit utomton (K {s 0 }, Σ,, s 0, {s}), whr s 0 is nw stt not contind in K nd = {(q, σ, p) : δ(p, σ) = q} {(s 0,, q) : q F }. Informlly, w otin M from M y rvrsing ll trnsitions nd switching initil nd finl stts. (W nd to introduc nw initil stt for M s M my hv mor thn on finl stt.) Th utomton M ccpts th st of ll rvrs strings of L. Exrcis 2.4.5 () W us th Pumping Thorm to prov tht th lngug L = {ww : w {, } } is not rgulr.

Th proof is y contrdiction. Suppos L is rgulr. Thn y th Pumping Thorm thr xists n intgr n 1 such tht vry string ww L, with ww n, cn writtn s ww = xyz, whr xy n, y, nd xy i z L, for ch i 0. Tk th string w = n. Sinc ww n, th string ww cn writtn s xyz, for suitl strings x, y, nd z s dscrid ov. Sinc xy n, th string xy consists of s only. Thrfor xyyz is string of th form k+m k, whr m > 0. This string is clrly not of th form uu, for ny string u, which contrdicts tht it is n lmnt of L. W conclud tht L is not rgulr lngug. Exrcis 2.4.7 Lt M = (K, Σ, δ, s, F) dtrministic finit utomton nd lt n th numr of stts of M. First osrv tht if string w is ccptd y M nd n w, thn, y th sm rgumnts s in th proof of Thorm 2.4.1, w cn writtn s xyz, whr 1 y n nd y drivs th utomton from som stt q ck to q. Consquntly, th utomton M ccpts xy i z, for ch i 0. An immdit consqunc of this osrvtion is tht if M ccpts ny string of lngth grtr thn or qul to K, thn it ccpts infinitly mny strings. On th othr hnd, if M ccpts infinitly mny strings, thn it must ccpt som strings of lngth grtr thn or qul to K. Lt w ny shortst such string. By th ov osrvtion w cn writtn s xyz, for suitl strings x, y, nd z, such tht 1 y K nd M ccpts xz. Sinc th string xz is shortr thn w w my infr tht xz < K (for othrwis w = xyz could not shortst string of lngth grtr thn or qul to K tht is ccptd y M) nd hnc K w < 2 K. Exrcis 2.4.8 () A sust of rgulr lngug nd not rgulr. For xmpl, th st {, } is rgulr, ut its sust { i i : i 0} is nonrgulr. (c) If L is rgulr, so is its complmnt Σ L. Thus, th conctntion of th two sts, L(Σ L) = {xy : x L nd y L}, is rgulr s wll.

(d) Th Pumping Thorm cn usd to show tht th st {w : w = w R } is not rgulr. () If L is rgulr, so is th st L R ; s Prolm 2.3.6 (g). Sinc w R L if nd only if w L R, w my infr tht th st is rgulr. L L R = {w : w L nd w L R } = {w : w L nd w R L} (g) Not tht Σ = {y : y Σ } is sust of {xyx R : x, y Σ } (s th formr st is otind from th lttr y tking x to th mpty string. This of cours implis tht th two sts r qul (nd rgulr).