🏛️ Atlas✒️Formalizations.Combinatorics.Caballero.AngularGapPatterns view on GitHub ↗4 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 3. Usa la clasificación de AngularPeaks,las fronteras de AngularStepPartition y el vector relativo de AngularPhaseFiber.Modelo solicitado gpt-6.2-astra, esfuerzo max. Valores efectivos no expuestos. Superficie: agente Codex.Tarea: identificar las quintetas de fase en cada unidad insertada.Resultado: los huecos uno y dos admiten la fase 1, y el tercero admite las fases 1 y 2.Alcance: la lista de la Parte I en las unidades nuevas, para toda pendiente y altura del Teorema A.-/module public import Formalizations.Combinatorics.Caballero.AngularSectionTransportpublic import Formalizations.Combinatorics.Caballero.AngularPhaseFiber /-!# AngularGapPatterns-/ /-!## 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 CaballeroGapPatterns open CaballeroExact CaballeroPeaks CaballeroStepPartition CaballeroPhaseFiber CaballeroListStabilityopen CaballeroSectionTransport /-- Integer left endpoints of the three units inserted into the new section. -/def gapStart (b : ℕ) : Fin 3 → ℤ  | 0 => j1 b  | 1 => (j2 b : ℤ) + 1  | _ => (j3 b : ℤ) + 2 /-- The five integers `⌊(r + m*h)/3⌋`, using Euclidean integer division. -/def pattern (m r : ℤ) : Palabra :=  ((r - 2 * m) / 3, (r - m) / 3, r / 3, (r + m) / 3, (r + 2 * m) / 3) /-- Any of the three residue patterns at slope `m/3`. -/def phase (m : ℤ) (θ u : ℝ) : Prop :=  ∃ r : ℤ, 0 ≤ r ∧ r ≤ 2 ∧ rawWord θ u = pattern m r private theorem gap_bounds (b : ℕ) (H : ℤ) (i : Fin 3)    (hb : 6 * H + 12 ≤ (b : ℤ)) (hb18 : 18 ≤ (b : ℤ)) :    1 ≤ gapStart b i ∧ gapStart b i + H < (b : ℤ) + 3 := by  obtain ⟨j₁, j₂, j₃⟩ := integer_cuts b  fin_cases i  · change 1 ≤ (j1 b : ℤ) ∧ (j1 b : ℤ) + H < (b : ℤ) + 3    omega  · change 1 ≤ (j2 b : ℤ) + 1 ∧ (j2 b : ℤ) + 1 + H < (b : ℤ) + 3    omega  · change 1 ≤ (j3 b : ℤ) + 2 ∧ (j3 b : ℤ) + 2 + H < (b : ℤ) + 3    omega private theorem index_ranges (b : ℕ) (i : Fin 3) (r : ℤ) (hb : 18 ≤ (b : ℤ))    (hr0 : 0 ≤ r) (hr2 : r ≤ 2) :    let s := 3 * gapStart b i + r    let B := (b : ℤ) + 3    1 ≤ s ∧ s ≤ 3 * B ∧ ((s = B ∨ s = B + 1 ∨ (2 * B + 1 ≤ s ∧ s ≤ 3 * B - 1)) ↔ i.val = 2) := by  obtain ⟨j₁, j₂, j₃⟩ := integer_cuts b  let legal (s : ℤ) (index : ℕ) := 1 ≤ s ∧ s ≤ 3 * ((b : ℤ) + 3) ∧    ((s = (b : ℤ) + 3 ∨ s = ((b : ℤ) + 3) + 1 ∨      (2 * ((b : ℤ) + 3) + 1 ≤ s ∧ s ≤ 3 * ((b : ℤ) + 3) - 1)) ↔ index = 2)  change legal (3 * gapStart b i + r) i.val  fin_cases i  · change legal (3 * (j1 b : ℤ) + r) 0    dsimp [legal]    omega  · change legal (3 * ((j2 b : ℤ) + 1) + r) 1    dsimp [legal]    omega  · change legal (3 * ((j3 b : ℤ) + 2) + r) 2    dsimp [legal]    omega /-- All three gaps admit precisely phase 1; the third additionally admits precisely phase 2. -/theorem gap_iff (b : ℕ) (θ u : ℝ) (i : Fin 3) (hθ : 0 < θ)    (hb : 12 * θ + 18 ≤ (b : ℝ)) (hu : u ∈ Set.Ico 0 1) :    enLista ((b : ℤ) + 3) (cellWord ((b : ℤ) + 3) ((gapStart b i : ℝ) + u) θ) ↔      phase 1 θ u ∨ (i.val = 2 ∧ phase 2 θ u) := by  let j := gapStart b i  obtain ⟨hH, hB⟩ := height_bound b θ hθ hb  have hb18 : 18 ≤ (b : ℤ) := by    have h : (18 : ℝ) ≤ b := by linarith    exact_mod_cast h  obtain ⟨hj, hjH⟩ := gap_bounds b ⌈2 * θ⌉ i hB hb18  change 1 ≤ j at hj  change j + ⌈2 * θ⌉ < (b : ℤ) + 3 at hjH  have hzero : ⌊u⌋ = 0 := Int.floor_eq_zero_iff.mpr hu  obtain ⟨m1, m2, m3, m4, hleft, hright⟩ := raw_bounds θ u hθ.le  rw [hzero] at m2 m3 hleft hright  have hw : cellWord ((b : ℤ) + 3) ((j : ℝ) + u) θ =      (⌊u - 2 * θ⌋ + j, ⌊u - θ⌋ + j, j, ⌊u + θ⌋ + j, ⌊u + 2 * θ⌋ + j) := by    rw [cellWord_section]    have e0 : ((j : ℝ) + u) - 2 * θ = (u - 2 * θ) + j := by ring    have e1 : ((j : ℝ) + u) - θ = (u - θ) + j := by ring    have e3 : ((j : ℝ) + u) + θ = (u + θ) + j := by ring    have e4 : ((j : ℝ) + u) + 2 * θ = (u + 2 * θ) + j := by ring    simp only [sectionWord, e0, e1, e3, e4, Int.floor_add_intCast, Int.floor_intCast_add,      hzero, add_zero, Prod.mk.injEq]    unfold clip    omega  change enLista ((b : ℤ) + 3) (cellWord ((b : ℤ) + 3) ((j : ℝ) + u) θ) ↔ _  rw [hw, car_medio _ _ _ _ _ _ (by omega) (by omega) (by omega) (by omega)    (by omega) (by omega) (by omega) hj]  constructor  · rintro (⟨s, hslo, hshi, ha, hc, hcenter, hd, he⟩ | ⟨s, hsG, ha, hc, hcenter, hd, he⟩)    · left      refine ⟨s % 3, by omega, by omega, ?_⟩      norm_num [rawWord, pattern, Prod.mk.injEq, hzero]      omega    · have hs : 3 * gapStart b i + s % 3 = s := by change 3 * j + s % 3 = s; omega      have hindex := index_ranges b i (s % 3) hb18 (by omega) (by omega)      dsimp only at hindex      rw [hs] at hindex      refine Or.inr ⟨hindex.2.2.mp hsG, s % 3, by omega, by omega, ?_⟩      norm_num [rawWord, pattern, Prod.mk.injEq, hzero]      omega  · rintro (⟨r, hr₀, hr₂, hp⟩ | ⟨hi, r, hr₀, hr₂, hp⟩)    · have hindex := index_ranges b i r hb18 hr₀ hr₂      refine Or.inl ⟨3 * j + r, hindex.1, hindex.2.1, ?_⟩      norm_num [rawWord, pattern, Prod.mk.injEq, hzero] at hp      omega    · have hindex := index_ranges b i r hb18 hr₀ hr₂      refine Or.inr ⟨3 * j + r, hindex.2.2.mpr hi, ?_⟩      norm_num [rawWord, pattern, Prod.mk.injEq, hzero] at hp      omega -- At the second peak the left endpoint has a G pattern and no O₁ pattern.private theorem second_peak_control : ¬ phase 1 (2/3) 0 ∧ phase 2 (2/3) 0 := by  constructor  · rintro ⟨r, h₀, h₂, hp⟩    norm_num [rawWord, pattern, Prod.mk.injEq] at hp    omega  · refine ⟨0, by decide, by decide, ?_⟩    norm_num [rawWord, pattern] -- Allowing phase 2 in the first gap, or deleting it from the third, changes actual membership.example : ¬ enLista 69 (cellWord 69 ((gapStart 66 0 : ℝ) + 0) (2/3)) ∧    enLista 69 (cellWord 69 ((gapStart 66 2 : ℝ) + 0) (2/3)) := by  have first := gap_iff 66 (2/3) 0 0 (by norm_num) (by norm_num) (by norm_num [Set.mem_Ico])  have third := gap_iff 66 (2/3) 0 2 (by norm_num) (by norm_num) (by norm_num [Set.mem_Ico])  constructor  · intro hm    rcases first.mp hm with hp | ⟨hi, _⟩    · exact second_peak_control.1 hp    · exact (by decide : (0 : Fin 3).val ≠ 2) hi  · exact third.mpr (Or.inr ⟨rfl, second_peak_control.2⟩)  end CaballeroGapPatterns