Top Banner
September 8, 2009 Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to Welcome to CS 620 – CS 620 – Theory of Computation Theory of Computation Fall 2009 Fall 2009 Instructor: Marc Pomplun Instructor: Marc Pomplun
44

September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

Jan 02, 2016

Download

Documents

gary owen
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

1

Welcome toWelcome to

CS 620 – CS 620 – Theory of ComputationTheory of Computation

Fall 2009Fall 2009

Instructor: Marc PomplunInstructor: Marc Pomplun

Page 2: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

2

Instructor – Marc PomplunInstructor – Marc Pomplun

Office:Office: S-3-171 S-3-171

Lab:Lab: S-3-135 S-3-135

Office Hours:Office Hours: Tuesdays 17:30 - 19:00 Tuesdays 17:30 - 19:00 Thursdays 14:30 - 16:00 Thursdays 14:30 - 16:00

Phone:Phone: 287-6443 (office) 287-6443 (office) 287-6485 (lab) 287-6485 (lab)

E-Mail:E-Mail: [email protected]

Homepage: Homepage: www.cs.umb.edu/~marc/cs620/www.cs.umb.edu/~marc/cs620/

Page 3: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

3

I’m from LI’m from Lübeckübeck, Germany:, Germany:

Page 4: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

4

And what is my area of research?And what is my area of research?

It’s Cognitive Science, esp. eye movementsIt’s Cognitive Science, esp. eye movements

Page 5: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

5

A poor guinea pig:A poor guinea pig:

Page 6: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

6

Computer Vision:Computer Vision:

Page 7: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

7

Modeling of Brain FunctionsModeling of Brain Functions

Page 8: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

8

Modeling of Brain FunctionsModeling of Brain Functionsunit and connectionin the interpretive network

unit and connectionin the gating network

unit and connectionin the top-down bias network

layer l +1

layer l -1

layer l

Page 9: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

9

Example: Distribution of Visual AttentionExample: Distribution of Visual Attention

Page 10: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

10

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 11: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

11

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 12: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

12

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 13: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

13

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 14: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

14

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 15: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

15

Selectivity in Complex ScenesSelectivity in Complex Scenes

Page 16: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

16

Human-Computer Interfaces:Human-Computer Interfaces:

Page 17: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

17

Now back to CS 620:Now back to CS 620:TextbookTextbook:: Martin D. Davis, Ron Sigal & Elaine J. Weyuker: Computability, Complexity, and Languages. Fundamentals of Theoretical Computer Science. Elsevier Science, 2nd Edition 1994. ISBN: 0122063821.

On the Web:On the Web:http://www.cs.umb.edu/~marc/cs620/http://www.cs.umb.edu/~marc/cs620/(contains all kinds of course information and also my (contains all kinds of course information and also my slides in PPT, PDF and HTML formats, updated slides in PPT, PDF and HTML formats, updated afterafter each session)each session)

Page 18: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

18

Your EvaluationYour Evaluation

• 4 4 sets of sets of exercises exercises 20%20%

• midterm midterm (1.5 hours)(1.5 hours) 35%35%

• final final exam (2.5 hours) exam (2.5 hours) 45%45%

Page 19: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

19

GradingGrading

95%: A95%: A 90%: A-90%: A-

74%: C+74%: C+ 70%: C70%: C 66%: C- 66%: C-

86%: B+86%: B+ 82%: B 82%: B 78%: B- 78%: B-

62%: D+62%: D+ 56%: D 56%: D 50%: D- 50%: D-

50%: F50%: F

For the assignments, exams and your course grade, For the assignments, exams and your course grade, the following scheme will be used to convert the following scheme will be used to convert percentages into letter grades:percentages into letter grades:

Page 20: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

20

Complaints about GradingComplaints about Grading

If you think that the grading of your If you think that the grading of your assignment or exam was unfair, assignment or exam was unfair,

• write down your complaint (handwriting is OK),write down your complaint (handwriting is OK),• attach it to the assignment or exam, attach it to the assignment or exam, • and give it to me or put it in my mailbox.and give it to me or put it in my mailbox.

I will re-grade the I will re-grade the wholewhole exam/assignment and exam/assignment and return it to you in class.return it to you in class.

Page 21: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

21

What is so interesting about theWhat is so interesting about theTheory of Computation?Theory of Computation?

• Theory of Computation is the most fundamental Theory of Computation is the most fundamental subject in computer science.subject in computer science.

• What you learn in this course applies to all What you learn in this course applies to all computers and all programming languages that will computers and all programming languages that will ever exist.ever exist.

• You will understand the capabilities of algorithms in You will understand the capabilities of algorithms in general.general.

• For example, you will learn about problems that For example, you will learn about problems that cannot be solved algorithmically.cannot be solved algorithmically.

Page 22: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

22

PreliminariesPreliminaries

• Sets and n-tuplesSets and n-tuples• FunctionsFunctions• Alphabets and StringsAlphabets and Strings• PredicatesPredicates• QuantifiersQuantifiers• Proof by ContradictionProof by Contradiction• Mathematical InductionMathematical Induction

Page 23: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

23

Set TheorySet Theory

• Set: Collection of objects (“elements”)Set: Collection of objects (“elements”)

• aaAA “a is an element of A”“a is an element of A” “a is a member of A”“a is a member of A”

• aaAA “a is not an element of A”“a is not an element of A”

• A = {aA = {a11, a, a22, …, a, …, ann} } “A contains…”“A contains…”

• Order of elements is meaninglessOrder of elements is meaningless

• It does not matter how often the same element is It does not matter how often the same element is listed.listed.

Page 24: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

24

Cartesian ProductCartesian ProductThe The ordered n-tupleordered n-tuple (a (a11, a, a22, a, a33, …, a, …, ann) is an ) is an

ordered collectionordered collection of objects. of objects.

Two ordered n-tuples (aTwo ordered n-tuples (a11, a, a22, a, a33, …, a, …, ann) and ) and

(b(b11, b, b22, b, b33, …, b, …, bnn) are equal if and only if they ) are equal if and only if they

contain exactly the same elements contain exactly the same elements in the same in the same orderorder, i.e. a, i.e. aii = b = bii for 1 for 1 i i n. n.

The The Cartesian productCartesian product of two sets is defined as: of two sets is defined as:

AAB = {(a, b) | aB = {(a, b) | aA A b bB}B}

Example:Example: A = {x, y}, B = {a, b, c} A = {x, y}, B = {a, b, c}AAB = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}B = {(x, a), (x, b), (x, c), (y, a), (y, b), (y, c)}

Page 25: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

25

Cartesian ProductCartesian Product

Note that:Note that:

• AA = = • A = A = • For non-empty sets A and B: AFor non-empty sets A and B: AB B A AB B B BAA

• |A|AB| = |A|B| = |A||B||B|

The Cartesian product of The Cartesian product of two or more setstwo or more sets is is defined as:defined as:

AA11AA22……AAnn = {(a = {(a11, a, a22, …, a, …, ann) | a) | aiiAAii for 1 for 1 i i

n}n}

Page 26: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

26

Set OperationsSet Operations

Union: AUnion: AB = {x | xB = {x | xA A x xB}B}

Example:Example: A = {a, b}, B = {b, c, d} A = {a, b}, B = {b, c, d}

AAB = {a, b, c, d} B = {a, b, c, d}

Intersection: AIntersection: AB = {x | xB = {x | xA A x xB}B}

Example:Example: A = {a, b}, B = {b, c, d} A = {a, b}, B = {b, c, d}

AAB = {b}B = {b}

Page 27: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

27

Set OperationsSet Operations

Two sets are called Two sets are called disjointdisjoint if their intersection is if their intersection is empty, that is, they share no elements:empty, that is, they share no elements:

AAB = B =

The The differencedifference between two sets A and B contains between two sets A and B contains exactly those elements of A that are not in B:exactly those elements of A that are not in B:

A-B = {x | xA-B = {x | xA A x xB}B}

Example:Example: A = {a, b}, B = {b, c, d}, A = {a, b}, B = {b, c, d}, A-B = {a}A-B = {a}

Page 28: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

28

Set OperationsSet Operations

The The complementcomplement of a set A contains exactly those of a set A contains exactly those elements under consideration that are not in A: elements under consideration that are not in A: -A = U-A-A = U-A

Example:Example: U = U = NN, B = {250, 251, 252, …}, B = {250, 251, 252, …} -B = {0, 1, 2, …, 248, 249}-B = {0, 1, 2, …, 248, 249}

Page 29: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

29

FunctionsFunctions

A A functionfunction f from a set A to a set B is an f from a set A to a set B is an assignmentassignment of exactly one element of B to each of exactly one element of B to each element of A.element of A.

We writeWe write

f(a) = bf(a) = b

if b is the unique element of B assigned by the if b is the unique element of B assigned by the function f to the element a of A.function f to the element a of A.

If f is a function from A to B, we writeIf f is a function from A to B, we write

f: Af: ABB

(note: Here, “(note: Here, ““ has nothing to do with if… then)“ has nothing to do with if… then)

Page 30: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

30

FunctionsFunctions

If f:AIf f:AB, we say that A is the B, we say that A is the domaindomain of f and B is of f and B is the the codomaincodomain of f. of f.

If f(a) = b, we say that b is the If f(a) = b, we say that b is the imageimage of a and a is of a and a is the the pre-imagepre-image of b. of b.

The The rangerange of f:A of f:AB is the set of all images of B is the set of all images of elements of A.elements of A.

We say that f:AWe say that f:AB B mapsmaps A to B. A to B.

Page 31: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

31

Alphabets and StringsAlphabets and Strings

An An alphabetalphabet is a finite, nonempty set A of objects is a finite, nonempty set A of objects called called symbolssymbols..

A A wordword ( (stringstring) on A is an n-tuple of symbols of A.) on A is an n-tuple of symbols of A.

Instead of using the notation (aInstead of using the notation (a11, a, a22, …, a, …, ann) we can ) we can

just write ajust write a11aa22…a…ann..

The set of all words on A is written A*.The set of all words on A is written A*.

Any subset of A* is called a Any subset of A* is called a languagelanguage on A. on A.

Page 32: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

32

Alphabets and StringsAlphabets and Strings

ConcatenationConcatenation of strings: of strings:

Let string u = monkey, v = businessLet string u = monkey, v = business

uvuv = monkeybusiness= monkeybusiness

= businessmonkey= businessmonkeyvuvu

Page 33: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

33

Propositional FunctionsPropositional Functions

Propositional function (open sentence):Propositional function (open sentence):

statement involving one or more variables,statement involving one or more variables,

e.g.: x-3 > 5.e.g.: x-3 > 5.

Let us call this propositional function P(x), where P Let us call this propositional function P(x), where P is the is the predicatepredicate and x is the and x is the variablevariable..

What is the truth value of P(2) ?What is the truth value of P(2) ? falsefalse

What is the truth value of P(8) ?What is the truth value of P(8) ?

What is the truth value of P(9) ?What is the truth value of P(9) ?

falsefalse

truetrue

Page 34: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

34

Propositional FunctionsPropositional Functions

Let us consider the propositional function Let us consider the propositional function Q(x, y, z) defined as: Q(x, y, z) defined as:

x + y = z.x + y = z.

Here, Q is the Here, Q is the predicatepredicate and x, y, and z are the and x, y, and z are the variablesvariables..

What is the truth value of Q(2, 3, 5) ?What is the truth value of Q(2, 3, 5) ? truetrue

What is the truth value of Q(0, 1, 2) ?What is the truth value of Q(0, 1, 2) ?

What is the truth value of Q(9, -9, 0) ?What is the truth value of Q(9, -9, 0) ?

falsefalse

truetrue

Page 35: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

35

Universal QuantificationUniversal Quantification

Let P(x) be a propositional function.Let P(x) be a propositional function.

Universally quantified sentenceUniversally quantified sentence::

For all x in the universe of discourse P(x) is true.For all x in the universe of discourse P(x) is true.

Using the universal quantifier Using the universal quantifier ::

x P(x) x P(x) “for all x P(x)” or “for every x P(x)”“for all x P(x)” or “for every x P(x)”

(Note: (Note: x P(x) is either true or false, so it is a x P(x) is either true or false, so it is a proposition, not a propositional function.)proposition, not a propositional function.)

Page 36: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

36

Universal QuantificationUniversal Quantification

Example: Example:

S(x): x is a UMB student.S(x): x is a UMB student.

G(x): x is a genius.G(x): x is a genius.

What does What does x (S(x) x (S(x) G(x)) G(x)) mean ? mean ?

““If x is a UMB student, then x is a genius.”If x is a UMB student, then x is a genius.”

oror

““All UMB students are geniuses.”All UMB students are geniuses.”

Page 37: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

37

Existential QuantificationExistential Quantification

Existentially quantified sentenceExistentially quantified sentence::There exists an x in the universe of discourse for There exists an x in the universe of discourse for which P(x) is true.which P(x) is true.

Using the existential quantifier Using the existential quantifier ::x P(x) x P(x) “There is an x such that P(x).”“There is an x such that P(x).”

“ “There is at least one x such that P(x).”There is at least one x such that P(x).”

(Note: (Note: x P(x) is either true or false, so it is a x P(x) is either true or false, so it is a proposition, but no propositional function.)proposition, but no propositional function.)

Page 38: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

38

Existential QuantificationExistential Quantification

Example: Example: P(x): x is a UMB professor.P(x): x is a UMB professor.G(x): x is a genius.G(x): x is a genius.

What does What does x (P(x) x (P(x) G(x)) G(x)) mean ? mean ?

““There is an x such that x is a UMB professor and x There is an x such that x is a UMB professor and x is a genius.”is a genius.”oror““At least one UMB professor is a genius.”At least one UMB professor is a genius.”

Page 39: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

39

Disproof by CounterexampleDisproof by Counterexample

A counterexample to A counterexample to x P(x) is an object c so that x P(x) is an object c so that P(c) is false. P(c) is false.

Statements such as Statements such as x (P(x) x (P(x) Q(x)) can be Q(x)) can be disproved by simply providing a counterexample.disproved by simply providing a counterexample.

Statement: “All birds can fly.”Statement: “All birds can fly.”

Disproved by counterexample: Penguin.Disproved by counterexample: Penguin.

Page 40: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

40

InductionInduction

The The principle of mathematical inductionprinciple of mathematical induction is a is a useful tool for proving that a certain predicate is useful tool for proving that a certain predicate is true for true for all natural numbersall natural numbers..

It cannot be used to discover theorems, but only to It cannot be used to discover theorems, but only to prove them.prove them.

Page 41: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

41

InductionInductionIf we have a propositional function P(n), and we If we have a propositional function P(n), and we want to prove that P(n) is true for any natural want to prove that P(n) is true for any natural number n, we do the following:number n, we do the following:

• Show that P(0) is true.Show that P(0) is true. (basis step)(basis step)• Show that if P(n) then P(n + 1) for any nShow that if P(n) then P(n + 1) for any nN.N. (inductive step)(inductive step)• Then P(n) must be true for any nThen P(n) must be true for any nN. N. (conclusion)(conclusion)

Page 42: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

42

InductionInduction

Example (“Gauss”):Example (“Gauss”):

1 + 2 + … + n = n (n + 1)/21 + 2 + … + n = n (n + 1)/2

1.1. Show that P(0) is true.Show that P(0) is true.(basis step)(basis step)

For n = 0 we get 0 = 0. For n = 0 we get 0 = 0. True.True.

Page 43: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

43

InductionInduction

2.2. Show that if P(n) then P(n + 1) for any nShow that if P(n) then P(n + 1) for any nNN. . (inductive step)(inductive step)

1 + 2 + … + n = n (n + 1)/21 + 2 + … + n = n (n + 1)/2

1 + 2 + … + n 1 + 2 + … + n + (n + 1)+ (n + 1) = n (n + 1)/2 = n (n + 1)/2 + (n + 1)+ (n + 1)

= (n + 1) (n/2 + 1) = (n + 1) (n/2 + 1)

= (n + 1) (n + 2)/2= (n + 1) (n + 2)/2

= = (n + 1)(n + 1) (((n + 1)(n + 1) + + 1)/21)/2

Page 44: September 8, 2009Theory of Computation Lecture 1: Introduction and Preliminaries 1 Welcome to CS 620 – Theory of Computation Fall 2009 Instructor: Marc.

September 8, 2009 Theory of ComputationLecture 1: Introduction and Preliminaries

44

InductionInduction

3.3. Then P(n) must be true for any nThen P(n) must be true for any nN. N. (conclusion)(conclusion)

1 + 2 + … + n = n (n + 1)/2 is true for all n1 + 2 + … + n = n (n + 1)/2 is true for all nN.N.

End of proof.End of proof.

End of first lecture!End of first lecture!