# 4.1.G Structural Induction

Next, while we are on the topic of induction, let’s generalise the idea of induction to also apply it to sets. This more general form of induction is often called structural induction. Structural induction is used to prove that some proposition P(x) holds for all of some sort of recursively defined structure, such as formulae, lists, or trees—or recursively- defined sets. In a proof by structural induction we show that the proposition holds for all the ‘minimal’ structures, and that if it holds for the immediate substructures of a certain structure S, then it must hold for also. Structural induction is useful for proving properties about algorithms; sometimes it is used together with in variants for this purpose.

To get an idea of what a ‘recursively defined set’ might look like, consider the follow- ing definition of the set of natural numbers N.

Basis: 0 ∈ N.
Successionx∈N→x+1∈N.
Exclusivity: No other elements other than those outlined by the rules above are in N.

This definition is similar to one we have seen before, first stating that 0 ∈ N and then saying that we can add 1 to an element in N to get another element of N. The final clause is needed to ensure that other items are not part of N. Without it, you and me, as well as π, ‘New York City’, and ‘King Willem-Alexander’ might have been in the set. After all there was no reason for those elements not to be in there.

Now compare that recursive definition, with the method for mathematical induction we have seen before:

Base case: Prove that P(0) holds.
Inductive case: Prove that ∀∈ N(P(k) → P(+ 1)) holds.

Conclusion: ∀∈ NP(n)) holds.

As we can see mathematical induction and this recursive definition show large similarities. The base case of the induction proves the property for the basis of our recursive definition and the inductive step proves the property for the succession rule. In fact, this similarity is no coincidence and we can generalise this method to get to structural induction.

Consider for instance the set PROP, which represents all valid formula in propositional logic:

AtomspPROPforalli∈N.
Negation∈ PROP → ¬∈ PROP.
Binary connectivex,yPROP→(xy)∈PROP,s.t.∗∈{∧,∨,→,↔}.

Exclusivity: Nothing else is in PROP.

Using this definition of the set PROP we can use structural induction to prove certain claims about PROP. For instance we can prove that every formula in PROP has equally many left parentheses ‘(’ and right parentheses ‘)’.

Proof. Let l(φ) denote the number of left parentheses in a formula φ. Similarly let r(φ)denote the number of right parentheses. Let P(φ) be the statement that l(φ) = r(φ). We need to prove that ∀φ ∈ PROP(P(φ)).

Base case: Consider the Atoms rule of the definition of PROPl(pi) = 0 = r(pi). Therefore P(pi) holds.

Inductive case: We want to show that if the statement is true for x∈ PROP (where x and are arbitrary formula), then it is true for ¬and (∗ y) for all ∗ ∈ {∨, ∧, →, ↔}. That is, we must prove the implication (P(x) ∧ P(y)) → (Px) ∧ P((∗ y))). So we assume P(x) ∧ P(y), that is, we assume that for both formula and yl(x) = r(x) andl(y) = r(y). We want to prove Px), that is, that for ¬x lx) = rx)

lx) = l(x)        by the Negation rule of PROP

r(x)        by the inductive hypothesis

rx)        by the Negation rule of PROP

Secondly we prove that P((∗ y)) holds for all ∗ ∈ {∨, ∧, →, ↔}:

l((∗ y)) = 1 + l(x) + l(y)        by the Binary connective rule of PROP

= 1 + r(x) + r(y)        by the inductive hypothesis

r((∗ y))        by the Binary connective rule of PROP

Altogether, we have shown that P(pi) holds and that, for all x,∈ PROP and ∗ ∈ {∨, ∧, →, ↔}, (P(x) ∧ P(y)) → (Px) ∧ P((∗ y)) is true. Therefore, by the principle of structural induction, P(φ) is true for all φ ∈ PROP, so for all propositional formula the number of left parentheses equals the number of right parentheses. This completes the proof by structural induction.

Such structural induction proofs can be applied on any recursively defined set of numbers, formulae or even strings (pieces of text) or lists or trees, making this a very powerful generalised proof method.

Exercises

1. If we don’t make the assumption that ab, and are distinct, then the set denoted by {abc}might actually contain either 1, 2, or 3 elements. How many different elements might the set{ ab, {a}, {ac}, {abc} } contain? Explain your answer.

2. Compute ∪ B∩ B, and ∖ for each of the following pairs of sets

a)A={a,b,c}, B=∅
b) = {1,2,3,4,5}, = {2,4,6,8,10}

c) = {a,b}, = {a,b,c,d}
d) = {a,b,{a,b}}, $$B=\{\{a\},\{a, b\}\}$$

3. Draw a Venn diagram for each of the four sets of the last exercise.

4. Recall that N represents the set of natural numbers. That is, N = {0, 1, 2, 3, . . . }. Let ={∈ N | ≥ 5}, let = {∈ N | ≤ 10}, and let = {∈ N | is an even number}. Find each of the following sets:

a) ∩ Y     b) ∪ Y     c) ∖ Y     d) N ∖ Z

e) ∩ Z     f) ∩ Z     g) ∪ Z     h) ∖ N()

5. Find P {1, 2, 3} . (Hint: It has eight elements.)

6.Assumethataandbareentitiesandthat. Let and be the sets defined byA ={ a, {b}, {ab} } and = { ab, {a, {b}} }. Determine whether each of the following statements is true or false. Explain your answers.

a) ∈ A     b) {ab} ⊆ A     c) {ab} ⊆ B

d) {ab} ∈ B     e) {a, {b}} ∈ A     f) {a, {b}} ∈ B

7. Since P(A) is a set, it is possible to form the set P P(A) . What is P P(∅) ? What is P P({a,b}) ? (Hint: It has sixteen elements.)

1. In the English sentence, “She likes men who are tall, dark, and handsome”, does she like an intersection or a union of sets of men? How about in the sentence, “She likes men who are tall, men who are dark, and men who are handsome”?

2. If is any set, what can you say about ∪ ? About ∩ ? About ∖ ? Why?

3. Suppose that and are sets such that ⊆ B. What can you say about ∪ ? About ∩ ?