AFTD Auto-Formalizing Theoretical Domains

moore_bound_three_formula

theoremverified

For any integer d ≥ 1, the Moore bound for diameter 3 evaluates to m(d, 3) = d^3 - d^2 + d + 1.

Statement

theorem moore_bound_three_formula (d : ℕ) (hd : 1 ≤ d) : moore_bound d 3 = d ^ 3 - d ^ 2 + d + 1
Source
arXiv:2611.26037 Sec. 1
Verified
22 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 3
  • moore_boundThe Moore bound m(d, k) is defined as 1 + d * ∑_{i=0}^{k-1} (d-1)^i, representing the maximum possible number of vertices in a graph of…
  • TotalPreorderA total preorder: a preorder where ≤ is total (complete). This is weaker than LinearOrder — it does NOT require antisymmetry or…
  • LinearOrder.toTotalPreorderEvery LinearOrder is a TotalPreorder.

Read back from the Lean

For every natural number $d$ satisfying $1 \le d$, $\operatorname{moore\_bound}(d, 3) = d^3 - d^2 + d + 1$.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

The proof, explained

We write d = 1 + e for e ≥ 0 to eliminate the condition d ≥ 1. Expanding the definition of the Moore bound for diameter 3 reduces the left-hand side to 1 + (1 + e)(1 + e + e^2). Because subtraction on natural numbers truncates, we prove (1 + e)^2 ≤ (1 + e)^3 to rewrite (1 + e)^3 - (1 + e)^2 as (1 + e)^2 * e. Substituting this identity eliminates subtraction, allowing both sides to be confirmed equal by ring arithmetic.

  1. We can write d = 1 + e for some natural number e.

    Since 1 ≤ d, Nat.exists_eq_add_of_le provides a natural number e such that d = 1 + e. The obtain tactic substitutes 1 + e for d throughout the goal.

    line 3

    uses Nat.exists_eq_add_of_le

      obtain ⟨e, rfl⟩ := Nat.exists_eq_add_of_le hd
  2. The Moore bound for degree 1 + e and diameter 3 evaluates to 1 + (1 + e) * (1 + e + e^2).

    Unfolding the definition of moore_bound expresses the left-hand side as 1 + (1 + e) * ∑ i ∈ range 3, (1 + e - 1)^i. Applying Finset.sum_range_succ and Finset.sum_range_zero unrolls this sum into three terms (for i = 0, 1, 2), and norm_num simplifies (1 + e - 1) to e and computes the powers, leaving 1 + (1 + e) * (1 + e + e^2).

    lines 4–5

    uses Finset.sum_range_succ, Finset.sum_range_zero

      simp only [moore_bound, Finset.sum_range_succ, Finset.sum_range_zero]
      norm_num
  3. (1 + e)^2 ≤ (1 + e)^3.

    Since e ≥ 0 by Nat.zero_le, we have 1 + e ≥ 1. Non-linear arithmetic (nlinarith) uses this to conclude that (1 + e)^2 ≤ (1 + e)^3.

    line 6

    uses Nat.zero_le

      have hle : (1 + e) ^ 2 ≤ (1 + e) ^ 3 := by nlinarith [Nat.zero_le e]
  4. (1 + e)^3 - (1 + e)^2 = (1 + e)^2 * e.

    Because natural number subtraction is truncated, Nat.sub_eq_iff_eq_add together with the inequality (1 + e)^2 ≤ (1 + e)^3 turns this subtraction into the equivalent addition (1 + e)^3 = (1 + e)^2 * e + (1 + e)^2, which is an identity in any commutative semiring verified by ring.

    lines 7–9

    uses Nat.sub_eq_iff_eq_add

      have h : (1 + e) ^ 3 - (1 + e) ^ 2 = (1 + e) ^ 2 * e := by
        rw [Nat.sub_eq_iff_eq_add hle]
        ring
  5. The Moore bound identity holds: 1 + (1 + e) * (1 + e + e^2) = (1 + e)^3 - (1 + e)^2 + (1 + e) + 1.

    Rewriting with the identity h replaces (1 + e)^3 - (1 + e)^2 by (1 + e)^2 * e, eliminating the subtraction. Both sides are now polynomials in e, and the ring tactic confirms they are equal.

    lines 10–11

      rw [h]
      ring
Nat.exists_eq_add_of_le
If m ≤ n for natural numbers m and n, there exists a natural number k such that n = m + k.
Finset.sum_range_succ
The sum of a function over {0, ..., n} equals the sum over {0, ..., n - 1} plus the term at index n.
Finset.sum_range_zero
The sum of any function over the empty range (range 0) is 0.
Nat.zero_le
Every natural number is greater than or equal to zero.
Nat.sub_eq_iff_eq_add
For natural numbers with b ≤ a, a - b = c if and only if a = c + b.

Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.

Lean source view module on GitHub

/-- Algebraic expansion of the Moore bound m(d, 3) = d^3 - d^2 + d + 1 for d >= 1. -/theorem moore_bound_three_formula (d : ℕ) (hd : 1 ≤ d) : moore_bound d 3 = d ^ 3 - d ^ 2 + d + 1 := by  obtain ⟨e, rfl⟩ := Nat.exists_eq_add_of_le hd  simp only [moore_bound, Finset.sum_range_succ, Finset.sum_range_zero]  norm_num  have hle : (1 + e) ^ 2 ≤ (1 + e) ^ 3 := by nlinarith [Nat.zero_le e]  have h : (1 + e) ^ 3 - (1 + e) ^ 2 = (1 + e) ^ 2 * e := by    rw [Nat.sub_eq_iff_eq_add hle]    ring  rw [h]  ring
See it in the graphDiscuss this resultChallenge it