HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Infinite prefix-closed context-free languages contain an infinite regular subset

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
infinitefreelanguagescontainregularclosedcontextprefixsubset

Problem

The Problem:

Say that a language is prefix-closed if all prefixes of every string
in the language are also in the language. Let C be an infinite,
prefix-closed, context-free language. Show that C contains an infinite
regular subset.

Can we show this by using Myhill-Nerode Theorem?

Solution

Given a normal form grammer $G$ for an infinite prefix-closed $L$, examine the (almost) regular grammer $G'$ obtained by transforming rules of the form $A\rightarrow BC$ into $A\rightarrow B$. I leave it to you to show that $L(G')$ satisfies your requirements.

Context

StackExchange Computer Science Q#139333, answer score: 2

Revisions (0)

No revisions yet.