Docsity

Assignment Review - Languages and Computation | CS 3240, Assignments of Computer Science

Toggle sidebar
bg1
1.29b
L={www|w∈{a,b}* }
Assume that L is regular, so that the pumping lemma must hold. The lemma says ‘p’
exists. Whatever it is, we can choose s to be apbapbapb where w=ap. Then y should
consist of only a’s since |xy|≤p. The lemma says any pumped strings should belong to
the language. However, with i=0, the string a
p-|y|bapbapb doesn’t belong to L clearly.
This is contradiction. Thus L is non-regular.
1.46a
L={0n1m0n | m,n ≥ 0}
Assume that L is regular. Let the string s = 0p10p. Then y should consist of only 0’s.
With i=0, the string 0p-|y|10p doesn’t belong to L clearly. This is contradiction.
Alternatively, let A={0*10*}. Then A∩B = {0n10n} = C. If we assume A and B to be
regular, then C must be regular. Proving that C is not regular will in turn prove that A is
not regular because B is regular.
1.46c
Assume that L is regular, then its complement, L’ = {w| w∈{0,1}
* is a palindrome},
should be regular. Let the string s = 0p10p = xyz with |xy|≤p and |y|≥1. Then y
should consist of only 0’s. With i=0, the string 0
p-|y|10p is not a palindrome. This is
contradiction. Therefore, L’ is nonregular.
When some language is a regular language, its complement is also regular. Therefore, if
some language L is not regular, its complement is not regular. Since L’ is nonregular, its
complement L is nonregular.
1.46d
L={wtw | w,t ∈ {0,1}+ }
Assume that L is regular. Let the string s = 0p100p1, where w=0p1, t=0. Since |xy|≤p, y
must consist of only 0’s. Let y be 0k where k≥1. Then the string 0p-k+ki100p1 for any i
should belong to L by the pumping lemma. (Here we prove that this is impossible) In
this case, w should end with 1 since the whole string ends with ‘1’. Therefore w must
be 0p-k+ki1. Thus “p≥p-k+ki” should be true to make the number of 0’s in each w same
for any i. However this is not true for i≥2. Thus this is contradiction.
pf2

Partial preview of the text

Download Assignment Review - Languages and Computation | CS 3240 and more Assignments Computer Science in PDF only on Docsity!

1.29b L={www|w∈{a,b}*^ } Assume that L is regular, so that the pumping lemma must hold. The lemma says ‘p’ exists. Whatever it is, we can choose s to be apbapbapb where w=ap. Then y should consist of only a’s since |xy|≤p. The lemma says any pumped strings should belong to the language. However, with i=0, the string ap-|y|bapbapb doesn’t belong to L clearly. This is contradiction. Thus L is non-regular.

1.46a L={0n 1 m 0 n^ | m,n ≥ 0} Assume that L is regular. Let the string s = 0p 10 p. Then y should consist of only 0’s. With i=0, the string 0p-|y| 10 p^ doesn’t belong to L clearly. This is contradiction.

Alternatively, let A={0* 10 *}. Then A∩B = {0n 10 n} = C. If we assume A and B to be regular, then C must be regular. Proving that C is not regular will in turn prove that A is not regular because B is regular.

1.46c Assume that L is regular, then its complement, L’ = {w| w∈{0,1}*^ is a palindrome}, should be regular. Let the string s = 0p 10 p^ = xyz with |xy|≤p and |y|≥1. Then y should consist of only 0’s. With i=0, the string 0p-|y| 10 p^ is not a palindrome. This is contradiction. Therefore, L’ is nonregular.

When some language is a regular language, its complement is also regular. Therefore, if some language L is not regular, its complement is not regular. Since L’ is nonregular, its complement L is nonregular.

1.46d L={wtw | w,t ∈ {0,1}+ } Assume that L is regular. Let the string s = 0p 100 p1, where w=0p1, t=0. Since |xy|≤p, y must consist of only 0’s. Let y be 0k^ where k≥1. Then the string 0p-k+ki 100 p1 for any i should belong to L by the pumping lemma. (Here we prove that this is impossible) In this case, w should end with 1 since the whole string ends with ‘ 1 ’. Therefore w must be 0p-k+ki1. Thus “p≥p-k+ki” should be true to make the number of 0’s in each w same for any i. However this is not true for i≥2. Thus this is contradiction.

1.49b Let the string s = 1p 0 p 1 p. This makes y consist of only 1’s. For i=0, the number of 1’s before 0 becomes fewer than that of 1’s after 0. This doesn’t belong to the original language, thus we have contradiction.

1.55c The minimum pumping length is 1. Since 001 belongs to 0* 1 , it is equivalent with 0 1 *. The empty string cannot be pumped and other nonempty strings can be decomposed into xyz where x=e, y=first alphabet, z=the rest. Therefore the lemma holds.

1.55e The minimum pumping length for (01)*^ is 2. The length can’t be zero since the empty string can not be pumped. Every nonempty string in the language can be decomposed into xyz where x=e, y=01 and z=the rest. This satisfies all conditions of the lemma.