AFTD Auto-Formalizing Theoretical Domains

prime_convolution_two_support_orbit_formula

theoremverified

The product orbit supported at 0 and minus one produces the two-level rank-one environment plus its two crossed diagonal entries, provided the four offsets are distinct and the indicated doubled difference is nonzero.

Statement

theorem prime_convolution_two_support_orbit_formula (n : ℕ) (r : Fin (n+2))
    (hr0 : r ≠ 0) (hr1 : r ≠ 1) (hr2 : 2*r ≠ 1)
    (htwo : (2 : Fin (n+2)) ≠ 0) (hdouble : 2*(1-r) ≠ 0)
    (A B : ℝ) (j l : Fin (n+2)) :
    (∑ i, in1249_A n A B i * in1249_B n r A B (r*i+j) *
      in1249_A n A B (i+j-l) * in1249_B n r A B (r*(i+j-l)+l)) =
      in1249_P n A B j * in1249_P n A B l +
        A^2*B^2 * (if j=l ∧ (j=r ∨ j=1-r) then 1 else 0)
Source
OP-2466 two-support product orbit computation 42733
Verified
29 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • supportThe support $\mathrm{supp}(p) \subseteq \mathrm{Fin}\,n$ consists of coordinates where $p(i) \neq I$; the weight is…
  • cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…
Used by 1

The proof, explained

The proof computes the convolution of two-support functions over Fin (n+2). First, the summation over the entire group is restricted to the two-point support {0, -1} of the weight function. Second, the resulting two-term algebraic expression is evaluated by casework on the difference j - l: on the diagonal j = l, it produces the square of rectP plus two crossed diagonal terms at r and 1 - r; on the off-diagonals j - l = ±1, overlapping translates match the rank-one product rectP j * rectP l; and elsewhere all terms vanish.

  1. The offsets 0, 1, r, 1-r are pairwise distinct, and the shifts of rectB and rectP are simplified

    From r ≠ 0, r ≠ 1, and 2r ≠ 1, linear arithmetic shows r ≠ 1 - r, 1 - r ≠ 0, and 1 - r ≠ 1. The conditions j - r = 0 and j - r = 1 - r are rewritten as j = r and j = 1, respectively, using sub_eq_zero, and rectB and rectP are expanded.

    lines 18–23

    uses sub_eq_zero

      have hr1r : r ≠ 1-r := by intro h; apply hr2; linear_combination h
      have hr10 : 1-r ≠ 0 := by intro h; apply hr1; linear_combination -h
      have hr11 : 1-r ≠ 1 := by intro h; apply hr0; linear_combination -h
      have e0 : j-r=0 ↔ j=r := sub_eq_zero
      have e1 : j-r=1-r ↔ j=1 := by constructor <;> intro h <;> linear_combination h
      simp only [rectB, rectP, e0, e1]
  2. The diagonal twirl identity holds for all values of j automation

    We split into cases: j = 0, j = 1, j = r, j = 1 - r, and all other j. In each case, substituting j and simplifying using the distinctness of the offsets shows both sides are equal by polynomial ring arithmetic (evaluating to A^4, B^4, A^2*B^2, A^2*B^2, and 0 respectively).

    lines 24–32

    uses Ne.symm

      by_cases h0 : j=0
      · subst j; simp [hr0, hr1, hr2, hr10, hr11, hr1r, Ne.symm hr0, Ne.symm hr10] <;> ring
      · by_cases h1 : j=1
        · subst j; simp [hr0, hr1, hr2, hr10, hr11, hr1r, Ne.symm hr1, Ne.symm hr11] <;> ring
        · by_cases h2 : j=r
          · subst j; simp [h0,h1,hr0,hr1,hr1r,hr10,hr11] <;> ring
          · by_cases h3 : j=1-r
            · subst j; simp [h0,h1,h2,hr0,hr1,hr1r,hr10,hr11, Ne.symm hr1r]
            · simp [h0,h1,h2,h3]
  3. The difference 1 - r and its double are nonzero and distinct from 1 - r

    From r ≠ 1 and 2*(1 - r) ≠ 0, we deduce 1 - r ≠ 0, (1 - r) + (1 - r) ≠ 0, and (1 - r) + (1 - r) ≠ 1 - r by linear combination.

    lines 38–44

      have hr10 : 1-r ≠ 0 := by intro h; apply hr1; linear_combination -h
      have ht0 : (1-r)+(1-r) ≠ 0 := by
        intro h
        apply hdouble
        linear_combination h
      have hts : (1-r)+(1-r) ≠ 1-r := by
        intro h; apply hr10; linear_combination h
  4. The overlap of rectB with its shift by 1 - r is nonzero only at j = 0 automation

    Case analysis on j: if j = 0, the product is A*B; if j = 1 - r, the second factor evaluates to 2*(1 - r), which is neither 0 nor 1 - r, so the term vanishes; if j is neither 0 nor 1 - r, the first factor is zero.

    lines 45–53

      by_cases h0 : j=0
      · subst j
        simp [rectB, hr10]
      · by_cases h1 : j=1-r
        · subst j
          have heq : (1-r)+1-r = (1-r)+(1-r) := by ring
          rw [heq]
          simp [rectB, hr10, ht0, hts]
        · simp [rectB, h0, h1]
  5. The overlap of rectP with its shift by 1 is nonzero only at j = 0

    Case analysis on j: if j = 0, the product is A^2 * B^2. If j = 1, the shifted index is 2, which is neither 1 (since 1 ≠ 0 by one_ne_zero) nor 0 (since 2 ≠ 0), so the second factor is zero. For any other j, the first factor is zero.

    lines 57–68

    uses one_ne_zero

      by_cases h0 : j=0
      · subst j
        simp [rectP]
      · by_cases h1 : j=1
        · subst j
          have h21 : (1 : F)+1 ≠ 1 := by
            intro h
            have hh : (1 : F)=0 := by linear_combination h
            exact one_ne_zero hh
          have h20 : (1 : F)+1 ≠ 0 := by intro h; apply htwo; linear_combination h
          simp [rectP, h20, h21]
        · simp [rectP, h0, h1]
  6. The elements -1 and -2 in F are distinct from 0 and -1

    From 1 ≠ 0 and 2 ≠ 0 in F, we obtain -1 ≠ 0 using neg_ne_zero.mpr, 1 ≠ -1, -2 ≠ 0, and -2 ≠ -1 using one_ne_zero and linear combinations.

    lines 79–85

    uses neg_ne_zero.mpr, one_ne_zero

      have hneg : (-1 : F) ≠ 0 := neg_ne_zero.mpr one_ne_zero
      have htwo' : (1 : F) ≠ -1 := by intro h; apply htwo; linear_combination h
      have hm2 : (-1 : F) - 1 ≠ 0 := by intro h; apply htwo; linear_combination -h
      have hm21 : (-1 : F) - 1 ≠ -1 := by
        intro h
        have hh : (1 : F) = 0 := by linear_combination -h
        exact one_ne_zero hh
  7. The twirl algebra identity holds on the diagonal j = l

    When j = l, the difference j - l is 0, so rectA (j - l) = A and rectA (j - l - 1) = rectA (-1) = B. The LHS simplifies to A^2 * rectB j ^ 2 + B^2 * rectB (j - r) ^ 2, which equals the RHS by rect_twirl_diagonal.

    lines 86–93

    uses rect_twirl_diagonal

      by_cases h0 : j=l
      · subst l
        simp only [sub_self, mul_zero, zero_add, zero_sub, rectA, if_pos rfl, hneg, if_false, true_and]
        simp only [if_true]
        have he : r * (-1) + j = j-r := by ring
        rw [he]
        have hd := rect_twirl_diagonal r hr0 hr1 hr2 A B j
        nlinarith [hd]
  8. The twirl algebra identity holds on the superdiagonal j - l = 1

    When j - l = 1, j ≠ l (using one_ne_zero) and rectA (j - l) = rectA 1 = 0, while rectA (j - l - 1) = rectA 0 = A. The LHS reduces to A * B * rectB l * rectB (l + 1 - r), which equals rect_B_overlap. The RHS is rectP (l + 1) * rectP l, which equals rect_P_overlap. Both sides agree in all cases.

    lines 94–109

    uses rect_B_overlap, rect_P_overlap, one_ne_zero

      · by_cases hp : j-l=1
        · have hj : j=l+1 := by linear_combination hp
          subst j
          have hl : l+1 ≠ l := by
            intro h
            have hh : (1 : F) = 0 := by linear_combination h
            exact one_ne_zero hh
          simp only [add_sub_cancel_left, rectA, one_ne_zero, htwo', if_false, sub_self, if_pos rfl,
            mul_zero, zero_add, hl, false_and, ↓reduceIte, mul_zero, add_zero]
          have hb := rect_B_overlap r hr1 hdouble A B l
          have hc := rect_P_overlap htwo A B l
          by_cases hz : l = 0
          · simp only [if_pos hz] at hb hc
            linear_combination (A*B)*hb - hc
          · simp only [if_neg hz] at hb hc
            linear_combination (A*B)*hb - hc
  9. The twirl algebra identity holds on the subdiagonal j - l = -1

    When j - l = -1, rectA (j - l) = B and rectA (j - l - 1) = rectA (-2) = 0. The LHS reduces to A * B * rectB j * rectB (j + 1 - r), which equals rect_B_overlap. The RHS is rectP j * rectP (j + 1), which equals rect_P_overlap. Both sides agree in all cases.

    lines 110–129

    uses rect_B_overlap, rect_P_overlap

        · by_cases hm : j-l= -1
          · have hl : l=j+1 := by linear_combination -hm
            subst l
            have hj : j ≠ j+1 := by
              intro h
              have hh : (1 : F) = 0 := by linear_combination -h
              exact one_ne_zero hh
            have he : j-(j+1) = (-1 : F) := by ring
            rw [he]
            simp only [rectA, hneg, if_false, if_pos rfl,
              hm2, hm21, mul_zero, zero_add, hj, false_and, ↓reduceIte, add_zero]
            have hb := rect_B_overlap r hr1 hdouble A B j
            have hc := rect_P_overlap htwo A B j
            have hzarg : r*(-1)+(j+1) = j+1-r := by ring
            rw [hzarg]
            by_cases hz : j = 0
            · simp only [if_pos hz] at hb hc
              linear_combination (A*B)*hb - hc
            · simp only [if_neg hz] at hb hc
              linear_combination (A*B)*hb - hc
  10. The twirl algebra identity holds when |j - l| > 1

    When j - l is none of 0, 1, -1, sub_ne_zero.mpr gives j - l ≠ 0, so both rectA (j - l) and rectA (j - l - 1) vanish, making the LHS 0. The RHS is also 0 because rectP is supported on {0, 1}, and any pair of indices from {0, 1} has difference in {0, 1, -1}.

    lines 130–137

    uses sub_ne_zero.mpr

          · have hsub0 : j-l ≠ 0 := sub_ne_zero.mpr h0
            have hsub10 : j-l-1 ≠ 0 := by intro h; apply hp; linear_combination h
            have hsub1n : j-l-1 ≠ -1 := by intro h; apply hsub0; linear_combination h
            have hP : rectP A B j * rectP A B l = 0 := by
              simp only [rectP]
              split_ifs with a b c d <;> simp_all <;> try ring
              all_goals exfalso <;> first | apply hp | apply hm | apply h0 <;> linear_combination a + b
            simp [rectA, hsub0, hm, hsub10, hsub1n, h0, hP]
  11. The convolution sum over Fin (n+2) reduces to the two terms at i = 0 and i = -1

    Since 0 ≠ -1 in Fin (n+2), Fintype.sum_eq_add applies. The weight function in1249_A i vanishes for all i ∉ {0, -1}, so only the summands at i = 0 and i = -1 survive, giving the two-term expression.

    lines 155–166

    uses Fintype.sum_eq_add, Ne.symm

      have h01 : (0 : Fin (n+2)) ≠ -1 := by
        intro h
        have h1 : (1 : Fin (n+2)) = 0 := by linear_combination h
        have h1v : ((1 : Fin (n+2)) : ℕ) = 1 := by simp
        rw [h1] at h1v
        simp at h1v
      rw [Fintype.sum_eq_add 0 (-1) h01]
      · have h10 : (-1 : Fin (n+2)) ≠ 0 := Ne.symm h01
        simp only [in1249_A, if_pos rfl, h01, h10, if_false, if_true]
        congr 1 <;> congr 1 <;> congr 1 <;> try ring
      · intro i ⟨hi0, hi1⟩
        simp [in1249_A, hi0, hi1]
  12. The prime convolution two-support orbit formula holds

    Rewriting the convolution sum with in1249_twirl_support yields the two-term expression, which then equals in1249_P j * in1249_P l plus the crossed diagonal terms by rect_twirl_algebra.

    lines 176–177

    uses in1249_twirl_support, rect_twirl_algebra

      rw [in1249_twirl_support]
      exact rect_twirl_algebra r hr0 hr1 hr2 htwo hdouble A B j l
sub_eq_zero
In an additive group, a - b = 0 if and only if a = b
Ne.symm
Symmetry of inequality: if a ≠ b then b ≠ a
one_ne_zero
In a nontrivial ring, 1 ≠ 0
neg_ne_zero.mpr
If a ≠ 0, then -a ≠ 0
rect_twirl_diagonal
Identity for the diagonal j = l: A^2 * rectB j ^ 2 + B^2 * rectB (j-r) ^ 2 = rectP j ^ 2 + A^2*B^2 * [j ∈ {r, 1-r}]
rect_B_overlap
The product rectB j * rectB (j+1-r) equals A*B if j = 0 and 0 otherwise
rect_P_overlap
The product rectP j * rectP (j+1) equals A^2*B^2 if j = 0 and 0 otherwise
sub_ne_zero.mpr
If a ≠ b, then a - b ≠ 0
Fintype.sum_eq_add
A sum over a finite type where all terms except at a and b are zero equals f a + f b
in1249_twirl_support
Reduces the convolution sum over Fin (n+2) to the sum of the two terms at i = 0 and i = -1
rect_twirl_algebra
Evaluates the two-term twirl sum to rectP j * rectP l plus diagonal correction terms

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 Fin.CommRingset_option maxHeartbeats 1000000set_option linter.all falsevariable {F : Type*} [CommRing F] [Nontrivial F] [DecidableEq F]def rectP (A B : ℝ) (j : F) : ℝ :=  if j=0 then A^2 else if j=1 then B^2 else 0def rectB (r : F) (A B : ℝ) (j : F) : ℝ :=  if j=0 then A else if j=1-r then B else 0-- Case j=l: the four distinct offsets are 0, 1, r, 1-r.theorem rect_twirl_diagonal (r : F) (hr0 : r ≠ 0) (hr1 : r ≠ 1)    (hr2 : 2*r ≠ 1) (A B : ℝ) (j : F) :    A^2 * rectB r A B j ^2 + B^2 * rectB r A B (j-r)^2 =      rectP A B j ^2 + A^2*B^2 * (if j=r ∨ j=1-r then 1 else 0) := by  have hr1r : r ≠ 1-r := by intro h; apply hr2; linear_combination h  have hr10 : 1-r ≠ 0 := by intro h; apply hr1; linear_combination -h  have hr11 : 1-r ≠ 1 := by intro h; apply hr0; linear_combination -h  have e0 : j-r=0 ↔ j=r := sub_eq_zero  have e1 : j-r=1-r ↔ j=1 := by constructor <;> intro h <;> linear_combination h  simp only [rectB, rectP, e0, e1]  by_cases h0 : j=0  · subst j; simp [hr0, hr1, hr2, hr10, hr11, hr1r, Ne.symm hr0, Ne.symm hr10] <;> ring  · by_cases h1 : j=1    · subst j; simp [hr0, hr1, hr2, hr10, hr11, hr1r, Ne.symm hr1, Ne.symm hr11] <;> ring    · by_cases h2 : j=r      · subst j; simp [h0,h1,hr0,hr1,hr1r,hr10,hr11] <;> ring      · by_cases h3 : j=1-r        · subst j; simp [h0,h1,h2,hr0,hr1,hr1r,hr10,hr11, Ne.symm hr1r]        · simp [h0,h1,h2,h3]-- The only overlapping translates of the two-support orbit occur at j=0.theorem rect_B_overlap (r : F) (hr1 : r ≠ 1) (hdouble : 2*(1-r) ≠ 0)    (A B : ℝ) (j : F) :    rectB r A B j * rectB r A B (j+1-r) = if j=0 then A*B else 0 := by  have hr10 : 1-r ≠ 0 := by intro h; apply hr1; linear_combination -h  have ht0 : (1-r)+(1-r) ≠ 0 := by    intro h    apply hdouble    linear_combination h  have hts : (1-r)+(1-r) ≠ 1-r := by    intro h; apply hr10; linear_combination h  by_cases h0 : j=0  · subst j    simp [rectB, hr10]  · by_cases h1 : j=1-r    · subst j      have heq : (1-r)+1-r = (1-r)+(1-r) := by ring      rw [heq]      simp [rectB, hr10, ht0, hts]    · simp [rectB, h0, h1]theorem rect_P_overlap (htwo : (2 : F) ≠ 0) (A B : ℝ) (j : F) :    rectP A B j * rectP A B (j+1) = if j=0 then A^2*B^2 else 0 := by  by_cases h0 : j=0  · subst j    simp [rectP]  · by_cases h1 : j=1    · subst j      have h21 : (1 : F)+1 ≠ 1 := by        intro h        have hh : (1 : F)=0 := by linear_combination h        exact one_ne_zero hh      have h20 : (1 : F)+1 ≠ 0 := by intro h; apply htwo; linear_combination h      simp [rectP, h20, h21]    · simp [rectP, h0, h1]def rectA (A B : ℝ) (j : F) : ℝ :=  if j=0 then A else if j= -1 then B else 0theorem rect_twirl_algebra (r : F) (hr0 : r ≠ 0) (hr1 : r ≠ 1)    (hr2 : 2*r ≠ 1) (htwo : (2 : F) ≠ 0) (hdouble : 2*(1-r) ≠ 0) (A B : ℝ) (j l : F) :    A * rectB r A B j * rectA A B (j-l) * rectB r A B (r*(j-l)+l) +    B * rectB r A B (j-r) * rectA A B (j-l-1) * rectB r A B (r*(j-l-1)+l) =      rectP A B j * rectP A B l +        A^2*B^2 * (if j=l ∧ (j=r ∨ j=1-r) then 1 else 0) := by  have hneg : (-1 : F) ≠ 0 := neg_ne_zero.mpr one_ne_zero  have htwo' : (1 : F) ≠ -1 := by intro h; apply htwo; linear_combination h  have hm2 : (-1 : F) - 1 ≠ 0 := by intro h; apply htwo; linear_combination -h  have hm21 : (-1 : F) - 1 ≠ -1 := by    intro h    have hh : (1 : F) = 0 := by linear_combination -h    exact one_ne_zero hh  by_cases h0 : j=l  · subst l    simp only [sub_self, mul_zero, zero_add, zero_sub, rectA, if_pos rfl, hneg, if_false, true_and]    simp only [if_true]    have he : r * (-1) + j = j-r := by ring    rw [he]    have hd := rect_twirl_diagonal r hr0 hr1 hr2 A B j    nlinarith [hd]  · by_cases hp : j-l=1    · have hj : j=l+1 := by linear_combination hp      subst j      have hl : l+1 ≠ l := by        intro h        have hh : (1 : F) = 0 := by linear_combination h        exact one_ne_zero hh      simp only [add_sub_cancel_left, rectA, one_ne_zero, htwo', if_false, sub_self, if_pos rfl,        mul_zero, zero_add, hl, false_and, ↓reduceIte, mul_zero, add_zero]      have hb := rect_B_overlap r hr1 hdouble A B l      have hc := rect_P_overlap htwo A B l      by_cases hz : l = 0      · simp only [if_pos hz] at hb hc        linear_combination (A*B)*hb - hc      · simp only [if_neg hz] at hb hc        linear_combination (A*B)*hb - hc    · by_cases hm : j-l= -1      · have hl : l=j+1 := by linear_combination -hm        subst l        have hj : j ≠ j+1 := by          intro h          have hh : (1 : F) = 0 := by linear_combination -h          exact one_ne_zero hh        have he : j-(j+1) = (-1 : F) := by ring        rw [he]        simp only [rectA, hneg, if_false, if_pos rfl,          hm2, hm21, mul_zero, zero_add, hj, false_and, ↓reduceIte, add_zero]        have hb := rect_B_overlap r hr1 hdouble A B j        have hc := rect_P_overlap htwo A B j        have hzarg : r*(-1)+(j+1) = j+1-r := by ring        rw [hzarg]        by_cases hz : j = 0        · simp only [if_pos hz] at hb hc          linear_combination (A*B)*hb - hc        · simp only [if_neg hz] at hb hc          linear_combination (A*B)*hb - hc      · have hsub0 : j-l ≠ 0 := sub_ne_zero.mpr h0        have hsub10 : j-l-1 ≠ 0 := by intro h; apply hp; linear_combination h        have hsub1n : j-l-1 ≠ -1 := by intro h; apply hsub0; linear_combination h        have hP : rectP A B j * rectP A B l = 0 := by          simp only [rectP]          split_ifs with a b c d <;> simp_all <;> try ring          all_goals exfalso <;> first | apply hp | apply hm | apply h0 <;> linear_combination a + b        simp [rectA, hsub0, hm, hsub10, hsub1n, h0, hP]open Fin.CommRingdef in1249_A (n : ℕ) (A B : ℝ) (i : Fin (n+2)) : ℝ :=  if i = 0 then A else if i = -1 then B else 0def in1249_B (n : ℕ) (r : Fin (n+2)) (A B : ℝ) (i : Fin (n+2)) : ℝ :=  if i = 0 then A else if i = 1-r then B else 0def in1249_P (n : ℕ) (A B : ℝ) (i : Fin (n+2)) : ℝ :=  if i = 0 then A^2 else if i = 1 then B^2 else 0theorem in1249_twirl_support (n : ℕ) (r : Fin (n+2)) (A B : ℝ)    (j l : Fin (n+2)) :    (∑ i, in1249_A n A B i * in1249_B n r A B (r*i+j) *      in1249_A n A B (i+j-l) * in1249_B n r A B (r*(i+j-l)+l)) =    A * in1249_B n r A B j * in1249_A n A B (j-l) * in1249_B n r A B (r*(j-l)+l) +    B * in1249_B n r A B (j-r) * in1249_A n A B (j-l-1) * in1249_B n r A B (r*(j-l-1)+l) := by  have h01 : (0 : Fin (n+2)) ≠ -1 := by    intro h    have h1 : (1 : Fin (n+2)) = 0 := by linear_combination h    have h1v : ((1 : Fin (n+2)) : ℕ) = 1 := by simp    rw [h1] at h1v    simp at h1v  rw [Fintype.sum_eq_add 0 (-1) h01]  · have h10 : (-1 : Fin (n+2)) ≠ 0 := Ne.symm h01    simp only [in1249_A, if_pos rfl, h01, h10, if_false, if_true]    congr 1 <;> congr 1 <;> congr 1 <;> try ring  · intro i ⟨hi0, hi1⟩    simp [in1249_A, hi0, hi1]theorem prime_convolution_two_support_orbit_formula (n : ℕ) (r : Fin (n+2))    (hr0 : r ≠ 0) (hr1 : r ≠ 1) (hr2 : 2*r ≠ 1)    (htwo : (2 : Fin (n+2)) ≠ 0) (hdouble : 2*(1-r) ≠ 0)    (A B : ℝ) (j l : Fin (n+2)) :    (∑ i, in1249_A n A B i * in1249_B n r A B (r*i+j) *      in1249_A n A B (i+j-l) * in1249_B n r A B (r*(i+j-l)+l)) =      in1249_P n A B j * in1249_P n A B l +        A^2*B^2 * (if j=l ∧ (j=r ∨ j=1-r) then 1 else 0) := by  rw [in1249_twirl_support]  exact rect_twirl_algebra r hr0 hr1 hr2 htwo hdouble A B j l
See it in the graphDiscuss this resultChallenge it