0% found this document useful (0 votes)
19 views311 pages

Unit I FA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views311 pages

Unit I FA

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 311

CS8501- Theory of

Computation
BY,
MRS A .BHAGYALAKSHMI
APIII

04-Jun-20 6:23 PM 1
Session 1
Introduction about TOC and
Basic terms used in TOC

04-Jun-20 6:23 PM 2
Theory of Computation
(TOC)
Syllabus?

04-Jun-20 6:23 PM 3
UNIT I AUTOMATA FUNDAMENTALS 9

Introduction to formal proof – Additional forms of Proof – Inductive Proofs –Finite Automata –
Deterministic Finite Automata – Non-deterministic Finite Automata – Finite Automata with Epsilon
Transitions

UNIT II REGULAR EXPRESSIONS AND LANGUAGES 9

Regular Expressions – FA and Regular Expressions – Proving Languages not to be regular – Closure
Properties of Regular Languages – Equivalence and Minimization of Automata.

UNIT III CONTEXT FREE GRAMMAR AND LANGUAGES 9

CFG – Parse Trees – Ambiguity in Grammars and Languages – Definition of the Pushdown Automata
– Languages of a Pushdown Automata – Equivalence of Pushdown Automata and CFG,
Deterministic Pushdown Automata.

UNIT IV PROPERTIES OF CONTEXT FREE LANGUAGES 9

Normal Forms for CFG – Pumping Lemma for CFL – Closure Properties of CFL – Turing Machines –
Programming Techniques for TM.

UNIT V UNDECIDABILITY 9

Non Recursive Enumerable (RE) Language – Undecidable Problem with RE – Undecidable Problems
about TM – Post‘s Correspondence Problem, The Class P and NP.

04-Jun-20 6:23 PM 4
Text Book?

04-Jun-20 6:23 PM 5
TEXT BOOK:

1. J.E.Hopcroft, R.Motwani and J.D Ullman, ―Introduction to Automata Theory, Languages


and Computations‖, Second Edition, Pearson Education, 2003.

REFERENCES: 1. H.R.Lewis and C.H.Papadimitriou, ―Elements of the theory of


Computation‖, Second Edition, PHI, 2003.
2. J.Martin, ―Introduction to Languages and the Theory of Computation‖, Third Edition,
TMH, 2003.
3. Micheal Sipser, ―Introduction of the Theory and Computation‖, Thomson Brokecole,
1997.

04-Jun-20 6:23 PM 6
Text Book

04-Jun-20 6:23 PM 7
Theory of Computation(TOC)
Syllabus- Framework
• Unit I- Finite Automata (FA)
• Unit II- Regular Expression(RE) and Regular Languages(RL)
• Unit III- Context Free Grammars(CFG) and Pushdown
Automata(PDA)
• Unit IV- CFL and Turing Machines(TM)
• Unit V- Undecidability

04-Jun-20 6:23 PM 8
Theory of Computation(TOC)
Definition
Automata Theory

Computational Theory

It provide various computational models to solve the problems

 “Deals with how efficiently problems can be solved on a model


of computation, using an algorithm“

04-Jun-20 6:23 PM 9
Applications?

04-Jun-20 6:23 PM 10
Finite Automata (FA) –
•For the designing of lexical analysis of a compiler.
•For recognizing the pattern using regular expressions.
•Used in text editors.

Push Down Automata (PDA) –


•For designing the parsing phase of a compiler (Syntax Analysis).
•For implementation of stack applications.

Turing Machine (TM) –


•For solving any recursively enumerable problem.
•For implementation of artificial intelligence.

04-Jun-20 6:23 PM 11
Compiler design!!!!

04-Jun-20 6:23 PM 12
Compiler?

04-Jun-20 6:23 PM 13
Compiler?
Translates highlevel
language to low level
language

04-Jun-20 6:23 PM 14
How?

04-Jun-20 6:23 PM 15
010101…..

04-Jun-20 6:23 PM 16
How? -> first step?

04-Jun-20 6:23 PM 17
Lexical analyzer in compiler
int - keyword
a - identifier
= - operator
10 - number
; - special symbol
int - keyword
b - identifier
= - operator
25 - number
; - special symbol



04-Jun-20 6:23 PM 18
Entire program is
divided into sequence of
words or strings!!!

04-Jun-20 6:23 PM 19
Strings and its recognition
are very important !
avg+10 variable ,
operator , number

04-Jun-20 6:23 PM 20
TOC - Application
String Recognition

04-Jun-20 6:23 PM 21
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 22
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 23
Alphabet
•Alphabet (∑) : is a finite, nonempty set of input symbols
Examples:
Alphabet ∑={0,1}
Alphabet ∑={a,b}
Alphabet ∑={a,b,c,….z}
Alphabet ∑={A,B,C,….,Z}
Alphabet ∑={1,2,3,….,9}

04-Jun-20 6:23 PM 24
Alphabet?
{a,b,….+,*,…0,1,2
,….#,;,{,},[,],}

04-Jun-20 6:23 PM 25
Alphabet
•Alphabet (∑) : is a finite, nonempty set of input symbols
Examples:
Alphabet ∑={0,1}
Alphabet ∑={a,b}
Alphabet ∑={a,b,c,….z}
Alphabet ∑={A,B,C,….,Z}
Alphabet ∑={1,2,3,….,9}

04-Jun-20 6:23 PM 26
Alphabet- cont.
•Alphabet (∑) : is a finite, nonempty set of input symbols
Check – which sets are Alphabet?
1. ∑={1,2,3…….} 1 and 3 are infinite
4 is empty set
2. ∑={+,*,-,/} So 1,3,4 are incorrect
3. ∑={c,f,g,…..}
4. ∑={ } 2 is correct

04-Jun-20 6:23 PM 27
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 28
String

◦String (w) : is a finite sequence of input symbols


selected from some Alphabet.
◦Merging of input symbols in any sequence with or
without repetitions

04-Jun-20 6:23 PM 29
Strings – Cont.

Alphabet ∑={0,1} then


 Strings are {0,1,00,10,01,11,100,001,1001,…}
Alphabet ∑={a,b} then
 Strings are {a,b,aa,bb,ab,ba,aba,aaa…...}

04-Jun-20 6:23 PM 30
Alphabet and Strings – check?
1. Alphabet ∑={0,1} then
Strings are {aa,bb,cc,….}
3 is correct
2. Alphabet ∑={a,b} then
Strings are {0,1,11,11,0001,10000…...}
3. Alphabet ∑={0,1,a,b} then
Strings are {aa,bb,abba,…,abb, 0,1,11,abb01,10abb…...}
4. Alphabet ∑={0,1,a,b} then
Strings are {ac,bb,cc,…,abb, 0,1,11,11,abb01,10abb,…...}

04-Jun-20 6:23 PM 31
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 32
Length of a String

◦Length of a string |w|:


‘the number of input symbols’ in the string

04-Jun-20 6:23 PM 33
Length of a string – Cont.

Alphabet ∑={0,1} then


 Strings are {0,1,00,10,01,11,100,001,1001,…}
Length => 1 1 2 2 2 2 3 3 4
Alphabet ∑={a,b} then
 Strings are {a, b, aa, bb, ab, ba, aba, aaa…...}
Length => 1 1 2 2 2 2 3 3

04-Jun-20 6:23 PM 34
Empty String () or Null string

◦ - called as Epsilon
◦The empty string is the zero occurrences of input
symbols(∑)
◦String w=  then its length =0 ( NO INPUT SYMBOLS)

04-Jun-20 6:23 PM 35
Recap
•Alphabet (∑) ? : a finite, nonempty set of input symbols
◦String (w) ? : is a finite sequence of input symbols
chosen from some Alphabet.
◦Length of a sting (|w|)? : no. of input symbols in the
string

04-Jun-20 6:23 PM 36
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 37
Powers of an Alphabet
•Powers of an Alphabet (∑k) :
it generates set of strings of length k,
each of whose symbols is in ∑.

04-Jun-20 6:23 PM 38
Powers of an Alphabet
(∑k) : it generates set of strings of length k,
each of whose symbols is in ∑.
Alphabet ∑={0,1} then
∑0 = length of strings is equal to 0 => 
∑1 = length of strings is equal to 1 => {0,1}
∑2 = length of strings is equal to 2 => {00,01,10,11}
∑3 = length of strings is equal to 3 => {000,001,010,011,100,110,111}
∑4 = length of strings is equal to 4 => { ? }
it continues…

04-Jun-20 6:23 PM 39
Powers of an Alphabet
(∑k) : it generates set of strings of length k,
each of whose symbols is in ∑.
Alphabet ∑={a,b} then
∑0 = length of strings is equal to 0 => 
∑1 = length of strings is equal to 1 => {a,b}
∑2 = length of strings is equal to 2 => {aa,ab,ba,bb}
∑3 = length of strings is equal to 3 => {aaa,aab,aba,abb,baa,bbb}
∑4 = length of strings is equal to 4 => { ? }
it continues…

04-Jun-20 6:23 PM 40
TOC - Most important terms are,
•Alphabets
◦Strings
◦Length of a string
◦Powers of an Alphabet
◦Languages

04-Jun-20 6:23 PM 41
Language
◦Language(L) : set of strings selected from ∑*
◦ ∑* = ∑0 U∑1 U∑2……Ꚙ
Language (L) =∑* => ∑0 U∑1 U∑2…..
◦∑={0,1} then
L=  U {0,1} U {00,01,10,11} U {000,001,010,011,100,110,111} U..
L= { ,0,1,00,01,10,11,000,001,010,011,100,110,111,…..}

04-Jun-20 6:23 PM 42
Language
◦ Language(L) : set of strings selected from ∑*
◦ ∑* = ∑0 U∑1 U∑2……
L = ∑* => ∑0 U∑1 U∑2…..
=> ∑0 U∑1 U∑2…..
◦ ∑={a,b} then
L=  U {a,b} U {aa,ab,ba,bb} U {aaa,aab,aba,abb,baa,bba,bbb} U..
L= { ,a,b,aa,ab,ba,bb,aaa,aab,aba,abb,baa,bba,bbb,…..}

04-Jun-20 6:23 PM 43
Language Example
Language(L) : set of strings selected from ∑* (∑* = ∑0 U∑1 U∑2…)
∑ ={a,b} → ∑* = {,a,b,aa,ab,ba,bb,aaa,abb,bab,….}
L={w| s.t |w| is 2 , over ∑* ={a,b} } Find L?
L={aa,ab,ba,bb}
L={w| s.t |w| is odd , over ∑* ={a,b} } Find L?
L={a,b,aba,bab,aaa,bbb,ababa,…}
Find L={w|w containing palindrome strings over ∑* ={a,b} } find L?
L={aba,aaabaaa,bab,bbabb,…}
04-Jun-20 6:23 PM 44
Why are the Languages important?
Application example

The strings are,


int, a, b, c, x, y, +, =, 10, 25, { , } , ( , ) , ;

04-Jun-20 6:23 PM 45
Why the Languages are important?- Cont.
◦ In a programming languages,
all the strings are categorized into different sets(Languages).
L for keywords={int,float,char,..}
L for numbers={10,256,34.5,56.23...}
L for symbols={#,*{,},{,},(,), ; ,$,#,..}
L for operators={+,-,*,/,&&,||,..}
L for identifiers={sum,avg,result,tot,…}

04-Jun-20 6:23 PM 46
How the strings are recognized ? / Is any
Computation model available?

◦Language Recognizer

04-Jun-20 6:23 PM 47
Is any Language Recognizer available?
◦YES!!

◦ Finite Automata (NFA,DFA)


◦ Pushdown Automata(PDA)
◦ Turing Machine(TM)
◦ Undecidabiity

04-Jun-20 6:23 PM 48
Queries?

04-Jun-20 6:23 PM 49
Session 2
Finite Automata

08-Jun-20 4:09 PM 1
TOC - Most important terms
are,
• Alphabets
◦ Strings
◦ Length of a string
◦ Powers of an Alphabet
◦ Languages

08-Jun-20 4:09 PM 2
POWERS OF AN ALPHABET
Alphabet ∑={0,1,a,b} then
∑0 = length of strings is equal to 0 => 40 => No. of strings ?
1=

∑1 = length of strings is equal to 1 => No. of strings ? 41 =

{0,1,a,b}

∑2 = length of strings is equal to 1 => No. of strings ? 42


{00,11,10,01,aa,bb,ab,ba,0a,0b,1a,1b,a0,b0,b1,a1}

∑3 = length of strings is equal to 1 => No. of strings ? 43


{000,111,aaa,bbb,…….
Language
language L is subset of ∑*
Let ∑={0,1,a,b}
◦ ∑* = ∑0 U∑1 U∑2……Ꚙ
∞ k
◦ 𝑘=0 ∑
∑* ={ ,0,1,a,b,
00,11,10,01,aa,bb,ab,ba,0a,0b,1a,1b,a0,b0,b1,a1…}
Find strings for
Language L?
Find L? Let ∑={0,1,a,b}
L={an|n>=0}
L=?
L={an|n>=1}
L=?
Find L? Let ∑={0,1,a,b}
L={anbn | n>=1}
L=?
L={an bm | n>=1 & m>=1}
L=?
L={an bm | n>=0 & m>=0}
L=?
Find L? Let ∑={0,1,a,b}
L={an|n>=0} L={an|n>=1}
n=0 a0
n=1 a1 n=1 a1
n=2 a2 n=2 a2
…….. ……..
L={ ,a,aa,aaa,…… } L={a,aa,aaa,……}
Find L? Let ∑={0,1,a,b}
Language strings
L={an|n>=0} L={,a,aa,aaa,……}

L={an|n>=1} L={a,aa,aaa,……}

L={anbn | n>=1} L={ab,aabb,aaabbb,aaaabbbb,….}


Find L? Let ∑={0,1,a,b}
Language strings

L={w|w has odd number of L={1,111,11111,


only 1’s} …}

L={w|w has even number of L={,11,1111,…}


only 1’s}
Find L? Let ∑={0,1,a,b}
Language strings
L={w| s.t |w| is L={,00,11,10,1111,0
Even} 000, 1010,…}

L={w| s.t |w| is odd} L={0,111,01110,1,}

L={w|w has a single digit 1} L={1,010,0010,100,…


}
FINITE
AUTOMATA (FA)
Finite Automata (FA)-
Definition
• It Contains states and transitions among states in
response to inputs.

n
q1 q2 t
i
q5
q0

start
o
f q3 q4 r

08-Jun-20 4:09 PM 14
Finite Automata (FA)-
Definition
n
q1 q2 t
i
q5
q0

start o
f q3 q4 r

Strings?
Language?

08-Jun-20 4:09 PM 15
Finite Automata (FA)-
Definition
n
q1 q2 t
i
q5
q0

start o q4
f q3 r

◦ Merge the input symbols from start symbol to


final state.
◦ In this example, strings are “int” and “for”
◦ Language (L)={int , for}

08-Jun-20 4:09 PM 16
Finite Automata (FA)-
Definition
A FA is defined by the 5-tuple:
◦ {Q, ∑ , q0, δ ,F }

A Finite Automaton (FA) consists of:


◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping between Q x ∑ ==> Q

17
Finite Automata (FA)-
Definition
A FA is defined by the 5-tuple:
◦ {Q, ∑ , q0, δ ,F } q1
n
q2 t
i
q5
q0
Q ==> {q0, q1, q2, q3, q4, q5} o q4
start
∑ ==> {i,f,n,o,t,r } f q3 r
q0 ==> {q0}
F ==> {q5}
δ ==> δ (q0 , i)= q1 δ (q1 , n)= q2 δ (q2 , t)= q5
δ (q0 , f)= q3 δ (q3 , o)= q4 δ (q4 , r)= q5

08-Jun-20 4:09 PM 18
Finite Automata • Q = {q0,q1,q2}

• ∑ = {0,1}
• start state = q0
• F = {q2}

1 0 0,1
• Transition table
start q 0 q 1 q
0 1 2 symbols
Accepting
0 1
state
q0 q1 q0
q1 q1 q2
states
*q2 q2 q2

19
Finite Automata (FA)- Types
Deterministic Finite Automata (DFA)
◦ DFA Returns only one state always for a input symbol
◦ The machine can exist in only one state at any given
time
◦ No  transition
Non-deterministic Finite Automata (NFA)
◦ NFA returns more number of states for a input symbol
◦ The machine can exist in multiple states at the same
time
◦  transition exists
Deterministic Finite Automata
- Definition
A Deterministic Finite Automaton (DFA) consists
of:
◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping
between Q x ∑ ==> Q
◦ A DFA is defined by the 5-tuple:
{Q, ∑ , q0,F, δ }
DFA Returns only one state always for a input symbol

21
DFA
1
DFA Examples
Examples

q1
n q2 t
i
q q
0 5
start f q3 o q4 r
Non Deterministic Finite
Automata - Definition
A Non Deterministic Finite Automaton (NFA)
consists of:
◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping between
Q x ∑ ==> Q
A NFA is defined by the 5-tuple:
◦ {Q, ∑ , q0,F, δ }
◦ NFA returns more number of states for a input symbol

24
NFA
1
NFA Examples
Examples
Session 3
FA,NFA,DFA and
Extended Transition
function

09-Jun-20 11:56 AM 1
FINITE
AUTOMATA (FA)
Finite Automata (FA)-
Definition
• It Contains states and transitions among states in
response to inputs.

n
q1 q2 t
i
q5
q0

start
o
f q3 q4 r

09-Jun-20 11:56 AM 3
Finite Automata (FA)-
Definition
n
q1 q2 t
i
q5
q0

start o
f q3 q4 r

Strings?
Language?

09-Jun-20 11:56 AM 4
Finite Automata (FA)-
Definition
n
q1 q2 t
i
q5
q0

start o q4
f q3 r

◦ Merge the input symbols from start symbol to


final state.
◦ In this example, strings are “int” and “for”
◦ Language (L)={int , for}

09-Jun-20 11:56 AM 5
Finite Automata (FA)-
Definition
A FA is defined by the 5-tuple:
◦ {Q, ∑ , q0, δ ,F }

A Finite Automaton (FA) consists of:


◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping between Q x ∑ ==> Q

6
Finite Automata (FA)-
Definition
A FA is defined by the 5-tuple:
◦ {Q, ∑ , q0, δ ,F } q1
n
q2 t
i
q5
q0
Q ==> {q0, q1, q2, q3, q4, q5} o q4
start
∑ ==> {i,f,n,o,t,r } f q3 r
q0 ==> {q0}
F ==> {q5}
δ ==> δ (q0 , i)= q1 δ (q1 , n)= q2 δ (q2 , t)= q5
δ (q0 , f)= q3 δ (q3 , o)= q4 δ (q4 , r)= q5

09-Jun-20 11:56 AM 7
Finite Automata • Q = {q0,q1,q2}

• ∑ = {0,1}
• start state = q0
• F = {q2}

1 0 0,1
• Transition table
start q 0 q 1 q
0 1 2 symbols
Accepting
0 1
state
q0 q1 q0
q1 q1 q2
states
*q2 q2 q2

8
Finite Automata (FA)- Types
Deterministic Finite Automata (DFA)
◦ DFA Returns only one state always for a input symbol
◦ The machine can exist in only one state at any given
time
◦ No  transition
Non-deterministic Finite Automata (NFA)
◦ NFA returns more number of states for a input symbol
◦ The machine can exist in multiple states at the same
time
◦  transition exists
Deterministic Finite Automata
- Definition
A Deterministic Finite Automaton (DFA) consists
of:
◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping
between Q x ∑ ==> Q
◦ A DFA is defined by the 5-tuple:
{Q, ∑ , q0,F, δ }
DFA Returns only one state always for a input symbol

10
DFA
1
DFA Examples
Examples

q1
n q2 t
i
q q
0 5
start f q3 o q4 r
Non Deterministic Finite
Automata - Definition
A Non Deterministic Finite Automaton (NFA)
consists of:
◦ Q ==> a finite set of states
◦ ∑ ==> a finite set of input symbols (alphabet)
◦ q0 ==> a start state
◦ F ==> set of accepting states
◦ δ ==> a transition function, which is a mapping between
Q x ∑ ==> Q
A NFA is defined by the 5-tuple:
◦ {Q, ∑ , q0,F, δ }
◦ NFA returns more number of states for a input symbol

13
NFA
1
NFA Examples
Examples
DFA & Language

09-Jun-20 11:56 AM 16
DFA
2
DFA
3
NFA and
Language

09-Jun-20 11:56 AM 19
NFA
2
NFA
3
Check NFA or DFA
& Find L?
NFA
4
DFA
4
DFA
5
DFA
6
NFA
5
Language to FA?
L={} Design DFA
DFA is,

q0

q0
L={} Design DFA


q0 qq1
0

q0
1
2
1.Language?
2.design DFA
3.Check
DFA?(Accept/Reject)
Input string
processing!!!
What does a DFA do on reading an
input string?
Input: a word w in ∑*
Question: Is w acceptable by the DFA?
Steps:
◦ Start at the “start state” q0
◦ For every input symbol in the sequence w do
◦ Compute the next state from the current state, given the
current input symbol in w and the transition function
◦ If after all symbols in w are consumed, the current
state is one of the accepting states (F) then
◦accept w; Otherwise, reject w.

39
Accept?
1. End of input string?
2. and current state is a final state?

then,
The string(w) belongs to language(DFA)
(i.e)String accepted!
Reject?
1. No transitions for a current input symbol?
2.(or) end of input string ! but current state is
not a final state?
3.(or) current state is final state but ?

then,
The string(w) not belongs to language(DFA)
(i.e)String rejected
Language of a DFA
A DFA A accepts string w if there is a path
from Initial state to an accepting (or
final) state that is labeled by w
L(A) = { w | (q0,w)  F }

- Extended transition function

L(A) = all strings that lead to an accepting


state from q0

42
Session 4
DFA design

10:20 PM 1
Recap
1. Alphabet
2. String
3. Length of a string
4. Language
5. Finite Automata
6. FA types
7. NFA
8. DFA
9. Language of a DFA
10. Extended transition function(String processing)

10:20 PM 2
10:20 PM 3
10:20 PM 4
10:20 PM 5
10:20 PM 6
1

10:20 PM 7
2

10:20 PM 8
Q3

10:20 PM 9
10:20 PM 10
10:20 PM 11
10:20 PM 12
10:20 PM 13
10:20 PM 14
10:20 PM 15
10:20 PM 16
10:20 PM 17
NFA !!
Strings are
L={101, 000101000, 1111011111, 00110101000………}

10:20 PM 18
Strings are NFA !!
L={01,00,000001,000000,111101,111100,1010101,…

10:20 PM 19
NFA !!

10:20 PM 20
Design DFA - for L contains set of strings
such that strings end with 0 over {0,1}*
L={ 0,1110,00000,101010,0001000,….}

10:20 PM 21
DFA?
L CONTAINS - ODD 1’S EVEN 0’S
L CONTAINS - ODD 1’S ODD 0’S HW
L CONTAINS - EVEN 1’S ODD 0’S
L CONTAINS - EVEN 1’S EVEN 0’S

10:20 PM 22
Odd no. of 1’s

Even no. of 1’s

10:20 PM 23
Language contains 3 multiples of only 1’s

Language contains not 3 multiples of only 1’s

10:20 PM 24
DFA?
L CONTAINS - ODD 1’S and EVEN 0’S
L CONTAINS - ODD 1’S and ODD 0’S HW
L CONTAINS - EVEN 1’S and ODD 0’S
L CONTAINS - EVEN 1’S and EVEN 0’S

10:20 PM 25
1 2

3 4

10:20 PM 26
11 2

3
4

10:20 PM 27
DFA for - Odd ones and even 0’s

11 2

3
4

10:20 PM 28
DFA for - Odd ones and Odd 0’s

11 2

3
4

10:20 PM 29
DFA for - Even ones and Odd 0’s

11 2

3
4

10:20 PM 30
DFA for - Even ones and Even 0’s

11 2

3
4

10:20 PM 31
Session 5
DFA design

11:29 PM 1
Recap
1. Alphabet
2. String
3. Length of a string
4. Language
5. Finite Automata
6. FA types
7. NFA
8. DFA
9. Language of a DFA
10. Extended transition function(String processing)

11:29 PM 2
11:29 PM 3
11:29 PM 4
11:29 PM 5
11:29 PM 6
1

11:29 PM 7
2

11:29 PM 8
Q3

11:29 PM 9
11:29 PM 10
11:29 PM 11
11:29 PM 12
11:29 PM 13
Odd no. of 1’s

Even no. of 1’s

11:29 PM 14
Alphabet={0,1}
Language contains 3 multiples of only 1’s
Language contains not 3 multiples of only 1’s

11:29 PM 15
11:29 PM 16
11:29 PM 17
11:29 PM 18
11:29 PM 19
NFA !!
Strings are
L={101, 000101000, 1111011111, 00110101000………}

11:29 PM 20
Strings are NFA !!
L={01,00,000001,000000,111101,111100,1010101,…

11:29 PM 21
NFA !!

11:29 PM 22
Design DFA - for L contains set of strings
such that strings end with 0 over {0,1}*
L={ 0,1110,00000,101010,0001000,….}

11:29 PM 23
NFA to DFA?

11:29 PM 24
11:29 PM 25
DFA?
L CONTAINS - ODD 1’S EVEN 0’S
L CONTAINS - ODD 1’S ODD 0’S
HW
L CONTAINS - EVEN 1’S ODD 0’S
L CONTAINS - EVEN 1’S EVEN 0’S

11:29 PM 26
NFA to DFA?

11:29 PM 27
Subset
construction
algorithm

11:29 PM 28
11:29 PM 29
Example -1

11:29 PM 30
11:29 PM 31
11:29 PM 32
11:29 PM 33
11:29 PM 34
11:29 PM 35
11:29 PM 36
Example -2

11:29 PM 37
11:29 PM 38
11:29 PM 39
11:29 PM 40
11:29 PM 41
11:29 PM 42
11:29 PM 43
HW problems
Construct DFA
1. Language Contains substring “101”
2. Strings end with “01”

11:29 PM 44
Session 7
Theorem 1- Equivalence of NFA
and DFA & ENFA

1:25 PM 2
Recap
1. Alphabet
2. String
3. Length of a string
4. Language
5. Finite Automata
6. FA types
7. NFA
8. DFA
9. Language of a DFA
10. Extended transition function(String processing)

1:25 PM 3
Recap
11. FA design (NFA and DFA)
12. Language of NFA
12. Conversion of NFA to DFA- subset construction alg
13. Theorem – equivalence of NFA and DFA
14. Epsilon NFA- Introduction

1:25 PM 4
Language of NFA and Input
processing

1:25 PM 5
1:25 PM 6
1:25 PM 7
1:25 PM 8
1:25 PM 9
NFA to DFA?

1:25 PM 10
Subset construction algorithm

1:25 PM 11
1:25 PM 12
Example -1

1:25 PM 13
1:25 PM 14
1:25 PM 15
1:25 PM 16
1:25 PM 17
1:25 PM 18
1:25 PM 19
Example -2

1:25 PM 20
1:25 PM 21
1:25 PM 22
1:25 PM 23
1:25 PM 24
1:25 PM 25
1:25 PM 26
HW problems
Construct DFA
1. Language Contains substring “101”
2. Strings end with “01”

1:25 PM 27
1:25 PM 28
Proof mathematical inductive method
• Step 1: Prove the statement for
• basis ( n=0 or n=1)

• Step 2: Inductive hypothesis


• Assume given statement is true for kth value and derive the equation

• Step 3: Using hypothesis, prove the given statement for (k+1)th value

1:25 PM 29
1:25 PM 30
Replace k by k+1

1:25 PM 31
1:25 PM 32
1:25 PM 33
1:25 PM 34
1:25 PM 35
1:25 PM 36
Session 8 and 9
ENFA

10:25 PM 1
Recap
1. Alphabet
2. String
3. Length of a string
4. Language
5. Finite Automata
6. FA types
7. NFA
8. DFA
9. Language of a DFA
10. Extended transition function(String processing)

10:25 PM 2
Recap
11. FA design (NFA and DFA)
12. Language of NFA
12. Conversion of NFA to DFA- subset construction alg
13. Theorem – equivalence of NFA and DFA
14. Epsilon NFA- Introduction
15. Eclosure of a state
16. Language processing in ENFA

10:25 PM 3
Epsilon NFA(ENFA)

10:25 PM 4
Finite Automata
DFA
NFA
◦ENFA (NFA+ epsilon transitions)

10:25 PM 5
Epsilon NFA -ENFA

10:25 PM 6
10:25 PM 7
10:25 PM 8
10:25 PM 9
E-closure?

10:25 PM 10
E-closure- Use
1. Input string processing
2. ENFA to DFA conversion

10:25 PM 11
.a=a.  =a
.  .a=a
.  .b=b L={a,b,ca}
.c. . a= ca

10:25 PM 12
E closure(q)-It is set of states which can be reached from
the states q with only epsilon moves including the state q
itself

10:25 PM 13
L={a,ab}

10:25 PM 14
L={ ,a,aa,aaa…}
10:25 PM 15
10:25 PM 16
10:25 PM 17
10:25 PM 18
Find E-closure?

10:25 PM 19
E closure(0)={0,1,24,5,6}
E closure(1)={1,2,4,5}
E closure(2)={2}
E closure(3)={3}
E closure(4)={4,5}
E closure(5)={5}
E closure(6)={6}
E closure(6)={7}

10:25 PM 20
10:25 PM 21
10:25 PM 22
Representation of
transition table in ENFA

10:25 PM 23
{2}

{4}

10:25 PM 24
{2}
{3}
{5}

10:25 PM 25
{q3}

10:25 PM 26
10:25 PM 27
10:25 PM 28
10:25 PM 29
10:25 PM 30
10:25 PM 31
ENFA to DFA
Subset construction
algorithm

10:25 PM 32
10:25 PM 33
10:25 PM 34
Eclosure(q0)= {qo,q1}
Eclosure(q1)= {q1}
Eclosure(q2)= {q2,q3}
Eclosure(q3)= {q3}

10:25 PM 35
10:25 PM 36
10:25 PM 37
10:25 PM 38
10:25 PM 39
10:25 PM 40
10:25 PM 41
10:25 PM 42
10:25 PM 43
10:25 PM 44
10:25 PM 45
10:25 PM 46
10:25 PM 47
10:25 PM 48
10:25 PM 49
10:25 PM 50
10:25 PM 51
DFA,NFA and ENFA
1.Formal definition Definition
2.Example,Differnce
3.language generated by Automata
4.Input string processing
5.Conversion – Subset construction
6.Theorem

10:25 PM 52
Basic
Mathematical
proofs

10:25 PM 53
Formal proofs

4:26 PM 1
Recap
1. Alphabet
2. String
3. Length of a string
4. Language
5. Finite Automata
6. FA types
7. NFA
8. DFA
9. Language of a DFA
10. Extended transition function(String processing)

4:26 PM 2
Recap
11. FA design (NFA and DFA)
12. Language of NFA
12. Conversion of NFA to DFA- subset construction alg
13. Theorem 1 – equivalence of NFA and DFA
14. Epsilon NFA- Introduction
15. Eclosure of a state
16. Language processing in ENFA
17. ENFA to DFA
18. Theorem 2 – equivalence of ENFA and DFA

4:26 PM 3
DFA,NFA and ENFA
1.Formal definition Definition
2.Example,Differnce
3.language generated by Automata
4.Input string processing
5.Conversion – Subset construction
NFA to DFA
ENFA to DFA
6.Theorem - 2

4:26 PM 4
Introduction to
formal proof

4:26 PM 5
Formal proofs
1. Deductive
2.Inductive
3.Additional forms of proofs
Proofs by sets
Proofs by contradiction
Proofs by counterexample

4:26 PM 6
1. Deductive Proof
A deductive proof consists of a sequence of statements whose truth
leads us from some initial statement called the hypothesis or the given
statement(s) to a conclusion statement.
Each step in the proof must follow by some accepted logical principle
from either the given facts or some of the previous statement
The hypothesis may be true or false, depending on the value of its
parameter
If H then C . C is deducted from H

4:26 PM 7
Hypothesis : x ≥ 4
Conclusion : 2x ≥ x2
Parameter : x
Proof:
◦ If x=3, then 23 ≥ 32  8 ≥ 9 which is false
◦ If x=4 then 24 ≥ 42  16 ≥ 16 which is true
◦ For each time x increments by 1, the LHS get incremented by 2 and
𝑥+1 2
the RHS
𝑥
𝑥+1
◦ If x ≥ 4, the = 1.25, (1.25)2= 1.5625
𝑥
◦ 1.5625 is less than 2
◦ Hence 2x ≥ x2 will be true for x ≥ 4

4:26 PM 8
4:26 PM 9
4:26 PM 10
4:26 PM 11
Ex 2
If x is the sum of the squares of four positive
integers, then 2x ≥ x2

4:26 PM 12
4:26 PM 13
4:26 PM 14
2.Proof mathematical
inductive method
Step 1: Prove the statement for
basis ( n=0 or n=1)

Step 2: Inductive hypothesis


Assume given statement is true for kth value and derive the
equation

Step 3: Using hypothesis, prove the given statement for


(k+1)th value

4:26 PM 15
4:26 PM 16
Replace k by k+1

4:26 PM 17
4:26 PM 18
Additional Forms of Proof
Proofs by sets
Proofs by contradiction
Proofs by counterexample

4:26 PM 19
Proofs by contradiction
The method of proof by contradiction is to assume that a statement is
not true and then to show that that assumption leads to a
contradiction.
To prove if H then C is to prove If H then not C implies falsehood.

4:26 PM 20
4:26 PM 21
4:26 PM 22
4:26 PM 23
4:26 PM 24
Proofs by counterexample
A proof by counterexample is not technically a
proof. It is merely a way of showing that a given
statement cannot possibly be correct by showing
an instance that contradicts a universal statement.

If integer x is a prime then x is odd

4:26 PM 25
4:26 PM 26
4:26 PM 27
Proofs by sets R U (S ∩ T) = (R U S) ∩ (R U T)

4:26 PM 28
4:26 PM 29
Unit 1- Completed!

4:26 PM 30

You might also like