Download CSC 236

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

History of logarithms wikipedia , lookup

Location arithmetic wikipedia , lookup

Proofs of Fermat's little theorem wikipedia , lookup

Transcript
CSC 236
Week 2 | more induction avours
(Course notes 1.3)
slide 1
Dierent avours of induction for dierent problems
Try \Every natural number greater than 1 has a prime factorization."
Prime factorization of n is a sequence of prime numbers with product n. The sequence might
have a single element, so the prime factorization of 2 is 2
Work at setting up induction. What goes wrong?
slide 2
Every natural number greater than 1 has a prime factorization.
What's our base case?
How do you get from P (n) to P (n + 1) when n = 15?
slide 3
Another avour of induction needed:
Complete, (aka Strong, or Course-of-Values) induction
reasons to believe it
domino
domino
domino
domino
domino
domino
domino
domino
domino
domino
domino
domino
domino
dom
domino
More domino carnage:
ino
domino
(8n 2 N; fP (0); : : : ; P (n
1)g ) P (n)) ) 8n 2 N; P (n)
If the truth of all the previous cases always implies the current case, then all cases are true.
slide 4
Every natural number greater than 1 has a prime factorization
slide 5
Every full binary tree has an odd number of nodes (except the zero tree)
Denitions (page 32):
A tree is a directed graph
A non-empty tree has a root node, r, such that there is exactly one path from r to any other
node.
If a tree has an edge (u; v ), then u is v 's parent, v is u's child.
Two nodes with the same parent are called siblings.
A node with no children is called a leaf. A non-leaf is called an internal node.
Binary trees have nodes with 2 children, and children are labelled either left or right.
Internal nodes of full binary trees have 2 children.
slide 6
Tree examples
slide 7
Every full binary tree (except the zero tree) has an odd number of nodes
What problem occurs with Simple Induction?
What smaller case(s) help(s) us?
slide 8
Every full binary tree (except the zero tree) has an odd number of nodes
slide 9
Every chocolate grid of n squares can be broken into separate squares with
n
1 breaks
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
C
What does \break" mean in this context?
Does the problem have a recursive structure?
Is there a problem with zero?
slide 10
Every chocolate grid of n squares can be broken into separate squares with
n
1 breaks
slide 11
Every chocolate grid of n squares can be broken into separate squares with
n
1 breaks
slide 12
Every chocolate grid of n squares can be broken into separate squares with
n
1 breaks
slide 13
What postage can be formed with 4- and 5-cent stamps?
What's your conjecture?
Base case(s)?
Simple or complete induction?
slide 14
What postage can be formed with 4- and 5-cent stamps?
slide 15
Given n; m 2 N; n 6= 0, does the set R = fr 2 N j 9q 2 N; m = qn + rg have a
smallest element?
This is the main piece to prove the existence of a unique quotient and remainder: 8m 2 N; 8n 2 N n f0g; 9q; r 2 N; m = qn + r ^ 0 r < n (why does
n have to be positive?)
Proof in the course notes uses simple induction
Alternative proof, shorter and clearer, uses Principle of Well Ordering: every
non-empty subset of N has a smallest element.
slide 16
For every pair of natural numbers m; n with n > 0, exists a pair of natural
numbers q; r such that m = qn + r and 0 r < n
slide 17