Lecture 0
Lecture 0
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 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 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 ¬ – 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