Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Jason Filippou
CMSC250 @ UMCP
07-05-2016
2 Proofs
Binary Trees
Sets
Proofs
Binary Trees
Pictorially
Pictorially
Height: 2
# Nodes: 7
Pictorially
Root r Height: 2
# Nodes: 7
Height: 1 Height: 1
# Nodes: 3 # Nodes: 3
Claim: |V | = |E| + 1
The number of vertices (|V |) of a non-empty binary tree T is the
number of its edges (|E|) plus one.
So P (T ) holds.
Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 12 / 26
Proofs Binary Trees
Sets
16 ∈ S1 S2 S3
16 ∈ S1 S2 S3
21 ∈ S1 S2 S3
Practice!
Practice!
|S4 | = 0 1 2 +∞
Practice!
|S4 | = 0 1 2 +∞
|S5 | = 0 1 2 +∞
Practice!
|S4 | = 0 1 2 +∞
|S5 | = 0 1 2 +∞
|S6 | = 0 1 2 +∞
Practice!
|S4 | = 0 1 2 +∞
|S5 | = 0 1 2 +∞
|S6 | = 0 1 2 +∞
|S7 | = 0 1 2 +∞
Practice!
|S4 | = 0 1 2 +∞
|S5 | = 0 1 2 +∞
|S6 | = 0 1 2 +∞
|S7 | = 0 1 2 +∞
|S8 | = 0 1 2 +∞
Proof
An inequality proof
Let S be the subset of Z × Z = Z2 defined as follows:
Base case: (0, 0) ∈ S
Recursive step:
(a, b) ∈ S ⇒ (((a, b+1) ∈ S)∧((a+1, b+1) ∈ S)∧(a+2, b+1) ∈ S).
Prove that ∀(a, b) ∈ S, a ≤ 2b.
In class!
S⊆A
Proof
a
We can do this, since A is parameterized by n.
Proof (continued)
Proof: S ⊆ A part.
We now prove that S ⊆ A.
1 Inductive base: By the base case of the definition of S, we have
that 3 ∈ S. Since 3 = 3 · 1 and 1 ∈ N∗ , we have that 3 ∈ A. So P (3).
2 Inductive hypothesis: Assume that x, y ∈ S are also contained
by A, i.e x, y ∈ A. So P (x), P (y).
3 Inductive step: We must show that P (x + y), i.e x + y ∈ A,
because if we do show this, we will have covered the recursive step
of A’s definition. From the inductive hypothesis, we have that
x, y ∈ A ⇒ ∃i, j ∈ N∗ : x = 3i, y = 3j. Therefore,
x + y = 3 (i + j) ⇒ x + y ∈ A. Therefore, P (x + y).
| {z }
z∈N
Definition
A recursively defined language Let Σ = {a, b} be an alphabet. We
define the language L as follows:
(Base case:) ∈ L
(Recursive step:) If x ∈ L, axa ∈ L and bxb ∈ L.a
a
σ1 σ2 is the concatenation of σ1 and σ2 . Concatenation can be applied
to n strings, n = 1, 2, 3, . . . . σ n is the concatenation of σ n− many times.
Definition
A recursively defined language Let Σ = {a, b} be an alphabet. We
define the language L as follows:
(Base case:) ∈ L
(Recursive step:) If x ∈ L, axa ∈ L and bxb ∈ L.a
a
σ1 σ2 is the concatenation of σ1 and σ2 . Concatenation can be applied
to n strings, n = 1, 2, 3, . . . . σ n is the concatenation of σ n− many times.
Claim
∀σ ∈ L, |σ| is even.a
a
|σ| is the number of characters in σ.
1 In the inductive base, prove P (·) for all the base elements of the
recursively defined set S.
1 In the inductive base, prove P (·) for all the base elements of the
recursively defined set S.
This gives us that P (·) holds for sets up to some cardinality n0 .
1 In the inductive base, prove P (·) for all the base elements of the
recursively defined set S.
This gives us that P (·) holds for sets up to some cardinality n0 .
2 In the inductive hypothesis, assume ∃S : |S| ≥ n0 and P (S).
1 In the inductive base, prove P (·) for all the base elements of the
recursively defined set S.
This gives us that P (·) holds for sets up to some cardinality n0 .
2 In the inductive hypothesis, assume ∃S : |S| ≥ n0 and P (S).
Reminds us of weak mathematical induction?
1 In the inductive base, prove P (·) for all the base elements of the
recursively defined set S.
This gives us that P (·) holds for sets up to some cardinality n0 .
2 In the inductive hypothesis, assume ∃S : |S| ≥ n0 and P (S).
Reminds us of weak mathematical induction?
3 In the inductive step, use the recursive part of the definition of S
to prove that the new set constructed (call it S 0 ) satisfies the
proposition (so P (S 0 )).
The inductive hypothesis will undoubtedly be used.