Theory of Automata: Lecture - 04 Spring 2021 Waqas Tariq Dar UOL
Theory of Automata: Lecture - 04 Spring 2021 Waqas Tariq Dar UOL
Lecture – 04
Spring 2021
Waqas Tariq Dar
UOL
Kleene Closure
Kleene Closure ( applied to ∑ )
A set of all the strings (finite) that can be
formed by the elements of ∑ where the
elements may be repeated any number of
times, and the null string is also included.
Denoted by ∑*
Also called Kleene star.
...Kleene Closure
If ∑ = {a} , then
●
∑* = { Λ, a, aa, aaa, aaaa, …… }
If ∑ = {0, 1} , then
●
∑* = { Λ, 0, 1, 00, 01, 10, 11, 000, 001…… }
If ∑ = {a, b, c} , then
●
∑* = { Λ, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb,
cc, aaa…… }
...Kleene Closure
We can think of the Kleene star as an operation that
makes an infinite language of strings of letters out of
an alphabet ∑.
When we say "infinite language" we mean infinitely
many words each of finite length.
Notice that when we wrote out the first several words
in the language we put them in size order (words of
shortest length first) and then listed all the words of the
same length alphabetically.
We shall usually follow this method of sequencing a
language.
...Kleene Closure - Generalizing
We shall now generalize the use of the star operator to
sets of words, not just sets of alphabet letters.
If S = {aa, b} , then
●
S* = { Λ plus any word composed of factors of aa and b }
●
= { Λ plus all strings of a's and b's in which the a's
occur in even clumps }
●
= { Λ b aa bb aab baa bbb aaaa aabb baab bbaa bbbb
aaaab aabaa aabbb baaaa baabb bbaab bbbaa bbbbb }
●
Are the strings bbaabaa and aabaaab in S* ?
...Kleene Closure - Generalizing
Another example:
If S = {a, ab} , then
●
S* = { Λ plus any word composed of factors of a
and ab }
●
= { Λ plus all strings of a's and b's except those
that start with b and those that contain a double
b}
●
= { Λ a aa ab aaa aab aaaa aaab aaba abab...}
●
Is the string aabaaabba in S* ?
Some Observations
Λ represents an empty string (not alphabet
thus not a part of ∑ )
ε also represents the same.
ε is not equivalent to ∅
If ∑ = ∅ then,
●
∑* = {Λ}
Is ∑* = (∑*)* and so on ?
Star(Kleene) vs Plus Operation
∑* : The set of all strings over an alphabet ∑
called Kleene Star Closure of alphabet. So
we have
∑* = ∑0 U ∑1 U ∑2 U ∑3 U……………
∑+ : The set of all strings over an alphabet ∑
excluding empty string, ε, and called plus
operation. So we have
∑+ = ∑1 U ∑2 U ∑3 U……………
String Operations - Concatenation
Usually, we will use small alphabets: ∑ = {a,b}
Let w and v represent any two strings from ∑* and
a1, a2, a3 … and b1, b2, b3 … represent letter number
1, 2, 3,… from the strings w and v respectively.
w = a1a2a3 …… an e.g., abba
v = b1b2b3 …… bm e.g., bbbaaa
Concatenation:
●
wv = a1a2,..anb1b2...bm e.g., abbabbbaaa
String Operations - Reverse
Let,
w = a1a2a3 …… an e.g., ababaaabbb
Then,
Reverse:
●
wR = anan-1.....a2a1 e.g., bbbaaababa
String Operations – String Length
Let,
w = a1a2a3 …… an
Then,
Length:
●
|w| = n
●
|abba| = 4
●
|aa| = 2
●
|a| = 1
Note that:
Sets : { } {}
Set Size : { } 0
Set Size : {} 1
String Length 0
Operations on Language:
n n
An infinite language L {a b : n 0}
ab
L abb L
aabb
aaaaabbbbb
Superset of language L is ∑*
Operations on Language:
Complement of language L :
*
L=∑ −L
Let, L={aa , ab , abb }
*
L={all strings of ∑ other than L}
Operations on Language:
Reverse of language L :
R R
L ={w : w∈ L}
Let, L={aa , ab , abb }
R
L ={aa , ba , bba}
Reverse of following?
n n
L {a b : n 0}
Operations on Language:
Concatenation of language L1 and L2 :
L1 L2 ={xy : x ∈ L1 , y ∈ L2 }
Let, L1={aa , ab , abb }
L2 ={ab , aabb , aaaabbbb}
Then,
L1 L2 ={aaab , aaaabb , abbab ,...}
Operations on Language:
Other usual set operations :
,
a, bb,
a, bb *
aa , abb, bba , bbbb,
aaa, aabb, abba, abbbb,
Operations on Language:
Positive Closure
1 2
L L L
L *
a, bb,
a, bb aa, abb, bba, bbbb,
aaa, aabb, abba, abbbb,
References
T1 : Chapter 2
R1 : Chapter 1
https://math.stackexchange.com/questions/
1425011/does-the-kleene-closure-of-an-
alphabet-contain-an-infinite-string/1425014