Session-1and 2:�Basic Mathematical Notation and techniques
By
Dr. Ashok Kumar
Amity School of Engineering & Technology
Introduction to Automata Theory
Amity School of Engineering & Technology
Basic Mathematical Notation and techniques
Amity School of Engineering & Technology
Basic Mathematical Notation and techniques
Amity School of Engineering & Technology
String Operations
5
Concatenation
Amity School of Engineering & Technology
6
Reverse
Amity School of Engineering & Technology
String Length
Length:
Examples:
7
Amity School of Engineering & Technology
Length of Concatenation
Example:
8
Amity School of Engineering & Technology
Empty String
A string with no letters:
Observations:
9
Amity School of Engineering & Technology
Substring
Substring of string:
a subsequence of consecutive characters
String Substring
10
Amity School of Engineering & Technology
Prefix and Suffix
Prefixes Suffixes
11
prefix
suffix
Amity School of Engineering & Technology
Another Operation
Example: (ab)4 = abababab
Definition:
12
Amity School of Engineering & Technology
The * Operation
13
Amity School of Engineering & Technology
14
The + Operation
Amity School of Engineering & Technology
Languages
15
Amity School of Engineering & Technology
16
Note that:
Sets
Set size
Set size
String length
Amity School of Engineering & Technology
Another Example
An infinite language
17
Amity School of Engineering & Technology
Operations on Languages
The usual set operations
Complement:
18
Amity School of Engineering & Technology
Reverse
Definition:
Examples:
19
Amity School of Engineering & Technology
Concatenation
Definition:
Example:
20
Amity School of Engineering & Technology
Another Operation
Definition:
Special case:
21
{a, b}3={a,b}{a,b}{a,b}=
{aaa,aab,aba,abb,baa,bab,bba,bbb}
Amity School of Engineering & Technology
More Examples
22
aabb∈L
Amity School of Engineering & Technology
Star-Closure (Kleene *)
Definition:
Example:
23
Amity School of Engineering & Technology
Positive Closure
Definition:
24
Amity School of Engineering & Technology
25
Mathematical Preliminaries
Amity School of Engineering & Technology
26
A set is a collection of elements
SETS
We write
Amity School of Engineering & Technology
27
A = { 1, 2, 3, 4, 5 }
Universal Set: all possible elements
U = { 1 , … , 10 }
1
2
3
4
5
A
U
6
7
8
9
10
Amity School of Engineering & Technology
28
Set Operations
A = { 1, 2, 3 } B = { 2, 3, 4, 5}
A U B = { 1, 2, 3, 4, 5 }
A B = { 2, 3 }
A - B = { 1 }
B - A = { 4, 5 }
U
A
B
2
3
1
4
5
2
3
1
Venn diagrams
Amity School of Engineering & Technology
29
A
Universal set = {1, …, 7}
A = { 1, 2, 3 } A = { 4, 5, 6, 7}
1
2
3
4
5
6
7
A
A = A
Amity School of Engineering & Technology
30
0
2
4
6
1
3
5
7
even
{ even integers } = { odd integers }
odd
Integers
Amity School of Engineering & Technology
31
DeMorgan’s Laws
A U B = A B
U
A B = A U B
U
Amity School of Engineering & Technology
32
Empty, Null Set:
= { }
S U = S
S =
S - = S
- S =
U
= Universal Set
Amity School of Engineering & Technology
33
Subset
A = { 1, 2, 3} B = { 1, 2, 3, 4, 5 }
A B
U
Proper Subset:
A B
U
A
B
Set A is considered to be a proper subset of Set B if Set B contains at least one element that is not present in Set A.
Amity School of Engineering & Technology
34
Disjoint Sets
A = { 1, 2, 3 } B = { 5, 6}
A B =
U
A
B
Amity School of Engineering & Technology
35
Set Cardinality
A = { 2, 5, 7 }
|A| = 3
Amity School of Engineering & Technology
36
Powersets
A powerset is a set of all subsets
Powerset of S = the set of all the subsets of S
S = { a, b, c }
2S = { , , {a}, {b}, {c}, {a, b}, {a, c}, {b, c}, {a, b, c} }
Observation: | 2S | = 2|S| ( 8 = 23 )
Amity School of Engineering & Technology
37
FUNCTIONS
domain
1
2
3
a
b
c
range
f : A -> B
A
B
f(1) = a
4
5
Amity School of Engineering & Technology
38
Let A & B be sets. A binary relation “R” from A to B
R = {(x1, y1), (x2, y2), (x3, y3), …}
Where and
R ⊆ A x B
xi R yi to denote
e. g. if R = ‘>’: 2 > 1, 3 > 2, 3 > 1
RELATIONS
Amity School of Engineering & Technology
39
GRAPHS
A directed graph
V = { a, b, c, d, e }
E = { (a,b), (b,c), (b,e),(c,a), (c,e), (d,c), (e,b), (e,d) }
node
edge
a
b
c
d
e
Amity School of Engineering & Technology
40
Labeled Graph
a
b
c
d
e
1
3
5
6
2
6
2
Amity School of Engineering & Technology
41
PROOF TECHNIQUES
Amity School of Engineering & Technology
42
Induction
We have statements P1, P2, P3, …
If we know
P1, P2, …, Pk imply Pk+1
Then
Every Pi is true
Amity School of Engineering & Technology
43
Proof by Induction
Find P1, P2, …, Pb which are true
Let’s assume P1, P2, …, Pk are true,
for any k >= b
Show that Pk+1 is true
Amity School of Engineering & Technology
44
Example
Theorem: A binary tree of height h has at most 2h leaves.
Proof by induction:
let L(i) be the maximum number of
leaves of any subtree at height i
Amity School of Engineering & Technology
45
We want to show: L(i) <= 2i
Let’s assume L(i) <= 2i for all i = 0, 1, …, k
we need to show that L(k + 1) <= 2k+1
Amity School of Engineering & Technology
46
L(k) <= 2k
L(k+1) <= 2 * L(k) <= 2 * 2k = 2k+1
Induction Step
height
k
k+1
(we add at most two nodes for every leaf of level k)
Amity School of Engineering & Technology
47
Proof by Contradiction
We want to prove that a statement P is true
Amity School of Engineering & Technology
48
Example
Theorem: is not rational
Proof:
Assume by contradiction that it is rational
= n/m
n and m have no common factors
We will show that this is impossible
Amity School of Engineering & Technology
49
= n/m 2 m2 = n2
Therefore, n2 is even
n is even
n = 2 k
2 m2 = 4k2
m2 = 2k2
m is even
m = 2 p
Thus, m and n have common factor 2
Contradiction!
Amity School of Engineering & Technology