Context-Free Grammars & Languages

Answer & solution
Official answer: B; C; D
B concatenates two even-palindrome languages and is context-free. C is all binary strings, since w may be empty. D is exactly the even palindromes: wx xR wR=(wx)(wx)R, and x may be empty. A is not context-free. Here is a pumping argument that accounts for empty w and x rather than merely calling the dependencies crossed. Its intersection with 0+1+0+1+ consists of 0a 1b0c1d satisfying either a=c and b-d is a nonnegative even integer, or b=d and c-a is a nonnegative even integer. This follows by examining where w and x split the first half: either w=0a 1k and x=1d, or w=0a and x=1b0k. The word 0p1p0p1p belongs. A pumping window of length at most p meets at most two adjacent blocks. Pumping a piece crossing a boundary creates extra runs when repeated. Otherwise pumping changes only those adjacent block lengths. If both change, use upward pumping for blocks 1/2 or 3/4 and downward pumping for blocks 2/3 to violate both conditions. If only one changes, increase block 1 or 4, or decrease block 2 or 3. Every possible pumping decomposition thus has a failing exponent. Closure under regular intersection proves A is not context-free. Answer B, C, D.
Constructive positive proofs: let E→0E0|1E1|ε generate even palindromes. For B use start H→EE, concatenating two such words. For C use H→0H|1H|ε, since taking w=ε yields arbitrary x. For D use E again, because the concatenated first half wx is arbitrary. These grammars establish membership instead of relying only on a visual impression of symmetry; A requires the non-CFL argument above.