SlideShare a Scribd company logo
1 of 111
THEORY OF COMPUTATION
Unit –I
FINITE AUTOMATA
By,
T.VISWANATH KANI,M.E.,
AP/CSE
VCEW
FINITE AUTOMATA
• Introduction
• Basic Mathematical Notation and techniques
• Finite State systems
• Basic Definitions
• Finite Automaton
• DFA & NDFA
• Finite Automaton with €- moves.
Introduction
The Theory of Computation is a branch of
computer science and mathematics combined that
"deals with how efficiently problems can be solved
on a model of computation, using an algorithm".
It studies the general properties of
computation which in turn, helps us increase
the efficiency at which computers solve
problems. This is done when we estimate the
validity of the solutions given by the
computer through the theory of computation
and then alternate the algorithms so that we
can obtain a more reliable solution.
This is a fast-growing branch that has
helped solving problems in many fields beside
computer science such as Physics, Economy,
Biology and many others
Introduction
• Before introducing you to the basics of the theory of computation, I
would like to talk about the Turing machine, as it plays a good role
in explaining this theory:
It is theoretical abstract machine used as a model of computation . It
uses an infinite memory tape where the information obtained are
saved, and analyze these information to determine whether the
operation is feasible or not.
• This theory is approached through three main fields:
1- Automata theory
2- Computability theory
3- Computational complexity theory
6
Alan Turing (1912-1954)
• Father of Modern Computer Science
• English mathematician
• Studied abstract machines called
Turing machines even before
computers existed
• Heard of the Turing test?
(A pioneer of automata theory)
7
Theory of Computation: A Historical
Perspective
1930s • Alan Turing studies Turing machines
• Decidability
• Halting problem
1940-1950s • “Finite automata” machines studied
• Noam Chomsky proposes the
“Chomsky Hierarchy” for formal
languages
1969 Cook introduces “intractable” problems
or “NP-Hard” problems
1970- Modern computer science: compilers,
computational & complexity theory evolve
Importance of Theory of computation
The theory of computation forms the basis for:
• Writing efficient algorithms that run in
computing devices.
• Programming language research and their
development.
• Efficient compiler design and construction.
Automata theory
• Automata theory (also known as Theory Of
Computation) is a theoretical branch of
Computer Science and Mathematics, which
mainly deals with the logic of computation
with respect to simple machines, referred to
as automata.
• Automata* enables the scientists to
understand how machines compute the
functions and solve problems. The main
motivation behind developing Automata
Theory was to develop methods to describe
and analyze the dynamic behavior of discrete
systems.
• Automata is originated from the word
“Automaton” which is closely related to
“Automation”.
Automata theory
A basic computation performed on/by an automaton
is defined by the following features:
• A set of input symbols.
• The configuration states.
• Output.
Branches of Automata theory
Finite Automata (FA): This is a computer model
that is inferior in its computation ability. This model
is fit for devices with limited memory. It is a simple
abstract machine with five elements that define its
functioning and processing of problems.
Computability theory
• The Computability theory defines whether a
problem is “solvable” by any abstract machine.
Some problems are computable while others
are not.
• Computation is done by various computation
models depending on the nature of the problem
at hand, examples of these machines are: the
Turing machine, Finite state machines, and
many others.
Complexity theory
This theoretical computer science branch is all
about studying the cost of solving problems while
focusing on resources (time & space) needed as the
metric. The running time of an algorithm varies with the
inputs and usually grows with the size of the inputs.
They are:
• Upper (Worst Case Scenario)
• Lower (Best Case Scenario)
The major classifications of complexities include:
• Class P
• Class NP
Why toc?
• Foundation of all model computers
•Deep understanding of computer and computing
• Theory of pattern matching in web search
• Theory of finite automata in sequential circuits
• Theory of context free grammars in Compilers
•Theory of computational complexity in
cryptography and network security
Why toc?
• Finite automata are a useful model for many important
kinds of software and hardware:
1. Software for designing and checking the behaviour of
digital circuits
2. The lexical analyser of a typical compiler, that is, the
compiler component that breaks the input text into logical
units
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 of protocols for secure exchange information
TOC Example
Research Areas available in ToC
• Design and analysis of algorithms
• Cryptography
• Quantum Computation
• Randomness in computation
Applications of ToC
• Compiler design
• Robotics
• Artificial Intelligence
• Knowledge Engineering
BASIC MATHEMATICAL NOTATIONS
AND TECHNIQUES
• Symbols- a,b,c,0,1,2,3
• Alphabets-Collection of symbols representing in
∑
• Strings- Array of characters
∑={0,1}-00,01,11,0000,111,...
∑={a,b} - a,b,ab,aa,bb,abc,...
• String length of ∑={1,2,3}=3
Notation of length of w: |w| Example: |011| = 3
and | ε | = 0
BASIC MATHEMATICAL NOTATIONS
AND TECHNIQUES
• Empty string is denoted by ε
• Concatenation of strings
X=0,1. Y=2
XY=012
• Reversing a string
Writing the symbols in reverse order
U=1010001
U^R=1000101
BASIC MATHEMATICAL NOTATIONS
AND TECHNIQUES
• Power of an alphabet:
Let ∑ be an alphabet Then ∑^*-Denotes all the
strings over an alphabet ∑
∑^m – Set of all strings of length m over an alphabet
∑
• For example:
∑={0,1}
∑^0=ε
BASIC MATHEMATICAL NOTATIONS
AND TECHNIQUES
• ∑^1={0,1}
• ∑^2={00,10,10,11}
• ∑^3={001,100,101,110,111,011,...}
• ∑^* =?
Kleene closure
Positive Closure
Language
• Definition − A language is a subset of ∑* for
some alphabet ∑. It can be finite or infinite.
• Example − If the language takes all possible
strings of length 2 over ∑ = {a, b}, then L = {
ab, aa, ba, bb }
Operations on Languages
• Concatenation
• Reversal
• Kleen closure
• Positive closure
• Union
• Intersection
Concatenation, Kleene closure
• If L1 and L2 are two languages, we define:the
concatenation of L1 and L2, denoted by L1L2, as
the set of all words given by the concatenation of
any word in L1 with any word in L2.
L={x|x=uv and u belongs to L1 and v belongs to L2}
Ex:If L = {001, 10, 111 } and M = {ǫ, 001 } then
L.M = {001, 10, 111, 001001, 10001, 111001 }
• The Kleene closure of L, denoted by L*, as the
language: L*=L0 U L1 U L2 U ... where L0 is the
empty string and Ln=Ln-1L is the language
consisting of the words of length n for n>0.
Union, Intersection
• The union of two languages L and M, denoted
L ∪ M, is the set of strings that are in either L,
or M, or both.
Example If L = {001, 10, 111 } and M = {ǫ, 001 } then
L ∪ M = {ǫ, 001, 10, 111 }
• Intersection:
Let L and M be the languages of regular
expressions R and S, respectively then it a
regular expression whose language is L
intersection M.
Set
A set is an unordered collection of objects or an
unordered collection of elements. Sets are
always written with curly braces {}, and the
elements in the set are written within the curly
braces.
Examples
 The set {a, b, c} has elements a, b, and c.
 The sets {a, b, c} and {b, c, b, a, a} are the same
since order does not matter in a set and since
redundancy also does not count.
Types of Set
1.Finite Set
 A set consisting of a natural number of objects, i.e. in which
number element is finite is said to be a finite set. Consider the
sets
 A = { 5, 7, 9, 11} and B = { 4 , 8 , 16, 32, 64, 128}
 Obviously, A, B contain a finite number of elements, i.e. 4
objects in A and 6 in B. Thus they are finite sets.
2. Infinite set
 If the number of elements in a set is finite, the set is said to be
an infinite set.
 Thus the set of all natural number is given by N = { 1, 2, 3,
...} is an infinite set. Similarly the set of all rational number
between ) and 1 given by
 A = {x:x E Q, 0 <x<1} is an infinite set.
Types of Set
3.Null set/ empty set
A null set or an empty set is a valid set with no
member.
4.Subset
A subset A is said to be subset of B if every elements
which belongs to A also belongs to B.
A = { 1, 2, 3} B = { 1, 2, 3, 4} A subset of B.
Operations on set
• Union
• Intersection
• Difference
Formal proof
Formal proof- Try to prove the statement B is true because
statement A is true
Induction on Integers
• To prove a statement S(n) about an integer n
by induction, we do:
• Basis --- show S(i) true for a particular basis
integer i (0 or 1 usually)
• Inductive step --- assume n ≥ i (basis integer),
and show that the statement “if S(n), then S(n
+ 1)” is true.
Prove 1+2+...+n=n(n+1)/2 using a
proof by induction.
Homework
• Using the principle of mathematical induction, prove that
1)1² + 2² + 3² + ..... + n² = (1/6){n(n + 1)(2n + 1} for all n ∈ N.
2) 1 x 2 + 3 x 4 + 5 x 6 + …. + (2n - 1) x 2n = n(n+1)(4n−1)3
3)1 ∙ 2 + 2 ∙ 3 + 3 ∙ 4 + ..... + n(n + 1) = (1/3){n(n + 1)(n + 2)}.
Finite State Machine or Finite
Automata
A Finite State Machine, or FSM, is a
computation model that can be used to
simulate sequential logic, or, in other words, to
represent and control execution flow. Finite
State Machines can be used to model problems
in many fields, including mathematics, artificial
intelligence, games or linguistics.
Finite State Machine
• A Finite State Machine is any device storing the state of
something at a given time. The state will change based on
inputs, providing the resulting output for the implemented
changes.
• Finite State Machines come from a branch of Computer
Science called “automata theory”. The family of data structure
belonging to this domain also includes the Turing Machine
The important points here are the following:
 We have a fixed set of states that the machine can be in
 The machine can only be in one state at a time
 A sequence of inputs is sent to the machine
 Every state has a set of transitions and every transition is associated
with an input and pointing to a state
Real world examples
Coin-operated turnstile
• States: locked, unlocked
• Transitions: pointing a coin in the slot will unlock
the turnstile, pushing the arm of the unlocked
turnstile will let the costumer pass and lock the
turnstile again
Traffic Light
• States: Red, Yellow, Green
• Transitions: After a given time, Red will change
to Green, Green to Yellow, and Yellow to Red
FSM
Finite-state Automata
• Finite-state automata are finite-state
machines with no output.
• Finite automata have two states,
Accept state or Reject state. When the input
string is processed successfully, and
the automata reached its final state
Automata theory
• Automata is a theoretical branch of computer science and discrete
mathematics that focuses on the logic of simple machines. The types of
computational models within automata theory include:
• Finite state machines—Models for any system with a limited number of
conditional states of being.
• Pushdown automata – More complicated than finite state machines,
these use regions of memory called stacks to store information as part of
a model.
• Linear-bounded automata (LBA) – Similar to a Turing machine, but the
data is limited to a portion of input within a finite group of inputs.
• Turing machines—The most complex mathematical model within
automata theory for testing different input combinations to analyze a
larger system or problem.
• State transition - When a finite state machine switches between states, it is called
a state transition.
Finite Automata
• Finite automata are used to recognize patterns.
• It takes the string of symbol as input and changes its state
accordingly. When the desired symbol is found, then the
transition occurs.
• At the time of transition, the automata can either move to
the next state or stay in the same state.
• Finite automata have two states, Accept state or Reject
state. When the input string is processed successfully, and
the automata reached its final state, then it will accept.
• Formal Definition of FA
• A finite automaton is a collection of 5-tuple (Q, ∑, δ, q0, F),
where:
Finite Automata
• Q: finite set of states
• ∑: finite set of the input symbol
• q0: initial state
• F: final state
• δ: Transition function
Finite Automata Model
• Finite automata can be represented by input tape
and finite control.
• Input tape: It is a linear tape having some
number of cells. Each input symbol is placed in
each cell.
• Finite control: The finite control decides the next
state on receiving particular input from input
tape. The tape reader reads the cells one by one
from left to right, and at a time only one input
symbol is read.
Finite Automata Model
FA Types
• 1. DFA
• DFA refers to deterministic finite automata. Deterministic refers to
the uniqueness of the computation. In the DFA, the machine goes
to one state only for a particular input character. DFA does not
accept the null move.
• 2. NFA
• NFA stands for non-deterministic finite automata. It is used to
transmit any number of states for a particular input. It can accept
the null move.
• Some important points about DFA and NFA:
• Every DFA is NFA, but NFA is not DFA.
• There can be multiple final states in both NFA and DFA.
• DFA is used in Lexical Analysis in Compiler.
• NFA is more of a theoretical concept.
Transition Diagram
• A transition diagram or state transition diagram is
a directed graph which can be constructed as
follows:
• There is a node for each state in Q, which is
represented by the circle.
• There is a directed edge from node q to node p
labeled a if δ(q, a) = p.
• In the start state, there is an arrow with no
source.
• Accepting states or final states are indicating by a
double circle.
Transition Diagram
DFA(Deterministic Finite Automata )
A deterministic finite automaton (DFA) consists of
1. a finite set of states (often denoted Q )
2. a finite set Σ of symbols (alphabet)
3. a transition function that takes as argument a
state and a symbol and returns a state (often
denoted δ )
4. a start state often denoted q 0
5. a set of final or accepting states (often denoted F
) We have q 0 ∈ Q and F ⊆ Q
Deterministic Finite Automata
• DFA is mathematically represented as a 5-
tuple (Q, Σ, δ, q 0, F )
• The transition function δ is a function in Q × Σ
→ Q
• Q × Σ is the set of 2-tuples (q, a) with q ∈ Q
and a ∈ Σ
Regular Language
Regular Language:
• A language is regular if there exits a DFA for that language.
• The language accepted by DFA is RL.
Regular Expression:
• A Mathematical notation used to describe the regular language.
• This is formed by using 3 Symbols:
(i). [dot operator] – for concatenation
(ii) + [Union operator] –at least 1 occurrence eg) 1+ = {1,11,111,-------
(iii) {*} [Closure Operator ] – Zero or more occurrences eg) 1* = {Λ
,1,11,111,…..}
Basic Regular Expressions:
• Ø is a RE and denotes the empty set.
• ε is a RE and denotes the set { ε }
• For each a in ∑, a is a RE and denotes the set {a}
• If r and s are RE that denoting the languages R and S respectively, then,
– (r+s) is a RE that denotes the set (RUS)
– (r.s) is a RE that denotes the set R.S
– (r)* is a RE that denotes the set R*
Graphical Representation of DFA
• A DFA can be represented by digraphs called
state diagram. In which:
• The state is represented by vertices.
• The arc labeled with an input character show
the transitions.
• The initial state is marked with an arrow.
• The final state is denoted by a double circle.
DFA-Transition Table,Diagram
DFA-Transition Table,Diagram
For this example
• Q = { q 0, q 1, q 2 }
start state q 0
• F = { q 1 }
• Σ = { 0, 1 }
δ is a function from Q × Σ to Q
• δ : Q × Σ → Q
• δ ( q 0, 1) = q 0
• δ ( q 0, 0) = q 2
Draw a DFA for the language accepting strings ending with
’01’ over input alphabets ∑ = {0, 1}
ANS
Regular expression for the given language = (0 + 1)*01
Step-01:
• All strings of the language ends with substring “01”.
• So, length of substring = 2.
• Thus, Minimum number of states required in the DFA = 2 +
1 = 3.
• It suggests that minimized DFA will have 3 states.
Step-02:
We will construct DFA for the following strings-
01
001
0101
001101
Diagram
Draw a DFA that accepts a language L over input alphabets ∑ =
{0, 1} such that L is the set of all strings starting with ’00’.
Solution-
Regular expression for the given language = 00(0 + 1)*
Step-01:
All strings of the language starts with substring “00”.
So, length of substring = 2.
Thus, Minimum number of states required in the DFA = 2 + 2 = 4.
It suggests that minimized DFA will have 4 states.
Step-02:
We will construct DFA for the following strings-
00
000
00000
Diagram
Example 1:
• Q = {q0, q1, q2}
• ∑ = {0, 1}
• q0 = {q0}
• F = {q2}
Transition Function Example
DFA that will accepts the string having odd
number of 1's and odd number of 0's
Draw a DFA for the language accepting strings ending
with ‘abb’ over input alphabets ∑ = {a, b}
Solution-
Regular expression for the given language = (a +
b)*abb
Step-01:
– All strings of the language ends with substring “abb”.
– So, length of substring = 3.
– Thus, Minimum number of states required in the DFA = 3
+ 1 = 4.
– It suggests that minimized DFA will have 4 states.
Step-02:
We will construct DFA for the following strings-
abb
aabb
ababb
abbabb
Transition Table
StatesInput a b
->q0 q1 q0
q1 q1 q2
q2 q1 q3
q3* q1 q0
Ex:Language over alphabet {0,1}: The
language { 0n1 k | n≥1 and k≥1}
H.W
1.Design a DFA in which set of all strings can be
accepted which ends with ab.
(Given: Input alphabet, Σ={a, b}
Language L ={ab, abab, abaabbab, abbab,
bbabaabab ….})
2. Design a DFA such that:
L = {anbm | n,m ≥ 0}
(Given: Input alphabet, Σ={a, b}
Language L = {ε, a, aa, aaa, b, bb, bbb,ab, aab,
aaab, abbb, aabb, aaaabbbb, ...})
H.W
3.Design a DFA to accept the strings over s={0,1}
with three Consecutive Zero
4.Design a DFA to accept the strings over {0,1}
With 011 as substring
String Acceptance(DFA)
H.W
1.Show how the string ω1 =aabba and ω2 =aba is processed
2.Check whether the strings “ababba” ,”baab” are accepted
by the DFA?
NFA or NDFA(Nondeterministic Finite
Automato)
• NFA refers to Nondeterministic Finite Automaton. A
Finite Automata(FA) is said to be non deterministic, if
there is more than one possible transition from one
state on the same input symbol.
A non deterministic finite automata is also set of five
tuples and represented as, 5-tuple (Q, ∑, δ, q0, F),
where:
• Q: finite set of states
• ∑: finite set of the input symbol
• q0: initial state
• F: final state
• δ: Transition function
NFA Examples
• An NFA that accepts all binary strings that end
with 101.
Transition Table
0 1
A {A} {A,B}
B {C} {∅}
C
{∅}
{D}
D
{∅} {∅}
NFA Examples
Design a NFA for the transition table
as given below:
• Design an NFA with ∑ = {0, 1} in which double
'1' is followed by double '0'.
What is the language accepted by the
following finite state automata?
a(bb + bba) ∗ ba or ab(bb + bab) ∗a
NFA Examples
• Give NFAs with the specified number of states
recognizing each of the following languages.
In all cases, the alphabet is Σ = {0, 1}.
(a) The language { w ∈ Σ∗ | w ends with 00 } with
three states
Design a NFA to accept strings containing the
substring,”0101”.
• Determine a NFA that accepts L=(aa* (a + b))
.
H.W
1.Design a NFA to accept strings over
alphabet{0, 1}, such that the third symbol
from right end is 0.
2.Design a NFA with no more than five states
for the set {ababn : n >= 0}U{aban : n > 0} .
3.Construct a NFA that accepts L={x €{a, b}/ x
ends with 'aab‘}
String Acceptance By NFA
H.W
StatesInput 0 1
q0 {q0,q1} q2
q1 {q1,q2}
q2 {q2,q0} q1
Check Whether the input String 0100 is Accepted or not
H.W
StatesInput 0 1
q0 {qo,q3} {q0,q1}
q1 q2
q2 q2 q2
q3 q4
q4 q4 q4
Consider the given NFA to Check Whether W=01001 is Valid or Not
NFA’s with ε −Transitions
We extend the class of NFAs by allowing
instantaneous (ε) transitions:
1. The automaton may be allowed to change its
state without reading the input symbol.
2. In diagrams, such transitions are depicted by
labeling the appropriate arcs with ε.
3. Note that this does not mean that ε has become
an input symbol. On the contrary, we assume
that the symbol ε does not belong to any
alphabet.
ε -NFA Example
1.Find the ε-closure of the states 1,2 and 4
in the following transition diagram
ε-closure(1)={1,2,3,4,6}
ε-closure(2)={2,3,6}
ε-closure(4)={4}
1.Find the ε-closure for the following transition diagram
ε-closure(A)={A,B,C}
ε-closure(B)={B,C}
ε-closure(C)={C}
H.W
Find ε-closure of the all states
ε-closure NFA String Acceptance
find
Conversion from NFA to DFA
• Steps for converting NFA to DFA:
• Step 1: Initially Q' = ϕ
• Step 2: Add q0 of NFA to Q'. Then find the
transitions from this start state.
• Step 3: In Q', find the possible set of states for
each input symbol. If this set of states is not in
Q', then add it to Q'.
• Step 4: In DFA, the final state will be all the
states which contain F(final states of NFA)
1.Convert the given NFA to DFA.
• Now we will obtain δ' transition for state q0.
• δ'([q0], 0) = [q0]
• δ'([q0], 1) = [q1]
• The δ' transition for state q1 is obtained as:
• δ'([q1], 0) = [q1, q2] (new state generated)
δ'([q1], 1) = [q1]
• The δ' transition for state q2 is obtained as:
• δ'([q2], 0) = [q2]
• δ'([q2], 1) = [q1, q2]
• δ'([q1, q2], 0) = δ(q1, 0) ∪ δ(q2, 0)
• = {q1, q2} ∪ {q2}
• = [q1, q2]
• δ'([q1, q2], 1) = δ(q1, 1) ∪ δ(q2, 1)
• = {q1} ∪ {q1, q2}
• = {q1, q2}
• = [q1, q2]
• The state [q1, q2] is the final state as well
because it contains a final state q2. The
transition table for the constructed DFA will
be:
0,1
H.W
Convert NFA TO DFA
0 1
q0 {q0,q1} {q1}
q1 - {q0,q1}

More Related Content

What's hot

Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler designKuppusamy P
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic NotationsRishabh Soni
 
Code Optimization
Code OptimizationCode Optimization
Code Optimizationguest9f8315
 
03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdfKkSingh64
 
Application of greedy method prim
Application of greedy method primApplication of greedy method prim
Application of greedy method primTech_MX
 
Graph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxGraph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxHome
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal formsAkila Krishnamoorthy
 
FCFS scheduling OS
FCFS scheduling OSFCFS scheduling OS
FCFS scheduling OSTotan Banik
 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structureshatredai
 

What's hot (20)

Code optimization
Code optimizationCode optimization
Code optimization
 
Bellman ford algorithm
Bellman ford algorithmBellman ford algorithm
Bellman ford algorithm
 
Data Structures Chapter-2
Data Structures Chapter-2Data Structures Chapter-2
Data Structures Chapter-2
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Code optimization in compiler design
Code optimization in compiler designCode optimization in compiler design
Code optimization in compiler design
 
Asymptotic Notations
Asymptotic NotationsAsymptotic Notations
Asymptotic Notations
 
Stacks in c++
Stacks in c++Stacks in c++
Stacks in c++
 
Merge sort algorithm
Merge sort algorithmMerge sort algorithm
Merge sort algorithm
 
Code Optimization
Code OptimizationCode Optimization
Code Optimization
 
03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf03 Linear Arrays Memory Representations .pdf
03 Linear Arrays Memory Representations .pdf
 
Compiler lec 8
Compiler lec 8Compiler lec 8
Compiler lec 8
 
Application of greedy method prim
Application of greedy method primApplication of greedy method prim
Application of greedy method prim
 
Graph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptxGraph coloring problem(DAA).pptx
Graph coloring problem(DAA).pptx
 
Theory of computation Lec3 dfa
Theory of computation Lec3 dfaTheory of computation Lec3 dfa
Theory of computation Lec3 dfa
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
FCFS scheduling OS
FCFS scheduling OSFCFS scheduling OS
FCFS scheduling OS
 
Python Functions
Python   FunctionsPython   Functions
Python Functions
 
Algorithm Designs - Control Structures
Algorithm Designs - Control StructuresAlgorithm Designs - Control Structures
Algorithm Designs - Control Structures
 
algo
algoalgo
algo
 

Similar to Unit -I Toc.pptx

Basic Foundations of Automata Theory
Basic Foundations of Automata TheoryBasic Foundations of Automata Theory
Basic Foundations of Automata Theorysaugat86
 
Algorithms and problem solving.pptx
Algorithms and problem solving.pptxAlgorithms and problem solving.pptx
Algorithms and problem solving.pptxaikomo1
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)SURBHI SAROHA
 
Overview_of_a_computational_model_-_Languages_1.ppt
Overview_of_a_computational_model_-_Languages_1.pptOverview_of_a_computational_model_-_Languages_1.ppt
Overview_of_a_computational_model_-_Languages_1.pptSanthoshS508159
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...DrkhanchanaR
 
Design and analysis of Algorithms - Lecture 08 (1).ppt
Design and analysis of Algorithms - Lecture 08 (1).pptDesign and analysis of Algorithms - Lecture 08 (1).ppt
Design and analysis of Algorithms - Lecture 08 (1).pptZeenaJaba
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithmsDr. Rupa Ch
 
Programming in python
Programming in pythonProgramming in python
Programming in pythonIvan Rojas
 
DAA - chapter 1.pdf
DAA - chapter 1.pdfDAA - chapter 1.pdf
DAA - chapter 1.pdfASMAALWADEE2
 
Regular expressions h1
Regular expressions h1Regular expressions h1
Regular expressions h1Rajendran
 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in Onejehan1987
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithmsGanesh Solanke
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxskilljiolms
 

Similar to Unit -I Toc.pptx (20)

DSA
DSADSA
DSA
 
Basic Foundations of Automata Theory
Basic Foundations of Automata TheoryBasic Foundations of Automata Theory
Basic Foundations of Automata Theory
 
Algorithms and problem solving.pptx
Algorithms and problem solving.pptxAlgorithms and problem solving.pptx
Algorithms and problem solving.pptx
 
Mod1.pdf
Mod1.pdfMod1.pdf
Mod1.pdf
 
Theory of computing
Theory of computingTheory of computing
Theory of computing
 
01.ppt
01.ppt01.ppt
01.ppt
 
Unit 1.pptx
Unit 1.pptxUnit 1.pptx
Unit 1.pptx
 
Propositional logic(part 2)
Propositional logic(part 2)Propositional logic(part 2)
Propositional logic(part 2)
 
Overview_of_a_computational_model_-_Languages_1.ppt
Overview_of_a_computational_model_-_Languages_1.pptOverview_of_a_computational_model_-_Languages_1.ppt
Overview_of_a_computational_model_-_Languages_1.ppt
 
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
Unit I- Data structures Introduction, Evaluation of Algorithms, Arrays, Spars...
 
Design and analysis of Algorithms - Lecture 08 (1).ppt
Design and analysis of Algorithms - Lecture 08 (1).pptDesign and analysis of Algorithms - Lecture 08 (1).ppt
Design and analysis of Algorithms - Lecture 08 (1).ppt
 
UNIT_I [Autosaved].pptx
UNIT_I [Autosaved].pptxUNIT_I [Autosaved].pptx
UNIT_I [Autosaved].pptx
 
Design and Analysis of algorithms
Design and Analysis of algorithmsDesign and Analysis of algorithms
Design and Analysis of algorithms
 
Programming in python
Programming in pythonProgramming in python
Programming in python
 
DAA - chapter 1.pdf
DAA - chapter 1.pdfDAA - chapter 1.pdf
DAA - chapter 1.pdf
 
Regular expressions h1
Regular expressions h1Regular expressions h1
Regular expressions h1
 
Data structure and algorithm All in One
Data structure and algorithm All in OneData structure and algorithm All in One
Data structure and algorithm All in One
 
Analysis of algorithms
Analysis of algorithmsAnalysis of algorithms
Analysis of algorithms
 
intro.ppt
intro.pptintro.ppt
intro.ppt
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 

More from viswanath kani

More from viswanath kani (8)

ContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptxContextFreeGrammars (1).pptx
ContextFreeGrammars (1).pptx
 
Unit2 Toc.pptx
Unit2 Toc.pptxUnit2 Toc.pptx
Unit2 Toc.pptx
 
TuringMachines.pdf
TuringMachines.pdfTuringMachines.pdf
TuringMachines.pdf
 
Pushdown Automaton (1).ppt
Pushdown Automaton (1).pptPushdown Automaton (1).ppt
Pushdown Automaton (1).ppt
 
UNIT 2.pdf
UNIT 2.pdfUNIT 2.pdf
UNIT 2.pdf
 
UNIT 1.pdf
UNIT 1.pdfUNIT 1.pdf
UNIT 1.pdf
 
toc_model_qp2-.pdf
toc_model_qp2-.pdftoc_model_qp2-.pdf
toc_model_qp2-.pdf
 
Bio fuel
Bio fuelBio fuel
Bio fuel
 

Recently uploaded

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVRajaP95
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 

Recently uploaded (20)

Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IVHARMONY IN THE NATURE AND EXISTENCE - Unit-IV
HARMONY IN THE NATURE AND EXISTENCE - Unit-IV
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
VICTOR MAESTRE RAMIREZ - Planetary Defender on NASA's Double Asteroid Redirec...
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 

Unit -I Toc.pptx

  • 1. THEORY OF COMPUTATION Unit –I FINITE AUTOMATA By, T.VISWANATH KANI,M.E., AP/CSE VCEW
  • 2. FINITE AUTOMATA • Introduction • Basic Mathematical Notation and techniques • Finite State systems • Basic Definitions • Finite Automaton • DFA & NDFA • Finite Automaton with €- moves.
  • 3. Introduction The Theory of Computation is a branch of computer science and mathematics combined that "deals with how efficiently problems can be solved on a model of computation, using an algorithm".
  • 4. It studies the general properties of computation which in turn, helps us increase the efficiency at which computers solve problems. This is done when we estimate the validity of the solutions given by the computer through the theory of computation and then alternate the algorithms so that we can obtain a more reliable solution. This is a fast-growing branch that has helped solving problems in many fields beside computer science such as Physics, Economy, Biology and many others
  • 5. Introduction • Before introducing you to the basics of the theory of computation, I would like to talk about the Turing machine, as it plays a good role in explaining this theory: It is theoretical abstract machine used as a model of computation . It uses an infinite memory tape where the information obtained are saved, and analyze these information to determine whether the operation is feasible or not. • This theory is approached through three main fields: 1- Automata theory 2- Computability theory 3- Computational complexity theory
  • 6. 6 Alan Turing (1912-1954) • Father of Modern Computer Science • English mathematician • Studied abstract machines called Turing machines even before computers existed • Heard of the Turing test? (A pioneer of automata theory)
  • 7. 7 Theory of Computation: A Historical Perspective 1930s • Alan Turing studies Turing machines • Decidability • Halting problem 1940-1950s • “Finite automata” machines studied • Noam Chomsky proposes the “Chomsky Hierarchy” for formal languages 1969 Cook introduces “intractable” problems or “NP-Hard” problems 1970- Modern computer science: compilers, computational & complexity theory evolve
  • 8. Importance of Theory of computation The theory of computation forms the basis for: • Writing efficient algorithms that run in computing devices. • Programming language research and their development. • Efficient compiler design and construction.
  • 9. Automata theory • Automata theory (also known as Theory Of Computation) is a theoretical branch of Computer Science and Mathematics, which mainly deals with the logic of computation with respect to simple machines, referred to as automata.
  • 10. • Automata* enables the scientists to understand how machines compute the functions and solve problems. The main motivation behind developing Automata Theory was to develop methods to describe and analyze the dynamic behavior of discrete systems. • Automata is originated from the word “Automaton” which is closely related to “Automation”.
  • 11. Automata theory A basic computation performed on/by an automaton is defined by the following features: • A set of input symbols. • The configuration states. • Output. Branches of Automata theory Finite Automata (FA): This is a computer model that is inferior in its computation ability. This model is fit for devices with limited memory. It is a simple abstract machine with five elements that define its functioning and processing of problems.
  • 12. Computability theory • The Computability theory defines whether a problem is “solvable” by any abstract machine. Some problems are computable while others are not. • Computation is done by various computation models depending on the nature of the problem at hand, examples of these machines are: the Turing machine, Finite state machines, and many others.
  • 13. Complexity theory This theoretical computer science branch is all about studying the cost of solving problems while focusing on resources (time & space) needed as the metric. The running time of an algorithm varies with the inputs and usually grows with the size of the inputs. They are: • Upper (Worst Case Scenario) • Lower (Best Case Scenario) The major classifications of complexities include: • Class P • Class NP
  • 14. Why toc? • Foundation of all model computers •Deep understanding of computer and computing • Theory of pattern matching in web search • Theory of finite automata in sequential circuits • Theory of context free grammars in Compilers •Theory of computational complexity in cryptography and network security
  • 15. Why toc? • Finite automata are a useful model for many important kinds of software and hardware: 1. Software for designing and checking the behaviour of digital circuits 2. The lexical analyser of a typical compiler, that is, the compiler component that breaks the input text into logical units 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 of protocols for secure exchange information
  • 17. Research Areas available in ToC • Design and analysis of algorithms • Cryptography • Quantum Computation • Randomness in computation Applications of ToC • Compiler design • Robotics • Artificial Intelligence • Knowledge Engineering
  • 18. BASIC MATHEMATICAL NOTATIONS AND TECHNIQUES • Symbols- a,b,c,0,1,2,3 • Alphabets-Collection of symbols representing in ∑ • Strings- Array of characters ∑={0,1}-00,01,11,0000,111,... ∑={a,b} - a,b,ab,aa,bb,abc,... • String length of ∑={1,2,3}=3 Notation of length of w: |w| Example: |011| = 3 and | ε | = 0
  • 19. BASIC MATHEMATICAL NOTATIONS AND TECHNIQUES • Empty string is denoted by ε • Concatenation of strings X=0,1. Y=2 XY=012 • Reversing a string Writing the symbols in reverse order U=1010001 U^R=1000101
  • 20. BASIC MATHEMATICAL NOTATIONS AND TECHNIQUES • Power of an alphabet: Let ∑ be an alphabet Then ∑^*-Denotes all the strings over an alphabet ∑ ∑^m – Set of all strings of length m over an alphabet ∑ • For example: ∑={0,1} ∑^0=ε
  • 21. BASIC MATHEMATICAL NOTATIONS AND TECHNIQUES • ∑^1={0,1} • ∑^2={00,10,10,11} • ∑^3={001,100,101,110,111,011,...} • ∑^* =?
  • 24. Language • Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or infinite. • Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L = { ab, aa, ba, bb }
  • 25. Operations on Languages • Concatenation • Reversal • Kleen closure • Positive closure • Union • Intersection
  • 26. Concatenation, Kleene closure • If L1 and L2 are two languages, we define:the concatenation of L1 and L2, denoted by L1L2, as the set of all words given by the concatenation of any word in L1 with any word in L2. L={x|x=uv and u belongs to L1 and v belongs to L2} Ex:If L = {001, 10, 111 } and M = {ǫ, 001 } then L.M = {001, 10, 111, 001001, 10001, 111001 } • The Kleene closure of L, denoted by L*, as the language: L*=L0 U L1 U L2 U ... where L0 is the empty string and Ln=Ln-1L is the language consisting of the words of length n for n>0.
  • 27. Union, Intersection • The union of two languages L and M, denoted L ∪ M, is the set of strings that are in either L, or M, or both. Example If L = {001, 10, 111 } and M = {ǫ, 001 } then L ∪ M = {ǫ, 001, 10, 111 } • Intersection: Let L and M be the languages of regular expressions R and S, respectively then it a regular expression whose language is L intersection M.
  • 28. Set A set is an unordered collection of objects or an unordered collection of elements. Sets are always written with curly braces {}, and the elements in the set are written within the curly braces. Examples  The set {a, b, c} has elements a, b, and c.  The sets {a, b, c} and {b, c, b, a, a} are the same since order does not matter in a set and since redundancy also does not count.
  • 29. Types of Set 1.Finite Set  A set consisting of a natural number of objects, i.e. in which number element is finite is said to be a finite set. Consider the sets  A = { 5, 7, 9, 11} and B = { 4 , 8 , 16, 32, 64, 128}  Obviously, A, B contain a finite number of elements, i.e. 4 objects in A and 6 in B. Thus they are finite sets. 2. Infinite set  If the number of elements in a set is finite, the set is said to be an infinite set.  Thus the set of all natural number is given by N = { 1, 2, 3, ...} is an infinite set. Similarly the set of all rational number between ) and 1 given by  A = {x:x E Q, 0 <x<1} is an infinite set.
  • 30. Types of Set 3.Null set/ empty set A null set or an empty set is a valid set with no member. 4.Subset A subset A is said to be subset of B if every elements which belongs to A also belongs to B. A = { 1, 2, 3} B = { 1, 2, 3, 4} A subset of B.
  • 31. Operations on set • Union • Intersection • Difference
  • 32. Formal proof Formal proof- Try to prove the statement B is true because statement A is true Induction on Integers • To prove a statement S(n) about an integer n by induction, we do: • Basis --- show S(i) true for a particular basis integer i (0 or 1 usually) • Inductive step --- assume n ≥ i (basis integer), and show that the statement “if S(n), then S(n + 1)” is true.
  • 33. Prove 1+2+...+n=n(n+1)/2 using a proof by induction.
  • 34.
  • 35.
  • 36. Homework • Using the principle of mathematical induction, prove that 1)1² + 2² + 3² + ..... + n² = (1/6){n(n + 1)(2n + 1} for all n ∈ N. 2) 1 x 2 + 3 x 4 + 5 x 6 + …. + (2n - 1) x 2n = n(n+1)(4n−1)3 3)1 ∙ 2 + 2 ∙ 3 + 3 ∙ 4 + ..... + n(n + 1) = (1/3){n(n + 1)(n + 2)}.
  • 37. Finite State Machine or Finite Automata A Finite State Machine, or FSM, is a computation model that can be used to simulate sequential logic, or, in other words, to represent and control execution flow. Finite State Machines can be used to model problems in many fields, including mathematics, artificial intelligence, games or linguistics.
  • 38. Finite State Machine • A Finite State Machine is any device storing the state of something at a given time. The state will change based on inputs, providing the resulting output for the implemented changes. • Finite State Machines come from a branch of Computer Science called “automata theory”. The family of data structure belonging to this domain also includes the Turing Machine The important points here are the following:  We have a fixed set of states that the machine can be in  The machine can only be in one state at a time  A sequence of inputs is sent to the machine  Every state has a set of transitions and every transition is associated with an input and pointing to a state
  • 39. Real world examples Coin-operated turnstile • States: locked, unlocked • Transitions: pointing a coin in the slot will unlock the turnstile, pushing the arm of the unlocked turnstile will let the costumer pass and lock the turnstile again Traffic Light • States: Red, Yellow, Green • Transitions: After a given time, Red will change to Green, Green to Yellow, and Yellow to Red
  • 40. FSM
  • 41. Finite-state Automata • Finite-state automata are finite-state machines with no output. • Finite automata have two states, Accept state or Reject state. When the input string is processed successfully, and the automata reached its final state
  • 42. Automata theory • Automata is a theoretical branch of computer science and discrete mathematics that focuses on the logic of simple machines. The types of computational models within automata theory include: • Finite state machines—Models for any system with a limited number of conditional states of being. • Pushdown automata – More complicated than finite state machines, these use regions of memory called stacks to store information as part of a model. • Linear-bounded automata (LBA) – Similar to a Turing machine, but the data is limited to a portion of input within a finite group of inputs. • Turing machines—The most complex mathematical model within automata theory for testing different input combinations to analyze a larger system or problem. • State transition - When a finite state machine switches between states, it is called a state transition.
  • 43. Finite Automata • Finite automata are used to recognize patterns. • It takes the string of symbol as input and changes its state accordingly. When the desired symbol is found, then the transition occurs. • At the time of transition, the automata can either move to the next state or stay in the same state. • Finite automata have two states, Accept state or Reject state. When the input string is processed successfully, and the automata reached its final state, then it will accept. • Formal Definition of FA • A finite automaton is a collection of 5-tuple (Q, ∑, δ, q0, F), where:
  • 44. Finite Automata • Q: finite set of states • ∑: finite set of the input symbol • q0: initial state • F: final state • δ: Transition function
  • 45. Finite Automata Model • Finite automata can be represented by input tape and finite control. • Input tape: It is a linear tape having some number of cells. Each input symbol is placed in each cell. • Finite control: The finite control decides the next state on receiving particular input from input tape. The tape reader reads the cells one by one from left to right, and at a time only one input symbol is read.
  • 47. FA Types • 1. DFA • DFA refers to deterministic finite automata. Deterministic refers to the uniqueness of the computation. In the DFA, the machine goes to one state only for a particular input character. DFA does not accept the null move. • 2. NFA • NFA stands for non-deterministic finite automata. It is used to transmit any number of states for a particular input. It can accept the null move. • Some important points about DFA and NFA: • Every DFA is NFA, but NFA is not DFA. • There can be multiple final states in both NFA and DFA. • DFA is used in Lexical Analysis in Compiler. • NFA is more of a theoretical concept.
  • 48. Transition Diagram • A transition diagram or state transition diagram is a directed graph which can be constructed as follows: • There is a node for each state in Q, which is represented by the circle. • There is a directed edge from node q to node p labeled a if δ(q, a) = p. • In the start state, there is an arrow with no source. • Accepting states or final states are indicating by a double circle.
  • 50. DFA(Deterministic Finite Automata ) A deterministic finite automaton (DFA) consists of 1. a finite set of states (often denoted Q ) 2. a finite set Σ of symbols (alphabet) 3. a transition function that takes as argument a state and a symbol and returns a state (often denoted δ ) 4. a start state often denoted q 0 5. a set of final or accepting states (often denoted F ) We have q 0 ∈ Q and F ⊆ Q
  • 51. Deterministic Finite Automata • DFA is mathematically represented as a 5- tuple (Q, Σ, δ, q 0, F ) • The transition function δ is a function in Q × Σ → Q • Q × Σ is the set of 2-tuples (q, a) with q ∈ Q and a ∈ Σ
  • 52.
  • 53. Regular Language Regular Language: • A language is regular if there exits a DFA for that language. • The language accepted by DFA is RL. Regular Expression: • A Mathematical notation used to describe the regular language. • This is formed by using 3 Symbols: (i). [dot operator] – for concatenation (ii) + [Union operator] –at least 1 occurrence eg) 1+ = {1,11,111,------- (iii) {*} [Closure Operator ] – Zero or more occurrences eg) 1* = {Λ ,1,11,111,…..} Basic Regular Expressions: • Ø is a RE and denotes the empty set. • ε is a RE and denotes the set { ε } • For each a in ∑, a is a RE and denotes the set {a} • If r and s are RE that denoting the languages R and S respectively, then, – (r+s) is a RE that denotes the set (RUS) – (r.s) is a RE that denotes the set R.S – (r)* is a RE that denotes the set R*
  • 54. Graphical Representation of DFA • A DFA can be represented by digraphs called state diagram. In which: • The state is represented by vertices. • The arc labeled with an input character show the transitions. • The initial state is marked with an arrow. • The final state is denoted by a double circle.
  • 56. DFA-Transition Table,Diagram For this example • Q = { q 0, q 1, q 2 } start state q 0 • F = { q 1 } • Σ = { 0, 1 } δ is a function from Q × Σ to Q • δ : Q × Σ → Q • δ ( q 0, 1) = q 0 • δ ( q 0, 0) = q 2
  • 57. Draw a DFA for the language accepting strings ending with ’01’ over input alphabets ∑ = {0, 1} ANS Regular expression for the given language = (0 + 1)*01 Step-01: • All strings of the language ends with substring “01”. • So, length of substring = 2. • Thus, Minimum number of states required in the DFA = 2 + 1 = 3. • It suggests that minimized DFA will have 3 states. Step-02: We will construct DFA for the following strings- 01 001 0101 001101
  • 59. Draw a DFA that accepts a language L over input alphabets ∑ = {0, 1} such that L is the set of all strings starting with ’00’. Solution- Regular expression for the given language = 00(0 + 1)* Step-01: All strings of the language starts with substring “00”. So, length of substring = 2. Thus, Minimum number of states required in the DFA = 2 + 2 = 4. It suggests that minimized DFA will have 4 states. Step-02: We will construct DFA for the following strings- 00 000 00000
  • 61. Example 1: • Q = {q0, q1, q2} • ∑ = {0, 1} • q0 = {q0} • F = {q2}
  • 63. DFA that will accepts the string having odd number of 1's and odd number of 0's
  • 64. Draw a DFA for the language accepting strings ending with ‘abb’ over input alphabets ∑ = {a, b} Solution- Regular expression for the given language = (a + b)*abb Step-01: – All strings of the language ends with substring “abb”. – So, length of substring = 3. – Thus, Minimum number of states required in the DFA = 3 + 1 = 4. – It suggests that minimized DFA will have 4 states. Step-02: We will construct DFA for the following strings- abb aabb ababb abbabb
  • 65.
  • 66. Transition Table StatesInput a b ->q0 q1 q0 q1 q1 q2 q2 q1 q3 q3* q1 q0
  • 67.
  • 68.
  • 69.
  • 70. Ex:Language over alphabet {0,1}: The language { 0n1 k | n≥1 and k≥1}
  • 71. H.W 1.Design a DFA in which set of all strings can be accepted which ends with ab. (Given: Input alphabet, Σ={a, b} Language L ={ab, abab, abaabbab, abbab, bbabaabab ….}) 2. Design a DFA such that: L = {anbm | n,m ≥ 0} (Given: Input alphabet, Σ={a, b} Language L = {ε, a, aa, aaa, b, bb, bbb,ab, aab, aaab, abbb, aabb, aaaabbbb, ...})
  • 72. H.W 3.Design a DFA to accept the strings over s={0,1} with three Consecutive Zero 4.Design a DFA to accept the strings over {0,1} With 011 as substring
  • 73.
  • 75.
  • 76.
  • 77. H.W 1.Show how the string ω1 =aabba and ω2 =aba is processed 2.Check whether the strings “ababba” ,”baab” are accepted by the DFA?
  • 78. NFA or NDFA(Nondeterministic Finite Automato) • NFA refers to Nondeterministic Finite Automaton. A Finite Automata(FA) is said to be non deterministic, if there is more than one possible transition from one state on the same input symbol. A non deterministic finite automata is also set of five tuples and represented as, 5-tuple (Q, ∑, δ, q0, F), where: • Q: finite set of states • ∑: finite set of the input symbol • q0: initial state • F: final state • δ: Transition function
  • 79.
  • 80. NFA Examples • An NFA that accepts all binary strings that end with 101.
  • 81. Transition Table 0 1 A {A} {A,B} B {C} {∅} C {∅} {D} D {∅} {∅}
  • 83. Design a NFA for the transition table as given below:
  • 84. • Design an NFA with ∑ = {0, 1} in which double '1' is followed by double '0'.
  • 85.
  • 86. What is the language accepted by the following finite state automata? a(bb + bba) ∗ ba or ab(bb + bab) ∗a
  • 87. NFA Examples • Give NFAs with the specified number of states recognizing each of the following languages. In all cases, the alphabet is Σ = {0, 1}. (a) The language { w ∈ Σ∗ | w ends with 00 } with three states
  • 88. Design a NFA to accept strings containing the substring,”0101”.
  • 89.
  • 90. • Determine a NFA that accepts L=(aa* (a + b)) .
  • 91. H.W 1.Design a NFA to accept strings over alphabet{0, 1}, such that the third symbol from right end is 0. 2.Design a NFA with no more than five states for the set {ababn : n >= 0}U{aban : n > 0} . 3.Construct a NFA that accepts L={x €{a, b}/ x ends with 'aab‘}
  • 93.
  • 94.
  • 95.
  • 96. H.W StatesInput 0 1 q0 {q0,q1} q2 q1 {q1,q2} q2 {q2,q0} q1 Check Whether the input String 0100 is Accepted or not
  • 97. H.W StatesInput 0 1 q0 {qo,q3} {q0,q1} q1 q2 q2 q2 q2 q3 q4 q4 q4 q4 Consider the given NFA to Check Whether W=01001 is Valid or Not
  • 98. NFA’s with ε −Transitions We extend the class of NFAs by allowing instantaneous (ε) transitions: 1. The automaton may be allowed to change its state without reading the input symbol. 2. In diagrams, such transitions are depicted by labeling the appropriate arcs with ε. 3. Note that this does not mean that ε has become an input symbol. On the contrary, we assume that the symbol ε does not belong to any alphabet.
  • 100. 1.Find the ε-closure of the states 1,2 and 4 in the following transition diagram ε-closure(1)={1,2,3,4,6} ε-closure(2)={2,3,6} ε-closure(4)={4}
  • 101. 1.Find the ε-closure for the following transition diagram ε-closure(A)={A,B,C} ε-closure(B)={B,C} ε-closure(C)={C}
  • 102. H.W Find ε-closure of the all states
  • 103. ε-closure NFA String Acceptance find
  • 104.
  • 105.
  • 106. Conversion from NFA to DFA • Steps for converting NFA to DFA: • Step 1: Initially Q' = ϕ • Step 2: Add q0 of NFA to Q'. Then find the transitions from this start state. • Step 3: In Q', find the possible set of states for each input symbol. If this set of states is not in Q', then add it to Q'. • Step 4: In DFA, the final state will be all the states which contain F(final states of NFA)
  • 107. 1.Convert the given NFA to DFA.
  • 108. • Now we will obtain δ' transition for state q0. • δ'([q0], 0) = [q0] • δ'([q0], 1) = [q1] • The δ' transition for state q1 is obtained as: • δ'([q1], 0) = [q1, q2] (new state generated) δ'([q1], 1) = [q1] • The δ' transition for state q2 is obtained as: • δ'([q2], 0) = [q2] • δ'([q2], 1) = [q1, q2]
  • 109. • δ'([q1, q2], 0) = δ(q1, 0) ∪ δ(q2, 0) • = {q1, q2} ∪ {q2} • = [q1, q2] • δ'([q1, q2], 1) = δ(q1, 1) ∪ δ(q2, 1) • = {q1} ∪ {q1, q2} • = {q1, q2} • = [q1, q2] • The state [q1, q2] is the final state as well because it contains a final state q2. The transition table for the constructed DFA will be:
  • 110. 0,1
  • 111. H.W Convert NFA TO DFA 0 1 q0 {q0,q1} {q1} q1 - {q0,q1}