🏛️ Atlas✒️Formalizations.Combinatorics.Caballero.AngularBand view on GitHub ↗10 theorems
/-Copyright (c) 2026 Carles Marín. All rights reserved.Released under Apache 2.0 license as described in the file LICENSE.Authors: Carles Marín, Claude (AI assistant)-/module public import Formalizations.Combinatorics.Caballero.AngularGeneralA /-!# The band around z_0 for central cells (Caballero, Part IV) Lemma 13 of Part IV for every a, b. For 0 < theta < 1/a the K = (a+1)(b+1) opening positions P = {itheta + j} are distinct; the k-th one is p_k, D(k) = #(P ∩ [p_k - Lambda, p_k)) and z_0 = #(P ∩ [0,Lambda)). For a point (Lambda, theta) off the lines whose floor Lambda is central (4a+5 <= J <= b -C_a, `IsCentral`), every k >= z_0 has |D(k) - z_0| <= a + 1 (`band_le`), and the constant a + 1 isattained (`band_sharp`: Lambda = J + 1/2, theta = 1/(4(a+1)), p_k = J + 1 give z_0 = m(J+1), D(k) =mJ). The k-th opening position is represented by the position x itself with k = number of openingpositions before x (`openingIndex`). The proof is direct: in every row both counts lie in [J, J+1],so no use of Lemma 11 (block) is needed. Conventions: the section hypothesis 0 < theta < 1/a and offthe lines are explicit hypotheses; a >= 2, b >= 1 of the paper are not needed (central alreadyforces b large). ## Main results * `CaballeroGeneralA.band_le`: Lemma 13: for a central point and an opening position p_k with k >= z_0, |D(k) - z_0| <= a + 1* `CaballeroGeneralA.band_sharp`: Lemma 13, optimality: for every a, b with room for central vectors the bound a + 1 is attained ## References * C. Marín, How Many Dyck Words Do the Divisors of an Integer Make? IV. The Primary Phase of the Ambiguity Profile for General a, draft (2 December 2026), unpublished.* C. Marín, How Many Dyck Words Do the Divisors of an Integer Make? Exact Counts and Quasipolynomial Growth (Part I), Zenodo (2026), doi:10.5281/zenodo.24536372 (concept DOI).-/ @[expose] public section namespace CaballeroGeneralA open Finset /-- The set `P = {iθ + j : 0 ≤ i ≤ a, 0 ≤ j ≤ b}` of opening positions (for `aθ < 1` these`K = (a+1)(b+1)` positions are pairwise distinct). -/noncomputable def openingSet (a b : ℕ) (θ : ℝ) : Finset ℝ :=  (range (a + 1) ×ˢ range (b + 1)).image (opos θ) /-- The index `k` of the opening position `x ∈ P`, that is `x = p_k`: the number of openingpositions strictly before `x`. -/noncomputable def openingIndex (a b : ℕ) (θ : ℝ) (x : ℝ) : ℕ :=  ((openingSet a b θ).filter fun y => y < x).card /-- `D(k) = #(P ∩ [p_k - Λ, p_k))` for `p_k = x`. -/noncomputable def windowCount (a b : ℕ) (θ Λ : ℝ) (x : ℝ) : ℕ :=  ((openingSet a b θ).filter fun y => x - Λ ≤ y ∧ y < x).card /-- `z₀ = #(P ∩ [0, Λ))`. -/noncomputable def zeroCount (a b : ℕ) (θ Λ : ℝ) : ℕ :=  ((openingSet a b θ).filter fun y => 0 ≤ y ∧ y < Λ).card theorem no_int_multiple (a : ℕ) (θ : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1) (d : ℤ)    (h1 : 1 ≤ d) (h2 : d ≤ a) (z : ℤ) : (z : ℝ) ≠ (d : ℝ) * θ := by  intro e  have hd : (1 : ℝ) ≤ d := by exact_mod_cast h1  have hda : (d : ℝ) ≤ a := by exact_mod_cast h2  have hpos : (0 : ℝ) < (d : ℝ) * θ := by positivity  have hle : (d : ℝ) * θ ≤ (a : ℝ) * θ := mul_le_mul_of_nonneg_right hda hθ.le  have hz : (0 : ℝ) < z := by rw [e]; exact hpos  have hz' : (1 : ℝ) ≤ z := by    have : (0 : ℤ) < z := by exact_mod_cast hz    exact_mod_cast this  linarith theorem opos_injOn (a b : ℕ) (θ : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1) :    Set.InjOn (opos θ) ↑(range (a + 1) ×ˢ range (b + 1)) := by  intro u hu v hv e  simp only [coe_product, Set.mem_prod, mem_coe, mem_range] at hu hv  unfold opos at e  have h1 : u.1 = v.1 := by    by_contra hne    rcases lt_or_gt_of_ne hne with h | h    · apply no_int_multiple a θ hθ haθ ((v.1 : ℤ) - u.1) (by omega) (by omega)        ((u.2 : ℤ) - v.2)      push_cast      linarith    · apply no_int_multiple a θ hθ haθ ((u.1 : ℤ) - v.1) (by omega) (by omega)        ((v.2 : ℤ) - u.2)      push_cast      linarith  have h2 : u.2 = v.2 := by    rw [h1] at e    have : (u.2 : ℝ) = v.2 := by linarith    exact_mod_cast this  exact Prod.ext h1 h2 theorem openingSet_bounds (a b : ℕ) (θ : ℝ) (hθ : 0 < θ) (y : ℝ) (hy : y ∈ openingSet a b θ) :    0 ≤ y ∧ y ≤ b + a * θ := by  unfold openingSet at hy  obtain ⟨v, hv, rfl⟩ := mem_image.mp hy  simp only [mem_product, mem_range] at hv  unfold opos  have h1 : (v.1 : ℝ) ≤ a := by exact_mod_cast (by omega : v.1 ≤ a)  have h2 : (v.2 : ℝ) ≤ b := by exact_mod_cast (by omega : v.2 ≤ b)  have h3 : (v.1 : ℝ) * θ ≤ a * θ := mul_le_mul_of_nonneg_right h1 hθ.le  constructor  · positivity  · linarith /-- Counting the opening positions that satisfy `p`, row by row (`i` fixed, `j` varying). -/theorem card_openingSet_filter (a b : ℕ) (θ : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1)    (p : ℝ → Prop) [DecidablePred p] :    ((openingSet a b θ).filter p).card      = ∑ i ∈ range (a + 1), ((range (b + 1)).filter fun j : ℕ => p ((i : ℝ) * θ + j)).card := by  unfold openingSet  rw [filter_image, card_image_of_injOn    ((opos_injOn a b θ hθ haθ).mono (by      intro v hv      exact (mem_filter.mp (mem_coe.mp hv)).1))]  rw [card_filter, sum_product]  apply sum_congr rfl  intro i _  rw [card_filter]  rfl /-- The number of `j ≤ b` with `α ≤ j < β` is `⌈β⌉ - ⌈α⌉` when `α > -1`, `β ≤ b + 1`. -/theorem band_card_row (b : ℕ) (α β : ℝ) (hα : -1 < α) (hβ : β ≤ b + 1) (hαβ : α ≤ β) :    (((range (b + 1)).filter fun j : ℕ => α ≤ (j : ℝ) ∧ (j : ℝ) < β).card : ℤ) = ⌈β⌉ - ⌈α⌉ := by  have hc : 0 ≤ ⌈α⌉ := by    have := Int.lt_ceil.mpr (show (((-1 : ℤ)) : ℝ) < α by simpa using hα)    omega  have hcb : ⌈α⌉ ≤ ⌈β⌉ := Int.ceil_mono hαβ  have hbb : ⌈β⌉ ≤ (b : ℤ) + 1 := Int.ceil_le.mpr (by push_cast; linarith)  have e : ((range (b + 1)).filter fun j : ℕ => α ≤ (j : ℝ) ∧ (j : ℝ) < β)      = Ico ⌈α⌉.toNat ⌈β⌉.toNat := by    ext j    simp only [mem_filter, mem_range, mem_Ico]    constructor    · rintro ⟨_, h1, h2⟩      have a1 := Int.ceil_le.mpr (show α ≤ (((j : ℤ)) : ℝ) by simpa using h1)      have a2 := Int.lt_ceil.mpr (show (((j : ℤ)) : ℝ) < β by simpa using h2)      omega    · rintro ⟨h1, h2⟩      refine ⟨by omega, ?_, ?_⟩      · have := Int.ceil_le.mp (show ⌈α⌉ ≤ (j : ℤ) by omega)        simpa using this      · have := Int.lt_ceil.mp (show (j : ℤ) < ⌈β⌉ by omega)        simpa using this  rw [e, Nat.card_Ico]  omega theorem sum_bounds (a : ℕ) (f : ℕ → ℤ) (J : ℤ) (h : ∀ i ∈ range (a + 1), J ≤ f i ∧ f i ≤ J + 1) :    ((a : ℤ) + 1) * J ≤ ∑ i ∈ range (a + 1), f i      ∧ ∑ i ∈ range (a + 1), f i ≤ ((a : ℤ) + 1) * (J + 1) := by  have lo : ∑ i ∈ range (a + 1), J ≤ ∑ i ∈ range (a + 1), f i :=    sum_le_sum fun i hi => (h i hi).1  have hi : ∑ i ∈ range (a + 1), f i ≤ ∑ i ∈ range (a + 1), (J + 1) :=    sum_le_sum fun i hi => (h i hi).2  simp only [sum_const, card_range, nsmul_eq_mul] at lo hi  push_cast at lo hi  exact ⟨lo, hi⟩ theorem windowCount_eq (a b : ℕ) (θ Λ x : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1)    (hx : x ∈ openingSet a b θ) (hΛ0 : 0 ≤ Λ) (hΛx : Λ ≤ x) :    (windowCount a b θ Λ x : ℤ)      = ∑ i ∈ range (a + 1), (⌈x - (i : ℝ) * θ⌉ - ⌈x - Λ - (i : ℝ) * θ⌉) := by  obtain ⟨-, hxb⟩ := openingSet_bounds a b θ hθ x hx  unfold windowCount  rw [card_openingSet_filter a b θ hθ haθ, Nat.cast_sum]  apply sum_congr rfl  intro i hi  rw [mem_range] at hi  have hia : (i : ℝ) ≤ a := by exact_mod_cast (by omega : i ≤ a)  have hit : (i : ℝ) * θ ≤ a * θ := mul_le_mul_of_nonneg_right hia hθ.le  have hit0 : 0 ≤ (i : ℝ) * θ := by positivity  have e : ((range (b + 1)).filter fun j : ℕ => x - Λ ≤ (i : ℝ) * θ + j ∧ (i : ℝ) * θ + j < x)      = (range (b + 1)).filter fun j : ℕ =>          x - Λ - (i : ℝ) * θ ≤ (j : ℝ) ∧ (j : ℝ) < x - (i : ℝ) * θ := by    apply filter_congr    intro j _    constructor <;> rintro ⟨h1, h2⟩ <;> constructor <;> linarith  rw [e]  exact band_card_row b _ _ (by linarith) (by linarith) (by linarith) theorem zeroCount_eq (a b : ℕ) (θ Λ : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1)    (hΛ1 : 1 ≤ Λ) (hΛb : Λ ≤ b + 1) :    (zeroCount a b θ Λ : ℤ) = ∑ i ∈ range (a + 1), ⌈Λ - (i : ℝ) * θ⌉ := by  unfold zeroCount  rw [card_openingSet_filter a b θ hθ haθ, Nat.cast_sum]  apply sum_congr rfl  intro i hi  rw [mem_range] at hi  have hia : (i : ℝ) ≤ a := by exact_mod_cast (by omega : i ≤ a)  have hit : (i : ℝ) * θ ≤ a * θ := mul_le_mul_of_nonneg_right hia hθ.le  have hit0 : 0 ≤ (i : ℝ) * θ := by positivity  have e : ((range (b + 1)).filter fun j : ℕ => 0 ≤ (i : ℝ) * θ + j ∧ (i : ℝ) * θ + j < Λ)      = (range (b + 1)).filter fun j : ℕ =>          (0 : ℝ) ≤ (j : ℝ) ∧ (j : ℝ) < Λ - (i : ℝ) * θ := by    apply filter_congr    intro j _    have hj : (0 : ℝ) ≤ j := Nat.cast_nonneg j    constructor <;> rintro ⟨h1, h2⟩ <;> constructor <;> linarith  rw [e, band_card_row b _ _ (by norm_num) (by linarith) (by linarith)]  simp /-- Lemma 13 (the band). Let `0 < θ < 1/a`, let `(Λ, θ)` be off the lines with central vector(`IsCentral a b Λ`), and let `p_k = x` be an opening position with `k ≥ z₀`. Then`|D(k) - z₀| ≤ m` with `m = a + 1`. -/theorem band_le (a b : ℕ) (Λ θ : ℝ) (hθ : 0 < θ) (haθ : (a : ℝ) * θ < 1)    (hoff : OffLines a Λ θ) (hc : IsCentral a b Λ) (x : ℝ) (hx : x ∈ openingSet a b θ)    (hk : zeroCount a b θ Λ ≤ openingIndex a b θ x) :    |(windowCount a b θ Λ x : ℤ) - (zeroCount a b θ Λ : ℤ)| ≤ (a : ℤ) + 1 := by  have _ := hoff -- the proof does not need `OffLines`; it is part of the paper's setting  obtain ⟨hJ1, hJ2⟩ := hc  have hCa : 0 < Ca a := by unfold Ca; positivity  have hΛJ: ((⌊Λ⌋ : ℤ) : ℝ) ≤ Λ := Int.floor_le Λ  have hΛJ' : Λ < ((⌊Λ⌋ : ℤ) : ℝ) + 1 := Int.lt_floor_add_one Λ  have hJ5 : (5 : ℝ) ≤ ((⌊Λ⌋ : ℤ) : ℝ) := by exact_mod_cast (by omega : (5 : ℤ) ≤ ⌊Λ⌋)  have hJb : ((⌊Λ⌋ : ℤ) : ℝ) ≤ b := by exact_mod_cast (by omega : ⌊Λ⌋ ≤ (b : ℤ))  have hΛ1 : 1 ≤ Λ := by linarith  have hΛb : Λ ≤ b + 1 := by linarith  obtain ⟨hx0, hxb⟩ := openingSet_bounds a b θ hθ x hx  -- k ≥ z₀ forces x ≥ Λ  have hΛx : Λ ≤ x := by    by_contra hlt    push Not at hlt    have hsub : (openingSet a b θ).filter (fun y => y < x)        ⊆ (openingSet a b θ).filter (fun y => 0 ≤ y ∧ y < Λ) := by      intro y hy      obtain ⟨hyP, hyx⟩ := mem_filter.mp hy      exact mem_filter.mpr ⟨hyP, (openingSet_bounds a b θ hθ y hyP).1, by linarith⟩    have hss : (openingSet a b θ).filter (fun y => y < x)        ⊂ (openingSet a b θ).filter (fun y => 0 ≤ y ∧ y < Λ) := by      rw [Finset.ssubset_iff_of_subset hsub]      exact ⟨x, mem_filter.mpr ⟨hx, hx0, hlt⟩, fun h => lt_irrefl x (mem_filter.mp h).2⟩    have := card_lt_card hss    unfold openingIndex zeroCount at *    omega  have hD := windowCount_eq a b θ Λ x hθ haθ hx (by linarith) hΛx  have hZ := zeroCount_eq a b θ Λ hθ haθ hΛ1 hΛb  have hrowD : ∀ i ∈ range (a + 1),      ⌊Λ⌋ ≤ ⌈x - (i : ℝ) * θ⌉ - ⌈x - Λ - (i : ℝ) * θ⌉        ∧ ⌈x - (i : ℝ) * θ⌉ - ⌈x - Λ - (i : ℝ) * θ⌉ ≤ ⌊Λ⌋ + 1 := by    intro i _    have e : x - (i : ℝ) * θ = (x - Λ - (i : ℝ) * θ) + Λ := by ring    rw [e]    have l1 : ⌈x - Λ - (i : ℝ) * θ⌉ + ⌊Λ⌋ ≤ ⌈(x - Λ - (i : ℝ) * θ) + Λ⌉ := by      rw [← Int.ceil_add_intCast]      exact Int.ceil_mono (by linarith)    have l2 : ⌈(x - Λ - (i : ℝ) * θ) + Λ⌉ ≤ ⌈x - Λ - (i : ℝ) * θ⌉ + ⌊Λ⌋ + 1 := by      have : ⌈(x - Λ - (i : ℝ) * θ) + Λ⌉ ≤ ⌈(x - Λ - (i : ℝ) * θ) + ((⌊Λ⌋ + 1 : ℤ) : ℝ)⌉ :=        Int.ceil_mono (by push_cast; linarith)      rw [Int.ceil_add_intCast] at this      omega    omega  have hrowZ : ∀ i ∈ range (a + 1),      ⌊Λ⌋ ≤ ⌈Λ - (i : ℝ) * θ⌉ ∧ ⌈Λ - (i : ℝ) * θ⌉ ≤ ⌊Λ⌋ + 1 := by    intro i hi    rw [mem_range] at hi    have hia : (i : ℝ) ≤ a := by exact_mod_cast (by omega : i ≤ a)    have hit : (i : ℝ) * θ ≤ a * θ := mul_le_mul_of_nonneg_right hia hθ.le    have hit0 : 0 ≤ (i : ℝ) * θ := by positivity    constructor    · have := Int.lt_ceil.mpr (show (((⌊Λ⌋ - 1 : ℤ)) : ℝ) < Λ - (i : ℝ) * θ by        push_cast; linarith)      omega    · exact Int.ceil_le.mpr (by push_cast; linarith)  have bD := sum_bounds a _ ⌊Λ⌋ hrowD  have bZ := sum_bounds a _ ⌊Λ⌋ hrowZ  rw [hD, hZ, abs_le]  constructor <;> nlinarith [bD.1, bD.2, bZ.1, bZ.2] /-- Lemma 13 (optimality): the constant `m = a + 1` cannot be lowered. For every `a, b` with roomfor central vectors there is a central point and an index `k ≥ z₀` with `|D(k) - z₀| = m`. -/theorem band_sharp (a b : ℕ) (hb : 4 * (a : ℤ) + 5 + Ca a ≤ b) :    ∃ Λ θ : ℝ, 0 < θ ∧ (a : ℝ) * θ < 1 ∧ OffLines a Λ θ ∧ IsCentral a b Λ ∧      ∃ x ∈ openingSet a b θ, zeroCount a b θ Λ ≤ openingIndex a b θ x ∧        |(windowCount a b θ Λ x : ℤ) - (zeroCount a b θ Λ : ℤ)| = (a : ℤ) + 1 := by  have hCa : 0 < Ca a := by unfold Ca; positivity  obtain ⟨θ, hθ, h4⟩ : ∃ θ : ℝ, 0 < θ ∧ 4 * ((a : ℝ) + 1) * θ = 1 :=    ⟨1 / (4 * ((a : ℝ) + 1)), by positivity, by field_simp⟩  have haθ : (a : ℝ) * θ < 1 / 4 := by nlinarith  obtain ⟨J, hJ⟩ : ∃ J : ℕ, J = 4 * a + 5 := ⟨_, rfl⟩  have hJb : (J : ℤ) + 1 ≤ b := by rw [hJ]; push_cast; omega  have hJbR : (J : ℝ) + 1 ≤ b := by exact_mod_cast hJb  have hJ5 : (5 : ℝ) ≤ J := by rw [hJ]; push_cast; linarith [(Nat.cast_nonneg a : (0 : ℝ) ≤ a)]  have hflo : ⌊(J : ℝ) + 1 / 2⌋ = (J : ℤ) := by    rw [Int.floor_eq_iff]    constructor <;> push_cast <;> linarith  have hcen : IsCentral a b ((J : ℝ) + 1 / 2) := by    unfold IsCentral    rw [hflo]    constructor <;> omega  have hoff : OffLines a ((J : ℝ) + 1 / 2) θ := by    intro h h1 h2 z e    have hc1 : (h : ℝ) ≤ a := by exact_mod_cast h2    have hc2 : -(a : ℝ) ≤ h := by exact_mod_cast h1    have u1 : (h : ℝ) * θ ≤ a * θ := mul_le_mul_of_nonneg_right hc1 hθ.le    have u2 : -(a : ℝ) * θ ≤ h * θ := mul_le_mul_of_nonneg_right hc2 hθ.le    have z1 : (J : ℝ) < z := by linarith    have z2 : (z : ℝ) < J + 1 := by linarith    have z1' : (J : ℤ) < z := by exact_mod_cast z1    have z2' : z < (J : ℤ) + 1 := by exact_mod_cast z2    omega  have hxP : (J : ℝ) + 1 ∈ openingSet a b θ := by    unfold openingSet    refine mem_image.mpr ⟨(0, J + 1), ?_, ?_⟩    · simp only [mem_product, mem_range]      omega    · simp [opos]  have hit : ∀ i ∈ range (a + 1), 0 ≤ (i : ℝ) * θ ∧ (i : ℝ) * θ < 1 / 4 := by    intro i hi    rw [mem_range] at hi    have hia : (i : ℝ) ≤ a := by exact_mod_cast (by omega : i ≤ a)    have := mul_le_mul_of_nonneg_right hia hθ.le    exact ⟨by positivity, by linarith⟩  have haθ1 : (a : ℝ) * θ < 1 := by linarith  have hΛ0 : (0 : ℝ) ≤ (J : ℝ) + 1 / 2 := by positivity  have hΛx : (J : ℝ) + 1 / 2 ≤ (J : ℝ) + 1 := by linarith  have hD := windowCount_eq a b θ ((J : ℝ) + 1 / 2) ((J : ℝ) + 1) hθ haθ1 hxP hΛ0 hΛx  have hZ := zeroCount_eq a b θ ((J : ℝ) + 1 / 2) hθ haθ1 (by linarith) (by linarith)  have hI : (openingIndex a b θ ((J : ℝ) + 1) : ℤ)      = ∑ i ∈ range (a + 1), ((J : ℤ) + 1) := by    unfold openingIndex    rw [card_openingSet_filter a b θ hθ haθ1, Nat.cast_sum]    apply sum_congr rfl    intro i hi    obtain ⟨t0, t1⟩ := hit i hi    have e : ((range (b + 1)).filter fun j : ℕ => (i : ℝ) * θ + j < (J : ℝ) + 1)        = (range (b + 1)).filter fun j : ℕ =>            (0 : ℝ) ≤ (j : ℝ) ∧ (j : ℝ) < (J : ℝ) + 1 - (i : ℝ) * θ := by      apply filter_congr      intro j _      have hj : (0 : ℝ) ≤ j := Nat.cast_nonneg j      constructor      · intro h; exact ⟨hj, by linarith⟩      · rintro ⟨-, h⟩; linarith    rw [e, band_card_row b _ _ (by norm_num) (by linarith) (by linarith)]    have : ⌈(J : ℝ) + 1 - (i : ℝ) * θ⌉ = (J : ℤ) + 1 := by      rw [Int.ceil_eq_iff]      push_cast      constructor <;> linarith    rw [this]    simp  have hDv : (windowCount a b θ ((J : ℝ) + 1 / 2) ((J : ℝ) + 1) : ℤ)      = ∑ i ∈ range (a + 1), (J : ℤ) := by    rw [hD]    apply sum_congr rfl    intro i hi    obtain ⟨t0, t1⟩ := hit i hi    have c1 : ⌈(J : ℝ) + 1 - (i : ℝ) * θ⌉ = (J : ℤ) + 1 := by      rw [Int.ceil_eq_iff]      push_cast      constructor <;> linarith    have c2 : ⌈(J : ℝ) + 1 - ((J : ℝ) + 1 / 2) - (i : ℝ) * θ⌉ = 1 := by      rw [Int.ceil_eq_iff]      push_cast      constructor <;> linarith    rw [c1, c2]    omega  have hZv : (zeroCount a b θ ((J : ℝ) + 1 / 2) : ℤ)      = ∑ i ∈ range (a + 1), ((J : ℤ) + 1) := by    rw [hZ]    apply sum_congr rfl    intro i hi    obtain ⟨t0, t1⟩ := hit i hi    rw [Int.ceil_eq_iff]    push_cast    constructor <;> linarith  refine ⟨(J : ℝ) + 1 / 2, θ, hθ, haθ1, hoff, hcen, (J : ℝ) + 1, hxP, ?_, ?_⟩  · have : (zeroCount a b θ ((J : ℝ) + 1 / 2) : ℤ)        ≤ (openingIndex a b θ ((J : ℝ) + 1) : ℤ) := by rw [hZv, hI]    exact_mod_cast this  · rw [hDv, hZv]    simp only [sum_const, card_range, nsmul_eq_mul]    push_cast    rw [show ((a : ℤ) + 1) * (J : ℤ) - ((a : ℤ) + 1) * ((J : ℤ) + 1) = -((a : ℤ) + 1) by ring,      abs_neg, abs_of_nonneg (by positivity)] end CaballeroGeneralA