0% found this document useful (0 votes)
20 views27 pages

Ch 2 Part 1 - Deterministic Finite Automata

Uploaded by

kingshukpaul82
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)
20 views27 pages

Ch 2 Part 1 - Deterministic Finite Automata

Uploaded by

kingshukpaul82
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/ 27

Finite Automata

Languages
Deterministic Finite Automata
Representations of Automata

1
Informal Explanation
 Finite automata are finite collections
of states with transition rules that
take you from one state to another.
 Original application was sequential
switching circuits, where the “state”
was the settings of internal bits.
 Today, several kinds of software can
be modeled by FA.
2
Representing FA
 Simplest representation is often a
graph.
 Nodes = states.
 Arcs indicate state transitions.
 Labels on arcs tell what causes the
transition.

3
Example: Protocol for
Sending Data

timeout
data in
Ready Sending

Start ack

4
Alphabets
 An alphabet is any finite set of
symbols.
 Examples: ASCII, Unicode, {0,1}
(binary alphabet ), {a,b,c}.

5
Strings
 The set of strings over an
alphabet Σ is the set of lists, each
element of which is a member of Σ.
 Strings shown with no commas, e.g.,
abc.
 Σ* denotes this set of strings.
 ε stands for the empty string
(string of length 0).
6
Example: Strings
 {0,1}* = {ε, 0, 1, 00, 01, 10, 11,
000, 001, . . . }
 Subtlety: 0 as a string, 0 as a
symbol look the same.
 Context determines the type.

7
Languages
 A language is a subset of Σ* for
some alphabet Σ.
 Example: The set of strings of 0’s and
1’s with no two consecutive 1’s.
 L = {ε, 0, 1, 00, 01, 10, 000, 001,
010, 100, 101, 0000, 0001, 0010,
0100, 0101, 1000, 1001, 1010, . . . }

8
Deterministic Finite
Automata
 A formalism for defining
languages, consisting of:
1. A finite set of states (Q, typically).
2. An input alphabet (Σ, typically).
3. A transition function (δ, typically).
4. A start state (q0, in Q, typically).
5. A set of final states (F ⊆ Q, typically).
 “Final” and “accepting” are synonyms.
9
The Transition Function
 Takes two arguments: a state and
an input symbol.
 δ(q, a) = the state that the DFA
goes to when it is in state q and
input a is received.

10
Graph Representation of
DFA’s
 Nodes = states.
 Arcs represent transition function.
 Arc from state p to state q labeled by all
those input symbols that have transitions
from p to q.
 Arrow labeled “Start” to the start
state.
 Final states indicated by double
circles.
11
Example: Graph of a DFA
Accepts all strings without two consecutive 1’s.

0 0,1
1 1
A B C

Start 0
Previous Previous Consecutive
string OK, String OK, 1’s have
does not ends in a been seen.
end in 1. single 1.
12
Alternative
Representation: Transition
Table
Final states
starred Columns =
0 1 input symbols
*A A B
Arrow for *B A C
start state C C C

Rows = states

13
Classwork
Draw transition diagram for DFA
accepting all strings with a substring 01

14
Classwork
Draw transition diagram for DFA
accepting all strings with a substring 01

Answer:

15
Extended Transition
Function
 We describe the effect of a string
of inputs on a DFA by extending δ
to a state and a string.
 Induction on length of string.
 Basis: δ(q, ε) = q
 Induction: δ(q,wa) = δ(δ(q,w),a)
 w is a string; a is an input symbol.

16
Extended δ: Intuition
 Convention:
 … w, x, y, x are strings.
 a, b, c,… are single symbols.
 Extended δ is computed for state q
and inputs a1a2…an by following a
path in the transition graph,
starting at q and selecting the arcs
with labels a1, a2,…,an in turn.
17
Example: Extended Delta
0 1
A A B
B A C
C C C

δ(B,011) = δ(δ(B,01),1) = δ(δ(δ(B,0),1),1) =

δ(δ(A,1),1) = δ(B,1) = C

18
Delta-hat
 In book, the extended δ has a
“hat” to distinguish it from δ itself.
 Not needed, because both agree
when the string is a single symbol.
˄ ˄
 δ(q, a) = δ(δ(q, ε), a) = δ(q, a)

Extended deltas

19
Language of a DFA
 Automata of all kinds define
languages.
 If A is an automaton, L(A) is its
language.
 For a DFA A, L(A) is the set of strings
labeling paths from the start state to
a final state.
 Formally: L(A) = the set of strings w
such that δ(q0, w) is in F. 20
Example: String in a
Language
String 101 is in the language of the DFA below.
Start at A.

0 0,1
1 1
A B C

Start 0

21
Example: String in a
Language
String 101 is in the language of the DFA below.
Follow arc labeled 1.
0 0,1
1 1
A B C

Start 0

22
Example: String in a
Language
String 101 is in the language of the DFA below.

Then arc labeled 0 from current state B.


0 0,1
1 1
A B C

Start 0

23
Example: String in a
Language
String 101 is in the language of the DFA below.
Finally arc labeled 1 from current state A. Result
is an accepting state, so 101 is in the language.
0 0,1
1 1
A B C

Start 0

24
Example – Concluded
 The language of our example DFA
is:
{w | w is in {0,1}* and w does not
have
two consecutive 1’s}
Such that… These conditions
about w are true.
Read a set former as
“The set of strings w…
25
Regular Languages
 A language L is regular if it is the
language accepted by some DFA.
 Note: the DFA must accept only the
strings in L, no others.
 Some languages are not regular.
 Intuitively, regular languages “cannot
count” to arbitrarily high integers.

26
Example: A Nonregular
Language
L1 = {0n1n | n ≥ 1}
 Note: ai is conventional for i a’s.
 Thus, 04 = 0000, e.g.
 Read: “The set of strings consisting
of n 0’s followed by n 1’s, such
that n is at least 1.
 Thus, L1 = {01, 0011, 000111,…}
27

You might also like