You are on page 1of 23

Automata

• A computing machine accepts some input and


produces some output by processing the
input.
• Example, Search engine
• The most simple computing machine is known
as automata
• The primitive kind of automata will not have
any memory element
Languages
• Given an alphabet , we can make a word or string
by concatenating the letters of .

• Concatenation of “x” and “y” is “xy”

• Typical example: ={0,1}, the possible words over 


are the finite bit strings.

• A language is a set of words.


More about Languages
• The empty string  is the unique string with zero
length.

• Concatenation of two langauges:


A•B = { xy | xA and yB }

• Typical examples:
L = { x | x is a bit string with two zeros }
L = { anbn | n  N }
L = {1n | n is prime}
A Word of Warning
Do not confuse the concatenation of languages with
the Cartesian product of sets.

For example, let A = {0,00} then

A•A = { 00, 000, 0000 } with |A•A|=3,

AA = { (0,0), (0,00), (00,0), (00,00) }


with |AA|=4
Recognizing Languages
• Let L be a language  S

• a machine M recognizes L if
“accept” if and only if xL

xS
M
if and only if xL
“reject”
Finite Automaton
The most simple machine that is not just a
finite list of words.

“Read once”, “no write” procedure.

Typical is its limited memory.


Think Thermostat, elevator door, etc.
A Simple Automaton (0)
transition states
rules
0 1

1 0

q1 q2 q3

0,1
starting state
accepting state
A Simple Automaton (1)
0 1

1 0

q1 q2 q3

start 0,1

accept

on input “0110”, the machine goes:


q1  q1  q2  q2  q3 = “reject”
A Simple Automaton (2)
0 1

1 0

q1 q2 q3

0,1

on input “101”, the machine goes:


q1  q2  q3  q2 = “accept”
A Simple Automaton (3)
0 1

1 0

q1 q2 q3

0,1
010: reject
11: accept
010100100100100: accept
010000010010: reject
: reject
Finite Automaton (def.)
• A deterministic finite automaton (DFA)
M is defined by a 5-tuple M=(Q,,,q0,F)

– Q: finite set of states


– : finite alphabet
– : transition function :QQ
– q0Q: start state
– FQ: set of accepting states
Formal Definition of a Finite Automaton
1. Finite set of states, typically Q.
2. Alphabet of input symbols, typically 
3. One state is the start/initial state, typically q0 // q0  Q
4. Zero or more final/accepting states; the set is typically F. // F 
Q
5. A transition function, typically δ. This function
• Takes a state and input symbol as arguments.
• Returns a state.
• One “rule” would be written δ(q, a) = p, where q and p are states, and
a is an input symbol.
• Intuitively: if the FA is in state q, and input a is received, then the FA
goes to state p (note: q = p OK).
6. A FA is represented as the five-tuple: A = (Q, , δ,q0, F).
Here, F is a set of accepting states.
M = (Q,,,q,F)
0 1
states Q = {q1,q2,q3}
1 0

alphabet  = {0,1} q1 q2 q3

start state q1
0,1

accept states F={q2}


0
0 11
transition function :
qq11 qq11 qq22
qq22 qq33 qq22
qq33 qq22 qq22
Operation of the machine
0 0 1 Input Tape

q0 Finite Control

• Read the current letter of input under the


tape head.
• Transit to a new state depending on the
current input and the current state, as
dictated by the transition function.
• Halt after consuming the entire input.
Exercise
1. Construct an automaton for strings that
begin with 0
2. Construct an automaton for even numbers
3. Construct an automaton for numbers
divisible by 4
4. Construct an automaton with at-most 3 a’s
Exercise
5. Consider a ticket vending machine @ a
railway station. Consider that the cost of a
ticket is Rs.3(Assume you use Re1, Rs.2 and
Rs.5 coins). The machine should have the
capability of vending even two tickets at a
time. Can you create a Finite Automata for
this vending machine?
Exercise
6. Construct an automaton to search for
keyword 101
7. Construct an automaton for even number of
a’ s and b’ s
8. Construct an automaton for same symbols in
all odd positions
Exercise 2
9. Binary strings in which every 0 is followed by
11
10.Construct an automaton which Begins with
01 and ends with 01
11.The set of all strings that are palindromes of
length 4. The alphabet is {a,b,c}
Exercise
12.Student grades in an examination are
represented with letters{ A, B , C, D, E, F}. An
input string such as ABFCAD indicates the
grades obtained by a student in 6 different
subjects. The automaton must accept only
those students who have scored at least
three D’s and no F’s.
Exercise
13.Student grades in an examination are
represented with letters{ A, B , C, D, E, F}. An
input string such as ABFCAD indicates the grades
obtained by a student in 6 different subjects.
The automaton must accept only those students
who have scored at least three A’s or B’s(overall)
14.Construct an automaton such that there will be
equal number of a’s and b’s 𝑎𝑛 𝑏𝑛 . Let n=5.
Limitation of Finite Automata
• Can Finite automata solve all computing
problems ?
• We can never implement a computing
machine with an infinite number of states
• If there is no limit on the input size, there is no
solution using simple automata.
• This limitation is stated as inability of
automata to do absolute counting, i.e to count
the number of symbols in it’s input.

You might also like