Homework 4 due 11/25.

Slides:



Advertisements
Similar presentations
Transparency No. 2-1 Formal Language and Automata Theory Homework 3.
Advertisements

Closure Properties of CFL's
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 2670 Introduction to Theory of Computing September 15, 2004.
CS5371 Theory of Computation
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Chap 2 Context-Free Languages. Context-free Grammars is not regular Context-free grammar : eg. G 1 : A  0A1substitution rules A  Bproduction rules B.
Lecture Note of 12/22 jinnjy. Outline Chomsky Normal Form and CYK Algorithm Pumping Lemma for Context-Free Languages Closure Properties of CFL.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
Lecture 3: Closure Properties & Regular Expressions Jim Hook Tim Sheard Portland State University.
104 Closure Properties of Regular Languages Regular languages are closed under many set operations. Let L 1 and L 2 be regular languages. (1) L 1  L 2.
79 Regular Expression Regular expressions over an alphabet  are defined recursively as follows. (1) Ø, which denotes the empty set, is a regular expression.
1 CSCI 3130: Formal Languages and Automata Theory Tutorial 4 Hung Chun Ho Office: SHB 1026 Department of Computer Science & Engineering.
Normal forms for Context-Free Grammars
Transparency No. P2C1-1 Formal Language and Automata Theory Part II Pushdown Automata and Context-Free Languages.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
CS5371 Theory of Computation Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
Regular Languages A language is regular over  if it can be built from ;, {  }, and { a } for every a 2 , using operators union ( [ ), concatenation.
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Chapter 4 Context-Free Languages Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Tutorial CSC3130 : Formal Languages and Automata Theory Haifeng Wan ( )
Context-free Grammars Example : S   Shortened notation : S  aSaS   | aSa | bSb S  bSb Which strings can be generated from S ? [Section 6.1]
Introduction to CS Theory
Midterm 1 Breakdown >79 3 >29 7 >69 5 >19 5 >59 7 >49 9 >39 7.
Context Free Grammars.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
Chapter 4 Pumping Lemma Properties of Regular Languages Decidable questions on Regular Languages.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
Closure Properties Lemma: Let A 1 and A 2 be two CF languages, then the union A 1  A 2 is context free as well. Proof: Assume that the two grammars are.
Chapter 6 Properties of Regular Languages. 2 Regular Sets and Languages  Claim(1). The family of languages accepted by FSAs consists of precisely the.
Review for final pm. 2 Review for Midterm Induction – On integer: HW1, Ex 2.2.9b p54 – On length of string: Ex p53, HW2, HW3.
Non-CF Languages The language L = { a n b n c n | n  0 } does not appear to be context-free. Informal: A PDA can compare #a’s with #b’s. But by the time.
CSCI 2670 Introduction to Theory of Computing September 13.
CS 203: Introduction to Formal Languages and Automata
Pumping Lemma for CFLs. Theorem 7.17: Let G be a CFG in CNF and w a string in L(G). Suppose we have a parse tree for w. If the length of the longest path.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
CSCI 3130: Formal languages and automata theory Tutorial 3 Chin.
Context-Free Languages
Finite Automata Chapter 1. Automatic Door Example Top View.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
Transparency No. 4-1 Formal Language and Automata Theory Chapter 4 Patterns, Regular Expressions and Finite Automata (include lecture 7,8,9) Transparency.
Transparency No. 2-1 Formal Language and Automata Theory Homework 2.
Donghyun (David) Kim Department of Mathematics and Physics North Carolina Central University 1 Chapter 2 Context-Free Languages Some slides are in courtesy.
Algorithms for hard problems Automata and tree automata Juris Viksna, 2015.
Transparency No. 1 Formal Language and Automata Theory Homework 5.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen.
1 A well-parenthesized string is a string with the same number of (‘s as )’s which has the property that every prefix of the string has at least as many.
Theory of Languages and Automata By: Mojtaba Khezrian.
 2005 SDU Lecture11 Decidability.  2005 SDU 2 Topics Discuss the power of algorithms to solve problems. Demonstrate that some problems can be solved.
Transparency No. 1 Formal Language and Automata Theory Homework 6.
Page 1. 1)Let B n = { a k | where k is a multiple of n}. I.e. B 1 = { a k | where k is a multiple of 1} = { a k | k Є {0,1,2,3,…}} = {‘’, a, aa, aaa, aaaa,
CSCE 355 Foundations of Computation
Lecture 22 Pumping Lemma for Context Free Languages
Context free grammar.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
Pushdown Automata Reading: Chapter 6.
Jaya Krishna, M.Tech, Assistant Professor
Context-Free Languages
REGULAR LANGUAGES AND REGULAR GRAMMARS
Context-free Languages
CHAPTER 2 Context-Free Languages
Properties of Context-Free Languages
Subject Name: Finite Automata & Formal Languages Subject Code 10CS56.
Chapter 1 Regular Language - 02
Recap Lecture 4 Regular expression of EVEN-EVEN language, Difference between a* + b* and (a+b)*, Equivalent regular expressions; sum, product and closure.
Presentation transcript:

Homework 4 due 11/25

1. Homomorphism 1. Let A = L(M) where M is the DFA given in the figure, and h be a homomorphism from {a,b}*  {a,b}* with h(a) = ab and h(b) = ba. 1.1 Find a DFA N1 such that L(N) = h(A), 1.2 Find a DFA N2 such that L(N) = h-1(A) Give your answer Using state-transition diagram 2 a b 1 3

2. Pumping lemma and closure properties of regular languages 2. Using (game-theoretical version of ) pumping lemma to show the following two sets are not regular: 2.1 A1 = { x x | x  {0,1}* } 2.2 A2 = {an bm | 0  n  m  2n+10 } Using closure properties of regular languages to show that : 2.3 If A1(the language given at 2.1) is not regular, then neither is the language A3={ xcx | x  {0,1}* } 2.4 If the language Prime={ ap | p is a prime number } is not regular, then neither is the language A4 = { ambnct | (m+n+t) is not a prime number }.

3. Which of the following sets are regular ? Give your reason. 3. Testing Regular sets 3. Which of the following sets are regular ? Give your reason. {an b m | n  0 and m  0 } {an b m | n  m, n  0 and m  0 } {ak y | k  0, y  {a,b}* and y contains at least k a’s } {xcy | x, y  {a,b}* } {an b m | n +10  m } {an bm | n > m and m < 20 } {an b m | n > m > 20 }

4. Elimination of inaccessible states 4. For the given FA, find all states which are inaccessible. 4.1 Draw a state transition diagram for the DFA. 4.2 Draw the state transition diagram for the resulting DFA after removing of inaccessible states. a b 1 1 3 2F 6 5 7 4F 6F 2 8 4

5. Minimization of DFA a b 1 F 6 4 2F 7 5 3 2 8 1 5. Apply the minimization algorithm to find a minimal DFA equivalent to the right one. 5.1 Draw the chart table 5.2 Mark each cell corresponding to a pair {p,q} of states p,q that are not equivalent with a number indicating the length of a minimal string which witnesses their inequivalence. 5.3 Draw a state-transition table (or diagram) for the resulting DFA and indicate clearly which equivalence class of the old DFA corresponds to each state of the new one. a b 1 F 6 4 2F 7 5 3 2 8 1 2 3 4 5 6 7 8 1

6. Consider the following context free grammar G: 6. CFG and CFL 6. Consider the following context free grammar G: C  ABC | AB A  Aa | a B  bA | b 6.1 If G=(N, S, S, P), then N = __________; S = _______________ ; S = ___________ and P = {________________}. 6.2. Define L(X) = {xS* | X*x}. Find 3 regular expressions representing L(A), L(B) and L(C), respectively. 6.3 Which of the following strings are in L(G) ? (a) aabaab (b) aaaaba (c) aabbaa (d) abaaba 6.4 Give a derivation for each of the above strings which are in L(G).

7.1 A1 = {w | w contains at least three 1s.} CFG design 7. Give context-free grammars that generate the following languages. Suppose the alphabet of terminals is {0,1}. 7.1 A1 = {w | w contains at least three 1s.} 7.2 A2 = {w | w starts and ends with the same symbol.} 7.3 A3 = { w | the length of w is odd and its middle symbol is 0.} 7.4 A4 = {w | w contains as many 0s as 1s.} 7.5 A5 = {w  {a,b,c}* | #a(w) + #b(w)  #c(w) }. // #a(w) is the number of a’s occurring in w. 7.6 A6 = {anbnck | 3  k}

8. Let G be the context-free grammar (CFG) given below: S  (S) S | e 8. Verification of CFG 8. Let G be the context-free grammar (CFG) given below: S  (S) S | e Assume the alphabet S = {(, )}. Show that If x  L(G), then x is a balanced parenthesis. If x is a balanced parenthesis, then xL(G). Note that x is a balanced parenthesis iff 1. it has the same number of occurrences of ‘(‘ and ‘)’ and 2. for every proper prefix y of x, occurrences of ‘(‘ in y is no less than occurrences of ‘)’, i.e., L(y)  R(y)).