This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: ECS 120: Introduction to the Theory of Computation Homework 5 Problem 1. Describe the language of the following CFG grammar S → aSb  bY  Y a , Y → bY  aY  . To describe the language of this grammar we first notice that row (2) above is a grammar that can derive any string over { a,b } . Then, row (1) is a grammar that can generate the following types of strings over { a,b } : • All strings that begin with a b , i.e. L 1 = L ( b ( a ∪ b ) * ); • All strings that end with an a , i.e. L 2 = L (( a ∪ b ) * a ); • All strings that start with n a ’s, follow with any string from L 1 or L 2 above and end with n b ’s, i.e. L 3 = { a n } ( L 1 ∪ L 2 ) { b n } ,n ≥ 0. Thus, L ( G ) = L 1 ∪ L 2 ∪ L 3 . It is easy to see that w = a n b n 6∈ L ( G ) for any n ≥ 0, since if w ∈ L ( G ) and w starts with an a then w will either have a different number of a ’s than b ’s or a b will precede an a . Moreover it is easy to prove that any string over { a,b } not equal to...
View
Full
Document
This note was uploaded on 04/29/2010 for the course ECS 222 taught by Professor Mr. during the Spring '10 term at UC Davis.
 Spring '10
 mr.

Click to edit the document details