Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

[Formalized by test on 24 Nov 2026]

Title:Lemma crystal_descent · Unique Crystal Components

Source:Problems from arXiv papers
Proved lemma Checked by Lean. Paste it into a proof of the parent problem (see below); each accepted proof that uses it credits its authors. See the proof by test, 24 Nov 2026.
Statement:reviewed
Reuse this lemma — paste it into your Solution.lean, before the theorem that uses it
/-- Intermediate lemma (nosorry): Vieta jumping. A crystal pair (a, b) with a < b either is the first pair of its chain ((a-1)² = 2(b+1), i.e. X = k) or descends to the smaller crystal pair (c, a) with c = (a-1)²/(b+1) - 1 and the sam -/
theorem crystal_descent (a b : ℕ) (h : IsCrystalWithComponents (a * b) a b) (hlt : a < b) : (a - 1) ^ 2 = 2 * (b + 1) ∨ (IsCrystalWithComponents (((a - 1) ^ 2 / (b + 1) - 1) * a) ((a - 1) ^ 2 / (b + 1) - 1) a ∧ (a - 1) ^ 2 / (b + 1) - 1 < a ∧ (a + b) ^ 2 * (((a - 1) ^ 2 / (b + 1) - 1 + 1) * (a + 1)) = ((a - 1) ^ 2 / (b + 1) - 1 + a) ^ 2 * ((a + 1) * (b + 1))) := by
  obtain ⟨hn, ha, hb, -, hdiv⟩ := (isCrystalWithComponents_iff_sum_sq_dvd _ _ _).1 h
  obtain ⟨-, -, -, -, h1, h2⟩ := (isCrystalWithComponents_iff_two_mul_dvd _ _ _).1 h
  obtain ⟨x, rfl⟩ : ∃ x, a = 2 * x + 1 := (Nat.Odd.of_mul_left hn).exists_bit1
  obtain ⟨y, rfl⟩ : ∃ y, b = 2 * y + 1 := (Nat.Odd.of_mul_right hn).exists_bit1
  have hx : 1 ≤ x := by omega
  have hxy : x < y := by omega
  rw [Nat.add_sub_cancel] at h2 ⊢
  rw [Nat.add_sub_cancel] at h1
  -- `y + 1 ∣ x ^ 2` and `x + 1 ∣ y ^ 2`
  obtain ⟨Z, hZ⟩ : (y + 1) ∣ x ^ 2 := by
    have : 4 * (y + 1) ∣ 4 * x ^ 2 := by
      have e : 2 * (2 * y + 1 + 1) = 4 * (y + 1) := by ring
      have e' : (2 * x) ^ 2 = 4 * x ^ 2 := by ring
      rwa [e, e'] at h2
    exact (Nat.mul_dvd_mul_iff_left (by norm_num)).1 this
  have hyx : (x + 1) ∣ y ^ 2 := by
    have : 4 * (x + 1) ∣ 4 * y ^ 2 := by
      have e : 2 * (2 * x + 1 + 1) = 4 * (x + 1) := by ring
      have e' : (2 * y) ^ 2 = 4 * y ^ 2 := by ring
      rwa [e, e'] at h1
    exact (Nat.mul_dvd_mul_iff_left (by norm_num)).1 this
  have hq : (2 * x) ^ 2 / (2 * y + 1 + 1) = 2 * Z := by
    have e : (2 * x) ^ 2 = (2 * y + 1 + 1) * (2 * Z) := by rw [mul_pow, hZ]; ring
    rw [e, Nat.mul_div_cancel_left _ (by omega)]
  rw [hq]
  obtain ⟨k, hk⟩ := hdiv
  have hk' : (x + y + 1) ^ 2 = (x + 1) * (y + 1) * k := by
    have e : (2 * x + 1 + (2 * y + 1)) ^ 2 = 4 * (x + y + 1) ^ 2 := by ring
    have e' : (2 * x + 1 + 1) * (2 * y + 1 + 1) * k = 4 * ((x + 1) * (y + 1) * k) := by ring
    rw [e, e'] at hk
    omega
  have hZpos : 1 ≤ Z := by
    rcases Nat.eq_zero_or_pos Z with h0 | h0
    · rw [h0, mul_zero] at hZ
      have : 0 < x ^ 2 := by positivity
      omega
    · exact h0
  rcases Nat.lt_or_ge Z 2 with hZ1 | hZ2
  · left
    have : Z = 1 := by omega
    subst this
    rw [mul_pow, hZ]; ring
  · right
    -- integer form of the Vieta relation `Z = (k - 2) (x + 1) + 1 - y`
    have hZi : (x : ℤ) ^ 2 = ((y : ℤ) + 1) * Z := by exact_mod_cast hZ
    have hki : ((x : ℤ) + y + 1) ^ 2 = ((x : ℤ) + 1) * ((y : ℤ) + 1) * k := by exact_mod_cast hk'
    have hW : (Z : ℤ) = ((k : ℤ) - 2) * ((x : ℤ) + 1) + 1 - y := by
      have hm : ((y : ℤ) + 1) * ((Z : ℤ) - (((k : ℤ) - 2) * ((x : ℤ) + 1) + 1 - y)) = 0 := by
        linear_combination (-1 : ℤ) * hZi + hki
      rcases mul_eq_zero.1 hm with h0 | h0
      · exfalso; have : (0 : ℤ) ≤ y := by positivity
        linarith
      · linarith
    have hc1 : 2 * Z - 1 + 1 = 2 * Z := by omega
    refine ⟨?_, by nlinarith, ?_⟩
    · rw [isCrystalWithComponents_iff_two_mul_dvd]
      refine ⟨?_, by omega, by omega, rfl, ?_, ?_⟩
      · refine Nat.odd_mul.2 ⟨?_, ?_⟩
        · exact ⟨Z - 1, by omega⟩
        · exact ⟨x, rfl⟩
      · -- `2 (2 Z) ∣ (2 x) ^ 2`
        rw [hc1, Nat.add_sub_cancel, mul_pow, hZ]
        exact ⟨y + 1, by ring⟩
      · -- `2 (2 x + 2) ∣ (2 Z - 2) ^ 2`
        have e : 2 * Z - 1 - 1 = 2 * (Z - 1) := by omega
        have e2 : 2 * (2 * x + 1 + 1) = 4 * (x + 1) := by ring
        rw [e, e2, mul_pow, show (2 : ℕ) ^ 2 = 4 by norm_num]
        refine Nat.mul_dvd_mul_left 4 ?_
        have hd : ((x : ℤ) + 1) ∣ (((Z - 1 : ℕ) : ℤ)) ^ 2 := by
          have hcast : (((Z - 1 : ℕ) : ℤ)) = (Z : ℤ) - 1 := by push_cast [Nat.cast_sub (by omega : 1 ≤ Z)]; ring
          rw [hcast]
          have hy2 : ((x : ℤ) + 1) ∣ (y : ℤ) ^ 2 := by exact_mod_cast hyx
          have hid : ((Z : ℤ) - 1) ^ 2 = (y : ℤ) ^ 2 + ((x : ℤ) + 1) *
              (((k : ℤ) - 2) * ((k : ℤ) * ((x : ℤ) + 1) - 2 * x - 2 * y - 2)) := by
            rw [hW]; ring
          rw [hid]
          exact dvd_add hy2 (Dvd.intro _ rfl)
        exact_mod_cast hd
    · rw [hc1]
      have e : 2 * Z - 1 + (2 * x + 1) = 2 * (Z + x) := by omega
      rw [e]
      have key : ((x : ℤ) + y + 1) ^ 2 * Z = ((Z : ℤ) + x) ^ 2 * ((y : ℤ) + 1) := by
        rw [hW]
        linear_combination ((k : ℤ) * ((x : ℤ) + 1) - 2 * x - 2 * y - 2) * hki
      have key' : (x + y + 1) ^ 2 * Z = (Z + x) ^ 2 * (y + 1) := by exact_mod_cast key
      have e3 : 2 * x + 1 + (2 * y + 1) = 2 * (x + y + 1) := by ring
      rw [e3]
      calc (2 * (x + y + 1)) ^ 2 * (2 * Z * (2 * x + 1 + 1))
          = 16 * (x + 1) * ((x + y + 1) ^ 2 * Z) := by ring
        _ = 16 * (x + 1) * ((Z + x) ^ 2 * (y + 1)) := by rw [key']
        _ = (2 * (Z + x)) ^ 2 * ((2 * x + 1 + 1) * (2 * y + 1 + 1)) := by ring

From the first verified proof, s-m9h5g1vjjj (lemma proofs are public). If it relies on helper lemmas, copy them too.

Problem: Vieta jumping. A crystal pair (a, b) with a < b either is the first pair of its chain ((a-1)² = 2(b+1), i.e. X = k) or descends to the smaller crystal pair (c, a) with c = (a-1)²/(b+1) - 1 and the same ratio k. Every crystal is therefore (2z_j - 1, 2z_{j+1} - 1) for z₀ = 1, z₁ = k, … Full statement & Lean theorem →

Show: all ○ connecting…
  1. verifiedVerified proof by test2 d