SlideShare a Scribd company logo
1 of 43
LANGUAGE , GRAMMAR
&
AUTOMATA
Presentation by
Elakkiya.S,
Santhosh.B,
Balamurugan.A,
❖ Outline of the presentation
❖ Language
➢ Concatenation
➢ Properties of concatenation
➢ Regular expression
➢ Regular language
❖ Grammar
➢ Types of grammar
❖ Finite state machine
❖ Automata
➢ Automata and its types.
Maths- seminar presentation- 07.06.2021
1
Language
❖ Language:
❖ Definition:
➢ An alphabet is a non-empty finite set Σ of symbols.
➢ A string or word on the set Σ is a finite sequence of its elements (symbols)
■ If Σ ={a,b} then the sequences u=abba and v=aabbb of letters are strings
of Σ.
➢ The length of a string u is denoted by 丨u丨is the number of symbols in the
string
■ If Σ={0,1,2} then u=01 v=212 and w=01212 are possible strings on A. the
length of these strings is 丨u丨=2 丨v丨=3 丨w丨=5
➢ The string consisting of no symbols or letters taken from an alphabet Σ, we
define Σ⁰={λ}.
2
❖ Operations on strings
❖ The basic operations for strings is concatenation operations.
❖ The concatenation of strings is a string formed by writing the letters
(symbols) of first string followed by letters of second string
❖ Example :
➢ If u =ice and v= cream are the two strings of length 3 and 5 respectively.Then
concatenation of u and v is uv=ice cream is the string of length 3+5=8.
3
❖Properties of concatenation
❖ If Σ is an alphabet and n is a non-negative integer then the power of ∑ is
defined recursively as
➢ ∑1= ∑ and
➢ ∑n+1 = { ab:a∈A and b∈ ∑n}
❖ The concatenation Operation on an alphabet ∑ is associative , since for
every u,v,w ∈ ∑* ... We have u(vw)=(uv)w.
❖ The concatenation operation is not commutative (unless丨 ∑ 丨=1)on an
alphabet ∑ , since uv≠ vu for every u,v ∈ ∑* .
4
❖ The empty string λ is an identity element for concatenation
operation on an alphabet Σ that is λu=uλ=u for every u ∈ Σ*
❖ If u,v ∈ Σ* then we may write u=u1,u2,..........um and
v=v1,V2,......vn. For m,n and
u1,u2,...um;v1,v2..vn two string u,v are said equal.
❖ For every u,v,w ∈ ∑* we have
➢ wu= wv →u=v ( left cancellation)
➢ uw =vw →u=v ( right cancellation)
❖ For u, v ∈∑* we have
➢ │uv│= │u│+│v│
5
❖ Language
❖ Definition:
➢ For a given alphabet Σ , any subset of Σ* is called a language over Σ and is
denoted by L.
➢ The subset Ф also called empty language.
➢ A string in a language L is called a sentence of Σ.
6
❖ Operations on languages
❖ Operations on language :
➢ Let L1 and L2 be two languages over an alphabet Σ. Then the concatenation
of L1 and L2 is denoted by L1L2 and is the language defined as
■ L1L2={ab: a∈L1 and b∈L2}
❖ Examples :
➢ L1={a,ab,c} and L2={λ,b}
■ L1L2={aλ,ab,abλ,abb,cλ,cb}
={a,ab,ab,abb,c,cb}
7
❖ Problem :
8
❖ Regular expression
❖ Regular expression such as ( ),*,U,λ that are used to develop expression for
describing languages are called regular expressions.
❖ Thus the regular expression r over a non -empty alphabet Σ is a word which
attaches the letters of Σ with the help of operation( ),*,U and λ.
9
❖ Examples
❖ Each letter a∈Σ is a regular expression.
❖ Empty word λ and empty expression Φ are regular expression.
❖ If r is a regular expression then it's closure expression r* is an regular
expression.
❖ If r1,r2 are regular expression then r1+r2 is a regular expression.
10
❖ Regular language
❖ The language L(r) represented by the regular expression r over an alphabet Σ
is as follows;
(1).If r =Φ then L(r)=Φ
(2).If r=λ then L(λ)={λ} and L(())=ф empty set
(3).If r=a for some a ∈ Σthen L(a)={a}
(4).L(r*)=(L(r))* the kleene closure of L(r)
(5).L(r1 v r2)= L(r1)UL(r2) union of two languages.
11
GRAMMAR
❖ Grammar Definition
❖ A phrase structure grammar or simply a grammar G consists of four parts;
1. V
2.𝛴
3. S
4.P
12
❖ V,Σ,S,P Definition
❖ V is a finite set,where elements are called variables.
❖ 𝛴 is a finite subset of V whose elements are called terminals.
❖ vn𝛴=ф
❖ S is special variable(non terminal symbol) in the set V called the start symbol
that begins the generation of any sentence in the language.
❖ P is a finite set of whose elements are ordered pair (𝝰,𝜷) usually written as 𝜶
⇾𝜷 where 𝝰 and𝛃 are string(word) on VUΣ and has at least one non-terminal
on its left side elements of P are called productions or production rule.
❖ The grammar denoted by G=(v,Σ,s,p)
13
❖ Language of grammar G
❖ Definition
❖ Let G=(V,Σ,S,P) be a grammar then the language L(G)generated by G is the set
of all strings of terminals which are derivable from the starting state S. That is
➢ L(G)={w ∈ Σ*,s*⇒w}
❖ The elements of L(G) are usually called sentences.
14
problem (1)
1. Find the language L(G) generated by the grammar with v={S,A,B},𝛴={a,b} and
production p ={s→aB, B→b, B→bA , A→a,B}.
Solution;
S→aB
→a bA
→abaB
→ababA
→ababaB
→ababab
L(G)={(ab)n=ababab…….ab:nƐN}.
15
Problem(2)
Find the language L(G) generated by the grammar with V={s,a},Σ={a,b,c}
and production p={S→asb,aS→Aa,Aab→c}.
Solution; S →asb
S→asb S→a asb b
S→a asb b S→aa asb bb
S→a Aabb S→aa Aa bbb
S→acb S→aa c bb
L(G)={an c bn : n≥1}
16
TYPES OF
GRAMMAR
❖ TYPES OF GRAMMAR
➢ Type 0 (OR) Phrase Structure Grammar
➢ Type 1 (OR) Context sensitive Grammar
➢ Type 2 (OR) Context Free Grammar
➢ Type 3 (OR) Regular Grammar
17
❖ Type 0 (or) Phase Structure Grammar
➢ A Grammar G with no restriction on its productions is called A Type 0
Grammar
18
❖ Type 1 (or)Context Sensitive Grammar
➢ A Grammar G said to be of type 1 if every production is of the form
∝→ß where 丨∝丨≤丨β丨or of the form ∝→λ.
➢ Here λ is the null string and ∝ , β are arbitrary string on v.
19
❖ Type 2 (or)Context Free Grammar
➢ A Grammar G is said to be of type 2 if every production is of the form
A→β.
➢ Where the left hand side string is always a single non terminal symbol.
20
❖ Type 3 (or) Regular Grammar
➢ A Grammar G is said to be of type 3 if every production is of the form
A→∝ (or) A→aB.
➢ Where the left hand side string is always a single non terminal symbol and
the right hand side string is either terminal symbol (or) a terminal symbol
Followed by a non-terminal symbol or of the form S→λ.
21
Problems:
1) Determine the type of grammar G in the following:
a)p = { S→aA, A→aAB, B→b , A→a }
b)p = { S→ b, S→aA, A→b , A→bB, A→aA, B→a, B→aB }
c)p = { S→aAB, AB→a, A→b, B→AB }
d)p = { s→b, S→aA, A→b, A→aA, A→bB, B→a, B→aB }
Soln:
a)Type 2 (OR) Context Free Grammar.
b) Type 3 (OR) Regular Grammar.
c) Type 0 (OR) Phrase Structure Grammar.
d) Type 1 (OR) Context sensitive Grammar.
22
Finite state machine
❖ Finite state machine
❖ A finite state machine M consists of six parts:
➢ Σ, finite set of input alphabet symbols ai(i=1,2...n) with or without subscripts
are input symbols.
➢ S,a finite set of internal state. The state S₀ is the initial state,
➢ O is a finite set of the output alphabet that is O={x,y,z}.
➢ f,a transition (or next state)function or mapping from s *Σ into S. that is f:s
*Σ→S
➢ g,a output function from S *Σ into O. that is g:S *Σ→0
➢ Such a machine is written as
■ M={Σ,S,S₀ ,o,f,g}
23
❖ The Features of Finite State machine
● At any given time,the machine can be only one of finite number of states.This
States are called the internal States of the machine.
● The machine accepts as input Only a finite number of symbols the finite set
of all possible inputs constitute the input alphabet for the machine.
● An output and a next state are determined by each combination of Inputs and
internal states.The finite set of all possible outputs constitute the output
alphabet for the machine.
● We assume that the machine has an internal clock,an the sequential
processing are synchronised by separate and distinct clock pulses.
24
❖ State Table and State Diagram of a Finite State
machine:
❖ A Finite state machine M can be represented in compact form by means of
➢ A state-table also called transition table of M
➢ A labelled directed graph called the state diagram or transition diagram of M.
➢ The state table combines the state function ‘f’ and the output function ‘g’ for
all pairs of state and inputs
➢ The first column of the table list the (present )state for the machine .
➢ Entries in the second row are the elements of the input alphabet Σ listed
once under f and then again under g.
➢ The six numbers in the last two columns (and last three rows)are elements of
the output alphabets O.
25
❖ State transition table and state diagram
26
❖ Problem(1)
Let m be the finite state machine with state Table Given the following page.
❖ Find the input set Σ ,the state set S,the output set O and the initial state of M.
❖ Draw the state diagram of M.
❖ Find the output string of the input string 01001.
27
❖ Solution
❖ (A).Input set Σ ={0,1}
State set s ={S0,S1,S2,S3}
Output set 0={0,1}
Initial state=S0
28
Finite state automata
❖ Finite state automata:
❖ ite state automaton is a special type of finite state machine in which there is
no output , and some of its states are distinguished as accepting states.
❖ There are two types of automatiA finon
Deterministic finite state automation
Non-deterministic finite state automation
29
❖ Deterministic Finite State Automaton (DFA)
❖ A deterministic finite state automaton or simply an automaton M consists of five
parts:
➢ A finite non empty set 𝚺 of inputs, called alphabets
➢ A finite non empty set s of (internal) state.
➢ A next state function ( also called transition function) f from s* 𝚺 into s .
This function or mapping describes the change of states during the
transition. It is usually represented by a state transition table or a state
transition diagram.
➢ A subset F of set S of accepting (final) states.
➢ An initial state s₀𝟄S. Such a finite state automaton is denoted by M=( 𝚺,S,S𝜊
,f).
30
❖ State Transition Diagram
❖ A typical state transition diagram is shown. This diagram is a finite directed
labelled graph so that
➢ Each vertex (node) represents a state,
➢ The directed edges are represented by arrows and indicate the transition
from state si to state sj.The final state is represented by double circle.
➢ The initial state s₀ is represented by a circle with an arrow pointing towards
31
❖ Definition
❖ A string w is said to be accepting by a finite automaton M provided.
➢ There exists a path which originates from some initial state ,goes along the
arrows and terminates at some final state ,and
➢ The path value obtained by concatenation of all edge labels of the path is
equal to w
❖ Trap state
➢ A state from which a dfa can never come out is called a trap state.
32
❖ problem:
❖ Consider the transition diagram shown
(a) Find its state
(b) Find its input symbols
(c) Find its initial state
(d) Find its accepting states
(e) Find f(s2,1)
(f) Write its next state table
33
❖ Solution
(a) State S={s𝜊,s1,s2,s3}
(b) Input symbol 𝚺={0,1}
(c) Initial state=s𝜊
(d) Accepting states=S𝜊
(e) f(s2,1)=s3
(f) Next state table
-------------------------------------------
State f(input)
0 1
S𝜊 S2 S1
S1 S3 S𝜊
S2 S𝜊 S3
S3 S1 S2
34
❖ Non Deterministic Finite State Automaton
❖ A non-deterministic finite state automaton (nfa) allows zero,one or more
transitions from a state on the same input symbol.
❖ A non-deterministic finite state automaton m consists of five parts:
➢ A finite non empty set 𝚺 of input symbols.
➢ A finite non empty set s of state.
➢ A next state function ( or mapping) f from s* 𝚺 into p(s) , which is the power
set of S. that is the set of all subsets of S which are v equal to 2 power s
➢ A subset F of set S of accepting (final) states.
➢ An initial state s₀𝟄S. Such a finite state automaton is denoted by M=( 𝚺,S,S𝜊
,f).
35
❖ problem
❖ For a non deterministic finite state automaton shown..find
(a) Initial state
(b) State set
(c) Input set
(d) State table defining the next state function
❖ solution:
(a) Initial state=S𝜊
(b) State set={S𝜊,S1,S2}
(c) Input set ={0,1}
(d) Next state func
State f
S𝜊 {S1,S2} ф
S1 ф {S𝜊,S2}
S2 ф S𝜊
36
language , grammar and automata

More Related Content

What's hot

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)Mohammad Ilyas Malik
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal languageRabia Khalid
 
context free language
context free languagecontext free language
context free languagekhush_boo31
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automatahafizhamza0322
 
Compiler design syntax analysis
Compiler design syntax analysisCompiler design syntax analysis
Compiler design syntax analysisRicha Sharma
 
Context free languages
Context free languagesContext free languages
Context free languagesJahurul Islam
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computationBipul Roy Bpl
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languagesparmeet834
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture NotesFellowBuddy.com
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite AutomataAdel Al-Ofairi
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free GrammarsMarina Santini
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysisSoujanya V
 

What's hot (20)

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)
 
Theory of automata and formal language
Theory of automata and formal languageTheory of automata and formal language
Theory of automata and formal language
 
context free language
context free languagecontext free language
context free language
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 
Pumping lemma Theory Of Automata
Pumping lemma Theory Of AutomataPumping lemma Theory Of Automata
Pumping lemma Theory Of Automata
 
Compiler design syntax analysis
Compiler design syntax analysisCompiler design syntax analysis
Compiler design syntax analysis
 
Context free languages
Context free languagesContext free languages
Context free languages
 
Chomsky Hierarchy.ppt
Chomsky Hierarchy.pptChomsky Hierarchy.ppt
Chomsky Hierarchy.ppt
 
Regular expressions-Theory of computation
Regular expressions-Theory of computationRegular expressions-Theory of computation
Regular expressions-Theory of computation
 
Regular Languages
Regular LanguagesRegular Languages
Regular Languages
 
Top down parsing
Top down parsingTop down parsing
Top down parsing
 
Theory of Computation Lecture Notes
Theory of Computation Lecture NotesTheory of Computation Lecture Notes
Theory of Computation Lecture Notes
 
Finite automata
Finite automataFinite automata
Finite automata
 
Types of Parser
Types of ParserTypes of Parser
Types of Parser
 
Nondeterministic Finite Automata
Nondeterministic Finite AutomataNondeterministic Finite Automata
Nondeterministic Finite Automata
 
Lecture: Context-Free Grammars
Lecture: Context-Free GrammarsLecture: Context-Free Grammars
Lecture: Context-Free Grammars
 
Python programming : Standard Input and Output
Python programming : Standard Input and OutputPython programming : Standard Input and Output
Python programming : Standard Input and Output
 
Asymptotic analysis
Asymptotic analysisAsymptotic analysis
Asymptotic analysis
 
Lecture: Automata
Lecture: AutomataLecture: Automata
Lecture: Automata
 
pushdown automata
pushdown automatapushdown automata
pushdown automata
 

Similar to language , grammar and automata

RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRaviAr5
 
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 1Srimatre K
 
Automata
AutomataAutomata
AutomataGaditek
 
Automata
AutomataAutomata
AutomataGaditek
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfdawod yimer
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghggggggggggggggggggggggggggggggggggadugnanegero
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationPrafullMisra
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxRaviAr5
 
@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdf@vtucode.in-module-1-21CS51-5th-semester (1).pdf
@vtucode.in-module-1-21CS51-5th-semester (1).pdfFariyaTasneem1
 
Regular expression
Regular expressionRegular expression
Regular expressionRajon
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introductionNAMRATA BORKAR
 

Similar to language , grammar and automata (20)

5. NFA & DFA.pdf
5. NFA & DFA.pdf5. NFA & DFA.pdf
5. NFA & DFA.pdf
 
RegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptxRegularLanguageProperties [Autosaved].pptx
RegularLanguageProperties [Autosaved].pptx
 
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
 
Automata
AutomataAutomata
Automata
 
Automata
AutomataAutomata
Automata
 
Chapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdfChapter 3 REGULAR EXPRESSION.pdf
Chapter 3 REGULAR EXPRESSION.pdf
 
hghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggghghghghhghghgggggggggggggggggggggggggggggggggg
hghghghhghghgggggggggggggggggggggggggggggggggg
 
Thoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's ClassificationThoery of Computaion and Chomsky's Classification
Thoery of Computaion and Chomsky's Classification
 
Ch02
Ch02Ch02
Ch02
 
Final fa part1
Final fa part1Final fa part1
Final fa part1
 
Lec1.pptx
Lec1.pptxLec1.pptx
Lec1.pptx
 
Automata theory
Automata theoryAutomata theory
Automata theory
 
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
 
QB104541.pdf
QB104541.pdfQB104541.pdf
QB104541.pdf
 
Ch03
Ch03Ch03
Ch03
 
Mod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptxMod 2_RegularExpressions.pptx
Mod 2_RegularExpressions.pptx
 
@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
 
Regular expression
Regular expressionRegular expression
Regular expression
 
Automata theory introduction
Automata theory introductionAutomata theory introduction
Automata theory introduction
 

Recently uploaded

GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]📊 Markus Baersch
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfJohn Sterrett
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts ServiceSapana Sha
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDRafezzaman
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxFurkanTasci3
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAbdelrhman abooda
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...ThinkInnovation
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceSapana Sha
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptSonatrach
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort servicejennyeacort
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Sapana Sha
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024thyngster
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home ServiceSapana Sha
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)jennyeacort
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfgstagge
 

Recently uploaded (20)

GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]GA4 Without Cookies [Measure Camp AMS]
GA4 Without Cookies [Measure Camp AMS]
 
DBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdfDBA Basics: Getting Started with Performance Tuning.pdf
DBA Basics: Getting Started with Performance Tuning.pdf
 
Call Girls In Mahipalpur O9654467111 Escorts Service
Call Girls In Mahipalpur O9654467111  Escorts ServiceCall Girls In Mahipalpur O9654467111  Escorts Service
Call Girls In Mahipalpur O9654467111 Escorts Service
 
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTDINTERNSHIP ON PURBASHA COMPOSITE TEX LTD
INTERNSHIP ON PURBASHA COMPOSITE TEX LTD
 
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
Deep Generative Learning for All - The Gen AI Hype (Spring 2024)
 
Data Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptxData Science Jobs and Salaries Analysis.pptx
Data Science Jobs and Salaries Analysis.pptx
 
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptxAmazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
Amazon TQM (2) Amazon TQM (2)Amazon TQM (2).pptx
 
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
Predictive Analysis - Using Insight-informed Data to Determine Factors Drivin...
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Call Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts ServiceCall Girls In Dwarka 9654467111 Escorts Service
Call Girls In Dwarka 9654467111 Escorts Service
 
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.pptdokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
dokumen.tips_chapter-4-transient-heat-conduction-mehmet-kanoglu.ppt
 
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
9711147426✨Call In girls Gurgaon Sector 31. SCO 25 escort service
 
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
Saket, (-DELHI )+91-9654467111-(=)CHEAP Call Girls in Escorts Service Saket C...
 
Call Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort ServiceCall Girls in Saket 99530🔝 56974 Escort Service
Call Girls in Saket 99530🔝 56974 Escort Service
 
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
Consent & Privacy Signals on Google *Pixels* - MeasureCamp Amsterdam 2024
 
9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service9654467111 Call Girls In Munirka Hotel And Home Service
9654467111 Call Girls In Munirka Hotel And Home Service
 
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
꧁❤ Aerocity Call Girls Service Aerocity Delhi ❤꧂ 9999965857 ☎️ Hard And Sexy ...
 
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
Call Us ➥97111√47426🤳Call Girls in Aerocity (Delhi NCR)
 
RadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdfRadioAdProWritingCinderellabyButleri.pdf
RadioAdProWritingCinderellabyButleri.pdf
 

language , grammar and automata

  • 1. LANGUAGE , GRAMMAR & AUTOMATA Presentation by Elakkiya.S, Santhosh.B, Balamurugan.A,
  • 2. ❖ Outline of the presentation ❖ Language ➢ Concatenation ➢ Properties of concatenation ➢ Regular expression ➢ Regular language ❖ Grammar ➢ Types of grammar ❖ Finite state machine ❖ Automata ➢ Automata and its types. Maths- seminar presentation- 07.06.2021 1
  • 4. ❖ Language: ❖ Definition: ➢ An alphabet is a non-empty finite set Σ of symbols. ➢ A string or word on the set Σ is a finite sequence of its elements (symbols) ■ If Σ ={a,b} then the sequences u=abba and v=aabbb of letters are strings of Σ. ➢ The length of a string u is denoted by 丨u丨is the number of symbols in the string ■ If Σ={0,1,2} then u=01 v=212 and w=01212 are possible strings on A. the length of these strings is 丨u丨=2 丨v丨=3 丨w丨=5 ➢ The string consisting of no symbols or letters taken from an alphabet Σ, we define Σ⁰={λ}. 2
  • 5. ❖ Operations on strings ❖ The basic operations for strings is concatenation operations. ❖ The concatenation of strings is a string formed by writing the letters (symbols) of first string followed by letters of second string ❖ Example : ➢ If u =ice and v= cream are the two strings of length 3 and 5 respectively.Then concatenation of u and v is uv=ice cream is the string of length 3+5=8. 3
  • 6. ❖Properties of concatenation ❖ If Σ is an alphabet and n is a non-negative integer then the power of ∑ is defined recursively as ➢ ∑1= ∑ and ➢ ∑n+1 = { ab:a∈A and b∈ ∑n} ❖ The concatenation Operation on an alphabet ∑ is associative , since for every u,v,w ∈ ∑* ... We have u(vw)=(uv)w. ❖ The concatenation operation is not commutative (unless丨 ∑ 丨=1)on an alphabet ∑ , since uv≠ vu for every u,v ∈ ∑* . 4
  • 7. ❖ The empty string λ is an identity element for concatenation operation on an alphabet Σ that is λu=uλ=u for every u ∈ Σ* ❖ If u,v ∈ Σ* then we may write u=u1,u2,..........um and v=v1,V2,......vn. For m,n and u1,u2,...um;v1,v2..vn two string u,v are said equal. ❖ For every u,v,w ∈ ∑* we have ➢ wu= wv →u=v ( left cancellation) ➢ uw =vw →u=v ( right cancellation) ❖ For u, v ∈∑* we have ➢ │uv│= │u│+│v│ 5
  • 8. ❖ Language ❖ Definition: ➢ For a given alphabet Σ , any subset of Σ* is called a language over Σ and is denoted by L. ➢ The subset Ф also called empty language. ➢ A string in a language L is called a sentence of Σ. 6
  • 9. ❖ Operations on languages ❖ Operations on language : ➢ Let L1 and L2 be two languages over an alphabet Σ. Then the concatenation of L1 and L2 is denoted by L1L2 and is the language defined as ■ L1L2={ab: a∈L1 and b∈L2} ❖ Examples : ➢ L1={a,ab,c} and L2={λ,b} ■ L1L2={aλ,ab,abλ,abb,cλ,cb} ={a,ab,ab,abb,c,cb} 7
  • 11. ❖ Regular expression ❖ Regular expression such as ( ),*,U,λ that are used to develop expression for describing languages are called regular expressions. ❖ Thus the regular expression r over a non -empty alphabet Σ is a word which attaches the letters of Σ with the help of operation( ),*,U and λ. 9
  • 12. ❖ Examples ❖ Each letter a∈Σ is a regular expression. ❖ Empty word λ and empty expression Φ are regular expression. ❖ If r is a regular expression then it's closure expression r* is an regular expression. ❖ If r1,r2 are regular expression then r1+r2 is a regular expression. 10
  • 13. ❖ Regular language ❖ The language L(r) represented by the regular expression r over an alphabet Σ is as follows; (1).If r =Φ then L(r)=Φ (2).If r=λ then L(λ)={λ} and L(())=ф empty set (3).If r=a for some a ∈ Σthen L(a)={a} (4).L(r*)=(L(r))* the kleene closure of L(r) (5).L(r1 v r2)= L(r1)UL(r2) union of two languages. 11
  • 15. ❖ Grammar Definition ❖ A phrase structure grammar or simply a grammar G consists of four parts; 1. V 2.𝛴 3. S 4.P 12
  • 16. ❖ V,Σ,S,P Definition ❖ V is a finite set,where elements are called variables. ❖ 𝛴 is a finite subset of V whose elements are called terminals. ❖ vn𝛴=ф ❖ S is special variable(non terminal symbol) in the set V called the start symbol that begins the generation of any sentence in the language. ❖ P is a finite set of whose elements are ordered pair (𝝰,𝜷) usually written as 𝜶 ⇾𝜷 where 𝝰 and𝛃 are string(word) on VUΣ and has at least one non-terminal on its left side elements of P are called productions or production rule. ❖ The grammar denoted by G=(v,Σ,s,p) 13
  • 17. ❖ Language of grammar G ❖ Definition ❖ Let G=(V,Σ,S,P) be a grammar then the language L(G)generated by G is the set of all strings of terminals which are derivable from the starting state S. That is ➢ L(G)={w ∈ Σ*,s*⇒w} ❖ The elements of L(G) are usually called sentences. 14
  • 18. problem (1) 1. Find the language L(G) generated by the grammar with v={S,A,B},𝛴={a,b} and production p ={s→aB, B→b, B→bA , A→a,B}. Solution; S→aB →a bA →abaB →ababA →ababaB →ababab L(G)={(ab)n=ababab…….ab:nƐN}. 15
  • 19. Problem(2) Find the language L(G) generated by the grammar with V={s,a},Σ={a,b,c} and production p={S→asb,aS→Aa,Aab→c}. Solution; S →asb S→asb S→a asb b S→a asb b S→aa asb bb S→a Aabb S→aa Aa bbb S→acb S→aa c bb L(G)={an c bn : n≥1} 16
  • 21. ❖ TYPES OF GRAMMAR ➢ Type 0 (OR) Phrase Structure Grammar ➢ Type 1 (OR) Context sensitive Grammar ➢ Type 2 (OR) Context Free Grammar ➢ Type 3 (OR) Regular Grammar 17
  • 22. ❖ Type 0 (or) Phase Structure Grammar ➢ A Grammar G with no restriction on its productions is called A Type 0 Grammar 18
  • 23. ❖ Type 1 (or)Context Sensitive Grammar ➢ A Grammar G said to be of type 1 if every production is of the form ∝→ß where 丨∝丨≤丨β丨or of the form ∝→λ. ➢ Here λ is the null string and ∝ , β are arbitrary string on v. 19
  • 24. ❖ Type 2 (or)Context Free Grammar ➢ A Grammar G is said to be of type 2 if every production is of the form A→β. ➢ Where the left hand side string is always a single non terminal symbol. 20
  • 25. ❖ Type 3 (or) Regular Grammar ➢ A Grammar G is said to be of type 3 if every production is of the form A→∝ (or) A→aB. ➢ Where the left hand side string is always a single non terminal symbol and the right hand side string is either terminal symbol (or) a terminal symbol Followed by a non-terminal symbol or of the form S→λ. 21
  • 26. Problems: 1) Determine the type of grammar G in the following: a)p = { S→aA, A→aAB, B→b , A→a } b)p = { S→ b, S→aA, A→b , A→bB, A→aA, B→a, B→aB } c)p = { S→aAB, AB→a, A→b, B→AB } d)p = { s→b, S→aA, A→b, A→aA, A→bB, B→a, B→aB } Soln: a)Type 2 (OR) Context Free Grammar. b) Type 3 (OR) Regular Grammar. c) Type 0 (OR) Phrase Structure Grammar. d) Type 1 (OR) Context sensitive Grammar. 22
  • 28. ❖ Finite state machine ❖ A finite state machine M consists of six parts: ➢ Σ, finite set of input alphabet symbols ai(i=1,2...n) with or without subscripts are input symbols. ➢ S,a finite set of internal state. The state S₀ is the initial state, ➢ O is a finite set of the output alphabet that is O={x,y,z}. ➢ f,a transition (or next state)function or mapping from s *Σ into S. that is f:s *Σ→S ➢ g,a output function from S *Σ into O. that is g:S *Σ→0 ➢ Such a machine is written as ■ M={Σ,S,S₀ ,o,f,g} 23
  • 29. ❖ The Features of Finite State machine ● At any given time,the machine can be only one of finite number of states.This States are called the internal States of the machine. ● The machine accepts as input Only a finite number of symbols the finite set of all possible inputs constitute the input alphabet for the machine. ● An output and a next state are determined by each combination of Inputs and internal states.The finite set of all possible outputs constitute the output alphabet for the machine. ● We assume that the machine has an internal clock,an the sequential processing are synchronised by separate and distinct clock pulses. 24
  • 30. ❖ State Table and State Diagram of a Finite State machine: ❖ A Finite state machine M can be represented in compact form by means of ➢ A state-table also called transition table of M ➢ A labelled directed graph called the state diagram or transition diagram of M. ➢ The state table combines the state function ‘f’ and the output function ‘g’ for all pairs of state and inputs ➢ The first column of the table list the (present )state for the machine . ➢ Entries in the second row are the elements of the input alphabet Σ listed once under f and then again under g. ➢ The six numbers in the last two columns (and last three rows)are elements of the output alphabets O. 25
  • 31. ❖ State transition table and state diagram 26
  • 32. ❖ Problem(1) Let m be the finite state machine with state Table Given the following page. ❖ Find the input set Σ ,the state set S,the output set O and the initial state of M. ❖ Draw the state diagram of M. ❖ Find the output string of the input string 01001. 27
  • 33. ❖ Solution ❖ (A).Input set Σ ={0,1} State set s ={S0,S1,S2,S3} Output set 0={0,1} Initial state=S0 28
  • 35. ❖ Finite state automata: ❖ ite state automaton is a special type of finite state machine in which there is no output , and some of its states are distinguished as accepting states. ❖ There are two types of automatiA finon Deterministic finite state automation Non-deterministic finite state automation 29
  • 36. ❖ Deterministic Finite State Automaton (DFA) ❖ A deterministic finite state automaton or simply an automaton M consists of five parts: ➢ A finite non empty set 𝚺 of inputs, called alphabets ➢ A finite non empty set s of (internal) state. ➢ A next state function ( also called transition function) f from s* 𝚺 into s . This function or mapping describes the change of states during the transition. It is usually represented by a state transition table or a state transition diagram. ➢ A subset F of set S of accepting (final) states. ➢ An initial state s₀𝟄S. Such a finite state automaton is denoted by M=( 𝚺,S,S𝜊 ,f). 30
  • 37. ❖ State Transition Diagram ❖ A typical state transition diagram is shown. This diagram is a finite directed labelled graph so that ➢ Each vertex (node) represents a state, ➢ The directed edges are represented by arrows and indicate the transition from state si to state sj.The final state is represented by double circle. ➢ The initial state s₀ is represented by a circle with an arrow pointing towards 31
  • 38. ❖ Definition ❖ A string w is said to be accepting by a finite automaton M provided. ➢ There exists a path which originates from some initial state ,goes along the arrows and terminates at some final state ,and ➢ The path value obtained by concatenation of all edge labels of the path is equal to w ❖ Trap state ➢ A state from which a dfa can never come out is called a trap state. 32
  • 39. ❖ problem: ❖ Consider the transition diagram shown (a) Find its state (b) Find its input symbols (c) Find its initial state (d) Find its accepting states (e) Find f(s2,1) (f) Write its next state table 33
  • 40. ❖ Solution (a) State S={s𝜊,s1,s2,s3} (b) Input symbol 𝚺={0,1} (c) Initial state=s𝜊 (d) Accepting states=S𝜊 (e) f(s2,1)=s3 (f) Next state table ------------------------------------------- State f(input) 0 1 S𝜊 S2 S1 S1 S3 S𝜊 S2 S𝜊 S3 S3 S1 S2 34
  • 41. ❖ Non Deterministic Finite State Automaton ❖ A non-deterministic finite state automaton (nfa) allows zero,one or more transitions from a state on the same input symbol. ❖ A non-deterministic finite state automaton m consists of five parts: ➢ A finite non empty set 𝚺 of input symbols. ➢ A finite non empty set s of state. ➢ A next state function ( or mapping) f from s* 𝚺 into p(s) , which is the power set of S. that is the set of all subsets of S which are v equal to 2 power s ➢ A subset F of set S of accepting (final) states. ➢ An initial state s₀𝟄S. Such a finite state automaton is denoted by M=( 𝚺,S,S𝜊 ,f). 35
  • 42. ❖ problem ❖ For a non deterministic finite state automaton shown..find (a) Initial state (b) State set (c) Input set (d) State table defining the next state function ❖ solution: (a) Initial state=S𝜊 (b) State set={S𝜊,S1,S2} (c) Input set ={0,1} (d) Next state func State f S𝜊 {S1,S2} ф S1 ф {S𝜊,S2} S2 ф S𝜊 36