Upload
roy
View
27
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Lecture 2 Theory of Computation. Yasir Imtiaz Khan. Graphs. Set of points with the lines connecting some of the points (also called simple graph). The points are called nodes or vertices and the lines are called edges. - PowerPoint PPT Presentation
Citation preview
LECTURE 2THEORY OF COMPUTATION
Yasir Imtiaz Khan
GRAPHS Set of points with the lines connecting some of the
points (also called simple graph). The points are called nodes or vertices and the
lines are called edges.
Numbers of edges at a particular node is the degree of that node.
G = (V, E)
GRAPHS CONTINUE…..Path: in a graph is a sequence of nodes
connected by edges.Simple Path: is a path that does not
repeat nodes.Connected Graph: if every two nodes
have a path between them.Cycle: A path is a cycle if it starts and ends
with same node.Simple Cycle: contains at least three
nodes and repeats only the first and last nodes
GRAPHS CONTINUE….Tree: if it is connected and has no simple
cyclesDirected Graph: If it has arrows instead
of linesStrongly Connected: if a directed path
connects every two nodes.
Language: a set of strings
String: a sequence of symbols from some alphabet
Example: Strings: cat, dog, house Language: {cat, dog, house}
zcba ,,,, Alphabet:
Languages are used to describe computation problems
},17,13,11,7,5,3,2{ PRIMES
},6,4,2,0{ EVEN
}9,,2,1,0{ Alphabet:
ALPHABETS AND STRINGS
abbawbbbaaavabu
ba,
baaabbbaabaabbaaba
Example Strings
Example Alphabet:
An alphabet is a set of symbols
A string is a sequence of symbols from the alphabet
String variables
}9,,2,1,0{ Decimal numbers alphabet
102345 567463386
}1,0{Binary numbers alphabet
100010001 101101111
STRING OPERATIONS
m
nbbbvaaaw
21
21
bbbaaaabba
mn bbbaaawv 2121
Concatenation
abbabbbaaa
12aaaw nR
naaaw 21 ababaaabbb
Reverse
bbbaaababa
STRING LENGTH
Length:
Examples:
naaaw 21nw
124
aaaabba
PROOFSTheorem
Mathematical statements proved true.
Lemmas Assist in other proof so we proof
Corollaries Related statements are true (Conclude other
things)
PROOF BY CONTRADICTION In a proof by contradiction we assume, along
with the hypotheses, the logical negation of the result we wish to prove and then reach some kind of contradiction.
That is, if we want to prove "If P, Then Q", we assume P and Not Q.
EXAMPLE (PROOF BY CONTRADICTION) Theorem. There are infinitely many prime
numbers. Proof. Assume to the contrary that there are
only finitely many prime numbers, and all of them are listed as follows: p1, p2 ..., pn.
Consider the number q = p1p2... pn + 1. The number q is either prime or composite. If we divided any of the listed primes pi into q, there would result a remainder of 1 for each i = 1, 2, ..., n. Thus, q cannot be composite. We conclude that q is a prime number, not among the primes listed above, contradicting our assumption that all primes are in the list p1, p2 ..., pn.
PROOF BY INDUCTION Mathematical induction: is a method of
mathematical proof typically used to establish that a given statement is true of all natural numbers.
Base Case Inductive Step
16
Theorem:
For all n>=1.
Proof #1: (by induction on n)
Basis:n = 1
1 = 1
2)1(
1
nnin
i
2)11(11
1
i
i
17
Inductive hypothesis:Suppose that for some k>=1.
Inductive step:We will show that
by the inductive hypothesis
It follows that for all n>=1. �
2)1(
1
kkik
i
2)2)(1(1
1
kkik
i
)1(1
1
1
kiik
i
k
i
)1(2)1(
kkk
2)1(2)1(
kkk
2)2)(1(
kk
2)1(
1
nnin
i
EXAMPLE PROOF BY INDUCTION
AUTOMATA THEORY Deals with the properties of computation
models.
Abstract Model of digital computer so it should have features like
MemoryControl UnitALUInputOutput