0

Prove that for every regular language $L$, the following language is regular:

$L_{pf}=$ $\{x \in L | $ no proper prefix of $x$ is in $L\}$

How should I prove this?

I understood that $L_{pf}$ is just subset of $L$ and the words inside it are special such that no word is the prefix of other one, is this right ? it's not hard if I have the words in $L$ to prove this, but how to generalise it ?

John L.
  • 38,985
  • 4
  • 33
  • 90
MR.-c
  • 197
  • 9

2 Answers2

1

Take a DFA for $L$. Make every exiting transition from a final state go to a non-final sink state instead. (Proof details left to you)

Nathaniel
  • 15,071
  • 2
  • 27
  • 52
1

Let $L' = \{xx'\,|\,x\in L\,\&\,|x'|>0\}$. Your language $L_{pf} = L\setminus L'$, so constructing DFA for $L'$ solves your task, since you can use the closure properties.

Consider a DFA $A$ recognizing $L$. Let $F$ be the set of the final states of $A$. Add a new final state $q_T$ to $A$ and for every final $q_i\in F$ and every terminal $s$ add the transitions $(q_i, s, q_T)$ to your automaton. Finally, make all the states in $F$ non-final. You get an NFA recognising words with the proper prefixes in $L$, and in order to use the closure properties you need to apply a determinisation algorithm. Afterwards, construct the complement and the intersection.

Tonita
  • 565
  • 3
  • 7