NFA to GNFA, for the same state do we add an epsilon or a phi?

772 Views Asked by At

When converting NFAs to GNFAs (to derive regular expressions), if there's some state that has no connection to the other we add a phi transition.

What about a state to itself. If a state has no transition to itself do we add a phi or an epsilon?

I think following the general rule we would add a phi.

This would mean that "there's no way to get from a state to itself".

But how about an epsilon; it would mean "you can read nothing to go from a state to itself". Which is also true I guess.

Which is correct?

Edit:

In an NFA, an epsilon transition (between two states) would mean that the current state of the NFA can change position to the other state (via the phi transition) without reading any symbols. (for no reason).

In a GNFA, A phi transition (between two states) would mean that there's no direct route between this state and the other. There's no symbol that can let the GNFA directly change its position from the state to the other. This is equivalent to just not having an arrow between the two states. That's why they're usually ommitted.

1

There are 1 best solutions below

0
On BEST ANSWER

What about a state to itself. If a state has no transition to itself do we add a phi or an epsilon?

We add epsilon for no transition from a state to itself, as a FA stays at same state upon reading empty string (unless explicitly defined for NFA).

I think following the general rule we would add a phi. This would mean that "there's no way to get from a state to itself".

This is incorrect. It is like saying after getting in your home, you cannot stay there and, you cannot leave from there because you have lost your memory.

The phi act as annihilator for string concatenation, and used for generating regular expression corresponding to an unreachable state of NFS.