You are on page 1of 22

SOFTWARE

CONSTRUCTION
Lecture 05,06
Finite Automata
Finite Automaton

• A Finite automaton (FA), is a collection of the followings


1. Finite number of states, having one initial and some
(maybe none) final states.
2. Finite set of input letters (Σ) from which input strings are
formed.
3. Finite set of transitions i.e. for each state and for each
input letter there is a transition showing how to move
from one state to another.(Each state can have as many
outgoing edges as there are letters in the alphabet set.
There can be no or many incoming edges)
Finite Automaton:
Example
• Σ = {a,b}
• States: x, y, z where x is an initial state and z is final
state.
• Transitions:
1. At state x reading a, go to state z
2. At state x reading b, go to state y
3. At state y reading a, b go to state y
4. At state z reading a, b go to state z
These transitions can be expressed by the following table called
transition table
Pictorial Representation

• Tell whether a,aa,aab,ba, bab accepted


or rejected?
• The above FA accepts the language:

a(a+b)*
Note

• to indicate the initial state, an arrow head can also be


placed before that state and that the final state with
double circle, as shown below.
• while expressing an FA by its transition diagram, the
labels of states are not necessary.
FAs and their language

Acceptance :aa,bb,
What about null ab,ba,aaaa,aabb,…
string ??? Is it part of Rejection: a b aaa
language yes / no bbb aab bab…….
EXAMPLE
• One of the many FAs that accept all words
is
FAs that accept no language
• i) FAs that have no final state
FAs that accept no language
ii) Final state can not be reached from the
start state
Example
• FA that accepts all the words in the
language: a(a+b)*
Example
• What language is accepted by the
following FA.
Example
• Construct a machine that accepts all the
words with b as third letter and reject all
other words i.e.,
Example
• Build an FA that accepts only the word
baa
Example
• Build an FA that accepts only the strings
baa and ab.
Example
• Determine the language accepted by the
following FA

Only the word Λ


Example
• Deduce Language for the following FA
Example
• Consider the language L of strings of
length two or more, defined over ∑ = {a, b}
begining with and ending in same letters.
• R.E= a(a+b)*a + b(a+b)*b
Example
• Suppose we are programmers hired to
write a word processor. As part of this
major program, we must build a subroutine
that scans any given input string of English
letters and spaces and locates the first
occurrence of the substring cat whether it
is a word standing alone or part of a longer
word such as abdicate.
Example
• FA for EVEN-EVEN
Resource/s

• Chapter 5 (Finite Automata), from


“Introduction to Automata Computer
Theory by Daniel I.A Cohen”

You might also like