Take the 2-minute tour ×
MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

Let $L \subseteq A^\star$ be a formal language over $A$ generated by a context-free grammar, and $L' = A^\star - L$ be the relative complement in $A^\star$.

If $L$ and $L'$ are both context-free, are they necessarily deterministic context-free?

share|improve this question
2  
This is essentially an exact duplicate of mathoverflow.net/questions/51657/… which has an answer. –  Benjamin Steinberg Feb 21 '12 at 22:27
1  
Perhaps you missed my last edit - I removed that part of the question. To clarify, my original question contained the above, as well as a "dual" question concerning the closure of the set of context-free languages w.r.t. finitary Boolean operations. In this question, I'm not looking for the closure of the class of context-free languages with respect to complements, but merely to know if the proper sub-class of CF languages which have CF complements is in fact the class DCF of deterministic CF languages. –  Nick Loughlin Feb 21 '12 at 22:50
1  
Ok no longer a duplicate. –  Benjamin Steinberg Feb 21 '12 at 22:53
1  
In other words, you are asking if $CFL \cap coCFL \subseteq DCFL$ or not. Interesting question. Couldn't find the answer in Hopcroft and Ullman. –  Kaveh Feb 22 '12 at 1:55
1  
@Nick, I rewrote the question to match your comment above as djlewis2 makes a good point. Please re-edit if this was not your intent. –  Benjamin Steinberg Feb 22 '12 at 21:57
show 1 more comment

2 Answers

up vote 4 down vote accepted

It seems that the answer to your question is no. See here.

share|improve this answer
add comment

Your question is a bit unclear, and when we clarify it, it becomes true.

If by "deterministic context-free grammar" you mean, as usual, an LR(k) grammar for some k, then Knuth proved in his seminal paper ("On the translation of languages from left to right", 1965) that the languages defined are the same as those defined by deterministic PDAs. These are the DFCLs, and the DFCLs are closed under complement. So both your L and L' are DFCLs and hence CFLs, and your last premise is redundant.

Your question really comes down to: are the DFCL's closed under complement -- and they are.

share|improve this answer
2  
You are right, but it seems from the discussion that the OP didn’t actually intend to demand $L$ to be DCFL a priori, it may be a typo. –  Emil Jeřábek Feb 22 '12 at 16:55
    
Ah, perhaps. But if so, that's quite a bit more than a typo. He'd simply say "If L is a CFL and L' its complement is also a CFL..." Also, if the question is as you say, then it ~is~ a duplicate of the referenced question, and the answer is "no". Perhaps Nick needs to chime in here. –  David Lewis Feb 22 '12 at 17:53
    
Oh, he accepted that answer -- I guess you are right. –  David Lewis Feb 22 '12 at 17:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.