Theory of Automata Handouts 1
Theory of Automata Handouts 1
Theory of Automata Handouts 1
&
Formal Languages
Handouts 01
Department of Information Technology
Hazara University, Mansehra
What does automata mean?
“Finite” refer to the finite number of” state(s)” (a condition at particular time) in the automata. For e.g
spinner of the washing machine(consider it as automata) can be in any three states(represented by
circle) at particular time. i.e. fast spin, medium spin, slow spin. A transition(represented by arrow) from
one state to another can be triggered through a spin button. This can be represented as following.
Introduction to languages
There are two types of languages
• Formal Languages (Syntactic languages)
• Informal Languages (Semantic languages)
Alphabets
Definition
A finite non-empty set of symbols (called letters), is called an alphabet. It is denoted by Σ ( Greek letter
sigma).
Example
Σ = {a,b}
Σ = {i,j,k}
Note Certain version of language ALGOL has 113 letters.
Σ (alphabet) includes letters, digits and a variety of operators including sequential operators such as
GOTO and IF
2
Strings
Definition
Concatenation of finite number of letters from the alphabet is called a string.
Example
If Σ = {a,b} then
a, abab, aaabb, ababababababababab
Note
Empty string or null string: Sometimes a string with no symbol at all is used, denoted by (Small Greek
letter Lambda) λ or (Capital Greek letter Lambda) Λ, is called an empty string or null string.
The capital lambda will mostly be used to denote the empty string, in further discussion.
Words
Definition
Words are strings belonging to some language.
Example
If Σ= {x} then a language L can be defined as
Σ = {a, b}.
As when this string is scanned by the compiler (Lexical Analyzer), first symbol B is identified as a letter
belonging to Σ, while for the second letter the lexical analyzer would not be able to identify, so while
defining an alphabet it should be kept in mind that ambiguity should not be created.
3
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.
Conclusion
Σ1= {B, aB, bab, d}
Length of Strings
Definition
The length of string s, denoted by |s|, is the number of letters in the string.
Example
Σ={a,b}
s=ababa
|s|=5
Example
Σ= {B, aB, bab, d}
s=BaBbabBd
Tokenizing=(B), (aB), (bab), (B), (d)
|s|=5
Reverse of a String
Definition
The reverse of a string s denoted by Rev(s) or sr, is obtained by writing the letters of s in reverse order.
Example