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

VTU 21CS51 ATC Module 1 Automata Part

Automata Theory and Compiler Design Module 1 notes which includes the following: 1. DFA, NFA, epsilon-NFA 2. Conversion from NFA and epsilon-NFA to DFA 3. Minimization of DFA

Uploaded by

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

VTU 21CS51 ATC Module 1 Automata Part

Automata Theory and Compiler Design Module 1 notes which includes the following: 1. DFA, NFA, epsilon-NFA 2. Conversion from NFA and epsilon-NFA to DFA 3. Minimization of DFA

Uploaded by

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

ATC Module 1

Syllabus:

1) Introduction to Automata Theory:


(i) Central Concepts of AT
(ii) Deterministic Finite Automata
(iii) Non-Deterministic Finite Automata
(iv) Epsilon NFA
(v) NFA to DFA conversion
(vi) Minimization of DFA

2) Introduction to Compiler Design:


(i) Language Processors
(ii) Phases of Compilers

Points to Remember:

1) Not much theory to remember here. Focus solely on the problems.


Although that can be said about the entire subject.
2) Compiler Design part of this module is very scoring so make sure to
not skip this.
3) A little difficult to trust previous year papers as the scheme is very
different now including the fact that this subject is now 2 separate
subjects combined together.
Definitions (2021, 2022, 2023)

 An alphabet in automata theory refers to a finite set of symbols from which


strings are formed. For instance, in a binary alphabet, we have only two symbols:
0 and 1. Similarly, in an alphabet of English letters, we have symbols from 'a' to
'z'.
 A string is a finite sequence of symbols chosen from an alphabet. For example, if
our alphabet is {0, 1}, then "10110" and "000" are both strings over this alphabet.
 The length of a string is the number of symbols it contains. For instance, the
string "10110" has a length of 5, and the string "000" has a length of 3.
 Concatenation is the operation of joining two strings end-to-end to form a new
string. For example, if we have two strings "101" and "011", their concatenation
would result in "101011".
 Reversal is the operation of flipping the order of symbols in a string. For instance,
if we reverse the string "10110", we get "01101".
 Replication/Power involves repeating a string a certain number of times. For
example, if we replicate the string "abc" three times, we get "abcabcabc".
 In the context of automata theory, a language is a set of strings over a given
alphabet. For example, if our alphabet is {0, 1}, then the language {0, 1, 00, 11,
000, 111, ...} consists of all possible binary strings of any length.
 The cardinality of a set is the number of elements in that set. In the context of
languages, the cardinality refers to the number of strings in the language. For
example, if a language contains only the string "0", its cardinality is 1. If it
contains "0" and "1", its cardinality is 2.

Finite Automata

A finite automaton (plural: finite automata) is a mathematical model used in computer


science and automata theory to recognize patterns within strings. It consists of a finite
set of states, an alphabet, a transition function, a start state, and one or more final
states.

Here's a breakdown of its components, also called the 5 tuples of finite automata:
Finite Set of States(k/Q): These are the distinct states the automaton can be in at any
given time. Each state represents a particular condition or situation of the system.

Alphabet(∑): This is a finite set of symbols from which strings are formed. The
automaton reads input strings symbol by symbol from this alphabet.

Transition Function(δ): This function dictates how the automaton moves from one
state to another based on the current state and the input symbol being read. It defines
the behavior or rules of the automaton.

Start State(S): This is the initial state where the automaton begins processing input
strings.

Final State/Accepting State(F/A): These are the states where the automaton ends up
after processing an input string. If the automaton reaches any of these states after
reading the entire input string, it accepts the string as part of its language.

Finite automata come in two main types: deterministic finite automata (DFAs) and
nondeterministic finite automata (NFAs).

Deterministic Finite Automata (DFA) (2022, 2023)

A DFA is a 5 tuple notation indicating the following:

M = (Q, ∑, δ, S, F)
where,
M is the name of the machine
Q is non-empty, finite set of states
∑ is non-empty, finite set of input alphabets
δ is a transition function which is a mapping of Q x ∑ to Q which is denoted
by δ : Q x ∑ to Q
S ϵ Q and is the initial state
F ϵ Q and is a non-empty set of all final states.

Deterministic- Exactly 1 transition for every input from any given state.
Finite- Has finite number of states and edges.
Automata- A machine that will either accept or reject a string.

Steps to construct a DFA for a given language

1) Identify the alphabets.


2) Identify the minimum string.
3) Draw the skeleton from the minimum string.
4) Add the remaining transitions of the alphabets on the skeleton.
5) If required, add a trap state.
6) Identify the start state and final state.
7) Draw the final diagram of the DFA.
8) Write the 5 tuple notation for the DFA.

Steps to solve Divisible by k problem

1) Identify the radix (r) input and divisor (k).


2) Compute the possible reminder (i) which represents the states of DFA.
3) Find the transition δ (qi, a) = qj where j = (r * i + d) mod k
4) Construct a DFA using the transitions obtained by Step 3.

(Solved problems attached towards the end)


Non-Deterministic Automata (NFA)

A Non-Deterministic Finite Automaton (NFA) is a type of finite automaton that


operates with less strict rules compared to a deterministic finite automaton (DFA). In
an NFA, for a given state and input symbol, there can be multiple possible next states
or even no next state at all. This non-deterministic behavior allows for more flexibility
in recognizing languages, but it also increases complexity. It has the same 5 tuple
notation as a DFA:

M = (Q, ∑, δ, S, F)
where,
M is the name of the machine
Q is non-empty, finite set of states
∑ is non-empty, finite set of input alphabets
δ is a transition function which is a mapping of Q x ∑ to Q which is denoted
by δ : Q x ∑ to Q. Here there can be multiple transitions of the same state and same
alphabet and there also is an option for “no move”
S ϵ Q and is the initial state
F ϵ Q and is a non-empty set of all final states.

Steps to construct an NFA for a given language

1) Identify the alphabets.


2) Identify the start state.
3) Add all the transitions one after the other in any given order.
4) Identify the final state(s).
5) Write the 5 tuple notation for the NFA.
Conversion of NFA to DFA

1) Identify the start state.


2) Identify the input.
3) Identify the transitions on the DFA from the NFA.
4) Draw the DFA using the transitions.
5) Identify the final state.

NFA with epsilon transitions

A Non-Deterministic Finite Automaton with epsilon transitions (NFA-ε) is an


extension of a standard NFA where transitions can occur not only based on input
symbols but also by consuming epsilon (ε), which represents an empty string or no
input. This allows for more flexibility in the transitions between states, potentially
simplifying the representation of certain languages.

Minimization of DFA using Table Filling Algorithm

 Indistinguishable States: Indistinguishable states are states in a finite automaton


that behave identically with respect to input strings. This means that, regardless
of the input string being processed, the automaton transitions to the same states
from indistinguishable states, and they accept or reject the same set of input
strings.

 Distinguishable States: Distinguishable states are states in a finite automaton


that exhibit different behavior with respect to input strings. This means that, for at
least one input string, the automaton transitions to different states from
distinguishable states, and they accept or reject different sets of input strings.
The Table-Filling algorithm is one method used to minimize a deterministic finite
automaton (DFA). Here are the steps involved in using this algorithm:

Initialize the Table: Create a table where each cell corresponds to a pair of states
from the DFA. Initially, mark cells corresponding to final and non-final state pairs as
"X" (distinguishable).

Iterative Refinement:

Step 1: For each pair of states (p, q), if p is a final state and q is not a final state, or
vice versa, mark the cell (p, q) as "D" (distinguishable).
Step 2: Repeat the following until no new cells are marked:
For each pair of states (p, q) where p and q are not marked:
For each input symbol a in the alphabet:
Let x be the state reached from p by input symbol a, and y be the state reached from q
by input symbol a.
If the cell (x, y) is marked as "D", mark the cell (p, q) as "D" (distinguishable).

Minimization: Merge all pairs of states that are not marked as "D" to form the
minimized DFA. Each merged group of states represents an equivalent state in the
minimized DFA.

Finalization: Update the transitions of the minimized DFA based on the merged
states.
Designate the initial state and final states of the minimized DFA according to the
original DFA.

Result: The minimized DFA obtained after merging equivalent states represents an
equivalent DFA that accepts the same language as the original DFA but with a
minimized number of states.

You might also like