AFTD Auto-Formalizing Theoretical Domains

standard_quad_cons_cons

theoremverified

For any natural number $d$, prime $p$, scalars $a, b \in \mathbb{Z}/p\mathbb{Z}$, and vector $v \in (\mathbb{Z}/p\mathbb{Z})^d$, $Q_{d+2}((a, b, v)) = a^2 + b^2 + Q_d(v)$.

Statement

theorem standard_quad_cons_cons (d : ℕ) {p : ℕ} (a b : ZMod p) (v : Fin d → ZMod p) :
    standard_quad (d + 2) (Matrix.vecCons a (Matrix.vecCons b v)) = a ^ 2 + b ^ 2 + standard_quad d v
Source
step towards cylinder_construction_distance_set
Verified
31 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 1
  • standard_quadThe standard quadratic form $Q_d$ on $(\mathbb{Z}/p\mathbb{Z})^d$, defined by $Q_d(x) = \sum_{i} x_i^2$.
Used by 2
  • cylinder_construction_distance_setLet $p$ be an odd prime (with $p$ prime and $p$ odd) and let $m \ge 0$ be a natural number. There exist an $m$-dimensional submodule…
  • cylinder_construction_stepLet $p$ be prime. Given an $m$-dimensional totally isotropic subspace $W \le (\mathbb{Z}/p\mathbb{Z})^d$ and a vector $e \notin W$…

The proof, explained

The identity is proven by expanding the definition of the quadratic form $Q_{d+2}$ as a sum of squares over $\mathrm{Fin}(d+2)$. The simplifier splits off the first two terms of the summation using `Fin.sum_univ_succ`, simplifies the vector head evaluations on $(a, b, v)$ to $a^2$ and $b^2$ via `Matrix.vecCons`, and identifies the remaining summation as $Q_d(v)$, using associativity of addition to group the terms.

  1. $Q_{d+2}((a, b, v)) = a^2 + b^2 + Q_d(v)$ automation

    Unfolding the definition of `standard_quad` expresses the left-hand side as a sum of squares over $\mathrm{Fin}(d+2)$. Applying `Fin.sum_univ_succ` extracts the first coordinate, which equals $a$ by the definition of `Matrix.vecCons`, giving $a^2$ plus a sum over $\mathrm{Fin}(d+1)$. A second application of `Fin.sum_univ_succ` extracts the second coordinate $b$, giving $b^2$ plus the sum of squares over the remaining vector $v$, which is `standard_quad d v`. Finally, `add_assoc` reassociates $(a^2 + b^2) + Q_d(v)$ to match the right-hand side.

    line 4

    uses standard_quad, Matrix.vecCons, Fin.sum_univ_succ, add_assoc

      simp [standard_quad, Matrix.vecCons, Fin.sum_univ_succ, add_assoc]
standard_quad
The standard quadratic form on $(\mathbb{Z}/p\mathbb{Z})^d$, defined as the sum of the squares of the components: $\sum_{i \in \mathrm{Fin}\,d} (x_i)^2$.
Matrix.vecCons
The operation prepending a scalar $a$ to an $n$-dimensional vector $v$ to obtain an $(n+1)$-dimensional vector with $(a, v)_0 = a$ and $(a, v)_{i+1} = v_i$.
Fin.sum_univ_succ
A sum over $\mathrm{Fin}(n+1)$ can be split into its first term at index $0$ and the sum of the remaining terms over $\mathrm{Fin}\,n$: $\sum_{i} f(i) = f(0) + \sum_{i} f(i+1)$.
add_assoc
Addition is associative: $(a + b) + c = a + (b + c)$.

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

/-- The standard quadratic form Q_{d+2} evaluated on a vector with two prepended coordinates equals a^2 + b^2 + Q_d(v). -/theorem standard_quad_cons_cons (d : ℕ) {p : ℕ} (a b : ZMod p) (v : Fin d → ZMod p) :    standard_quad (d + 2) (Matrix.vecCons a (Matrix.vecCons b v)) = a ^ 2 + b ^ 2 + standard_quad d v := by  simp [standard_quad, Matrix.vecCons, Fin.sum_univ_succ, add_assoc]
See it in the graphDiscuss this resultChallenge it