SlideShare ist ein Scribd-Unternehmen logo
1 von 63
THEORY OF COMPUTATION
Lecture One:
Automata Theory
1Er. Deepinder KaurAutomata Theory
Theory of Computation
In theoretical computer science and mathematics,
the theory
of computation is the branch that deals with how efficiently
problems can be solved on a model of computation, using an
algorithm. The field is divided into three major branches:
• automata theory,
• computability theory
• computational complexity theory.
Er. Deepinder Kaur 2Automata Theory
Automata theory
• The word “Automata“ is the plural of “automaton" which
simply means any machine.
• automata theory is the study of abstract machines and
problems they are able to solve.
• Automata theory is closely related to formal language
theory as the automata are often classified by the class of
formal languages they are able to recognize.
Er. Deepinder KaurAutomata Theory 3
Abstract Machine
• An abstract machine, also called an abstract computer, is a
theoretical model of a computer hardware or software system
used in Automata theory.
Er. Deepinder KaurAutomata Theory 4
Applications of Automata
• A variety of properties concerning the models, grammars, and
languages will be proven.
• These algorithms form the basis of tools for processing languages,
e.g., parsers, compilers, assemblers, etc.
• Other algorithms will form the basis of tools that automatically
construct language processors, e.g., yacc, lex, etc.
– Note that our perspective will be similar to, yet different from a compiler
class.
• Additionally, some things will be proven to be non-computable,
e.g., the enhanced compiler.
Automata Theory 5Er. Deepinder Kaur
Automaton
• An automaton is an abstract model of a digital
computer
• It has a mechanism to read input (string over a given
alphabet, e.g. strings of 0’s and 1’s on Σ = {0,1})
written on an input file.
• A finite automaton has a set of states
• Its control moves from state to state in response to
external “inputs”
Automata Theory 6Er. Deepinder Kaur
Automaton
• With every automaton, a transition function is
associated which gives the next state in terms of
the current state
• An automaton can be represented by a graph in
which the vertices give the internal states and the
edges transitions
• The labels on the edges show what happens (in
terms of input and output) during the transitions
Automata Theory 7Er. Deepinder Kaur
Components of an automaton
• Input file : Contains strings of input symbols
• Storage unit: consists of an unlimited number of
cells, each capable of holding a single symbol
from an alphabet
• Control unit : can be in any one of a finite
number of internal states and can change states
in defined manner
Automata Theory 8Er. Deepinder Kaur
Some Terms used in automaton theory
• Alphabets-Everything in mathematics is based on symbols. This
is also true for automata theory. Alphabets are
defined as a finite set of symbols. An example of
alphabet is a set of decimal numbers
∑={0,1,2,3,4,5,6,7,8,9}
• Strings- A string is a finite sequence of symbols selected from some
alphabet
If ∑ {a,b} is an alphabet then abab is string over alphabet ∑. A
string is generally denoted by w. The length of string is denoted by |
w|
• Empty string is string with zero occurrence of symbols . This string is
represented by є
Automata Theory 9Er. Deepinder Kaur
• The set of strings, including empty, over an alphabet ∑ is
denoted by ∑*.
• ∑+
= ∑* -{є}
• Languages-A set of strings which are chosen from some ∑*,
where ∑ is a particular alphabet, is called a language . If ∑ is
an alphabet, and L subset of ∑*, then L is said to be
language over alphabet ∑. For example the language of all
strings consisting of n 0’s followed by n 1’s for some n>=0:
{є,01,0011,000111,-------}
Automata Theory 10Er. Deepinder Kaur
• Langauge in set forms-
{w|some logical view about w}
e.g {an
bn
|n>=1}
• Kleene closure- Given an alphabet, a language in
which any string of letters from ∑ is a word, even
the null string, is called closure of the alphabet . It is
denoted by writing a star, after the name of
alphabet as a superscript ∑*.
Automata Theory 11Er. Deepinder Kaur
Finite Automaton
• One of the powerful models of computation which
are restricted model of actual computer is called
finite automata. These machines are very similar to
CPU of a computer .They are restricted model as
they lack memory.
• Finite automation is called finite because number of
possible states and number of letter in alphabet are
both finite and automation because the change of
state is totally governed by the input.
Automata Theory 12Er. Deepinder Kaur
2.2 Deterministic Finite Automata
– graphic model for a DFA
13Automata Theory Er. Deepinder Kaur
Main parts of pictorial representation of Finite
machine
• Strings are fed into device by means of an input tape which is
divided into square with each symbol in each square.
• Main part of machine is a black box which serve that what symbol is
written at any position on input tape by means of a movable
reading head
• P0,p1,p2,p3,p4 are the states in finite control system and x and y
are input symbols.
• At regular intervals, the automation reads one symbol from input
tape and then enters in a new state that depends only on current
state and the symbol just read.
Automata Theory 14Er. Deepinder Kaur
Main parts of pictorial representation of Finite
machine
• After reading an input symbol, reading head moves one square to
the right on input tape so that on next move, it will read the symbol
in next tape square. This process is repeated again and again
• Automation then indicates approval or disapproval
• If it winds up in one of the final states, the input string is considered
to be accepted. The language accepted by the machine is the set of
strings it accepts.
Automata Theory 15Er. Deepinder Kaur
DFA:
Deterministic Finite Automaton
• An informal definition (formal version later):
– A diagram with a finite number of states represented
by circles
– An arrow points to one of the states, the unique start
state
– Double circles mark any number of the states as
accepting states
– For every state, for every symbol in Σ, there is exactly
one arrow labeled with that symbol going to another
state (or back to the same state)
Automata Theory
Er. Deepinder Kaur
Finite Automata FA
• Its goal is to act as a recognizer for specific a
language/pattern.
• Any problem can be presented in form of
decidable problem that can be answered by
Yes/No.
• Hence FA (machine with limited memory) can
solve any problem.
17Automata Theory Er. Deepinder Kaur
Deterministic Finite Automata DFA
FA = “a 5-tuple “ (Q, Σ, , q0, F)
1. Q: {q0, q1, q2, …} is set of states.
2. Σ: {a, b, …} set of alphabet.
3. (delta): represents the set of transitions that FA can
take between its states.
 : Q x Σ→Q
Q x Σ to Q, this function:
 Takes a state and input symbol as arguments.
 Returns a single state.
 : Q x Σ→Q
4. q0 Q is the start state.
5. F Q is the set of final/accepting states.
18
∈
⊂
Automata Theory Er. Deepinder Kaur
Transition function 
: Q x Σ→Q
Maps from domain of (states, letters) to range
of states.
19
(q0, a)
(q2, b)
(q1, b)
q1
q2
q3
Automata Theory Er. Deepinder Kaur
Transition function 
• : Q x Σ→Q
• Maps from domain of (states, letters) to range
of states.
20
(q0, a)
(q2, b)
(q1, b)
q1
q2
q3
Automata Theory Er. Deepinder Kaur
How does FA work?
1. Starts from a start state.
2. Loop
Reads a sequence of letters
1. Until input string finishes
2. If the current state is a final state then
Input string is accepted.
1. Else
Input string is NOT accepted.
• But how can FA be designed and represented?
21Automata Theory Er. Deepinder Kaur
Transition System
FA = “a 5-tuple “ (Q, Σ, , q0, F)
1. Q: {q0, q1, q2, …} is set of states.
2. Σ: {a, b, …} set of alphabet.
3. (delta): represents the set of transitions that FA can
take between its states.
 : Q x Σ→Q
Q x Σ to Q, this function:
 Takes a state and input symbol as arguments.
 Returns a single state.
 : Q x Σ→Q
4. q0 Q is the start state.
5. F Q is the set of final/accepting states.
22
∈
⊂
Automata Theory Er. Deepinder Kaur
Transition System
Transition Diagrams Transition Tables
23Automata Theory Er. Deepinder Kaur
Transition Diagram Notations
• If any state q in Q is the starting state then
it is represented by the circle with arrow as
• Nodes corresponding to accepting states
are marked by a double circle
q
Automata Theory 24Er. Deepinder Kaur
Transition Diagram
Can be represented by directed labeled graph/Transition table
Vertex is a state
States= nodes
Starting/Initial state denoted by circle and arrow/-
Final state(s) denoted by two concentric circles/+
Other states with circle
Transition function  =directed arrows connecting states.
25
S1
S2
b
a a,b
Automata Theory Er. Deepinder Kaur
Alternative Representation: Transition
Table
26
0 1
A A B
B A C
C C C
Rows = states
Columns =
input symbols
Final states
starred
*
*Arrow for
start state
Automata Theory Er. Deepinder Kaur
Acceptability of a string
A string is accepted by a transition system if
• There exist a path from initial state to final
state
• Path traversed is equal to w
27Automata Theory Er. Deepinder Kaur
Example1.1
• Build an FA that accepts only aab
28
S1
-
S3
a
S2
a b
+
S4
a b
S1 S2 ?
S2 S3 ?
S3 ? ?
S4 ? ?
Automata Theory Er. Deepinder Kaur
Example withTransition Table
29
0 1
A C B
B D A
C A D
D B C
*
Check for 110101
Automata Theory Er. Deepinder Kaur
Example withTransition Table
30
Solution:-
(A,110101)= (B,10101)
(A,0101)
(C,101)
(D,01)
(B,1)
A*Automata Theory Er. Deepinder Kaur
Automata Theory 31
Properties of transition function
1. (q,λ)=q
• It comes back to same state
• It requires an input symbol to change the
state of a system.
2. (q,aw)=((q,a),w)
(q,w,a)=((q,w),a)
Er. Deepinder Kaur
Facts in designing FA
First of all we have to analyze set of strings.
Make sure that every state is check for output state
and for every input symbol from given set.
No state must have two different outputs for single
input symbol
There must be one initial and atleast one final state
in FA
32Automata Theory Er. Deepinder Kaur
Language of a DFA
• Automata of all kinds define languages.
• If A is an automaton, L(A) is its language.
• For a DFA A, L(A) is the set of strings
labeling paths from the start state to a final
state.
• Formally: L(A) = the set of strings w such
that δ(q0, w) is in F.
33Automata Theory Er. Deepinder Kaur
Language
• A language is a set of strings.
For example, {0, 1}, {all English words}, {0, 0, 0, ...} are
all languages.
Automata Theory 34Er. Deepinder Kaur
Example #8:
• Let Σ = {0, 1}. Give DFAs for {}, {ε}, Σ*
, and Σ+
.
For {}:
For Σ*
: For Σ+
:
Er. Deepinder Kaur
0/1
q0
0/1
q0
0/1
q0 q1
0/1
Automata Theory 35
Example: Design a FA that accepts set of strings such that every string
ends in 00, over the alphabet
{0,1} i,e ∑={0, 1}
Inorder to design any FA, first try to fulfill the
minimum condition.
Start 0 0 0
Being DFA, we must check every input symbol for
output state from every state. So we have to decide
output state at symbol 1 from q0,q1 and q2. Then it
will be complete FA
q0 q1 q2
Automata Theory 36Er. Deepinder Kaur
• 1 0 0
start 0
1 1
q0 q1 q2q2
Automata Theory 37Er. Deepinder Kaur
Ex 2 –
• Construct a DFA that accepts a’s and b’s and
‘aa’ must be substring
38Automata Theory Er. Deepinder Kaur
Example: String in a Language
39
Start
a
20 1
a
Minimal condition : aa
Automata Theory Er. Deepinder Kaur
Example: String in a Language
40
Start
There may be aabbaa.bbbbaa,aa,aab,aabb,….
a
20 1
a
b
Automata Theory Er. Deepinder Kaur
Example: String in a Language
41
Start
a
b
A CB
a
b a,b
.
Automata Theory Er. Deepinder Kaur
Ex : (0+1)*00(0+1)*
• Idea: Suppose the string x1x2 ···xn is on
the tape. Then we check x1x2, x2x3, ...,
xn-1xn in turn.
• Step 1. Build a checker
0 0
Automata Theory 42Er. Deepinder Kaur
• Step 2. Find all edges by the following
consideration:
Consider x1x2.
• If x1=1, then we give up x1x2 and continue to
check x2x3. So, we have δ(q0, 1) = q0.
• If x1x2 = 01, then we also give up x1x2 and
continue to check x2x3. So,
δ(q1, 1) = δ(q0, 1) =q0.
• If x1x2 = 00, then x1x2··· xn is accepted for any
x3···xn. So, δ(q2,0)=δ(q2,1)=q2.
Automata Theory 43Er. Deepinder Kaur
(0+1)*00(0+1)*
0 0
0
1
1
1
Automata Theory 44Er. Deepinder Kaur
Ex 1
All words that start with “a” over the alphabet
{a,b}
a(a+b)*
Automata Theory 45
1
2b
a 3
a,b
a,b3
Er. Deepinder Kaur
Ex3
• All words that start with triple letter
(aaa+bbb)(a+b)*
Automata Theory 46Er. Deepinder Kaur
Ex3
Automata Theory 47
1-
2a 3
a,b
4
b 5
b
6+
b
a a
Er. Deepinder Kaur
Ex4
• All words with even count of letters having “a” in an
even position from the start, where the first letter is
letter number one. (a+b)a((a+b)a)*
Automata Theory 48Er. Deepinder Kaur
Ex4
Automata Theory 49
-
a,b
Er. Deepinder Kaur
EX5:Construct DFA to accept (0+1)*
0
1
Automata Theory 50Er. Deepinder Kaur
Ex 6:Construct DFA to accept 00(0+1)*
0 0
0
11
1
0 1
Automata Theory 51Er. Deepinder Kaur
(0+1)*(00+01)
0 0
1
1
1
0
0
1
Automata Theory 52Er. Deepinder Kaur
Construct a FA that accepts set of strings where the number of 0s in
every string is multiple of 3 over alphabet ∑={0,1}
1 1 1
start 0 0
0
As 0 existence of 0 is also multiple of 3, we have to consider starting
state as the final state.
q1 q2q0
Automata Theory 53Er. Deepinder Kaur
Design FA which accepts set of strings containing exactly four
1s in every string over alphabet ∑={0,1}
1
q2q4q0 q1 q2
1 1
q3
1
0 0 0
0 0
q5
0/1
star
t
1
q5 is called the trap state or dead state.
Dead states are those states which
transit to themselves for all input
symbols.
Automata Theory 54Er. Deepinder Kaur
Design a FA that accepts strings containing exactly one 1 over alphabet
{0,1}. Also draw the transition table for the FA generated
q2q2q1
1
0 0
q3
0/1
1
start
q3 is the dead state
Automata Theory 55Er. Deepinder Kaur
Transition table for previous problem
δ/∑ 0 1
q1 q1 q2
*q2 q2 q3
q3 q3 q3
Non final state that transit in
self loop for all inputs
Automata Theory 56Er. Deepinder Kaur
Design an FA that accepts the language
L={w ϵ (0,1)*/ second symbol of w is ‘0’ and fourth input is ‘1’}
q0 q3q1 q2
0 1
1/0
1
1/0
0
1/0
q5
0/1
start
q4
Automata Theory 57Er. Deepinder Kaur
Design DFA for the language
L={w ϵ (a,b)*/nb(w) mod 3 > 1}
As given in the language, this can be interpreted that number of b mod 3 has to be
greater than 1 and there is no restriction on number of a’s. Thus it will accept string with
2 bs,5 bs, 8bs and so on.
q0 q1 q2
b b
a a
a
b
star
t
Q={q0,q1,q2}
F={q2}
Automata Theory 58Er. Deepinder Kaur
Design FA over alphabet ∑= {0,1} which accepts the set of strings either
start with 01 or end with 01
q0 q1
q3
q4
q2
0 1
1/0
q5
1
0
1
0
1
0
0
1
start
Automata Theory 59Er. Deepinder Kaur
Example #4:
• Give a DFA M such that:
L(M) = {x | x is a string of 0’s and 1’s and |x| >= 2}
Er. Deepinder Kaur
q1
q0
q2
0/1
0/1
0/1
Automata Theory 60
Example #5:
• Give a DFA M such that:
L(M) = {x | x is a string of (zero or more) a’s and b’s such
that x does not contain the substring aa}
Er. Deepinder Kaur
q2q0
a
a/b
a
q1
b
b
Automata Theory 61
Example #6:
• Give a DFA M such that:
L(M) = {x | x is a string of a’s, b’s and c’s such that x
contains the substring aba}
Er. Deepinder Kaur
q2q0
a
a/b
b
q1
b a
b
q3
a
Automata Theory 62
DFA Practice
• Design a FA which accepts the only input 101
over input set {0,1}
• Strings that end in ab
• Strings that contain aba
• String start with 0 and ends with 1 over {0,1}
• Strings made up of letters in word ‘CHARIOT’
and recognize those strings that contain the
word ‘CAT’ as a substringEr. Deepinder Kaur 63Automata Theory

Weitere ähnliche Inhalte

Was ist angesagt?

Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translationAkshaya Arunan
 
Control Strategies in AI
Control Strategies in AI Control Strategies in AI
Control Strategies in AI Bharat Bhushan
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notationsNikhil Sharma
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design MAHASREEM
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compilerIffat Anjum
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMvikas dhakane
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machineEhatsham Riaz
 
Issues in the design of Code Generator
Issues in the design of Code GeneratorIssues in the design of Code Generator
Issues in the design of Code GeneratorDarshan sai Reddy
 
Address in the target code in Compiler Construction
Address in the target code in Compiler ConstructionAddress in the target code in Compiler Construction
Address in the target code in Compiler ConstructionMuhammad Haroon
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1Manoj Patil
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDAAshish Duggal
 

Was ist angesagt? (20)

Syntax directed translation
Syntax directed translationSyntax directed translation
Syntax directed translation
 
Control Strategies in AI
Control Strategies in AI Control Strategies in AI
Control Strategies in AI
 
Type Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLikeType Checking(Compiler Design) #ShareThisIfYouLike
Type Checking(Compiler Design) #ShareThisIfYouLike
 
Lexical analysis - Compiler Design
Lexical analysis - Compiler DesignLexical analysis - Compiler Design
Lexical analysis - Compiler Design
 
Recognition-of-tokens
Recognition-of-tokensRecognition-of-tokens
Recognition-of-tokens
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
I. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHMI. AO* SEARCH ALGORITHM
I. AO* SEARCH ALGORITHM
 
Language processors
Language processorsLanguage processors
Language processors
 
Mealy and moore machine
Mealy and moore machineMealy and moore machine
Mealy and moore machine
 
Issues in the design of Code Generator
Issues in the design of Code GeneratorIssues in the design of Code Generator
Issues in the design of Code Generator
 
Design of a two pass assembler
Design of a two pass assemblerDesign of a two pass assembler
Design of a two pass assembler
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Analysis modelling
Analysis modellingAnalysis modelling
Analysis modelling
 
Address in the target code in Compiler Construction
Address in the target code in Compiler ConstructionAddress in the target code in Compiler Construction
Address in the target code in Compiler Construction
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDAPush Down Automata (PDA) | TOC  (Theory of Computation) | NPDA | DPDA
Push Down Automata (PDA) | TOC (Theory of Computation) | NPDA | DPDA
 

Ähnlich wie Introduction to fa and dfa

Patterns, Automata and Regular Expressions
Patterns, Automata and Regular ExpressionsPatterns, Automata and Regular Expressions
Patterns, Automata and Regular ExpressionsDarío Garigliotti
 
Regular expression automata
Regular expression automataRegular expression automata
Regular expression automata성욱 유
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computationprasadmvreddy
 
State space analysis.pptx
State space analysis.pptxState space analysis.pptx
State space analysis.pptxRaviMuthamala1
 
Toc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationToc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationnarayan dudhe
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdfFariyaTasneem1
 
Finite automata
Finite automataFinite automata
Finite automataPusp Sunar
 
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...PranavHendre1
 
linear algebra in control systems
linear algebra in control systemslinear algebra in control systems
linear algebra in control systemsGanesh Bhat
 
Finite state automaton
Finite state automatonFinite state automaton
Finite state automatonAmmAr mobark
 
introduction-190804060837.pptx
introduction-190804060837.pptxintroduction-190804060837.pptx
introduction-190804060837.pptxshumPanwar
 
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyserArchana Gopinath
 

Ähnlich wie Introduction to fa and dfa (20)

TOC Introduction
TOC Introduction TOC Introduction
TOC Introduction
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Theory of computation and automata
Theory of computation and automataTheory of computation and automata
Theory of computation and automata
 
Patterns, Automata and Regular Expressions
Patterns, Automata and Regular ExpressionsPatterns, Automata and Regular Expressions
Patterns, Automata and Regular Expressions
 
Regular expression automata
Regular expression automataRegular expression automata
Regular expression automata
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
Lexical
LexicalLexical
Lexical
 
State space analysis.pptx
State space analysis.pptxState space analysis.pptx
State space analysis.pptx
 
Toc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computationToc 1 | gate | Theory of computation
Toc 1 | gate | Theory of computation
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
 
Finite automata
Finite automataFinite automata
Finite automata
 
Transition System
Transition SystemTransition System
Transition System
 
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...
MOC2.PPT[1].pptx introduction to mealy machine and moore machine with eample ...
 
linear algebra in control systems
linear algebra in control systemslinear algebra in control systems
linear algebra in control systems
 
Finite state automaton
Finite state automatonFinite state automaton
Finite state automaton
 
Automata
AutomataAutomata
Automata
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
introduction-190804060837.pptx
introduction-190804060837.pptxintroduction-190804060837.pptx
introduction-190804060837.pptx
 
Implementation of lexical analyser
Implementation of lexical analyserImplementation of lexical analyser
Implementation of lexical analyser
 
Ch2 finite automaton
Ch2 finite automatonCh2 finite automaton
Ch2 finite automaton
 

Kürzlich hochgeladen

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 

Kürzlich hochgeladen (20)

Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 

Introduction to fa and dfa

  • 1. THEORY OF COMPUTATION Lecture One: Automata Theory 1Er. Deepinder KaurAutomata Theory
  • 2. Theory of Computation In theoretical computer science and mathematics, the theory of computation is the branch that deals with how efficiently problems can be solved on a model of computation, using an algorithm. The field is divided into three major branches: • automata theory, • computability theory • computational complexity theory. Er. Deepinder Kaur 2Automata Theory
  • 3. Automata theory • The word “Automata“ is the plural of “automaton" which simply means any machine. • automata theory is the study of abstract machines and problems they are able to solve. • Automata theory is closely related to formal language theory as the automata are often classified by the class of formal languages they are able to recognize. Er. Deepinder KaurAutomata Theory 3
  • 4. Abstract Machine • An abstract machine, also called an abstract computer, is a theoretical model of a computer hardware or software system used in Automata theory. Er. Deepinder KaurAutomata Theory 4
  • 5. Applications of Automata • A variety of properties concerning the models, grammars, and languages will be proven. • These algorithms form the basis of tools for processing languages, e.g., parsers, compilers, assemblers, etc. • Other algorithms will form the basis of tools that automatically construct language processors, e.g., yacc, lex, etc. – Note that our perspective will be similar to, yet different from a compiler class. • Additionally, some things will be proven to be non-computable, e.g., the enhanced compiler. Automata Theory 5Er. Deepinder Kaur
  • 6. Automaton • An automaton is an abstract model of a digital computer • It has a mechanism to read input (string over a given alphabet, e.g. strings of 0’s and 1’s on Σ = {0,1}) written on an input file. • A finite automaton has a set of states • Its control moves from state to state in response to external “inputs” Automata Theory 6Er. Deepinder Kaur
  • 7. Automaton • With every automaton, a transition function is associated which gives the next state in terms of the current state • An automaton can be represented by a graph in which the vertices give the internal states and the edges transitions • The labels on the edges show what happens (in terms of input and output) during the transitions Automata Theory 7Er. Deepinder Kaur
  • 8. Components of an automaton • Input file : Contains strings of input symbols • Storage unit: consists of an unlimited number of cells, each capable of holding a single symbol from an alphabet • Control unit : can be in any one of a finite number of internal states and can change states in defined manner Automata Theory 8Er. Deepinder Kaur
  • 9. Some Terms used in automaton theory • Alphabets-Everything in mathematics is based on symbols. This is also true for automata theory. Alphabets are defined as a finite set of symbols. An example of alphabet is a set of decimal numbers ∑={0,1,2,3,4,5,6,7,8,9} • Strings- A string is a finite sequence of symbols selected from some alphabet If ∑ {a,b} is an alphabet then abab is string over alphabet ∑. A string is generally denoted by w. The length of string is denoted by | w| • Empty string is string with zero occurrence of symbols . This string is represented by є Automata Theory 9Er. Deepinder Kaur
  • 10. • The set of strings, including empty, over an alphabet ∑ is denoted by ∑*. • ∑+ = ∑* -{є} • Languages-A set of strings which are chosen from some ∑*, where ∑ is a particular alphabet, is called a language . If ∑ is an alphabet, and L subset of ∑*, then L is said to be language over alphabet ∑. For example the language of all strings consisting of n 0’s followed by n 1’s for some n>=0: {є,01,0011,000111,-------} Automata Theory 10Er. Deepinder Kaur
  • 11. • Langauge in set forms- {w|some logical view about w} e.g {an bn |n>=1} • Kleene closure- Given an alphabet, a language in which any string of letters from ∑ is a word, even the null string, is called closure of the alphabet . It is denoted by writing a star, after the name of alphabet as a superscript ∑*. Automata Theory 11Er. Deepinder Kaur
  • 12. Finite Automaton • One of the powerful models of computation which are restricted model of actual computer is called finite automata. These machines are very similar to CPU of a computer .They are restricted model as they lack memory. • Finite automation is called finite because number of possible states and number of letter in alphabet are both finite and automation because the change of state is totally governed by the input. Automata Theory 12Er. Deepinder Kaur
  • 13. 2.2 Deterministic Finite Automata – graphic model for a DFA 13Automata Theory Er. Deepinder Kaur
  • 14. Main parts of pictorial representation of Finite machine • Strings are fed into device by means of an input tape which is divided into square with each symbol in each square. • Main part of machine is a black box which serve that what symbol is written at any position on input tape by means of a movable reading head • P0,p1,p2,p3,p4 are the states in finite control system and x and y are input symbols. • At regular intervals, the automation reads one symbol from input tape and then enters in a new state that depends only on current state and the symbol just read. Automata Theory 14Er. Deepinder Kaur
  • 15. Main parts of pictorial representation of Finite machine • After reading an input symbol, reading head moves one square to the right on input tape so that on next move, it will read the symbol in next tape square. This process is repeated again and again • Automation then indicates approval or disapproval • If it winds up in one of the final states, the input string is considered to be accepted. The language accepted by the machine is the set of strings it accepts. Automata Theory 15Er. Deepinder Kaur
  • 16. DFA: Deterministic Finite Automaton • An informal definition (formal version later): – A diagram with a finite number of states represented by circles – An arrow points to one of the states, the unique start state – Double circles mark any number of the states as accepting states – For every state, for every symbol in Σ, there is exactly one arrow labeled with that symbol going to another state (or back to the same state) Automata Theory Er. Deepinder Kaur
  • 17. Finite Automata FA • Its goal is to act as a recognizer for specific a language/pattern. • Any problem can be presented in form of decidable problem that can be answered by Yes/No. • Hence FA (machine with limited memory) can solve any problem. 17Automata Theory Er. Deepinder Kaur
  • 18. Deterministic Finite Automata DFA FA = “a 5-tuple “ (Q, Σ, , q0, F) 1. Q: {q0, q1, q2, …} is set of states. 2. Σ: {a, b, …} set of alphabet. 3. (delta): represents the set of transitions that FA can take between its states.  : Q x Σ→Q Q x Σ to Q, this function:  Takes a state and input symbol as arguments.  Returns a single state.  : Q x Σ→Q 4. q0 Q is the start state. 5. F Q is the set of final/accepting states. 18 ∈ ⊂ Automata Theory Er. Deepinder Kaur
  • 19. Transition function  : Q x Σ→Q Maps from domain of (states, letters) to range of states. 19 (q0, a) (q2, b) (q1, b) q1 q2 q3 Automata Theory Er. Deepinder Kaur
  • 20. Transition function  • : Q x Σ→Q • Maps from domain of (states, letters) to range of states. 20 (q0, a) (q2, b) (q1, b) q1 q2 q3 Automata Theory Er. Deepinder Kaur
  • 21. How does FA work? 1. Starts from a start state. 2. Loop Reads a sequence of letters 1. Until input string finishes 2. If the current state is a final state then Input string is accepted. 1. Else Input string is NOT accepted. • But how can FA be designed and represented? 21Automata Theory Er. Deepinder Kaur
  • 22. Transition System FA = “a 5-tuple “ (Q, Σ, , q0, F) 1. Q: {q0, q1, q2, …} is set of states. 2. Σ: {a, b, …} set of alphabet. 3. (delta): represents the set of transitions that FA can take between its states.  : Q x Σ→Q Q x Σ to Q, this function:  Takes a state and input symbol as arguments.  Returns a single state.  : Q x Σ→Q 4. q0 Q is the start state. 5. F Q is the set of final/accepting states. 22 ∈ ⊂ Automata Theory Er. Deepinder Kaur
  • 23. Transition System Transition Diagrams Transition Tables 23Automata Theory Er. Deepinder Kaur
  • 24. Transition Diagram Notations • If any state q in Q is the starting state then it is represented by the circle with arrow as • Nodes corresponding to accepting states are marked by a double circle q Automata Theory 24Er. Deepinder Kaur
  • 25. Transition Diagram Can be represented by directed labeled graph/Transition table Vertex is a state States= nodes Starting/Initial state denoted by circle and arrow/- Final state(s) denoted by two concentric circles/+ Other states with circle Transition function  =directed arrows connecting states. 25 S1 S2 b a a,b Automata Theory Er. Deepinder Kaur
  • 26. Alternative Representation: Transition Table 26 0 1 A A B B A C C C C Rows = states Columns = input symbols Final states starred * *Arrow for start state Automata Theory Er. Deepinder Kaur
  • 27. Acceptability of a string A string is accepted by a transition system if • There exist a path from initial state to final state • Path traversed is equal to w 27Automata Theory Er. Deepinder Kaur
  • 28. Example1.1 • Build an FA that accepts only aab 28 S1 - S3 a S2 a b + S4 a b S1 S2 ? S2 S3 ? S3 ? ? S4 ? ? Automata Theory Er. Deepinder Kaur
  • 29. Example withTransition Table 29 0 1 A C B B D A C A D D B C * Check for 110101 Automata Theory Er. Deepinder Kaur
  • 30. Example withTransition Table 30 Solution:- (A,110101)= (B,10101) (A,0101) (C,101) (D,01) (B,1) A*Automata Theory Er. Deepinder Kaur
  • 31. Automata Theory 31 Properties of transition function 1. (q,λ)=q • It comes back to same state • It requires an input symbol to change the state of a system. 2. (q,aw)=((q,a),w) (q,w,a)=((q,w),a) Er. Deepinder Kaur
  • 32. Facts in designing FA First of all we have to analyze set of strings. Make sure that every state is check for output state and for every input symbol from given set. No state must have two different outputs for single input symbol There must be one initial and atleast one final state in FA 32Automata Theory Er. Deepinder Kaur
  • 33. Language of a DFA • Automata of all kinds define languages. • If A is an automaton, L(A) is its language. • For a DFA A, L(A) is the set of strings labeling paths from the start state to a final state. • Formally: L(A) = the set of strings w such that δ(q0, w) is in F. 33Automata Theory Er. Deepinder Kaur
  • 34. Language • A language is a set of strings. For example, {0, 1}, {all English words}, {0, 0, 0, ...} are all languages. Automata Theory 34Er. Deepinder Kaur
  • 35. Example #8: • Let Σ = {0, 1}. Give DFAs for {}, {ε}, Σ* , and Σ+ . For {}: For Σ* : For Σ+ : Er. Deepinder Kaur 0/1 q0 0/1 q0 0/1 q0 q1 0/1 Automata Theory 35
  • 36. Example: Design a FA that accepts set of strings such that every string ends in 00, over the alphabet {0,1} i,e ∑={0, 1} Inorder to design any FA, first try to fulfill the minimum condition. Start 0 0 0 Being DFA, we must check every input symbol for output state from every state. So we have to decide output state at symbol 1 from q0,q1 and q2. Then it will be complete FA q0 q1 q2 Automata Theory 36Er. Deepinder Kaur
  • 37. • 1 0 0 start 0 1 1 q0 q1 q2q2 Automata Theory 37Er. Deepinder Kaur
  • 38. Ex 2 – • Construct a DFA that accepts a’s and b’s and ‘aa’ must be substring 38Automata Theory Er. Deepinder Kaur
  • 39. Example: String in a Language 39 Start a 20 1 a Minimal condition : aa Automata Theory Er. Deepinder Kaur
  • 40. Example: String in a Language 40 Start There may be aabbaa.bbbbaa,aa,aab,aabb,…. a 20 1 a b Automata Theory Er. Deepinder Kaur
  • 41. Example: String in a Language 41 Start a b A CB a b a,b . Automata Theory Er. Deepinder Kaur
  • 42. Ex : (0+1)*00(0+1)* • Idea: Suppose the string x1x2 ···xn is on the tape. Then we check x1x2, x2x3, ..., xn-1xn in turn. • Step 1. Build a checker 0 0 Automata Theory 42Er. Deepinder Kaur
  • 43. • Step 2. Find all edges by the following consideration: Consider x1x2. • If x1=1, then we give up x1x2 and continue to check x2x3. So, we have δ(q0, 1) = q0. • If x1x2 = 01, then we also give up x1x2 and continue to check x2x3. So, δ(q1, 1) = δ(q0, 1) =q0. • If x1x2 = 00, then x1x2··· xn is accepted for any x3···xn. So, δ(q2,0)=δ(q2,1)=q2. Automata Theory 43Er. Deepinder Kaur
  • 45. Ex 1 All words that start with “a” over the alphabet {a,b} a(a+b)* Automata Theory 45 1 2b a 3 a,b a,b3 Er. Deepinder Kaur
  • 46. Ex3 • All words that start with triple letter (aaa+bbb)(a+b)* Automata Theory 46Er. Deepinder Kaur
  • 47. Ex3 Automata Theory 47 1- 2a 3 a,b 4 b 5 b 6+ b a a Er. Deepinder Kaur
  • 48. Ex4 • All words with even count of letters having “a” in an even position from the start, where the first letter is letter number one. (a+b)a((a+b)a)* Automata Theory 48Er. Deepinder Kaur
  • 50. EX5:Construct DFA to accept (0+1)* 0 1 Automata Theory 50Er. Deepinder Kaur
  • 51. Ex 6:Construct DFA to accept 00(0+1)* 0 0 0 11 1 0 1 Automata Theory 51Er. Deepinder Kaur
  • 53. Construct a FA that accepts set of strings where the number of 0s in every string is multiple of 3 over alphabet ∑={0,1} 1 1 1 start 0 0 0 As 0 existence of 0 is also multiple of 3, we have to consider starting state as the final state. q1 q2q0 Automata Theory 53Er. Deepinder Kaur
  • 54. Design FA which accepts set of strings containing exactly four 1s in every string over alphabet ∑={0,1} 1 q2q4q0 q1 q2 1 1 q3 1 0 0 0 0 0 q5 0/1 star t 1 q5 is called the trap state or dead state. Dead states are those states which transit to themselves for all input symbols. Automata Theory 54Er. Deepinder Kaur
  • 55. Design a FA that accepts strings containing exactly one 1 over alphabet {0,1}. Also draw the transition table for the FA generated q2q2q1 1 0 0 q3 0/1 1 start q3 is the dead state Automata Theory 55Er. Deepinder Kaur
  • 56. Transition table for previous problem δ/∑ 0 1 q1 q1 q2 *q2 q2 q3 q3 q3 q3 Non final state that transit in self loop for all inputs Automata Theory 56Er. Deepinder Kaur
  • 57. Design an FA that accepts the language L={w ϵ (0,1)*/ second symbol of w is ‘0’ and fourth input is ‘1’} q0 q3q1 q2 0 1 1/0 1 1/0 0 1/0 q5 0/1 start q4 Automata Theory 57Er. Deepinder Kaur
  • 58. Design DFA for the language L={w ϵ (a,b)*/nb(w) mod 3 > 1} As given in the language, this can be interpreted that number of b mod 3 has to be greater than 1 and there is no restriction on number of a’s. Thus it will accept string with 2 bs,5 bs, 8bs and so on. q0 q1 q2 b b a a a b star t Q={q0,q1,q2} F={q2} Automata Theory 58Er. Deepinder Kaur
  • 59. Design FA over alphabet ∑= {0,1} which accepts the set of strings either start with 01 or end with 01 q0 q1 q3 q4 q2 0 1 1/0 q5 1 0 1 0 1 0 0 1 start Automata Theory 59Er. Deepinder Kaur
  • 60. Example #4: • Give a DFA M such that: L(M) = {x | x is a string of 0’s and 1’s and |x| >= 2} Er. Deepinder Kaur q1 q0 q2 0/1 0/1 0/1 Automata Theory 60
  • 61. Example #5: • Give a DFA M such that: L(M) = {x | x is a string of (zero or more) a’s and b’s such that x does not contain the substring aa} Er. Deepinder Kaur q2q0 a a/b a q1 b b Automata Theory 61
  • 62. Example #6: • Give a DFA M such that: L(M) = {x | x is a string of a’s, b’s and c’s such that x contains the substring aba} Er. Deepinder Kaur q2q0 a a/b b q1 b a b q3 a Automata Theory 62
  • 63. DFA Practice • Design a FA which accepts the only input 101 over input set {0,1} • Strings that end in ab • Strings that contain aba • String start with 0 and ends with 1 over {0,1} • Strings made up of letters in word ‘CHARIOT’ and recognize those strings that contain the word ‘CAT’ as a substringEr. Deepinder Kaur 63Automata Theory