SlideShare a Scribd company logo
1 of 23
Download to read offline
Theory of Computation
By Rushabh Wadkar
Topics to be covered
Basic concepts and their usage
Basic Grammar
Automata Introduction
a. Deterministic
b. Non-Deterministic
Intro to DFA and NFA
Day 2
Basic Concepts in TOC
In theory of computation the few of the most important concepts are:
1. To identify the Language.
[ Σ=(a,b) ] ,
hence w=(aab,bab,aaa,ba…)
2. Concatenation of strings.
If s1= a1
a2
...an
And s2 = b1
b2
...bn
(s1.s2)= a1
a2
...an
b1
b2
...bn
Basic Concepts in TOC
In theory of computation the few of the most important concepts are:
3. Length of a string.
If s1= abaaba
Length of s1(|s1|) = 6
|w| = |wR
|
where wR
is the reverse
4. Sub-strings.
If u = abb & v = bab
And w = u.v
w = abbbab
u,v are substrings of w
Basic Concepts in TOC
In theory of computation the few of the most important concepts are:
5.1 Empty Strings
Denoted as ‘λ’.
|λ| = 0 & w0
= λ
5.2 Concatenating with
Empty Strings.
w.λ= λ.w = w
Proof By Induction
To prove:
Step1: For all a ∈ ∑ and w any string on ∑; Let,
Step2: Take any υ of length n + 1 and
write it as υ = wa
Proof By Induction
To prove:
Step3: By the inductive hypothesis
Hence we can say...
Common Denotations
1. L = {an
bn
: n>0}, then L2
= {an
bn
am
bm
: n,m>0}
Ln
means L is concatenated with itself n times.
2. LR
means the reversal of L
If L= abbab, then LR
= babba
3. If ∑ =(a,b)
∑ *
={λ,a,b,ab,ba,. . .} and ∑ +
={a,b,ab,ba,. . .}
Grammars
A grammar is defined as a quadruple, G =(V, T, S, P)
where,
V is a finite set of objects called variables,
T is a finite set of objects called terminal symbols,
S ∈ V is a special symbol called the start variable,
P is a finite set of productions.
It will be assumed without further mention that the sets V and T are nonempty and disjoint.
We normally use capital letters for Variables, and small letters for terminals.
Grammar Problems
Q. Find grammar that generates L={an
bn+1
: n>=0}
.
.
. G = (V, T, S, P)
= ({S,A},{a,b},S,P)
P = S ---> Ab
A ---> aAb
A ---> λ
Grammar Problems
Q. If ∑ = { a, b}, and let na
(w) and nb
(w) denote the number of a’s and b’s in the
string w respectively. Find the grammar for L={w: na
(w) = nb
(w)}
S ---> SS
S ---> λ
S ---> aSb
S ---> bSa
Grammar Problems
Q. If Σ={a,b} , find grammar that contains exactly 1 a.
S --->bS | Sb
S ---> a
Grammar Problems
Q. If Σ={a,b} , find grammar that contains at least 1 a.
S ---> a
S --->bS | Sb
S ---> SS
Grammar Problems
Q. If Σ={a,b} , find grammar that contain not more than 3 a(s).
S ---> aA|Aa|aaA|Aaa|aaaA|Aaaa
S --->A|aAa|aaAa|aAaa
A ---> λ|bA|Ab
Grammar Problems
Q. If Σ={a,b} , find grammar that contain at least 3 a(s).
S --->BaBaBaB
B ---> λ|a|b|BB
Grammar Problems
Q. For the following grammar, Find the language.
S ---> λ|aSbb
Language (L)= {an
b2n
: n>=0}
Grammar Problems
Q. For the following grammar, Find the language.
S ---> aSb
S ---> aaa
Language (L)= {am
bm-3
: n>=0}
Grammar Problems
Comment if the two grammars are equal
1.
S ---> aSb|bSa|SS|a
2.
S ---> aSb|bSa|a
The string “aa” can’t be derived by
grammar 2
Automata: An Introduction
An automaton is an abstract model of a digital computer. It will be assumed that
the input is a string over a given alphabet, written on an input file, which the
automaton can read but not change.
The input mechanism can also detect the end of the input string (by sensing an
end-of-file condition).
The automaton can produce output of some form.
General Automaton This is a general model of
automata. A finite-state control will
be common to all specific cases,
but differences will arise from the
way in which the output can be
produced and the nature of the
temporary storage.
The nature of the temporary storage
governs the power of different types
of automata.
Types of Automaton
Deterministic Finite Automata Non-Deterministic Finite Automata
● All transitions are deterministic
○ Each transition leads to only
1 other state
● For each state, transition on all
symbols must be defined.
● Harder to construct as compared
to a NFA
● Some transitions could be
non-deterministic
○ Transition could lead to a
subset of states
● Transition on all symbols need
not be defined for a state.
● Easier to construct as compared
to a DFA
Special types of Automaton
Let us see a few types of automaton that are of specific usage.
#Acceptor
An automaton whose
output is restricted to simple
yes/no. It accepts or rejects a
string.
#Applications:
>Automata are used for serial
addition in binary circuits.
>Also used in legal acceptors
to detect if the string is valid.
End of Day 2
www.linkedin.com/in/wadkar-rushabh
@RushabhWadkar
Thank you...

More Related Content

What's hot

Regular Languages
Regular LanguagesRegular Languages
Regular Languagesparmeet834
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Animesh Chaturvedi
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramAbdullah Jan
 
Context free grammars
Context free grammarsContext free grammars
Context free grammarsRonak Thakkar
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite AutomataArchana Gopinath
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free GrammarsMarina Santini
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of LanguageDipankar Boruah
 
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
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machinesAYESHA JAVED
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFAMaulik Togadiya
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammarSampath Kumar S
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of AutomataFarooq Mian
 

What's hot (20)

Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
NFA & DFA
NFA & DFANFA & DFA
NFA & DFA
 
Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)Deterministic Finite Automata (DFA)
Deterministic Finite Automata (DFA)
 
NFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition DiagramNFA Converted to DFA , Minimization of DFA , Transition Diagram
NFA Converted to DFA , Minimization of DFA , Transition Diagram
 
Context free grammars
Context free grammarsContext free grammars
Context free grammars
 
Finite automata
Finite automataFinite automata
Finite automata
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Regular Expression to Finite Automata
Regular Expression to Finite AutomataRegular Expression to Finite Automata
Regular Expression to Finite Automata
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
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
 
NFA to DFA
NFA to DFANFA to DFA
NFA to DFA
 
Context free grammar
Context free grammarContext free grammar
Context free grammar
 
Moore and mealy machines
Moore and mealy machinesMoore and mealy machines
Moore and mealy machines
 
push down automata
push down automatapush down automata
push down automata
 
Finite Automata
Finite AutomataFinite Automata
Finite Automata
 
Regular expression with DFA
Regular expression with DFARegular expression with DFA
Regular expression with DFA
 
2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar2.1 & 2.2 grammar introduction – types of grammar
2.1 & 2.2 grammar introduction – types of grammar
 
Theory of Automata
Theory of AutomataTheory of Automata
Theory of Automata
 

Similar to Theory of Computation Basic Concepts and Grammar

Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysisDattatray Gandhmal
 
Theory of Computation.pptx
Theory of Computation.pptxTheory of Computation.pptx
Theory of Computation.pptxsavita325705
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptxmainakmail2585
 
finite_automata.ppt
finite_automata.pptfinite_automata.ppt
finite_automata.pptAkhlasHashim
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsRushabh2428
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal formsAkila Krishnamoorthy
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaRushabh2428
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)bolovv
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaPRAVEENTALARI4
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRaviAr5
 
introduction-190804060837.pptx
introduction-190804060837.pptxintroduction-190804060837.pptx
introduction-190804060837.pptxshumPanwar
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxssuser039bf6
 

Similar to Theory of Computation Basic Concepts and Grammar (20)

Lex analysis
Lex analysisLex analysis
Lex analysis
 
Finite automata-for-lexical-analysis
Finite automata-for-lexical-analysisFinite automata-for-lexical-analysis
Finite automata-for-lexical-analysis
 
Theory of Computation.pptx
Theory of Computation.pptxTheory of Computation.pptx
Theory of Computation.pptx
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
flat unit1
flat unit1flat unit1
flat unit1
 
9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx9781284077247_PPTx_CH01.pptx
9781284077247_PPTx_CH01.pptx
 
finite_automata.ppt
finite_automata.pptfinite_automata.ppt
finite_automata.ppt
 
Theory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and ProblemsTheory of Computation Grammar Concepts and Problems
Theory of Computation Grammar Concepts and Problems
 
Automata theory - CFG and normal forms
Automata theory - CFG and normal formsAutomata theory - CFG and normal forms
Automata theory - CFG and normal forms
 
Lexical
LexicalLexical
Lexical
 
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping LemmaTheory of Computation Regular Expressions, Minimisation & Pumping Lemma
Theory of Computation Regular Expressions, Minimisation & Pumping Lemma
 
Lecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.pptLecture12_16717_Lecture1.ppt
Lecture12_16717_Lecture1.ppt
 
Chapter Two(1)
Chapter Two(1)Chapter Two(1)
Chapter Two(1)
 
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping LemmaTheory of computation:Finite Automata, Regualr Expression, Pumping Lemma
Theory of computation:Finite Automata, Regualr Expression, Pumping Lemma
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
introduction-190804060837.pptx
introduction-190804060837.pptxintroduction-190804060837.pptx
introduction-190804060837.pptx
 
The Theory of Finite Automata.pptx
The Theory of Finite Automata.pptxThe Theory of Finite Automata.pptx
The Theory of Finite Automata.pptx
 
5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 

Recently uploaded

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxDr.Ibrahim Hassaan
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxChelloAnnAsuncion2
 

Recently uploaded (20)

How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Gas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptxGas measurement O2,Co2,& ph) 04/2024.pptx
Gas measurement O2,Co2,& ph) 04/2024.pptx
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptxGrade 9 Q4-MELC1-Active and Passive Voice.pptx
Grade 9 Q4-MELC1-Active and Passive Voice.pptx
 

Theory of Computation Basic Concepts and Grammar

  • 1. Theory of Computation By Rushabh Wadkar
  • 2. Topics to be covered Basic concepts and their usage Basic Grammar Automata Introduction a. Deterministic b. Non-Deterministic Intro to DFA and NFA Day 2
  • 3. Basic Concepts in TOC In theory of computation the few of the most important concepts are: 1. To identify the Language. [ Σ=(a,b) ] , hence w=(aab,bab,aaa,ba…) 2. Concatenation of strings. If s1= a1 a2 ...an And s2 = b1 b2 ...bn (s1.s2)= a1 a2 ...an b1 b2 ...bn
  • 4. Basic Concepts in TOC In theory of computation the few of the most important concepts are: 3. Length of a string. If s1= abaaba Length of s1(|s1|) = 6 |w| = |wR | where wR is the reverse 4. Sub-strings. If u = abb & v = bab And w = u.v w = abbbab u,v are substrings of w
  • 5. Basic Concepts in TOC In theory of computation the few of the most important concepts are: 5.1 Empty Strings Denoted as ‘λ’. |λ| = 0 & w0 = λ 5.2 Concatenating with Empty Strings. w.λ= λ.w = w
  • 6. Proof By Induction To prove: Step1: For all a ∈ ∑ and w any string on ∑; Let, Step2: Take any υ of length n + 1 and write it as υ = wa
  • 7. Proof By Induction To prove: Step3: By the inductive hypothesis Hence we can say...
  • 8. Common Denotations 1. L = {an bn : n>0}, then L2 = {an bn am bm : n,m>0} Ln means L is concatenated with itself n times. 2. LR means the reversal of L If L= abbab, then LR = babba 3. If ∑ =(a,b) ∑ * ={λ,a,b,ab,ba,. . .} and ∑ + ={a,b,ab,ba,. . .}
  • 9. Grammars A grammar is defined as a quadruple, G =(V, T, S, P) where, V is a finite set of objects called variables, T is a finite set of objects called terminal symbols, S ∈ V is a special symbol called the start variable, P is a finite set of productions. It will be assumed without further mention that the sets V and T are nonempty and disjoint. We normally use capital letters for Variables, and small letters for terminals.
  • 10. Grammar Problems Q. Find grammar that generates L={an bn+1 : n>=0} . . . G = (V, T, S, P) = ({S,A},{a,b},S,P) P = S ---> Ab A ---> aAb A ---> λ
  • 11. Grammar Problems Q. If ∑ = { a, b}, and let na (w) and nb (w) denote the number of a’s and b’s in the string w respectively. Find the grammar for L={w: na (w) = nb (w)} S ---> SS S ---> λ S ---> aSb S ---> bSa
  • 12. Grammar Problems Q. If Σ={a,b} , find grammar that contains exactly 1 a. S --->bS | Sb S ---> a
  • 13. Grammar Problems Q. If Σ={a,b} , find grammar that contains at least 1 a. S ---> a S --->bS | Sb S ---> SS
  • 14. Grammar Problems Q. If Σ={a,b} , find grammar that contain not more than 3 a(s). S ---> aA|Aa|aaA|Aaa|aaaA|Aaaa S --->A|aAa|aaAa|aAaa A ---> λ|bA|Ab
  • 15. Grammar Problems Q. If Σ={a,b} , find grammar that contain at least 3 a(s). S --->BaBaBaB B ---> λ|a|b|BB
  • 16. Grammar Problems Q. For the following grammar, Find the language. S ---> λ|aSbb Language (L)= {an b2n : n>=0}
  • 17. Grammar Problems Q. For the following grammar, Find the language. S ---> aSb S ---> aaa Language (L)= {am bm-3 : n>=0}
  • 18. Grammar Problems Comment if the two grammars are equal 1. S ---> aSb|bSa|SS|a 2. S ---> aSb|bSa|a The string “aa” can’t be derived by grammar 2
  • 19. Automata: An Introduction An automaton is an abstract model of a digital computer. It will be assumed that the input is a string over a given alphabet, written on an input file, which the automaton can read but not change. The input mechanism can also detect the end of the input string (by sensing an end-of-file condition). The automaton can produce output of some form.
  • 20. General Automaton This is a general model of automata. A finite-state control will be common to all specific cases, but differences will arise from the way in which the output can be produced and the nature of the temporary storage. The nature of the temporary storage governs the power of different types of automata.
  • 21. Types of Automaton Deterministic Finite Automata Non-Deterministic Finite Automata ● All transitions are deterministic ○ Each transition leads to only 1 other state ● For each state, transition on all symbols must be defined. ● Harder to construct as compared to a NFA ● Some transitions could be non-deterministic ○ Transition could lead to a subset of states ● Transition on all symbols need not be defined for a state. ● Easier to construct as compared to a DFA
  • 22. Special types of Automaton Let us see a few types of automaton that are of specific usage. #Acceptor An automaton whose output is restricted to simple yes/no. It accepts or rejects a string. #Applications: >Automata are used for serial addition in binary circuits. >Also used in legal acceptors to detect if the string is valid.
  • 23. End of Day 2 www.linkedin.com/in/wadkar-rushabh @RushabhWadkar Thank you...