Automata Week 1
Automata Week 1
AND
FORMAL LANGUAGES
AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Review of Set Theory
Sets
• For example:
Therefore, the set {1, 2, 3} is the same as the set {2, 3, 1}.
Similarly, the set {1, 2, 3, 2} is the same as the set {1, 2, 3}.
Set Membership
• For example:
Subsets
• For example:
• For example:
Empty Set
A = { } or A = ∅.
Union of Sets
• For example:
then A ∪ B = {1, 2, 3, 4, 5, 6}
Intersection of Sets
• The intersection of two sets A and B is obtained by forming a single
set that contains all the elements that are in both A and B.
• For example:
then A ∩ B = {3, 4}
AUTOMATA
Page 9 of 26 THEORY AND FORMAL LANGUAGES
Review of Set Theory
Complement of Sets
• For example:
then A′ = {1, 2, 5, 6}
Set-Builder Notation
AUTOMATA
Page 11 of THEORY AND FORMAL LANGUAGES
26
Review of Set Theory
• For example:
• Examples:
A = {x | x ∈ N, x ≥ 0}
This is read as: “Set A is the set of all x such that x is a natural
number and is greater than or equal to 0.”
A = {x | x = y2, y ∈ N }
This is read as: “Set A is the set of all x such that x is equal to
y2 where y is a natural number. Set A is therefore the set of
perfect squares.”
Power Sets
• For example:
P(A) = { ∅, {1}, {2}, {3}, {1,2}, {2, 3}, {1, 3},{1, 2, 3}}
• Sequences are similar to sets except for the fact that the ordering
and repetition of the members in sequences are important.
• For example:
• For example:
• Examples:
• For example:
Let set A = {1, 2, 3}, set B = {x, y}, and set C = {$, %}
AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Functions and Relations
Functions
• For any given function, the same input always produces the same
output.
• The set of all possible values the input of a function can take on is
called the domain of the function.
For the function f(x) = x + 1, the domain and range are the set of all
real numbers.
For the function f(x) = x2, the domain is the set of all real numbers
while the range is the set of non-negative real numbers.
• For example:
For the function f(x) = x + 1,
if x = 2, then f(x) = 3.
It can then be said that the function f(x) maps 2 to 3.
The function also maps 3 to 4, 4 to 5, etc.
• For example:
• A binary relation may involve only one set, A. If that is the case,
then the relation is simply a relation on set A.
• For example:
Let set A = {1, 2, 3}.
The relation “looks the same as” is reflexive since any person
looks like himself.
For example:
The relation “is less than” is transitive since if 1 < 2 and 2 <
3, then it implies that 1 < 3.
However, the relation “is the square of” is not transitive since
16 is the square of 4 and 4 is the square of 2 does not imply
that 16 is the square of 2.
For example:
AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Graphs
Undirected Graphs
1
node
2 3
edge
4 5
2 3
edge
(3, 5)
4 5
Take note that edge (1, 3) can also be referred to as edge (3,1).
• The number of edges connected to a node is called the degree of that node.
For example:
1
2 3
4 5
G = (N, E)
Examples:
1
2 3
Graph G
4 5
G = ( {1, 2, 3, 4, 5},
{(1, 2), (1, 3),(2, 4), (3, 4), (3, 5), (4, 5)} )
2 6
1 4 Graph H
3 5
H = ({1, 2, 3, 4, 5, 6},
{(1, 2), (1, 3), (2, 6), (3, 4), (3, 5), (4,5)})
For example: 2 6
1 4 Graph G
3 5
4
Subgraph of
Graph G
3 5
For example:
2 6
Path
1 4
3 5
• If every two nodes in a graph have a path between them, the graph is
called a connected graph.
• If there is at least two nodes in a graph that do not have a path between
them, then the graph is called a disconnected graph.
For example:
2 6
1 4
3 5
• A path is a cycle if it starts and ends in the same node. Take note that
the choice of the starting node is arbitrary/unspecified .
A simple cycle is a cycle that contains at least three nodes and has no
repeating nodes except for the first and last node.
For example: 2 6
A path which is
a cycle
1 4
3 5
For example:
1
2 3
4 5 6 7 8
9 10
For example:
2 6
1 4
3 5
Directed Graph G
Since these are ordered pairs, edge (i, j) is different from edge (j, i).
For example:
Edge (2, 6)
2 6
Edge (6, 2)
1 4
3 5
• The formal description of the given directed graph G would then be:
2 6
1 4
3 5
Directed Graph G
G = ({1, 2, 3, 4, 5, 6},
{(1, 2), (1, 3), (2, 6), (3, 1), (3, 4),(4, 5), (5, 3), (6, 2)})
For example: 2 6
1 4
3 5
Directed Graph G
For the given directed graph G, the outdegree of node 1 is 2 while its
indegree is 1.