21
LECTURE 2 THEORY OF COMPUTATION Yasir Imtiaz Khan

Lecture 2 Theory of Computation

  • Upload
    roy

  • View
    27

  • Download
    0

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

Page 1: Lecture 2 Theory of Computation

LECTURE 2THEORY OF COMPUTATION

Yasir Imtiaz Khan

Page 2: Lecture 2 Theory of Computation

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

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

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

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

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

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

}9,,2,1,0{ Decimal numbers alphabet

102345 567463386

}1,0{Binary numbers alphabet

100010001 101101111

Page 9: Lecture 2 Theory of Computation

STRING OPERATIONS

m

nbbbvaaaw

21

21

bbbaaaabba

mn bbbaaawv 2121

Concatenation

abbabbbaaa

Page 10: Lecture 2 Theory of Computation

12aaaw nR

naaaw 21 ababaaabbb

Reverse

bbbaaababa

Page 11: Lecture 2 Theory of Computation

STRING LENGTH

Length:

Examples:

naaaw 21nw

124

aaaabba

Page 12: Lecture 2 Theory of Computation

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

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

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

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

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

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

EXAMPLE PROOF BY INDUCTION

Page 19: Lecture 2 Theory of Computation
Page 20: Lecture 2 Theory of Computation
Page 21: Lecture 2 Theory of Computation

AUTOMATA THEORY Deals with the properties of computation

models.

Abstract Model of digital computer so it should have features like

MemoryControl UnitALUInputOutput