Introduction toAutomata Theory
Unit – I
By Dr.T.P.Latchoumi
BY DR.T.P.LATCHOUMI
UNIT 1
• Introduction to Automaton
• Mathematical concepts
• Formal Languages: Strings, Languages, Properties
• Finite Representation : Regular Expressions
• Problems related to regular expressions
• Finite Automata :Deterministic Finite Automata
• Nondeterministic Finite Automata
• Finite Automaton with €- moves
• Problems related to Deterministic and Nondeterministic Finite
Automata
• Problems related to Finite Automaton with €- moves
• Minimization of DFA
• Problems related to Minimization of DFA
• Regular Languages : Equivalence of Finite Automata and
Regular Languages
• Equivalence of Finite Automata and Regular Grammars
• Problems related to Equivalence of Finite Automata and
Regular Languages and Regular Grammars
• Variants of Finite Automata :Two-way Finite Automaton Mealy
Machines
• Properties of Regular Languages: Closure Properties
• Set Theoretic Properties & Other Properties
• Pumping Lemma
BY DR.T.P.LATCHOUMI
What is Automata Theory?
Study of abstract computing devices, or ―machines‖
Automaton = an abstract computing device
Note: A ―device‖ need not even be a physical hardware!
A fundamental question in computer science:
Find out what different models of machines can do and cannot do
The theory of computation
Computability vs. Complexity
BY DR.T.P.LATCHOUMI
(A pioneer of automata theory)
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?
BY DR.T.P.LATCHOUMI
Theory of Computation: A Historical
Perspective
BY DR.T.P.LATCHOUMI
Why Automata Theory?
Automata theory is important because it allows scientists to understand how
machines solve problems.
An automaton is any machine that uses a specific, repeatable process to convert
information into different forms. Modern computers are a common example of
an automaton.
BY DR.T.P.LATCHOUMI
Introduction to formal proof
The Statement ―If A then B‖ means that B is deduced from A.
In this statement A is called hypothesis and B is called conclusion
statement.
BY DR.T.P.LATCHOUMI
Types of formal proof
Deductive proof
◦ It consists of a sequence of statements given with logical reasoning to prove
the first (or initial) statement.
◦ The first statement is called hypothesis.
Inductive proof
◦ It is a recursive kind of proof which consists of sequence of parameterized
statements that cure statement itself with lower values of its parameters
BY DR.T.P.LATCHOUMI
Inductive Proof (Example)
BY DR.T.P.LATCHOUMI
Cont.….
1. Show that the base case is true
2. Assume it is true for some n=k
3. Show that this implies that it is also true for n=k+1
BY DR.T.P.LATCHOUMI
Cont.…..
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Example 2
Prove that1 2 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 6
For all positive integers n.
Solution: Statement P (n) is defined by
1 2 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 2
We first show that p (1) is true.
LHS = 1 2 = 1
RHS = 1 (1 + 1) (2*1 + 1)/ 6 = 1
Both sides of the statement are equal hence p (1) is true.
BY DR.T.P.LATCHOUMI
Cont.…
2. We now assume that p (k) is true
1 2 + 2 2 + 3 2 + ... + k 2 = k (k + 1) (2k + 1)/ 6 and show
that p (k + 1) is true by adding (k + 1) 2 to both sides of the
above statement
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Additional forms of Proofs
I. Proofs about sets
II. Proofs by contradiction
III. Proofs by counter example
BY DR.T.P.LATCHOUMI
Proofs about sets
Set is a collection of elements or items. Let us consider two sets A and B.
Define the expression R as union of A and B (i.e. AUB) and S as union of B and
A (i.e. BUA), where U is the Union operation U on two sets A and B such that if
x ϵ AUB iff x is in A or x is in B.
Prove that R=S(i.e, x is in R if and only if it is in S)
BY DR.T.P.LATCHOUMI
Proof
To prove R=S, we must prove
AUB=BUA
S.No. Statement Justification
1 x is in AUB Given
2 x is in A or x is in B By definition of union & (1)
3 x is in B or x is in A By definition of union & (2)
4 x is in BUA By definition of union & (3)
i) x is in AUB then it is in BUA
ii) x is in BUA then it is in AUB
S.No. Statement Justification
1 x is in BUA Given
2 x is in B or x is in A By definition of union & (1)
3 x is in A or x is in B By definition of union & (2)
4 x is in AUB By definition of union & (3)
BY DR.T.P.LATCHOUMI
Proofs by
contradiction
Example: Prove PUQ = QUP
Proof: Initially assume, PUQ = QUP is not true
i.e. PUQ ≠ QUP
Now consider, x is in PUQ
x is in P or x is in Q (By Definition of Union)
x is in Q or x is in P (By Definition of Union)
x is in QUP (By Definition of Union)
This contradicts our assumption PUQ ≠ QUP
Hence the assumption which we made initially is false.
Therefore PUQ = QUP is proved.
• In proof by contradiction, to
prove the statement of the form
―if A true then B true‖, We start
with statement A is not true by
assumption and try to get the
conclusion statement B.
• When it impossible to reach B
then we contradict our self and
accept that A is true.
BY DR.T.P.LATCHOUMI
Proofs by counter
Example 1: There is no pair of integers a and b such that a mod b
= b mod a
Proof: There are two possibilities. They are either a>b or a<b.
If a=2 and b=3 then 2 mod 3 ≠ 3 mod 2
If a=3 and b=2 then 3 mod 2 ≠ 2 mod 3
If a=b=2 then 2 mod 2 = 2 mod 2, so the given statement is true
only if a=b, so we have to change the statement slightly, Thus, a mod b
= b mod a true only when a=b.
We proved by counter example; this type of proof is called proof
by counter example. Such proof is true only at specific conditions.
• To prove certain statements, we
need to check all the possible
conditions in which that
statement remains true.
• There are some situations in
which the statement cannot be
true.
BY DR.T.P.LATCHOUMI
Example :2
Let n = 1, P(1) = 42(1) + 1 + 3(1) + 2= 43 + 33 = 64 + 27 = 91 = 13.t where t= 7
Let n = k, P(k) = 42(k) + 1 + 3(k) + 2= 42k + 1 + 3k + 2 = 13.t, true for some integer t
Let n = k + 1, P(k + 1) = 42(k + 1) + 1 + 3(k + 1) + 2
= 42(k + 1) + 1 + 3(k + 1) + 2
= 42k + 2 + 1 + 3k + 1 + 2
= 42k + 1 + 2 + 3k + 2 + 1
= 42k + 1.42 + 3k + 2.31
= 42.42k + 1 + 3.3k + 2
= 42.42k + 1 + 423k+2 - 423k+2 + 3.3k + 2 {Add & Sub 423k+2}
= 42(42k + 1 + 3k+2) + 3k+2 (-42+ 3)
= 42(13.t)- 3k+2 (-42+ 3) {42k + 1 + 3k + 2 = 13.t} = 16(13.t)- 3k+2 (-13)
= 13[16. t + 3k+2] = Multiple of 13
P(k + 1) is multiple of 13, Hence proved.
Prove that every integer n ≥ 0, the
number 42n + 1 + 3n + 2 is multiple of
13 by induction.
BY DR.T.P.LATCHOUMI
Formal Language
 Language is a set of valid strings from some alphabet. The set may be empty, finite, or infinite.
 L (M) is the language defined by machine M and L(G) is the language defined by context free grammar.
The two notations for specifying formal languages are:
 Grammar or regular expression (Generative approach).
 Automaton (Recognition approach).
BY DR.T.P.LATCHOUMI
Alphabet
An alphabet is a finite nonempty set of symbols. The symbol Σ is used to denote the alphabet.
1) Σ = {0, 1}
2) Σ = {a, b, c, …, z}
3) Σ = Set of ASII character
BY DR.T.P.LATCHOUMI
String
A string is a finite sequence of symbols chosen from some alphabet.
1) Σ = {0,1} 11001 [ Empty string is denoted by ε]
2) Σ = {a, b, c}  aabbcbbbaa
The total number of symbols in the string is called length of the string
Example: 1) |0001|=4
2) |100|=3
BY DR.T.P.LATCHOUMI
Empty string (ε)
Empty string is the string with zero occurrence of symbol. This empty string is denoted by ε.
Power of an alphabet
BY DR.T.P.LATCHOUMI
Power of an alphabet
If Σ is an alphabet, then the set of all string of certain length forms an alphabet. 𝑘 to be
the set of string of length k for each symbol in Σ.
Example
∑ = {0, 1}
0 ={ε}
1 = {0, 1}
2 = {00, 01, 10, 11}
3 = {000, 001, 010, 011, 100, 101, 110, 111}
+ = 1 𝑈 2 𝑈 3 …
∑+ = 𝑖
∗ = 0 𝑈 1 𝑈 2 …
∑∗ = 𝑖
Set of all strings over an alphabet is denoted by ∑∗
Set of all strings over an alphabet except null string is denoted by ∑+
BY DR.T.P.LATCHOUMI
Concatenation of strings
Let X and Y be the two strings over Σ = {a, b, c}. Then XY denotes the concatenation of X and Y.
X = aabb
Y = cccc
XY = aabbcccc
YX = ccccaabb
BY DR.T.P.LATCHOUMI
Language
It is a collection of all strings.
A set of strings of all which are chosen from ∑∗ is called a language, where ∑ is a particular alphabet set.
BY DR.T.P.LATCHOUMI
Substring, suffix and prefix
Substring: For a string w, the string x is a substring of w if the string x appears contiguously in w.
As such, for w =abcdef
we have that bcd is a substring of w,
but ace is not a substring of w.
Suffix and prefix: A string x is a suffix of w if its a substring of w appearing in the end of w.
Similarly, y is a prefix of w if y is a substring of w appearing in the beginning of w.
As such, for w =abcdef
we have that abc is a prefix of w,
and def is a suffix of w.
BY DR.T.P.LATCHOUMI
Binary relations on strings
1. Prefix - u is a prefix of v if there is a w such that v = uw.
◦ Examples:
◦  is a prefix of 0 since 0 = 0
◦ apple is a prefix of appleton since appleton = apple.ton
2. Suffix - u is a suffix of v if there is a w such that v = wu.
◦ Examples:
◦  is a suffix of 0 since 0 =0 
◦ ton is a suffix of appleton since= apple.ton
BY DR.T.P.LATCHOUMI
3. Substring - u is a substring of v if there are x and y such that v = xuy.
◦ Examples:
◦ let is a substring of appleton since appleton = app.let.on
◦ 0 is a substring of 0 since 0 = epsilon.0.epsilon
Observe that prefix and suffix are special cases
of substring.
BY DR.T.P.LATCHOUMI
Finite Automata
BY DR.T.P.LATCHOUMI
Types of finite automata (FA)
 Deterministic Finite Automata (DFA)
 Nondeterministic Finite Automata (NFA)
BY DR.T.P.LATCHOUMI
Transition
diagram
BY DR.T.P.LATCHOUMI
Transition
table
• A transition table is a conventional table
represent of a function like in FA.
• That takes two argument and return a
value.
• The rows of the table correspond to the
state and column corresponds to the input
symbols.
• Row corresponds to states of automata
and columns correspond to input symbols.
• The entry for row correspond to state q
and column corresponding to the input
symbol ‗a‘ is the state δ(q,a).
BY DR.T.P.LATCHOUMI
Deterministic Finite Automata
(DFA)
◦ Definition
◦ Finite automata are called Deterministic automata if there is only one path for its specified input from current
state to next state.
◦ A DFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −
◦ Q is a finite set of states.
◦ ∑ is a finite set of symbols called alphabet.
◦ δ is the transition function where δ: Q × ∑ → Q
◦ q0 is the initial state from where any input is processed (q0 ∈ Q).
◦ F is a set of final state/states of Q (F ⊆ Q).
BY DR.T.P.LATCHOUMI
Graphical Representation of a
DFA
A DFA is represented by digraphs called state diagram.
 The vertices represent the states.
 The arcs labelled with an input alphabet show the transitions.
 The initial state is denoted by an empty single incoming arc.
 The final state is indicated by double circles.
BY DR.T.P.LATCHOUMI
Example 1
BY DR.T.P.LATCHOUMI
Example 2
Design FA which accepts only those
strings which start with 0 and end
with 1 over the input set Σ = {0, 1}
BY DR.T.P.LATCHOUMI
Example 3
Design FA & State Table which
accepts odd number of 1‘s and any
number of 0‘s.
BY DR.T.P.LATCHOUMI
Nondeterministic Finite Automata
(NFA)
 FA is also called as NFA when many paths are specified in code from the current state to next state.
 In NDFA, for a particular input symbol, the machine can move to any combination of the states in the machine.
 In other words, the exact state to which the machine moves cannot be determined.
 Hence, it is called Non-deterministic Automaton.
 As it has finite number of states, the machine is called Non-deterministic Finite Machine or Non-deterministic Finite
Automaton.
BY DR.T.P.LATCHOUMI
Formal Definition of an NDFA
An NDFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −
Q is a finite set of states.
∑ is a finite set of symbols called alphabets.
δ is the transition function where δ: Q × ∑ → 2Q (Here the power set of Q (2Q) has been taken because in case of
NDFA, from a state, transition can occur to any combination of Q states)
q0 is the initial state from where any input is processed (q0 ∈ Q).
F is a set of final state/states of Q (F ⊆ Q).
BY DR.T.P.LATCHOUMI
Graphical Representation of an
NDFA: (same as DFA)
An NDFA is represented by digraphs called state diagram.
 The vertices represent the states.
 The arcs labelled with an input alphabet show the transitions.
 The initial state is denoted by an empty single incoming arc.
 The final state is indicated by double circles.
BY DR.T.P.LATCHOUMI
Example 1
Let a non-deterministic finite automaton be
Q = {a, b, c}
∑ = {0, 1}
q0 = {a}
F = {c}
BY DR.T.P.LATCHOUMI
Example 2
Construct NFA
where L= {0101* + 0100 n ≥ 0}
over the string ∑= {0,1}
BY DR.T.P.LATCHOUMI
Differences between DFA and NFA
DFA NFA
The transition from a state is to a single next state for each input symbol.
Hence it is called deterministic.
The transition from a state can be to multiple next states for each input
symbol. Hence it is called non-deterministic.
The transition mapping for DFA is Q x ∑ —> Q. The transition mapping for NFA is Q x (∑ U {ε}) —> 2Q
Empty string transitions are not seen in DFA. NDFA permits empty string transitions.
Backtracking is allowed in DFA In NDFA, backtracking is not always possible.
Requires more space. Requires less space.
A string is accepted by a DFA if it transits to a final state. A string is accepted by a NDFA, if at least one of all possible transitions
ends in a final state.
BY DR.T.P.LATCHOUMI
FA with Epsilon transition
The ε transition in NFA is given to move from one state to another without having any
symbol from input.
The language accepted by NFA with epsilon transition is represented 5 tuples (Q, ∑, δ,
q0, F) Where, M is the NFA with ε moves.
Q is the finite set of non-empty states.
∑ is the finite set of non-empty symbols.
δ is the finite set of transitions.
q0 is the initial state.
F is the final state.
BY DR.T.P.LATCHOUMI
Epsilon closure (p)
It is set of all state which are reachable from state p or epsilon transition such that
1) ε closure (p) ={p}, Where p € Q
2) If there exist ε -closure (p) ={q} and δ (q, ε) = r, then ε closure (p) = {q, r}.
BY DR.T.P.LATCHOUMI
Example 1
Find the ε closure for the following
NFA with ε
BY DR.T.P.LATCHOUMI
Example 2
Construct NFA with ɛ which accepts a
language consisting g the strings of any
number of a‘s followed by any number of
b‘s followed by any number of c‘s.
Solution
Here any number of a‘s or b‘s or c‘s means
zero or more in number.
That means there can be zero or more a‘s
followed by zero or more b‘s followed by
more c‘s.
Hence the NFA with ɛ moves can be
Transition Table: a B c ɛ
q0 q0 Φ ϕ q1
q1 ϕ q1 ϕ q2
q2 ϕ Φ q2 ϕ
We can parse the string aabbcc as follows.
 (q0,aabbcc) -  (q0,abbcc)
 (q0,bbcc)
 (q1, bbcc)
 (q1, bcc)
 (q2, cc)
 (q2, c)
 (q2, ɛ )
Hence, we reached the accept state after scanning the complete input string.
BY DR.T.P.LATCHOUMI
Conversion from NFA with ε to
NFA without ε
1) Find all the ε transition for each state from Q that will be called as ε closure {qi} Where {qi} is the
element of Q
2) δ‘ transition can be obtained from δ transition. i.e., an ε closure of δ.
3) Step 2 is repeated for each input symbol and for each state of given NFA.
4) Using the resultant state, the transition table for equivalent NFA without ε can be built.
BY DR.T.P.LATCHOUMI
Example
Convert the given NFA with ε
transition to NFA without ε
transition
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Cont.….
BY DR.T.P.LATCHOUMI
Theorem
Equivalence of
NFA with ε
without ε
moves
BY DR.T.P.LATCHOUMI
Conversion of
NFA to DFA
BY DR.T.P.LATCHOUMI
Example 1
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Example 2
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Theorem
Equivalence of NFA and DFA
BY DR.T.P.LATCHOUMI
Method for conversion NFA with ε to
DFA
BY DR.T.P.LATCHOUMI
Example
BY DR.T.P.LATCHOUMI
Cont.…
BY DR.T.P.LATCHOUMI
Cont.….
BY DR.T.P.LATCHOUMI
BY DR.T.P.LATCHOUMI

Unit i

  • 1.
    Introduction toAutomata Theory Unit– I By Dr.T.P.Latchoumi BY DR.T.P.LATCHOUMI
  • 2.
    UNIT 1 • Introductionto Automaton • Mathematical concepts • Formal Languages: Strings, Languages, Properties • Finite Representation : Regular Expressions • Problems related to regular expressions • Finite Automata :Deterministic Finite Automata • Nondeterministic Finite Automata • Finite Automaton with €- moves • Problems related to Deterministic and Nondeterministic Finite Automata • Problems related to Finite Automaton with €- moves • Minimization of DFA • Problems related to Minimization of DFA • Regular Languages : Equivalence of Finite Automata and Regular Languages • Equivalence of Finite Automata and Regular Grammars • Problems related to Equivalence of Finite Automata and Regular Languages and Regular Grammars • Variants of Finite Automata :Two-way Finite Automaton Mealy Machines • Properties of Regular Languages: Closure Properties • Set Theoretic Properties & Other Properties • Pumping Lemma BY DR.T.P.LATCHOUMI
  • 3.
    What is AutomataTheory? Study of abstract computing devices, or ―machines‖ Automaton = an abstract computing device Note: A ―device‖ need not even be a physical hardware! A fundamental question in computer science: Find out what different models of machines can do and cannot do The theory of computation Computability vs. Complexity BY DR.T.P.LATCHOUMI
  • 4.
    (A pioneer ofautomata theory) 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? BY DR.T.P.LATCHOUMI
  • 5.
    Theory of Computation:A Historical Perspective BY DR.T.P.LATCHOUMI
  • 6.
    Why Automata Theory? Automatatheory is important because it allows scientists to understand how machines solve problems. An automaton is any machine that uses a specific, repeatable process to convert information into different forms. Modern computers are a common example of an automaton. BY DR.T.P.LATCHOUMI
  • 7.
    Introduction to formalproof The Statement ―If A then B‖ means that B is deduced from A. In this statement A is called hypothesis and B is called conclusion statement. BY DR.T.P.LATCHOUMI
  • 8.
    Types of formalproof Deductive proof ◦ It consists of a sequence of statements given with logical reasoning to prove the first (or initial) statement. ◦ The first statement is called hypothesis. Inductive proof ◦ It is a recursive kind of proof which consists of sequence of parameterized statements that cure statement itself with lower values of its parameters BY DR.T.P.LATCHOUMI
  • 9.
  • 10.
    Cont.…. 1. Show thatthe base case is true 2. Assume it is true for some n=k 3. Show that this implies that it is also true for n=k+1 BY DR.T.P.LATCHOUMI
  • 11.
  • 12.
  • 13.
    Example 2 Prove that12 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 6 For all positive integers n. Solution: Statement P (n) is defined by 1 2 + 2 2 + 3 2 + ... + n 2 = n (n + 1) (2n + 1)/ 2 We first show that p (1) is true. LHS = 1 2 = 1 RHS = 1 (1 + 1) (2*1 + 1)/ 6 = 1 Both sides of the statement are equal hence p (1) is true. BY DR.T.P.LATCHOUMI
  • 14.
    Cont.… 2. We nowassume that p (k) is true 1 2 + 2 2 + 3 2 + ... + k 2 = k (k + 1) (2k + 1)/ 6 and show that p (k + 1) is true by adding (k + 1) 2 to both sides of the above statement BY DR.T.P.LATCHOUMI
  • 15.
  • 16.
    Additional forms ofProofs I. Proofs about sets II. Proofs by contradiction III. Proofs by counter example BY DR.T.P.LATCHOUMI
  • 17.
    Proofs about sets Setis a collection of elements or items. Let us consider two sets A and B. Define the expression R as union of A and B (i.e. AUB) and S as union of B and A (i.e. BUA), where U is the Union operation U on two sets A and B such that if x ϵ AUB iff x is in A or x is in B. Prove that R=S(i.e, x is in R if and only if it is in S) BY DR.T.P.LATCHOUMI
  • 18.
    Proof To prove R=S,we must prove AUB=BUA S.No. Statement Justification 1 x is in AUB Given 2 x is in A or x is in B By definition of union & (1) 3 x is in B or x is in A By definition of union & (2) 4 x is in BUA By definition of union & (3) i) x is in AUB then it is in BUA ii) x is in BUA then it is in AUB S.No. Statement Justification 1 x is in BUA Given 2 x is in B or x is in A By definition of union & (1) 3 x is in A or x is in B By definition of union & (2) 4 x is in AUB By definition of union & (3) BY DR.T.P.LATCHOUMI
  • 19.
    Proofs by contradiction Example: ProvePUQ = QUP Proof: Initially assume, PUQ = QUP is not true i.e. PUQ ≠ QUP Now consider, x is in PUQ x is in P or x is in Q (By Definition of Union) x is in Q or x is in P (By Definition of Union) x is in QUP (By Definition of Union) This contradicts our assumption PUQ ≠ QUP Hence the assumption which we made initially is false. Therefore PUQ = QUP is proved. • In proof by contradiction, to prove the statement of the form ―if A true then B true‖, We start with statement A is not true by assumption and try to get the conclusion statement B. • When it impossible to reach B then we contradict our self and accept that A is true. BY DR.T.P.LATCHOUMI
  • 20.
    Proofs by counter Example1: There is no pair of integers a and b such that a mod b = b mod a Proof: There are two possibilities. They are either a>b or a<b. If a=2 and b=3 then 2 mod 3 ≠ 3 mod 2 If a=3 and b=2 then 3 mod 2 ≠ 2 mod 3 If a=b=2 then 2 mod 2 = 2 mod 2, so the given statement is true only if a=b, so we have to change the statement slightly, Thus, a mod b = b mod a true only when a=b. We proved by counter example; this type of proof is called proof by counter example. Such proof is true only at specific conditions. • To prove certain statements, we need to check all the possible conditions in which that statement remains true. • There are some situations in which the statement cannot be true. BY DR.T.P.LATCHOUMI
  • 21.
    Example :2 Let n= 1, P(1) = 42(1) + 1 + 3(1) + 2= 43 + 33 = 64 + 27 = 91 = 13.t where t= 7 Let n = k, P(k) = 42(k) + 1 + 3(k) + 2= 42k + 1 + 3k + 2 = 13.t, true for some integer t Let n = k + 1, P(k + 1) = 42(k + 1) + 1 + 3(k + 1) + 2 = 42(k + 1) + 1 + 3(k + 1) + 2 = 42k + 2 + 1 + 3k + 1 + 2 = 42k + 1 + 2 + 3k + 2 + 1 = 42k + 1.42 + 3k + 2.31 = 42.42k + 1 + 3.3k + 2 = 42.42k + 1 + 423k+2 - 423k+2 + 3.3k + 2 {Add & Sub 423k+2} = 42(42k + 1 + 3k+2) + 3k+2 (-42+ 3) = 42(13.t)- 3k+2 (-42+ 3) {42k + 1 + 3k + 2 = 13.t} = 16(13.t)- 3k+2 (-13) = 13[16. t + 3k+2] = Multiple of 13 P(k + 1) is multiple of 13, Hence proved. Prove that every integer n ≥ 0, the number 42n + 1 + 3n + 2 is multiple of 13 by induction. BY DR.T.P.LATCHOUMI
  • 22.
    Formal Language  Languageis a set of valid strings from some alphabet. The set may be empty, finite, or infinite.  L (M) is the language defined by machine M and L(G) is the language defined by context free grammar. The two notations for specifying formal languages are:  Grammar or regular expression (Generative approach).  Automaton (Recognition approach). BY DR.T.P.LATCHOUMI
  • 23.
    Alphabet An alphabet isa finite nonempty set of symbols. The symbol Σ is used to denote the alphabet. 1) Σ = {0, 1} 2) Σ = {a, b, c, …, z} 3) Σ = Set of ASII character BY DR.T.P.LATCHOUMI
  • 24.
    String A string isa finite sequence of symbols chosen from some alphabet. 1) Σ = {0,1} 11001 [ Empty string is denoted by ε] 2) Σ = {a, b, c}  aabbcbbbaa The total number of symbols in the string is called length of the string Example: 1) |0001|=4 2) |100|=3 BY DR.T.P.LATCHOUMI
  • 25.
    Empty string (ε) Emptystring is the string with zero occurrence of symbol. This empty string is denoted by ε. Power of an alphabet BY DR.T.P.LATCHOUMI
  • 26.
    Power of analphabet If Σ is an alphabet, then the set of all string of certain length forms an alphabet. 𝑘 to be the set of string of length k for each symbol in Σ. Example ∑ = {0, 1} 0 ={ε} 1 = {0, 1} 2 = {00, 01, 10, 11} 3 = {000, 001, 010, 011, 100, 101, 110, 111} + = 1 𝑈 2 𝑈 3 … ∑+ = 𝑖 ∗ = 0 𝑈 1 𝑈 2 … ∑∗ = 𝑖 Set of all strings over an alphabet is denoted by ∑∗ Set of all strings over an alphabet except null string is denoted by ∑+ BY DR.T.P.LATCHOUMI
  • 27.
    Concatenation of strings LetX and Y be the two strings over Σ = {a, b, c}. Then XY denotes the concatenation of X and Y. X = aabb Y = cccc XY = aabbcccc YX = ccccaabb BY DR.T.P.LATCHOUMI
  • 28.
    Language It is acollection of all strings. A set of strings of all which are chosen from ∑∗ is called a language, where ∑ is a particular alphabet set. BY DR.T.P.LATCHOUMI
  • 29.
    Substring, suffix andprefix Substring: For a string w, the string x is a substring of w if the string x appears contiguously in w. As such, for w =abcdef we have that bcd is a substring of w, but ace is not a substring of w. Suffix and prefix: A string x is a suffix of w if its a substring of w appearing in the end of w. Similarly, y is a prefix of w if y is a substring of w appearing in the beginning of w. As such, for w =abcdef we have that abc is a prefix of w, and def is a suffix of w. BY DR.T.P.LATCHOUMI
  • 30.
    Binary relations onstrings 1. Prefix - u is a prefix of v if there is a w such that v = uw. ◦ Examples: ◦  is a prefix of 0 since 0 = 0 ◦ apple is a prefix of appleton since appleton = apple.ton 2. Suffix - u is a suffix of v if there is a w such that v = wu. ◦ Examples: ◦  is a suffix of 0 since 0 =0  ◦ ton is a suffix of appleton since= apple.ton BY DR.T.P.LATCHOUMI
  • 31.
    3. Substring -u is a substring of v if there are x and y such that v = xuy. ◦ Examples: ◦ let is a substring of appleton since appleton = app.let.on ◦ 0 is a substring of 0 since 0 = epsilon.0.epsilon Observe that prefix and suffix are special cases of substring. BY DR.T.P.LATCHOUMI
  • 32.
  • 33.
    Types of finiteautomata (FA)  Deterministic Finite Automata (DFA)  Nondeterministic Finite Automata (NFA) BY DR.T.P.LATCHOUMI
  • 34.
  • 35.
    Transition table • A transitiontable is a conventional table represent of a function like in FA. • That takes two argument and return a value. • The rows of the table correspond to the state and column corresponds to the input symbols. • Row corresponds to states of automata and columns correspond to input symbols. • The entry for row correspond to state q and column corresponding to the input symbol ‗a‘ is the state δ(q,a). BY DR.T.P.LATCHOUMI
  • 36.
    Deterministic Finite Automata (DFA) ◦Definition ◦ Finite automata are called Deterministic automata if there is only one path for its specified input from current state to next state. ◦ A DFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where − ◦ Q is a finite set of states. ◦ ∑ is a finite set of symbols called alphabet. ◦ δ is the transition function where δ: Q × ∑ → Q ◦ q0 is the initial state from where any input is processed (q0 ∈ Q). ◦ F is a set of final state/states of Q (F ⊆ Q). BY DR.T.P.LATCHOUMI
  • 37.
    Graphical Representation ofa DFA A DFA is represented by digraphs called state diagram.  The vertices represent the states.  The arcs labelled with an input alphabet show the transitions.  The initial state is denoted by an empty single incoming arc.  The final state is indicated by double circles. BY DR.T.P.LATCHOUMI
  • 38.
  • 39.
    Example 2 Design FAwhich accepts only those strings which start with 0 and end with 1 over the input set Σ = {0, 1} BY DR.T.P.LATCHOUMI
  • 40.
    Example 3 Design FA& State Table which accepts odd number of 1‘s and any number of 0‘s. BY DR.T.P.LATCHOUMI
  • 41.
    Nondeterministic Finite Automata (NFA) FA is also called as NFA when many paths are specified in code from the current state to next state.  In NDFA, for a particular input symbol, the machine can move to any combination of the states in the machine.  In other words, the exact state to which the machine moves cannot be determined.  Hence, it is called Non-deterministic Automaton.  As it has finite number of states, the machine is called Non-deterministic Finite Machine or Non-deterministic Finite Automaton. BY DR.T.P.LATCHOUMI
  • 42.
    Formal Definition ofan NDFA An NDFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where − Q is a finite set of states. ∑ is a finite set of symbols called alphabets. δ is the transition function where δ: Q × ∑ → 2Q (Here the power set of Q (2Q) has been taken because in case of NDFA, from a state, transition can occur to any combination of Q states) q0 is the initial state from where any input is processed (q0 ∈ Q). F is a set of final state/states of Q (F ⊆ Q). BY DR.T.P.LATCHOUMI
  • 43.
    Graphical Representation ofan NDFA: (same as DFA) An NDFA is represented by digraphs called state diagram.  The vertices represent the states.  The arcs labelled with an input alphabet show the transitions.  The initial state is denoted by an empty single incoming arc.  The final state is indicated by double circles. BY DR.T.P.LATCHOUMI
  • 44.
    Example 1 Let anon-deterministic finite automaton be Q = {a, b, c} ∑ = {0, 1} q0 = {a} F = {c} BY DR.T.P.LATCHOUMI
  • 45.
    Example 2 Construct NFA whereL= {0101* + 0100 n ≥ 0} over the string ∑= {0,1} BY DR.T.P.LATCHOUMI
  • 46.
    Differences between DFAand NFA DFA NFA The transition from a state is to a single next state for each input symbol. Hence it is called deterministic. The transition from a state can be to multiple next states for each input symbol. Hence it is called non-deterministic. The transition mapping for DFA is Q x ∑ —> Q. The transition mapping for NFA is Q x (∑ U {ε}) —> 2Q Empty string transitions are not seen in DFA. NDFA permits empty string transitions. Backtracking is allowed in DFA In NDFA, backtracking is not always possible. Requires more space. Requires less space. A string is accepted by a DFA if it transits to a final state. A string is accepted by a NDFA, if at least one of all possible transitions ends in a final state. BY DR.T.P.LATCHOUMI
  • 47.
    FA with Epsilontransition The ε transition in NFA is given to move from one state to another without having any symbol from input. The language accepted by NFA with epsilon transition is represented 5 tuples (Q, ∑, δ, q0, F) Where, M is the NFA with ε moves. Q is the finite set of non-empty states. ∑ is the finite set of non-empty symbols. δ is the finite set of transitions. q0 is the initial state. F is the final state. BY DR.T.P.LATCHOUMI
  • 48.
    Epsilon closure (p) Itis set of all state which are reachable from state p or epsilon transition such that 1) ε closure (p) ={p}, Where p € Q 2) If there exist ε -closure (p) ={q} and δ (q, ε) = r, then ε closure (p) = {q, r}. BY DR.T.P.LATCHOUMI
  • 49.
    Example 1 Find theε closure for the following NFA with ε BY DR.T.P.LATCHOUMI
  • 50.
    Example 2 Construct NFAwith ɛ which accepts a language consisting g the strings of any number of a‘s followed by any number of b‘s followed by any number of c‘s. Solution Here any number of a‘s or b‘s or c‘s means zero or more in number. That means there can be zero or more a‘s followed by zero or more b‘s followed by more c‘s. Hence the NFA with ɛ moves can be Transition Table: a B c ɛ q0 q0 Φ ϕ q1 q1 ϕ q1 ϕ q2 q2 ϕ Φ q2 ϕ We can parse the string aabbcc as follows.  (q0,aabbcc) -  (q0,abbcc)  (q0,bbcc)  (q1, bbcc)  (q1, bcc)  (q2, cc)  (q2, c)  (q2, ɛ ) Hence, we reached the accept state after scanning the complete input string. BY DR.T.P.LATCHOUMI
  • 51.
    Conversion from NFAwith ε to NFA without ε 1) Find all the ε transition for each state from Q that will be called as ε closure {qi} Where {qi} is the element of Q 2) δ‘ transition can be obtained from δ transition. i.e., an ε closure of δ. 3) Step 2 is repeated for each input symbol and for each state of given NFA. 4) Using the resultant state, the transition table for equivalent NFA without ε can be built. BY DR.T.P.LATCHOUMI
  • 52.
    Example Convert the givenNFA with ε transition to NFA without ε transition BY DR.T.P.LATCHOUMI
  • 53.
  • 54.
  • 55.
    Theorem Equivalence of NFA withε without ε moves BY DR.T.P.LATCHOUMI
  • 56.
    Conversion of NFA toDFA BY DR.T.P.LATCHOUMI
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
    Theorem Equivalence of NFAand DFA BY DR.T.P.LATCHOUMI
  • 65.
    Method for conversionNFA with ε to DFA BY DR.T.P.LATCHOUMI
  • 66.
  • 67.
  • 68.
  • 69.