Let D = (Q, Σ, δ, q0, F) be a DFA. How do we construct a new DFA D' from D such that L(D' ) = { w ∈ Σ* : wβ ∈ L(D) for some β ∈ Σ*}
that is L(D' ) contains every string w that is a prefix of some string in L(D).
Let D = (Q, Σ, δ, q0, F) be a DFA. How do we construct a new DFA D' from D such that L(D' ) = { w ∈ Σ* : wβ ∈ L(D) for some β ∈ Σ*}
that is L(D' ) contains every string w that is a prefix of some string in L(D).
Copyright © 2021 JogjaFile Inc.
Welcome to MSE!
Hint:
A word is in $L(D)$ if it ends in an accepting state.
So if you want $w$ to be a prefix of some word in $L(D)$, what can we say about the end state of $w$?
Well, if $w\beta \in L(D)$ that means if we start where $w$ ended and then follow $\beta$, we find ourselves in an accepting state.
Can you show the converse? That is, if there is a path to an accepting state from wherever $w$ ends up, then $w$ is a prefix of a word in $L(D)$?
Once you've shown this, you'll know that $D'$ should accept a word if and only if that word can see an accepting state in $D$. Do you see a way to modify $D$ in order to make it have this behavior?
I hope this helps ^_^