1. Intro, Set, String, Language
1. Intro, Set, String, Language
Introduction of
TOC, Set, String and Language
Topics to be covered
Looping
• Introduction to TOC
• Set
• Function
• Relation
• String
• Languages
Introduction to TOC
Introduction to TOC
Automata theory (also known as Theory Of Computation) is a theoretical branch of Computer
Science and Mathematics, which mainly deals with the logic of computation with respect to
simple machines, referred to as automata.
Automata* enables scientists to understand how machines compute functions and solve
problems.
The main motivation behind developing Automata Theory was to develop methods to describe
and analyze the dynamic behavior of discrete systems.
Automata originated from the word “Automaton” which is closely related to “Automation”.
For digital circuit or VLSI Design or Sequential circuit design (as per requirement)
▪ To design digital circuit, TOC provides mathematical models that are used to design these circuits.
It also has purpose for those problems which are not solvable, or its solution does not
exist.
B = {11, 12, 21, 11, 12, 22} is not normal, Set must contain distinct items.
The Sets {10, 11, 12}, {11, 10, 12} and {12, 11, 10} are all equal.
Formal Definition: Set is the unordered distinct items which has at least one common property.
Example:
U = {1,2,3,4,5}
A = {1,2}
A’ = {3,4,5}
Example:
A = {1, 3, 5, 7, 9}
B = {1, 2, 3, 4, 5}
A U B = {1, 2, 3, 4, 5, 7, 9}
Example:
A = {1, 3, 5, 7, 9}
B = {1, 2, 3, 4, 5}
A ∩ B = {1, 3, 5}
Prof. Jay R Dhamsaniya #3130006 (PS) Unit 1 – Basic Probability 11
Operations on Sets
Operations on the sets are: The set difference A - B of two sets A and B is the set of
everything in A but not in B.
1. Complement
2. Union
𝐴 – 𝐵 = {𝑥 | 𝑥 ∈ 𝐴 𝑎𝑛𝑑 𝑥 ∉ 𝐵}
3. Intersection = {𝑥 | 𝑥 ∈ 𝐴} ∩ {𝑥 | 𝑥 ∉ 𝐵}
4. Set Difference = 𝐴 ∩ 𝐵’
5. Symmetric Difference
6. Cartesian product U
𝐴 𝐵
Example:
A = {1, 3, 5, 7, 9}
B = {1, 2, 3, 4, 5}
A - B = {7, 9}
Prof. Jay R Dhamsaniya #3130006 (PS) Unit 1 – Basic Probability 12
Operations on Sets
Operations on the sets are: The symmetric difference A ⊖ B of two sets A and B is
the set of everything in A but not in B or the set of
1. Complement
everything in B but not in A.
2. Union
3. Intersection
4. Set Difference 𝐴 ⊖ 𝐵 = (𝐴 – 𝐵) 𝑈 (𝐵 – 𝐴)
5. Symmetric Difference
6. Cartesian product U
Example:
A = {1, 3, 5, 7, 9}
B = {1, 2, 3, 4, 5}
A ⊖ B = {7, 9, 2, 4}
Prof. Jay R Dhamsaniya #3130006 (PS) Unit 1 – Basic Probability 13
Operations on Sets
Operations on the sets are: The Cartesian product A x B of two sets A and B is the set
of all ordered pairs (a, b) where a ∈ A and b ∈ B.
1. Complement
2. Union
3. Intersection 𝐴𝑥𝐵 = 𝑎, 𝑏 𝑎 ∈ 𝐴 𝑎𝑛𝑑 𝑏 ∈ 𝐵}
4. Set Difference
5. Symmetric Difference Example:
6. Cartesian product A = {1, 3, 5}
B = {2, 4}
A x B = {(1,2), (1,4), (3,2), (3,4), (5,2), (5,4)}
|Φ| = |{ }| = 0
Example:
A = {1, 3, 5}
B = {2, 4}
P(A) = {Φ, {1}, {3}, {5}, {1,3}, {1,5}, {3,5}, {1,3,5} }
Associative laws
𝐴 ∩ (𝐵 ∩ 𝐶) = (𝐴 ∩ 𝐵) ∩ 𝐶
𝐴 𝑈 (𝐵 𝑈 𝐶) = (𝐴 𝑈 𝐵) 𝑈 𝐶
Distributive laws
𝐴 𝑈 (𝐵 ∩ 𝐶) = (𝐴 𝑈 𝐵) ∩ (𝐴 𝑈 𝐶)
𝐴 ∩ (𝐵 𝑈 𝐶) = (𝐴 ∩ 𝐵) 𝑈 (𝐴 ∩ 𝐶)
Absorptive laws
𝐴 𝑈 (𝐴 ∩ 𝐵) = 𝐴
𝐴 ∩ (𝐴 𝑈 𝐵) = 𝐴
De Morgan laws
(𝐴 𝑈 𝐵)’ = 𝐴’ ∩ 𝐵’
(𝐴 ∩ 𝐵)’ = 𝐴’ 𝑈 𝐵’
𝐴𝑈Φ = 𝐴
𝐴∩Φ = Φ
𝐴𝑈𝑈 = 𝑈
𝐴∩𝑈 = 𝐴
f(1) = 1 2 4
f(2) = 4 9
3
f(3) = 9
16
4
f(4) = 16
25
36
16
4
a 1 @
b 2 #
c 3 !
d 4
A B A B
a 1 1 a
b 2 f 2 b
f-1
c 3 3 c
d 4 4 d
4. R is antisymmetric if for every x and y in A, if 𝑥𝑅𝑦, then there must be 𝑦𝑅𝑥 until
unless x =y.
2. A={1, 2, 3, 4}, R={(1, 1), (2, 2), (2, 3), (3, 2), (4, 2), (4, 4)} is equivalent relation?
3. A={0, 1, 2}, R={(0, 0), (1, 1), (2, 2), (1, 0), (2, 1)} is equivalent relation?
Alphabets (Σ): Alphabets are a set (nonempty) of symbols, which are always finite.
Example:
Σ = {0, 1} is an alphabet of binary digits.
Σ = {0, 1, 2, 3..9} is an alphabet of decimal digits.
Σ = {a, b, c..}
Σ = {A, B, C…}
Null String: String that doesn't contain any element or string whose length is 0.
➢ Conclusion: For alphabet {a, b} with length n, number of strings can be generated = 2n.
Note: If the number of symbols in the alphabet Σ is represented by |Σ|, then a number of strings of length n,
possible over Σ is |Σ|n.
2. Consider a string of length n of same symbols, how many distinct substrings are there?
Ans. = n+1 (Note: If word distinct is not describe, then assume it.)
Ans. = n(n+1)/2
2. Consider a string of length n of distinct symbols, how many total no. of non null and proper
substrings are there?
Ans. = 2
2. Consider a string of length n of same symbols, how many prefix and suffix will be same?
Ans. = l+1
Example:
Language accepting all combination of g's over Σ={g}:
g* = {ε, g, gg, ggg, gggg, ggggg,...}
56
Closure Representation
Note: Σ* is a set of all possible strings (often power set (need not be unique here or we can
say multiset) of string).
So, this implies that language is a subset of Σ*. This is also called a “Kleene Star”.
Kleene Star is also called a “Kleene Operator” or “Kleene Closure”.
Engineers and IT professionals make use of Kleene Star to achieve all set of strings which is
to be included from a given set of characters or symbols. It is one kind of Unary operator.
In Kleene Star methodology all individual elements of a given string must be present but
additional elements or combinations of these alphabets can be included to any extent.
Example: Input String: “GFG".
Σ* = { ε, “GFG", "GGFG", "GGFG", "GFGGGGGGGG", "GGGGGGGGFFFFFFFFFGGGGGGGG", ...}
(Kleene Star is an infinite set but if we provide any grammar rules then it can work as a finite set. Please note
that we can include ε string also in given Kleene star representation.)
57
Language
A set of strings all of which are chosen from some 𝛴 ∗ , where 𝛴 is a particular alphabet, is
called a language.
If 𝛴 is an alphabet, and 𝐿 ⊆ 𝛴 ∗ , then 𝐿 is said to be language over alphabet 𝛴.
Language comprises of:
Set of characters – 𝛴
Set of strings (words) defined from set of character - 𝛴 ∗
Language L is defined from 𝛴 ∗ , and 𝐿 ⊆ 𝛴 ∗ because 𝛴 ∗ contains many string which may
not satisfy the rules of language.
Example:
𝛴 = {a, b}
𝛴 ∗ = {ε, a, b, aa, ab, ba, bb, aaa, aab, aba, abb, baa, …}
58
Language (Cont..)
A language that can be formed over ‘Σ’ can be Finite or Infinite.
L1 = { set of string of 2 }
59
Operations over Language
Operations over the language are:
1. Concatenation
2. Union
3. * (Kleene closure)
4. +
hopeless
If 𝐿 is a set of words then by 𝐿∗ we mean the set of all finite strings formed by concatenating
words from S, where any word may be used as often, we like, and where the null string is also
included. ∞
𝐿∗ = ራ 𝐿𝑖
𝑖=0
Example: 𝐿 = {ab}
If 𝐿 is a set of words then by 𝐿+ we mean the set of all finite strings formed by concatenating
words from L, where any word may be used as often, we like, and where the null string is not
included. ∞
𝐿+ = ራ 𝐿𝑖
𝑖=1
Example: 𝐿 = {ab}