Vous êtes sur la page 1sur 18

CS142

Introduction to Theory of
Computing
Components of Computer Theory
Theory of Mathematical Logic
Georg Cantor (1845-1918) Theory of Sets
David Hilbert (1862-1943) Algorithm and Rules of
Inference
Kurt Godel (1906-1978) Incompleteness Theorem
True statements without any possible proof
Alonzo Church, Stephen Cole Kleene, Emil Post
That there are problems that no algorithm could solve
Alan Mathison Turing (1912-1954)
Developed the concept of a theoretical universal-algorithm
machine
Theory of Computer Languages
Noam Chomsky
Mathematical models for the description of languages
Theoretically explore the capabilities
and limitations of computers
Complexity theory
What makes some problems computationally
hard and others easy?
Computability theory
What problems can be solved by a computer?
Automata theory
How can we mathematically model
computation?
Sets, multisets and sequences
Set
Order and repetition dont matter
{7,4,7,3} = {3,4,7}
Multiset
Order doesnt matter, repetition does
{7,4,7,3} = {3,4,7,7} = {3,4,7}
Sequence
Order and repetition matter
(7,4,7,3) = (3,4,7,7)
Finite sequence of k elements may be called
a k-tuple
Sets, multisets and sequences
Set
Subset A _ B
Proper subset A c B
Infinite set { 1, 2, 3, . . . }
Empty set { } or C
Venn Diagram

Set notation
Union: AB
Intersection: AB
Complement: A
Cartesian Product: AB
Also called cross product
Power set: P (A)
Example
A = {1,2}, B={2,3}, U = {xeN|x < 6}
AB =
AB =
A =
AB =
P (A) =
A = {1,2}, B={2,3}, U = {xeN|x < 6}
AB = {1,2,3}
AB = {2}
A = {3,4,5}
AB = {(1,2), (1,3), (2,2), (2,3)}
P (A) = {, {1}, {2}, {1,2}}
Function
Mechanism associating each input
value with exactly one output value
Domain: set of all possible input values
Range: set containing all possible output
values
f : D R

n f (n)
1
2
3
4
2
4
2
4
f : {1, 2, 3, 4} {2, 4}
f : {1, 2, 3, 4} {1, 2, 3, 4}
Relation
Predicate: function whose output
value is always either true or false
Relation: predicate whose domain is
the set AAA
If domain is all k-tuples of A, the
relation is a k-ary relation on A
Properties of Relations (Reflexive,
Irreflexive, Symmetric, Asymmetric,
Transitive)
Graphs
Nodes
Graphs
Edges
Graphs
Degree = 2 Degree = 1 Degree = 3
Graphs
Binary tree Subgraph
Directed graphs
1
5
4
3
2
{(2,1),(3,1),(4,3),(5,2)}
Alphabets and strings
Alphabet: any finite set

1
= {1,2,3}

2
= {o,|,}
String: finite sequence of symbols
from the given alphabet
1212123
o|||o|
Empty string, , contains no symbols of the
alphabet
Language: a set of strings

Boolean logic
Conjunction (and) .
Disjunction (or) v
Negation (not)
Exclusive or (xor)
Equality
Implication
Proof techniques
Construction
Prove a there exists statement by
finding the object that exists
Contradiction
Assume the opposite and find a
contradiction
Induction
Show true for a base case and show that
if the property holds for the value k,
then it must also hold for the value k + 1
Find the error in the following proof that 2 = 1.

Consider the equation
a = b
Multiply both sides by a to obtain
a
2
= ab
Subtract b
2
from both sides to get
a
2
b
2
= ab b
2

Now factor each side,
(a+b)(a-b) = b(a-b)
and divide each side by (a-b), to get
a+b = b
Finally, let a and b equal 1, which shows that
2 = 1