FLAT - Ch.1 (Lecture Notes)
FLAT - Ch.1 (Lecture Notes)
II. Alphabet
The non empty finite set of symbols is called as an alphabet and it is denoted by
∑.
Example
∑ = {a.b.c………z}
∑ = {0,1}
∑ = {1}
III. String
Example
∑ = {a,b}
W = a,ab,aa,bb
W= ab,aab,abc
∑ = {0,1}
W = 0,01,00,11,1
W = 102,2013
∑ = {1}
W = 1, 11, 111
W = 1,12, 121
IV. Length of a string
If w is any string over alphabet ∑ then the number of symbols involved in the
sequence of string is called as length of the string and denoted by |w|.
Example
V. Empty string
A string of length zero or string without any symbols is known as empty string
and is denoted by €
w = € , |w| = 0
w. € = w = €.w
VI. Substring
Let u,w be the two strings over same alphabet ∑ then u is said to be substring of
w if u can be obtained from w.
Any consecutive sequence of symbols over given string.
Example
W = TOC
Zero length Substring= €
One length substring=T,O,C
Two length substring= TO,OC
Three length substring=TOC
If u is a substring of w then |u| <= |w|
Every string is substring to itself.
Empty string “€” is substring for every string
Types substring
1. No of substrings = ∑n +1 = n(n+1)/2
2. No. of trivial string = 2
3. No. of non-trivial substring = ∑n -1
4. No. of non-empty substring= ∑n
5. No of substrings of distinct length = n
6. No. of strings of length n generated over alphabet ∑ = | ∑ |n
Prefix
The sequence of starting or leading symbol is called as prefix.
Suffix
The sequence of ending or trailing symbol is called as suffix.
Example
1. w=TOC , |w|=3
2. Prefix : € , T , TO , TOC
3. Suffix : TOC , OC , C , €
If w is any string of length ‘n’ then
1. No. of prefix = No. of suffix = n+1
2. Trivial substrings are common for both prefix and suffix
3. Every prefix and suffix must be a substring but every substring need not
be prefix or suffix.
+ve closure(∑+)
∑+ = {w | |w|>=1}
Kleen closure(∑*)
∑* = {w | |w|>=0}
∑* = ∑+ ꓴ €
IX. Language
Formal Languages
The collection of strings where we can put some restriction in the
formation of string is called as formal language.
Example ∑ = {0,1}
L ={00,01,10,11}
L = { (01)n | n>=1 }
L = { 0n 1m |m>=1,n>=1}
Empty Languages
The Language that does not contain any string even empty string is
called as empty language and is denoted by ф.
Finite Languages
The Language which contains finite number of strings and length of
each string is finite is called as finite language
L = { 0n 1n |1<=n<=1}
Infinite Languages
The Language which contains infinite number of strings and length of
each string is finite is called as infinite language .
L = { 0n 1n |n>=1}
XII. Automata
The mathematical system that can represent the formal language is called as
Automata i.e. The mathematical representation of formal language is called as an
automata.
Types of Automata
1. Finite Automata(FA)
2. Push Down Automata(PDA)
3. Linear Bound Automata(LBA)
4. Turing Machine(LBA)
XIII. Expressive power of an automata
1. E(FA)=1
2. E(PDA)=2
3. E(LBA)=3
4. E(TM)=4
XIV. Grammar
The collection of rules which are used to generate the string is called grammar.
Grammar G is a collection of 4 tuples {V,T,P,S}
G= {V,T,P,S} ,Where
XVI. Derivation
Consider the following grammar and write the derivation to generate string abc.
1. A XYZ (r1)
2. X a (r2)
3. Y b (r3)
4. Z c (r4)
5.
Derivation
A XYZ
A aYZ
A abZ
A abc
Parse Tree
X Y Z
a b c