You are on page 1of 18

FORMAL LANGUAGES AND AUTOMATA THEORY

Why Study Automata Theory:

“Finite automata are a useful model for many important kinds of


hardware and software”

Example Case Study:

You are working in a software company and your boss has the idea to
develop a new antivirus system. This program should analyse automatically
any incoming program file and will do the following:
If the program will harm your computer, it will be deleted.
If the program will not harm your computer, it will be started.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL
1
Why Study Automata Theory: (Contd..)

1. Software for designing and checking the behavior of digital circuits

2. The lexical analyzer of a typical compiler; that is, the compiler


component that breaks the input text into logical units, such as
identifiers, keywords, and punctuation

3. Software for scanning large bodies of text, such as collections of


Web Pages to find occurrences of words, phrases, or other patterns

4. Software for verifying systems of all types that have a finite


number of distinct states, such as communications protocols or
protocols for secure exchange of information

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 2
Why Study Automata Theory: (Contd..)

The device remembers whether it is in the “on” state or the “off” state,
and it allows the user to press a button whose effect is different,
depending on the state of the switch.
That is, if the switch is in the off state, then pressing the button
changes it to the on state, and if the switch is in the on state, then
pressing the same button turns it to the off state. In the following, we
defined two states, i.e., off and on and labeled transition ‘push’

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 3
Why Study Automata Theory: (Contd..)

Start state is ‘off’ and it is defined by arrow in the given finite


automaton. It is often necessary to indicate one or more states as final
or accepting states. Final state are defined by double circle. Here
states={t, th, the, then}, in which ‘then’ is a final state. Transition
Labels = {t, h, e,n}

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 4
Structural Representations

There are two important notations that are not automaton like, but play
an important role in the study of automata and their applications:
. 1. Grammars are useful models when designing software that processes data
with a recursive structure.

The best known example is a parser the component of a compiler that deals
with the recursively nested features of the typical programming language,
such as expressions, arithmetic, conditional, and so on.

For instance, a grammatical rule like , EE + E

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL
5
Structural Representations (Contd..)

2. Regular Expressions also denote the structure of data.


When interpreting such expressions, we only need to know that
[A –Z] represents a range of characters from capital A to capital Z
(i.e, any capital letter) and is used to represent the blank character
alone. Also, the symbol * represents “any number of ”, the
preceding expression.

Parentheses are used to group components of the expression they do


not represent characters of the text described.

Ex: a, (a+b), a* , (a+b)* , etc.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 6
Automata and Complexity (Contd..)

Automata are essential for the study of the limits of computation:

What can a computer do at all?

This study is called decidability and the problems that can be solved
by computer are called decidable.

What can a computer do efficiently This study is called intractable


and the problems that can be solved by a computer using no more
time than some slowly growing function of the size of the input are
called tractable.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 7
The Central Concepts of Automata

Alphabet:
An alphabet is a finite, nonempty set of symbols. Conventionally, we use
the
symbol ∑ for an alphabet.
Common alphabets include,
1. ∑ ={0,1}
2. ∑={a, b,….z}
3. The set of all ASCII characters.
Strings
A string or sometimes word is a finite sequence of symbols chosen from some
alphabet.
For example, 011110 is a string from the binary alphabet ∑ ={0,1}.

The Empty String


The empty string is the string with zero occurrences of symbols. This string
‘ ϵBy‘:isDr aK RAJENDRA
denotedPrepared emptyPRASAD,
string.PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 8
The Central Concepts of Automata (Contd..)

Length of a String
Length of a string is the number of symbols in the string
For instance, the string 01101 has length ‘5’
The standard notation for the length of a string w is |w|
Examples: |110| = 3, |10|=2, |11011|=5, |ϵ| = 0
Powers of an Alphabet
If ∑ is an alphabet, we define Example:

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 9
The Central Concepts of Automata (Contd..)

……………………………………………,
{ϵ}

Concatenation of Strings
Let x and y be strings. Then xy denotes the concatenation of x and y, that
Is, the string formed by making a copy of x and following it by a copy of y

Example:
x=101, y=110
xy=101110

Languages

A set of strings all of which are chosen from some , where is a particular
alphabet, is called a language. If is an alphabet, and L , then L is a language
over .

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 10
The Central Concepts of Automata (Contd..)

Languages Examples:

1. The language of all strings consisting of 0’s followed by n 1’s , for some
n ≥0 , {ϵ, 01, 0011, 000111, ……….}

2. The set of all strings of 0’s and 1’s with an equal number of each, {ϵ, 01,
10, 1001,1100,0011,……}

3. The set of binary numbers whose value is prime, {10, 11, 101, 111,
1011, ……..}

4. is a language for any alphabet

5. is the empty language for any alphabet

6. {ϵ}, the language consisting of only the empty string.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 11
Finite Automata

Definition

“The finite automata or finite state machine is an abstract machine which have
five elements or tuple. It has a set of states and rules for moving from one
state to another but it depends upon the applied input symbol. Basically it is
an abstract model of digital computer. Following figure shows some essential
features of a general automation.”

Finite Automata M = { Q, Σ, δ ,q, F, }.

Q : Finite set of states.


Σ : set of Input Symbols.
δ : Transition Mapping Function, Q x Σ  Q
q : Initial state.
F : set of Final States.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 12
Finite Automata

Definition

“The finite automata or finite state machine is an abstract machine which have
five elements or tuple. It has a set of states and rules for moving from one
state to another but it depends upon the applied input symbol. Basically it is
an abstract model of digital computer. Following figure shows some essential
features of a general automation.”

Finite Automata M = { Q, Σ, δ ,q, F, }.

Q : Finite set of states.


Σ : set of Input Symbols.
δ : Transition Mapping Function, Q x Σ  Q
q : Initial state.
F : set of Final States.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 13
Finite Automata

Figure: Features of Finite Automata

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 14
Types of Finite Automata

1. Deterministic Finite Automata (DFA)


2. Non-Deterministic Finite Automata

In a DFA, for a particular input character, the machine goes to one state
only. A transition function is defined on every state for every input
symbol. Also in DFA null (or ε) move is not allowed, i.e., DFA cannot
change state without any input character.

NFA is similar to DFA except following additional features:


1. Null (or ε) move is allowed i.e., it can move forward without reading
symbols.
2. Ability to transmit to any number of states for a particular input .
Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 15
Deterministic Finite Automata (DFA)

Deterministic Finite Automata M = { Q, Σ, δ ,q, F, }.

Q : Finite set of states.


Σ : set of Input Symbols.
δ : Transition Mapping Function, Q x Σ  Q
q : Initial state.
F : set of Final States.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 16
Non-Deterministic Finite Automata (NFA or NDFA)

Non-Deterministic Finite Automata M = { Q, Σ, δ ,q, F, }.

Q : Finite set of states.


Σ : set of Input Symbols.
δ : Transition Mapping Function, Q X (Σ U ε ) --> 2 ^ Q.
q : Initial state.
F : set of Final States.

Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL 17
Prepared By : Dr K RAJENDRA PRASAD, PROFESSOR, DEPT. OF CSE (CS), IARE (Autonomous), NANDYAL
18

You might also like