lecture 2 theory of computation
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 PresentationTRANSCRIPT
![Page 1: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/1.jpg)
LECTURE 2THEORY OF COMPUTATION
Yasir Imtiaz Khan
![Page 2: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/2.jpg)
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)
![Page 3: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/3.jpg)
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
![Page 4: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/4.jpg)
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.
![Page 5: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/5.jpg)
Language: a set of strings
String: a sequence of symbols from some alphabet
Example: Strings: cat, dog, house Language: {cat, dog, house}
zcba ,,,, Alphabet:
![Page 6: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/6.jpg)
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:
![Page 7: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/7.jpg)
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
![Page 8: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/8.jpg)
}9,,2,1,0{ Decimal numbers alphabet
102345 567463386
}1,0{Binary numbers alphabet
100010001 101101111
![Page 9: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/9.jpg)
STRING OPERATIONS
m
nbbbvaaaw
21
21
bbbaaaabba
mn bbbaaawv 2121
Concatenation
abbabbbaaa
![Page 10: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/10.jpg)
12aaaw nR
naaaw 21 ababaaabbb
Reverse
bbbaaababa
![Page 11: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/11.jpg)
STRING LENGTH
Length:
Examples:
naaaw 21nw
124
aaaabba
![Page 12: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/12.jpg)
PROOFSTheorem
Mathematical statements proved true.
Lemmas Assist in other proof so we proof
Corollaries Related statements are true (Conclude other
things)
![Page 13: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/13.jpg)
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.
![Page 14: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/14.jpg)
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.
![Page 15: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/15.jpg)
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
![Page 16: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/16.jpg)
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
![Page 17: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/17.jpg)
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
![Page 18: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/18.jpg)
EXAMPLE PROOF BY INDUCTION
![Page 19: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/19.jpg)
![Page 20: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/20.jpg)
![Page 21: Lecture 2 Theory of Computation](https://reader035.vdocument.in/reader035/viewer/2022062811/5681605b550346895dcf87af/html5/thumbnails/21.jpg)
AUTOMATA THEORY Deals with the properties of computation
models.
Abstract Model of digital computer so it should have features like
MemoryControl UnitALUInputOutput