140 likes | 246 Vues
This article explores Nondeterministic Finite Automata (NFA) and regular expressions, focusing on the expression (aab)*(a+aba)* and its processing of the input string "aababa". Through computation trees, we illustrate how the NFA transitions through states via lambda transitions, emphasizing the role of the Kleene star in enabling multiple transitions to accept the input. The interaction between the regular expression and the input string is analyzed step-by-step, showcasing the functionality of NFAs in formal language theory.
E N D
Regular Expression -> NFA with an input string Brian K. Strickland
Λ-NFA for Regular Expression (aab)*(a + aba)* a 1 2 a a b Λ 0 3 a a 4 5 b
Computation Tree for Input String: aababa Λ a a 0 0 a 1 1 4 5 4 4 2 5 a a a b b Λ 3 3 3 3 3 3 3 a a a a b a
Regular Expression: (aab)*(a + aba)*Input String: aababa 2 0 5 5 1 1 0 4 4 4 a Λ 1 2 a a a a a b a a a Λ 3 3 3 3 3 3 3 b b 0 3 Λ a a a a a a b 4 5 b a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 Accepted! 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a Accepted!
Regular Expression: (aab)*(a + aba)*Input String: aababa 1 a Λ 1 2 0 a a a a 1 a b 4 a a a 2 Λ 4 0 Accepted! 3 3 3 3 3 3 3 b b 3 Λ 0 5 a a a a a a 4 b 4 5 b 5 a • The key is the lambda transition from the Kleene star operation (*) which allows the regular expression to transition to the accepting state of the NFA. Accepted!