CSC312
Automata Theory
Lecture # 2
Languages
2
Alphabet: An alphabet is a finite set of symbols, usually
letters, digits, and punctuations.
Valid/In-valid alphabets: An alphabet may contain
letters consisting of group of symbols for example Σ=
{a, ba, bab, d}.
Remarks: While defining an alphabet of letters
consisting of more than one symbols, no letter should
be started with the letter of the same alphabet i.e.
one letter should not be the prefix of another.
However, a letter may be ended in a letter of same
alphabet.
Valid alphabet :
Invalid alphabet :
 
, ,
a ba c
 
Alphabet and Strings
 
, ,
a ab c
 
3
String or word: A finite sequence of
letters/alphabets
Examples: “cat”, “dog”, “house”, “read” …
Defined over an alphabet:
Language: A language is a set of
strings constructed from some
alphabet e.g. Urdu, English, Java, the
set of all binary strings
 
z
c
b
a ,
,
,
, 


Alphabets and Strings
Sentences are made up of certain
combinations of words.
Not all combinations of words lead to a valid English sentence.
So we see that some basic units are
combined to make bigger units.
Languages
How can you tell whether a given sentence
belongs to a particular languages
Black is cat the
The tea is hot
I like chocolates two much
Rules give a clue to forming as well as
validating sentences.
Formal vs. Informal Rules
Informal language -> abstract languages
Incoherent strings are also
understandable
Slang, idiom, dialect etc.
Raise ambiguity
Interpretation varies with region
I am through (BrE/AmE)
Same words have multiple meanings.
Like, light, base, etc.
Summary of Languages
Three aspects/specifications
Lexical
Defines valid words/units of a language
Syntactic
Defines rules for combining the units to
form valid sentences (computer programs
in context of machines)
Semantic
Concerned with the interpretation or
meaning of a sentence (what output to
produce in context of machines)
Affected by ambiguity the most.
Formal languages
Rules defined explicitly and clearly
No ambiguities
Universally uniform understanding
Lets the machine
Interpret an input uniformly every time. i.e.
always produces same output for a
particular input
Avoid crashes because of ambiguity.
Explicitly and categorically reject invalid
input
Formal Languages
Need uniformly understandable notation
Representations
Alphabet
Represents a finite set of fundamental units
of lanauges, e.g. for English ={a,b,….z.A,…
Z,}
∑ = {0,1}
∑ = {0,1,2,3,4,5,6,7,8,9}
Formal Languages
List of words
Set of all valid words of a given language,
e.g., a language English_Words that
contains all valid words of English would
have a  = {all entries of the dictionary
+ punctuation marks and blank space}
Denoted by 
Is  Finite or Infinite set.
Strings: A string a finite sequence of symbols
chosen from alphabet. For example
0111100 , 123045, abbbcdeg etc.
String Variable: A letter used for
denoting a string. The author uses w, x, y
and z as string variable. For example
w = 0111100 , x = 123045, z = abbbcdeg
Length of String: The number of positions
for symbols in the string. For simplicity
we can say that it is the number of
symbols in the string. For example
|w| = 7 , |x| = ? , |z| = ?
12
Alphabets and Strings
We will use small letters for alphabets:
Strings
abba
w
bbbaaa
v
ab
u



 
b
a,


b
aaabbbaaba
baba
abba
ab
a
13
String Operations
m
n
b
b
b
v
a
a
a
w


2
1
2
1


bbbaaa
abba
m
n b
b
b
a
a
a
wv 
 2
1
2
1

Concatenation
abbabbbaaa
Let we have following strings
Reverse
1
2a
a
a
w n
R

 abba
aaabbb
14
String Length
Length:
Examples:
n
a
a
a
w 
2
1

n
w 
1
2
4



a
aa
abba
15
Length of Concatenation
Example:
v
u
uv 

8
5
3
8
5
,
3
,











v
u
uv
aababaab
uv
v
abaab
v
u
aab
u
16
Empty String
A string with no letters:
Observations:
Note-1: A language that does not
contain any word at all is denoted by
 or { }. This language doesn’t contain
any word not even the NULL string.
i.e. { } ≠ {}
or or
  
0
w w w
abba abba abba

 
 

 
 
17
Empty String
Note-2: Suppose a language L doesn’t
contain NULL then
L = L + 
but L ≠ L + {}.
Important : NULL is identity element
with respect to concatenation.
18
Substring
Substring of string:
a subsequence of consecutive characters
String Substring
bbab
b
abba
ab
abbab
abbab
abbab
abbab
19
Prefix and Suffix
Let the string is
Prefixes Suffixes
abbab
abbab
abba
abb
ab
a


b
ab
bab
bbab
abbab uv
w 
prefix
suffix
20
Repeat Operation
- w repeated n time; that is,
Example:
Definition:

 
 
n
n
w
ww
w 
  abbaabba
abba 
2


0
w
  

0
abba
n
w
21
The * Operation
: the set of all possible strings from
alphabet , called closure of alphabets also known as
Kleene star operator or Kleene star closure.
i.e. infinitely many words each of finite length.
*


 
 

,
,
,
,
,
,
,
,
,
*
,
aab
aaa
bb
ba
ab
aa
b
a
b
a





22
The + Operation
: the set of all possible strings from
alphabet except , also known as Kleene plus operator.
Note : are infinite



 
 

,
,
,
,
,
,
,
,
,
*
,
aab
aaa
bb
ba
ab
aa
b
a
b
a










*
 

,
,
,
,
,
,
,
, aab
aaa
bb
ba
ab
aa
b
a



* and 
 
23
Languages
A language is a set of strings OR
A language is any subset of , usually
denoted by L. It may be finite or infinite.
Example:
Languages:
If a string w is in L, we say that w is a
sentence of L.
*

 
 

,
,
,
,
,
,
,
,
*
,
aaa
bb
ba
ab
aa
b
a
b
a





 
 
}
,
,
,
,
,
{
,
,
aaaaaa
ab
aa
baba
abba
aab
aa
a


24
Note that:
}
{
}
{ 



0
}
{ 


1
}
{ 

0


Sets
Set size
Set size
String length
25
Another Example
An infinite language }
0
:
{ 
 n
b
a
L n
n
aaaaabbbbb
aabb
ab

L
 L
abb
26
Operations on Languages
The usual set operations
Complement:
   
   
     
aaaa
a
ab
bb
aaaa
ab
a
ab
ab
bb
aaaa
ab
a
aaaa
bb
ab
a
ab
bb
aaaa
ab
a
,
,
,
,
}
{
,
,
,
}
,
,
,
{
,
,
,






L
L 

 *
   

,
,
,
,
,
,
, aaa
bb
ab
aa
b
ba
a 

27
Reverse
Definition:
Examples:
Concatenation
Definition:
Examples:
}
:
{ L
w
w
L R
R


   
abab
baa
ba
baba
aab
ab R
,
,
,
, 
{ : 0}
{ : 0}
n n
R n n
L a b n
L b a n
 
 
 
2
1
2
1 ,
: L
y
L
x
xy
L
L 


  
 
, , ,
, , , , ,
a ab ba b aa
ab aaa abb abaa bab baaa

28
Repeat Operation
Definition:
L concatenated with itself n times.
Special case:


 
n
n
L
LL
L 
     
 
bbb
bba
bab
baa
abb
aba
aab
aaa
b
a
b
a
b
a
b
a
,
,
,
,
,
,
,
,
,
,
, 3


 
   
0
0
, ,
L
a bba aaa




29
More Examples
}
0
:
{ 
 n
b
a
L n
n
}
0
,
:
{
2

 m
n
b
a
b
a
L m
m
n
n
2
L
aabbaaabbb
30
Star-Closure (Kleene *)
Definition:
Example:


 2
1
0
* L
L
L
L 
 
















,
,
,
,
,
,
,
,
,
,
,
*
,
abbbb
abba
aabb
aaa
bbbb
bba
abb
aa
bb
a
bb
a

31
Positive Closure
Definition:
Note: L+
includes  if and only if L includes 
 





*
2
1
L
L
L
L 


 













,
,
,
,
,
,
,
,
,
,
,
abbbb
abba
aabb
aaa
bbbb
bba
abb
aa
bb
a
bb
a
32
Lexicographical Order
Assume that the symbols in are
themselves ordered.
Definition: A set of strings is in
lexicographical order if
-The strings are grouped first according to
their length.
-Then, within each group, the strings are
ordered “alphabetically” according to the
ordering of the symbols.

Ex: Let the alphabet be
The set of all strings in Lexicographical
order is
, a, b, aa, ab, ba, bb, aaa, …., bbb, aaaa, …,
bbbb, ….
33
Lexicographical Order
{ , }
a b
 

More Related Content

PDF
Theory of Automata ___ Basis ...........
PPT
Lecture 3,4
PPT
Lecture 3,4
PPT
Lesson 01.ppt
PDF
Language
PPT
Introducton to computer theory/theory of automata.pptx
ODP
Final formal languages
PPTX
theory of computation lecture 02
Theory of Automata ___ Basis ...........
Lecture 3,4
Lecture 3,4
Lesson 01.ppt
Language
Introducton to computer theory/theory of automata.pptx
Final formal languages
theory of computation lecture 02

Similar to Lec-02 Languages for finite automata FA (20)

PPTX
L_2_apl.pptx
PDF
01-Introduction&Languages.pdf
PPT
Lesson 01 for Computer Science Data Analysis
PPTX
Computational Theory Lecture 1 Theory of Automata.pptx
PPT
Theory of Automata Lesson 01
PPT
Theory of Automata - Power Point Slides Lecture 01).ppt
PPT
Theory of Automata
PPT
Lesson-01-29092022-081117pm.ppt
PPT
Lecture 1,2
PPTX
Ch2 automata.pptx
PPTX
Theory of automata and formal language
PPT
Chapter # 1.ppt cs field using machine management
PPT
Lesson 01.ppt theory of automata including basics of it
PPT
10651372.ppt
PPTX
Automata definitions
PDF
Handout Regular expression with examples and lecture
PPTX
Regular Expression in Compiler design
PPT
Lesson 02.ppt theory of automata including basics of it
PPTX
Mod 2_RegularExpressions.pptx
PPT
Theory of Automata Lesson 02
L_2_apl.pptx
01-Introduction&Languages.pdf
Lesson 01 for Computer Science Data Analysis
Computational Theory Lecture 1 Theory of Automata.pptx
Theory of Automata Lesson 01
Theory of Automata - Power Point Slides Lecture 01).ppt
Theory of Automata
Lesson-01-29092022-081117pm.ppt
Lecture 1,2
Ch2 automata.pptx
Theory of automata and formal language
Chapter # 1.ppt cs field using machine management
Lesson 01.ppt theory of automata including basics of it
10651372.ppt
Automata definitions
Handout Regular expression with examples and lecture
Regular Expression in Compiler design
Lesson 02.ppt theory of automata including basics of it
Mod 2_RegularExpressions.pptx
Theory of Automata Lesson 02
Ad

Recently uploaded (20)

PDF
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
PPTX
Chapter-4-Rizal-Higher-Education-1-2_081545.pptx
PPTX
MMW-CHAPTER-1-final.pptx major Elementary Education
PDF
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
DOCX
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
PPTX
Neurological complocations of systemic disease
PDF
African Communication Research: A review
PPTX
Single Visit Endodontics.pptx treatment in one visit
PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PDF
Developing speaking skill_learning_mater.pdf
PDF
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
PDF
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
PPTX
INTRODUCTION TO PHILOSOPHY FULL SEM - COMPLETE.pptxINTRODUCTION TO PHILOSOPHY...
PPTX
Diploma pharmaceutics notes..helps diploma students
PPTX
CHROMIUM & Glucose Tolerance Factor.pptx
PPTX
Neurology of Systemic disease all systems
PDF
Review of Related Literature & Studies.pdf
PDF
IS1343_2012...........................pdf
PPTX
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
Kalaari-SaaS-Founder-Playbook-2024-Edition-.pdf
Chapter-4-Rizal-Higher-Education-1-2_081545.pptx
MMW-CHAPTER-1-final.pptx major Elementary Education
Jana Ojana 2025 Prelims - School Quiz by Pragya - UEMK Quiz Club
HELMET DETECTION AND BIOMETRIC BASED VEHICLESECURITY USING MACHINE LEARNING.docx
Neurological complocations of systemic disease
African Communication Research: A review
Single Visit Endodontics.pptx treatment in one visit
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
Developing speaking skill_learning_mater.pdf
V02-Session-4-Leadership-Through-Assessment-MLB.pdf
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
INTRODUCTION TO PHILOSOPHY FULL SEM - COMPLETE.pptxINTRODUCTION TO PHILOSOPHY...
Diploma pharmaceutics notes..helps diploma students
CHROMIUM & Glucose Tolerance Factor.pptx
Neurology of Systemic disease all systems
Review of Related Literature & Studies.pdf
IS1343_2012...........................pdf
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
Ad

Lec-02 Languages for finite automata FA

  • 2. 2 Alphabet: An alphabet is a finite set of symbols, usually letters, digits, and punctuations. Valid/In-valid alphabets: An alphabet may contain letters consisting of group of symbols for example Σ= {a, ba, bab, d}. Remarks: While defining an alphabet of letters consisting of more than one symbols, no letter should be started with the letter of the same alphabet i.e. one letter should not be the prefix of another. However, a letter may be ended in a letter of same alphabet. Valid alphabet : Invalid alphabet :   , , a ba c   Alphabet and Strings   , , a ab c  
  • 3. 3 String or word: A finite sequence of letters/alphabets Examples: “cat”, “dog”, “house”, “read” … Defined over an alphabet: Language: A language is a set of strings constructed from some alphabet e.g. Urdu, English, Java, the set of all binary strings   z c b a , , , ,    Alphabets and Strings
  • 4. Sentences are made up of certain combinations of words. Not all combinations of words lead to a valid English sentence. So we see that some basic units are combined to make bigger units.
  • 5. Languages How can you tell whether a given sentence belongs to a particular languages Black is cat the The tea is hot I like chocolates two much Rules give a clue to forming as well as validating sentences.
  • 6. Formal vs. Informal Rules Informal language -> abstract languages Incoherent strings are also understandable Slang, idiom, dialect etc. Raise ambiguity Interpretation varies with region I am through (BrE/AmE) Same words have multiple meanings. Like, light, base, etc.
  • 7. Summary of Languages Three aspects/specifications Lexical Defines valid words/units of a language Syntactic Defines rules for combining the units to form valid sentences (computer programs in context of machines) Semantic Concerned with the interpretation or meaning of a sentence (what output to produce in context of machines) Affected by ambiguity the most.
  • 8. Formal languages Rules defined explicitly and clearly No ambiguities Universally uniform understanding Lets the machine Interpret an input uniformly every time. i.e. always produces same output for a particular input Avoid crashes because of ambiguity. Explicitly and categorically reject invalid input
  • 9. Formal Languages Need uniformly understandable notation Representations Alphabet Represents a finite set of fundamental units of lanauges, e.g. for English ={a,b,….z.A,… Z,} ∑ = {0,1} ∑ = {0,1,2,3,4,5,6,7,8,9}
  • 10. Formal Languages List of words Set of all valid words of a given language, e.g., a language English_Words that contains all valid words of English would have a  = {all entries of the dictionary + punctuation marks and blank space} Denoted by  Is  Finite or Infinite set. Strings: A string a finite sequence of symbols chosen from alphabet. For example 0111100 , 123045, abbbcdeg etc.
  • 11. String Variable: A letter used for denoting a string. The author uses w, x, y and z as string variable. For example w = 0111100 , x = 123045, z = abbbcdeg Length of String: The number of positions for symbols in the string. For simplicity we can say that it is the number of symbols in the string. For example |w| = 7 , |x| = ? , |z| = ?
  • 12. 12 Alphabets and Strings We will use small letters for alphabets: Strings abba w bbbaaa v ab u      b a,   b aaabbbaaba baba abba ab a
  • 13. 13 String Operations m n b b b v a a a w   2 1 2 1   bbbaaa abba m n b b b a a a wv   2 1 2 1  Concatenation abbabbbaaa Let we have following strings Reverse 1 2a a a w n R   abba aaabbb
  • 15. 15 Length of Concatenation Example: v u uv   8 5 3 8 5 , 3 ,            v u uv aababaab uv v abaab v u aab u
  • 16. 16 Empty String A string with no letters: Observations: Note-1: A language that does not contain any word at all is denoted by  or { }. This language doesn’t contain any word not even the NULL string. i.e. { } ≠ {} or or    0 w w w abba abba abba          
  • 17. 17 Empty String Note-2: Suppose a language L doesn’t contain NULL then L = L +  but L ≠ L + {}. Important : NULL is identity element with respect to concatenation.
  • 18. 18 Substring Substring of string: a subsequence of consecutive characters String Substring bbab b abba ab abbab abbab abbab abbab
  • 19. 19 Prefix and Suffix Let the string is Prefixes Suffixes abbab abbab abba abb ab a   b ab bab bbab abbab uv w  prefix suffix
  • 20. 20 Repeat Operation - w repeated n time; that is, Example: Definition:      n n w ww w    abbaabba abba  2   0 w     0 abba n w
  • 21. 21 The * Operation : the set of all possible strings from alphabet , called closure of alphabets also known as Kleene star operator or Kleene star closure. i.e. infinitely many words each of finite length. *        , , , , , , , , , * , aab aaa bb ba ab aa b a b a     
  • 22. 22 The + Operation : the set of all possible strings from alphabet except , also known as Kleene plus operator. Note : are infinite         , , , , , , , , , * , aab aaa bb ba ab aa b a b a           *    , , , , , , , , aab aaa bb ba ab aa b a    * and   
  • 23. 23 Languages A language is a set of strings OR A language is any subset of , usually denoted by L. It may be finite or infinite. Example: Languages: If a string w is in L, we say that w is a sentence of L. *       , , , , , , , , * , aaa bb ba ab aa b a b a          } , , , , , { , , aaaaaa ab aa baba abba aab aa a  
  • 24. 24 Note that: } { } {     0 } {    1 } {   0   Sets Set size Set size String length
  • 25. 25 Another Example An infinite language } 0 : {   n b a L n n aaaaabbbbb aabb ab  L  L abb
  • 26. 26 Operations on Languages The usual set operations Complement:               aaaa a ab bb aaaa ab a ab ab bb aaaa ab a aaaa bb ab a ab bb aaaa ab a , , , , } { , , , } , , , { , , ,       L L    *      , , , , , , , aaa bb ab aa b ba a  
  • 27. 27 Reverse Definition: Examples: Concatenation Definition: Examples: } : { L w w L R R       abab baa ba baba aab ab R , , , ,  { : 0} { : 0} n n R n n L a b n L b a n       2 1 2 1 , : L y L x xy L L         , , , , , , , , a ab ba b aa ab aaa abb abaa bab baaa 
  • 28. 28 Repeat Operation Definition: L concatenated with itself n times. Special case:     n n L LL L          bbb bba bab baa abb aba aab aaa b a b a b a b a , , , , , , , , , , , 3         0 0 , , L a bba aaa    
  • 29. 29 More Examples } 0 : {   n b a L n n } 0 , : { 2   m n b a b a L m m n n 2 L aabbaaabbb
  • 30. 30 Star-Closure (Kleene *) Definition: Example:    2 1 0 * L L L L                    , , , , , , , , , , , * , abbbb abba aabb aaa bbbb bba abb aa bb a bb a 
  • 31. 31 Positive Closure Definition: Note: L+ includes  if and only if L includes         * 2 1 L L L L                   , , , , , , , , , , , abbbb abba aabb aaa bbbb bba abb aa bb a bb a
  • 32. 32 Lexicographical Order Assume that the symbols in are themselves ordered. Definition: A set of strings is in lexicographical order if -The strings are grouped first according to their length. -Then, within each group, the strings are ordered “alphabetically” according to the ordering of the symbols. 
  • 33. Ex: Let the alphabet be The set of all strings in Lexicographical order is , a, b, aa, ab, ba, bb, aaa, …., bbb, aaaa, …, bbbb, …. 33 Lexicographical Order { , } a b  