Can finite automata keep track of history or relevant history?

130 Views Asked by At

I am unable to understand that if I have a Finite automaton which say accepts all the strings that end with ab, now if input given is "aab" now it reads 'a', then it reads second 'a',this implies that it can keep track of all input that it has been read so far . So does that imply that it can track the currently read input symbols read so far?

2

There are 2 best solutions below

0
On

Finite Automaton can only be in one state at a time.It can not store any input string/symbols,due to unavailability of storage space. When finite automaton read an input signal it can only do two things either accept the input and transition to another state or final state or reject the input .

Finite automaton which say accepts all the strings that end with ab

Finite automaton which say accepts all the strings that end with ab

0
On

Finite state automata passes from one state into another, depending on the symbols it encounters on it's input, until it finally arrives in one of it's two terminal states, accepting or rejecting the input string. But along the way, it can keep track of symbols it previously encountered by encoding information about that in it's present state. For example, I will describe the finite-state automata from your question, that accepts all strings ending with 'ab' and rejects all others.

If we denote the state of our automata at time $t$ as $\mathrm{state}_t$, and symbol it encounters at time $t$ at it's input as $\mathrm{input}_t$, we can describe the evolution of our automata as, $$\mathrm{state}_{t+1}=f(\mathrm{state}_t,\mathrm{input}_t)$$ for $t=0,1,\ldots$, until it reaches one of it's two terminal states 'accept' or 'reject'; function $f$ is called the transition function of our finite state automata. The automata will use set of 5 states $\{s_0, s_1, s_2, \mathrm{accept}, \mathrm{reject}\}$, it will start from $\mathrm{state}_0 = s_0$ and we will define it's transition function as $$ \begin{array}{lll} f (s_0, a) = s_1 & f (s_0, b) = s_0 & f (s_0, \mathrm{eol}) = \mathrm{reject}\\ f (s_1, a) = s_1 & f (s_1, b) = s_2 & f (s_1, \mathrm{eol}) = \mathrm{reject}\\ f (s_2, a) = s_1 & f (s_2, b) = s_0 & f (s_2, \mathrm{eol}) = \mathrm{accept} \end{array} $$ In this way, if automata is in the state $s_1$, we know previous symbol was a, if it's in the state $s_2$ we know the last two symbols were 'ab', etc.

We could even make the set of states to be the set of all possible input strings of length up to $n \in \mathbb{N}$, and choose transition function in such a way that the current state of automata will always be equal to the last $n$ symbols that appeared on it's input.