AFTD Auto-Formalizing Theoretical Domains

norm_sub_smul_sq

theoremverified

Let $V$ be a real inner product space, let $z \in V$, let $n \in V$ be a unit vector with $\|n\| = 1$, and let $a \in \mathbb{R}$. Then $\|z - a \cdot n\|^2 = \|z\|^2 - 2 a \langle n, z \rangle + a^2$.

Statement

open scoped RealInnerProductSpace in
lemma norm_sub_smul_sq
    {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]
    (z n : V) (hn : ‖n‖ = 1) (a : ℝ) :
    ‖z - a • n‖ ^ 2 = ‖z‖ ^ 2 - 2 * a * ⟪n, z⟫ + a ^ 2
Source
arXiv:2611.00379, Lemma 3 proof
Verified
04 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1
  • plank_energy_diff_single_flipLet $V$ be a real inner product space and $\iota$ a finite type with decidable equality. Let $n : \iota \to V$ be unit vectors,…

Read back from the Lean

Let $V$ be a normed additive commutative group with a real inner product space structure ([NormedAddCommGroup V] [InnerProductSpace ℝ V]). For any vectors $z, n \in V$ such that $\|n\| = 1$, and for any real number $a \in \mathbb{R}$, $$\|z - a \cdot n\|^2 = \|z\|^2 - 2a \langle n, z \rangle + a^2,$$ where $\langle \cdot, \cdot \rangle$ denotes the real inner product.

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

The proof expands the squared norm of the difference ‖z - a • n‖² using the standard identity ‖x - y‖² = ‖x‖² - 2 ⟪x, y⟫ + ‖y‖² for real inner product spaces. It evaluates the term ‖a • n‖² to a² using the hypothesis that n is a unit vector. Finally, it pulls the scalar a out of the inner product, applies symmetry ⟪z, n⟫ = ⟪n, z⟫, and concludes by ring arithmetic.

  1. The squared norm of the difference expands to ‖z - a • n‖² = ‖z‖² - 2 ⟪z, a • n⟫ + ‖a • n‖².

    We apply the general identity `norm_sub_sq_real`, which expands the squared norm of a difference in a real inner product space into ‖x - y‖² = ‖x‖² - 2 ⟪x, y⟫ + ‖y‖², with x = z and y = a • n.

    line 7

    uses norm_sub_sq_real

      rw [norm_sub_sq_real]
  2. ‖a • n‖² = a².

    We establish the intermediate claim (h1) that ‖a • n‖² = a². Homogeneity of the norm (`norm_smul`) gives ‖a • n‖ = ‖a‖ * ‖n‖, which after squaring becomes ‖a‖² * ‖n‖² (`mul_pow`). Substituting the unit vector hypothesis ‖n‖ = 1 (hn) simplifies this via `one_pow` and `mul_one` to ‖a‖². Finally, identifying the norm of a real number with the absolute value (`Real.norm_eq_abs`) and using that |a|² = a² (`sq_abs`) yields a².

    lines 8–9

    uses norm_smul, mul_pow, one_pow, mul_one, Real.norm_eq_abs, sq_abs

      have h1 : ‖a • n‖ ^ 2 = a ^ 2 := by
        rw [norm_smul, mul_pow, hn, one_pow, mul_one, Real.norm_eq_abs, sq_abs]
  3. ‖z - a • n‖² = ‖z‖² - 2 * a * ⟪n, z⟫ + a².

    We rewrite the expansion from the first step using ‖a • n‖² = a² (h1). We then pull the scalar a out of the second argument of the inner product using `real_inner_smul_right`, and use symmetry of the real inner product (`real_inner_comm`) to commute ⟪z, n⟫ to ⟪n, z⟫. The two sides now differ only by associativity and commutativity of real multiplication, so polynomial ring arithmetic (`ring`) closes the goal.

    lines 10–11

    uses real_inner_smul_right, real_inner_comm

      rw [h1, real_inner_smul_right, real_inner_comm z n]
      ring
norm_sub_sq_real
In a real inner product space, the squared norm of a difference expands as ‖x - y‖² = ‖x‖² - 2 ⟪x, y⟫ + ‖y‖².
norm_smul
The norm of a scalar multiple is the product of the norm of the scalar and the norm of the vector: ‖r • x‖ = ‖r‖ * ‖x‖.
mul_pow
The power of a product is the product of the powers: (a * b)ⁿ = aⁿ * bⁿ.
one_pow
Any natural power of 1 equals 1: 1ⁿ = 1.
mul_one
Multiplying by 1 leaves an element unchanged: a * 1 = a.
Real.norm_eq_abs
The norm of a real number equals its absolute value: ‖r‖ = |r|.
sq_abs
The square of the absolute value of a number equals its square: |a|² = a².
real_inner_smul_right
In a real inner product space, scalar multiplication in the second argument factors out: ⟪x, r • y⟫ = r * ⟪x, y⟫.
real_inner_comm
The real inner product is symmetric: ⟪y, x⟫ = ⟪x, y⟫.

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

open scoped RealInnerProductSpace in/-- Expansion of the squared norm of a difference with a scaled unit vector in a real inner product space. -/lemma norm_sub_smul_sq    {V : Type*} [NormedAddCommGroup V] [InnerProductSpace ℝ V]    (z n : V) (hn : ‖n‖ = 1) (a : ℝ) :    ‖z - a • n‖ ^ 2 = ‖z‖ ^ 2 - 2 * a * ⟪n, z⟫ + a ^ 2 := by  rw [norm_sub_sq_real]  have h1 : ‖a • n‖ ^ 2 = a ^ 2 := by    rw [norm_smul, mul_pow, hn, one_pow, mul_one, Real.norm_eq_abs, sq_abs]  rw [h1, real_inner_smul_right, real_inner_comm z n]  ring
See it in the graphDiscuss this resultChallenge it