Finite Automata2
Finite Automata2
A Finite State Machine (FSM) or finite state automaton is an abstract machine used in the study
of computation and language that has only a finite, constant amount of memory.
Finite Automata
o Finite automata are used to recognize patterns.
o It takes the string of symbol as input and changes its state accordingly. When the desired
symbol is found, then the transition occurs.
o At the time of transition, the automata can either move to the next state or stay in the
same state.
o Finite automata have two states, Accept state or Reject state. When the input string is
processed successfully, and the automata reached its final state, then it will accept.
Formal Definition of FA
A finite automaton is defined as 5-tuples (Q, Σ, δ, q0, F). where, Q is finite non-empty set of
states, Σ is finite non-empty set of input d alphabets, δ is transition function which maps Q × Σ
into Q, q0 is initial state and q0 ∈ Q, F is set of final states and F ⊆ Q.
For DFA: Q × Σ → Q
For NFA: Q × Σ → 2Q
Deterministic Finite Automaton (DFA) In DFA, for each input symbol, one can determine the
state to which the machine will move. Hence, it is called Deterministic Automaton. As it has a
finite number of states, the machine is called Deterministic Finite Machine or Deterministic
Finite Automaton.
q0 is the initial state from where any input is processed (q0 ∈ Q).
In the following image, we can see that from state q0 for input a, there are two next states q1 and
q2, similarly, from q0 for input b, the next states are q0 and q1. Thus it is not fixed or determined
that with a particular input where to go next. Hence this FA is called non
non-deterministic
deterministic finite
automata.
NFA also
lso has five states same as DFA, but with different transition function, as shown follows:
δ: Q x ∑ →2Q
Transition Diagrams
A transition diagram is a finite directed labelled graph in which each vertex represents a
state and directed edges indicate the transition from one state to another. Edges are
labelled with input/output. In this, the initial state is represented by a cir
circle
cle with an arrow
towards it, the final state is represented by two concentric circles and intermediate states
are represented by just a circle.
1. The finite automaton M1 has three states, labeled q1, q2, and q3; since these are the labels
found in the three circles. Thus, Q = { q1, q2, q3 }
2. The input symbols for M1 are 0 and 1, as these are the only labels found on the arrows
that represent the transitions. Thus, Σ = { 0, 1 }.
3. The start state is q1, the state shown with an unlabeled input arrow coming
from nowhere.
4. The only state marked with the double circle is q3, so F = {q3}.
5. Transitions:
d(q1, 0 ) = q2 d(q1, 1 ) = q1
d(q2, 0 ) = q2 d(q2, 1 ) = q3
d(q3, 0 ) = q2 d(q3, 1 ) = q1