Professional Documents
Culture Documents
proceeding:
This document is confidential and intended solely for the educational purpose of
RMK Group of Educational Institutions. If you have received this document
through email in error, please notify the system manager. This document contains
proprietary information and is intended only to the respective group / learning
community as intended. If you are not the addressee you should not disseminate,
distribute or copy through e-mail. Please notify the sender immediately by e-
mail if you have received this document by mistake and delete this document
from your system. If you are not the intended recipient you are notified that
disclosing, copying, distributing or taking any action in reliance on the contents of
this information is strictly prohibited.
21CS503
THEORY OF
COMPUTATION
Department: CSE
Batch/Year: 2021-24/ III Yr
Created by:
Date: 05.08.2023
Table of Contents
S.NO Topic Page No.
1. Course Objectives 6
2. Pre-Requisites 7
3. Syllabus 8
4. Course outcomes 9
9. Assignments 55
15 Assessment Schedule 70
Semester V
21CS503
Theory of Computation
Semester I Semester II
21GE101 21CS202
Problem Solving and Python Programming
C Programming
Syllabus
UNIT V UNDECIDABILITY 9
Non-Recursive Enumerable Language – Undecidable Problem with Regular
Expressions – Undecidable Problems about Turing Machine – Post‘s Correspondence
Problem, Intractable Problems-The Classes P and NP-An NP Complete Problems.
Program
Program Outcomes Specific
Outcomes
Cours Le
K3
e vel K K K K A A A A A A A
K5 P P P
OutC of 3 4 5 5 3 2 3 3 3 3 2
K6 S S S
omes CO
P P P P P P P P P P P P O O O
O O O O O O O O O O O O 1 2 3
1 2 3 4 5 6 7 8 9 10 11 12
CO
K3 3 2 1 3
304.1
CO
K3 3 2 1 3
304.2
CO
K3 3 2 1 3
304.3
CO
K3 3 2 1 3
304.4
CO
K3 3 2 1 3
304.5
UNIT - I
FINITE AUTOMATA
Lecture Plan
UNIT – I FINITE AUTOMATA
Exercise:
1. Construct DFA for set of all strings {a,b} with ‘abb’ as substring.
2. Construct DFA for set of all strings with three consecutive 0’s at the end.
3. Construct DFA that accepts input string 0’s and 1’s that begins with 11.
4. Construct NFA for set of all strings {0,1} that ends with 00.
5. Construct NFA with 011 as substring.
1. Practice construction Finite automata using Jflap software for the above
language http://www.jflap.org/
1. Explore Finite Automata construction using mobile app - Finite State Machine
https://play.google.com/store/apps/details?id=com.mountainreacher.automat
a&hl=en
https://quizizz.com/admin/quiz/5f0bdc5e287b56001bbee080
Lecture Notes
Computation:
·It is a process following a well defined model that is understood and can be
Classes of Computation:
• Digital Vs Analog
• Sequential Vs Parallel Vs Concurrent
• Batch Vs interactive
Automata
Definition 1
An open-ended computer science discipline that concerns an abstract device
called an automaton, which performs a specific and recognition function.
Definition 2
3 Switching theory and design and analysis of digital circuits automata theory is
applied.
Statements:
If H then C – If Hypothesis then Conclusion
Interpretation of Statements:
H C H⇒C (i.e. ¬H V C)
F F T
F T T
T F F
T T T
If and Only If statements, e.g. “If and only if H then C” means that H ⇒ C and
C ⇒ H.
H ⇔ C or “H iff C”.
H C H ⇔ C (i.e. H equals C)
F F T
F T F
T F F
T T T
Basic Proofs:
1. Deductive proof
2. Contra-positive proof
3. Contradiction based proof
4. Induction
• Mathematical
• Structural
• Mutual
Deductive Proof:
• Each step of a deductive proof MUST follow from a given fact or previous
statements (or their combinations) by an accepted logical principle.
Theorem 1: If x ≥ 4, then 2x ≥ x2 .
Consequently, 1.56 is the largest that the right-hand side will increase.
Since 1.56 < 2, the left side is increasing faster than the right side
Theorem 2:
Statement Justification
2. x = a2 + b2 + c2 + d2 Given
3. a ≥ 1, b ≥ 1, c ≥ 1, d ≥ 1 Given
Reductions to Theorems:
Let S be a finite subset of some infinite set U. Let T be the complement of S with
respect to U. Then T is infinite.
Proof:
Since S and T are complements, and their union is an infinite set, and given S is
finite, T has to be infinite in order to satisfy this
n+x=∞
Therefore x = ∞
If-And-Only-If Statements :
Let x be a real number. Then floor of x is the same as ceiling of x iff x is an integer
• A if and only if B
• A iff B
• A is equivalent to B
In this case we must prove in both directions. In order to prove A if and only if B,
we must prove the following two statements:
1. If-Part: if B then A
2. Only-If-Part: if A then B
A Sample iff Theorem: Let x be a real number. Then ⎣x⎦= ⎡x⎤ if and only if x
is an integer.
Note:
⎣x⎦ is the floor of real number x is the greatest integer equal to or less than x
⎡x⎤ is the ceiling of real number x is the least integer equal to or greater than x.
By definitions of ceiling and floor operations. ⎣x⎦ = x and ⎡x⎤ = x . Thus, ⎣x⎦= ⎡x⎤.
By definitions of ceiling and floor operations. ⎣x⎦ ≤ x and ⎡x⎤ ≥ x .Since given that
⎣x⎦= ⎡x⎤, ⎡x⎤ ≤ x and ⎡x⎤ ≥ x. By the properties of arithmetic inequalities, ⎡x⎤ = x.
Since ⎡x⎤ is always an integer, x MUST be integer too.
Proof: Assume floor of x = ceiling of x – (0)
Prove: x is an integer
Using definitions of floor and ceiling
Floor of x is less than or equal to x (1)
Ceiling of x is greater than or equal to x (2)
But we know floor of x and ceiling of x are equal.
Substituting (0) in (2) we get
Ceiling of x is less than or equal to x (3)
From (3) and (1) we conclude ceiling of x is x
Similar corollary to prove floor of x is x.
Thus x is an integer Only if part
Assume x is integer.
By definition, when x is integer both floor and ceiling are equal to x
RUS=SUR
R U S=E
S U R =F
Commutative law says E = F
Prove:
An element x is in E iff x is in G
If x is in E then x is in F
If x is in F then x is in E
Theorem: R ∪ ( S ∩ T) = (R ∪ S) ∩ (R ∪ T)
Proof of If-Part:
Proof of R ∪ ( S ∩ T) = (R ∪ S) ∩ (R ∪ T)
Proof of Only-If-Part:
Contrapositive :
To prove “if H then C”, we would prove “if not C then not H”
For example, the assertion "If it is my car, then it is red" is equivalent to "If that
car is not red, then it is not mine".
To prove "If P, Then Q" by the method of contra positive means to prove "If Not
Q, Then Not P".
Example:
Two integers are said to have the same parity if they are both odd or both even.
Theorem. If x and y are two integers for which x+y is even, then x and y have
the same parity
Proof:
The contra positive version of this theorem is "If x and y are two integers with
opposite parity, then their sum must be odd."
Since one of these integers is even and the other odd, there is no loss of
generality to suppose x is even and y is odd.
Thus, there are integers k and m for which x = 2k and y = 2m+1. Then, we
compute the sum x+y = 2k + 2m + 1 = 2(k+m) + 1, which is an odd integer
by definition.
Proof by Contradiction:
Another way to prove a statement of the form “if H then C” is to prove the
In order create the proof: – Start by assuming both the hypothesis H and the
Two parts
If a = b, then a mod b = b mod a
Assume a = b,
Hence, a mod a = b mod b = 0, then hypothesis
If a mod b ≡b mod a then a = b
Contradiction:
Assume a ≠ b, consider a < b and a > b
If a < b then a mod b = a (1)
And b mod a < a (2)
But given (1) and (2) are equal, hence contradiction
By symmetry, b < a will have
b mod a = b and a mod b < b.
Hence, a = b is the scenario
The method of Contrapositive has the advantage that your goal is clear:
Prove Not H.
Indeed, one may never be found (and will never be found if the
hypothesis is false)
Mathematical Induction :
Inductive Proof
• There is a special form of proof called inductive ie) essential when dealing
with recursively defined objects.
• Many of the most familiar inductive proofs deals with integers, but in
automata theory we also need inductive proofs about such recursively
defined concepts as trees and expression of various sorts such as regular
expressions.
The theorem that is proved when we go from a hypothesis H to a conclusion C is
the statement “if H then C”, we say that “C is deduced from H”.
Induction on Integers:
There is a given statement P(n) involving the natural number n such that
1.The statement is true for n=1, i.e., P(1) is true, and
2.If the statement is true for n=k (where k is some positive integer ), then the
statement is also true for n=k+1 , i.e., truth of P(k) implies the truth of P(k+1).
3. Then, P(n) is true for all natural numbers n.
Basic Step: Show that the result holds for all elements specified in the basis step
of the recursive definition to be in the set.
Recursive step: Show that if the statement is true for each of the elements used
to construct new elements in the recursive step of the definition, the result
holds for these new elements.
A single node is a non-empty tree and that node is the root of that tree.
If T1 ,T2 ,…,Tk are non-empty trees (k≥1) and N is a new node, the a new non-
empty tree T can be created using new node N, new k edges and T1 ,T2 ,…,Tk as
follows:
Let |V| be the number nodes and |E| be the number of edges of a non-empty tree T
Theorem: For a non-empty tree T, |V| = |E| + 1.
Inductive Hypothesis: Suppose that for a non-empty tree T with m nodes where
1≤m≤n, |V|=|E|+1 Induction: Let T be a non-empty tree with n+1 nodes. T must
be created as follows:
Each of trees T1 ,…,Tk must contain nodes less than or equal to n. So, we can apply
IH to each of trees T1 ,…,Tk . Thus, |V1 |=|E1 |+1 … |Vk |=|Ek |+1
For T, |V| = |V1 |+…+ |Vk |+1 |E| = |E1 |+…+ |Ek |+k
Mutual Induction:
Since pushing the button switches the state between on and off , and the switch
starts out in the off state, we expect that the following statements will together
explain the operation of the switch
S1(n): The automaton is in state off after n pushes if and only if n is even
We give the basis and inductive parts of the proofs of statements S1(n) and S2(n)
below The proofs depend on several facts about odd and even integers if we add or
subtract from an even integer. we get an odd integer, and if we add or subtract
from an odd integer we get an even integer
BASIS: For the basis, we choose n Since there are two statements, each of which
must be proved in both directions because S1 and S2 are each “if-and-only-if”
statements) there are actually four cases to the basis, and four cases to the
induction as well
1. [S1: If] Since is in fact even, we must show that after pushes, the automaton
of Fig is in state off. Since that is the start state, the automaton is indeed in
state off after pushes
2. [S2: Only if] The automaton is in state off after pushes, so we must show
that is even But is even by definition of even, so there is nothing more to
prove
3. [S3:IF] The hypothesis of the if part of S1 is that is odd Since this hypothesis
H is false, any statement of the form if H then C is true, Thus, this part of the
basis also holds
4. [S4: Only if] The hypothesis, that the automaton is in state on after pushes,
is also false, since the only way to get to state on is by following an arc
labeled Push ,which requires that the button be pushed at least once Since
the hypothesis is false, we can again conclude that the if-then statement is
true
INDUCTION : Now, we assume that S1(n) and S2(n) are true, and try to prove
S1(n+1) and S2(n+1). Again, the proof separates into four parts
1. [S1(n+1) If]: The hypothesis for this part is that n+1 is even. Thus, n is odd
The if part of statement S2(n) says that after n pushes, the automaton is in
state on The arc from on to off labeled Push tells us that the( n+1)st push
will cause the automaton to enter state off. That completes the proof of the if
part of S1(n+1)
2. [S1(n+1) Only-if] : The hypothesis is that the automaton is in state off after
n+1 pushes. Inspecting the automaton of Fig tells us that the only way to get
to state off after one or more moves is to be in state on and receive an input
Push Thus, if we are in state off after n+1 pushes, we must have been in
state on after n pushes Then, we may use the only if part of statement S2(n)
to conclude that n is odd. Consequently, n+1 is even, which is the desired
conclusion for the only-if portion of S1(n+1)
3. [S2(n+1) If] : This part is essentially the same as part (1) with the roles of
statements S1 and S2 exchanged, and with the roles of odd and even
exchanged The reader should be able to construct this part of the proofeasi
4. [S2(n+1) Only-if] : This part is essentially the same as part (2) with the roles
of statements S1 and S2 exchanged, and with the roles of odd and even
exchanged
Example 1: Prove by mathematical induction 1+2+3+…+n= 𝑛(𝑛+1)/2
Proof:
1. Basis of induction:
Base case: n=1
L.H.S = 1
R.H.S = 𝑛(𝑛+1)2 = (1)(1+1)/2 = 2/2=1
2. By Induction hypothesis:
For every k > 0, 1+2+3+… + k = 𝑘(𝑘+1)2
3. Statement to be shown in induction step:
1+2+3+… + k + (k+1) = (𝑘+1)((𝑘+1)+1)/2
4.Proof of Induction step:
L.H.S
1+2+3+… + k + (k+1) = 𝑘(𝑘+1)/2 + (k+1)
= (k+1) [ 𝑘/2 +1]
= (k+1) [ (𝑘+2)/2]
= (𝑘+1)(𝑘+2)/2 [∵ (𝑘+1)(𝑘+1+1)2]
= R.H.S
P(k+1) is also true for every k > 1
Induction: Suppose for some x >4 that 2x ≥ x2. With this statement as the
hypothesis, we need to prove the same statement, with x+1 in place of x:
2(x+1)≥ (x+1)2
2(x+1) ≥ 2*2x
We are assuming 2x ≥ x2
2x2 ≥ (x+1)2
2x2 ≥ (x2+2x+1)
x2 ≥ 2x+1
x ³≥ 2 + 1/x
Since x >=4, we get some value >=4 on the left side. The right side will equal at
most 2.25 and in fact gets smaller and approaches 2 as x increases. Consequently,
we have proven the theorem to be true by induction.
Example 4: Prove by mathematical induction For every positive integer n, prove
that 7ⁿ-3ⁿis divisible by 4
Proof:
Let P(n): 7ⁿ-3ⁿis divisible by 4
Step: 1 P(1): 7¹-3¹ = 4 which is divisible by 4. Thus P(n) is true for n=1
Step :2 Let P(k) be true for some natural number k
i.e., P(k) : 7ᵏ-3ᵏis divisible by 4.
We can write 7ᵏ-3ᵏ= 4d, where d ∊ N.
Step :3 To prove that P(k+1) is true whenever P(k) is true.
P(k+1) : 7ᵏ+1- 3ᵏ+1is divisible by 4
Proof: 7⁽ᵏ⁺¹⁾-3⁽ᵏ⁺¹⁾=7⁽ᵏ⁺¹⁾-7.3ᵏ+7.3ᵏ-3⁽ᵏ⁺¹⁾ (for convenience adding and subtracting 7.3ᵏ)
=7(7ᵏ-3ᵏ)+(7-3)3ᵏ
=7(4d)+(7-3)3ᵏ
=7(4d) +4.3ᵏ
=4(7d+3ᵏ)
From the last line, we see that 7⁽ᵏ⁺¹⁾-3⁽ᵏ⁺¹⁾ is divisible by 4.
Thus P(k+1) is true when P(k) is true.
Alphabet:
An alphabet is a finite, non-empty set of symbols. It is denoted by Σ.
Example:
i) Σ= {a,b}, an alphabet of 2 symbols a and b.
)i Σ= {0, 1, 2}, an alphabet of 3 symbols 0, 1 and 2.
)i Σ= {a,b,…,z}, the set of all lower case letters.
String:
A string (or) word over an alphabet set Σis a finite sequence of symbols from Σ.
Example:
i) If Σ= {a,b} then abab, aabba area all strings over the alphabet Σ= {a,b}.
ii) If Σ= {a} then a, aa, aaa, are all strings over the alphabet Σ= {a}.
Operation on Integers:
Length of a String:
Let w be the string then “length of the string │w│is the number of symbols
composing the string.
Example:
i) If w=abcd then │w│= 4.
ii) If x=0101010 then │x│= 7.
iii) │ε│=0.
Empty
i) The string consisting of zero symbols or the length of a string is zero.
ii) It is denoted by ε.│ε│=0
Reverse of a String:
i) The reverse of a string is obtained by writing the symbols in reverse order.
ii)Let w is a string. Then its reverse is wR.
i.e) w=a1a2a3…am
wR = am… a3a2a1
iii) If u=100010 the uR=010001
Power of an alphabet:
Let Σbe an alphabet, then
Σ*denotes the set of all string over the alphabet Σ.
Σm denotes the set of all string over the alphabet Σof length m.
Example:
If Σ= {0, 1} then
Σ0 = {ε}empty string.
Σ1 = {0, 1} set of all string of length one over Σ= {0, 1}.
Σ2 = {00, 01, 10, 11} set of all string of length over Σ= {0, 1}.
Kleene Closure:
Let Σbe an alphabet, then “kleene closure Σ*”denotes the set of all strings over the
alphabet Σ(includes ε,empty string).
Example:
i) If Σ= {a} then Σ*= {ε,a,aa…}.
ii) If Σ= {0,1} then Σ*={ε,0,1,00,11,10…}
Substring:
A string v appears within another string w(w=uv) is called substring of w. If w=uv,
then substrings u and v are said to be prefix and suffix of w respectively. Example:
i) w=abbab be a string over an alphabet Σ= {a,b} then a,ab,abb,ba,bab,… are all
substrings of w.
ii) w=123
Prefixes = {ε, 1, 12, 123}
Suffixes = {ε, 3, 23, 123}
iii) w=abbab
Prefixes = {ε,a, ab, abb, abba, abbab}
Suffixes = {ε,b, ab, bab, bbab, abbab}
Palindrome:
i)A palindrome is a string, which is same whether written forward or backward.
Example:
madam, 121
ii)If the length of the palindrome is even, then it can be obtained by concatenation
of a string and its reverse.
Example:
If U = 10 and UR = 01 then even palindrome UUR=1001.
Properties of string operations:
i) Concatenation is associative, that is for all strings u,v, and w (uv)w = u(vw).
ii) If u and v are strings then the length of their concatenation is the sum of the
individual length, i.e) │uv│=│u│+│v│.
Example:
x=abc and y=123
xy = abc123
Languages:
For any alphabet Σ,any subset L of Σ*is a language. A set of strings from an
alphabet is called a language.
Example:
i) English: It is a language over Σ={a,b,c,…z}.
ii) Binary string: {0, 1, 01, 0101 …} is a language over Σ= {o,1}.
iii) If Σ={a,b} is a alphabet then Σ*={ε,a,b,aa,ab…} is a language.
Notations:
1.{λ}or {ε}: Empty string or Null string language. It is a language over every
alphabet and it contains exactly one string εor λ.
Example:
{λ}or {ε}has one string λor ε.
2. Φ: Empty language.
Example:
It contains no strings.
3. Σ*:Universal language.
It contains all string over the alphabet Σ.
Lecture Notes
FINITE AUTOMATA
FA is of two types
1. Deterministic Finite Automata-DFA
2. Nondeterministic Finite Automata-NFA
Examples
1. FA for on/off switch-Digital Systems
2. Lexical Analysis - Recognizing a string “int”
The term “deterministic” refers to the fact that for one each input there is one and
only one state to which the automaton can transition from its current state.
Transition Diagram
i. For each state in Q there is a node.
ii. For each state ‘q’ in Q and each input symbol a in ∑, let δ(q,a)=p. Then the
transition diagram has an arc from node ‘q’ to node P labeled ‘a’.
Transition table
• A transition table is a tabular representation of a function like δthat
takes two arguments and returns a value.
• The rows of the table correspond to the states and the columns correspond
to the inputs.
• The entry for the row corresponds to state ‘q’ and the column corresponds
to inputs ‘a’ is the state δ(q,a).
0 1
-> * q0 q0 q1
q1 q0 q1
Extending the transition function to strings:
• We define an extended transition function that describes what happens
when we start in any state and follow any sequence of inputs.
• If δis our transition function, then the extended transition function
constructed from δwill be called δ’.
Solution:
Any binary number ends with ‘0’ are always “even”. [0010 (2), 0100 (4)…]
When a binary number ends with ‘1’ it always “odd”. [0001 (1), 0011(3)].
2. Design DFA to accept the string that always ends with 00.
3. Design a DFA for accepting all the strings that ends with ab
Non deterministic Finite Automata (NFA)
An NFA has a finite set of states, a finite set of input symbols, one start state and
set of accepting states.
The difference between the DFA and the NFA is in the type of δ
i) For the NFA, δis a function that takes a state and an input symbol as
arguments, but returns a set of zero, one or more states.
δ(q,a) = {p,q}
Ex: δ(q0,a) = {q1,q2}
ii) For the DFA, δis a function returns only one state.
δ(q,a) = {ps}
1. Design NFA with ∑ = {0, 1} and accept all string of length atleast 2.
The ε-transitions in NFA are given in order to move from one state to
another without having any symbol from input set ∑.
Definition (or) Formal notation for an ε-NFA:
The language accepted by NFA with εdenoted by M = (Q, ∑, δ,q0, F) can be
defined as follows:
M= (Q, ∑, δ,q0, F) be a NFA with ε
where, Q is a finite set of states
∑ is input symbols
δis a transition function , Q X { ∑ ∪ ε} to 2Q q0 is a start state.
F is a set of final states such that F ⊆ Q.
The string w is accepted by NFA can be represented as
L(M) = {w | w ⊆ ∑* and δtransition for w from q0 reaches to F}
Problem: Construct NFA with εwhich accepts a language consisting the strings of
any number of a’s followed by any number of b’s followed by any number of c’s.
Epsilon closure for a given state X is a set of states which can be reached from
the states X with only (null) or εmoves including the state X itself.
∈-closure(1) : {1,2,3,5,8}
∈-closure(2) : { 2,3,5}
∈-closure(3) : { 3}
∈-closure(4) : { 4,7,8,2,3,5}
∈-closure(5) : { 5}
∈-closure(6) : { 6,7,8,2,3,5}
∈-closure(7) : { 7,8,2,3,5}
∈-closure(8) : { 8}
Lecture Notes
Step 1:
Consider M=(Q,Σ,δ,q0,F) is a NFA with ε,we have to convert this NFA with εto
equivalent DFA denoted by MD = (QD,Σ,δD,q0,FD)
Theorem:
A language L is accepted by some ε-NFA if and only if(iff) L is accepted by some
DFA.
Proof:
Suppose
L=L(D) for some DFA.
D into an ε-NFA E by adding transition δ(q, ε)= φfor all states q of D.
we must also convert the transition of D on input symbols.
Example:
δD(p,a) = p into an NFA transition to the set containing only p.
i.e) δE(p,a) = {p}.
Thus e transition of E and D are the same, but E explicitly states that there are no
transition out of any state on ε.
Lecture Notes
Let E=(QE,Σ,δE,q0,FE) be an ε-NFA. Apply the modified subset construction
described above to produce the DFA.
D = (QD,Σ,δD,q0,FD)
Formally
δ'E(q0,w) = δ'D(qD,w) by induction on the length of w.
Basis:
if |w| = 0, then w = ε.
we know δ'E(q0, ε)= ECLOSE(q0).
we also know that qD = ECLOSE(q0), because this is how the start state of D is
defined.
for DFA, we know that δ'(p, ε)= p for any state p, so on particular
δ'D(qD, ε)= ECLOSE (q0).
we have thus proved that δ'E(q0, ε)= δ'D(qD, ε).
Induction:
Suppose w=xa, where a is the final symbol of w and assume that the statement
holds for x.
i.e) δ'E(q0, x) = δ'D(qD, x).
let both these sets of states be {p1,p2,...pk}.
By the definition of δ'for ε-NFA's ,we compute δ'E(q0, w) by
let {r1,r2,...rm} be ⋃δE(Pi,a)𝑘𝑖=1
Then δ'E(q0,w) = ECLOSE({r1,r2,...rm})
Theorem:
If L is accepted by NFA with ε-transitions, then L is accepted by an NFA without
ε-transitions. That is L(M) = L(M')
Proof:
By induction: In ε-NFA, and ' are same and in NFA and ' are different.
Lecture Notes
DFA :
Basis: |W|=0
δˆ(q, ε)= q
If we are in a state q and read no inputs, then we are still in state q
Induction: |W|>1
Suppose w is a string of the form xa;
Then: δˆ(q, w) = δˆ(q, xa)
= δ(δˆ(q, x), a)
= δ(p , a ) let δˆ(q, x) = p
= [r]
NFA:
Basis: δˆ(q, ε)= q
If we are in a state q and read no inputs, then we are still in state q
Induction:
Suppose w is a string of the form xa
Then: δˆ(q, w) = δ(δˆ(q, x), a)
= δ({p1, p2, . . . pk , },a) let δˆ(q, x) = {p1, p2,
. . . pk , }
Solution:
Initial State of given NFA is {q0 }
Since NFA is equivalent to DFA,
Let the Initial State of DFA be [q0] -------------A
Resultant DFA
0 1
→A A B
B C B
*C C C
a)
Note:
No change in Initial State
No change in the total No. Of States
May be change in Final States
Changes in transitions
Solution:
ε-Closure(q0)={q0,q1}
ε-Closure(q1)={q1}
Transition table
0 1
* q1 Φ {q1}
Transition diagram
Conversion of NFA-ε into its equivalent NFA.
b)
Solution:
ε-Closure(A)={A,B}
ε-Closure(B)={B,D}
ε-Closure(C)={C}
ε-Closure(D)={D}
Transition table
State Input symbol
0 1
->A {A,B,C} Φ
*B {C,D} {D}
C Φ Φ
*D {D} {D}
Note:
B & D are final states because final state of given NFA-ε D lies in both
ε-Closure(B)={B,D}
ε-Closure(D)={D}
Conversion of NFA-ε to DFA
Solution:
Resultant DFA :
States Inputs
0 1 2
->*A A B C
*B ∅ B C
*C ∅ ∅ C
Note:
Since q2 lies in DFA states A,B,C , all the three states becomes the final
states of resultant DFA.
Lecture Notes
b)
States Inputs
0 1 ε
->A {B} {A} {B}
B ∅ {B} {C}
*C {C,A} {C} ∅
Solution:
=ε-closure{δ((B,C), 0)}
= {C}
= [C] ---------Z
= {B,C}
=[B,C] ------Y
= [C] -----------Z
= [C] ----------Z
S.No Questions K CO
Level Level
S.No Questions K CO
Level Level
1. Define hypothesis.
S.No Questions K CO
Level Level
5. What is the use of Structural induction proof?
Structural induction is used to prove that some
proposition P(x) holds for all x of some sort of recursively
defined structure.
K2 CO1
6. Define Induction Principle.
S.No Questions K CO
Level Level
9. Define Finite Automation.
A finite automata is a collection of 5 tuples
(Q, Σ.δ,q0, F )
where Q is a finite set of states, which is non empty. K2 CO1
Σis an input alphabet, indicates input set.
δis a transition function
q0 is an initial state (q0 in Q)
F is a set of final states.
K3 CO1
K3 CO1
K3 CO1
Part A Q & A
S.No Questions K CO
Level Level
13. Design NFA which accepts the language
{ w ∈Σ∗ | w contains at least two 0s, or exactly two
1s }
K3 CO1
K2 CO1
S.No Questions K CO
Level Level
DFA NFA
S.No Questions K CO
Level Level
19. Explain the extended transition function for ε-NFA
Eg.
δˆ(q0, 11001) =δ(δˆ(q0, 1)1001)
=δ(δˆ(q0, 1)001)
=δ(δˆ(q0, 0)01)
=δ(δˆ(q1, 0)1)
=δ(q2, 1)
=q0
Part B Qs
S.No Questions K CO
Level Level
S.No Questions K CO
Level Level
5.
6. K2 CO1
Part B Qs
S.No Questions K CO
Level Level
States- Inputs
0 1
→p {p,q} {p}
8. K2 CO1
q {r} {r}
r {s} ф
*s {s} {s}
9. Inputs K2 CO1
States
ε a b c
→p {q} {p} Ф Ф
q {r} ф {q} Ф
*r Ф ф ф {r}
Part B Qs
S.No Questions K CO
Level Level
States Inputs
ε a b c
→p {q} {p} Ф Ф
q {r} ф {q} Ф
10. K2 CO1
*r Ф ф ф {r}
NPTEL : https://swayam.gov.in/nd1_noc19_cs79/preview
Swayam : https://nptel.ac.in/courses/106/106/106106049/
coursera : https://www.coursera.org/learn/cs-algorithms-theory-machines
Udemy : https://www.udemy.com/course/theory-of-computation-toc/
Mooc : https://www.mooc-list.com/tags/theory-computation
https://infyspringboard.onwingspan.com/web/en/app/toc/lex_auth_0132999
01609811968399/overview
Real time Applications in day to day life and to Industry
M = (Q, ∑, L,R,δ,s,t,r)
Sweeping automata
NLP is used in a wide variety of everyday products and services. Some of the most
common ways NLP is used are through voice-activated digital assistants on
smartphones, email-scanning programs used to identify spam, and translation apps
that decipher foreign languages.
•Keyword extraction: An NLP technique that analyzes a text to identify the most
important keywords or phrases. Keyword extraction is commonly used for search
engine optimization (SEO), social media monitoring, and business intelligence
purposes.
Unit Test I :
Unit Test II :
Model Examination :
Prescribed Textbooks & Reference Books
TEXTBOOK:
1. Introduction to Automata Theory, Languages and Computation, 3rd
Edition, John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, Pearson Education,
2014.
REFERENCES:
Disclaimer:
This document is confidential and intended solely for the educational purpose of RMK Group of Educational
Institutions. If you have received this document through email in error, please notify the system manager. This
document contains proprietary information and is intended only to the respective group / learning community as
intended. If you are not the addressee you should not disseminate, distribute or copy through e-mail. Please notify
the sender immediately by e-mail if you have received this document by mistake and delete this document from
your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking
any action in reliance on the contents of this information is strictly prohibited.