Math Circles Finite Automata Question Sheet 3 (Solutions)

Similar documents
Regular languages can be expressed as regular expressions.

Student Book SERIES. Patterns and Algebra. Name

Student Book SERIES. Fractions. Name

Patterns and Algebra

Kirchhoff s Rules. Kirchhoff s Laws. Kirchhoff s Rules. Kirchhoff s Laws. Practice. Understanding SPH4UW. Kirchhoff s Voltage Rule (KVR):

The Math Learning Center PO Box 12929, Salem, Oregon Math Learning Center

Spiral Tilings with C-curves

Digital Design. Sequential Logic Design -- Controllers. Copyright 2007 Frank Vahid

Section 16.3 Double Integrals over General Regions

Arduino for Model Railroaders

1 tray of toffee 1 bar of toffee. 10 In the decimal number, 0 7, the 7 refers to 7 tenths or

First Round Solutions Grades 4, 5, and 6

Aquauno Select MINUTES. (duration) FREQUENCY LED. OFF 8h AQUAUNO SELECT 5 MIN FREQUENCY. the timer is being programmed;

Example. Check that the Jacobian of the transformation to spherical coordinates is

Birka B22: threaded in variation

SOLVING TRIANGLES USING THE SINE AND COSINE RULES

Geometric quantities for polar curves

Patterns and Relationships

Polar Coordinates. July 30, 2014

Sequential Logic (2) Synchronous vs Asynchronous Sequential Circuit. Clock Signal. Synchronous Sequential Circuits. FSM Overview 9/10/12

CHAPTER 2 LITERATURE STUDY

Make Your Math Super Powered

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Lecture 20. Intro to line integrals. Dan Nichols MATH 233, Spring 2018 University of Massachusetts.

MONOCHRONICLE STRAIGHT

Experiment 8 Series DC Motor (II)

Dataflow Language Model. DataFlow Models. Applications of Dataflow. Dataflow Languages. Kahn process networks. A Kahn Process (1)

CS 135: Computer Architecture I. Boolean Algebra. Basic Logic Gates

Misty. Sudnow Dot Songs

Exercise 1-1. The Sine Wave EXERCISE OBJECTIVE DISCUSSION OUTLINE. Relationship between a rotating phasor and a sine wave DISCUSSION

How to Build Wealth Like Warren Buffett.

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN SPRING 2005

Homework #1 due Monday at 6pm. White drop box in Student Lounge on the second floor of Cory. Tuesday labs cancelled next week

Section 17.2: Line Integrals. 1 Objectives. 2 Assignments. 3 Maple Commands. 1. Compute line integrals in IR 2 and IR Read Section 17.

Direct Current Circuits. Chapter Outline Electromotive Force 28.2 Resistors in Series and in Parallel 28.3 Kirchhoff s Rules 28.

On the Description of Communications Between Software Components with UML

Addition Mission: Facts Practice

Operation Manual Sewing Machine

Challenge! 1 Warm-up. 2 Conversation. Language box. a Discuss the pictures with a partner.

EE Controls Lab #2: Implementing State-Transition Logic on a PLC

Magnetic monopole field exposed by electrons

10.4 AREAS AND LENGTHS IN POLAR COORDINATES

MAXIMUM FLOWS IN FUZZY NETWORKS WITH FUNNEL-SHAPED NODES

Solutions to exercise 1 in ETS052 Computer Communication

(1) Primary Trigonometric Ratios (SOH CAH TOA): Given a right triangle OPQ with acute angle, we have the following trig ratios: ADJ

Samantha s Strategies page 1 of 2

Series. Teacher. Numbers

TUR DOORS SHOWER DOORS

Discontinued AN6262N, AN6263N. (planed maintenance type, maintenance type, planed discontinued typed, discontinued type)

Abacaba-Dabacaba! by Michael Naylor Western Washington University

Energy Harvesting Two-Way Channels With Decoding and Processing Costs

Topic 20: Huffman Coding

Balancing Your Life. Ideas that might help you

MATH 118 PROBLEM SET 6

arxiv: v1 [cs.cc] 29 Mar 2012

(1) Non-linear system

& Y Connected resistors, Light emitting diode.

Unit 1: Chapter 4 Roots & Powers

9.4. ; 65. A family of curves has polar equations. ; 66. The astronomer Giovanni Cassini ( ) studied the family of curves with polar equations

Section 6.1 Law of Sines. Notes. Oblique Triangles - triangles that have no right angles. A c. A is acute. A is obtuse

Operation Manual. Product Code 885-V55. Computerized Embroidery Machine GETTING READY EMBROIDERY APPENDIX

The Discussion of this exercise covers the following points:

Operation Manual. Addendum. Embroidery Machine. Product Code: 884-T13

METHOD OF LOCATION USING SIGNALS OF UNKNOWN ORIGIN. Inventor: Brian L. Baskin

PROGRAMMING MANUAL MTMA/01 MTMV/01 FB00329-EN

CHAPTER 3 AMPLIFIER DESIGN TECHNIQUES

Algorithms for Memory Hierarchies Lecture 14

Application Note. Differential Amplifier

ABB STOTZ-KONTAKT. ABB i-bus EIB Current Module SM/S Intelligent Installation Systems. User Manual SM/S In = 16 A AC Un = 230 V AC

LECTURE 9: QUADRATIC RESIDUES AND THE LAW OF QUADRATIC RECIPROCITY

ITEC2620 Introduction to Data Structures

ABOUT THIS MANUAL ABOUT THIS MANUAL

Module 9. DC Machines. Version 2 EE IIT, Kharagpur

510 Series Color Jetprinter

Comparison of soundscape on the ground floor of tube-houses in Hanoi and open urban space in Bordeaux

Macroscopic and Microscopic Springs Procedure

BUBBLE BOBBLE 1 o C r t n o s l 2 t e G t g n i a t S r d e t 3 a B s c i Pl y a 4 a G m S e r c e n e 5 in r Sco g 6 ms e It 7 a P s s o w d r

Sinusoidal Steady State Analysis

Re: PCT Minimum Documentation: Updating of the Inventory of Patent Documents According to PCT Rule 34.1

REVIEW QUESTIONS. Figure For Review Question Figure For Review Question Figure For Review Question 10.2.

ASSEMBLY INSTRUCTIONS

Translate and Classify Conic Sections

Triangles and parallelograms of equal area in an ellipse

General Augmented Rook Boards & Product Formulas

Algebra Practice. Dr. Barbara Sandall, Ed.D., and Travis Olson, M.S.

Spotted at APA. Top Points this week. Spring f ro. Year 7. Year 8. Year 9. Year 10. Year 11. Student Newsletter ~

Probability and Statistics P(A) Mathletics Instant Workbooks. Copyright

Theme: Don t get mad. Learn mod.

Basic Embroidery. Chapter 5 COMBINING PATTERNS BEFORE EMBROIDERING PREPARING THE FABRIC SELECTING PATTERNS...

ARK CHEVRON INSTALLATION GUIDE

Safety Relay Unit. Main contacts Auxiliary contact Number of input channels Rated voltage Model Category. possible 24 VAC/VDC G9SA-501.

How to remove BRNS/BRFS series from a PWB

SPECIAL EDITION. Spring 2012 Ezine. where crafty is contagious

Area-Time Efficient Digit-Serial-Serial Two s Complement Multiplier

How To Play Against Stronger Players

Defining the Rational Numbers

Domination and Independence on Square Chessboard

ECE 274 Digital Logic Fall 2009 Digital Design

Network Theorems. Objectives 9.1 INTRODUCTION 9.2 SUPERPOSITION THEOREM

CS2204 DIGITAL LOGIC & STATE MACHINE DESIGN fall 2008

Transcription:

Mth Circles Finite Automt Question Sheet 3 (Solutions) Nickols Rollick nrollick@uwterloo.c Novemer 2, 28 Note: These solutions my give you the nswers to ll the prolems, ut they usully won t tell you how to get the nswer. All the fun nd profit lies in finding the nswers for yourself... Also e wre tht some questions hve more thn one solution this will only provide you with one of them! Questions from Lesson. Descrie ll strings ccepted y ech of the following NFAs: () ; Solution: This NFA ccepts ll the strings tht strt with.

() ; 2 Solution: This NFA ccepts the string, nd nothing else. (c) 4 5 ; 2 3 ; Solution: This NFA ccepts the strings tht either strt with, or end with. 2

2. Drw n NFA stisfying ech set of conditions: () It hs four sttes, nd ccepts the lnguge of strings tht hve no s, or else hve one or more s followed y single. Solution: 2 3 () It hs three sttes nd llows three possile symols:,, nd c. It ccepts the lnguge defined y the following conditions: The empty string is in the lnguge. Given string in the lnguge, dding or c to the end gives nother string in the lnguge. (For exmple,, c, c,, cc ll elong to this lnguge.) Solution: c 2 3

3. Given the following NFAs, construct DFAs tht ccept the sme lnguge: () ; ; 2 Solution: As discussed during the session, designing DFA tht keeps trck of ll possile universes leds to: fg fg ; f2g f;g f;;2g B ; ; f;2g 4

() 2 Solution: Agin, we cn follow the sme possile universes construction tht we discussed during the session. The ccepting sttes in the new DFA re the ones with in them, since stte is the only ccepting stte of the NFA. fg f;2g B ; 5

Extr Questions 4. Here, we will see tht every finite lnguge uilt out of strings of s nd s is regulr. In other words, given ny finite collection of strings, there is some DFA tht ccepts exctly those strings nd no others. () Drw n NFA with four sttes nd three rrows tht ccepts the string nd nothing else. Now drw n NFA with six sttes nd five rrows tht ccepts the string nd nothing else. Solution: For : 2 3 For : 2 3 5 4 () Building on the pttern from the previous prt, suppose we re given ny string of s nd s (mye it s ). Descrie how to uild n NFA tht ccepts tht string, nd nothing else. Solution: If the string hs n symols in it, we uild n NFA tht hs n + sttes, lelled up to n, nd n rrows. There is one rrow from stte to stte lelled with the first letter of the string, one from stte to stte 2 lelled with the second letter, nd so on. Only the lst stte n is n ccepting stte. Unless the input to the NFA is exctly the specified string, the NFA will either not mke it to stte n nd reject the string, or it will red letter tht it cn t hndle, nd rek down. 6

(c) Given ny single string, explin why there is DFA (not just n NFA) ccepting tht string, nd nothing else. Solution: In the previous prt, we showed there ws n NFA tht ccepts the given string, nd nothing else. Applying the prllel universes construction, we cn tke tht NFA nd get DFA ccepting the sme lnguge (so exctly tht string, nd nothing else). (d) Lst time, we sw tht for ny two DFAs, ccepting ny two lnguges, we cn uild nother DFA ccepting the strings in either lnguge. Using this, explin how we cn tke ny two strings nd uild DFA ccepting those two strings nd nothing else. Solution: Given ny two strings, we cn pply the previous prt to find two DFAs, ech of which ccepts exctly one of the strings, nd nothing else. Applying the construction from lst time, we cn uild new DFA ccepting only the strings ccepted y either DFA. In other words, this new DFA ccepts the two given strings, nd nothing else. (e) Building on the ide from the previous prt, explin how we cn tke ny finite numer of strings nd uild DFA ccepting those strings nd nothing else. Solution: Suppose we hve finite collection of strings, which we ll cll w,..., w n. By prt (c), we cn find DFAs ccepting w nd nothing else, w 2 nd nothing else, w 3 nd nothing else, etc. Tking the DFA ccepting w nd nothing else nd the one ccepting w 2 nd nothing else, we uild new DFA ccepting the strings tht either of these DFAs ccept. In other words, this new DFA ccepts w, w 2, nd nothing else. Next, we tke this new DFA nd the one ccepting w 3 nd pply the sme construction, giving DFA ccepting w, w 2, w 3, nd nothing else. Repeting this over nd over gin, we end up with DFA tht ccepts exctly w,..., w n. 7

5. Given ny NFA, explin how to construct new NFA with exctly one ccepting stte tht ccepts the sme lnguge. (Hint: Try this on few exmples first the NFA in Question (c) is good plce to strt.) Solution: Here is how the construction works. Tke the originl NFA nd dd in one new stte (this will e the ccepting stte of the new NFA). Tke ll the ccepting sttes of the originl NFA nd dd lnk rrow from those sttes to the new stte. Then mke ll sttes of this new NFA rejecting sttes, except for the new one we just dded in. Why does this ccept the sme lnguge? We hve to check tht it ccepts nd rejects exctly the sme strings s the originl NFA. First, suppose string is ccepted y the originl NFA. This mens there is some collection of choices the originl NFA cn mke when reding the string, where it ends up t n ccepting stte. Since we hven t tken wy ny rrows in the new NFA, the new NFA cn mke the sme choices nd end up t the sme stte. The only prolem is tht this is not n ccepting stte ny more. But in the new NFA, there must e lnk rrow from this stte to the new ccepting stte, so this new NFA cn choose to follow the lnk rrow fter reding the string nd ccept it. Now suppose we hve string tht is rejected y the originl NFA. This mens no mtter wht choices the originl NFA mkes when reding the string, it will lwys e rejected. Note tht the only extr choices the new NFA cn mke re to follow the lnk rrows to the new ccepting stte. But since there re no rrows coming out of tht stte, if the NFA still hs letters left to red when it does this, it will rek nd reject the string. So the only wy the new NFA cn ccept string tht the old NFA rejected is if it follows one of the new lnk rrows fter reding ll the symols. The only wy it cn do tht is if it psses through n ccepting stte for the old NFA fter reding ll the symols, which would cuse the string to e ccepted y the originl NFA too. An exmple might e useful in mking this clerer. Here is wht we get when pplying this construction to the NFA from Question (c). The new ccepting stte hs een lelled N (for new ). 4 5 ; 2 N 3 ; 8

6. For ny string, the reverse of tht string is otined y reversing the order of ll the symols. For exmple, the reverse of is, nd the reverse of is gin. Given lnguge, we cn define the reverse lnguge to e wht you get if you reverse ll the strings in the originl lnguge. If lnguge is regulr, explin why the reverse lnguge is lso regulr. (Hint: Strting with DFA ccepting the originl lnguge, turn it into n NFA with single ccepting stte tht ccepts the sme lnguge, using the previous question. Then convert tht NFA into new NFA ccepting the reverse lnguge.) Solution: Since every NFA cn e converted into DFA ccepting the sme lnguge, it is enough to uild n NFA ccepting the reverse lnguge. If lnguge is regulr, we cn find DFA tht ccepts the lnguge. Since DFA is specil kind of NFA, we cn pply the previous question to turn this DFA into n NFA with single ccepting stte tht lso ccepts the lnguge. Finlly, we turn this NFA into n NFA ccepting the reverse lnguge. All we need to do is chnge the initil (strting) stte of the NFA into n ccepting stte, chnge the unique ccepting stte of the NFA into n initil stte, nd reverse ll of the rrows. Then, given string in the originl lnguge, there is some wy the originl NFA cn ccept it, y following collection of rrows from the initil stte to the single ccepting stte. By strting t the ccepting stte nd following ll those rrows ckwrds, we end up ck t the initil stte, which mens tht our new NFA ccepts the reverse string. The rgument works the other wy too: if the new NFA ccepts string, then in the originl NFA, there is some wy to strt t the ccepting stte, follow the rrows ckwrds, nd end up t the initil stte fter reding the string. This mens the originl NFA ccepts the reverse of this string, so tht the string we strted with is in the reverse lnguge. 9