Download presentation
Presentation is loading. Please wait.
1
NFA- to NFA conversion
2
Purpose This presentation presents an example execution of the algorithm which takes as input an NFA with -transitions and produces as output an equivalent NFA without - transitions Algorithm Specification –Input: NFA M 1 with -transitions –Output: NFA M 2 without -transitions
3
Input NFA M 1 with transitions a a bb a,b 1 2 34 5
4
Compute all closures a a bb a,b 1 2 34 5 While this step is not necessary, it does make all future steps simpler. Compute ({i}) for 0 < i < 6 ({1}) = {1,2,3} ({2}) = {2} ({3}) = {3} ({4}) = {4} ({5}) = {5,1,2,3} = {1,2,3,5}
5
Process State 1 a a bb a,b 1 2 34 5 Compute * (1,b) First compute ({1}) ({1}) = {1,2,3} Now compute ({1}),b) (1,b) = {} (2,b) = {4} (3,b) = {3} ({1}),b) = {3,4} Finally compute ( ({1}),a)) = ({3,4}) ({3}) = {3} ({4}) = {4} ( ({1}),b)) = {3,4} * (1,b) = {3,4} Compute * (1,a) First compute ({1}) ({1}) = {1,2,3} Now compute ({1}),a) (1,a) = {} (2,a) = {2} (3,a) = {4} ({1}),a) = {2,4} Finally compute ( ({1}),a)) = ({2,4}) ({2}) = {2} ({4}) = {4} ( ({1}),a)) = {2,4} * (1,a) = {2,4}
6
Process State 2 a a bb a,b 1 2 34 5 Compute * (2,b) First compute ({2}) ({2}) = {2} Now compute ({2}),b) (2,b) = {4} ({2}),b) = {4} Finally compute ( ({2}),b)) = ({4}) ({4}) = {4} ( ({2}),b)) = {4} * (2,b) = {4} Compute * (2,a) First compute ({2}) ({2}) = {2} Now compute ({2}),a) (2,a) = {2} ({2}),a) = {2} Finally compute ( ({1}),a)) = ({2}) ({2}) = {2} ( ({2}),a)) = {2} * (2,a) = {2}
7
Process State 3 a a bb a,b 1 2 34 5 Compute * (3,b) First compute ({3}) ({3}) = {3} Now compute ({3}),b) (3,b) = {3} ({3}),b) = {3} Finally compute ( ({3}),b)) = ({3}) ({3}) = {3} ( ({3}),b)) = {3} * (3,b) = {3} Compute * (3,a) First compute ({3}) ({3}) = {3} Now compute ({3}),a) (3,a) = {4} ({3}),a) = {4} Finally compute ( ({3}),a)) = ({4}) ({4}) = {4} ( ({3}),a)) = {4} * (3,a) = {4}
8
Process State 4 a a bb a,b 1 2 34 5 Compute * (4,b) First compute ({4}) ({4}) = {4} Now compute ({4}),b) (4,b) = {4} ({4}),b) = {5} Finally compute ( ({4}),b)) = ({5}) ({5}) = {1,2,3,5} ( ({4}),b)) = {1,2,3,5} * (4,b) = {1,2,3,5} Compute * (4,a) First compute ({4}) ({4}) = {4} Now compute ({4}),a) (4,a) = {5} ({4}),a) = {5} Finally compute ( ({4}),a)) = ({5}) ({5}) = {1,2,3,5} ( ({4}),a)) = {1,2,3,5} * (4,a) = {1,2,3,5}
9
Process State 5 a a bb a,b 1 2 34 5 Compute * (5,b) First compute ({5}) ({5}) = {1,2,3,5} Now compute ({5}),b) (1,b) = {} (2,b) = {4} (3,b) = {3} (5,b) = {} ({5}),b) = {3,4} Finally compute ( ({5}),b)) = ({3,4}) ({3}) = {3} ({4}) = {4} ( ({5}),b)) = {3,4} * (5,b) = {3,4} Compute * (5,a) First compute ({5}) ({5}) = {1,2,3,5} Now compute ({5}),a) (1,a) = {} (2,a) = {2} (3,a) = {4} (5,a) = {} ({5}),a) = {2,4} Finally compute ( ({5}),a)) = ({2,4}) ({2}) = {2} ({4}) = {4} ( ({5}),a)) = {2,4} * (5,a) = {2,4}
10
Showing All Transitions a a bb a,b 1 2 34 5 a a bb 1 2 34 5 a b b a The initial state of the new NFA is the same as the initial state of the original NFA- .
11
Accepting States a a bb a,b 1 2 34 5 a a bb 1 2 34 5 a b b a First make all original accepting states accepting states: In this case, this means state 5 should be an accepting state Next check to see if ({1}) includes an accepting state In this case, no. Thus, we do not make the initial state an accepting state
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.