Theory of Automata & Formal Languages

Finite Automata

DFA Definition

: A DFA is 5-tuple or quintuple M = (Q,

∑

,

δ

, q

0

, A) whereQ is non-empty, finite set of states.

∑

is non-empty, finite set of input alphabets.

δ

is transition function, which is a mapping from Q x

∑

to Q.q

0

∈

Q is the start state.A

⊆

Q is set of accepting or final states.

Note: For each input symbol

a

, from a given state there is exactly one transition (there can beno transitions from a state also) and we are sure (or can determine) to which state themachine enters. So, the machine is called

deterministic

machine. Since it has finite number of states the machine is called Deterministic finite machine or Deterministic Finite Automatonor Finite State Machine (FSM).The language accepted by DFA is

L(M) = { w | w

∈

∑

* and

δ

*(q

0

, w)

∈

A }The non-acceptance of the string

w

by an FA or DFA can be defined in formalnotation as:L(M) = { w | w

∈

∑

* and

δ

*(q

0

, w)

∉

A }

DFA to accepting strings of a’s and b’s starting with the string ab

Fig.2.7 Transition diagram to accept string ab(a+b)*

So, the DFA which accepts strings of a’s and b’s starting with the string

ab

is givenby M = (Q,

∑

,

δ

, q

0

, A) whereQ = {q

0

, q

1

, q

2

, q

3

}

∑

= {a, b}q

0

is the start stateA = {q

2

}.

δ

is shown the transition table 2.4.

←Σ→

δ

a b

→

q

0

q

1

q

3

q

1

q

3

q

2

q

2

q

2

←

S t a t e s

→

q

3

q

3

q

3

q

2

a,b

q

2

q

1

q

0

a b

q

3

aa,bb

2

Draw a DFA to accept string of 0’s and 1’s ending with the string 011.

Obtain a DFA to accept strings of a’s and b’s having a sub string aaObtain a DFA to accept strings of a’s and b’s except those containing the substring aab.

Obtain DFAs to accept strings of a’s and b’s having exactly one a,

Obtain a DFA to accept strings of a’s and b’s having even number of a’s and b’s

The machine to accept even number of a’s and b’s is shown in fig.2.22.

q

3

q

1

q

2

q

0

1 00011 10

q

2

q

1

b

q

0

a aba,b

q

3

a ba

q

2

q

1

q

0

a,bbba

q

1

q

0

b a,ba

q

2

ba

q

1

b

q

0

a,a

q

1

b

q

0

ba a

q

3

b

q

2

ba a

q

4

a,

3Fig.2.22 DFA to accept even no. of a’s and b’s

Regular language

Definition

: Let M = (Q,

∑

,

δ

, q

0

, A) be a DFA. The language L is regular if thereexists a machine M such that L = L(M).

Applications of Finite Automata

String matching/processingCompiler Construction

The various compilers such as C/C++, Pascal, Fortran or any other compiler aredesigned using the finite automata. The DFAs are extensively used in the buildingthe various phases of compiler such asLexical analysis (To identify the tokens, identifiers, to strip of thecomments etc.)Syntax analysis (To check the syntax of each statement or control statementused in the program)Code optimization (To remove the un wanted code)Code generation (To generate the machine code)

Other applications

The concept of finite automata is used in wide applications. It is not possible tolist all the applications, as there are infinite numbers of applications. This sectionlists some applications:1. Large natural vocabularies can be described using finite automaton whichincludes the applications such as spelling checkers and advisers, multi-language dictionaries, to indent the documents, in calculators to evaluatecomplex expressions based on the priority of an operator etc. to name afew. Any editor that we use uses finite automaton for implementation.2. Finite automaton is very useful in recognizing difficult problems i.e.,sometimes it is very essential to solve an un-decidable problem. Eventhough there is no general solution exists for the specified problem, usingtheory of computation, we can find the approximate solutions.

q

1

q

0

b

q

2

baab

q

3

baa

Filters

1 hundred reads

1 thousand reads

Sathiyaseelan Thiru ⓋⓛⓅ liked this

Osama Alvi liked this

Mocin ⎝⎲⏝⎲⎠ liked this

RenatoDosSantosLeal liked this

Safaa Alradadi liked this

Anirudh Taklu Kaushik liked this

Divya Vidhyadharan liked this

Beso Al-tameme liked this

scribd