CS5371 Theory of Computation: Lecture 1: Mathematics Review I (Basic Terminology)
CS5371 Theory of Computation: Lecture 1: Mathematics Review I (Basic Terminology)
CS5371 Theory of Computation: Lecture 1: Mathematics Review I (Basic Terminology)
Theory of Computation
Lecture 1: Mathematics Review I
(Basic Terminology)
Objectives
•Unlike other CS courses, this course
is a MATH course…
•We will look at a lot of definitions,
theorems and proofs
•This lecture: reviews basic math
notation and terminology
–Set, Sequence, Function, Graph, String…
•Also, common proof techniques
–By construction, induction, contradiction
Set
•A set is a group of items
•One way to describe a set: list every item in
the group inside { }
–E.g., { 12, 24, 5 } is a set with three items
•When the items in the set has trend: use …
–E.g., { 1, 2, 3, 4, …} means the set of natural
numbers
•Or, state the rule
–E.g., { n | n = m2 for some positive integer m } means
the set { 1, 4, 9, 16, 25, …}
•A set with no items is an empty set denoted
by { } or ;
Set
•The order of describing a set does
not matter
–{ 12, 24, 5 } = { 5, 24, 12 }
•Repetition of items does not matter
too
–{ 5, 5, 5, 1 } = { 1, 5 }
•Membership symbol
–5 { 12, 24, 5 } 7 { 12, 24, 5 }
Set (Quick Quiz)
•How many items are in each of the
following set?
–{ 3, 4, 5, …, 10 }
–{ 2, 3, 3, 4, 4, 2, 1 }
–{ 2, {2}, {{1,2,3,4,5,6}} }
–;
–{;}
Set
Given two sets A and B
•we say A µ B (read as A is a subset of B)
if every item in A also appears in B
–E.g., A = the set of primes, B = the set of
integers
•we say A ( B (read as A is a proper subset
of B) if A µ B but A B
Warning: Don’
t be confused with and µ
–Let A = { 1, 2, 3 }. Is ; A? Is ; µ A?
Union, Intersection, Complement
Given two sets A and B
•A [ B (read as the union of A and B) is the
set obtained by combining all elements of A
and B in a single set
–E.g., A = { 1, 2, 4 } B = { 2, 5 }
A [ B = { 1, 2, 4, 5 }
•A \ B (read as the intersection of A and B)
is the set of common items of A and B
–In the above example, A \ B = { 2 }
—
•A (read as the complement of A) is the set
of items under consideration not in A
Set
•The power set of A is the set of all
subsets of A, denoted by 2A
–E.g., A = { 0, 1 }
2A = { {}, {0}, {1}, {0,1} }
–How many items in the above power set
of A?
•If A has n items, how many items
does its power set contain? Why?
Sequence
•A sequence of items is a list of these items
in some order
•One way to describe a sequence: list the
items inside ( )
–( 5, 12, 24 )
•Order of items inside ( ) matters
–( 5, 12, 24 ) ( 12, 5, 24 )
•Repetition also matters
–( 5, 12, 24 ) ( 5, 12, 12, 24 )
•Finite sequences are also called tuples
–( 5, 12, 24 ) is a 3-tuple
–( 5, 12, 12, 24 ) is a 4-tuple
Sequence
Given two sets A and B
•The Cartesian product of A and B, denoted by
A x B, is the set of all possible 2-tuples with
the first item from A and the second item
from B
–E.g., A = {1, 2} and B = {x, y, z}
A x B = { (1,x), (1,y), (1,z), (2,x), (2,y), (2,z) }
Subgraph G
shown darker
Graph H
Graphs
•A path is a sequence of vertices
connected by edges
•If every two nodes have a path between
them, the graph is connected
•A cycle is a path that starts and ends
at the same vertex
•A tree is a connected graph with no
cycles
Graphs (Quick Quiz)
•Is the following graph connected?
•Is it a tree?
•Are there any cycles?
•How about the
darker subgraph?
Directed Graphs
•If lines are replaced by arrows, the graph
becomes directed
•The number of arrows pointing into a vertex is
called in-degree of the vertex
•The number of arrows pointing from a vertex
is called out-degree of the vertex
•A directed path is a path from one vertex to
the other vertex, following the direction of
the “ arrows”
Directed Graphs
•Is there a directed path from a to b?
b
Strings
•An alphabet = a set of characters
–E.g., The English Alphabet = {A,B,C,…,Z}
•A string = a sequence of characters
•A string over an alphabet
–A sequence of characters, with each character
coming from
•The length of a string w, denoted by |w|, is
the number of characters in w
•The empty string (written as ) is a string
of length 0
Strings
Let w = w1w2…wn be a string of length n
•A substring of w is a consecutive
subsequence of w (that is, wiwi+1…wj
for some i j)
•The reverse of w, denoted by wR, is
the string wn…w2 w1
•A set of strings is called a language
Next time
•Common Proof Techniques
•Part I: Automata Theory