0% found this document useful (0 votes)
14 views

Automata Week 1

The document provides an overview of automata theory and formal languages. It begins by defining automata theory as the study of abstract machines and the computation problems that can be solved using these machines. It then reviews some key concepts in set theory such as sets, membership, subsets, unions, and intersections. Finally, it discusses functions and relations, defining a function as an object that relates a known input to a specific output.

Uploaded by

Dann Laurte
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Automata Week 1

The document provides an overview of automata theory and formal languages. It begins by defining automata theory as the study of abstract machines and the computation problems that can be solved using these machines. It then reviews some key concepts in set theory such as sets, membership, subsets, unions, and intersections. Finally, it discusses functions and relations, defining a function as an object that relates a known input to a specific output.

Uploaded by

Dann Laurte
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 44

AUTOMATA THEORY

AND
FORMAL LANGUAGES

SCHOOL OF COMPUTING JAYSON


AUTOMATA THEORY AND FORMAL VIERNES
LANGUAGES
Automata Theory

• Theory of automata is a theoretical branch of computer


science and mathematics.

• It is the study of abstract machines and the computation


problems that can be solved using these machines.

• The abstract machine is called the automata.

• The main motivation behind developing the automata theory


was to develop methods to describe and analyze the
dynamic behavior of discrete systems.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Review of Set Theory

 Sets

• A set is a collection of objects such as numbers, letters, symbols, or


other sets.

• These objects are called the members or elements of the set.

• For example:

If set A = {0, 2, 4, 8, 16},

then the members or elements of set A are 0, 2, 4, 8, and 16.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

• In sets, the ordering and repetition of the members are not


important.

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

• The symbol ∈ is used to denote membership in a set while the


symbol ∉ is used to denote non-membership in a set.

• For example:

If set A = {0, 2, 4, 8, 16},


then 8 ∈ A while 7 ∉ A.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 Subsets

• For two sets A and B, B is a subset of A, if every member of B


is also a member of A.

• Set B is a subset of set A is denoted by B ⊆ A.

• For example:

If set A = {0, 2, 4, 8, 16}


and set B = {2, 8},
then B ⊆ A.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory
 Infinite Set

• An infinite set is a set that has infinitely many members.

• For example:

The set of integers Z = {…, -2, -1, 0, 1, 2, …} is an infinite set.

 Empty Set

• An empty set is a set that contains no members.

• If set A is an empty set, it is written as:

A = { } or A = ∅.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 Union of Sets

• The union of two sets A and B is obtained by forming a single set


that contains all the elements in A and B.

• The union of sets A and B is written as A ∪ B.

• For example:

If Set A = {1, 2, 3, 4} and Set B = {3, 4, 5, 6}

then A ∪ B = {1, 2, 3, 4, 5, 6}

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 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.

• The intersection of sets A and B is written as A ∩ B.

• For example:

If Set A = {1, 2, 3, 4} and Set B = {3, 4, 5, 6}

then A ∩ B = {3, 4}

If A ∩ B = ∅ (they have no common elements),

then sets A and B are said to be disjoint.

AUTOMATA
Page 9 of 26 THEORY AND FORMAL LANGUAGES
Review of Set Theory

 Complement of Sets

• Assume set A is a subset of set B (A ⊆ B).

• The complement of A with respect to B is the set of all elements in


B that are not in A.

• The complement of set A is written as Ā or A′.

• For example:

If Set A = {3, 4} and Set B = {1, 2, 3, 4, 5, 6}

then A′ = {1, 2, 5, 6}

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 Set-Builder Notation

• The set-builder notation is used to describe a set containing


elements that has a certain property or follow a certain rule.

• The following designations are used in conjunction with the


set-builder notation:

N = set of natural numbers


Z = set of all integers
R = set of all real numbers

AUTOMATA
Page 11 of THEORY AND FORMAL LANGUAGES
26
Review of Set Theory

• For example:

A = {x | x ∈ Z, 10 < x < 20}

• This is read as “set A is the set of all x such that x is an


integer and x is greater than 10 but less than 20.”

• In the traditional way of writing sets (called the roster method)


set A would have been written as:

A = { 11, 12, 13, 14, 15, 16, 17, 18, 19}

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

• The set-builder notation is often used to describe infinite sets.

• 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.”

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 Power Sets

• The power set of A is the set of all subsets of set A.

• The power set of A is written as P(A) or 2A.

• For example:

Let set A = {1, 2, 3}.

P(A) = { ∅, {1}, {2}, {3}, {1,2}, {2, 3}, {1, 3},{1, 2, 3}}

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

 Sequences and Tuples

• Sequences are similar to sets except for the fact that the ordering
and repetition of the members in sequences are important.

• For example:

The sequence {1, 2, 3} is different from the sequence {2, 3, 1}.

The sequence {1, 2, 3, 2} is different from the sequence {1, 2, 3}.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

• Sequences may be finite or infinite.

• Finite sequences are called tuples.

• A sequence with k elements is a called a k-tuple.

• For example:

The sequence {1, 2, 3} is a 3-tuple


while the sequence {a, b} is a 2-tuple.

• A 2-tuple is often called a pair.

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory
 Cartesian Product of Sets

• The Cartesian Product, or Cross Product of two sets A and B, is


the set of all 2-tuples or pairs wherein the first element of a pair is
a member of set A and the second element of a pair is a member of
set B.

• The Cartesian product of sets A and B is written as A × B.

• Examples:

Let set A = {1, 2} and set B = {x, y}

A × B = { {1, x}, {1, y},


{2, x}, {2, y} }

B × A = { {x, 1}, {x, 2},


{y, 1}, {y, 2} }
AUTOMATA THEORY AND FORMAL LANGUAGES
Review of Set Theory

Let set A = {1, 2, 3} and set B = {x, y}

A × B = { {1, x}, {1, y},


{2, x}, {2, y},
{3, x}, {3, y} }

B × A = { {x, 1}, {x, 2}, {x, 3},


{y, 1}, {y, 2}, {y, 3} }

A × A = { {1, 1}, {1, 2}, {1, 3},


{2, 1}, {2, 2}, {2, 3},
{3, 1}, {3, 2}, {3, 3} }

B × B = { {x, x}, {x, y},


{y, x}, {y, y} }

AUTOMATA THEORY AND FORMAL LANGUAGES


Review of Set Theory

• The Cartesian product can be extended to more than two sets.


Generally, the Cartesian product of k sets A1, A2, …, Ak, is the
set of all k-tuples (a1, a2,…, ak) where ai ∈ Ai.

• For example:

Let set A = {1, 2, 3}, set B = {x, y}, and set C = {$, %}

A × B × C = { {1, x, $}, {1, x, %}, {1, y, $}, {1, y, %},


{2, x, $}, {2, x, %}, {2, y, $}, {2, y, %},
{3, x, $}, {3, x, %}, {3, y, $}, {3, y, %} }

C × B × C = { {$, x, $}, {$ , x, %}, {$, y, $}, {$, y, %},


{%, x, $}, {% , x, %}, {%, y, $}, {%, y, %} }

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Functions and Relations

 Functions

• A function is an object that defines the relation between a known


input and the output it produces.

• Functions are usually written as f(x) = y. For a function f, if the


input is x then the output is y.
• Examples:
Given a function f(x) = x + 1,
if the input x = 2, then the
output is f(x) = 3.

Given a function f(x) = x2,


if the input x = 2,
then the output is f(x) = 4.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

• 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.

• The set of all possible output values of a function is called the


range of the function.
• For example:

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.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

• A function is also called a mapping.

• 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.

• Therefore, a function is some rule that associates to each element


in its domain some element in its range.

• For example:

The function f(x) = x2 maps each real number to its square


(2 is mapped to 4, 3 is mapped to 9, 4 is mapped to 16, etc.)

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations
 Binary Relations

• A binary relation from set A to set B is the set of ordered pairs


{x, y} where x ∈ A and y ∈ B.

• The ordered pair {x, y} is in a relation to R if element x is related to


element y as defined by R.
• For example:
Let A = {3, 4, 5, 6, 7, 8, 9} and B = {1, 2, 3}.
If R is defined as x = y2, the relation R is:
R = {{4, 2}, {9, 3}}
• If the ordered pair {x, y} ∈ R, then we write a xRy.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

• 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}.

If R is defined as x < y, the relation R on set A is:


R = {{1, 2}, {1, 3}, {2, 3}}

Take note that the other ordered pairs


{1, 1}, {2, 1}, {2, 2}, {3, 1}, {3, 2}, and {3, 3}
are not included in R because they do not satisfy x < y.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

 Properties of Binary Relations

• A relation R on set A is reflexive if for every x ∈ A, xRx. In other


words, each element of set A is related to itself.
For example:

The relation “is equal to” is reflexive.


However, the relation “is less than” is not reflexive since 1 < 1 is
not possible. The relation cannot be applied to the same element.

The relation “looks the same as” is reflexive since any person
looks like himself.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

• A relation R on set A is symmetric if for every x, y ∈ A, xRy


implies yRx.

For example:

The relation “is equal to” is symmetric.

However, the relation “is less than” is not symmetric since


1< 2 does not imply 2 < 1.

The relation “is a sibling of” is symmetric since if John is a sibling


of Peter, then it implies that Peter is a sibling of John.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations

• A relation R on set A is transitive if for every x, y, z ∈ A, xRy


and yRz implies xRz.
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.

The relation “is taller than” is transitive since if John is taller


than Peter and Peter is taller than Paul, then it implies that
John is taller than Paul.

AUTOMATA THEORY AND FORMAL LANGUAGES


Functions and Relations
• A binary relation R is an equivalence relation if R is reflexive,
symmetric, and transitive.

For example:

Is the relation “looks the same as” an equivalence relation?

- It is reflexive since any person looks the same as himself.

- It is symmetric since if John looks the same as Peter, then it


implies that Peter looks the same as John.

- It is transitive since if John looks the same as Peter and Peter


looks the same as Paul, then it implies that John looks the same as
Paul.

The relation “looks the same as” is therefore an equivalence relation.


AUTOMATA THEORY AND FORMAL LANGUAGES
Graphs

AUTOMATA
AUTOMATA THEORY
THEORY AND
AND FORMAL
FORMAL LANGUAGES
LANGUAGES
Graphs
 Undirected Graphs

• An undirected graph is a finite set of points and lines


connecting the points.
• The points in a graph are called nodes or vertices, and the lines
are called edges or arcs.
For example:

1
node

2 3

edge

4 5

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• In this course, an undirected graph will simply be called graph.

• Each node in a graph is labeled while each edge is identified using a


tuple (i, j), where i and j are the nodes that the edge connects.

For example: 1 edge


(1, 3)

2 3

edge
(3, 5)
4 5

Take note that edge (1, 3) can also be referred to as edge (3,1).

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• The number of edges connected to a node is called the degree of that node.

For example:
1

2 3

4 5

In this graph, node 1 has a degree of 2 while node 4 has a degree of 3.

No more than one edge is allowed between any two nodes.

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• A graph G can be described as being composed by a set of nodes, N, and


a set of edges, E.

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)} )

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

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)})

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• A subgraph of graph G is a graph whose set of nodes is a subset of that


of G and whose edges are the edges of G on the corresponding nodes.

For example: 2 6

1 4 Graph G

3 5

4
Subgraph of
Graph G
3 5

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• A path in a graph is a sequence of consecutive edges.

A path is a simple path if there are no repeated nodes.

The length of a path is the number of edges within the path.

For example:
2 6

Path
1 4

3 5

The length of the path indicated is 3.

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• 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

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• 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

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• A special kind of graph that is connected and has no simple cycles is


called a tree.

For example:
1

2 3

4 5 6 7 8

9 10

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs
 Directed Graphs

• A directed graph is similar to an undirected graph except that edges are


replaced by directed edges.

In other words, lines are replaced by arrows.

For example:
2 6

1 4

3 5

Directed Graph G

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• An edge connecting two nodes from node i to node j is represented as the


ordered pair (i, j). While an edge connecting two nodes from node j to node
i is represented as the ordered pair (j, i).

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

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs

• 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)})

AUTOMATA THEORY AND FORMAL LANGUAGES


Graphs
• In a directed graph, the number of arrows pointing from a particular node is
the outdegree of that node

The number of arrows pointing to a particular node is the indegree.

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.

AUTOMATA THEORY AND FORMAL LANGUAGES

You might also like