0% found this document useful (0 votes)
5 views

Notes Module 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Notes Module 1

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

21CS51 Automata Theory and Compiler Design

Notes for Module 1

Automata theory is the study of different types of formal


automata or machines which have applications in
computer science. For example, finite state machines or
finite automata are used in the design of hardware such
as sequential logic, registers and processors. Finite
automata are used in compilers for recognizing tokens
such as identifiers, keywords, literal and operators.
Pushdown automata or automata with a single stack are
used for checking the syntax of a written program and
understanding it. That is, the program is checked for
errors and target code is generated. Automata theory is
thus a core subject in computer science.

An automaton is used in general to accept a language. A


language is made up of symbols.

Alphabet
An alphabet is a finite non-empty set of symbols. It is
usually denoted by the Greek capital letter ∑. Typical
examples of alphabets are the binary alphabet {0, 1} and
the set of lower case English letters {a, b, c, ..., z}.

String
A string is a finite sequence of symbols from an alphabet.
It is usually denoted by w. The length of a string w,
denoted |w|, is the number of symbols in the sequence
w. For example |abc| = 3 and |01001| = 5. We also have
the empty string containing no symbol (or 0 symbols),
which is denoted by the Greek letter ͼ (epsilon). |ͼ| = 0.

Power of an Alphabet
If n ≥ 0 is an integer, ∑n represents the set of all strings
using ∑ as the alphabet. Note that ∑0 = {ͼ}. Now, the set
of all strings over ∑, represented as ∑* is defined as ∑0 U
∑1 U ∑2 U ∑3 U ∑4 ... where U represents set union
operator.

Language
A language over an alphabet is a set of strings using that
alphabet. That is, a language L over ∑ is given by L
subset of ∑*. Note that L can be either finite or infinite.
An example of a finite language over {0, 1} is {01, 11,
0011, 000011} and an example of an infinite language
over {0, 1} is L = {w | w has the same number of 0’s as
1’s}

Finite Automata
Finite Automata are associated with regular expressions.
The language accepted by a finite automaton can be
represented as a regular expression. Similarly, a regular
expression that represents a language can be converted
to a finite automaton which accepts that language.

Languages and Problems


Associated with every language is a decision problem. If
w is a string, and L is a language, there is a decision
problem whether x in L. This problem has an yes or no
answer.
Decision problems are special cases of general
computational problems. A general computational
problem can be approximately worded using a decision
problem. For example, instead of computing the radius of
a sphere, we can ask questions like is the radius greater
than 10 cm?

Simple and Powerful Automata


Automata try to decide some decision problems. That is
each automaton can accept a language. The simplest
kinds of automata we study are finite automata. The next
type of automata which are more powerful and can
accept more types of languages are called pushdown
automata. The most powerful automata are Turing
machines. Turing machines can do whatever any general
computer can do. However there are some problems
which even Turing machines cannot solve. These are
called undecidable problems.
Finite Automata
A finite automaton is an automaton or machine which
can exist in only one of a finite number of states at any
given time.
Deterministic Finite Automata
A deterministic finite automaton or DFA has a finite set
of states Q, an alphabet ∑, a state transition function δ,
an initial or start state q0, and a set of final states F \
subset Q. In other words, a DFA D = (Q, ∑, δ, q0, F) is a
5-tuple. The transition function δ, can be represented by
a transition diagram or a transition table. For ever state
and a symbol, there is a single next state.

Example of DFA
The following transition diagram represents a DFA which
recognizes all strings which contain 101 as a substring.

Shown below is the transition table.

Write your answers neatly on sheets of full size paper by hand.

Questions:

1. Define and explain the following terms:


a. Alphabet
b. String
c. Empty String
d. Concatenation
e. Power of an alphabet
f. Language
2. What is a Decision Problem? What is the connection between a
Language and a Decision Problem? How are general Computational
Problems related to Decision Problems?

3. What do you understand by a Deterministic Finite Automaton (DFA)?

4. Give DFAs for recognizing the following languages over {0, 1}: (Give
both the transition diagram and the transition table.)
a. The set of all strings with an even number of 0’s.
b. The set of all strings with an even number of 1’s and an odd
number of 0’s.
c. The set of all strings containing 01 as a substring.
d. The set of all strings NOT containing 101 as a substring.
e. The set of all strings which when treated as a binary number is
a value divisible by 3.
f. The set of all strings containing the same number of 0’s as 1’s.

5. Give DFAs for recognizing the following languages over the alphabet of
lower case English letters {a, b, c, ..., z}: (Transition table is not
needed.)
a. The language L = {anil}
b. The language L = {anil, amit, anita, sunil}
c. The set of all strings containing sem as a substring.

You might also like