You are on page 1of 23

Deterministic

Finite Automata

And Regular Languages


Languages Accepted by DFAs
Take DFA M

Definition:
The language L M  contains
all input strings accepted by M

L M  = { strings that drive M to a final state}

Courtesy Costas Busch - RPI 2


Example # 1
L M    abba M

a, b

q5
b a a, b
a b
q0 a q1 b q2 b q3 a q4
accept

Courtesy Costas Busch - RPI 3


Activity
Time
L M     , abba
This automaton accepts only one string

Language Accepted: L  abba 

a, b

q5
a a, b
b a b
q0 a q1 b q2 b q3 a q4

Make it to accept two strings L    , abba


Courtesy Costas Busch - RPI 5
Example # 2
Alphabet:   {1}
1

q0 q1
1
Language Accepted:
EVEN  {x : x   and | x | is even}
*

 { , 11, 1111, 111111, }


Courtesy Costas Busch - RPI 6
Example # 3
L M     , ab, abba M

a, b

q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4
accept accept accept

Courtesy Costas Busch - RPI 7


Activity
Time
What is the output ??
Input
( )

a, b

q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4

Courtesy Costas Busch - RPI 9


( )

Input Finished a, b

q5
b a a a, b
b
q0 a q1 b q2 b q3 a q4

accept
Courtesy Costas Busch - RPI 10
Formally
For a DFA M   Q, ,  , q0 , F 

Language accepted by M :
L M    w  * :  *  q0 , w  F 

q0 w q q  F

Courtesy Costas Busch - RPI 11


Observation
Language rejected by M :

L M    w  * :  *  q0 , w  F 

q0 w q q  F

Courtesy Costas Busch - RPI 12


Regular Languages
Definition:
A language L is regular if there is
a DFA M that accepts it ( L(M )  L )

The languages accepted by all DFAs


form the family of regular languages

Courtesy Costas Busch - RPI 13


Activity
Time
Paper & Pen .. Please
Draw DFAs that accept these languages.

1){ all strings in {a,b}* with prefix ab }


2) { all binary strings containing substring001 }
3){ all binary strings without substring 001 }

4){a n
b : n  0} 
5) awa : w  a , b  * 
6){ } 7){a , b } * 8){  }

9){x : x  {a}* and | x | is even} --DO--


Activity # 1

L M   {a b : n  0}
n

a a,b

q0 b q1 a, b q2

accept trap state

Courtesy Costas Busch - RPI 16


Activity # 2
The language L   awa : w   a, b *
is regular:
a
b
L  L M  b
q0 a q2 q3

b a
q4

a, b
Courtesy Costas Busch - RPI 17
Activity # 3
L M  = { all strings with prefix ab }
a, b

q0 a q1 b q2

b a accept

q3 a, b

Courtesy Costas Busch - RPI 18


Activity # 4
L  M  = { all binary strings containing
substring 001 }

0,1
1 0
1

 0 0 00 1 001
0

Courtesy Costas Busch - RPI 19


Activity # 5
L  M  = { all binary strings without
substring 001 }

1 0 0,1
1

 0 1
0 00 001

0
Courtesy Costas Busch - RPI 20
Activity # 6 & 7
  {a , b }
a, b
a, b

q0 q0

L (M )  { } L (M )   *

Empty language All strings


Courtesy Costas Busch - RPI 21
Activity # 8
  {a , b }

a, b

q0 a, b q0

L (M )  {  }
Language of the empty string
Courtesy Costas Busch - RPI 22
There exist languages which are not Regular:

n n
L {a b : n  0}

ADDITION  {x  y  z : x  1 , y  1 , z  1 , n m k

nm k}

There are no DFAs that accept these languages

(we will prove this in a later class)


Courtesy Costas Busch - RPI 23

You might also like