{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2-solutions - CS 360 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
CS 360 Introduction to the Theory of Computing Spring 2008 Assignment 2 Solutions 1. Prove that the following languages are not regular: 1. A = { x ∈ { 0 , 1 } * : the length of x is odd, and its middle symbol is 1 } Solution: We will use the pumping lemma to show A is non-regular. Assume A is regular. Then there exists a pumping length n 1 such that every string w A , with | w | ≥ n , can be written as w = xyz , where | xy | ≤ n , | y | > 0 , and xy i z A for all i 0 . Let w = 0 n 10 n , | w | = 2 n + 1 > n . Since w has odd length, and its middle symbol is 1, it’s in A . Then consider the decomposition of w as described in the pumping lemma: y is a nonempty susbstring of the first n characters of w . Since w starts with n zeroes, we are guaranteed that y = 0 k for some 1 k n . Then xy 0 z = xz = 0 n - k 10 n must be in A . However, n > n - k (since k > 0 ), and therefore, the middle symbol of the string is not 1 (or, if k = 1 , then the string is not of the odd length), so x / A . Contradiction. A is not regular. 2. B = { 0 n 1 m : n, m 0 are integers with n 6 = m } Solution 1: We will use the pumping lemma to show B is non-regular. Assume B is regular.
Background image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}