title: If pref(L) is regular, does that imply L is also regular?
body: <p>I have this exercise for homework:</p>
  
  <blockquote>
    <p>Say we have a language L. we know that the language <code>pref(L)</code> (all the prefixes of <code>L</code>, including all the words in <code>L</code> itself) is a regular language. Does this imply that the language <code>L</code> is regular as well?</p>
  </blockquote>
  
  <p>I took the NFA of <code>pref(L)</code> and divided it (via 2 epsilon transitions from <code>q0</code>) to 2 separate NFA's, as 1 defines <code>L</code> and the other defines <code>pref(L)\L</code>.</p>
  
  <p>What I actually got is a NFA for <code>L</code>, which means it is regular.</p>
  
  <p>I am not sure this is the way or if it legal. I'd be glad for another lead.</p>
  
  <p>Thanks in advance,</p>
  
  <p>Yaron.</p>