SlideShare une entreprise Scribd logo
1  sur  19
Dr. Sau. Kamaltai Gawai Institute of Engineering & Technology, Darapur
Department of Computer Science & Engineering
Subject: Theory of Computation [4KS05]
Subject Notes
Automata –What is it?
The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting".
An automaton (Automata in plural) is an abstract self-propelled computing device which
follows a predetermined sequence of operations automatically.
An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State
Machine (FSM).
Formal definition of a Finite Automaton
An automaton 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 the alphabet of the automaton.
 δ is the transition function.
 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).
RelatedTerminologies
Alphabet
 Definition − An alphabet is any finite set of symbols.
 Example − ∑ = {a, b, c, d} is an alphabet set where ‘a’, ‘b’, ‘c’, and ‘d’ are symbols.
String
 Definition − A string is a finite sequence of symbols taken from ∑.
 Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d}
Length of a String
 Definition − It is the number of symbols present in a string. (Denoted by |S|).
 Examples −
o If S = ‘cabcad’, |S|= 6
o If |S|= 0, it is called an empty string (Denoted by λ or ε)
Kleene Star
 Definition − The Kleene star, ∑*, is a unary operator on a set of symbols or strings, ∑,
that gives the infinite set of all possible strings of all possible lengths over ∑including λ.
 Representation − ∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪……. where ∑p is the set of all possible strings
of length p.
 Example − If ∑ = {a, b}, ∑* = {λ, a, b, aa, ab, ba, bb,………..}
Kleene Closure / Plus
 Definition − The set ∑+ is the infinite set of all possible strings of all possible lengths
over ∑ excluding λ.
 Representation − ∑+ = ∑1 ∪ ∑2 ∪ ∑3 ∪…….
∑+ = ∑* − { λ }
 Example − If ∑ = { a, b } , ∑+ = { a, b, aa, ab, ba, bb,………..}
Language
 Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or
infinite.
 Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L =
{ ab, bb, ba, bb}
DeterministicFiniteAutomaton
Finite Automaton can be classified into two types −
 Deterministic Finite Automaton (DFA)
 Non-deterministic Finite Automaton (NDFA / NFA)
Deterministic Finite Automaton (DFA)
In DFA, for each input symbol, one can determine the state to which the machine will move.
Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is
called Deterministic Finite Machine or Deterministic Finite Automaton.
Formal Definition ofaDFA
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 the 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).
Graphical Representation ofaDFA
A DFA is represented by digraphs called state diagram.
 The vertices represent the states.
 The arcs labeled 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.
Example
Let a deterministic finite automaton be →
 Q = {a, b, c},
 ∑ = {0, 1},
 q0 = {a},
 F = {c}, and
Transition function δ as shown by the following table −
Present State Next State for Input 0 Next State for Input 1
a a b
b c a
c b c
Its graphical representation would be as follows −
Non-deterministicFiniteAutomaton
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.
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 the 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).
Graphical Representation of an NDFA: (same as DFA)
An NDFA is represented by digraphs called state diagram.
 The vertices represent the states.
 The arcs labeled 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.
Example
Let a non-deterministic finite automaton be →
 Q = {a, b, c}
 ∑ = {0, 1}
 q0 = {a}
 F = {c}
The transition function δ as shown below −
Present State Next State for Input 0 Next State for Input 1
a a, b b
b c a, c
c b, c c
Its graphical representation would be as follows −
DFAvs NDFA
The following table lists the differences between DFA and NDFA.
DFA NDFA
The transition from a state is to a single
particular 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.
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.
Acceptors,Classifiers, and Transducers
Acceptor (Recognizer)
An automaton that computes a Boolean function is called an acceptor. All the states of an
acceptor is either accepting or rejecting the inputs given to it.
Classifier
A classifier has more than two final states and it gives a single output when it terminates.
Transducer
An automaton that produces outputs based on current input and/or previous state is called
a transducer. Transducers can be of two types −
 Mealy Machine − The output depends both on the current state and the current input.
 Moore Machine − The output depends only on the current state.
Acceptability byDFAand NDFA
A string is accepted by a DFA/NDFA iff the DFA/NDFA starting at the initial state ends in an
accepting state (any of the final states) after reading the string wholly.
A string S is accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff
δ*(q0, S) ∈ F
The language L accepted by DFA/NDFA is
{S | S ∈ ∑* and δ*(q0, S) ∈ F}
A string S′ is not accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff
δ*(q0, S′) ∉ F
The language L′ not accepted by DFA/NDFA (Complement of accepted language L) is
{S | S ∈ ∑* and δ*(q0, S) ∉ F}
Moore andMealyMachines
Finite automata may have outputs corresponding to each transition. There are two types of finite
state machines that generate output −
 Mealy Machine
 Moore machine
Mealy Machine
A Mealy Machine is an FSM whose output depends on the present state as well as the present
input.
It can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −
 Q is a finite set of states.
 ∑ is a finite set of symbols called the input alphabet.
 O is a finite set of symbols called the output alphabet.
 δ is the input transition function where δ: Q × ∑ → Q
 X is the output transition function where X: Q × ∑ → O
 q0 is the initial state from where any input is processed (q0 ∈ Q).
The state table of a Mealy Machine is shown below −
Present state
Next state
input = 0 input = 1
State Output State Output
→ a b x1 c x1
b b x2 d x3
c d x3 c x1
d d x3 d x2
The state diagram of the above Mealy Machine is −
Moore Machine
Moore machine is an FSM whose outputs depend on only the present state.
A Moore machine can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −
 Q is a finite set of states.
 ∑ is a finite set of symbols called the input alphabet.
 O is a finite set of symbols called the output alphabet.
 δ is the input transition function where δ: Q × ∑ → Q
 X is the output transition function where X: Q → O
 q0 is the initial state from where any input is processed (q0 ∈ Q).
The state table of a Moore Machine is shown below −
Present state
Next State
Output
Input = 0 Input = 1
→ a b c x2
b b d x1
c c d x2
d d d x3
The state diagram of the above Moore Machine is −
Mealy Machine vs. Moore Machine
The following table highlights the points that differentiate a Mealy Machine from a Moore
Machine.
Mealy Machine Moore Machine
Output depends both upon
present state and present input.
Output depends only upon the present state.
Generally, it has fewer states
than Moore Machine.
Generally, it has more states than Mealy
Machine.
Output changes at the clock
edges.
Input change can cause change in output change
as soon as logic is done.
Mealy machines react faster to
inputs
In Moore machines, more logic is needed to
decode the outputs since it has more circuit
delays.
IntroductiontoGrammars
n the literary sense of the term, grammars denote syntactical rules for conversation in natural
languages. Linguistics have attempted to define grammars since the inception of natural
languages like English, Sanskrit, Mandarin, etc.
The theory of formal languages finds its applicability extensively in the fields of Computer
Science. Noam Chomsky gave a mathematical model of grammar in 1956 which is effective
for writing computer languages.
Grammar
A grammar G can be formally written as a 4-tuple (N, T, S, P) where −
 N or VN is a set of variables or non-terminal symbols.
 T or ∑ is a set of Terminal symbols.
 S is a special variable called the Start symbol, S ∈ N
 P is Production rules for Terminals and Non-terminals. A production rule has the form α
→ β, where α and β are strings on VN ∪ ∑ and least one symbol of α belongs to VN.
Example
Grammar G1 −
({S, A, B}, {a, b}, S, {S → AB, A → a, B → b})
Here,
 S, A, and B are Non-terminal symbols;
 a and b are Terminal symbols
 S is the Start symbol, S ∈ N
 Productions, P : S → AB, A → a, B → b
Example
Grammar G2 −
(({S, A}, {a, b}, S,{S → aAb, aA → aaAb, A → ε } )
Here,
 S and A are Non-terminal symbols.
 a and b are Terminal symbols.
 ε is an empty string.
 S is the Start symbol, S ∈ N
 Production P : S → aAb, aA → aaAb, A → ε
Derivations from aGrammar
Strings may be derived from other strings using the productions in a grammar. If a
grammar G has a production α → β, we can say that x α y derives x β y in G. This derivation is
written as −
x α y ⇒G x β y
Example
Let us consider the grammar −
G2 = ({S, A}, {a, b}, S, {S → aAb, aA → aaAb, A → ε } )
Some of the strings that can be derived are −
S ⇒ aAb using production S → aAb
⇒ aaAbb using production aA → aAb
⇒ aaaAbbb using production aA → aAb
⇒ aaabbb using production A → ε
Language Generated byaGrammar
The set of all strings that can be derived from a grammar is said to be the language generated
from that grammar. A language generated by a grammar G is a subset formally defined by
L(G)={W|W ∈ ∑*, S ⇒G W}
If L(G1) = L(G2), the Grammar G1 is equivalent to the Grammar G2.
Example
If there is a grammar
G: N = {S, A, B} T = {a, b} P = {S → AB, A → a, B → b}
Here S produces AB, and we can replace A by a, and B by b. Here, the only accepted string
is ab, i.e.,
L(G) = {ab}
Example
Suppose we have the following grammar −
G: N = {S, A, B} T = {a, b} P = {S → AB, A → aA|a, B → bB|b}
The language generated by this grammar −
L(G) = {ab, a2b, ab2, a2b2, ………}
= {am bn | m ≥ 0 and n ≥ 0}
Construction ofaGrammar Generating aLanguage
We’ll consider some languages and convert it into a grammar G which produces those
languages.
Example
Problem − Suppose, L (G) = {am bn | m ≥ 0 and n > 0}. We have to find out the
grammar G which produces L(G).
Solution
Since L(G) = {am bn | m ≥ 0 and n > 0}
the set of strings accepted can be rewritten as −
L(G) = {b, ab,bb, aab, abb, …….}
Here, the start symbol has to take at least one ‘b’ preceded by any number of ‘a’ including null.
To accept the string set {b, ab, bb, aab, abb, …….}, we have taken the productions −
S → aS , S → B, B → b and B → bB
S → B → b (Accepted)
S → B → bB → bb (Accepted)
S → aS → aB → ab (Accepted)
S → aS → aaS → aaB → aab(Accepted)
S → aS → aB → abB → abb (Accepted)
Thus, we can prove every single string in L(G) is accepted by the language generated by the
production set.
Hence the grammar −
G: ({S, A, B}, {a, b}, S, { S → aS | B , B → b | bB })
Example
Problem − Suppose, L (G) = {am bn | m > 0 and n ≥ 0}. We have to find out the grammar G
which produces L(G).
Solution −
Since L(G) = {am bn | m > 0 and n ≥ 0}, the set of strings accepted can be rewritten as −
L(G) = {a, aa, ab, aaa, aab ,abb, …….}
Here, the start symbol has to take at least one ‘a’ followed by any number of ‘b’ including null.
To accept the string set {a, aa, ab, aaa, aab, abb, …….}, we have taken the productions −
S → aA, A → aA , A → B, B → bB ,B → λ
S → aA → aB → aλ → a (Accepted)
S → aA → aaA → aaB → aaλ → aa (Accepted)
S → aA → aB → abB → abλ → ab (Accepted)
S → aA → aaA → aaaA → aaaB → aaaλ → aaa (Accepted)
S → aA → aaA → aaB → aabB → aabλ → aab (Accepted)
S → aA → aB → abB → abbB → abbλ → abb (Accepted)
Thus, we can prove every single string in L(G) is accepted by the language generated by the
production set.
Hence the grammar −
G: ({S, A, B}, {a, b}, S, {S → aA, A → aA | B, B → λ | bB })
ChomskyClassificationofGrammars
According to Noam Chomosky, there are four types of grammars − Type 0, Type 1, Type 2, and
Type 3. The following table shows how they differ from each other −
Grammar
Type
Grammar
Accepted
Language Accepted Automaton
Type 0 Unrestricted
grammar
Recursively
enumerable language
Turing Machine
Type 1 Context-sensitive
grammar
Context-sensitive
language
Linear-bounded
automaton
Type 2 Context-free
grammar
Context-free language Pushdown
automaton
Type 3 Regular grammar Regular language Finite state
automaton
Take a look at the following illustration. It shows the scope of each type of grammar −
Type -3Grammar
Type-3 grammars generate regular languages. Type-3 grammars must have a single non-
terminal on the left-hand side and a right-hand side consisting of a single terminal or single
terminal followed by a single non-terminal.
The productions must be in the form X → a or X → aY
where X, Y ∈ N (Non terminal)
and a ∈ T (Terminal)
The rule S → ε is allowed if S does not appear on the right side of any rule.
Example
X → ε
X → a | aY
Y → b
Type -2Grammar
Type-2 grammars generate context-free languages.
The productions must be in the form A → γ
where A ∈ N (Non terminal)
and γ ∈ (T ∪ N)* (String of terminals and non-terminals).
These languages generated by these grammars are be recognized by a non-deterministic
pushdown automaton.
Example
S → X a
X → a
X → aX
X → abc
X → ε
Type -1Grammar
Type-1 grammars generate context-sensitive languages. The productions must be in the form
α A β → α γ β
where A ∈ N (Non-terminal)
and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-terminals)
The strings α and β may be empty, but γ must be non-empty.
The rule S → ε is allowed if S does not appear on the right side of any rule. The languages
generated by these grammars are recognized by a linear bounded automaton.
Example
AB → AbBc
A → bcA
B → b
Type -0Grammar
Type-0 grammars generate recursively enumerable languages. The productions have no
restrictions. They are any phase structure grammar including all formal grammars.
They generate the languages that are recognized by a Turing machine.
The productions can be in the form of α → β where α is a string of terminals and nonterminals
with at least one non-terminal and α cannot be null. β is a string of terminals and non-terminals.
RegularExpressions
A Regular Expression can be recursively defined as follows −
 ε is a Regular Expression indicates the language containing an empty string. (L (ε) = {ε})
 φ is a Regular Expression denoting an empty language. (L (φ) = { })
 x is a Regular Expression where L = {x}
 If X is a Regular Expression denoting the language L(X)and Y is a Regular Expression
denoting the language L(Y), then
o X + Y is a Regular Expression corresponding to the language L(X) ∪
L(Y) where L(X+Y) = L(X) ∪ L(Y).
o X . Y is a Regular Expression corresponding to the language L(X) .
L(Y) where L(X.Y) = L(X) . L(Y)
o R* is a Regular Expression corresponding to the language L(R*)where L(R*) =
(L(R))*
 If we apply any of the rules several times from 1 to 5, they are Regular Expressions.
Arden'sTheorem
In order to find out a regular expression of a Finite Automaton, we use Arden’s Theorem along
with the properties of regular expressions.
Statement −
Let P and Q be two regular expressions.
If P does not contain null string, then R = Q + RP has a unique solution that is R = QP*
Proof −
R = Q + (Q + RP)P [After putting the value R = Q + RP]
= Q + QP + RPP
When we put the value of R recursively again and again, we get the following equation −
R = Q + QP + QP2 + QP3…..
R = Q (ε + P + P2 + P3 + …. )
R = QP* [As P* represents (ε + P + P2 + P3 + ….) ]
Hence, proved.
ConstructionofanFAfromanRE
We can use Thompson's Construction to find out a Finite Automaton from a Regular
Expression. We will reduce the regular expression into smallest regular expressions and
converting these to NFA and finally to DFA.
Some basic RA expressions are the following −
Case 1 − For a regular expression ‘a’, we can construct the following FA −
Case 2 − For a regular expression ‘ab’, we can construct the following FA −
Case 3 − For a regular expression (a+b), we can construct the following FA −
Case 4 − For a regular expression (a+b)*, we can construct the following FA −
Step 4 −
Here qf is a final state, so we make q1 also a final state.
So the FA becomes −
PumpingLemmaForRegularGrammars
Theorem
Let L be a regular language. Then there exists a constant ‘c’such that for every string w in L −
|w| ≥ c
We can break w into three strings, w = xyz, such that −
 |y| > 0
 |xy| ≤ c
 For all k ≥ 0, the string xykz is also in L.
Applications ofPumping Lemma
Pumping Lemma is to be applied to show that certain languages are not regular. It should never
be used to show a language is regular.
 If L is regular, it satisfies Pumping Lemma.
 If L does not satisfy Pumping Lemma, it is non-regular.
Method toprove that alanguage Lis not regular
 At first, we have to assume that L is regular.
 So, the pumping lemma should hold for L.
 Use the pumping lemma to obtain a contradiction −
o Select w such that |w| ≥ c
o Select y such that |y| ≥ 1
o Select x such that |xy| ≤ c
o Assign the remaining string to z.
o Select k such that the resulting string is not in L.
Hence L is not regular.

Contenu connexe

Tendances

Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
prasadmvreddy
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
Srimatre K
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
NYversity
 

Tendances (20)

Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular language and Regular expression
Regular language and Regular expressionRegular language and Regular expression
Regular language and Regular expression
 
Kleene's theorem
Kleene's theoremKleene's theorem
Kleene's theorem
 
Ch2 finite automaton
Ch2 finite automatonCh2 finite automaton
Ch2 finite automaton
 
TOC 5 | Regular Expressions
TOC 5 | Regular ExpressionsTOC 5 | Regular Expressions
TOC 5 | Regular Expressions
 
Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
 
Theory of computation Lec2
Theory of computation Lec2Theory of computation Lec2
Theory of computation Lec2
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 
Theory of Computation
Theory of ComputationTheory of Computation
Theory of Computation
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
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
 
Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1Formal Languages and Automata Theory Unit 1
Formal Languages and Automata Theory Unit 1
 
Formal language & automata theory
Formal language & automata theoryFormal language & automata theory
Formal language & automata theory
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
L3 cfg
L3 cfgL3 cfg
L3 cfg
 
Lecture 7
Lecture 7Lecture 7
Lecture 7
 
NFA and DFA
NFA and DFANFA and DFA
NFA and DFA
 
Lesson 02
Lesson 02Lesson 02
Lesson 02
 

Similaire à Automata theory introduction

@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
FariyaTasneem1
 
Finite Automata fgyft rtrt rr uuy y.pptx
Finite Automata fgyft rtrt  rr uuy y.pptxFinite Automata fgyft rtrt  rr uuy y.pptx
Finite Automata fgyft rtrt rr uuy y.pptx
AsadBaig49
 
deterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdfdeterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdf
AmayJaiswal4
 

Similaire à Automata theory introduction (20)

Automaton
AutomatonAutomaton
Automaton
 
@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
 
Theory of automata
Theory of automataTheory of automata
Theory of automata
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
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
 
Finite Automata fgyft rtrt rr uuy y.pptx
Finite Automata fgyft rtrt  rr uuy y.pptxFinite Automata fgyft rtrt  rr uuy y.pptx
Finite Automata fgyft rtrt rr uuy y.pptx
 
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
Finite Automata: Deterministic And Non-deterministic Finite Automaton (DFA)
 
Unit iv
Unit ivUnit iv
Unit iv
 
Fsa
FsaFsa
Fsa
 
deterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdfdeterministicfiniteautomatondfa-181008145215 (1).pdf
deterministicfiniteautomatondfa-181008145215 (1).pdf
 
1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton1.3.1 deterministic finite automaton
1.3.1 deterministic finite automaton
 
flat unit1
flat unit1flat unit1
flat unit1
 
Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3Formal Languages and Automata Theory unit 3
Formal Languages and Automata Theory unit 3
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
 
Formalization Machines and Sastes
Formalization Machines and SastesFormalization Machines and Sastes
Formalization Machines and Sastes
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Finite automata
Finite automataFinite automata
Finite automata
 
03-FiniteAutomata.pptx
03-FiniteAutomata.pptx03-FiniteAutomata.pptx
03-FiniteAutomata.pptx
 

Dernier

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
Tonystark477637
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
dollysharma2066
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Dernier (20)

Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
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
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
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
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 

Automata theory introduction

  • 1. Dr. Sau. Kamaltai Gawai Institute of Engineering & Technology, Darapur Department of Computer Science & Engineering Subject: Theory of Computation [4KS05] Subject Notes Automata –What is it? The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined sequence of operations automatically. An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM). Formal definition of a Finite Automaton An automaton 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 the alphabet of the automaton.  δ is the transition function.  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). RelatedTerminologies Alphabet  Definition − An alphabet is any finite set of symbols.  Example − ∑ = {a, b, c, d} is an alphabet set where ‘a’, ‘b’, ‘c’, and ‘d’ are symbols. String  Definition − A string is a finite sequence of symbols taken from ∑.  Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d} Length of a String  Definition − It is the number of symbols present in a string. (Denoted by |S|).  Examples − o If S = ‘cabcad’, |S|= 6 o If |S|= 0, it is called an empty string (Denoted by λ or ε)
  • 2. Kleene Star  Definition − The Kleene star, ∑*, is a unary operator on a set of symbols or strings, ∑, that gives the infinite set of all possible strings of all possible lengths over ∑including λ.  Representation − ∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪……. where ∑p is the set of all possible strings of length p.  Example − If ∑ = {a, b}, ∑* = {λ, a, b, aa, ab, ba, bb,………..} Kleene Closure / Plus  Definition − The set ∑+ is the infinite set of all possible strings of all possible lengths over ∑ excluding λ.  Representation − ∑+ = ∑1 ∪ ∑2 ∪ ∑3 ∪……. ∑+ = ∑* − { λ }  Example − If ∑ = { a, b } , ∑+ = { a, b, aa, ab, ba, bb,………..} Language  Definition − A language is a subset of ∑* for some alphabet ∑. It can be finite or infinite.  Example − If the language takes all possible strings of length 2 over ∑ = {a, b}, then L = { ab, bb, ba, bb} DeterministicFiniteAutomaton Finite Automaton can be classified into two types −  Deterministic Finite Automaton (DFA)  Non-deterministic Finite Automaton (NDFA / NFA) Deterministic Finite Automaton (DFA) In DFA, for each input symbol, one can determine the state to which the machine will move. Hence, it is called Deterministic Automaton. As it has a finite number of states, the machine is called Deterministic Finite Machine or Deterministic Finite Automaton. Formal Definition ofaDFA 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 the alphabet.  δ is the transition function where δ: Q × ∑ → Q
  • 3.  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). Graphical Representation ofaDFA A DFA is represented by digraphs called state diagram.  The vertices represent the states.  The arcs labeled 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. Example Let a deterministic finite automaton be →  Q = {a, b, c},  ∑ = {0, 1},  q0 = {a},  F = {c}, and Transition function δ as shown by the following table − Present State Next State for Input 0 Next State for Input 1 a a b b c a c b c Its graphical representation would be as follows − Non-deterministicFiniteAutomaton 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.
  • 4. 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 the 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). Graphical Representation of an NDFA: (same as DFA) An NDFA is represented by digraphs called state diagram.  The vertices represent the states.  The arcs labeled 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. Example Let a non-deterministic finite automaton be →  Q = {a, b, c}  ∑ = {0, 1}  q0 = {a}  F = {c} The transition function δ as shown below − Present State Next State for Input 0 Next State for Input 1 a a, b b b c a, c
  • 5. c b, c c Its graphical representation would be as follows − DFAvs NDFA The following table lists the differences between DFA and NDFA. DFA NDFA The transition from a state is to a single particular 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. 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. Acceptors,Classifiers, and Transducers Acceptor (Recognizer)
  • 6. An automaton that computes a Boolean function is called an acceptor. All the states of an acceptor is either accepting or rejecting the inputs given to it. Classifier A classifier has more than two final states and it gives a single output when it terminates. Transducer An automaton that produces outputs based on current input and/or previous state is called a transducer. Transducers can be of two types −  Mealy Machine − The output depends both on the current state and the current input.  Moore Machine − The output depends only on the current state. Acceptability byDFAand NDFA A string is accepted by a DFA/NDFA iff the DFA/NDFA starting at the initial state ends in an accepting state (any of the final states) after reading the string wholly. A string S is accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff δ*(q0, S) ∈ F The language L accepted by DFA/NDFA is {S | S ∈ ∑* and δ*(q0, S) ∈ F} A string S′ is not accepted by a DFA/NDFA (Q, ∑, δ, q0, F), iff δ*(q0, S′) ∉ F The language L′ not accepted by DFA/NDFA (Complement of accepted language L) is {S | S ∈ ∑* and δ*(q0, S) ∉ F} Moore andMealyMachines Finite automata may have outputs corresponding to each transition. There are two types of finite state machines that generate output −  Mealy Machine  Moore machine Mealy Machine A Mealy Machine is an FSM whose output depends on the present state as well as the present input. It can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −  Q is a finite set of states.
  • 7.  ∑ is a finite set of symbols called the input alphabet.  O is a finite set of symbols called the output alphabet.  δ is the input transition function where δ: Q × ∑ → Q  X is the output transition function where X: Q × ∑ → O  q0 is the initial state from where any input is processed (q0 ∈ Q). The state table of a Mealy Machine is shown below − Present state Next state input = 0 input = 1 State Output State Output → a b x1 c x1 b b x2 d x3 c d x3 c x1 d d x3 d x2 The state diagram of the above Mealy Machine is − Moore Machine
  • 8. Moore machine is an FSM whose outputs depend on only the present state. A Moore machine can be described by a 6 tuple (Q, ∑, O, δ, X, q0) where −  Q is a finite set of states.  ∑ is a finite set of symbols called the input alphabet.  O is a finite set of symbols called the output alphabet.  δ is the input transition function where δ: Q × ∑ → Q  X is the output transition function where X: Q → O  q0 is the initial state from where any input is processed (q0 ∈ Q). The state table of a Moore Machine is shown below − Present state Next State Output Input = 0 Input = 1 → a b c x2 b b d x1 c c d x2 d d d x3 The state diagram of the above Moore Machine is −
  • 9. Mealy Machine vs. Moore Machine The following table highlights the points that differentiate a Mealy Machine from a Moore Machine. Mealy Machine Moore Machine Output depends both upon present state and present input. Output depends only upon the present state. Generally, it has fewer states than Moore Machine. Generally, it has more states than Mealy Machine. Output changes at the clock edges. Input change can cause change in output change as soon as logic is done. Mealy machines react faster to inputs In Moore machines, more logic is needed to decode the outputs since it has more circuit delays.
  • 10. IntroductiontoGrammars n the literary sense of the term, grammars denote syntactical rules for conversation in natural languages. Linguistics have attempted to define grammars since the inception of natural languages like English, Sanskrit, Mandarin, etc. The theory of formal languages finds its applicability extensively in the fields of Computer Science. Noam Chomsky gave a mathematical model of grammar in 1956 which is effective for writing computer languages. Grammar A grammar G can be formally written as a 4-tuple (N, T, S, P) where −  N or VN is a set of variables or non-terminal symbols.  T or ∑ is a set of Terminal symbols.  S is a special variable called the Start symbol, S ∈ N  P is Production rules for Terminals and Non-terminals. A production rule has the form α → β, where α and β are strings on VN ∪ ∑ and least one symbol of α belongs to VN. Example Grammar G1 − ({S, A, B}, {a, b}, S, {S → AB, A → a, B → b}) Here,  S, A, and B are Non-terminal symbols;  a and b are Terminal symbols  S is the Start symbol, S ∈ N  Productions, P : S → AB, A → a, B → b Example Grammar G2 − (({S, A}, {a, b}, S,{S → aAb, aA → aaAb, A → ε } ) Here,  S and A are Non-terminal symbols.  a and b are Terminal symbols.  ε is an empty string.
  • 11.  S is the Start symbol, S ∈ N  Production P : S → aAb, aA → aaAb, A → ε Derivations from aGrammar Strings may be derived from other strings using the productions in a grammar. If a grammar G has a production α → β, we can say that x α y derives x β y in G. This derivation is written as − x α y ⇒G x β y Example Let us consider the grammar − G2 = ({S, A}, {a, b}, S, {S → aAb, aA → aaAb, A → ε } ) Some of the strings that can be derived are − S ⇒ aAb using production S → aAb ⇒ aaAbb using production aA → aAb ⇒ aaaAbbb using production aA → aAb ⇒ aaabbb using production A → ε Language Generated byaGrammar The set of all strings that can be derived from a grammar is said to be the language generated from that grammar. A language generated by a grammar G is a subset formally defined by L(G)={W|W ∈ ∑*, S ⇒G W} If L(G1) = L(G2), the Grammar G1 is equivalent to the Grammar G2. Example If there is a grammar G: N = {S, A, B} T = {a, b} P = {S → AB, A → a, B → b} Here S produces AB, and we can replace A by a, and B by b. Here, the only accepted string is ab, i.e., L(G) = {ab} Example Suppose we have the following grammar − G: N = {S, A, B} T = {a, b} P = {S → AB, A → aA|a, B → bB|b}
  • 12. The language generated by this grammar − L(G) = {ab, a2b, ab2, a2b2, ………} = {am bn | m ≥ 0 and n ≥ 0} Construction ofaGrammar Generating aLanguage We’ll consider some languages and convert it into a grammar G which produces those languages. Example Problem − Suppose, L (G) = {am bn | m ≥ 0 and n > 0}. We have to find out the grammar G which produces L(G). Solution Since L(G) = {am bn | m ≥ 0 and n > 0} the set of strings accepted can be rewritten as − L(G) = {b, ab,bb, aab, abb, …….} Here, the start symbol has to take at least one ‘b’ preceded by any number of ‘a’ including null. To accept the string set {b, ab, bb, aab, abb, …….}, we have taken the productions − S → aS , S → B, B → b and B → bB S → B → b (Accepted) S → B → bB → bb (Accepted) S → aS → aB → ab (Accepted) S → aS → aaS → aaB → aab(Accepted) S → aS → aB → abB → abb (Accepted) Thus, we can prove every single string in L(G) is accepted by the language generated by the production set. Hence the grammar − G: ({S, A, B}, {a, b}, S, { S → aS | B , B → b | bB }) Example Problem − Suppose, L (G) = {am bn | m > 0 and n ≥ 0}. We have to find out the grammar G which produces L(G).
  • 13. Solution − Since L(G) = {am bn | m > 0 and n ≥ 0}, the set of strings accepted can be rewritten as − L(G) = {a, aa, ab, aaa, aab ,abb, …….} Here, the start symbol has to take at least one ‘a’ followed by any number of ‘b’ including null. To accept the string set {a, aa, ab, aaa, aab, abb, …….}, we have taken the productions − S → aA, A → aA , A → B, B → bB ,B → λ S → aA → aB → aλ → a (Accepted) S → aA → aaA → aaB → aaλ → aa (Accepted) S → aA → aB → abB → abλ → ab (Accepted) S → aA → aaA → aaaA → aaaB → aaaλ → aaa (Accepted) S → aA → aaA → aaB → aabB → aabλ → aab (Accepted) S → aA → aB → abB → abbB → abbλ → abb (Accepted) Thus, we can prove every single string in L(G) is accepted by the language generated by the production set. Hence the grammar − G: ({S, A, B}, {a, b}, S, {S → aA, A → aA | B, B → λ | bB }) ChomskyClassificationofGrammars According to Noam Chomosky, there are four types of grammars − Type 0, Type 1, Type 2, and Type 3. The following table shows how they differ from each other − Grammar Type Grammar Accepted Language Accepted Automaton Type 0 Unrestricted grammar Recursively enumerable language Turing Machine Type 1 Context-sensitive grammar Context-sensitive language Linear-bounded automaton Type 2 Context-free grammar Context-free language Pushdown automaton
  • 14. Type 3 Regular grammar Regular language Finite state automaton Take a look at the following illustration. It shows the scope of each type of grammar − Type -3Grammar Type-3 grammars generate regular languages. Type-3 grammars must have a single non- terminal on the left-hand side and a right-hand side consisting of a single terminal or single terminal followed by a single non-terminal. The productions must be in the form X → a or X → aY where X, Y ∈ N (Non terminal) and a ∈ T (Terminal) The rule S → ε is allowed if S does not appear on the right side of any rule. Example X → ε X → a | aY Y → b Type -2Grammar Type-2 grammars generate context-free languages.
  • 15. The productions must be in the form A → γ where A ∈ N (Non terminal) and γ ∈ (T ∪ N)* (String of terminals and non-terminals). These languages generated by these grammars are be recognized by a non-deterministic pushdown automaton. Example S → X a X → a X → aX X → abc X → ε Type -1Grammar Type-1 grammars generate context-sensitive languages. The productions must be in the form α A β → α γ β where A ∈ N (Non-terminal) and α, β, γ ∈ (T ∪ N)* (Strings of terminals and non-terminals) The strings α and β may be empty, but γ must be non-empty. The rule S → ε is allowed if S does not appear on the right side of any rule. The languages generated by these grammars are recognized by a linear bounded automaton. Example AB → AbBc A → bcA B → b Type -0Grammar Type-0 grammars generate recursively enumerable languages. The productions have no restrictions. They are any phase structure grammar including all formal grammars. They generate the languages that are recognized by a Turing machine. The productions can be in the form of α → β where α is a string of terminals and nonterminals with at least one non-terminal and α cannot be null. β is a string of terminals and non-terminals.
  • 16. RegularExpressions A Regular Expression can be recursively defined as follows −  ε is a Regular Expression indicates the language containing an empty string. (L (ε) = {ε})  φ is a Regular Expression denoting an empty language. (L (φ) = { })  x is a Regular Expression where L = {x}  If X is a Regular Expression denoting the language L(X)and Y is a Regular Expression denoting the language L(Y), then o X + Y is a Regular Expression corresponding to the language L(X) ∪ L(Y) where L(X+Y) = L(X) ∪ L(Y). o X . Y is a Regular Expression corresponding to the language L(X) . L(Y) where L(X.Y) = L(X) . L(Y) o R* is a Regular Expression corresponding to the language L(R*)where L(R*) = (L(R))*  If we apply any of the rules several times from 1 to 5, they are Regular Expressions. Arden'sTheorem In order to find out a regular expression of a Finite Automaton, we use Arden’s Theorem along with the properties of regular expressions. Statement − Let P and Q be two regular expressions. If P does not contain null string, then R = Q + RP has a unique solution that is R = QP* Proof − R = Q + (Q + RP)P [After putting the value R = Q + RP] = Q + QP + RPP When we put the value of R recursively again and again, we get the following equation − R = Q + QP + QP2 + QP3….. R = Q (ε + P + P2 + P3 + …. ) R = QP* [As P* represents (ε + P + P2 + P3 + ….) ] Hence, proved.
  • 17. ConstructionofanFAfromanRE We can use Thompson's Construction to find out a Finite Automaton from a Regular Expression. We will reduce the regular expression into smallest regular expressions and converting these to NFA and finally to DFA. Some basic RA expressions are the following − Case 1 − For a regular expression ‘a’, we can construct the following FA − Case 2 − For a regular expression ‘ab’, we can construct the following FA − Case 3 − For a regular expression (a+b), we can construct the following FA − Case 4 − For a regular expression (a+b)*, we can construct the following FA −
  • 18. Step 4 − Here qf is a final state, so we make q1 also a final state. So the FA becomes −
  • 19. PumpingLemmaForRegularGrammars Theorem Let L be a regular language. Then there exists a constant ‘c’such that for every string w in L − |w| ≥ c We can break w into three strings, w = xyz, such that −  |y| > 0  |xy| ≤ c  For all k ≥ 0, the string xykz is also in L. Applications ofPumping Lemma Pumping Lemma is to be applied to show that certain languages are not regular. It should never be used to show a language is regular.  If L is regular, it satisfies Pumping Lemma.  If L does not satisfy Pumping Lemma, it is non-regular. Method toprove that alanguage Lis not regular  At first, we have to assume that L is regular.  So, the pumping lemma should hold for L.  Use the pumping lemma to obtain a contradiction − o Select w such that |w| ≥ c o Select y such that |y| ≥ 1 o Select x such that |xy| ≤ c o Assign the remaining string to z. o Select k such that the resulting string is not in L. Hence L is not regular.