SlideShare a Scribd company logo
TYPESOF LANGUAGES
Name : Ankur
Enrollment Number : 140950107005
Subject :Theory Of Computation
Class : 6th A
Computer Science and Engineering
INTRODUCTION
 Language theory is a branch of mathematics
concerned with describing languages as a set of
operations over an alphabet. It is closely linked with
automata theory, as automata are used to generate
and recognize formal languages.There are several
classes of formal languages, each allowing more
complex language specification than the one
before it, i.e. Chomsky hierarchy, and each
corresponding to a class of automata which
recognizes it. Because automata are used as
models for computation, formal languages are the
preferred mode of specification for any problem
that must be computed.
In the formal languages of computer
science and linguistics, the Chomsky hierarchy is
a containment hierarchy of classes of formal
grammars.This hierarchy of grammars was described
by Noam Chomsky in 1956.
A formal grammar of this type consists of a finite set
of production rules (left-hand side → right-hand side),
where each side consists of a finite sequence of the
following symbols:
 a finite set of nonterminal symbols (indicating that
some production rule can yet be applied)
 a finite set of terminal symbols (indicating that no
production rule can be applied)
 a start symbol (a distinguished nonterminal symbol)
TYPESOF
LANGUAGES
Grammar Languages Automaton
Type-0 Recursively enumerable Turing machine
Type-1 Context-sensitive
Linear-bounded non-
deterministicTuring
machine
Type-2 Context-free
Non-
deterministic pushdown
automaton
Type-3 Regular Finite state automaton
RECURSIVELY
ENUMERABL
E LANGUAGE
 A recursively enumerable language is a recursively
enumerable subset in the set of all possible words over the
alphabet of the language. A recursively enumerable
language is a formal language for which there exists a
Turing machine (or other computable function) which will
enumerate all valid strings of the language.
 In mathematics, logic and computer science, a formal
language is called recursively
enumerable also recognizable, partially
decidable, semidecidable, Turing-acceptable or Turing-
recognizable, if it is a recursively enumerable subset in
the set of all possible words over the alphabet of the
language, i.e., if there exists aTuring machine which will
enumerate all valid strings of the language.
 Recursively enumerable languages are known as type-
0 languages in the Chomsky hierarchy of formal languages.
All regular, context-free, context-
sensitive and recursive languages are recursively
enumerable.The class of all recursively enumerable
languages is called RE.
There are three equivalent definitions of a recursively enumerable
language:
 A recursively enumerable language is a recursively
enumerable subset in the set of all possible words over
the alphabet of the language.
 A recursively enumerable language is a formal language for which
there exists aTuring machine (or other computable function) which
will enumerate all valid strings of the language. Note that if the
language is infinite, the enumerating algorithm provided can be
chosen so that it avoids repetitions, since we can test whether the
string produced for number n is "already" produced for a number
which is less than n. If it already is produced, use the output for
input n+1 instead (recursively), but again, test whether it is "new".
 A recursively enumerable language is a formal language for which
there exists aTuring machine (or other computable function) that
will halt and accept when presented with any string in the language
as input but may either halt and reject or loop forever when
presented with a string not in the language. Contrast this
to recursive languages, which require that theTuring machine halts
in all cases.
All regular, context-free, context-sensitive and recursive languages are
recursively enumerable.
Example
 The halting problem is recursively enumerable but
not recursive. Indeed one can run theTuring
Machine and accept if the machine halts, hence it is
recursively enumerable. On the other hand the
problem is undecidable. In computability theory,
the Halting problem is the problem of
determining, from a description of an
arbitrary computer program and an input, whether
the program will finish running or continue to run
forever.
For example, in pseudocode, the program
while (true) continue
does not halt; rather, it goes on forever in an infinite
loop. On the other hand, the program
print "Hello, world!“
does halt.
Closure
Properties
Recursively enumerable languages are closed under
the following operations.That is, if L and P are two
recursively enumerable languages, then the
following languages are recursively enumerable as
well:
 the Kleene star L* of L
 the concatenation L.P of L and P
 the union L U P
 the intersection L ∩ P
Recursively enumerable languages are not closed
under set difference or complementation.The set
difference L - P may or may not be recursively
enumerable. If L is recursively enumerable, then the
complement of L is recursively enumerable if and
only if L is also recursive.
CONTEXT-
SENSITIVE
LANGUAGE
 Type-1 grammars generate the context-sensitive
languages.These grammars have rules of the
form αAβ -> αγβ with A a nonterminal and α,
β and γ strings of terminals and/or non-terminals.
The strings α and β may be empty, but γ must be
nonempty.The rule S -> ε is allowed if S does not
appear on the right side of any rule.The languages
described by these grammars are exactly all
languages that can be recognized by a linear
bounded automaton (a nondeterministicTuring
machine whose tape is bounded by a constant
times the length of the input.)
 In theoretical computer science, a context-
sensitive language is a formal language that can
be defined by a context-sensitive grammar (and
equivalently by a noncontracting grammar).
Computational
Properties
 Computationally, a context-sensitive language is
equivalent with a linear bounded nondeterministic
Turing machine, also called a linear bounded
automaton.That is a non-deterministicTuring
machine with a tape of only kn cells, where n is the
size of the input and k is a constant associated with
the machine.This means that every formal
language that can be decided by such a machine is
a context-sensitive language, and every context-
sensitive language can be decided by such a
machine.
 This set of languages is also known
as NLINSPACE or NSPACE(O(n)), because they can
be accepted using linear space on a non-
deterministicTuring machine.
Example
 One of the simplest context-sensitive but not context-
free languages is L = {anbncn : n ≥ 1}: the language of all
strings consisting of n occurrences of the symbol "a",
then n "b"'s, then n "c"'s (abc, aabbcc, aaabbbccc,
etc.). A superset of this language, called the Bach
language, is defined as the set of all strings where "a",
"b" and "c" (or any other set of three symbols) occurs
equally often (aabccb, baabcaccb, etc.) and is also
context-sensitive.
 L can be shown to be a context-sensitive language by
constructing a linear bounded automaton which
accepts L.The language can easily be shown to be
neither regular nor context free by applying the
respective pumping lemmas for each of the language
classes to L.
 An example of recursive language that is not context-
sensitive is any recursive language whose decision is
an EXPSPACE-hard problem, say, the set of pairs of
equivalent regular expressions with exponentiation.
Closure
Properties
 The union, intersection, concatenation of two
context-sensitive languages is context-sensitive;
the Kleene plus of a context-sensitive language is
context-sensitive.
 The complement of a context-sensitive language is
itself context-sensitive a result known as
the Immerman–Szelepcsényi theorem.
 Membership of a string in a language defined by an
arbitrary context-sensitive grammar, or by an
arbitrary deterministic context-sensitive grammar,
is a PSPACE-complete problem.
CONTEXT-
FREE
LANGUAGE
 Type-2 grammars generate the context-free
languages.These are defined by rules of the form A ->
γ with A a nonterminal and γ a string of terminals
and/or non-terminals.These languages are exactly all
languages that can be recognized by a non-
deterministic pushdown automaton. Context-free
languages—or rather its subset of deterministic
context-free language—are the theoretical basis for
the phrase structure of most programming languages,
though their syntax also includes context-sensitive
name resolution due to declarations and scope.Often
a subset of grammars are used to make parsing easier,
such as by an LL parser. In formal language theory,
a context-free language (CFL) is
a language generated by a context-free
grammar (CFG).
 The set of all context-free languages is identical to the
set of languages accepted by pushdown automata,
which makes these languages amenable to parsing.
Further, for a given a CFG, there is a direct way to
produce a pushdown automaton for the grammar,
though going the other way (producing a grammar
given an automaton) is not as direct.
Example
A model context-free language is L = {anbncn : n ≥ 1} : the
language of all non-empty even-length strings, the
entire first halves of which are a's, and the entire second
halves of which are b's. L is generated by the grammar S
-> aSb|ab. This language is not regular. It is accepted by
the pushdown automaton M=({q0,q1,qf},{a,b},{a,z},δ
,q0,z,{qf}) where δ is defined as follows:
δ(q0,a,z)=(q0,az)
δ(q0,a,a)=(q0,aa)
δ(q0,b,a)=(q1, ε)
δ(q1,b,a)=(q1,ε)
Unambiguous CFLs are a proper subset of all CFLs: there
are inherently ambiguous CFLs. An example of an
inherently ambiguous CFL is the union of {anbmcmdm|n,m
> 0 } with {anbncmdm|n,m > 0 }.This set is context-free,
since the union of two context-free languages is always
context-free. But there is no way to unambiguously
parse strings in the (non-context-free)
subset {anbncndn|n,m > 0 } which is the intersection of
these two languages.
Properties
• Context-free parsing:
The context-free nature of the language makes it simple to
parse with a pushdown automaton.
Determining an instance of the membership problem; i.e.
given a string ω, determine whether ω ϵ L(G) where L is
the language generated by a given grammar G is also
known as recognition.
Practical uses of context-free languages require also to
produce a derivation tree that exhibits the structure that
the grammar associates with the given string.The process
of producing this tree is called parsing. Known parsers have
a time complexity that is cubic in the size of the string that
is parsed.
Formally, the set of all context-free languages is identical to
the set of languages accepted by pushdown
automata(PDA).
A special subclass of context-free languages are
the deterministic context-free languages which are defined
as the set of languages accepted by a deterministic
pushdown automaton and can be parsed by a LR(k) parser.
• Closure Properties:
Context-free languages are closed under the
following operations.That is, if L and P are
context-free languages, the following
languages are context-free as well:
1.the union L U P of L and P
2.the reversal of L
3.the concatenation L.P of L and P
4.the Kleene star L* of L
5.the cyclic shift of L (the language { vu : uv ϵ
L })
Context-free languages are not closed
under complement, intersection,
or difference.
REGULAR
LANGUAGE
• In theoretical computer science and formal language
theory, a regular language (also called a rational
language) is a formal language that can be expressed
using a regular expression.
• Type-3 grammars generate the regular languages.
Such a grammar restricts its rules to a single
nonterminal on the left-hand side and a right-hand
side consisting of a single terminal, possibly followed
by a single nonterminal (right regular).Alternatively,
the right-hand side of the grammar can consist of a
single terminal, possibly preceded by a single
nonterminal (left regular).These generate the same
languages. However, if left-regular rules and right-
regular rules are combined, the language need no
longer be regular.The rule S -> ε is also allowed here
if S does not appear on the right side of any rule.
These languages are exactly all languages that can be
decided by a finite state automaton.Additionally, this
family of formal languages can be obtained by regular
expressions. Regular languages are commonly used to
define search patterns and the lexical structure of
programming languages.
• Alternatively, a regular language can be defined
as a language recognized by a finite automaton.
The equivalence of regular expressions and finite
automata is known as Kleene's theorem.
• The collection of regular languages over
an alphabet Σ is defined recursively as follows:
1. The empty languageØ, and the empty string
language {ε} are regular languages.
2. For each a ∈ Σ (a belongs to Σ),
the singleton language {a} is a regular
language.
3. If A and B are regular languages,
then A ∪ B (union), A • B (concatenation),
and A* (Kleene star) are regular languages.
4. No other languages over Σ are regular.
Example
 All finite languages are regular; in
particular the empty string language {ε}
= Ø* is regular. Other typical examples
include the language consisting of all
strings over the alphabet {a, b} which
contain an even number of a’s, or the
language consisting of all strings of the
form: several a’s followed by several b’s.
 A simple example of a language that is
not regular is the set of strings { anbn | n ≥
0 }. Intuitively, it cannot be recognized
with a finite automaton, since a finite
automaton has finite memory and it
cannot remember the exact number of
a's.
Closure
Properties
The regular languages
are closed under the various
operations, that is, if the
languages K and L are regular, so is the
result of the following operations:
• the set theoretic Boolean
operations: union K ∪ L, intersection
K ∩ L, and complement L, hence
also relative complement K-L.
• the regular
operations: K ∪ L, concatenation K ∘
L, and Kleene star L*.
• the reverse (or mirror image) LR .
THANKYOU

More Related Content

What's hot

Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
Ratnakar Mikkili
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
Radhakrishnan Chinnusamy
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
Dipankar Boruah
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
Marina Santini
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
SOMNATHMORE2
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
Mir Majid
 
context free language
context free languagecontext free language
context free language
khush_boo31
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
Rahul Narang
 
Lecture 10 semantic analysis 01
Lecture 10 semantic analysis 01Lecture 10 semantic analysis 01
Lecture 10 semantic analysis 01
Iffat Anjum
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
Akhil Kaushik
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
Dattatray Gandhmal
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
Dr Geetha Mohan
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
Tanzeela_Hussain
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
hafizhamza0322
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
Marina Santini
 
Compilers
CompilersCompilers
Compilers
Bense Tony
 
Moore and mealy machine
Moore and mealy machineMoore and mealy machine
Moore and mealy machine
Mian Munib
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
Zahid Parvez
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prolog
Harry Potter
 
Finite automata
Finite automataFinite automata
Finite automata
ankitamakin
 

What's hot (20)

Introduction TO Finite Automata
Introduction TO Finite AutomataIntroduction TO Finite Automata
Introduction TO Finite Automata
 
1.Role lexical Analyzer
1.Role lexical Analyzer1.Role lexical Analyzer
1.Role lexical Analyzer
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
Decision properties of reular languages
Decision properties of reular languagesDecision properties of reular languages
Decision properties of reular languages
 
Compiler Design
Compiler DesignCompiler Design
Compiler Design
 
context free language
context free languagecontext free language
context free language
 
Turing Machine
Turing MachineTuring Machine
Turing Machine
 
Lecture 10 semantic analysis 01
Lecture 10 semantic analysis 01Lecture 10 semantic analysis 01
Lecture 10 semantic analysis 01
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Specification-of-tokens
Specification-of-tokensSpecification-of-tokens
Specification-of-tokens
 
Design and analysis of algorithms
Design and analysis of algorithmsDesign and analysis of algorithms
Design and analysis of algorithms
 
Phases of Compiler
Phases of CompilerPhases of Compiler
Phases of Compiler
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
 
Lecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular LanguagesLecture: Regular Expressions and Regular Languages
Lecture: Regular Expressions and Regular Languages
 
Compilers
CompilersCompilers
Compilers
 
Moore and mealy machine
Moore and mealy machineMoore and mealy machine
Moore and mealy machine
 
CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR CONTEXT FREE GRAMMAR
CONTEXT FREE GRAMMAR
 
Introduction to prolog
Introduction to prologIntroduction to prolog
Introduction to prolog
 
Finite automata
Finite automataFinite automata
Finite automata
 

Similar to Types of Language in Theory of Computation

Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
SANUC2
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
VenkataRaoS1
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
meresie tesfay
 
Lecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdfLecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdf
Deptii Chaudhari
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
Gaurav447273
 
Mba ebooks ! Edhole
Mba ebooks ! EdholeMba ebooks ! Edhole
Mba ebooks ! Edhole
Edhole.com
 
Free Ebooks Download ! Edhole
Free Ebooks Download ! EdholeFree Ebooks Download ! Edhole
Free Ebooks Download ! Edhole
Edhole.com
 
ChomskyPresentation.pdf
ChomskyPresentation.pdfChomskyPresentation.pdf
ChomskyPresentation.pdf
NiteshJaypal
 
Normal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.pptNormal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.ppt
Karthik Rohan
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
Siddharaj Junnarkar
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
adugnanegero
 
Deterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministicDeterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministic
Leyo Stephen
 
Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering students
RosnaPHaroon
 
Regular expression
Regular expressionRegular expression
Regular expression
lahirubanuka1
 
Chomsky classification for types of grammars
Chomsky classification for types of grammarsChomsky classification for types of grammars
Chomsky classification for types of grammars
VikrantSharma506366
 
Unit v
Unit vUnit v
Unit v
TPLatchoumi
 
Introduction to the theory of computation
Introduction to the theory of computationIntroduction to the theory of computation
Introduction to the theory of computation
prasadmvreddy
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
FellowBuddy.com
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
Akhil Kaushik
 
01-Introduction&Languages.pdf
01-Introduction&Languages.pdf01-Introduction&Languages.pdf
01-Introduction&Languages.pdf
TariqSaeed80
 

Similar to Types of Language in Theory of Computation (20)

Chomsky hierarchy
Chomsky hierarchyChomsky hierarchy
Chomsky hierarchy
 
Flat unit 3
Flat unit 3Flat unit 3
Flat unit 3
 
Ch3 4 regular expression and grammar
Ch3 4 regular expression and grammarCh3 4 regular expression and grammar
Ch3 4 regular expression and grammar
 
Lecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdfLecture Notes-Are Natural Languages Regular.pdf
Lecture Notes-Are Natural Languages Regular.pdf
 
Presentation (5).pdf
Presentation (5).pdfPresentation (5).pdf
Presentation (5).pdf
 
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
 
ChomskyPresentation.pdf
ChomskyPresentation.pdfChomskyPresentation.pdf
ChomskyPresentation.pdf
 
Normal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.pptNormal-forms-for-Context-Free-Grammars.ppt
Normal-forms-for-Context-Free-Grammars.ppt
 
Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)Fafl notes [2010] (sjbit)
Fafl notes [2010] (sjbit)
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Deterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministicDeterministic context free grammars &non-deterministic
Deterministic context free grammars &non-deterministic
 
Natural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering studentsNatural Language Processing Topics for Engineering students
Natural Language Processing Topics for Engineering students
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Chomsky classification for types of grammars
Chomsky classification for types of grammarsChomsky classification for types of grammars
Chomsky classification for types of grammars
 
Unit v
Unit vUnit v
Unit v
 
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 Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Context Free Grammar
Context Free GrammarContext Free Grammar
Context Free Grammar
 
01-Introduction&Languages.pdf
01-Introduction&Languages.pdf01-Introduction&Languages.pdf
01-Introduction&Languages.pdf
 

Recently uploaded

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
Celine George
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
Celine George
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
sayalidalavi006
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17How to Make a Field Mandatory in Odoo 17
How to Make a Field Mandatory in Odoo 17
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
How to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRMHow to Manage Your Lost Opportunities in Odoo 17 CRM
How to Manage Your Lost Opportunities in Odoo 17 CRM
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5Community pharmacy- Social and preventive pharmacy UNIT 5
Community pharmacy- Social and preventive pharmacy UNIT 5
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Types of Language in Theory of Computation

  • 1. TYPESOF LANGUAGES Name : Ankur Enrollment Number : 140950107005 Subject :Theory Of Computation Class : 6th A Computer Science and Engineering
  • 2. INTRODUCTION  Language theory is a branch of mathematics concerned with describing languages as a set of operations over an alphabet. It is closely linked with automata theory, as automata are used to generate and recognize formal languages.There are several classes of formal languages, each allowing more complex language specification than the one before it, i.e. Chomsky hierarchy, and each corresponding to a class of automata which recognizes it. Because automata are used as models for computation, formal languages are the preferred mode of specification for any problem that must be computed.
  • 3. In the formal languages of computer science and linguistics, the Chomsky hierarchy is a containment hierarchy of classes of formal grammars.This hierarchy of grammars was described by Noam Chomsky in 1956. A formal grammar of this type consists of a finite set of production rules (left-hand side → right-hand side), where each side consists of a finite sequence of the following symbols:  a finite set of nonterminal symbols (indicating that some production rule can yet be applied)  a finite set of terminal symbols (indicating that no production rule can be applied)  a start symbol (a distinguished nonterminal symbol)
  • 4. TYPESOF LANGUAGES Grammar Languages Automaton Type-0 Recursively enumerable Turing machine Type-1 Context-sensitive Linear-bounded non- deterministicTuring machine Type-2 Context-free Non- deterministic pushdown automaton Type-3 Regular Finite state automaton
  • 5. RECURSIVELY ENUMERABL E LANGUAGE  A recursively enumerable language is a recursively enumerable subset in the set of all possible words over the alphabet of the language. A recursively enumerable language is a formal language for which there exists a Turing machine (or other computable function) which will enumerate all valid strings of the language.  In mathematics, logic and computer science, a formal language is called recursively enumerable also recognizable, partially decidable, semidecidable, Turing-acceptable or Turing- recognizable, if it is a recursively enumerable subset in the set of all possible words over the alphabet of the language, i.e., if there exists aTuring machine which will enumerate all valid strings of the language.  Recursively enumerable languages are known as type- 0 languages in the Chomsky hierarchy of formal languages. All regular, context-free, context- sensitive and recursive languages are recursively enumerable.The class of all recursively enumerable languages is called RE.
  • 6. There are three equivalent definitions of a recursively enumerable language:  A recursively enumerable language is a recursively enumerable subset in the set of all possible words over the alphabet of the language.  A recursively enumerable language is a formal language for which there exists aTuring machine (or other computable function) which will enumerate all valid strings of the language. Note that if the language is infinite, the enumerating algorithm provided can be chosen so that it avoids repetitions, since we can test whether the string produced for number n is "already" produced for a number which is less than n. If it already is produced, use the output for input n+1 instead (recursively), but again, test whether it is "new".  A recursively enumerable language is a formal language for which there exists aTuring machine (or other computable function) that will halt and accept when presented with any string in the language as input but may either halt and reject or loop forever when presented with a string not in the language. Contrast this to recursive languages, which require that theTuring machine halts in all cases. All regular, context-free, context-sensitive and recursive languages are recursively enumerable.
  • 7. Example  The halting problem is recursively enumerable but not recursive. Indeed one can run theTuring Machine and accept if the machine halts, hence it is recursively enumerable. On the other hand the problem is undecidable. In computability theory, the Halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running or continue to run forever. For example, in pseudocode, the program while (true) continue does not halt; rather, it goes on forever in an infinite loop. On the other hand, the program print "Hello, world!“ does halt.
  • 8. Closure Properties Recursively enumerable languages are closed under the following operations.That is, if L and P are two recursively enumerable languages, then the following languages are recursively enumerable as well:  the Kleene star L* of L  the concatenation L.P of L and P  the union L U P  the intersection L ∩ P Recursively enumerable languages are not closed under set difference or complementation.The set difference L - P may or may not be recursively enumerable. If L is recursively enumerable, then the complement of L is recursively enumerable if and only if L is also recursive.
  • 9. CONTEXT- SENSITIVE LANGUAGE  Type-1 grammars generate the context-sensitive languages.These grammars have rules of the form αAβ -> αγβ with A a nonterminal and α, β and γ strings of terminals and/or non-terminals. The strings α and β may be empty, but γ must be nonempty.The rule S -> ε is allowed if S does not appear on the right side of any rule.The languages described by these grammars are exactly all languages that can be recognized by a linear bounded automaton (a nondeterministicTuring machine whose tape is bounded by a constant times the length of the input.)  In theoretical computer science, a context- sensitive language is a formal language that can be defined by a context-sensitive grammar (and equivalently by a noncontracting grammar).
  • 10. Computational Properties  Computationally, a context-sensitive language is equivalent with a linear bounded nondeterministic Turing machine, also called a linear bounded automaton.That is a non-deterministicTuring machine with a tape of only kn cells, where n is the size of the input and k is a constant associated with the machine.This means that every formal language that can be decided by such a machine is a context-sensitive language, and every context- sensitive language can be decided by such a machine.  This set of languages is also known as NLINSPACE or NSPACE(O(n)), because they can be accepted using linear space on a non- deterministicTuring machine.
  • 11. Example  One of the simplest context-sensitive but not context- free languages is L = {anbncn : n ≥ 1}: the language of all strings consisting of n occurrences of the symbol "a", then n "b"'s, then n "c"'s (abc, aabbcc, aaabbbccc, etc.). A superset of this language, called the Bach language, is defined as the set of all strings where "a", "b" and "c" (or any other set of three symbols) occurs equally often (aabccb, baabcaccb, etc.) and is also context-sensitive.  L can be shown to be a context-sensitive language by constructing a linear bounded automaton which accepts L.The language can easily be shown to be neither regular nor context free by applying the respective pumping lemmas for each of the language classes to L.  An example of recursive language that is not context- sensitive is any recursive language whose decision is an EXPSPACE-hard problem, say, the set of pairs of equivalent regular expressions with exponentiation.
  • 12. Closure Properties  The union, intersection, concatenation of two context-sensitive languages is context-sensitive; the Kleene plus of a context-sensitive language is context-sensitive.  The complement of a context-sensitive language is itself context-sensitive a result known as the Immerman–Szelepcsényi theorem.  Membership of a string in a language defined by an arbitrary context-sensitive grammar, or by an arbitrary deterministic context-sensitive grammar, is a PSPACE-complete problem.
  • 13. CONTEXT- FREE LANGUAGE  Type-2 grammars generate the context-free languages.These are defined by rules of the form A -> γ with A a nonterminal and γ a string of terminals and/or non-terminals.These languages are exactly all languages that can be recognized by a non- deterministic pushdown automaton. Context-free languages—or rather its subset of deterministic context-free language—are the theoretical basis for the phrase structure of most programming languages, though their syntax also includes context-sensitive name resolution due to declarations and scope.Often a subset of grammars are used to make parsing easier, such as by an LL parser. In formal language theory, a context-free language (CFL) is a language generated by a context-free grammar (CFG).  The set of all context-free languages is identical to the set of languages accepted by pushdown automata, which makes these languages amenable to parsing. Further, for a given a CFG, there is a direct way to produce a pushdown automaton for the grammar, though going the other way (producing a grammar given an automaton) is not as direct.
  • 14. Example A model context-free language is L = {anbncn : n ≥ 1} : the language of all non-empty even-length strings, the entire first halves of which are a's, and the entire second halves of which are b's. L is generated by the grammar S -> aSb|ab. This language is not regular. It is accepted by the pushdown automaton M=({q0,q1,qf},{a,b},{a,z},δ ,q0,z,{qf}) where δ is defined as follows: δ(q0,a,z)=(q0,az) δ(q0,a,a)=(q0,aa) δ(q0,b,a)=(q1, ε) δ(q1,b,a)=(q1,ε) Unambiguous CFLs are a proper subset of all CFLs: there are inherently ambiguous CFLs. An example of an inherently ambiguous CFL is the union of {anbmcmdm|n,m > 0 } with {anbncmdm|n,m > 0 }.This set is context-free, since the union of two context-free languages is always context-free. But there is no way to unambiguously parse strings in the (non-context-free) subset {anbncndn|n,m > 0 } which is the intersection of these two languages.
  • 15. Properties • Context-free parsing: The context-free nature of the language makes it simple to parse with a pushdown automaton. Determining an instance of the membership problem; i.e. given a string ω, determine whether ω ϵ L(G) where L is the language generated by a given grammar G is also known as recognition. Practical uses of context-free languages require also to produce a derivation tree that exhibits the structure that the grammar associates with the given string.The process of producing this tree is called parsing. Known parsers have a time complexity that is cubic in the size of the string that is parsed. Formally, the set of all context-free languages is identical to the set of languages accepted by pushdown automata(PDA). A special subclass of context-free languages are the deterministic context-free languages which are defined as the set of languages accepted by a deterministic pushdown automaton and can be parsed by a LR(k) parser.
  • 16. • Closure Properties: Context-free languages are closed under the following operations.That is, if L and P are context-free languages, the following languages are context-free as well: 1.the union L U P of L and P 2.the reversal of L 3.the concatenation L.P of L and P 4.the Kleene star L* of L 5.the cyclic shift of L (the language { vu : uv ϵ L }) Context-free languages are not closed under complement, intersection, or difference.
  • 17. REGULAR LANGUAGE • In theoretical computer science and formal language theory, a regular language (also called a rational language) is a formal language that can be expressed using a regular expression. • Type-3 grammars generate the regular languages. Such a grammar restricts its rules to a single nonterminal on the left-hand side and a right-hand side consisting of a single terminal, possibly followed by a single nonterminal (right regular).Alternatively, the right-hand side of the grammar can consist of a single terminal, possibly preceded by a single nonterminal (left regular).These generate the same languages. However, if left-regular rules and right- regular rules are combined, the language need no longer be regular.The rule S -> ε is also allowed here if S does not appear on the right side of any rule. These languages are exactly all languages that can be decided by a finite state automaton.Additionally, this family of formal languages can be obtained by regular expressions. Regular languages are commonly used to define search patterns and the lexical structure of programming languages.
  • 18. • Alternatively, a regular language can be defined as a language recognized by a finite automaton. The equivalence of regular expressions and finite automata is known as Kleene's theorem. • The collection of regular languages over an alphabet Σ is defined recursively as follows: 1. The empty languageØ, and the empty string language {ε} are regular languages. 2. For each a ∈ Σ (a belongs to Σ), the singleton language {a} is a regular language. 3. If A and B are regular languages, then A ∪ B (union), A • B (concatenation), and A* (Kleene star) are regular languages. 4. No other languages over Σ are regular.
  • 19. Example  All finite languages are regular; in particular the empty string language {ε} = Ø* is regular. Other typical examples include the language consisting of all strings over the alphabet {a, b} which contain an even number of a’s, or the language consisting of all strings of the form: several a’s followed by several b’s.  A simple example of a language that is not regular is the set of strings { anbn | n ≥ 0 }. Intuitively, it cannot be recognized with a finite automaton, since a finite automaton has finite memory and it cannot remember the exact number of a's.
  • 20. Closure Properties The regular languages are closed under the various operations, that is, if the languages K and L are regular, so is the result of the following operations: • the set theoretic Boolean operations: union K ∪ L, intersection K ∩ L, and complement L, hence also relative complement K-L. • the regular operations: K ∪ L, concatenation K ∘ L, and Kleene star L*. • the reverse (or mirror image) LR .