An extended transition function
The difference between a simple transition function and the extended transition function is that the former performs a transition of a single character/instance. In contrast, the latter performs the transitions on a complete string.
A recursive algorithm is used to reach the final state, which is as follows:
Base condition:
Recursion rule:
Here,
The input string is reduced from the right side, character by character, until the base condition—when all the strings are reduced and we are left with a null character (epsilon)—is reached. Then simple transitions are applied to the broken down string.
A transition table is formed to show each transition in the DFA. If the output is a final state, the given string will be accepted by the DFA.
Suppose a DFA of the following type:
The transition table will be of the following sort:
a | b | |
-> q0 | q1 | q0 |
q1 | q1 | q2 |
*q2 | q1 | q0 |
Let's take an input string
We remove the rightmost characters one by one using the recursion rule:
Here, when the last character is separated, we are left with epsilon by default:
Next, we use the base condition:
We use the transition table to change the states according to the input:
The last transition is as follows:
Since q2 is a final state, the DFA accepts the string abab.
In contrast, if we take a string
We remove the rightmost characters one by one using the recursion rule:
We use the base condition:
We use the transition table to get the following:
Since q1 is not a final state, the DFA doesn't accept the string
Free Resources