0% found this document useful (0 votes)
5 views57 pages

3. Section 2.1

The document provides an overview of finite automata, specifically focusing on Deterministic Finite Acceptors (DFA). It explains the structure of a DFA, including its states, transition functions, and how it processes input strings to determine acceptance or rejection. Additionally, it discusses constructing DFAs for specific languages and introduces the concept of regular languages.

Uploaded by

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

3. Section 2.1

The document provides an overview of finite automata, specifically focusing on Deterministic Finite Acceptors (DFA). It explains the structure of a DFA, including its states, transition functions, and how it processes input strings to determine acceptance or rejection. Additionally, it discusses constructing DFAs for specific languages and introduces the concept of regular languages.

Uploaded by

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

CS 3186

Finite Automata
Section 2.1

1
Automaton
(Accepter)

2
Automata
(Basic classification)

Automata as an Acceptor
Automata Control unit is a state machine
defined by a finite number of states
Storage: No temporary storage

Finite Acceptor is an acceptor with


finite number of states and no
external storage.

3
Finite Accepter

4
Deterministic Finite Accepter (DFA)

DFA:
• finite number of states
• no external storage
• Deterministic configurations

Deterministic: From any state, on the current


input, the contents of temporary storage
(current configuration), the next state (next
configuration) is uniquely defined by one state.
5
Formalities
Deterministic Finite Accepter (DFA)
M = (Q, ,, q0,F)

Q: set of final states


q0: initial state, q0Q
 : transition function
 : input alphabet
F : set of states, F  Q

6
Example
 = {a,b}
Q = {q0, q1, q2, q3, q4, q5}
Initial sate = q0
Final state = {q4}
: Q X   Q
Transition function defines the next state of the control unit
For example:
(q0, a)= q1
(q0, b)= q5

7
DFA
A deterministic automaton is one in which each move is
uniquely determined by the current configuration. If we
know the internal state, the input, we can predict the
future behavior of the automaton exactly.
(For example, from state q0 on input b, the next state is
q5; defined by (q0, b)= q5)

A nondeterministic automaton may have several possible


moves, so we can have a set of possible actions.
(For example, from state q0 on input b, the next state can
be q4 or q5; defined by (q0, b)= {q4,q5})

The relation between deterministic and nondeterministic


automata of various types will play a significant role in our
study. 8
Transition Function Representation
(Transition Graph)

Transition Graphs constructed as follows:


• Vertices represent states
• Directed edges represent transitions
– Label an edge is current input symbol
– Directed edge (q.r) with label a if and only if (q, a)= r

9
Transition Graph
Example of Finite Accepter

10
Finite Acceptor

Deterministic Finite Accepter (DFA) Operation

Start with the initial State


While input exists,
CurrentState =  (CurrentState, CurrentInput)
If CurrentState  F then Accept else Reject

11
Transition Function 
can be represented as a
Transition Table or as Transition Graph

12
Example 1: DFA operation on an input string

13
Reading the Input

14
15
16
17
18
Example 2: DFA rejection on a string

19
20
21
22
23
Example 3: DFA operation – another rejection

24
25
Extended Transition Function

26
Extended Transition Function *
The Extended Transition Function * gives the
state of the automaton after reading a string

27
Examples of extended transition functions

28
29
Observation - Walk
Observation: There is a walk from q to q’
with label w

30
Example - Walk
Example: with label abbbaa

31
Recursive Definition

32
Recursive definition - Example

33
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}

34
Examples of L(M)
L(M) = {abba} given the following M

35
Formal definition of L(M)
For a DFA M = (Q, ,, q0,F)

Language accepted by M
L(M) = {w  * | *(q0,w)  F}

36
Another Observation
For a DFA M = (Q, ,, q0,F)

Language rejected by M
𝐿(𝑀) = {w  * | *(q0,w) F}

37
Constructing a DFA
Given a given a description of the language in
words, Construct a DFA.

• We have to employ “reasoning” or “logic” similar


to solving a programming problem in Java.
• The logic will be slightly tedious as we have to
think in terms of the capability of the DFA.
• Start with the initial state.
• Each state has some meaning to it. i.e., we are
“remembering” some information in this state.
Constructing a DFA (Continued)
Given a given a description of the language in
words, Construct a DFA.
• Construct all other possible states for all
possible inputs with an eye on accepting strings in
the given language.
• Define state transitions based on intuitive logic.
Determine the final states that accepts the
language.
• Give a complete description of
M=(Q, ,, q0,F)
Constructing a DFA (Example)
Construct a DFA to accept the language L={abba}
Over  = {a,b}

Note:
• The DFA should only accept only the string in the
language.
• The DFA should account for all possible inputs
over  = {a,b}. i.e., any string from
*={,a,b,aa,ab,ba,bb,aaa,aba,abb…abba,abbb…}
• The DFA has to account for the infinite number
of strings with finite number of states. (Our
thinking process would be similar to designing an
algorithm for programming in Java)
Constructing a DFA (Examples)
.
Constructing a DFA (Example 1)
.
Constructing a DFA (Example 2)
L(M) = {,ab,abba}
(Note that the automaton M has F= {q0,q2,q4}

43
Constructing a DFA (Example 3)
M accepts all strings consisting of
arbitrary numbers of a’s followed by a
single b. In set notation,

L(M) = {anb|n  0}

44
Constructing a DFA (Example 4)
M accepts all strings consisting of arbitrary
numbers of a’s followed by a single b. In set
notation,

L(M) = {anb|n  0}

Note: A trap state is a state from which the automaton can never
“escape”.
45
Constructing a DFA (Example 5)
L(M)={all strings with prefix ab}

46
L(M)={all strings with prefix ab}

47
Constructing a DFA (Example 6)
L(M) = { all strings with substring 001}
 = {0,1}

48
Another Example
L(M) = { all strings with substring 001}
 = {0,1}

49
Constructing a DFA (Example 7)
L(M) = { all strings without substring 001}
 = {0,1}

50
Classification or Hierarchy or Family
Languages can be classified based on certain
properties of Grammar or Automata.
All the languages which is accepted by some
finite automaton are classified as a family
of languages. These are referred to as
Regular languages.
We will discuss corresponding hierarchy with
Grammars in the next chapter.
We will discuss the other level in the
language hierarchy later in the course.

51
Regular Languages

A language L is regular if there is


a DFA M such that L = L(M)

To refer to a given language as Regular, one


needs to describe a FSA, M that accepts
precisely that language.

52
Examples of regular languages
{abba}
{, ab, abba}
{anb|n  0}
{all strings with prefix ab}
{all strings that contain ab}
{all strings without substring 001}

There exist automata that accept these Languages.

53
Another example of a Language
The language L = {awa|w{a,b}*}
is regular. i.e., all strings that begin and end
with an “a”.

L=L(M)

54
Non regular languages
There exist languages which are not Regular
Example: L ={anbn|n  0}

There is no DFA that accepts such a


language

We will prove this later in the class

55
Homework 2.1
I) Do exercises : #1 to #6

II) Do exercises : #7 (a to c), #8 (a), #11 (a,b)

III) Given the alphabet as {0, 1}, write a DFA for the following
regular languages.
(i) Give the complete description of the DFA with transition function
as a table.

(ii) Give two examples in the Language that leads to acceptance.


Describe using the extended transition function on a string (of length
>=4) recursively using transitions one symbol at a time.

(iii) Give two examples that are not in the Language that is not
accepted. Describe using the extended transition function on a string
(of length >=4) recursively using transitions one symbol at a time.

56
Homework 2.1 (continued)
a) L = {w | w has exactly a single 1}
b) L = {w | w has at least one 1}
c) L = {w | w contains the string 01 as a substring}
d) L = {w | w is a string of odd length}
e) L = {w | the length of w is a multiple of three}
f) L = {w | w starts and ends with the same symbol}
g) L = {w | w ends in 11}
h) L = {w | w has at least one pair of consecutive zeroes}
i) L = {w | w has no pair of consecutive zeroes}
j) L = {w | w contains the substring 011}
k) L = {w | w is a string with an even number of 0’s}
l) L = {w | w does not contain the substring 110}
m) L = { w | w does not have even number of 1’s}

57

You might also like