0% found this document useful (0 votes)
9 views22 pages

Lecture 0

The document outlines mathematical preliminaries, including topics such as sets, sequences, functions, relations, graphs, strings, languages, and Boolean logic. It provides definitions, notations, and examples for each topic, emphasizing the importance of understanding these foundational concepts in mathematics and computation. Additionally, it includes housekeeping details for a course, such as the timetable, assessment structure, and prescribed text.

Uploaded by

pascalchitete123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views22 pages

Lecture 0

The document outlines mathematical preliminaries, including topics such as sets, sequences, functions, relations, graphs, strings, languages, and Boolean logic. It provides definitions, notations, and examples for each topic, emphasizing the importance of understanding these foundational concepts in mathematics and computation. Additionally, it includes housekeeping details for a course, such as the timetable, assessment structure, and prescribed text.

Uploaded by

pascalchitete123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Mathematical Preliminaries

Mwawi F Msiska

2021
House Keeping

I Timetable
1. Lectures: Mon Tue Wed
2. Tutorial:
I Google Classroom: e2szmfa
I Assessment: Three Tests
1. Test 1 – 21 Dec (15%)
2. Test 2 – 25 Jan (10%)
3. Test 3 – 22 Feb (10%)
4. Tutorials – MUST ATTEND (5%)
I Prescribed Text: Sipser, M. (2012). Introduction to the
Theory of Computation (3rd ed.). Course Technology
Sets

I Defn. A set is a group of objects represented as a unit.


I what objects types are allowed?
I Anything!
I Integers, Strings, Cars ...
I Even sets! Can have a set of sets!
I Terminology. The objects in sets are called members or
elements
I Can describe a set by a comma-separated list enclosed in
braces
I e.g. {a,3, g}
I {1, 2, 3, . . .}
I {. . . , −2, −1, 0, 1, 2, . . .}
I Can also describe a set by stating a rule for set membership
I e.g. {n | n = 2m + 1, for an integer m}
Sets

I Order of elements does not matter


I {a, b, c,} = {b, c, a}
I Duplicate elements do not matter
I {23, 7, 8, 91} = {23, 7, 8, 8, 23, 91}
I When only duplicates matter, then we have a multiset
I As multisets, {23, 7, 8, 91} =
6 {23, 7, 8, 8, 23, 91}
I When both order and duplicates matter, then we have a
sequence
I As sequences,
{23, 7, 8, 91} =
6 {23, 23, 7, 8, 91} =
6 {23, 7, 8, 8, 23, 91}
I Notation
I Set membership: 8 ∈ {23, 7, 8, 91}
/ {n | n = m2 , m ∈ N}
I non-membership: 5 ∈
Sets

I Notation
I Set variables: Use capital letters – A, B, C, Q, R, ...
I Let A = {1, 2, 3, 4}, B = {1, 2, 4}, N = {1, 2, 3, . . .},
C = {n |n = m2 , m ∈ N, m < 5} D = {3, 5}
I Subset: X ⊆ Y
I B ⊆ A, A ⊆ N B 6⊆ C
I Proper subset X ⊂ Y
I A ⊂ N, B ⊂ A
I B⊂6 C
I Empty set: ∅
I Union: X ∪ Y
I A ∪ D = {1, 2, 3, 4, 5}, A∪B =A
I Intersection: X ∩ Y
I A ∩ B = B, A ∩ D = {3}, B ∩D =∅
I Notation
I Universal set: set of all elements under consideration
I Complement: X
I e.g. Let U = {1, 2, 3, . . . , 10} and A = {1, 2, 3, 5, 7}
I Then A = {4, 6, 8, 9, 10}
I Power set: set of all subsets of a given set
I Let A = {1, 2, 3}
I The power set of A is denoted 2A
2A = {∅, {1}, {2}, {3}, {1, 2}, {2, 3}, {1, 3}, {1, 2, 3}}
Sequences

I Defn. A sequence is a list of objects in some order


I Order matters
I Duplicates matter
I Notation Comma-separated list in parentheses
I e.g. (2, 6, 8, 16)
I (3, 6, 9) 6= (3, 3, 3, 6, 6, 9) 6= (3, 3, 6, 3, 3, 9)
I A finite sequence is called a tuple
I 1-tuple – e.g. (37)
I 2-tuple (also called a pair) – e.g. (3, 4)
I triple, quadruple, quintuple, . . . , n-tuple
Sequences
I Defn. Given two sets A and B, the Cartesian product (also
called the cross product), denoted A × B, is a set of all pairs
where the first element is drawn from A and the second from
B.
I e.g. Let A = {1, 2}, B = {a, b, c} and C = {x, y }
I Then A × B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}
I A×B ×C =
{(1, a, x), (a, a, y ), (1, b, x), (1, b, y ), (1, c, x), (1, c, y ),
(2, a, x), (2, a, y ), (2, b, x), (2, b, y ), (2, c, x), (2, c, y )}
I In general, if A1 , A2 , . . . Ak are sets, Then the Cartesian
product of the k sets,
A1 × A2 × . . . × Ak = {(a1 , a2 , . . . , ak ) | ai ∈ Ai , 1 ≤ i ≤ k}

I You also compute a Cartesian product involving just one set.


k
z }| {
A × A × A × . . . × A = Ak
Functions

I A fundamental mathematical object that sets up input-out


relationship
I The same input always produces the same output
I Notation Let f be a function.
I If f associates the input a with the output b, then we write
f (a) = b
I A function is also called a mapping. Thus, when f (a) = b we
say that the function f maps a to b
I e.g. The add function. add(a,b) = a+b.
I Domain – set of possible inputs to a function
I Range – set of possible outputs
I Notation If the function f has domain D and range R, we
write f : D −→ R.
I e.g. f (x) = x 2 – f : R −→ R; add: R2 −→ R
Functions

I Consider the function f : Z −→ Z defined as follows: f (a) = a


if a ≥ 0, f (a) = −a if a ≤ 0.
I The range of this function is actually a subset of Z.
I When a function exhausts all elements of the range, it is said
to be onto.
I Can specify a function by either giving a procedure for
computing the output, or giving a table that lists inputs and
corresponding output.
n f (n)
0 1
I e.g. 1 2
2 3
3 4
4 0
I f : Z5 −→ Z5 , f (n) = (n + 1) mod 5
Functions
I Consider the general case f : A1 × A2 × . . . × Ak −→ B i.e
f (a1 , a2 , . . . , ak ) = b
I k is the arity of the function
I A function with an arity k is called a k-ary function
I 1-ary – unary, 2-ary – binary, etc
I Prefix notation – e.g add(a, b)
I Infix notation – e.g. a + b
I Predicate/property – a function whose range is {TRUE,
FALSE}
I e.g. even: Z −→ {TRUE, FALSE}
I even(8) = TRUE, even(21) = FALSE
I Given a set A, relation on A is a predicate whose domain is
Ak
I Also called a k-ary relation
I Binary relations typically use infix notaton. e.g. 3 < 5
Relations

I Given R a binary relation on set A, when we write aRb, we


mean aRb = TRUE
I e.g. 3 < 5 means 3 < 5 = TRUE
I In general if R is a k-ary relation on A, then R(a1 , a2 , . . . , ak )
means R(a1 , a2 , . . . , ak ) = TRUE
Graphs

I Defn A graph G = (V , E )
I D is a set of vertices/nodes
I E = D 2 is a set of edges - Can think of it as a line connecting
two nodes
I undirected/directed
I Undirected graphs
I Degree
I Labelled graph
I Defn. A subgraph, H = (V 0 , E , ) of a graph G = (V , E ) is a
graph such that V 0 ⊆ V and edges of H are edges of G on
corresponding nodes.
Graphs

I Path
I Simple Path
I Cycle
I Simple Cycle
I Connected graph
I tree
I root
I leaves
Graphs

I Directed graph
I Indegree/outdegree
I Directed path
I Strongly connected
Strings and Languages

I Defn. An alphabet is any nonempty finite set.


I Members of an alphabet are called symbols
I Notation Use Σ or Γ to denote an alphabet
I e.g.
Σ1 = {a,b}
Σ2 = {0, 1}
Γ = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w, x,y,z}
I Defn. A string over an alphabet is a sequence of symbols
drawn from the alphabet.
I Uses different notation from regular sequences
– no parentheses
– and no separator
Strings and Languages

I e.g. Let Σ = {a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p, q,r,s,t,u,v,w,x,y,z}


Then paground is a string over Σ
I If w is a string over Σ, then the length of w , denoted |w | is
the number of symbols in w
I An empty string, denoted ε, has no symbols
– |ε| = 0
I If |w | = n, we can write w = w1 w2 · · · wn , where each wi ∈ Σ
I w R = wn wn−1 · · · w1
Strings and Languages

I Let x = x1 x2 · · · xn and y = y1 y2 · · · ym be strings. Then the


concatenation of x and y , xy = x1 x2 · · · xn y1 y2 · · · ym
I In general xy 6= yx
k
I xk
z }| {
= xx · · · x
I Defn. A string h is a substring of a string w if h appears
consecutively in w
I e.g. gram is a substring of programmer
I Lexicographic ordering
I Defn. A language is a set of strings.
Boolean Logic

I ¬ – Negation (NOT)
p ¬p
T F
F T

I ∧– Conjunction (AND)
p q p∧q
T T T
T F F
F T F
F F F
Boolean Logic

I ∨– Disjunction (OR)
p q p∨q
T T T
T F T
F T T
F F F

I ⇒– Implication
p q p⇒q
T T T
T F F
F T T
F F T
Boolean Logic

I ⇔– Equality
p q p⇔q
T T T
T F F
F T F
F F T

I ⊕– Exclusive Or (XOR)
p q p⊕q
T T F
T F T
F T T
F F F
Boolean Logic

I All Boolean operations can be expressed AND and NOT


operations
I Some identities
p∨q ¬(¬p ∧ ¬q)
p⇒q ¬p ∨ q
p⇔q (p ⇒ q) ∧ (q ⇒ p)
p⊕q ¬(p ⇔ q)
I Distributive laws
– AND distributes over OR
– OR distributes over AND

You might also like