CS-850: Advanced Theory of Computation: Adnan Rashid

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 28

CS-850: Advanced

Theory of Computation
(Spring 2020)

Lecture 2
Adnan Rashid

Adnan Rashid Advanced Theory of Computation 1


Sets
▪ Natural Numbers, =
▪ Integers, =
▪ Empty set, = { }
▪ Union of A and B,
▪ Intersection of A and B,
▪ Complement of A,
▪ Cross product A x B
• =
• Tuple (4, b)
Adnan Rashid Advanced Theory of Computation 2
Sets
▪ Power set P(A)

• A = {0, 1}, P(A) =
▪ Venn Diagrams

Adnan Rashid Advanced Theory of Computation 3


Functions
▪ f(x) = y
• f: Domain → Range
• Arity
• Unary f(a), -a Prefix
• Binary g(a,b) a + b Infix
• g: →
• K-ary h (a,b,c,d)

Adnan Rashid Advanced Theory of Computation 4


Functions
▪ Predicates
▪ P: Domain → {True, False}
▪ Property
• P(x) ODD (4) = False
▪ Relation
▪ R: A x A x A x . . . x A → {True, False}
▪ Binary relations
• Greater (a, b) a>b

Adnan Rashid Advanced Theory of Computation 5


Functions
▪ Reflexive

▪ Symmetric

▪ Transitive

Adnan Rashid Advanced Theory of Computation 6


Graphs
▪ G = (V,E)
• V: Vertices (nodes), E: Edges

▪ Directed/undirected edges
▪ Labeled/unlabeled nodes
▪ Subgraphs
Adnan Rashid Advanced Theory of Computation 7
Graphs
▪ Paths Cycles

▪ Connected
▪ Unconnected

Adnan Rashid Advanced Theory of Computation 8


Graphs
▪ In-degree Out-degree

▪ Binary relation Directed graph


• R (a,b) = True
• aRb a b

Adnan Rashid Advanced Theory of Computation 9


Activity
▪ Write In-degree and Out-degree for each node of the following
graph

Node In- Out-


degree degree
1 2 2
2 1 2
3 1 0
4 2 0
5 1 2
6 1 2

Adnan Rashid Advanced Theory of Computation 10


Trees
▪ Graph with directed edges

▪ No cycles

▪ Root node

Adnan Rashid Advanced Theory of Computation 11


Graphs
▪ DAG (Directed Acyclic graph)
• Shared parents allowed

Adnan Rashid Advanced Theory of Computation 12


Graphs
▪ Formal Description of the graphs
• G = (V, E), where V and E are sets of vertices and
edges respectively.

Adnan Rashid Advanced Theory of Computation 13


Activity
▪ Write the formal description of the following
graph

Adnan Rashid Advanced Theory of Computation 14


Strings
▪ = Alphabets = Set of Symbols
• Always a finite set

▪ String
• A finite sequence of symbols from the alphabet
• For example, w = bacaddcb
• Length of a string = |w| = |bacaddcb| = 8
• Empty String,
Adnan Rashid Advanced Theory of Computation 15
Strings
▪ Concatenation of the strings x and y is xy
• x = acb, y = bdda, xy = acbbdda

▪ Reverse of a string
= bca

Adnan Rashid Advanced Theory of Computation 16


Language
▪ A language is a set of strings

▪ Empty language

Adnan Rashid Advanced Theory of Computation 17


Language
▪ How to describe languages?
• Enumeration

• Regular expressions

• Context-free Grammars

Adnan Rashid Advanced Theory of Computation 18


Boolean Logic
▪ AND, Conjunction
▪ OR, Disjunction
▪ NOT, Negation
▪ Implication
▪ Equality

Adnan Rashid Advanced Theory of Computation 19


Boolean Logic
▪ Distributive Laws

▪ Demorgan’s Law

Adnan Rashid Advanced Theory of Computation 20


First-order Logic
▪ Involves quantification over the variables

▪ Predicates: P(x), R(x), P(y)

▪ Functions: g(f(y))

Adnan Rashid Advanced Theory of Computation 21


Definitions, Theorems and
Lemmas
▪ Definition
▪ Theorem
▪ Known to be true
▪ Proof
• Based on mathematical arguments
• Sometimes brief and sometimes elaborated
▪ Lemmas
▪ Proved in isolation
▪ Part of a larger proof and is reusable in the main proof

Adnan Rashid Advanced Theory of Computation 22


Corollaries and
conjectures
▪ Corollary
• A true statement (theorem)
• Derived/proved easily from the main theorem
▪ Conjecture
• Possibly true and may be unproven
• For example, Kepler conjectures

Adnan Rashid Advanced Theory of Computation 23


Proofs

▪ Proof by construction

▪ Proof by contradiction

▪ Proof by induction

Adnan Rashid Advanced Theory of Computation 24


Proofs
▪ Proof by construction
• Theorem: Some object “A” exists
• Proof: Show that how to construct “A”
▪ Proof by contradiction
▪ Theorem: “P” is true
▪ Proof:
• Assume “P” is false.
• Apply some logical reasoning.
• Conclude the truth of something known to be false.

Adnan Rashid Advanced Theory of Computation 25


Proofs
▪ Proof by induction
▪ Theorem: “P” is true for all … [i ≥ 0]
▪ Proof:
▪ Base Case:
• Show P(0) is true
▪ Induction Case:
• Assume P(i) is true.
• Use logical reasoning to prove P(i+1) is true.
▪ Conclusion: P is true for all i ≥ 0.

Adnan Rashid Advanced Theory of Computation 26


Proofs
▪ Structural induction
▪ Theorem: “P” is true for all nodes of the tree.
▪ Proof:
• Base case: show that “P” is true
• for the root of the tree.
• Induction case: Try proving “P”
is true for an arbitrary node “x”.
• Assume “P” is true for all
ancestors of “x”.

Adnan Rashid Advanced Theory of Computation 27


Thank you!

Adnan Rashid Advanced Theory of Computation 28

You might also like