0% found this document useful (0 votes)
24 views23 pages

Lec 5

Uploaded by

huzaifa ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views23 pages

Lec 5

Uploaded by

huzaifa ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 23

FINITE

AUTOMATA
DFA
2
FINITE AUTOMATA

• Yet Another Method for Defining


Languages

• FAs and Their Languages


3
DEFINITION

• A finite automaton is a collection of three things:

1. A finite set of states, one of which is designated as the


initial state, called the start state, and some (maybe
none) of which are designated as final states.

2. An alphabet Σ of possible input letters.

3. A finite set of transitions that tell for each state and for
each letter of the input alphabet which state to go
next.
4
HOW DOES A FINITE
AUTOMATON WORK?
• It works by being presented with an input string
of letters that it reads letter by letter starting
from the leftmost letter.

• Beginning at the start state, the letters


determine a sequence of states.

• This sequence ends when the last input letter


has been read

• We will use the term FA for the phrase “finite


automaton”.
5
NOTE

• It may be noted that to indicate the initial state,


an arrow head can also be placed before that
state
• And final state with double circle.

• It is also to be noted that while expressing an
FA by its transition diagram, the labels of
states are not necessary.
6
STATES
7
STATES
8
ABSTRACT DEFINITION OF FA

1. A finite set of states Q = {q 0, q1, q2 q3 …}


of which q0 is start state.

2. A subset of Q called final state (s).

3. An alphabet ∑ = { x1, x2, x3, …}.

4. A transition function δ associating each


pair of state and letter with a state:
δ(q,xj)
9
TRANSITION DIAGRAMS
• Pictorial representation of an FA gives us more of a feeling for the motion.

• We represent each state by a small circle.

• We draw arrows showing to which other states the different input letters will lead
us. We label these arrows with the corresponding input letters.

• If a certain letter makes a state go back to itself, we indicate this by a loop.

• We indicate the start state by a minus sign, or by labeling it with the word start.

• We indicate the final states by plus signs, or by labeling them with the word final.

• Sometimes, a start state is indicated by an arrow, and a final state is indicated by


drawing another circle around its circle.
10
TRANSITION DIAGRAMS
CONTD.
• When we depict an FA as circles and arrows, we say that we
have drawn a directed graph.

• We borrow from Graph Theory the name directed edge, or


simply edge, for the arrow between states.

• Every state has as many outgoing edges as there are


letters in the alphabet.

• It is possible for a state to have no incoming edges or to


have many.
11
DFA

Examples
12
ANY NO.OF A’S

• Consider a FA that contains any no. of ‘a’


13
(A+B)*

• Consider the Language L, defined over Σ = {a,


b} of all strings including Λ.

• The language L may also be accepted by the


following FA
14
STARTING WITH B

• Consider the language L of strings, defined over


Σ={a, b}, starting with b
15
DEAD/ TRAP/REJECTING STATE
16
ENDING WITH ‘A’

• Consider the language L of strings,


defined over Σ={a, b}, ending in a
17
NOT BEGINNING WITH ‘B’

• The language of strings, defined over Σ ={a,


b}, not beginning with b
18
BEGINNING AND ENDING WITH
SAME LETTERS
• Consider the Language L of Strings of length
two or more, defined over Σ = {a, b},
beginning with and ending in same
letters
19
CONTAINING DOUBLE ‘A’

• Consider the Language L of strings , defined


over Σ = {a, b}, containing double a
20
HAVING “00” OR ‘11”

• Consider the language L of strings, defined over


Σ={0, 1}, having double 0’s or double 1’s,
21
22
TRANSITION TABLE

• The transition list can be summarized in a table


format in which each row is the name of one of
the states, and each column is a letter of the
input alphabet.
• For example, the transition table for the FA
above is
23
EXAMPLE

• One of many FAs that accept all words is

• Here, the ± means that the same state is both a start


and a final state.
• The language for this machine is
(a + b)*

You might also like