Skip to content
Part IA Michaelmas, Lent Term

Rule Induction

The Rule Induction Principle

Statement

Let RR be a set of rules on XX. Let XRX_R be the set of derivable elements.

To prove xXR.P(x)\forall x \in X_R. P(x): show that for every rule

u1unv\frac{u_1 \quad \cdots \quad u_n}{v}

if P(ui)P(u_i) holds for all premises uiu_i, then P(v)P(v) holds.

Intuition

If every rule “preserves” property PP from premises to conclusion, and PP holds for all axioms (rules with no premises), then PP holds for all derivable elements.

Examinable Proof: Rule Induction is Valid

Theorem: If S={xX:P(x)}S = \{x \in X : P(x)\} is closed under all rules in RR, then XRSX_R \subseteq S.

Proof:

Method: Induction on the height of derivations.

Base case (height 0\leq 0): No derivation has height 00 (a derivation must be a tree with at least a root). Alternatively: axioms have height 11, and SS contains all axiom conclusions since SS is closed under rules with no premises.

Inductive step: Suppose all derivations of height n\leq n have conclusions in SS. Consider a derivation of height n+1n+1 with conclusion vv.

The derivation uses some rule u1unv\frac{u_1 \quad \cdots \quad u_n}{v} where each uiu_i is derived by a subtree of height n\leq n.

By the induction hypothesis, each uiSu_i \in S.

Since SS is closed under the rule, vSv \in S.

Conclusion: By induction, every derivable element is in SS.

Equivalence of Characterisations

Two Characterisations of XRX_R

  1. XR={x:x has a derivation using R}X_R = \{x : x \text{ has a derivation using } R\}
  2. XR={S:S closed under R}X_R = \bigcap \{S : S \text{ closed under } R\}

Proof of Equivalence

(12)(1 \subseteq 2): Every SS closed under RR contains all derivable elements (shown by induction on derivation height).

(21)(2 \subseteq 1): XRX_R is itself closed under RR (union of rule applications preserves membership), and contains exactly the derivable elements.

The Recipe for Rule Induction

To prove xXR.P(x)\forall x \in X_R. P(x):

  1. For each axiom a\frac{}{a}: verify P(a)P(a) holds
  2. For each rule u1unv\frac{u_1 \quad \cdots \quad u_n}{v}: assume P(u1),,P(un)P(u_1), \ldots, P(u_n) and prove P(v)P(v)

This is the single most reusable proof template in this course.

Example: Balanced Parentheses

Rules

εuvu(v)\frac{}{\varepsilon} \qquad \frac{u \quad v}{u(v)}

Define language LRL_R with these rules.

Claim

Every wLRw \in L_R has balanced parentheses: #(’(’) = #(’)’) and every prefix has at least as many ’(’ as ’)’.

Proof by Rule Induction

Axiom: ε\varepsilon has 0 ’(’ and 0 ’)’. Trivially balanced.

Rule: Assume uu and vv are balanced. Consider u(v)u(v).

  • Count: adds 1 ’(’ and 1 ’)’ to total from uu and vv. Since u,vu, v balanced, total balanced.
  • Prefix property: Any prefix is either:
    • A prefix of uu (balanced by IH)
    • uu itself (balanced by IH)
    • u(u( or u(vu(v' where vv' is a prefix of vv (still satisfies prefix property)

Example: Natural Numbers

Rules

0nS(n)\frac{}{0} \qquad \frac{n}{S(n)}

Claim: Every derived nn is either 00 or S(m)S(m) for some derived mm

Proof:

  • Axiom: 00 is of the right form.
  • Rule: S(n)S(n) is of the right form (as successor of nn).

When to Use Rule Induction

Use rule induction when:

  1. The set is defined inductively by rules
  2. The property PP should be preserved by rule application
  3. You need to prove something about all derivable elements

Common applications:

  • Properties of syntax trees
  • Type preservation in programming languages
  • Semantic equivalences
  • Language properties

Summary

  • Rule induction: if SS closed under RR, then XRSX_R \subseteq S
  • Recipe: handle axioms, then each rule preserves PP from premises to conclusion
  • Proof: induction on derivation height
  • Fundamental proof technique for inductively defined sets