Introduction To Formal Language and Automata Theory
Introduction To Formal Language and Automata Theory
03/14/2021 1
Formal language
Formal languages provide models for both natural languages and programming
languages.
03/14/2021 2
03/14/2021 3
03/14/2021 4
03/14/2021 5
03/14/2021 6
03/14/2021 7
03/14/2021 8
03/14/2021 9
03/14/2021 10
03/14/2021 11
03/14/2021 12
Descriptive Definition of Language:
03/14/2021 13
Example 1
The language L of strings of odd length, defined over Σ={a},
can be written as
L={a, aaa, aaaaa,…..}
Example2
The language L of strings that does not start with a, defined
over Σ={a,b,c}, can be written as
L={b, c, ba, bb, bc, ca, cb, cc, …}
03/14/2021 14
Example 3
The language L of strings of length 2, defined over Σ={0,1,2},
can be written as
L={00, 01, 02,10, 11,12,20,21,22}
Example 4
The language L of strings ending in 0, defined over Σ ={0,1},
can be written as L={0,00,10,000,010,100,110,…}
03/14/2021 15
Example 5
The language EQUAL, of strings with number of a’s equal to
number of b’s, defined over Σ={a,b}, can be written as
{Λ ,ab,aabb,abab,baba,abba,…}
Example 6
The language EVEN-EVEN, of strings with even number of
a’s and even number of b’s, defined over Σ={a,b}, can be
written as
{Λ, aa, bb, aaaa,aabb,abab, abba, baab, baba, bbaa, bbbb,…}
03/14/2021 16
Example 8
The language INTEGER, of strings defined over
Σ={-,0,1,2,3,4,5,6,7,8,9}, can be written as
INTEGER = {…,-2,-1,0,1,2,…}
Example 9
The language EVEN, of stings defined over
Σ={-,0,1,2,3,4,5,6,7,8,9}, can be written as EVEN = { …,-4,-
2,0,2,4,…}
03/14/2021 17
Example 10
The language {anbn}, of strings defined over Σ={a,b}, as {anbn
: n=1,2,3,…}, can be written as
{ab, aabb, aaabbb,aaaabbbb,…}
Example 11
The language {anbn an}, of strings defined over Σ={a,b}, as
{anbn an : n=1,2,3,…}, can be written as
{aba, aabbaa, aaabbbaaa,aaaabbbbaaaa,…
03/14/2021 18
Example 12
The language factorial, of strings defined over
Σ={1,2,3,4,5,6,7,8,9} i.e. {1,2,6,24,120,…}
Example 13
The language FACTORIAL, of strings defined over Σ={a},
as {an! : n=1,2,3,…}, can be written as {a,aa,aaaaaa,…}.
It is to be noted that the language FACTORIAL can be defined
over any single letter alphabet.
03/14/2021 19
Example 14
The language DOUBLE FACTORIAL, of strings defined over
Σ={a, b}, as {an! bn! : n=1,2,3,…}, can be written as
{ab, aabb, aaaaaabbbbbb,…}
Example 15
The language SQUARE, of strings defined over Σ={a}, as
{an2 : n=1,2,3,…}, can be written as
{a, aaaa, aaaaaaaaa,…}
03/14/2021 20
Example 16
The language DOUBLE SQUARE, of strings defined over
Σ={a,b}, as
{an2 bn2 : n=1,2,3,…}, can be written as
{ab, aaaabbbb, aaaaaaaaabbbbbbbbb,…}
03/14/2021 21
PALINDROME
The language consisting of Λ and the strings s defined over Σ such that
Rev(s)=s.
It is to be denoted that the words of PALINDROME are called
palindromes.
Example 17
For Σ={a,b} PALINDROME={Λ , a, b, aa, bb, aaa, aba, bab, bbb, ...}
03/14/2021 22
03/14/2021 23
03/14/2021 24
03/14/2021 25
03/14/2021 26
03/14/2021 27
03/14/2021 28
03/14/2021 29
03/14/2021 30
03/14/2021 31
One
t er-
ha p
Of C
End
03/14/2021 32