Prove that the set of regular languages is a proper subset of the set of the context-free languages

StackOverflow https://stackoverflow.com/questions/4652839

문제

I was brushing up (not homework)on some computation-theory and came accross this problem:

How can you prove that the set of regular languages is a proper subset of the set of the context-free languages.

Now I know a language is regular iff it is accepted by a finite automaton.

And I know a language is context-free iff it is accepted by a pushdown automaton.

But I'm not sure of what solution is.

도움이 되었습니까?

해결책

Any DFA is equivalent to a PDA which happens to never push anything onto its stack, therefore all regular languages are also context-free. More formally:

A DFA is defined as a 5-tuple (Σ,S,s0,δ,F) consisting of the input alphabet, set of states, start state, transition table, and set of final (accepting) states.

A PDA is defined as a 7-tuple, including all the elements of a DFA, plus two additional parameters: Γ (the stack alphabet), and Z (the initial stack symbol). A PDA transition table is somewhat different from a DFA transition table: each transition can depend on both the input symbol and current stack symbol, and the transitions may push or pop from the stack.

So by introducing a dummy stack alphabet consisting of a single symbol, it's trivial (though somewhat annoying and long-winded to write out!) to map the DFA transition table (state, input) -> state to an equivalent PDA transition table (state, input, stack) -> (state, stack).

To complete the proof of a proper subset relationship: there exist languages which are context-free, but not regular, so the regular languages form a proper subset of the context-free languages. Example: the language of strings consisting of balanced parentheses.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top