quiz2-solutions-Spring-2007

# quiz2-solutions-Spring-2007 - CS 360 Introduction to the...

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

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 360: Introduction to the Theory of Computing John Watrous, University of Waterloo Solutions to Quiz 2 1. Consider the following language: Middle = { w ∈ { , 1 } * : the length of w is odd, and its middle symbol is 1 } . For example, the strings 1 , 011 , and 1101000 are contained in Middle , while 001 , 1111 , and ε are not. Use the Pumping Lemma (for regular languages) to prove that Middle is not regular. Solution. Assume toward contradiction that Middle is regular. Then by the Pumping Lemma there exists a pumping length n ≥ 1 for Middle , such that, for every w ∈ Middle with | w | ≥ n , it is possible to write w = xyz for strings x,y,z ∈ { , 1 } * satisfying 1. y negationslash = ε , 2. | xy | ≤ n , and 3. xy i z ∈ Middle for all i ≥ . Let w = 0 n 10 n . Then w ∈ Middle and | w | = 2 n + 1 > n , so it is possible to write n 10 n = xyz for strings x , y , and z as above. As | xy | ≤ n it must be that y only includes 0s from w that come before the middle 1. Given that y negationslash = ε , we must therefore have that...
View Full Document

## This note was uploaded on 09/22/2011 for the course CS 360 taught by Professor Johnwatrous during the Spring '08 term at Waterloo.

### Page1 / 3

quiz2-solutions-Spring-2007 - CS 360 Introduction to the...

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

View Full Document
Ask a homework question - tutors are online