Context-Free Langs: S-L Check if Not CF?

  • Context: MHB 
  • Thread starter Thread starter evinda
  • Start date Start date
Click For Summary

Discussion Overview

The discussion revolves around the properties of context-free languages (CFL) and regular languages, specifically examining whether the difference between a context-free language S and a regular language L (denoted as S - L) can result in a language that is not context-free. Participants explore closure properties, intersection, and complementation of these language classes.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • Some participants propose that S - L cannot be non-context-free due to closure properties of context-free languages under intersection with regular languages.
  • Others argue that context-free languages are not closed under complementation or intersection, suggesting that the difference between a regular language and a context-free language may not be context-free in general.
  • A participant mentions that S - L can be expressed as S ∩ L^c, where L^c is the complement of L, which is regular.
  • There is a discussion about the relationship between regular languages and context-free languages, with some participants asserting that regular languages are a proper subset of context-free languages.
  • Participants inquire about the logic needed to prove whether S - L is context-free, seeking clarification on how to apply the properties of regular and context-free languages.

Areas of Agreement / Disagreement

Participants express differing views on whether S - L can be non-context-free, with some asserting it cannot due to closure properties while others highlight the lack of closure under complementation. The discussion remains unresolved regarding the implications of these properties on specific language differences.

Contextual Notes

Participants note that the closure properties of context-free languages are relevant to the discussion, particularly concerning intersection and complementation, but do not reach a consensus on the implications for S - L.

evinda
Gold Member
MHB
Messages
3,741
Reaction score
0
Hello! :)
Let S be a context-free language and L a regular language.Is there a case that the language S-L is not context-free?
How can I check this?
 
Technology news on Phys.org
evinda said:
Hello! :)
Let S be a context-free language and L a regular language.Is there a case that the language S-L is not context-free?
How can I check this?

I think that it is not possible that the language S-L is not context-free,because of the closure properties.Am I right?
 
evinda said:
I think that it is not possible that the language S-L is not context-free,because of the closure properties.Am I right?
Yes, the class of context-free languages is closed under intersection with regular languages..
 
Evgeny.Makarov said:
Yes, the class of context-free languages is closed under intersection with regular languages..

Nice... :) and how can I prove this?Could you give me an example?
 
It is proved by combining a pushdown automaton and a deterministic finite automaton similarly to the proof that regular languages are closed under intersection. Namely, the set of states is the Cartesian product of the sets of the two automata, the accepting pairs are those where both states are accepting in their respective automata. Transitions are also done in the same way as in the given automata. That is, both automata are executed in parallel and accept only when both accept. This is described, for example, in Theorem 3.5.4 in "Elements of the Theory of Computation" by Lewis and Papadimitriou.

It is a good exercise to think why this construction does not work for combining two pushdown automata (which are inherently nondeterministic) and thus proving that CFL are closed under intersection (which is not the case).
 
Evgeny.Makarov said:
It is proved by combining a pushdown automaton and a deterministic finite automaton similarly to the proof that regular languages are closed under intersection. Namely, the set of states is the Cartesian product of the sets of the two automata, the accepting pairs are those where both states are accepting in their respective automata. Transitions are also done in the same way as in the given automata. That is, both automata are executed in parallel and accept only when both accept. This is described, for example, in Theorem 3.5.4 in "Elements of the Theory of Computation" by Lewis and Papadimitriou.

It is a good exercise to think why this construction does not work for combining two pushdown automata (which are inherently nondeterministic) and thus proving that CFL are closed under intersection (which is not the case).

To use the closure property of intersection,do I have to use the fact that S-L=S\cap L^{c} ,where L^{c} is the complement of L and is also regular?
 
evinda said:
To use the closure property of intersection,do I have to use the fact that S-L=S\cap L^{c} ,where L^{c} is the complement of L and is also regular?
That's right.
 
Evgeny.Makarov said:
That's right.

Nice,thank you! :) And what's about the language L-S?Is it also context-free and do I have to show it with the same way?
 
evinda said:
And what's about the language L-S?Is it also context-free and do I have to show it with the same way?
Context-free languages are not closed under complementation (nor intersection). And since the language of all words is regular, the difference of regular and CF is not CF in general.
 
  • #10
Evgeny.Makarov said:
Context-free languages are not closed under complementation (nor intersection). And since the language of all words is regular, the difference of regular and CF is not CF in general.

Nice,thank you very much! :) And...merry Christmas! ;)
 
  • #11
evinda said:
And...merry Christmas! ;)
Merci! And same to you!
 
  • #12
Evgeny.Makarov said:
It is proved by combining a pushdown automaton and a deterministic finite automaton similarly to the proof that regular languages are closed under intersection. Namely, the set of states is the Cartesian product of the sets of the two automata, the accepting pairs are those where both states are accepting in their respective automata. Transitions are also done in the same way as in the given automata. That is, both automata are executed in parallel and accept only when both accept. This is described, for example, in Theorem 3.5.4 in "Elements of the Theory of Computation" by Lewis and Papadimitriou.

It is a good exercise to think why this construction does not work for combining two pushdown automata (which are inherently nondeterministic) and thus proving that CFL are closed under intersection (which is not the case).

To show that S-L is context-free,could I also show that each regular language is context-free and that the set of all regular languages is a subset of the set of the context-free languages?So,the difference is only the set of the context-free languages.Or am I wrong?
 
  • #13
Please describe the logic of this argument in greater detail. That is, suppose that we know that regular languages are context-free. How do we use this fact to prove that S - L is context-free?
 
  • #14
Evgeny.Makarov said:
Please describe the logic of this argument in greater detail. That is, suppose that we know that regular languages are context-free. How do we use this fact to prove that S - L is context-free?

From the image:
View attachment 1850
we see that the set of the regular languages is a proper subset of the set of the context-free languages.So,if we subtract the regular language from the context-free one,the set that remains is context-free.Can I say it like that?
 

Attachments

  • Ch_3_1.gif
    Ch_3_1.gif
    2.8 KB · Views: 106
  • #15
evinda said:
the set of the regular languages is a proper subset of the set of the context-free languages.
This is true.
evinda said:
So,if we subtract the regular language from the context-free one,the set that remains is context-free.
And this is a completely different thing. The first quote talks about the difference between the set of context-free languages and the set of regular languages, and the second quote talks about the difference between an individual context-free language and an individual regular language.
 
  • #16
Evgeny.Makarov said:
This is true.
And this is a completely different thing. The first quote talks about the difference between the set of context-free languages and the set of regular languages, and the second quote talks about the difference between an individual context-free language and an individual regular language.

I understand...Thanks a lot! :)
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 3 ·
Replies
3
Views
4K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
3
Views
3K
  • · Replies 0 ·
Replies
0
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K