/-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: prueba geométrica del Teorema de paso tres de Paper III.Reutiliza la medida de la sección y el perfil de AngularExact, y enLista de AngularPeaks.Modelo solicitado gpt-6.2-astra, esfuerzo max. Valores efectivos no expuestos. Superficie: agente Codex.Tarea: demostrar que el aumento de longitud al pasar de b a b+3 es tres veces el perfil F₂.Alcance: clasificación de la Parte I en las dos alturas; pendiente real positiva y altura sin cota superior.-/module public import Formalizations.Combinatorics.Caballero.AngularPhaseMasspublic import Mathlib.Algebra.BigOperators.Fin /-!# AngularThreeStep-/ /-!## 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 CaballeroExact open Set MeasureTheory CaballeroStepPartition CaballeroSectionTransport CaballeroPhaseMass private theorem measurable_label (b : ℕ) (θ : ℝ) {s : Set ℝ} (hs : MeasurableSet s) : MeasurableSet (labelSet b θ s) := by have hw : Measurable (fun x : ℝ => cellWord (b : ℤ) x θ) := by unfold cellWord CaballeroPeaks.clip fun_prop have hm : MeasurableSet {w : CaballeroPeaks.Palabra | CaballeroPeaks.enLista (b : ℤ) w} := (Set.to_countable _).measurableSet exact hs.inter (hw hm) private theorem labeled_partition {I : Type*} [Fintype I] (b : ℕ) (θ : ℝ) (s : Set ℝ) (r : I → Set ℝ) (cover : s = ⋃ i, r i) (hd : Pairwise (fun i j => Disjoint (r i) (r j))) (hm : ∀ i, MeasurableSet (r i)) (hf : ∀ i, volume (r i) ≠ ⊤) : volume.real (labelSet b θ s) = ∑ i, volume.real (labelSet b θ (r i)) := by have eqs : labelSet b θ s = ⋃ i, labelSet b θ (r i) := by ext x simp only [labelSet, cover, Set.mem_iUnion, Set.mem_ofPred_eq] constructor · rintro ⟨⟨i, hi⟩, hw⟩ exact ⟨i, hi, hw⟩ · rintro ⟨i, hi, hw⟩ exact ⟨⟨i, hi⟩, hw⟩ rw [eqs] refine measureReal_iUnion_fintype ?_ ?_ ?_ · intro i j hij exact (hd hij).mono (fun _ hx => hx.1) (fun _ hx => hx.1) · intro i exact measurable_label b θ (hm i) · intro i exact ne_top_of_le_ne_top (hf i) (measure_mono (fun _ hx => hx.1)) private theorem length_label (Amb : ℤ → CaballeroPeaks.Palabra → Prop) (b : ℕ) (θ : ℝ) (hcl : ∀ w, Amb (b : ℤ) w ↔ CaballeroPeaks.enLista (b : ℤ) w) : secLen Amb b θ = volume.real (labelSet b θ (Ico 0 (sectionEnd b θ))) := by let A := {x : ℝ | CaballeroPeaks.enLista (b : ℤ) (cellWord (b : ℤ) x θ)} have he : {x : ℝ | 0 ≤ x ∧ x ≤ (b : ℝ) + 2 * θ ∧ Amb (b : ℤ) (cellWord (b : ℤ) x θ)} = Icc 0 (sectionEnd b θ) ∩ A := by ext x simp only [A, sectionEnd, Set.mem_ofPred_eq, Set.mem_inter_iff, Set.mem_Icc, hcl, and_assoc] unfold secLen rw [he] exact measureReal_congr (ae_eq_set_inter Ico_ae_eq_Icc.symm .rfl) private theorem translated_length (b : ℕ) (θ : ℝ) (i : Fin 4) (hθ : 0 < θ) (hb : 12 * θ + 18 ≤ (b : ℝ)) : volume.real (labelSet (b + 3) θ (piece b θ (imageIndex i))) = volume.real (labelSet b θ (oldRegion b θ i)) := by let t : ℝ := i.val let S := labelSet (b + 3) θ (piece b θ (imageIndex i)) have domain (x : ℝ) : x + t ∈ piece b θ (imageIndex i) ↔ x ∈ oldRegion b θ i := by rw [← (region_translation b θ i).1] constructor · rintro ⟨y, hy, he⟩ change y + t = x + t at he exact (add_right_cancel he) ▸ hy · intro hx exact ⟨x, hx, rfl⟩ have pre : (fun x : ℝ => x + t) ⁻¹' S = labelSet b θ (oldRegion b θ i) := by ext x change (x + t ∈ piece b θ (imageIndex i) ∧ CaballeroPeaks.enLista ((b : ℤ) + 3) (cellWord ((b : ℤ) + 3) (x + t) θ)) ↔ (x ∈ oldRegion b θ i ∧ CaballeroPeaks.enLista (b : ℤ) (cellWord (b : ℤ) x θ)) rw [domain] constructor · rintro ⟨hx, hw⟩ exact ⟨hx, (region_word b θ x i hθ hb hx).2.mpr hw⟩ · rintro ⟨hx, hw⟩ exact ⟨hx, (region_word b θ x i hθ hb hx).2.mp hw⟩ calc volume.real S = volume.real ((fun x : ℝ => x + t) ⁻¹' S) := congrArg ENNReal.toReal (measure_preimage_add_right volume t S).symm _ = _ := by rw [pre] /-- Three-step law for the section length, conditional on the Part I classification at both heights. -/theorem three_step (Amb : ℤ → CaballeroPeaks.Palabra → Prop) (b : ℕ) (θ : ℝ) (hθ : 0 < θ) (hb : 12 * θ + 18 ≤ (b : ℝ)) (hcl₀ : ∀ w, Amb (b : ℤ) w ↔ CaballeroPeaks.enLista (b : ℤ) w) (hcl₃ : ∀ w, Amb ((b + 3 : ℕ) : ℤ) w ↔ CaballeroPeaks.enLista ((b + 3 : ℕ) : ℤ) w) : secLen Amb (b + 3) θ - secLen Amb b θ = 3 * F2 θ := by rw [length_label Amb (b + 3) θ hcl₃, length_label Amb b θ hcl₀] obtain ⟨cov₀, dis₀⟩ := old_partition b θ hθ.le obtain ⟨cov₃, dis₃⟩ := new_partition b θ hθ.le rw [labeled_partition (b + 3) θ _ (piece b θ) cov₃ dis₃ (fun _ => measurableSet_Ico) (fun _ => by rw [piece, Real.volume_Ico]; exact ENNReal.ofReal_ne_top), labeled_partition b θ _ (oldRegion b θ) cov₀ dis₀ (fun _ => measurableSet_Ico) (fun _ => by rw [oldRegion, Real.volume_Ico]; exact ENNReal.ofReal_ne_top)] let old (i : Fin 4) := volume.real (labelSet b θ (oldRegion b θ i)) let fresh (k : Fin 7) := volume.real (labelSet (b + 3) θ (piece b θ k)) have t0 : fresh 0 = old 0 := translated_length b θ 0 hθ hb have t1 : fresh 2 = old 1 := translated_length b θ 1 hθ hb have t2 : fresh 4 = old 2 := translated_length b θ 2 hθ hb have t3 : fresh 6 = old 3 := translated_length b θ 3 hθ hb have g0 : fresh 1 = CaballeroPhaseTable.Ufase1 θ := by simpa [fresh, gapIndex] using gap_length b θ 0 hθ hb have g1 : fresh 3 = CaballeroPhaseTable.Ufase1 θ := by simpa [fresh, gapIndex] using gap_length b θ 1 hθ hb have g2 : fresh 5 = CaballeroPhaseTable.Ufase1 θ + CaballeroPhaseTable.Ufase2 θ := by simpa [fresh, gapIndex] using gap_length b θ 2 hθ hb change (∑ k : Fin 7, fresh k) - (∑ i : Fin 4, old i) = _ simp only [Fin.sum_univ_succ, Fin.sum_univ_zero, add_zero] change fresh 0 + (fresh 1 + (fresh 2 + (fresh 3 + (fresh 4 + (fresh 5 + fresh 6))))) - (old 0 + (old 1 + (old 2 + old 3))) = _ rw [t0, t1, t2, t3, g0, g1, g2, ← phase_sum θ hθ] ring -- Control numérico por encima de 64: la geometría distingue los coeficientes tres y dos.example : secLen CaballeroPeaks.enLista 69 (2/3) - secLen CaballeroPeaks.enLista 66 (2/3) = 1 ∧ secLen CaballeroPeaks.enLista 69 (2/3) - secLen CaballeroPeaks.enLista 66 (2/3) ≠ 2 * F2 (2/3) := by have hs := three_step CaballeroPeaks.enLista 66 (2/3) (by norm_num) (by norm_num) (fun _ => Iff.rfl) (fun _ => Iff.rfl) change secLen CaballeroPeaks.enLista 69 (2/3) - secLen CaballeroPeaks.enLista 66 (2/3) = 3 * F2 (2/3) at hs rw [hs] norm_num [F2] -- A b=66, las alturas 1/3 y 2/3 distinguen los tres huecos individualmente.example (i : Fin 3) : volume.real (labelSet 69 (1/3) (piece 66 (1/3) (gapIndex i))) = 1 ∧ volume.real (labelSet 69 (2/3) (piece 66 (2/3) (gapIndex i))) = (if i.val = 2 then 1 else 0) := by have f := CaballeroPhaseTable.fases_tramo2 (1/3) (by norm_num) (by norm_num) have g := CaballeroPhaseTable.fases_tramo4 (2/3) (by norm_num) (by norm_num) rw [gap_length 66 (1/3) i (by norm_num) (by norm_num), gap_length 66 (2/3) i (by norm_num) (by norm_num), f.1, f.2, g.1, g.2] by_cases h : i.val = 2 <;> norm_num [h] end CaballeroExact