Для ботов

## Converting Regular Expression to NFA ## Regular Expression to NFA (Non-Deterministic Finite Automata) NFAs are useful to show regular languages are closed under the last three operations union, concatenation, star. A Generalized Nondeterministic Finite Automaton is similar to an NFA but the transition function takes a state and a regular expression in the alphabet instead of a state and an alphabet element. The idea is that in state q 0 the transition to state q 1 can be taken if the next input matches the regular expression Note that there is only one accept state. However, this is no real restriction for a nondetrministic automaton. On the other hand, the transition function is defined on a different arguments than is the case for an ordinary NFA. The definition of the language of a GNFA is technically different than that of an NFA because the transition function is defined differently. However, the idea is really similar, but extended to allow regular expressions on the transitions. Steps 1 and 2 require adding a new start state and a new accepting state. Step 3 require no changes in the diagram except labeling the transitions out of the new start state and into the new accepting state. There are 3 arrows coming into state q 1 from other states: q 0q 2and q 4. To show the first part, if we are given an DFA, we need to show that there is a regular expression that describes exactly the language of the DFA. The construction of the regular expression begins with the DFA and each step will eliminate one state of the DFA until the only state s remaining are the start state and a final state. To show that for any regular expression there is an NFA that recognizes the same language described by the regular expression, the proof describes a procedure for constructing the NFA from the regular expression. What is L3 o L4 concatenation? For example, to eliminate state q 1 in replace each existing path q to q 1 to q ' by a path from q to q ' Label the new path with a regular expression that describes the strings that would cause a transition from state q to q 1 to q ' There are 3 arrows coming into state q 1 from other states: q 0q 2and q 4. If state q 1 is removed, paths must be replaced by new transitions: q 0 to q 2 q 2 to q 2 q 4 to q 2. Eliminating q 1what regular expressions are needed? Convert this DFA to a regular expression that describes the same language. Parse the regular expression into its parts based on the regular expression operator precedence and parentheses used if any to determine the operands of each operator. For each of the operators use the construction described in showing the closure properties of regular languages to construct an NFA for each operator and its operands. See Lemma 1. 