Formal Languages and Automata Exam

Similar documents
One Minute To Learn Programming: Finite Automata

Homework 3 Solutions

Regular Sets and Expressions

Solution to Problem Set 1

FORMAL LANGUAGES, AUTOMATA AND THEORY OF COMPUTATION EXERCISES ON REGULAR LANGUAGES

flex Regular Expressions and Lexical Scanning Regular Expressions and flex Examples on Alphabet A = {a,b} (Standard) Regular Expressions on Alphabet A

Unambiguous Recognizable Two-dimensional Languages

Regular Languages and Finite Automata

Polynomial Functions. Polynomial functions in one variable can be written in expanded form as ( )

Example 27.1 Draw a Venn diagram to show the relationship between counting numbers, whole numbers, integers, and rational numbers.

MATH 150 HOMEWORK 4 SOLUTIONS

Binary Representation of Numbers Autar Kaw

and thus, they are similar. If k = 3 then the Jordan form of both matrices is

PROF. BOYAN KOSTADINOV NEW YORK CITY COLLEGE OF TECHNOLOGY, CUNY

A Visual and Interactive Input abb Automata. Theory Course with JFLAP 4.0

Two hours UNIVERSITY OF MANCHESTER SCHOOL OF COMPUTER SCIENCE. Date: Friday 16 th May Time: 14:00 16:00

Appendix D: Completing the Square and the Quadratic Formula. In Appendix A, two special cases of expanding brackets were considered:

Reasoning to Solve Equations and Inequalities

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Physics 43 Homework Set 9 Chapter 40 Key

Example A rectangular box without lid is to be made from a square cardboard of sides 18 cm by cutting equal squares from each corner and then folding

Treatment Spring Late Summer Fall Mean = 1.33 Mean = 4.88 Mean = 3.

Lecture 5. Inner Product

Linear Equations in Two Variables

Bypassing Space Explosion in Regular Expression Matching for Network Intrusion Detection and Prevention Systems

FAULT TREES AND RELIABILITY BLOCK DIAGRAMS. Harry G. Kwatny. Department of Mechanical Engineering & Mechanics Drexel University

Operations with Polynomials

9 CONTINUOUS DISTRIBUTIONS

9.3. The Scalar Product. Introduction. Prerequisites. Learning Outcomes

NQF Level: 2 US No: 7480

19. The Fermat-Euler Prime Number Theorem

1.00/1.001 Introduction to Computers and Engineering Problem Solving Fall Final Exam

Mathematics. Vectors. hsn.uk.net. Higher. Contents. Vectors 128 HSN23100

Answer, Key Homework 10 David McIntyre 1

, and the number of electrons is -19. e e C. The negatively charged electrons move in the direction opposite to the conventional current flow.

Algebra Review. How well do you remember your algebra?

Factoring Polynomials

I calculate the unemployment rate as (In Labor Force Employed)/In Labor Force

MA Lesson 16 Notes Summer 2016 Properties of Logarithms. Remember: A logarithm is an exponent! It behaves like an exponent!

Math 135 Circles and Completing the Square Examples

Automated Grading of DFA Constructions

Quick Reference Guide: One-time Account Update

Math 314, Homework Assignment Prove that two nonvertical lines are perpendicular if and only if the product of their slopes is 1.

DlNBVRGH + Sickness Absence Monitoring Report. Executive of the Council. Purpose of report

1. In the Bohr model, compare the magnitudes of the electron s kinetic and potential energies in orbit. What does this imply?

Section 5-4 Trigonometric Functions

Lesson 4.1 Triangle Sum Conjecture

Vectors Recap of vectors

Integration by Substitution

Ratio and Proportion

Rotating DC Motors Part II

Java CUP. Java CUP Specifications. User Code Additions You may define Java code to be included within the generated parser:

SPECIAL PRODUCTS AND FACTORIZATION

baby on the way, quit today

LINEAR TRANSFORMATIONS AND THEIR REPRESENTING MATRICES

Bayesian Updating with Continuous Priors Class 13, 18.05, Spring 2014 Jeremy Orloff and Jonathan Bloom

Pointed Regular Expressions

Introduction. Teacher s lesson notes The notes and examples are useful for new teachers and can form the basis of lesson plans.

Section 7-4 Translation of Axes

Learning Outcomes. Computer Systems - Architecture Lecture 4 - Boolean Logic. What is Logic? Boolean Logic 10/28/2010

e.g. f(x) = x domain x 0 (cannot find the square root of negative values)

EQUATIONS OF LINES AND PLANES

Or more simply put, when adding or subtracting quantities, their uncertainties add.

DATABASDESIGN FÖR INGENJÖRER F

Lecture 3 Gaussian Probability Distribution

Multiplication and Division - Left to Right. Addition and Subtraction - Left to Right.

Learning Workflow Petri Nets

Solutions for Selected Exercises from Introduction to Compiler Design

Graphs on Logarithmic and Semilogarithmic Paper

P.3 Polynomials and Factoring. P.3 an 1. Polynomial STUDY TIP. Example 1 Writing Polynomials in Standard Form. What you should learn

GENERAL APPLICATION FOR FARM CLASSIFICATION

Econ 4721 Money and Banking Problem Set 2 Answer Key

Pentominoes. Pentominoes. Bruce Baguley Cascade Math Systems, LLC. The pentominoes are a simple-looking set of objects through which some powerful

Warm-up for Differential Calculus

FUNCTIONS AND EQUATIONS. xεs. The simplest way to represent a set is by listing its members. We use the notation

On the expressive power of temporal logic

Repeated multiplication is represented using exponential notation, for example:

Experiment 6: Friction

Unit 29: Inference for Two-Way Tables

CS99S Laboratory 2 Preparation Copyright W. J. Dally 2001 October 1, 2001

RIGHT TRIANGLES AND THE PYTHAGOREAN TRIPLETS

Lesson 2.1 Inductive Reasoning

Unit 6: Exponents and Radicals

How fast can we sort? Sorting. Decision-tree model. Decision-tree for insertion sort Sort a 1, a 2, a 3. CS Spring 2009

COMPLEX FRACTIONS. section. Simplifying Complex Fractions

Brillouin Zones. Physics 3P41 Chris Wiebe

Angles 2.1. Exercise Find the size of the lettered angles. Give reasons for your answers. a) b) c) Example

Module Summary Sheets. C3, Methods for Advanced Mathematics (Version B reference to new book) Topic 2: Natural Logarithms and Exponentials

Small Business Networking

Protocol Analysis / Analysis of Software Artifacts Kevin Bierhoff

Small Business Networking

On decidability of LTL model checking for process rewrite systems

Basic Research in Computer Science BRICS RS Brodal et al.: Solving the String Statistics Problem in Time O(n log n)

Distributions. (corresponding to the cumulative distribution function for the discrete case).

Geometry 7-1 Geometric Mean and the Pythagorean Theorem

Solving the String Statistics Problem in Time O(n log n)

5.2. LINE INTEGRALS 265. Let us quickly review the kind of integrals we have studied so far before we introduce a new one.

2 DIODE CLIPPING and CLAMPING CIRCUITS

Generating In-Line Monitors For Rabin Automata

Transcription:

Forml Lnguges nd Automt Exm Fculty of Computers & Informtion Deprtment: Computer Science Grde: Third Course code: CSC 34 Totl Mrk: 8 Dte: 23//2 Time: 3 hours Answer the following questions: ) Consider the lnguge S *, where S = { }. Write out ll the words in S * tht hve seven or fewer letters. Cn ny word in this lnguge contin the sustrings or? Why? ) Does the two following two regulr expressions define the sme lnguge: (+) * (+) * (+) * nd * * (+) *? Investigte your nswer. c) Construct regulr expression defining ech of the following lnguges over the lphet = { }: The lnguge of ll strings of 's nd 's in which either the strings re ll 's or else there is n followed y some 's. Lnguge of ll strings of 's nd 's tht t some point contin doule letter. All words tht contin t lest one of the strings s, s 2, s 3 or s 4. 2 ) Let = {,}, drw deterministic finite utomt (DFA) tht recognize, exctly: Lnguge ( (+) * (+)(+) * ) All words with s the third letter nd reject ll other words. All words tht hve different first nd lst letters. ) Drw the corresponding NFA to the following DFA + + (See the next pge)

c) If L is the lnguge recognized y the DFA in the figure, Drw DFA to recognize L', where L' is the complement of L. 3 ) Stte pumping lemm. ) Use pumping lemm to prove tht L = { n n, n } is nonregulr. c) Define the lnguge EQUAL to hve only the words with the sme totl numer of 's nd 's. Does EQUAL nonregulr lnguge? Prove your nswer. 4) ) Define wht we men y decidle prolem. ) Is there n effective procedure to determine the finiteness of lnguge of finite utomte? Stte it, if ny. c) Write the context free grmmr tht genertes L = { n n, n } 5 ) Define PALINDROMEX s the lnguge of ll words of the form sxreverse(s). Construct deterministic pushdown utomt tht ccept this lnguge. ) Define ODDPALINDROME to e the lnguge of ll strings of 's nd 's tht re plindromes nd hve n odd numer of letters. Construct nondeterministic pushdown utomt tht ccept this lnguge.

Model Answer Forml Lnguges nd Automt Exm Fculty of Computers & Informtion Deprtment: Computer Science Course code: CSC 34 Totl Mrk: 8 Dte: 23//2 Time: 3 hours ) Consider the lnguge S *, where S = { }. Write out ll the words in S * tht hve seven or fewer letters. Cn ny word in this lnguge contin the sustrings or? Why? The words of length less thn 7 re: : contins no fctors, : contins one fctor,,, : contins 2 fctors,,,,,,,: contins 3 fctors All words contins 4 or more fctors hve length 8. The lnguge words cn't contin neither nor. The reson is the locks tht uild the words re only 2. These 2 locks strt with nd end with or vice vers. So, the result of comintion yields only,,, or. ) Does the two following two regulr expressions define the sme lnguge: (+) * (+) * (+) * nd * * (+) *? Investigte your nswer. Yes. Both of them denote ll the words with t lest two 's. c) Construct regulr expression defining ech of the following lnguges over the lphet = { }: The lnguge of ll strings of 's nd 's in which either the strings re ll 's or else there is n followed y some 's.

The lnguge of ll strings of 's nd 's tht t some point contin doule letter. All words tht contin t lest one of the strings s, s 2, s 3 or s 4. * + * or equivlently ( +) * (+) * (+)(+) * (+) * (s +s 2 +s 3 +s 4 )(+) *

2 ) Let = {, }, drw deterministic finite utomt tht recognize exctly the following: Lnguge ( (+) * (+)(+) * ) +, All words with s the third letter nd reject ll other words.,,, +, All words tht hve different first nd lst letters. + +

) Drw the corresponding NFA to the following DFA + +, + + OR, + c) If L is the lnguge recognized y the DFA in the figure, Drw DFA to recognize L', where L' is the complement of L. ±

3 ) Stte pumping lemm. Let L e ny regulr lnguge tht hs infinitely mny words. Then there exist some three strings x, y, z (where y is not the null string) such tht ll the strings of the form xy n z L, n =, 2, 3, ) Use pumping lemm to prove tht L = { n n, n } is nonregulr. Assume the contrry, i.e. L is regulr Hence, y pumping lemm, x, y, z such tht xyz, xyyz L We differentite mong 3 cses of y: y constitute of only 's: We hve xyz contins the sme numer of 's nd 's So, xyyz contins numer of 's igger thn numer of 's So, xyyz L But xyyz L, which is contrdiction. y constitute of only 's: Sme rgument s ove. y constitutes of equl numer of 's nd 's: To e xyz L, y must equls to p p, for some p So yy = p p p p Now xyyz = x p p p p z L, which is contrdiction. The contrdictions show tht L is nonregulr.

c) Define the lnguge EQUAL to hve only the words with the sme totl numer of 's nd 's. Does EQUAL nonregulr lnguge? Prove your nswer. EQUAL is nonregulr ecuse { n n } = * * EQUAL We know tht * * is regulr lnguge nd the set of regulr lnguge is closed under intersection. Hence EQUAL cn't e regulr.

4) ) define wht we men y decidle prolem. An effective solution to prolem tht hs yes or no nswer is clled decision procedure. A prolem tht hs decision procedure is clled decidle. ) Is there n effective procedure to determine the finiteness of lnguge of finite utomte? Stte it, if ny. Yes. ssume tht the finite utomton hs N sttes Test ll words of length p on the mchine, where N p < 2 N If t lest one of these words ccepted then the lnguge is infinite Else if ll these words consumed t nonfinl sttes then the lnguge is finite. c) Write the context free grmmr tht genertes L = { n n, n } G = ({S}, {,}, {S S}, S)

5 ) Define PALINDROMEX s the lnguge of ll words of the form sxreverse(s). Construct deterministic pushdown utomt tht ccept this lnguge. Any deterministic pushdown utomt equivlent to the following is sufficient: OR

) Define ODDPALINDROME to e the lnguge of ll strings of 's nd 's tht re plindromes nd hve n odd numer of letters. Construct nondeterministic pushdown utomt tht ccept this lnguge. Any nondeterministic pushdown utomt equivlent to the following is sufficient: