🏛️ Atlas✒️Formalizations.Combinatorics.Caballero.AngularSectionTransport view on GitHub ↗7 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)-//-# encaje: geometría del paso tres del Paper III, obligación 2. Usa la partición de la sección,la palabra de AngularExact y la estabilidad sobre CaballeroPeaks.enLista.Modelo solicitado gpt-6.2-astra, esfuerzo max. Valores efectivos no expuestos. Superficie: agente Codex.Tarea: derivar de la geometría la conservación del vector y de su pertenencia a la lista.-/module public import Formalizations.Combinatorics.Caballero.AngularExactpublic import Formalizations.Combinatorics.Caballero.AngularStepPartitionpublic import Formalizations.Combinatorics.Caballero.AngularListStability /-!# AngularSectionTransport-/ /-!## References * C. Marín, Exact angular ambiguity profile for Dyck words of divisors (Part III), Zenodo (2026), doi:10.5281/zenodo.24699411.* 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 CaballeroSectionTransport open CaballeroExact CaballeroPeaks CaballeroStepPartition CaballeroListStability theorem cellWord_section (b : ℤ) (x θ : ℝ) : cellWord b x θ = sectionWord b θ x := by  norm_num [cellWord, sectionWord, sub_eq_add_neg, neg_mul] theorem height_bound (b : ℕ) (θ : ℝ) (hθ : 0 < θ) (hb : 12 * θ + 18 ≤ (b : ℝ)) :    0 ≤ ⌈2 * θ⌉ ∧ 6 * ⌈2 * θ⌉ + 12 ≤ (b : ℤ) := by  have hlo := Int.le_ceil (2 * θ)  have hhi := Int.ceil_lt_add_one (2 * θ)  constructor  · have h : (0 : ℝ) ≤ (⌈2 * θ⌉ : ℝ) := by linarith    exact_mod_cast h  · have h : 6 * (⌈2 * θ⌉ : ℝ) + 12 ≤ (b : ℝ) := by linarith    exact_mod_cast h private theorem floor_diff (x d : ℝ) : ⌊x + d⌋ - ⌊x⌋ ≤ ⌈d⌉ := by  have h := Int.floor_le_floor (show x + d ≤ x + (⌈d⌉ : ℝ) by linarith [Int.le_ceil d])  rw [Int.floor_add_intCast] at h  omega /-- Monotonicity and the two half-span bounds before clipping. -/theorem raw_bounds (θ x : ℝ) (hθ : 0 ≤ θ) :    ⌊x - 2 * θ⌋ ≤ ⌊x - θ⌋ ∧ ⌊x - θ⌋ ≤ ⌊x⌋ ∧ ⌊x⌋ ≤ ⌊x + θ⌋ ∧ ⌊x + θ⌋ ≤ ⌊x + 2 * θ⌋ ∧    ⌊x⌋ - ⌊x - 2 * θ⌋ ≤ ⌈2 * θ⌉ ∧ ⌊x + 2 * θ⌋ - ⌊x⌋ ≤ ⌈2 * θ⌉ := by  refine ⟨Int.floor_le_floor (by linarith), Int.floor_le_floor (by linarith),    Int.floor_le_floor (by linarith), Int.floor_le_floor (by linarith), ?_, floor_diff x (2 * θ)⟩  simpa only [sub_add_cancel] using floor_diff (x - 2 * θ) (2 * θ) theorem integer_cuts (b : ℕ) :    (j1 b : ℤ) = (b : ℤ) / 6 ∧ (j2 b : ℤ) = (b : ℤ) / 2 ∧    (j3 b : ℤ) = 5 * (b : ℤ) / 6 := by  simp [j1, j2, j3, Int.natCast_ediv] private theorem region_index (b : ℕ) (θ x : ℝ) (i : Fin 4) (hx : x ∈ oldRegion b θ i)    (hb : 18 ≤ (b : ℤ)) :    tReg (b : ℤ) (clip (b : ℤ) ⌊x⌋) = (i.val : ℤ) ∧    (i.val = 3 ∨ ⌊x⌋ < 5 * (b : ℤ) / 6) := by  obtain ⟨j₁, j₂, j₃⟩ := integer_cuts b  have lc (k : ℕ) (h : (k : ℝ) ≤ x) : (k : ℤ) ≤ ⌊x⌋ :=    Int.le_floor.mpr (by exact_mod_cast h)  have uc (k : ℕ) (h : x < (k : ℝ)) : ⌊x⌋ < (k : ℤ) :=    Int.floor_lt.mpr (by exact_mod_cast h)  fin_cases i  · change x ∈ Set.Ico 0 (j1 b : ℝ) at hx    have a := uc (j1 b) hx.2    rw [j₁] at a    change tReg _ _ = 0 ∧ ((0 : ℕ) = 3 ∨ _)    unfold tReg clip    split_ifs <;> omega  · change x ∈ Set.Ico (j1 b : ℝ) (j2 b : ℝ) at hx    have a := lc (j1 b) hx.1    have c := uc (j2 b) hx.2    rw [j₁] at a    rw [j₂] at c    change tReg _ _ = 1 ∧ ((1 : ℕ) = 3 ∨ _)    unfold tReg clip    split_ifs <;> omega  · change x ∈ Set.Ico (j2 b : ℝ) (j3 b : ℝ) at hx    have a := lc (j2 b) hx.1    have c := uc (j3 b) hx.2    rw [j₂] at a    rw [j₃] at c    change tReg _ _ = 2 ∧ ((2 : ℕ) = 3 ∨ _)    unfold tReg clip    split_ifs <;> omega  · change x ∈ Set.Ico (j3 b : ℝ) (sectionEnd b θ) at hx    have a := lc (j3 b) hx.1    rw [j₃] at a    change tReg _ _ = 3 ∧ ((3 : ℕ) = 3 ∨ _)    unfold tReg clip    split_ifs <;> omega /-- The cell word shifts by the region index and the full Part I list is preserved in both directions. -/theorem region_word (b : ℕ) (θ x : ℝ) (i : Fin 4) (hθ : 0 < θ)    (hb : 12 * θ + 18 ≤ (b : ℝ)) (hx : x ∈ oldRegion b θ i) :    cellWord ((b : ℤ) + 3) (x + (i.val : ℝ)) θ =        shiftWord (cellWord (b : ℤ) x θ) (i.val : ℤ) ∧    (enLista (b : ℤ) (cellWord (b : ℤ) x θ) ↔      enLista ((b : ℤ) + 3) (cellWord ((b : ℤ) + 3) (x + (i.val : ℝ)) θ)) := by  obtain ⟨hH, hB⟩ := height_bound b θ hθ hb  have hb18 : 18 ≤ (b : ℤ) := by    have h : (18 : ℝ) ≤ b := by linarith    exact_mod_cast h  have hs : x ∈ Set.Ico 0 (sectionEnd b θ) := by    rw [(old_partition b θ hθ.le).1]    exact Set.mem_iUnion.mpr ⟨i, hx⟩  have hx0 : 0 ≤ ⌊x⌋ := Int.floor_nonneg.mpr hs.1  obtain ⟨m1, m2, m3, m4, hleft, hright⟩ := raw_bounds θ x hθ.le  obtain ⟨ht, hregion⟩ := region_index b θ x i hx hb18  have hlo : -(b : ℤ) - 1 < ⌊x - 2 * θ⌋ := by omega  have hw : sectionWord ((b : ℤ) + 3) θ (x + (i.val : ℝ)) =      shiftWord (sectionWord (b : ℤ) θ x) (i.val : ℤ) := by    rcases hregion with h3 | hmid    · have h3z : (i.val : ℤ) = 3 := by exact_mod_cast h3      have h3r : (i.val : ℝ) = 3 := by exact_mod_cast h3      rw [h3z, h3r]      apply sectionWord_shift_three <;> omega    · have h4 : ⌊x + 2 * θ⌋ ≤ (b : ℤ) := by omega      have hi := i.isLt      simpa only [Int.cast_natCast] using sectionWord_shift_unclipped (b : ℤ) (i.val : ℤ) θ x        (by omega) (by omega) (by omega) (by omega) (by omega) (by omega) (by omega)  refine ⟨?_, ?_⟩  · simpa only [cellWord_section] using hw  simp only [cellWord_section, hw]  have hstab := estabilidad (b : ℤ) ⌈2 * θ⌉    (clip (b : ℤ) ⌊x - 2 * θ⌋) (clip (b : ℤ) ⌊x - θ⌋) (clip (b : ℤ) ⌊x⌋)    (clip (b : ℤ) ⌊x + θ⌋) (clip (b : ℤ) ⌊x + 2 * θ⌋) hH hB    (by unfold clip; omega) (by unfold clip; omega) (by unfold clip; omega) (by unfold clip; omega)    (by unfold clip; omega) (by unfold clip; omega) (by unfold clip; omega) (by unfold clip; omega)    (by unfold clip; omega)  rw [ht] at hstab  exact hstab -- Keeping the old word instead of adding one gives the wrong centre in region 1.example : shiftWord (cellWord 66 11 (1/3)) 0 ≠ cellWord 69 12 (1/3) := by  intro h  have hc := congrArg (fun w : Palabra => w.2.2.1) h  norm_num [shiftWord, cellWord, clip] at hc  end CaballeroSectionTransport