helical_dist_sq
For any natural number n and indices i, j : Fin n, the squared Euclidean distance dist (helical_point n i) (helical_point n j) ^ 2 in EuclideanSpace ℝ (Fin 3) equals 2 - 2 * Real.cos (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) + 4 * (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) ^ 2.
Statement
theorem helical_dist_sq (n : ℕ) (i j : Fin n) :
dist (helical_point n i) (helical_point n j) ^ 2 =
2 - 2 * Real.cos (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) +
4 * (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) ^ 2- Source
- arXiv:2610.38368, Section 2
- Verified
- 02 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- helical_pointFor a natural number n and an index j : Fin n, helical_point n j is the vector in EuclideanSpace ℝ (Fin 3) with coordinates cos((j : ℝ) /…
Read back from the Lean
For every natural number $n$ and all indices $i, j : \text{Fin } n$, the squared Euclidean distance between $\text{helical\_point}(n, i)$ and $\text{helical\_point}(n, j)$ is equal to $2 - 2 \cos\left(\frac{|(i : \mathbb{R}) - (j : \mathbb{R})|}{n}\right) + 4 \left(\frac{|(i : \mathbb{R}) - (j : \mathbb{R})|}{n}\right)^2$.
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 computes the squared Euclidean distance between two helical points by decomposing it into the sum of squares of their coordinate differences: two horizontal components and one vertical component. Using the cosine difference formula and the Pythagorean identity cos² θ + sin² θ = 1, the sum of the horizontal squared differences simplifies to 2 - 2 cos(i/n - j/n). Finally, the differences are matched to the theorem statement using the evenness of cosine (cos(-x) = cos x), the identity |x|² = x², and scaling the vertical term to 4((i - j)/n)².
The squared Euclidean distance expands coordinate-wise to (cos(i/n) - cos(j/n))^2 + (sin(i/n) - sin(j/n))^2 + (2i/n - 2j/n)^2.
By EuclideanSpace.dist_sq_eq and Fin.sum_univ_three, the squared distance in ℝ³ is the sum of the squared coordinate distances along the three axes. Unfolding the definition of helical_point and rewriting the 1D real distances via Real.dist_eq yields the sum of squared coordinate differences.
uses
EuclideanSpace.dist_sq_eq,Fin.sum_univ_three,Real.dist_eqhave hdist : dist (helical_point n i) (helical_point n j) ^ 2 = (Real.cos ((i : ℝ) / n) - Real.cos ((j : ℝ) / n)) ^ 2 + (Real.sin ((i : ℝ) / n) - Real.sin ((j : ℝ) / n)) ^ 2 + (2 * (i : ℝ) / n - 2 * (j : ℝ) / n) ^ 2 := by rw [EuclideanSpace.dist_sq_eq, Fin.sum_univ_three] dsimp [helical_point] simp [Real.dist_eq]
The absolute value inside the cosine can be dropped: cos(|i - j| / n) = cos(i/n - j/n).
Writing (i - j)/n as i/n - j/n via sub_div, le_total gives a case split on the sign of i - j. If 0 ≤ i - j, abs_of_nonneg removes the absolute value directly. If i - j ≤ 0, abs_of_nonpos replaces |i - j| with -(i - j); moving the negative sign outside the fraction via neg_div, Real.cos_neg removes it because cosine is an even function.
uses
sub_div,le_total,abs_of_nonneg,abs_of_nonpos,neg_div,Real.cos_neghave hcos : Real.cos (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) = Real.cos ((i : ℝ) / n - (j : ℝ) / n) := by rw [← sub_div] rcases le_total 0 ((i : ℝ) - (j : ℝ)) with h | h · rw [abs_of_nonneg h] · rw [abs_of_nonpos h, neg_div, Real.cos_neg]
The squared absolute ratio equals the squared difference: (|i - j| / n)^2 = (i/n - j/n)^2.
Using sub_div, div_pow, and sq_abs, the fraction (|i - j| / n)^2 simplifies to |i - j|^2 / n^2 = (i - j)^2 / n^2 = (i/n - j/n)^2.
uses
sub_div,div_pow,sq_abshave hsq : (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) ^ 2 = ((i : ℝ) / n - (j : ℝ) / n) ^ 2 := by rw [← sub_div, div_pow, div_pow, sq_abs]
The goal reduces to proving (cos u - cos v)^2 + (sin u - sin v)^2 + (2i/n - 2j/n)^2 = 2 - 2 * cos(u - v) + 4 * (u - v)^2, with u = i/n and v = j/n.
Substituting the coordinate expansion (hdist) and the identities eliminating the absolute values (hcos and hsq) into the main goal eliminates all absolute values, after which u and v are introduced as shorthand for i/n and j/n.
rw [hdist, hcos, hsq] set u : ℝ := (i : ℝ) / n set v : ℝ := (j : ℝ) / n
The horizontal trigonometric terms simplify: (cos u - cos v)^2 + (sin u - sin v)^2 = 2 - 2 * cos(u - v).
Expanding cos(u - v) with Real.cos_sub gives cos u * cos v + sin u * sin v. Expanding the squares on the left and invoking the Pythagorean identity Real.cos_sq_add_sin_sq for both u and v, linear_combination cancels the squared terms to produce 1 + 1 - 2 * cos(u - v) = 2 - 2 * cos(u - v).
uses
Real.cos_sub,Real.cos_sq_add_sin_sqhave h1 : (Real.cos u - Real.cos v) ^ 2 + (Real.sin u - Real.sin v) ^ 2 = 2 - 2 * Real.cos (u - v) := by rw [Real.cos_sub] have h2 := Real.cos_sq_add_sin_sq u have h3 := Real.cos_sq_add_sin_sq v linear_combination h2 + h3
The vertical difference (2i/n - 2j/n)^2 simplifies to 4 * (u - v)^2, and combining this with the horizontal contribution completes the equality.
Ring arithmetic shows that (2u - 2v)^2 = 4 * (u - v)^2 (h4) and that 2i/n - 2j/n equals 2u - 2v (h5). Rewriting the remaining goal with h5, h4, and the trigonometric identity h1 makes both sides identical, closing the proof.
have h4 : (2 * u - 2 * v) ^ 2 = 4 * (u - v) ^ 2 := by ring have h5 : (2 * (i : ℝ) / n - 2 * (j : ℝ) / n) = 2 * u - 2 * v := by dsimp [u, v] ring rw [h5, h4, h1]
EuclideanSpace.dist_sq_eq- In a Euclidean space, the squared distance between two points equals the sum of the squared distances between their coordinates.
Fin.sum_univ_three- A sum of values indexed over Fin 3 equals the sum of the values at indices 0, 1, and 2.
Real.dist_eq- The Euclidean distance between two real numbers equals the absolute value of their difference.
sub_div- Division distributes over subtraction: (a - b) / c = a / c - b / c.
le_total- In a linearly ordered type, any two elements are comparable: a ≤ b or b ≤ a.
abs_of_nonneg- The absolute value of a non-negative number is the number itself: if 0 ≤ a then |a| = a.
abs_of_nonpos- The absolute value of a non-positive number is its negation: if a ≤ 0 then |a| = -a.
neg_div- Negating the numerator negates the quotient: -b / a = -(b / a).
Real.cos_neg- The cosine function is even: cos(-x) = cos x.
div_pow- A quotient raised to a power distributes the exponent to numerator and denominator: (a / b) ^ n = a ^ n / b ^ n.
sq_abs- The square of the absolute value of a number equals the square of the number: |a| ^ 2 = a ^ 2.
Real.cos_sub- The cosine difference formula: cos(x - y) = cos x * cos y + sin x * sin y.
Real.cos_sq_add_sin_sq- The fundamental Pythagorean trigonometric identity: cos x ^ 2 + sin x ^ 2 = 1.
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.
/-- The squared distance between helical points P_i and P_j depends only on |i - j|. -/theorem helical_dist_sq (n : ℕ) (i j : Fin n) : dist (helical_point n i) (helical_point n j) ^ 2 = 2 - 2 * Real.cos (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) + 4 * (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) ^ 2 := by have hdist : dist (helical_point n i) (helical_point n j) ^ 2 = (Real.cos ((i : ℝ) / n) - Real.cos ((j : ℝ) / n)) ^ 2 + (Real.sin ((i : ℝ) / n) - Real.sin ((j : ℝ) / n)) ^ 2 + (2 * (i : ℝ) / n - 2 * (j : ℝ) / n) ^ 2 := by rw [EuclideanSpace.dist_sq_eq, Fin.sum_univ_three] dsimp [helical_point] simp [Real.dist_eq] have hcos : Real.cos (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) = Real.cos ((i : ℝ) / n - (j : ℝ) / n) := by rw [← sub_div] rcases le_total 0 ((i : ℝ) - (j : ℝ)) with h | h · rw [abs_of_nonneg h] · rw [abs_of_nonpos h, neg_div, Real.cos_neg] have hsq : (((|((i : ℝ) - (j : ℝ))|) : ℝ) / n) ^ 2 = ((i : ℝ) / n - (j : ℝ) / n) ^ 2 := by rw [← sub_div, div_pow, div_pow, sq_abs] rw [hdist, hcos, hsq] set u : ℝ := (i : ℝ) / n set v : ℝ := (j : ℝ) / n have h1 : (Real.cos u - Real.cos v) ^ 2 + (Real.sin u - Real.sin v) ^ 2 = 2 - 2 * Real.cos (u - v) := by rw [Real.cos_sub] have h2 := Real.cos_sq_add_sin_sq u have h3 := Real.cos_sq_add_sin_sq v linear_combination h2 + h3 have h4 : (2 * u - 2 * v) ^ 2 = 4 * (u - v) ^ 2 := by ring have h5 : (2 * (i : ℝ) / n - 2 * (j : ℝ) / n) = 2 * u - 2 * v := by dsimp [u, v] ring rw [h5, h4, h1]