The document discusses deterministic finite automata (DFAs) and regular languages. It provides examples of DFA transition graphs that accept specific strings and languages. A DFA is formally defined as a 5-tuple with sets of states and inputs, a transition function, initial state, and accepting states. A string is accepted if the DFA ends in an accepting state after reading the entire input string. The languages accepted by all possible DFAs form the class of regular languages. Some examples of regular languages are provided, and it is noted that there are also non-regular languages that cannot be accepted by any DFA.
3. Costas Busch - LSU 3
Transition Graph
initial
state
accepting
state
state
transition
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
4. Costas Busch - LSU 4
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
},{ ba
For every state, there is a transition
for every symbol in the alphabet
Alphabet
5. Costas Busch - LSU 5
Initial Configuration
1q 2q 3q 4qa b b a
5q
a a bb
ba,
Input String
a b b a
ba,
0q
Initial state
Input Tape
head
6. Costas Busch - LSU 6
Scanning the Input
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
7. Costas Busch - LSU 7
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
8. Costas Busch - LSU 8
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b b a
ba,
9. Costas Busch - LSU 9
0q 1q 2q 3q 4qa b b a accept
5q
a a bb
ba,
a b b a
ba,
Input finished
Last state determines the outcome
10. Costas Busch - LSU 10
1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
0q
A Rejection Case
Input String
11. Costas Busch - LSU 11
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
12. Costas Busch - LSU 12
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
a b a
ba,
13. Costas Busch - LSU 13
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
reject
a b a
ba,
Input finished
Last state determines the outcome
14. Costas Busch - LSU 14
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
)(
Another Rejection Case
Tape is empty
reject
Input Finished (no symbol read)
15. Costas Busch - LSU 15
Language Accepted: abbaL
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
This automaton accepts only one string
16. Costas Busch - LSU 16
To accept a string:
all the input string is scanned
and the last state is accepting
To reject a string:
all the input string is scanned
and the last state is non-accepting
17. Costas Busch - LSU 17
Another Example
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
abbaabL ,,
Accept
state
Accept
state
Accept
state
18. Costas Busch - LSU 18
)(
Empty Tape
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
accept
Input Finished
19. Costas Busch - LSU 19
Another Example
a
b ba,
ba,
0q 1q 2q
Accept
state
trap state
20. Costas Busch - LSU 20
a
b ba,
ba,
0q 1q 2q
a ba
Input String
27. Costas Busch - LSU 27
a
b ba,
ba,
0q 1q 2q
ab b
reject
Input finished
28. Costas Busch - LSU 28
Language Accepted: }0:{ nbaL n
a
b ba,
ba,
0q 1q 2q
29. Costas Busch - LSU 29
Another Example
0q 1q
1
1
}1{Alphabet:
Language Accepted:
even}isand:{ *
xxxEVEN
},111111,1111,11,{
30. Costas Busch - LSU 30
Formal Definition
Deterministic Finite Automaton (DFA)
FqQM ,,,, 0
Q
0q
F
: set of states
: input alphabet
: transition function
: initial state
: set of accepting states
31. Costas Busch - LSU 31
Set of States Q
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
543210 ,,,,, qqqqqqQ
ba,
Example
32. Costas Busch - LSU 32
Input Alphabet
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba, ba,
ba,
:the input alphabet never contains
Example
33. Costas Busch - LSU 33
Initial State 0q
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
Example
34. Costas Busch - LSU 34
Set of Accepting States QF
0q 1q 2q 3qa b b a
5q
a a bb
ba, 4qF
ba,
4q
Example
35. Costas Busch - LSU 35
Transition Function QQ :
q q x
qxq ),(
Describes the result of a transition
from state with symbolq x
36. Costas Busch - LSU 36
2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q 1q
10, qaq
Example:
37. Costas Busch - LSU 37
50, qbq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
38. Costas Busch - LSU 38
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
32, qbq
39. Costas Busch - LSU 39
a b
0q
1q
2q
3q
4q
5q
1q 5q
5q 2q
5q 3q
4q 5q
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,5q5q
5q5q
Transition Table for
states
symbols
40. Costas Busch - LSU 40
Extended Transition Function
QQ **
:
qwq ),(*
Describes the resulting state
after scanning string from statew q
41. Costas Busch - LSU 41
20
*
, qabq
3q 4qa b b a
5q
a a bb
ba,
ba,
0q 1q 2q
Example:
42. Costas Busch - LSU 42
50
*
, qabbbaaq
1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
0q
43. Costas Busch - LSU 43
41
*
, qbbaq
0q 1q 2q 3q 4qa b b a
5q
a a bb
ba,
ba,
44. Costas Busch - LSU 44
Special case:
qq ,*
for any state q
45. Costas Busch - LSU 45
qwq ,*
q qw
q q
kw 21
1 2 k
states may be repeated
In general:
implies that there is a walk of transitions
46. Costas Busch - LSU 46
Language accepted by DFA :
Language Accepted by DFA
it is denoted as and contains
all the strings accepted by
ML
M
M
MLWe also say that recognizesM
47. Costas Busch - LSU 47
For a DFA
Language accepted by :
FqQM ,,,, 0
M
FwqwML ,: 0
**
0q qw Fq
48. Costas Busch - LSU 48
Language rejected by :
FwqwML ,: 0
**
M
0q qw Fq
49. Costas Busch - LSU 49
0q
More DFA Examples
ba,
},{ ba
*
)( ML
0q
ba,
}{)( ML
Empty language All strings
50. Costas Busch - LSU 50
1q
ba,
},{ ba
0q ba,
}{)( ML
Language of the empty string
51. Costas Busch - LSU 51
ML = { all strings with prefix }ab
a b
ba,
0q 1q 2q
accept
ba,3q
ab
},{ ba
54. Costas Busch - LSU 54
*
,:)( bawawaML
a
b
ba,
a
b
b
a
0q 2q 3q
1q
55. Costas Busch - LSU 55
Regular Languages
Definition:
A language is regular if there is
a DFA that accepts it ( )
The languages accepted by all DFAs
form the family of regular languages
L
M LML )(
56. Costas Busch - LSU 56
abba abbaab,,
}0:{ nban
{ all strings in {a,b}* with prefix }ab
{ all binary strings without substring }001
Example regular languages:
There exist DFAs that accept these
languages (see previous slides).
*
,: bawawa
even}isand}1{:{ *
xxx
}{ }{
*
},{ ba
57. Costas Busch - LSU 57
There exist languages which are not Regular:
}0:{ nbaL nn
There are no DFAs that accept these languages
(we will prove this in a later class)
}n
,1z,1y,1x:{ mn
km
zyxADDITION k