Presentation is loading. Please wait.

Presentation is loading. Please wait.

Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction to Induction Steve Wolfman 1.

Similar presentations


Presentation on theme: "Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction to Induction Steve Wolfman 1."— Presentation transcript:

1 snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction to Induction Steve Wolfman 1

2 Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Single-Elimination Tournaments –Binary Trees A First Pattern for Induction Induction on Numbers Next Lecture Notes 2

3 Quiz Notes You’re faced with a problem like “How many teams can play in a 100 round tournament?” or “How many teams can play in an n-round tournament?” You don’t know the answer. What can you do? Strategies: Try to clearly define terms (What’s a tournament? What’s a round?) Try a smaller number. 100 is hard, what about 1 or 2? Write the problem (or a small version) out as a story and figure out which parts of the story matter. 3

4 Quiz Notes: Summations/Products All of these were tricky. It’s worth practicing with them since they come up in induction proofs. For example, let’s play with 4

5 Quiz Notes: Summations/Products All of these were tricky. It’s worth practicing with them since they come up in induction proofs. First, let’s change the bounds. We can do that by “shifting” k over. Instead of “k”, use “k+1” and decrease the bounds by 1, and the formula stays the same: 5

6 Quiz Notes: Summations/Products All of these were tricky. It’s worth practicing with them since they come up in induction proofs. Now, let’s split the sum. First, break up the fraction, then just tease apart the two addends: 6 Now, look at the first quiz problem again. Which responses are correct?

7 Quiz Notes: Summations/Products Or, the easier way. Try a (small) value for n. For example, with n=3, are these two equal? 7 If they’re equal for n=3, does that prove they’re always equal? If they’re not equal for n=3, does that prove they’re not always equal?

8 Lecture Prerequisites Read Section 4.1. Note: 4.1 is background information. We don’t intend to directly assess this material, but assignment and exam questions may require skills and knowledge from 4.1 to answer. Solve problems like Exercise Set 4.1, #1-8, 12- 14, 18-31, 37-44, 52-60. Complete the open-book, untimed quiz on Vista that’s due before the next class. 8

9 Learning Goals: Pre-Class By the start of class, you should be able to: –Convert sequences to and from explicit formulas that describe the sequence. –Convert sums to and from summation/”sigma” notation. –Convert products to and from product/”pi” notation. –Manipulate formulas in summation/product notation by adjusting their bounds, merging or splitting summations/products, and factoring out values. 9

10 Learning Goals: In-Class By the end of this unit, you should be able to: –Establish properties of self-referential structures using inductive proofs that naturally build on those self-references. 10

11 Where We Are in The Big Stories Theory How do we model computational systems? Now: Developing a new proof technique that’s perfect for algorithms involving (111 people) loops or (110 people) recursion... which is almost all interesting algorithms! Hardware How do we build devices to compute? Now: Taking a break in lecture. In lab, about one week away from pulling it all together into a working computer! 11

12 Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Single-Elimination Tournaments –Binary Trees A First Pattern for Induction Induction on Numbers Next Lecture Notes 12

13 Single-Elimination Tournaments In each round teams play in pairs. Losing teams are eliminated. The tournament ends when only one team remains. 13

14 Single-Elimination Tournament Problem What’s the maximum number of teams in an n-round single-elimination tournament? a.n teams b.2n teams c.n 2 teams d.2 n teams e.None of these 14

15 Tournament Step-by-Step Problem 2: Prove your result for... n = 0 n = 1 n = 2 n = 3 n = 4... 15

16 Tournament Logic So, if p teams can play in an n-round tournament, then 2p teams can play in an n+1-round tournament. If we want to prove this statement, which of the following techniques might we use? a.Antecedent assumption b.Witness proof c.WLOG d.Proof by cases e.None of these 16

17 Tournament Proof Proof that 2 n teams can play in an n-round tournament: Only 2 0 = one team (the automatic winner!) can “play” in a 0-round tournament. We work up to any other size by showing: if 2 k teams can play in a k-round tournament, then 2 k+1 teams can play in an k+1-round tournament. Why? Assume the antecedent. Then, a k+1-round tournament has half its teams eliminated in the first round. It then has k rounds left and, by assumption, can have 2 k teams. The first round started with twice that many: 2*2 k = 2 k+1. 17

18 Tournament Step-by-Step Problem 2: Prove your result for... n = 02 0 = 1 team n = 12*1 = 2 1 = 2 teams n = 22*2 = 2 2 = 4 teams n = 32*4 = 2 3 = 8 teams n = 42*8 = 2 4 = 16 teams... 18

19 Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Single-Elimination Tournaments –Binary Trees A First Pattern for Induction Induction on Numbers Next Lecture Notes 19

20 “Binary Trees” A “binary tree” is a root “node” and a collection of “child nodes” beneath the root. Each node is an object that has up to two children—a left child and a right child—each of which are themselves binary trees. 20 92 15 5 10 177 (They let us do some cool CS things... see CS110, 211, and 221.)

21 Binary Trees’ Height A binary tree’s “height” is the maximum number of steps it takes to get from the root down to a node with no children. This one’s height is: a.0 b.1 c.2 d.3 e.4 21 20 92 15 5 10 177 20 92 15 5 10 177

22 Binary Trees’ Height Problem 1: What’s the maximum number of nodes in a binary tree of height n? 22 20 92 15 5 10 177

23 Binary Trees’ Height Problem 2: Prove your result. 23 20 92 15 5 10 177

24 Binary Trees, Take Two Problem 1: Give an algorithm to determine the height of a binary tree. Problem 2: Prove that your algorithm is correct. 24 20 92 15 5 10 177

25 Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Single-Elimination Tournaments –Binary Trees A First Pattern for Induction Induction on Numbers Next Lecture Notes 25

26 An Induction Proof Pattern Type of Problem: Prove some property of a structure that is naturally defined in terms of itself. Part 1: Insight. Induction doesn’t help you with this part. It is not a technique to figure out patterns, only to prove them. Part 2: Proof. Establish that the property holds for simple structures. Establish that it holds at each step of construction of a more complex structure. 26

27 Natural Numbers and Induction Can we prove things about the natural numbers using induction? Are they “self- referential”? Let’s try one... Problem: What is the sum of the natural numbers 0..n? 27

28 Partly Worked Problem: Sum of 0..n Partly Worked Problem: What is the sum of the natural numbers 0..n? Induction doesn’t help with insight... But spoilers do: n(n+1)/2. Now, how do we prove it? 28

29 Partly Worked Problem: Sum of 0..n Partly Worked Problem: Prove that the sum of the natural numbers 0..n is n(n+1)/2. Is this self-referential? If we knew the sum of the numbers 0..(n-1), would it tell us anything about the sum of the numbers 0..n? 29

30 Outline Prereqs, Learning Goals, and Quiz Notes Problems and Discussion –Single-Elimination Tournaments –Binary Trees A First Pattern for Induction Induction on Numbers Next Lecture Notes 30

31 Learning Goals: In-Class By the end of this unit, you should be able to: –Establish properties of self-referential structures using inductive proofs that naturally build on those self-references. Note: this learning goal is not yet looking for formal inductive proofs. Instead, we’re just exploring how we work with things that are defined in terms of themselves. 31

32 Next Lecture Learning Goals: Pre-Class By the start of class, you should be able to: –Given a theorem to prove stated in terms of its induction variable (i.e., usually, in terms of n), write out the skeleton of an inductive proof including: the base case(s) that need to be proven, the induction hypothesis, and the inductive step that needs to be proven. So, take what we did in this lecture and use the textbook readings to formalize your understanding. We will have much more practice on inductive proofs. 32

33 Next Lecture Prerequisites Read Section 4.2-4.4. Solve (or at least “set up”, by writing the base case(s) that need to be proved, the induction hypothesis, and the inductive step that needs to be proved) problems like Exercise Set 4.2 #1-2, 5-17, and 31; 4.3 #1, 8-27, 29, and 30- 31, and 4.4 #1-7, 9-10, and 24. Solve problems like Exercise Set 4.2 #3-4 and 32, 4.3 #6-7 and 30-31, and 4.4 #17. Complete the open-book, untimed quiz on Vista that’s due before the next class. 33


Download ppt "Snick  snack CPSC 121: Models of Computation 2009 Winter Term 1 Introduction to Induction Steve Wolfman 1."

Similar presentations


Ads by Google