hw5-sol - ECS 120: Introduction to the Theory of...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 3

hw5-sol - ECS 120: Introduction to the Theory of...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online