Question: new _ trans nfa qs Type: ( ' q , ' s ) nfa _ t - > ' q list - > ( '
newtrans nfa qs
Type:qs nfat q list q list, s transition list
Description: The inputs are an NFA and a list of states. The output is a transition list. Each element in the returned list is a tuple in the form of src char, dest where dest is the list of states you can get to after starting from any state in the inputted list and moving on one character of the alphabet sigma followed by any number of epsilon transitions. This may seem a little confusing at first, so make sure you look at the examples below!
Examples:
type qs transi q s option q
type qs nfay sigma : s list; qs : q list; q : q; fs : q list; delta : qs transi list;
let nfa sigma z; qs ; ; ; q; fs ; delta Some z; None,
let dfasigma z; y; x; qs ; ; ; q; fs ; delta Some z; Some y; Some x;;
transFresh nfa Some z;
transFresh dfa; ; Some z; ; Some y; ; Some x
transFresh dfa; ; Some z; ; Some y; ; Some x
Explanation:
Starting from state in nfa we can move only to state on z and then from state to state on epsilon, which gives us the tuple Some z; z is the only character in the alphabet. So we return Some z;
Starting from either state or state in dfa we want to see where we can move to If we start at we can move to on z and if we start at there isn't an z transition. There are no states we can move to from via epsilons because it's a DFA so we have the tuple ; Some z Then, starting again from either state or state we can move to on y from and there isn't a y transition from to another state. There are no states we can move to from via epsilons, so we have the tuple ; Some y Then, starting again from either state or state we can move to on x from and there isn't a x transition from to another state. There are no states we can move to from via epsilons, so we have the tuple ; Some x So our overall returned list is ; Some z; ; Some y; ; Some x
Starting from either state or state in dfa there is no z transition that starts from either state or state So we have ; Some z Then, starting again from either state or state we can move to on y from and there isn't a y transition from to another state. There are no states we can move to from via epsilons because it's a DFA so we have ; Some y Then, starting again from either state or state we can move to state on x from and there isn't a x transition from to another state. There are no states we can move to from via epsilons, so we have ; Some x So our overall returned list is ; Some z; ; Some y; ; Some x
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
