0% found this document useful (0 votes)
8 views10 pages

Preliminary

Fsm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views10 pages

Preliminary

Fsm
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

1

What is Alphabet?
The term alphabet denotes the finite and nonempty set of symbols (or characters). For
example,
(1) If  is an alphabet containing all the 26 characters used in English language, then 
is finite and nonempty set, and ={a, b, c, …, z}.
(2) B={0, 1} is an alphabet.
(3) X={1, 2, 3, …} is not an alphabet because it is infinite.
(4) A={ } is not an alphabet because it is empty.

Transition Graph (TG)


Transition graphs are used to represent the automata. A graph T is called a transition
graph on some alphabet  if and only if T has following three things:
1. The alphabet  is called input alphabet from which inputs (also called labels)
are formed
2. T has is a finite directed graph and each edge (also called arc or arrow) of T is
labeled by a word w*. This also shows that how transitions occur from vertex
to vertex. There may be zero or one or more possible transition for w*.
3. There is a non-empty set of vertices from which at least one vertex designated
as initial (or starting) vertex and some vertices (possibly none sometimes)
designated as final vertices. An initial vertex can also be called as final vertex. A
vertex is also known as state.
2

For example, a transition graph over ={a, b} is shown in Fig. 1.

a q1
q0

b
b
ab
b

ab
q2 qf
a
Fig. 1 Transition Graph of Deterministic finite automaton

 A successful path is a series of edges beginning at some initial state and ending
at a final state.
 The concatenation of all the substrings that label the edges in the successful path
is a word accepted by the transition graph and the set of words accepted is the
language of the transition graph.

For example, words “ababa”, “ba”, “bba” are accepted by the transition graph shown in
Fig. 1.
The set states V={q0, q1, q2, qf}, set of final states is {qf}, and initial state is q0, and the
input alphabet ={a, b}.
3

Generalized Transition Graph (GTG)


Generalized transition graph is a transition graph in which edgesare labeled with a
regular expression. For example, consider an input alphabet ={0, 1}. The regular
expressions 0+1, 011 are the labels of the edges of the generalized transition graph
shown in Fig. 2.

0+1
011
S F

Fig. 2 Generalized Transition Graph

In the above generalized transition graph, set of states is {S, F}, initial state is S, final
state is F and accepted language is (0+1)*011.

 Generalized transition graphs are used to represent the finite automata


(FA).

Power Set
The power set of a set X is also a set which contains all the subsets of X including X and
denoted by 2X.
Example let X={a, b}, then power set of X is defined as
2X={, {a}, {b}, {a,b}}
Number of elements in 2X, 2X=22 = 4

In general, the number of elements in power set of a set A is 2A.

Example Determine the following sets


(a) 2X, where X={a, b, {a, b}}
(b) 2B- 2A, where A={1, 2}, and B={1, 2, 3}
(c) {a}{a, b}{a, b, c}
4

(d) {1, 2}
{1, 2}
(e) 2  {1, 2}
Solution:
(a) X={a, b, {a, b}},
X
Then 2 ={All subsets of set X}
={, {a}, {b}, {a, b}, {{a, b}}, {a,{a, b}}, {b, {a, b}},{a, b, {a, b}}}

String, and Language


We are aware of many languages like Hindi, English, French, etc. which are used in
conversation. We use many languages in computer programming also, for example, C,
C++, Java, etc.

1. String (or Word)


String and word are synonyms. Sometimes, sentence is also used for string. A string is
a finite sequence of symbols from some fixed alphabet.

For example, “abc” is a string over an alphabet ={a, b, c, …, z}.


The empty string or null string is denoted by  (Epsilon).

2. Length of a String
The length of a string is the number of occurrences (or appearances) of characters or
symbols in that string. If w is a string then its length is denoted by w . There may be
situation that, single symbol in a string occurs one or more times.
For example,
(1) w=abcd, then length of w is w =4
(2) n=124 is a string, then n =3
(3)  is the empty string and has length zero.
5

3. The Set of Words of length k(k1)


k
Let  be an alphabet and ={0, 1}, then all words of length k (k1) is denoted by and
k
 ={x: x is a string or word of length k, k1}

For example,
(1) Let us consider alphabet ={0, 1}, then 1={0,1}, 2={00, 01, 10, 11}, 3={000,
001, 010, 011, 100, 101, 110, 111}.
1 =2=21 (No. of strings of length one),
2 = 4=22 (No. of strings of length two), and
3 =8=23 (No. of strings of length three)
(2) S={a, b, c}, then S2={aa, ab, ac, bb, ba, bc, cc, ca, cb}, and S2 =9=32

4. Concatenation of Strings
If w1 and w2 are two strings then concatenation of string w2 with string w1 is a string and
it is denoted by w1w2. The length of string w1w2 is the sum of lengths of strings w1 and
w2, i.e.
w1w2= w1+ w2

5. Prefix and Suffix of a String


A string obtained by removing zero or more trailing symbols from a string w is called
prefix. For example, if a string w=xyz, then x, xy, xyz are prefixes of w.
A string obtained by removing zero or more leading symbols from a string w is called
suffix. For example, if a string w=xyz, then z, yz, xyz are suffixes of w.A string x is a
proper prefix or suffix of a string w if and only if xw.

6. Substrings of a String
A string obtained by removing a prefix and a suffix from a string w is called substring.
For example, if a string w=xyz, then y is a substring of w. Every prefix and suffix of a
string w is a substring of w, but not every substring of w is a prefix or suffix of w. For
every string w, both w and  are prefixes, suffixes, and substrings of w.
6

Substring of w =w- (One prefix)-(One suffix)

What a Language is?


A language L denotes a set of strings over certain alphabet. The , and {} are
languages. The language  is without a string and {} is similar to an empty box inside a
box i.e. a language with string .
For example, let us see some languages given below:
(1) L1={ ab, aabb, aaabbb} is a language over alphabet {a, b}
(2) L2={, a, aa, aaa, …} is a language over alphabet {a}
(3) L3={anbncn: n1} is a language over {a, b, c}.
(4) L4=={anbncm: m, n1} is a language over {a, b, c}.
(5) L5={w: w(a+b)* and has even number of a’s and odd number of b’s}
(6) L6={w: w(a+b)* and has either “aaa” or “bb” as substring}
(7) L7={w: w(a+b)* and has neither “aa” nor “bb” as substring}

Kleene Closure
Let  be some alphabet. Then Kleene closure of  is denoted by *, also known as
reflexive-transitive closure. The length of Kleene closure of any alphabet is infinite. It is
defined as follows:

*={Set of all words over }


={word of length zero, words of length one, words of length two, …}

=  (K)
K 0
=0 123… where i is set of words over  of length i
7

For example,
(1) ={0, 1} and a language L over . Then *= 0 12…
0 ={},
1 ={0, 1},
2 ={00,01, 10, 11}, and so on
*
So,  ={, 0, 1, 00, 01, 10, 11…}
*
(2) S={a}, then S ={, a, aa, aaa, aaaa, aaaaa,..}
(3) Let A=, then A* = * ={}

Positive Closure
If  is an alphabet then positive closure of  is denoted by + and defined as follows:

+ *
 = -{}
={Set of all words over  excluding empty string }

For example,
(1) If ={a}, then +={a, aa, aaa, aaaa, aaaaa, …}
(2) If A={0, 1}, then A+={0, 1, 00, 11, 01, 10, 000, 111, 001, …}

Useful Operations on Languages


Languages are represented by sets, so all the operations applicable on the sets are also
applicable on the languages. Most used operations are: Union, Concatenation,
Intersection, and Complement. Let us consider two languages L1 and L2 over the alphabet
 and see the operations.

Union: Union of two or more languages is a language, that is,


L=L1L2={x: x is in L1 or L2 or in both L1 and L2}
Concatenation: Concatenation of two or more languages is a language, that is,
L=L1L2={xy: x is in L1 and y is in L2}
Intersection: Intersection of two languages is a language, that is,
8

L=L1L2={x: x is in both L1 and L2}


Complement: If L1 is a language over , the complement of language L1 is defined as
∗ ∗
𝐋𝟏 =  − 𝐋𝟏 = {𝐱: 𝐱 𝐢𝐬 𝐢𝐧  𝐛𝐮𝐭 𝐱 𝐢𝐬 𝐧𝐨𝐭 𝐢𝐧 𝐋𝟏 }
Kleene Closure: If L is a language over , then Kleene closure of L is represented as L*
and defined as
L*={, L, L2, L3, …}
Example 2.4 Consider the languages L1={ab, aa, bc, cb, bb, cc}, L2={a, b, aa, bb, cc}
over {a, b, c} and L3={00,11} over {0, 1}. Find out the following:
(a) L=L1L2 (b) L=L1L3 (c) L=L1L2
(d) L=L1L3 (e) L3*
Solution: (a) L=L1L2={a, b, aa, bb, cc, ab, bc, cb}
(b) L=L1L3={ab00, ab11, aa00, aa11, bc00, bc11, cb00, cb11, bb00, bb11, cc00, cc11}
(c) L=L1L2={aa, bb, cc}
(d) L=L1L3=
(e) L3*={, 00, 11, 00000, 1111, 0011, 1100, …}

Theorem 1: For a language L over , Ln=Ln-1 L for n2


Proof: For language L, L2=LL, L3=LLL
Similarly Ln=LLL…L (concatenation of L n-times) for n2
={Concatenation of L (n-1)-times} {L}
=Ln-1L
Theorem 2: For a language L over ,

𝐿∗ = 𝐿 𝑓𝑜𝑟 𝑘 ≥ 0

Proof: L*={, L, L2, L3, L4, …}


=L0L1L2L3L4…

= 𝐿 𝑓𝑜𝑟 𝑘 ≥ 0

Theorem 3: For a language L over , Ln L* for n0


9

Proof: For n=0, L0={}


For n=1, L1=L
For n=2, L2=LL
Similarly for n3, Ln=LL…L (Concatenation L n-times)
According to Theorem 2.2, we know that L*={, L, L2, L3, L4, …}. It means, Ln is in
L*for certain value of n0. Therefore, Ln L* for n0

Theorem 4: For a language L over , L+= L*L=LL*


Proof: We know that
L+={L, L2, L3, L4, …}={, L, L2, L3, …}{L}={L}{, L, L2, L3, …}
Therefore, L+=L*L=LL*

Theorem 5: For a language L over , L* = (L*)*


Proof: L*={, L, L2, L3, …}
So, (L*)*={, L, L2, L3, …}*={All the strings over L*}
={, L, L2, L3, …}=L*

Formal Languages
Languages are basically communication means in form of symbols. To define the concept
of a Formal Language, we need the ideas of an Alphabet and a string. We have seen the
Kleene Closure and positive closure.
A formal language L on the alphabet  is a subset of *, i.e.
L *
Here we are defining a formal language L as a collection of strings (words). Is it
appearing practical in our real world? Obviously, the answer is no, because without the
grammar we cannot get the desired language. In our real life, a language means a means
of communication of our thoughts, desires, facts, etc.

Formal Grammars: Suppose we have a formal language L. That is to say, we have an


Alphabet  and this language is a certain subset; L *. How do we set about defining L?
10

There are many approaches to this but one has become very standard in recent years,
particularly in Computer Science. This approach is due to the well-known linguistic
theorist Noam Chomsky (1959). He developed this approach in studying “natural
languages”, but it has since been taken over in a big way to describe computer languages.
We will discuss this in Chapter- 4.

You might also like