Toc CHP-1
Toc CHP-1
Introduction
Let A and B be sets. We say that B is a subset of A, and write B ⊆ A, if every element of B is
an element of A. Two sets A and B are equal (we write A = B) if their members are the same.
In practice, to prove that A = B, we prove A ⊆ B and B ⊆ A. A set with no element is called
an empty set, also called a null set or a void set, and is denoted by ϕ. We define the some
operations on set as follows:
Union of A and B: A⋃B = {x |x ∈ A or x ∈ B }
Intersection of A and B: A⋂B = {x |x ∈ A and x ∈ B }
Complement of B in A: A – B = {x |x ∈ A and x ∉ B }
B. Relations
The concept of relation is similar to the real life that compares one with the other. The
relation made a pair of objects that is true in some cases and false in others; the statement ‘x
is less than y’ is true if x = 3 and y = 4, for example, but false if x = 3 and y = 2.
Properties of relations
The relations have generally three properties: reflective, symmetric, and transitive. A relation
R in a set S is called an equivalence relation if it is reflective, symmetric, and transitive.
A relation R in a set S is reflective if xRx for every x in S.
A relation R in a set S is symmetric if for x, y in S, yRx whenever xRy.
A relation R in a set S is transitive if for x, y and z in S, xRz whenever xRy and yRz.
Types of functions
One – to – one (or injective) function: The function f : X → Y is said to be one-to-one
if different elements in X have different images i.e. f(x1) ≠ f(x2) when x1 ≠ x2. For
example: f : Z → Z given by f(n) = 2n is one-to-one but not onto.
Onto (subjective) function: The function f : X → Y is said to be onto if every element
y in Y is the image of some element x in X i.e. one-to-many relations.
One – to – one correspondence (bijection): The function f : X → Y is said to be one–
to–one correspondence if f is both one-to-one and onto.
A. Alphabet
An alphabet is a non-empty set of symbols or letters, e.g. characters {a, b, . . . , z} or digits{0,
1} or ASCII characters etc. The alphabets are represented by the symbol Σ. Alphabets are
important in the use of formal languages, automata and semi-automata. In most cases, for
defining instances of automata, such as deterministic finite automata (DFAs), it is required to
specify an alphabet from which the input strings for the automaton are built.
For example a common alphabet is {0, 1}, the binary alphabet. A finite string is a finite
sequence of letters from an alphabet. For example, if we use the binary alphabet {0, 1}, the
strings (ε, 0, 1, 00, 01, 10, 11, 000, etc.) would all be in the Kleene closure (i.e. set of
alphabets) of the alphabet (where ε represents the empty string). An infinite sequence of
letters may be constructed from elements of an alphabet as well.
B. Strings
A string (or word) is a finite sequence of symbols chosen from some alphabet. For example:
01101 and 111 are strings from the binary alphabet Σ = {0, 1}.
The string with zero occurrences of symbols is called empty string (denoted by ε).
The number of positions for symbols in the string is called length of a string. The length
of string is noted as: w: |w|. For example: |011| = 3 and | ε | = 0
Generation of strings
If Σ is an alphabet, we can express the set of all strings of a certain length from that alphabet
by using the exponential notation: Σk: the set of strings of length k, each of whose is in Σ.
Examples:
Σ0: {ε}, regardless of what alphabet Σ is. That is ε is the only string of length 0
Theory of Computation - Compiled by Yagya Raj Pandeya, NAST, Dhangadhi ©[email protected] Page 2
Kleen star
Σ*: The set of all strings over an alphabet Σ
{0, 1}* = {ε, 0, 1, 00, 01, 10, 11, 000, . . .}
Σ* = Σ0 ∪ Σ1 ∪ Σ2 ∪ . . .
The symbol ∗ is called Kleene star and is named after the mathematician and logician
Stephen Cole Kleene.
Note:
Σ+ = Σ1 ∪ Σ2 ∪ . . .
Thus: Σ* = Σ+ ∪ {ε}
String concatenation
Strings can be concatenated yielding another string using the binary operation (.), called
concatenation on Σ*. If a1a2a3 . . . an and b1 b2 . . . bm are in Σ*, then a1a2a3 . . . an . b1b2 . . . bm
= a1a2a3 . . . an b1 b2 . . . bm.
If x are y be strings then x.y 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 examples:
x = 01101 and y = 110 then xy = 01101110 and yx = 11001101
For any string w, the equations εw = wε = w hold.
C. Language
Languages define a set of alphabets and associated meanings. A formal language L over an
alphabet Σ is a subset of Σ*, that is, a set of words over that alphabet. Sometimes the sets of
words are grouped into expressions, whereas rules and constraints may be formulated for the
creation of 'well-formed expressions'. For example, the expression 0(0 + 1)*1 represents the
set of all strings that begin with a 0 and end with a 1. A formal language is often defined by
means of a formal grammar such as a regular grammar or context-free grammar, also called
its formation rule.
Examples: The language may be Programming language C, English or French and others
are:
The language of all strings consisting of n 0s followed by n 1s (n ≥ 0): {ε, 01, 0011,
000111, . . .}
The set of strings of 0s and 1s with an equal number of each: {ε, 01, 10, 0011, 0101,
1001, . . .}
Σ* is a language for any alphabet Σ
∅, the empty language, is a language over any alphabet
Theory of Computation - Compiled by Yagya Raj Pandeya, NAST, Dhangadhi ©[email protected] Page 3
Theory of Computation - Compiled by Yagya Raj Pandeya, NAST, Dhangadhi ©[email protected] Page 4