Theory of Computation,
Alphabet, Strings, Formal
Languages
Finite Automata Theory & Formal
Languages
04/26/2025 Automata Theory & Languages 1
Theory of Computation
04/26/2025 Automata Theory & Languages 2
Computation
Computation
– to write and run a program
– carried out by executing programs
Program
– expresses an algorithm
Algorithm
– a descriptive, step by step process for carrying out
input to output transformation
04/26/2025 Automata Theory & Languages 3
Theory of Computation
• Theory of computation is the branch of theoretical
computer science that deals with how efficiently problems
can be solved on a model of computation, using an
algorithm.
• There are three central areas of the theory of computation:
automata, computability, and complexity
• These three areas are linked by the following question:
What are the fundamental capabilities and limitations of
computers?
04/26/2025 Automata Theory & Languages 4
Automata Theory
• Automata theory deals with the definitions and properties
of mathematical models of computation.
• These models play a role in several applied areas of
computer science.
• One model, called the finite automaton, is used in text
processing, compilers, and hardware design. Another
model, called the context-free grammar, is used in
programming languages and artificial intelligence.
04/26/2025 Automata Theory & Languages 5
Computability Theory
• During the first half of the twentieth century, it was discovered
that certain basic problems cannot be solved by computers.
• One example of this phenomenon is the problem of
determining whether a mathematical statement is true or false.
• No computer algorithm can be written that can perform the
above task.
• In computability theory, the central question is:
What makes some problems computationally solvable and
others not solvable?
04/26/2025 Automata Theory & Languages 6
Complexity Theory
• Computer problems come in different varieties; some are easy,
and some are hard.
• For example, the sorting problem is an easy one. Say that you
need to arrange a list of numbers in ascending order.
• Even a small computer can sort a million numbers rather quickly.
• Compare that to a scheduling problem. Say that you must find a
schedule of classes for the entire university to satisfy some
reasonable constraints, such as, no two classes take place in the
same room at the same time.
04/26/2025 Automata Theory & Languages 7
Complexity Theory (ctd)
• The scheduling problem seems to be much harder than the
sorting problem. If you have just a thousand classes, finding the
best schedule may require centuries, even with a
supercomputer.
• In complexity theory, the central question is:
What makes some problems computationally hard and others
easy?
04/26/2025 Automata Theory & Languages 8
Symbols, Alphabet, Strings and
Languages
04/26/2025 Automata Theory & Languages 9
Symbols, Alphabet and Strings
• Symbols can be letters, digits or special characters
for example:0, 1, a, b, +, *, (, )
• An alphabet is a finite, nonempty set of symbols
• Common alphabets include:
1. Σ = {0, 1}, the binary alphabet
2. Σ = {a, b, ..., z}, the set of all lower-case letters
3. The set of all ASCII characters (or the set of all printable ASCII characters)
• A string is a finite sequence of symbols chosen from some alphabet
– For example, 01101 is a string over the binary alphabet
Σ = {0, 1}
– Another example, babbc is a string over alphabet Σ = {a, b, c}
04/26/2025 Automata Theory & Languages 10
Notations for Strings and Alphabet
Suppose, Σ (sigma) is an alphabet,
then, Σ* denotes the set of all finite strings over Σ.
For example,
if Σ = {0, 1},
then Σ* will be set of all finite binary strings
Σ* = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, . . . }
• There is no upper bound to Σ*, but every string must have finite
length.
• In other words, Σ* is an infinite set, but all its members have finite
length (finite strings).
04/26/2025 Automata Theory & Languages 11
Powers of an Alphabet
• If Σ is an alphabet, we use Σk to be the set of strings of length k, each of
whose symbols is in Σ.
– Example: If Σ = {0, 1}, then Σ1 = {0, 1}, Σ2 = {00, 01, 10, 11},
Σ3 = {000, 001, 010, 011, 100, 101, 110, 111}
– Note that Σ0 = {ε}, regardless of what alphabet Σ is. That is, ε is the only string
whose length is 0.
• The set of all strings over an alphabet Σ is conventionally denoted as
Σ*.
– For instance, {0, 1}* = {ε, 0, 1, 00, 01, 10, 11, 000, . . .}.
– Put another way, Σ* = Σ0 U Σ1 U Σ2 U ...
– To exclude the empty string, Σ+ = Σ1 U Σ2 U Σ3 U ...
04/26/2025 Automata Theory & Languages 12
Concatenation of Strings
Let x and y be strings. Then xy denotes the concatenation of x and y,
that is, the string formed by making a copy of x and following it by a
copy of y.
– For example: Let x = 01101 and y = 110.
Then xy = 01101110
and yx = 11001101.
04/26/2025 Automata Theory & Languages 13
More on Symbols, Alphabet and Strings
• The empty string is a string with zero occurrences of symbols. This
string, denoted by ε (epsilon), is a string that may be chosen from
any alphabet whatsoever.
• The length of a string is, the number of positions for symbols in the
string.
– For example, 01101 has length 5.
• The standard notation for the length of a string w is |w|. For
example, |011| = 3, and |ε| = 0.
04/26/2025 Automata Theory & Languages 14
Formal Languages
A language L over the alphabet Σ is a subset of Σ*.
A formal language L over the alphabet Σ is a subset of Σ* together with a set of specific
rules.
For example:
if Σ = {0, 1}
Then, a possible language, L = {01, 011, 11001, 1010110}
L ⊆ Σ*
(L is a subset of Σ*)
Example of a formal language:
L1 = {x ϵ {0, 1}* | x has even number of 0's and even number of 1's}
(the set of string x, consisting of symbols 0 and 1, such that x has even number of 0’s and even
number 1’s)
So, L1 Σ*
(L1 is a proper subset of Σ*)
04/26/2025 Automata Theory & Languages 15
Formal Languages (ctd)
Listing symbols, alphabet, string and language:
symbols: 0, 1
alphabet Σ: {0, 1}
a string: 1101011
Σ* is Set of all finite binary strings. Σ: { a, b, c, d, … z}
A language is a subset of Σ*. Σ*: { ε, a, b, c, …, z, aa, ab, ac, …, aaa, aab, … }
L ⊆ {0, 1}* LEnglish = { a, at, how, who, ohw, …, zyzzyva }
• Other languages can also be viewed as sets of strings.
– Ex: English, where the collection of legal English words is a set of strings over the
alphabet that consists of all the letters.
– Ex: Programming language C with its own set of possible strings.
04/26/2025 Automata Theory & Languages 16
Exercise 1
Write down the symbols, alphabet Σ, set of finite strings Σ* and the first
twenty elements of the languages satisfying following descriptions:
L1 = The set of strings of 0’s and 1’s with two consecutive 1’s.
L2 = The set of strings of 0’s and 1’s with no two consecutive 1’s.
Symbols: 0, 1
Alphabet: Σ = {0, 1}
Set of finite strings: Σ* : {0, 1}* = {ε, 0, 1, 00, 01, 10, 11, 000, 001, 010, 011, 100, 101, 110, 111, 0000, 0001,
0010, 0011, 0100, 0101, 0110, 0111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 00001, 000001, . . . }
Language L1 = {11, 011, 110, 111, 0011, 0110, 0111, 1100, 1011, 1100, 1101, 1110, 1111, 00011, . . . }
Language L2 = {ε, 0, 1, 00, 01, 10, 000, 001, 010, 100, 101, 0000, 0001, 0010, 0100, 0101, 1000, 1001, 1010,
00000, . . . }
04/26/2025 Automata Theory & Languages 17
Exercise 2
L3 = The set of strings of a’s, b’s and c’s ending with ab.
For the above language, write down all the symbols, Σ and Σ*:
Also, write down the elements (first twenty) of the language:
Symbols: a, b, c
Alphabet: Σ = {a, b, c}
Set of finite strings: Σ* : {a, b, c}* = {ε, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc,
aaa, aab, aac, aba, abb, abc, aca, acb, acc, baa, bab, bac, bba, bbb, bbc, caa, . . . }
Language L3 = {ab, aab, bab, cab, aaab, abab, acab, baab, bbab, bcab, caab,
cbab, ccab, aaaab, aabab, aacab, abaab, abbab, abcab, acaab, . . . }
04/26/2025 Automata Theory & Languages 18
Exercise 3
L4 = The set of strings of a’s, b’s and c’s not ending with ab.
For the above language, write down all the symbols, Σ and Σ*:
Also, write down the elements (first twenty) of the language:
Symbols: a, b, c
Alphabet: Σ = {a, b, c}
Set of finite strings: Σ* : {a, b, c}* = {ε, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc,
aaa, aab, aac, aba, abb, abc, aca, acb, acc, baa, bab, bac, bba, bbb, bbc, caa, . . . }
Language L4 = {ε, a, b, c, aa, ac, ba, bb, bc, ca, cb, cc, aaa, aac, aba, abb, aca,
acb, acc, baa, bac, bba, bbb, bbc, bca, . . . }
04/26/2025 Automata Theory & Languages 19
Languages And Set Membership Problem
• We will be concerned with the set membership problem of formal
languages.
• That is, we have a formal language L (a set of strings), when a string x
(an element) is given, the goal is to determine whether that string x is a
member of the formal language L.
• The strings are finite strings.
• The inputs are always finite in the context of computing, otherwise the
input cannot be processed.
04/26/2025 Automata Theory & Languages 20
Models of Computation
• To solve this set membership problem, we will think in terms of models
of computation.
• We will describe in an abstract way a class of algorithms.
• Specified in terms of Automata.
• Models of Computation are Automata of various kinds.
• We will define an automata for a language and will check weather the
given string is accepted by the automata for that language.
04/26/2025 Automata Theory & Languages 21
Types of Automata
We will study:
• Finite State Automata (Deterministic and Non-deterministic)
• Regular Expressions
• Context-free Grammars
• Push Down Automata
• Turing Machines
04/26/2025 Automata Theory & Languages 22