cylinder_quad_expansion
For any natural numbers $d$ and $p$, any submodule $W \le (\mathbb{Z}/p\mathbb{Z})^d$ that is totally isotropic with respect to $Q_d$, and any vector $e \in (\mathbb{Z}/p\mathbb{Z})^d$ orthogonal to every element of $W$ under the standard dot product, for all $w, w' \in W$ and all $a, b \in \mathbb{Z}/p\mathbb{Z}$, $Q_d((w + a \cdot e) - (w' + b \cdot e)) = (a - b)^2 Q_d(e)$.
Statement
theorem cylinder_quad_expansion
(d : ℕ) {p : ℕ}
(W : Submodule (ZMod p) (Fin d → ZMod p)) (e : Fin d → ZMod p)
(h_iso : is_totally_isotropic d W)
(h_orth : ∀ w ∈ W, dotProduct e w = 0) :
∀ w ∈ W, ∀ w' ∈ W, ∀ (a b : ZMod p),
standard_quad d ((w + a • e) - (w' + b • e)) = (a - b) ^ 2 * standard_quad d e- Source
- arXiv:2610.34758 Lemma 2.3 proof
- Verified
- 28 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- standard_quadThe standard quadratic form $Q_d$ on $(\mathbb{Z}/p\mathbb{Z})^d$, defined by $Q_d(x) = \sum_{i} x_i^2$.
- is_totally_isotropicA subspace $W \subset (\mathbb{Z}/p\mathbb{Z})^d$ is totally isotropic with respect to the standard quadratic form $Q_d$ if $Q_d(w) = 0$…
- Used by 1
- cylinder_distance_setFor any natural numbers $d$ and $p$, any submodule $W \le (\mathbb{Z}/p\mathbb{Z})^d$ that is totally isotropic with respect to $Q_d$, any…
Read back from the Lean
For a natural number $d$, an (implicit) natural number $p$, a submodule $W \le (\text{Fin } d \to \mathbb{Z}/p\mathbb{Z})$ over $\mathbb{Z}/p\mathbb{Z}$, and a vector $e : \text{Fin } d \to \mathbb{Z}/p\mathbb{Z}$, assuming that $W$ is totally isotropic (i.e., is_totally_isotropic d W) and that $e$ is orthogonal to every vector in $W$ (i.e., $\text{dotProduct } e\ w = 0$ for all $w \in W$): for all $w, w' \in W$ and all scalars $a, b \in \mathbb{Z}/p\mathbb{Z}$, the standard quadratic form evaluated at $(w + a \cdot e) - (w' + b \cdot e)$ equals $(a - b)^2 \cdot \text{standard\_quad } d\ e$.
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
To evaluate the quadratic form Q_d on the difference (w + a • e) - (w' + b • e), we first rearrange it as (w - w') + (a - b) • e and express Q_d as a dot product with itself. We then expand this inner product using bilinearity into four terms. Because W is totally isotropic and e is orthogonal to W, the self-product of w - w' and both cross terms with e vanish. The remaining term simplifies to (a - b)^2 Q_d(e).
For any vector x, the standard quadratic form Q_d(x) equals the dot product x ⬝ᵥ x. automation
By definition, standard_quad d x is ∑ i, (x i) ^ 2 and dotProduct x x is ∑ i, x i * x i. The simp tactic unfolds these definitions and rewrites (x i) ^ 2 to x i * x i using sq.
uses
sqlemma cylinder_quad_expansion_eq_dotProduct (d : ℕ) {p : ℕ} (x : Fin d → ZMod p) : standard_quad d x = dotProduct x x := by simp [standard_quad, dotProduct, sq]
Fix arbitrary vectors w, w' ∈ W and scalars a, b ∈ ℤ/pℤ.
We introduce the universally quantified vectors w and w' with their membership proofs hw : w ∈ W and hw' : w' ∈ W, along with the scalars a, b : ℤ/pℤ.
intro w hw w' hw' a bThe quadratic form on the difference equals the self dot product of (w - w') + (a - b) • e.
We rearrange (w + a • e) - (w' + b • e) into (w - w') + (a - b) • e using module arithmetic (the module tactic), and then rewrite the quadratic form into a self dot product using cylinder_quad_expansion_eq_dotProduct.
uses
cylinder_quad_expansion_eq_dotProducthave h_diff : (w + a • e) - (w' + b • e) = (w - w') + (a - b) • e := by module rw [h_diff] rw [cylinder_quad_expansion_eq_dotProduct]
The difference w - w' lies in W, which implies e ⬝ᵥ (w - w') = 0, (w - w') ⬝ᵥ e = 0, and (w - w') ⬝ᵥ (w - w') = 0.
Since W is a submodule, w - w' ∈ W. By the orthogonality hypothesis h_orth, e ⬝ᵥ (w - w') = 0. By symmetry of the dot product (dotProduct_comm), (w - w') ⬝ᵥ e = 0. Finally, expressing (w - w') ⬝ᵥ (w - w') as standard_quad d (w - w') via cylinder_quad_expansion_eq_dotProduct, it vanishes because W is totally isotropic (h_iso).
uses
dotProduct_comm,cylinder_quad_expansion_eq_dotProducthave hu_mem : w - w' ∈ W := W.sub_mem hw hw' have heu : dotProduct e (w - w') = 0 := h_orth (w - w') hu_mem have hue : dotProduct (w - w') e = 0 := by rw [dotProduct_comm, heu] have huu : dotProduct (w - w') (w - w') = 0 := by rw [← cylinder_quad_expansion_eq_dotProduct] exact h_iso (w - w') hu_mem
Expanding the bilinear dot product and substituting the vanishing terms yields (a - b) ^ 2 * standard_quad d e. automation
We expand the dot product of (w - w') + (a - b) • e with itself using distributivity (add_dotProduct, dotProduct_add) and scalar multiplication rules (smul_dotProduct, dotProduct_smul). We then substitute the known zero dot products huu, heu, hue, rewrite e ⬝ᵥ e back to standard_quad d e using cylinder_quad_expansion_eq_dotProduct, and conclude using ring arithmetic.
uses
add_dotProduct,dotProduct_add,smul_dotProduct,dotProduct_smul,cylinder_quad_expansion_eq_dotProductsimp only [add_dotProduct, dotProduct_add, smul_dotProduct, dotProduct_smul] rw [huu, heu, hue] rw [← cylinder_quad_expansion_eq_dotProduct] ring
sq- In any monoid, the square a ^ 2 is equal to a * a.
cylinder_quad_expansion_eq_dotProduct- The standard quadratic form Q_d(x) on (ZMod p)^d equals the self dot product x ⬝ᵥ x.
dotProduct_comm- The dot product is commutative: v ⬝ᵥ w = w ⬝ᵥ v.
add_dotProduct- The dot product distributes over addition in the first argument: (u + v) ⬝ᵥ w = u ⬝ᵥ w + v ⬝ᵥ w.
dotProduct_add- The dot product distributes over addition in the second argument: u ⬝ᵥ (v + w) = u ⬝ᵥ v + u ⬝ᵥ w.
smul_dotProduct- Scalar multiplication factors out of the first argument of the dot product: (c • v) ⬝ᵥ w = c • (v ⬝ᵥ w).
dotProduct_smul- Scalar multiplication factors out of the second argument of the dot product: v ⬝ᵥ (c • w) = c • (v ⬝ᵥ w).
- Line 14 uses the `module` tactic to rearrange vector expressions using the module axioms for Fin d → ZMod p.
- Line 26 uses the `ring` tactic to close the goal via polynomial arithmetic in ZMod p.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
lemma cylinder_quad_expansion_eq_dotProduct (d : ℕ) {p : ℕ} (x : Fin d → ZMod p) : standard_quad d x = dotProduct x x := by simp [standard_quad, dotProduct, sq]/-- Expansion of the standard quadratic form on differences of elements of the cylinder set. -/theorem cylinder_quad_expansion (d : ℕ) {p : ℕ} (W : Submodule (ZMod p) (Fin d → ZMod p)) (e : Fin d → ZMod p) (h_iso : is_totally_isotropic d W) (h_orth : ∀ w ∈ W, dotProduct e w = 0) : ∀ w ∈ W, ∀ w' ∈ W, ∀ (a b : ZMod p), standard_quad d ((w + a • e) - (w' + b • e)) = (a - b) ^ 2 * standard_quad d e := by intro w hw w' hw' a b have h_diff : (w + a • e) - (w' + b • e) = (w - w') + (a - b) • e := by module rw [h_diff] rw [cylinder_quad_expansion_eq_dotProduct] have hu_mem : w - w' ∈ W := W.sub_mem hw hw' have heu : dotProduct e (w - w') = 0 := h_orth (w - w') hu_mem have hue : dotProduct (w - w') e = 0 := by rw [dotProduct_comm, heu] have huu : dotProduct (w - w') (w - w') = 0 := by rw [← cylinder_quad_expansion_eq_dotProduct] exact h_iso (w - w') hu_mem simp only [add_dotProduct, dotProduct_add, smul_dotProduct, dotProduct_smul] rw [huu, heu, hue] rw [← cylinder_quad_expansion_eq_dotProduct] ring