Cse 321 discrete structures
Download
1 / 37

CSE 321 Discrete Structures - PowerPoint PPT Presentation


  • 62 Views
  • Uploaded on

CSE 321 Discrete Structures. Winter 2008 Lecture 12 Induction. Announcements. Readings Monday, Wednesday Induction and recursion 4.1-4.3 (5 th Edition: 3.3-3.4) Midterm: Friday, February 8 In class, closed book Estimated grading weight: MT 12.5%, HW 50%, Final 37.5%.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' CSE 321 Discrete Structures' - joel-herman


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Cse 321 discrete structures

CSE 321 Discrete Structures

Winter 2008

Lecture 12

Induction


Announcements
Announcements

  • Readings

    • Monday, Wednesday

      • Induction and recursion

        • 4.1-4.3 (5th Edition: 3.3-3.4)

    • Midterm:

      • Friday, February 8

      • In class, closed book

      • Estimated grading weight:

        • MT 12.5%, HW 50%, Final 37.5%


Induction example
Induction Example

  • Prove 3 | 22n -1 for n  0

Examples to show its true

P(0)

P(k)  P(k+1)


Induction as a rule of inference
Induction as a rule of Inference

P(0)

 k (P(k)  P(k+1))

 n P(n)

Formal steps

Show P(0)

Assume P(k), Prove P(k+1), Conclude P(k) P(k+1)

Conclude  k (P(k) P(k+1))

Conclude  n P(n)


1 2 4 2 n 2 n 1 1
1 + 2 + 4 + … + 2n = 2n+1 - 1



Cute application checkerboard tiling with trinominos
Cute Application: Checkerboard Tiling with Trinominos

Prove that a 2k 2k checkerboard with one

square removed can be tiled with:


Strong induction
Strong Induction

P(0)

 k ((P(0)  P(1)  P(2)  …  P(k))  P(k+1))

 n P(n)


Player 1 wins n 2 chomp
Player 1 wins n  2 Chomp!

Winning strategy: chose the lower corner square

Theorem: Player 2 loses when faced with an n  2

board missing the lower corner square


Induction example1
Induction Example

  • A set of S integers is non-divisible if there is no pair of integers a, b in S where a divides b. If there is a pair of integers a, b in S, where a divides b, then S is divisible.

  • Given a set S of n+1 positive integers, none exceeding 2n, show that S is divisible.

  • What is the largest subset non-divisible subset of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }.


If s is a set of n 1 positive integers none exceeding 2n then s is divisible
If S is a set of n+1 positive integers, none exceeding 2n, then S is divisible

  • Base case: n =1

  • Suppose the result holds for n

    • If S is a set of n+1 positive integers, none exceeding 2n, then S is divisible

    • Let T be a set of n+2 positive integers, none exceeding 2n+2. Suppose T is non-divisible.


Proof by contradiction
Proof by contradiction then S is divisible

  • Claim: 2n+1  T and 2n + 2  T

  • Claim: n+1  T

  • Let T* = T – {2n+1, 2n+2}  {n+1}

  • If T is non-divisible, T* is also non-divisible

/


Recursive definitions
Recursive Definitions then S is divisible

  • F(0) = 0; F(n + 1) = F(n) + 1;

  • F(0) = 1; F(n + 1) = 2  F(n);

  • F(0) = 1; F(n + 1) = 2F(n)


Fibonacci numbers
Fibonacci Numbers then S is divisible

  • f0 = 0; f1 = 1; fn = fn-1 + fn-2


Bounding the fibonacci numbers
Bounding the Fibonacci Numbers then S is divisible

  • Theorem: 2n/2 fn 2n for n  6


Recursive definitions of sets
Recursive Definitions of Sets then S is divisible

  • Recursive definition

    • Basis step: 0  S

    • Recursive step: if x  S, then x + 2  S

    • Exclusion rule: Every element in S follows from basis steps and a finite number of recursive steps


Recursive definitions of sets1
Recursive definitions of sets then S is divisible

Basis: 6  S; 15  S;

Recursive: if x, y  S, then x + y  S;

Basis: [1, 1, 0]  S, [0, 1, 1]  S;

Recursive:

if [x, y, z]  S,  in R, then [ x,  y,  z]  S

if [x1, y1, z1], [x2, y2, z2]  S

then [x1 + x2, y1 + y2, z1 + z2]

Powers of 3


Strings
Strings then S is divisible

  • The set * of strings over the alphabet  is defined

    • Basis: * ( is the empty string)

    • Recursive: if w *, x , then wx *


Families of strings over a b
Families of strings over then S is divisible  = {a, b}

  • L1

    •  L1

    • w  L1 then awb  L1

  • L2

    •  L2

    • w  L2 then aw  L2

    • w  L2 then wb  L2


Function definitions
Function definitions then S is divisible

Len() = 0;

Len(wx) = 1 + Len(w); for w *, x 

Concat(w, ) = w for w *

Concat(w1,w2x) = Concat(w1,w2)x for w1, w2 in *, x 


Well formed fomulae
Well Formed Fomulae then S is divisible

  • Basis Step

    • T, F, and s, where is a propositional variable are in WFF

  • Recursive Step

    • If E and F are in WFF then ( E), (E F), (E F), (E F) and (E F) are in WFF


Tree definitions
Tree definitions then S is divisible

  • A single vertex r is a tree with root r.

  • Let t1, t2, …, tn be trees with roots r1, r2, …, rn respectively, and let r be a vertex. A new tree with root r is formed by adding edges from r to r1,…, rn.


Extended binary trees
Extended Binary Trees then S is divisible

  • The empty tree is a binary tree.

  • Let r be a node, and T1 and T2 binary trees. A binary tree can be formed with T1 as the left subtree and T2 as the right subtree. If T1 is non-empty, there is an edge from the root of T1 to r. Similarly, if T2 is non-empty, there is an edge from the root of T2 to r.


Full binary trees
Full binary trees then S is divisible

  • The vertex r is a FBT.

  • If r is a vertex, T1 a FBT with root r1 and T2 a FBT with root r2 then a FBT can be formed with root r and left subtree T1 and right subtree T2 with edges r r1 and r r2.


Simplifying notation
Simplifying notation then S is divisible

  • (, T1, T2), tree with left subtree T1 and right subtree T2

  •  is the empty tree

  • Extended Binary Trees (EBT)

    •  EBT

    • if T1, T2 EBT, then (, T1, T2)  EBT

  • Full Binary Trees (FBT)

    •  FBT

    • if T1, T2 FBT, then (, T1, T2)  FBT


Recursive functions on trees
Recursive Functions on Trees then S is divisible

  • N(T) - number of vertices of T

  • N() = 0; N() = 1

  • N(, T1, T2) = 1 + N(T1) + N(T2)

  • Ht(T) – height of T

  • Ht() = 0; Ht() = 1

  • Ht(, T1, T2) = 1 + max(Ht(T1), Ht(T2))

NOTE: Height definition differs from the text

Base case H() = 0 used in text


More tree definitions fully balanced binary trees
More tree definitions: Fully balanced binary trees then S is divisible

  •  is a FBBT.

  • if T1 and T2 are FBBTs, with Ht(T1) = Ht(T2), then (, T1, T2) is a FBBT.


And more trees almost balanced trees
And more trees: Almost balanced trees then S is divisible

  •  is a ABT.

  • if T1 and T2 are ABTs with Ht(T1) -1  Ht(T2)  Ht(T1)+1 then (, T1, T2) is a ABT.


Is this tree almost balanced
Is this Tree Almost Balanced? then S is divisible


Structural induction
Structural Induction then S is divisible

  • Show P holds for all basis elements of S.

  • Show that if P holds for elements used to construct a new element of S, then P holds for the new element.


Prove all elements of s are divisible by 3
Prove all elements of S are divisible by 3 then S is divisible

  • Basis: 21  S; 24  S;

  • Recursive: if x, y  S, then x + y  S;



Well formed fomulae1
Well Formed Fomulae right parentheses

  • Basis Step

    • T, F, and s, where is a propositional variable are in WFF

  • Recursive Step

    • If E and F are in WFF then ( E), (E F), (E F), (E F) and (E F) are in WFF


Fully balanced binary tree
Fully Balanced Binary Tree right parentheses

  • If T is a FBBT, then N(T) = 2Ht(T) - 1


Binary trees
Binary Trees right parentheses

  • If T is a binary tree, then N(T)  2Ht(T) - 1

If T = :

If T = (, T1, T2) Ht(T1) = x, Ht(T2) = y

N(T1)  2x, N(T2)  2y

N(T) = N(T1) + N(T2) + 1

 2x – 1 + 2y – 1 + 1

 2Ht(T) -1 + 2Ht(T) – 1 – 1

 2Ht(T) - 1


Almost balanced binary trees
Almost Balanced Binary Trees right parentheses

Let  = (1 + sqrt(5))/2

Prove N(T) Ht(T) – 1

Base case:

Recursive Case: T = (, T1, T2)

Let Ht(T) = k + 1

Suppose Ht(T1)  Ht(T2)

Ht(T1) = k, Ht(T2) = k or k-1


Almost balanced binary trees1
Almost Balanced Binary Trees right parentheses

N(T) = N(T1) + N(T2) + 1

k – 1 + k-1 – 1 + 1

k + k-1 – 1 [2 =  + 1]

k+1 – 1


ad