1 / 36

CS 173: Discrete Mathematical Structures

CS 173: Discrete Mathematical Structures. Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 12:30-2:30. CS 173 Announcements. Section locations have changed. See web. Section format has changed. Go. Homework #5 due 10/9, 11:59p. CS 173 Infinite Cardinality.

ian-fulton
Télécharger la présentation

CS 173: Discrete Mathematical Structures

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS 173:Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: W 12:30-2:30

  2. CS 173 Announcements • Section locations have changed. See web. • Section format has changed. Go. • Homework #5 due 10/9, 11:59p. Cs173 - Spring 2004

  3. CS 173 Infinite Cardinality Are there more evens than odds? Are there more natural numbers than evens? Are there more evens than multiples of 3? Cs173 - Spring 2004

  4. CS173Mathematical Induction - a cool example A 2n x 2n sized grid is deficient if all but one cell is tiled. Deficient Tiling 2n 2n Cs173 - Spring 2004

  5. CS173Mathematical Induction - a cool example We want to show that all 2n x 2n sized deficient grids can be tiled with tiles shaped like: Cs173 - Spring 2004

  6. Yup! Yup! CS173Mathematical Induction - a cool example Is it true for 20 x 20 grids? Is it true for 21 x 21 grids? Cs173 - Spring 2004

  7. CS173Mathematical Induction - a cool example Inductive Hypothesis: We can tile a 2k x 2k deficient board using our fancy designer tiles. Use this to prove: We can tile a 2k+1 x 2k+1 deficient board using our fancy designer tiles. Cs173 - Spring 2004

  8. 2k 2k ? ? 2k ? 2k CS173Mathematical Induction - a cool example 2k+1 OK!! (by IH) Cs173 - Spring 2004

  9. 2k 2k 2k 2k CS173Mathematical Induction - a cool example OK!! (by IH) OK!! (by IH) 2k+1 OK!! (by IH) OK!! (by IH) Cs173 - Spring 2004

  10. CS173Mathematical Induction - a cool example Cs173 - Spring 2004

  11. CS173Mathematical Induction - a cool example Cs173 - Spring 2004

  12. No. { x  Z : x < 0 } has no least element. CS 173 Mathematical Induction - why does it work? Definition: A set S is “well-ordered” if every non-empty subset of S has a least element. Given (we take as an axiom): the set of natural numbers (N) is well-ordered. Is the set of integers (Z) well ordered? Cs173 - Spring 2004

  13. No. { x  R : x > 1 } has no least element. CS 173 Mathematical Induction - why does it work? Is the set of non-negative reals (R) well ordered? Cs173 - Spring 2004

  14. Proof by contradiction. n P(n) CS 173 Mathematical Induction - why does it work? Proof of Mathematical Induction: We prove that (P(0)  (k P(k)  P(k+1)))  (n P(n)) Assume • P(0) • k P(k)  P(k+1) • n P(n) Cs173 - Spring 2004

  15. Since N is well ordered, S has a least element. Call it k. But by (2), P(k-1)  P(k). Contradicts P(k-1) true, P(k) false. Done. n P(n) CS 173 Mathematical Induction - why does it work? Assume • P(0) • n P(n)  P(n+1) • n P(n) Let S = { n : P(n) } What do we know? • P(k) is false because it’s in S. • k  0 because P(0) is true. • P(k-1) is true because P(k) is the least element in S. Cs173 - Spring 2004

  16. In our proofs, to show P(k+1), our inductive hypothesis assures that ALL of P(0), P(1), … P(k) are true, so we can use ANY of them to make the inference. CS 173 Strong Mathematical Induction If • P(0) and • n0 (P(0)  P(1)  …  P(n))  P(n+1) Then • n0 P(n) Cs173 - Spring 2004

  17. CS 173 Strong Mathematical Induction An example. Given n blue points and n orange points in a plane with no 3 collinear, prove there is a way to match them, blue to orange, so that none of the segments between the pairs intersect. Cs173 - Spring 2004

  18. CS 173 Strong Mathematical Induction Base case (n=1): Assume any matching problem of size less than (k+1) can be solved. Show that we can match (k+1) pairs. Cs173 - Spring 2004

  19. CS 173 Strong Mathematical Induction Show that we can match (k+1) pairs. Suppose there is a line partitioning the group into a smaller one of j blues and j oranges, and another smaller one of (k+1)-j blues and (k+1)-j oranges. OK!! (by IH) OK!! (by IH) Cs173 - Spring 2004

  20. CS 173 Strong Mathematical Induction How do we know such a line always exists? Consider the convex hull of the points: OK!! (by IH) If there is an alternating pair of colors on the hull, we’re done! OK!! (by IH) Cs173 - Spring 2004

  21. There must be a tie along the way CS 173 Strong Mathematical Induction If there is no alternating pair, all points on hull are the same color. Notice that any sweep of the hull hits an orange point first and also last. We sweep on some slope not given by a pair of points. Keep score of # of each color seen. Orange gets the early lead, and then comes from behind to tie at the end. OK!! (by IH) OK!! (by IH) Cs173 - Spring 2004

  22. But equivalently, we could define it like this: Inductive (Recursive) Definition Recursive Case Base Case CS173Inductive Definitions We completely understand the function f(n) = n!, right? As a reminder, here’s the definition: n! = 1 · 2 · 3 · … · (n-1) · n, n  1 Cs173 - Spring 2004

  23. Recursive Case Base Cases Is there a non-recursive definition for the Fibonacci Numbers? CS173Inductive Definitions Another VERY common example: Fibonacci Numbers Cs173 - Spring 2004

  24. Recursive Cases Base Case “I LOVE my definition. It’s perfect!” “Oh yeah? Prove it!” CS173Inductive Definitions Our examples so far have been inductively defined functions. Sets can be defined inductively, too. Give an inductive definition of S = {x: x is a multiple of 3} • 3  S • x,y  S  x + y  S • x,y  S  x - y  S • No other numbers are in S. Cs173 - Spring 2004

  25. CS173Inductive Definitions We want to show that my definition of S: • 3  S • x,y  S  x + y  S • x,y  S  x - y  S • No other numbers are in S. Contains the same elements as the set: T = {x: x is a multiple of 3} To prove S = T, show • T  S • S  T Cs173 - Spring 2004

  26. CS173Inductive Definitions We start with T  S. If x  T, then x = 3k for some integer k. We show by induction on |k| that 3k  S. Base Case (k = 0): 0  S since 3  S by rule 1, and 3 - 3  S by rule 3. Assume 3k, -3k  S, show that 3(k+1), -3(k+1) S. Cs173 - Spring 2004

  27. CS173Inductive Definitions We start with T  S. If x  T, then x = 3k for some integer k. We show by induction on |k| that 3k  S. Assume 3k, -3k  S, show that 3(k+1), -3(k+1) S. • 3k  S by inductive hypothesis. • 3  S by rule 1. • 3k + 3 = 3(k+1)  S by rule 2. • 0  S by base case. • 0 - 3(k+1) = -3(k+1)  S by rule 3. Cs173 - Spring 2004

  28. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Observe that by rule 4, all numbers in S are created by a finite number of applications of rules 1,2, and 3. We use the number of rule applications as our induction counter. For example: • 3  S by 1 application of rule 1. • 0  S by 2 rule applications (rules 1 and 3). • 9  S by 3 applications (rule 1 once and rule 2 twice). Cs173 - Spring 2004

  29. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Base Case (k=1): If x  S by 1 rule application, then it must be rule 1 and x = 3, which is clearly a multiple of 3. Cs173 - Spring 2004

  30. The argument is the same if rule 2 is last instead. CS173Inductive Definitions Next we show that S  T. That is, if an number x is described by S, then it is a multiple of 3. Assume any number described by k or fewer applications of the rules in S is a multiple of 3 and prove that any number described by (k+1) applications of the rules is also a multiple of 3. Suppose the (k+1)st rule applied is rule 3, and it results in value x = a + b. Then a and b are multiples of 3 by inductive hypothesis, and thus x is a multiple of 3. Cs173 - Spring 2004

  31. This just describes fully parenthesized propositions. CS173Inductive Definitions Yet another example: Well-Formed Formulas (wffs) • T is a wff • F is a wff • p is a wff for any propositional variable p • If p is a wff, then (p) is a wff • If p and q are wffs, then (p  q) is a wff • If p and q are wffs, then (p  q) is a wff For example, a statement like ((r)  (p  r)) can be proven to be a wff by arguing that (r) and (p  r) are wffs by induction and then applying rule 5. Cs173 - Spring 2004

  32. Countably infinite No. No. CS173Strings and Inductive Definitions Let  be a finite set called an alphabet. The set of strings on , denoted * is defined as: • *, where  denotes the null or empty string. • If x , and w *, then wx *, where wx is the concatenation of string w with symbol x. Example: Let  = {a, b, c}. Then * = {, a, b, c, aa, ab, ac, ba, bb, bc, ca, cb, cc, aaa, aab,…} How big is *? Are there any infinite strings in *? Is there a largest string in *? Cs173 - Spring 2004

  33. I point this out because the length of strings is something we might like to use for an inductive argument. CS173Strings and Inductive Definitions Inductive definition of the length of strings (the length of string w is |w|.): • || = 0 • If x , and w *, then |wx| = |w| + 1 Cs173 - Spring 2004

  34. For example (abc)R = cba x(w)R CS173Strings and Inductive Definitions Inductive definition of the reversal of a string (the reversal of string w is written wR.): • R =  • If x , and w *, then (wx)R = ? For example (abc)R = c(ab)R = cb(a)R = cba()R = cba = cba Cs173 - Spring 2004

  35. FruitLoopsR LoopsRFruitR spooLtiurF This is an example of how an inductive defn can be used in a proof. The thm itself isn’t compelling. CS173Strings and Inductive Definitions A Theorem: x,y  * (xy)R = yRxR Proof (by induction on |y|): Base Case (|y| = 0): If |y| = 0, y = , then (xy)R = (x)R = xR = xR = yRxR. IH: If |y|  n, then x  *, (xy)R = yRxR. Prove: If |y| = n+1, then x  *, (xy)R = yRxR. Cs173 - Spring 2004

  36. CS173Strings and Inductive Definitions IH: If |y|  n, then x  *, (xy)R = yRxR. Prove: If |y| = n+1, then x  *, (xy)R = yRxR. If |y| = n+1, then a  , u  *, so that y = ua, and |u| = n. Then, (xy)R = (x(ua))R by substitution = ((xu)a)R by assoc. of concatenation = a(xu)R by inductive defn of reversal = auRxR by IH = (ua)RxR by inductive defn of reversal = yRxR by substitution Cs173 - Spring 2004

More Related