The Central Idea

Suppose a class of objects is defined recursively.

Structural induction proves that every object in the class has a property \(P\) by following the same rules used to build the class.

The proof has two broad parts:

  1. prove \(P\) for every basic object;
  2. prove that every construction rule preserves \(P\).

If every object is generated from the basic objects by repeated use of those rules, then every object has property \(P\).

Ordinary Induction versus Structural Induction

Ordinary induction follows numerical succession:

\[ P(k)\Longrightarrow P(k+1). \]

Structural induction follows recursive construction:

\[ \text{properties of smaller components} \Longrightarrow \text{property of the object built from them}. \]

The organizing principle is not the next integer but the next construction step.

Why Structural Induction Is Needed

Some objects do not have a single natural predecessor.

A tree may be built by joining several smaller trees.

A logical formula may be built from one or two smaller formulas.

A string may be built by attaching a symbol to a shorter string.

Structural induction adapts the inductive hypothesis to these recursive dependencies.

Recursively Defined Sets

A recursively defined set usually has:

  1. base clauses specifying initial objects;
  2. construction clauses specifying how new objects are built;
  3. closure stating that nothing else belongs to the set.

Structural induction mirrors these clauses exactly.

The Structural Induction Principle

Suppose a class \(\mathcal S\) is generated by base objects and recursive construction rules.

To prove

\[ \forall x\in\mathcal S,\;P(x), \]

it is enough to show:

  1. \(P\) holds for every base object;
  2. whenever \(P\) holds for the inputs of a construction rule, it also holds for the output.

The Structural Inductive Hypothesis

In a structural inductive step, we assume that the desired property already holds for the smaller components from which the new object is built.

If an object is formed as

\[ C(x_1,\ldots,x_r), \]

then the hypothesis may be

\[ P(x_1),\ldots,P(x_r). \]

We then prove

\[ P(C(x_1,\ldots,x_r)). \]

A First Recursive Example: Binary Strings

Consider binary strings generated by:

  1. the empty string \(\varepsilon\) is a binary string;
  2. if \(w\) is a binary string, then \(w0\) and \(w1\) are binary strings.

Every finite binary string can be generated by repeatedly appending \(0\) or \(1\).

Example Property: Length Is a Nonnegative Integer

We prove that every recursively generated binary string has nonnegative integer length.

Let

\[ P(w): |w|\in\mathbb Z_{\ge0}. \]

Base Case for Binary Strings

The empty string has length

\[ |\varepsilon|=0. \]

Since

\[ 0\in\mathbb Z_{\ge0}, \]

the base case holds.

Structural Step for Binary Strings

Assume \(w\) is a binary string satisfying

\[ |w|\in\mathbb Z_{\ge0}. \]

Then

\[ |w0|=|w|+1 \]

and

\[ |w1|=|w|+1. \]

Both values are nonnegative integers.

Therefore the construction rules preserve the property.

Hence every binary string has nonnegative integer length.

A Better Example: Number of Symbols Equals Length

For a binary string \(w\), let

\[ z(w)=\text{number of zeros in }w \]

and

\[ o(w)=\text{number of ones in }w. \]

We claim

\[ \boxed{z(w)+o(w)=|w|.} \]

Base Case

For the empty string,

\[ z(\varepsilon)=0, \qquad o(\varepsilon)=0, \qquad |\varepsilon|=0. \]

Therefore,

\[ z(\varepsilon)+o(\varepsilon)=|\varepsilon|. \]

Structural Step: Appending 0

Assume

\[ z(w)+o(w)=|w|. \]

For \(w0\),

\[ z(w0)=z(w)+1 \]

and

\[ o(w0)=o(w). \]

Therefore,

\[ z(w0)+o(w0) = z(w)+1+o(w) \] \[ = |w|+1 \] \[ = |w0|. \]

Structural Step: Appending 1

Again assume

\[ z(w)+o(w)=|w|. \]

For \(w1\),

\[ z(w1)=z(w) \]

and

\[ o(w1)=o(w)+1. \]

Therefore,

\[ z(w1)+o(w1) = z(w)+o(w)+1 \] \[ = |w|+1 \] \[ = |w1|. \]

Thus the identity holds for every binary string.

Recursively Defined Arithmetic Expressions

Consider arithmetic expressions generated by:

  1. every integer is an expression;
  2. if \(E_1\) and \(E_2\) are expressions, then \((E_1+E_2)\) is an expression;
  3. if \(E_1\) and \(E_2\) are expressions, then \((E_1E_2)\) is an expression.

Every expression in this language is built from integers using addition and multiplication.

Example: Every Such Expression Has an Integer Value

We prove that every recursively generated arithmetic expression evaluates to an integer.

Base case:

An integer literal evaluates to an integer.

Structural steps:

If \(E_1\) and \(E_2\) evaluate to integers \(a\) and \(b\), then

\[ E_1+E_2 \]

evaluates to

\[ a+b\in\mathbb Z, \]

and

\[ E_1E_2 \]

evaluates to

\[ ab\in\mathbb Z. \]

Therefore every expression evaluates to an integer.

One Structural Step per Construction Rule

A structural induction proof must address every recursive rule that can create new objects.

If the definition allows:

\[ A(x), \qquad B(x,y), \qquad C(x,y,z), \]

then the proof generally needs separate preservation arguments for all three constructors.

Recursively Defined Logical Formulas

Suppose formulas are generated by:

  1. propositional variables are formulas;
  2. if \(\varphi\) is a formula, then \(\neg\varphi\) is a formula;
  3. if \(\varphi\) and \(\psi\) are formulas, then \((\varphi\land\psi)\) is a formula.

Structural induction can prove properties of every formula in this language.

Unary and Binary Constructors

The negation rule has one recursive input:

\[ \varphi \longrightarrow \neg\varphi. \]

The conjunction rule has two:

\[ \varphi,\psi \longrightarrow (\varphi\land\psi). \]

Therefore the conjunction step may use two inductive hypotheses:

\[ P(\varphi) \quad\text{and}\quad P(\psi). \]

Example: Every Formula Has Finitely Many Symbols

Let \(P(\varphi)\) be:

\[ \varphi\text{ contains finitely many symbols}. \]

Base case:

A propositional variable contains one symbol.

Negation step:

If \(\varphi\) contains finitely many symbols, then adding the symbol \(\neg\) still gives finitely many.

Conjunction step:

If \(\varphi\) and \(\psi\) each contain finitely many symbols, then their combined expression does also.

Therefore every recursively generated formula is finite.

Structural Induction on Trees

Trees are among the most important applications of structural induction.

A rooted binary tree can be defined recursively:

  1. a single vertex is a rooted binary tree;
  2. if \(T_1\) and \(T_2\) are rooted binary trees, attach them beneath a new root to form a new rooted binary tree.

Counting Vertices in a Constructed Tree

If a new tree \(T\) is built from \(T_1\) and \(T_2\), then

\[ V(T)=V(T_1)+V(T_2)+1. \]

Structural induction works well because numerical statistics of the large tree can often be expressed in terms of the same statistics of its subtrees.

Leaves and Internal Vertices

In a full binary tree, every internal vertex has exactly two children.

Let

\[ L(T)=\text{number of leaves} \]

and

\[ I(T)=\text{number of internal vertices}. \]

A classic structural identity is

\[ \boxed{L(T)=I(T)+1.} \]

Base Case for the Full Binary Tree Identity

A one-vertex tree has

\[ L=1 \]

and

\[ I=0. \]

Therefore,

\[ L=I+1. \]

Structural Step for the Full Binary Tree Identity

Suppose a full binary tree \(T\) is formed by joining two smaller full binary trees \(T_1\) and \(T_2\) beneath a new root.

Assume

\[ L(T_1)=I(T_1)+1 \]

and

\[ L(T_2)=I(T_2)+1. \]

Then

\[ L(T)=L(T_1)+L(T_2) \]

and

\[ I(T)=I(T_1)+I(T_2)+1. \]

Finishing the Tree Identity

Using the inductive hypotheses,

\[ L(T) = I(T_1)+1+I(T_2)+1 \] \[ = I(T_1)+I(T_2)+2. \]

Since

\[ I(T)=I(T_1)+I(T_2)+1, \]

we obtain

\[ L(T)=I(T)+1. \]

Therefore the identity holds for every full binary tree.

Why Structural Induction Fits Trees Better Than Ordinary Induction

A tree may have several subtrees.

Its recursive construction depends on their structure, not simply on a single numerical predecessor.

Structural induction allows us to assume the theorem for each immediate subtree and combine those results.

Structural Size and Ordinary Induction

Sometimes structural induction can be translated into ordinary induction on a size measure such as:

But structural induction is often clearer because it follows the definition directly.

Structural Induction and Strong Induction

Structural induction resembles strong induction because a newly built object may depend on several smaller components.

Strong induction says:

\[ \text{assume all smaller numerical cases}. \]

Structural induction says:

\[ \text{assume the property for the recursive components}. \]

Structural Induction and Recursive Algorithms

Recursive algorithms often process a structure by recursively processing its components.

A correctness proof can follow the same pattern:

  1. verify the algorithm on base structures;
  2. assume recursive calls work correctly on smaller components;
  3. prove the combination step is correct.

Example: Summing a Recursive List

Suppose lists are generated by:

  1. the empty list is a list;
  2. if \(L\) is a list and \(x\) is an element, then \(x::L\) is a list.

Define recursively:

\[ \operatorname{sum}([])=0 \]

and

\[ \operatorname{sum}(x::L)=x+\operatorname{sum}(L). \]

Structural induction is the natural method for proving properties of this recursive function.

Example: Length of Concatenation

For recursively defined lists or strings, one can prove

\[ |uv|=|u|+|v|. \]

A structural induction on \(u\) uses:

Base Case for Concatenation Length

If

\[ u=\varepsilon, \]

then

\[ |\varepsilon v| = |v| \]

and

\[ |\varepsilon|+|v| = 0+|v| = |v|. \]

Therefore the identity holds in the base case.

Structural Step for Concatenation Length

Assume

\[ |uv|=|u|+|v|. \]

Let \(a\) be one symbol and consider the extended string \(ua\).

Then

\[ |(ua)v| = |u(av)|. \]

Equivalently, appending one symbol increases total length by \(1\), so

\[ |(ua)v| = |uv|+1 \] \[ = |u|+|v|+1 \] \[ = |ua|+|v|. \]

Therefore the property is preserved.

Structural Induction on Parenthesized Expressions

Suppose expressions are built by:

  1. variables are expressions;
  2. if \(E\) is an expression, then \((-E)\) is an expression;
  3. if \(E_1,E_2\) are expressions, then \((E_1+E_2)\) is an expression.

A proof about all such expressions must check all three constructors.

Count Functions Follow Structure

For recursively built expressions, define:

\[ v(E)=\text{number of variable occurrences}, \] \[ o(E)=\text{number of operators}. \]

Structural induction can establish relationships between these quantities because each constructor changes them predictably.

Structural Induction and Parse Trees

Every recursively defined expression can often be represented by a parse tree.

Base objects correspond to leaves.

Constructors correspond to internal nodes.

Structural induction on the expression is therefore equivalent to induction over its parse tree structure.

Proving Properties of Recursive Definitions

Structural induction is appropriate whenever the domain itself is generated recursively.

Common domains include:

The Definition Tells You the Proof Cases

In ordinary case analysis, we choose useful cases.

In structural induction, the recursive definition usually tells us exactly which cases are required.

Each base clause becomes a base case.

Each recursive constructor becomes a structural step.

Multiple Base Constructors

Some recursive definitions have several base forms.

For example:

Then the proof must verify the desired property for both types of base object.

Multiple Recursive Constructors

A recursively defined class may allow several ways to build larger objects.

Structural induction requires a preservation proof for each one.

Skipping one constructor leaves an entire family of generated objects uncovered.

The Closure Clause Matters

Structural induction works because every object in the class is generated from the base objects using the listed constructors.

If unrelated objects can enter the domain by some other route, the proof no longer covers the entire class.

The recursive definition must be complete.

Common Error: Using the Wrong Base Objects

The base cases must match the actual recursive definition.

If the empty string is the only base object, beginning with arbitrary one-symbol strings may skip part of the construction logic.

Common Error: Forgetting a Constructor

Suppose formulas can be built with both

\[ \neg \]

and

\[ \land. \]

Proving only the conjunction case does not cover formulas produced by negation.

Every recursive rule must be handled.

Common Error: Assuming the Property for the Whole Object

The inductive hypotheses apply to the recursive components.

If proving \(P(C(x,y))\), we may assume

\[ P(x) \quad\text{and}\quad P(y), \]

but not

\[ P(C(x,y)). \]

The latter is exactly what must be proved.

Common Error: Assuming Too Little

A binary constructor may use two smaller objects.

If the proof of

\[ P(C(x,y)) \]

needs information about both components, then both inductive hypotheses should be stated:

\[ P(x) \quad\text{and}\quad P(y). \]

Common Error: Proving Only Small Examples

Checking strings of length \(0,1,2,\) and \(3\) does not prove a statement about all recursively generated strings.

Structural induction requires a general preservation argument for every construction rule.

Common Error: Ignoring Well-Formedness

In formal languages and recursive syntax, not every arbitrary string is a valid object.

The structural proof applies to objects generated by the grammar or recursive definition.

It should not silently assume malformed objects belong to the domain.

Common Error: Confusing Structural Induction with Case Analysis

Structural induction does use cases, but they are not merely unrelated alternatives.

The cases correspond to:

The recursive cases also use inductive hypotheses about smaller components.

Common Error: No Link to the Recursive Definition

A structural induction proof should make clear why the chosen cases generate every object under discussion.

If the proof never references the construction rules, it may not actually be structural induction.

Common Error: Using Size Alone When Structure Matters

Two objects may have the same size but different recursive shapes.

If the property depends on branching or syntax rather than only on size, ordinary induction on size may obscure the essential structure.

Structural induction keeps the recursive form visible.

Choosing Structural Induction

Structural induction is a strong candidate when:

A Reliable Structural Induction Workflow

  1. Write the recursive definition of the object class.
  2. Identify every base constructor.
  3. Identify every recursive constructor.
  4. State the property \(P(x)\) to be proved.
  5. Prove \(P\) for every base object.
  6. For each recursive constructor, assume \(P\) for its recursive inputs.
  7. Use those hypotheses to prove \(P\) for the newly constructed object.
  8. Verify that every construction rule has been covered.
  9. Conclude that every recursively generated object satisfies \(P\).

Example: Full Structural Induction Workflow

Consider full binary trees defined recursively:

  1. a single vertex is a full binary tree;
  2. if \(T_1\) and \(T_2\) are full binary trees, adding a new root whose two children are the roots of \(T_1\) and \(T_2\) creates a full binary tree.

Prove

\[ L(T)=I(T)+1. \]

Step 1: Base Structure

A single-vertex tree has

\[ L=1 \]

and

\[ I=0. \]

Hence

\[ L=I+1. \]

Step 2: Structural Hypotheses

Suppose \(T\) is built from full binary trees \(T_1\) and \(T_2\).

Assume

\[ L(T_1)=I(T_1)+1 \]

and

\[ L(T_2)=I(T_2)+1. \]

Step 3: Combine the Components

The leaves of \(T\) are exactly the leaves of the two subtrees:

\[ L(T)=L(T_1)+L(T_2). \]

The internal vertices are the internal vertices of the two subtrees plus the new root:

\[ I(T)=I(T_1)+I(T_2)+1. \]

Step 4: Use the Inductive Hypotheses

\[ L(T) = I(T_1)+1+I(T_2)+1 \] \[ = I(T_1)+I(T_2)+2 \] \[ = I(T)+1. \]

Therefore the property is preserved by the recursive constructor.

Step 5: Conclude

The identity holds for the base tree and is preserved whenever two full binary trees are combined beneath a new root.

Therefore, by structural induction,

\[ \boxed{L(T)=I(T)+1} \]

for every full binary tree.

Practice 1: Binary Strings

Let \(z(w)\) and \(o(w)\) denote the numbers of zeros and ones in a binary string \(w\).

Prove by structural induction:

\[ z(w)+o(w)=|w|. \]

Practice 2: Arithmetic Expressions

Expressions are built from integers using addition and multiplication.

Prove that every such expression evaluates to an integer.

Practice 3: Full Binary Trees

Prove that every full binary tree satisfies

\[ L=I+1. \]

Practice 4: Formula Finiteness

Logical formulas are built from propositional variables using negation and conjunction.

Prove that every such formula contains finitely many symbols.

Practice 5: Base Cases

A recursive definition has two base constructors.

How many types of base case must a structural induction proof check?

Practice 6: Binary Constructor

Suppose a constructor forms \(C(x,y)\) from two smaller objects.

What inductive hypotheses are normally available?

Practice 7: Missing Constructor

A recursive language allows variables, negation, conjunction, and disjunction.

A proof handles variables, negation, and conjunction only.

Explain why the proof is incomplete.

Practice 8: Structural or Ordinary Induction?

A theorem concerns every recursively generated parse tree.

Which proof method is more natural?

Practice 9: Recursive Lists

Lists are generated from the empty list by repeatedly attaching one new element.

Explain why structural induction on lists resembles ordinary induction on length.

Practice 10: Identify the Error

While proving \(P(C(x,y))\), a student assumes

\[ P(C(x,y)) \]

as the inductive hypothesis.

Explain the error.

Practice Answers

Practice 1

Base case:

\[ z(\varepsilon)=o(\varepsilon)=|\varepsilon|=0. \]

If \(z(w)+o(w)=|w|\), then appending \(0\) increases \(z\) and length by \(1\), while appending \(1\) increases \(o\) and length by \(1\).

Therefore the identity is preserved by both constructors.

Practice 2

Integer literals evaluate to integers.

If \(E_1\) and \(E_2\) evaluate to integers \(a\) and \(b\), then

\[ a+b\in\mathbb Z \]

and

\[ ab\in\mathbb Z. \]

Hence every generated expression evaluates to an integer.

Practice 3

The one-vertex tree satisfies

\[ 1=0+1. \]

If \(T\) is built from \(T_1,T_2\), then

\[ L(T)=L(T_1)+L(T_2) \]

and

\[ I(T)=I(T_1)+I(T_2)+1. \]

Using the inductive hypotheses gives

\[ L(T)=I(T)+1. \]

Practice 4

A variable contains finitely many symbols.

Adding one negation symbol preserves finiteness.

Combining two finite formulas with a conjunction symbol also produces a finite formula.

Practice 5

The proof must check

\[ \boxed{2} \]

types of base case, one for each base constructor.

Practice 6

The usual structural hypotheses are

\[ \boxed{P(x)\text{ and }P(y)}. \]

Practice 7

Objects built using disjunction are not covered.

Every recursive constructor must have its own preservation step.

Practice 8

Structural induction is more natural because the theorem concerns recursively generated trees and their component structure.

Practice 9

Each recursive step attaches one element, increasing the list length by exactly \(1\).

Therefore the recursive construction and numerical length advance together.

Structural induction follows the list constructor, while ordinary induction can follow the corresponding length.

Practice 10

The student has assumed the exact statement that must be proved for the new object.

The inductive hypotheses should apply only to the smaller components:

\[ \boxed{P(x)\text{ and }P(y)}. \]

What to Remember

Structural induction follows the recursive definition of a class of objects:

\[ \boxed{ \text{base objects} + \text{recursive constructors} \Longrightarrow \text{proof cases}. } \]

The strategic question is: How is every object in this class built from smaller valid objects, and does the desired property survive each construction rule?

Where We Go Next

Structural induction follows recursive construction rules. The next proof strategy instead divides all possible situations into a finite collection of exhaustive alternatives and proves the desired statement in each one.

The next lesson, Case Analysis, develops that method.