Non-Constant Binomial Terms Vanish for Chebyshev Angles

StatusFully Proven
TypeTheorem
ModuleChebyshevCircles.Proofs.ChebyshevOrthogonality

Statement

Theorem Non-Constant Binomial Terms Vanish for Chebyshev Angles

For $0 < j < N$, $0 \leq r \leq j$, and $(2r - j) \neq 0$, $\sum_{k=0}^{N-1} \cos\!\left(\frac{(2r-j)(2k+1)\pi}{2N}\right) = 0$. The proof splits by parity of $j$: when $j$ is odd, $(2r-j)$ is odd and the odd vanishing lemma applies; when $j$ is even, $(2r-j)$ is even and the even vanishing lemma applies.

theorem binomial_terms_vanish_chebyshev (N j r : ) (hN : 0 < N) (hj' : j < N)
    (hr : r  range (j + 1)) (hr_neq : (2 * r - j : )  0) :
     k  range N, Real.cos ((2 * r - j : ) * (2 * k + 1 : ) * π / (2 * N)) = 0 := by
Proof

Case split on the parity of $j$. In each case, verify the bound $|2r-j| < 2N$ (or $|2r-j| < N$ for the even case) and apply the corresponding vanishing lemma. The negative even case uses $\cos(-x) = \cos(x)$.


  -- We need to show:
  -- 1. (2r - j) is odd
  -- 2. |2r - j| < 2N
  -- Then apply sum_cos_chebyshev_angles_vanishes

  -- First establish the bound: r ≤ j
  have hr_le : r  j := by
    simp only [mem_range] at hr
    omega

  -- Split by parity of j
  by_cases h_parity : Odd j
  · -- Case 1: j is odd, so (2r - j) is odd
    have h_odd : Odd (2 * r - j : ) := by
      obtain m, hm := h_parity
      use (r : ) - m - 1
      have : (j : ) = 2 * m + 1 := by exact_mod_cast hm
      calc (2 * r - j : )
        _ = 2 * (r : ) - (2 * m + 1) := by rw [this]
        _ = 2 * ((r : ) - m - 1) + 1 := by ring

    -- Prove |2r - j| < 2N
    have h_bound : |(2 * r - j : )| < 2 * N := by
      by_cases hr_case : 2 * r  j
      · rw [abs_of_nonneg (Int.sub_nonneg_of_le (by omega : (j : )  (2 * r : )))]
        calc (2 * r - j : )
          _  (2 * j - j : ) := by omega
          _ = (j : ) := by ring
          _ < (N : ) := by omega
          _ < (2 * N : ) := by omega
      · push_neg at hr_case
        rw [abs_of_neg (Int.sub_neg_of_lt (by omega : (2 * r : ) < (j : )))]
        calc -(2 * r - j : )
          _ = (j - 2 * r : ) := by ring
          _  (j : ) := by omega
          _ < (N : ) := by omega
          _ < (2 * N : ) := by omega

    -- Apply odd vanishing lemma
    convert sum_cos_chebyshev_angles_vanishes N (2 * r - j) hN hr_neq h_odd h_bound using 2

  · -- Case 2: j is even, so (2r - j) is even
    have j_even : Even j := Nat.not_odd_iff_even.mp h_parity
    have h_even : Even (2 * r - j : ) := by
      obtain m, hm := j_even
      use (r : ) - m
      have : (j : ) = (m + m : ) := by simp [hm]
      calc (2 * r - j : )
        _ = 2 * (r : ) - ((m : ) + (m : )) := by rw [this]; simp
        _ = 2 * (r : ) - 2 * (m : ) := by ring
        _ = ((r : ) - (m : )) + ((r : ) - (m : )) := by ring

    -- Convert to natural number case
    -- Need to handle both positive and negative cases of (2r - j)
    by_cases h_sign : 2 * r  j
    · -- Positive case: 2r - j ≥ 0
      have h_pos : 0  (2 * r - j : ) := Int.sub_nonneg_of_le (by omega : (j : )  (2 * r : ))
      obtain m_nat, hm_nat := Int.eq_ofNat_of_zero_le h_pos

      -- Show m_nat is even and bounded
      have hm_even : Even m_nat := by
        have := h_even
        rwa [hm_nat, Int.even_coe_nat] at this

      have hm_pos : 0 < m_nat := by
        by_contra h
        push_neg at h
        have : m_nat = 0 := by omega
        rw [this] at hm_nat
        simp at hm_nat
        omega

      have hm_bound : m_nat < N := by
        have : (m_nat : ) < N := by
          calc (m_nat : )
            _ = 2 * r - j := by rw [ hm_nat]
            _  2 * j - j := by omega
            _ = j := by ring
            _ < N := by omega
        omega

      -- Apply even vanishing lemma
      calc  k  range N, Real.cos ((2 * r - j : ) * (2 * k + 1 : ) * π / (2 * N))
          _ =  k  range N, Real.cos ((m_nat : ) * (2 * k + 1 : ) * π / (2 * N)) := by
              congr 1; ext k; congr 1
              rw [hm_nat]
              norm_cast
          _ = 0 := sum_cos_chebyshev_angles_even_vanishes N m_nat hN hm_pos hm_even hm_bound

    · -- Negative case: 2r - j < 0, use cos(-x) = cos(x)
      have h_neg : (2 * r - j : ) < 0 := Int.sub_neg_of_lt (by omega : (2 * r : ) < (j : ))
      have h_pos : 0 < -(2 * r - j : ) := by omega

      obtain m_nat, hm_nat := Int.eq_ofNat_of_zero_le (by omega : 0  -(2 * r - j : ))

      -- Show m_nat is even and bounded
      have hm_even : Even m_nat := by
        have : Even (-(2 * r - j : )) := by
          obtain k, hk := h_even
          use -k
          calc -(2 * r - j : )
            _ = -(k + k) := by rw [hk]
            _ = -k + -k := by ring
        rwa [hm_nat, Int.even_coe_nat] at this

      have hm_pos : 0 < m_nat := by
        have : (m_nat : )  0 := by
          intro h
          rw [h] at hm_nat
          simp at hm_nat
          omega
        omega

      have hm_bound : m_nat < N := by
        have : (m_nat : ) < N := by
          calc (m_nat : )
            _ = -(2 * r - j) := by rw [ hm_nat]
            _ = j - 2 * r := by ring
            _  j := by omega
            _ < N := by omega
        omega

      -- Apply even vanishing lemma with cos(-x) = cos(x)
      calc  k  range N, Real.cos ((2 * r - j : ) * (2 * k + 1 : ) * π / (2 * N))
          _ =  k  range N, Real.cos ((-(m_nat : )) * (2 * k + 1 : ) * π / (2 * N)) := by
              congr 1; ext k; congr 1
              have : (2 * r - j : ) = -(m_nat : ) := by rw [ hm_nat]; ring
              rw [this]
              norm_cast
          _ =  k  range N, Real.cos ((m_nat : ) * (2 * k + 1 : ) * π / (2 * N)) := by
              congr 1; ext k
              have : ((-(m_nat : )) * (2 * k + 1 : ) * π / (2 * N) : ) =
                  -((m_nat : ) * (2 * k + 1 : ) * π / (2 * N)) := by
                push_cast; ring
              rw [this, Real.cos_neg]
              norm_cast
          _ = 0 := sum_cos_chebyshev_angles_even_vanishes N m_nat hN hm_pos hm_even hm_bound

Neighborhood

Legend
Not Ready
Work in Progress
Sorry (theorems only)
Proven/Defined
Fully Proven (theorems only)
Axiom
Mathlib Ready
Theorems/Lemmas
Definitions
Axioms