/-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.AngularPrimaryPhase /-!# The primary phase against the tent of Part II (Caballero, Part IV) Paragraph after Theorem 5 of Part IV. Let T_a(theta) = 1 - a(a+1)|theta - 1/(a+1)| be the tent ofPart II, Proposition 6.3. For a >= 2: U_a = T_a on [1/(a+2), 1/a] (so the left half of the tentpersists down to 1/(a+2)), and U_a > T_a on (0, 1/(a+2)) (the profile exceeds the tent only below1/(a+2)), since there 2 theta - T_a(theta) = (a-1)(1 - (a+2) theta) > 0. By Theorem 1 the same holdsfor the limit profile F_a = lim_b A_{a,b} (profile_vs_tent). For a >= 3 the point 1/(a+2) liesbeyond d = 1/(2a(a+1)) to the left of 1/(a+1) (left_end_beyond). ## Main results * `CaballeroTent.profile_vs_tent`: the limit profile is the tent on [1/(a+2), 1/a] and exceeds it on (0, 1/(a+2))* `CaballeroTent.primaryPhase_eq_tent`: U_a = 1 - a(a+1)|theta - 1/(a+1)| on [1/(a+2), 1/a]* `CaballeroTent.tent_lt_primaryPhase`: U_a exceeds the tent on (0, 1/(a+2))* `CaballeroTent.left_end_beyond`: for a >= 3, 1/(a+2) < 1/(a+1) - 1/(2a(a+1)) ## 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? II. Generic Rigidity and Persistent Ambiguity, Zenodo (2026).-/ @[expose] public section namespace CaballeroTent open Filter Topology CaballeroLowerBound CaballeroWidths /-- The tent `1 - a(a+1)|θ - 1/(a+1)|` of Part II, Proposition 6.3. -/noncomputable def tent (a : ℕ) (θ : ℝ) : ℝ := 1 - (a : ℝ) * ((a : ℝ) + 1) * |θ - 1 / ((a : ℝ) + 1)| /-- On `[1/(a+2), 1/a]` the primary phase function is the tent. -/theorem primaryPhase_eq_tent (a : ℕ) (ha : 2 ≤ a) (θ : ℝ) (h1 : 1 / ((a : ℝ) + 2) ≤ θ) (h2 : θ ≤ 1 / (a : ℝ)) : primaryPhase a θ = tent a θ := by obtain ⟨-, -, -, -, hB, hC⟩ := CaballeroPrimaryPhase.primary_phase a ha have ha1 : (0 : ℝ) < (a : ℝ) + 1 := by positivity unfold tent rcases le_or_gt θ (1 / ((a : ℝ) + 1)) with h | h · rw [hB θ h1 h, abs_of_nonpos (by linarith)] field_simp ring · rw [hC θ h.le h2, abs_of_pos (by linarith)] field_simp ring /-- Below `1/(a+2)` the primary phase function lies strictly above the tent. -/theorem tent_lt_primaryPhase (a : ℕ) (ha : 2 ≤ a) (θ : ℝ) (h0 : 0 < θ) (h1 : θ < 1 / ((a : ℝ) + 2)) : tent a θ < primaryPhase a θ := by obtain ⟨-, -, -, hA, -, -⟩ := CaballeroPrimaryPhase.primary_phase a ha have ha2 : (2 : ℝ) ≤ a := by exact_mod_cast ha have hlt : θ * ((a : ℝ) + 2) < 1 := by rw [lt_div_iff₀ (by positivity)] at h1 linarith have hle : θ ≤ 1 / ((a : ℝ) + 1) := by rw [le_div_iff₀ (by positivity)] nlinarith rw [hA θ h0 h1.le] unfold tent rw [abs_of_nonpos (by linarith)] have e : (a : ℝ) * ((a : ℝ) + 1) * -(θ - 1 / ((a : ℝ) + 1)) = (a : ℝ) - (a : ℝ) * ((a : ℝ) + 1) * θ := by field_simp ring rw [e] -- `2θ - (1 - a + a(a+1)θ) = (a - 1)(1 - (a+2)θ) > 0` nlinarith /-- The point `1/(a+2)` lies beyond `d = 1/(2a(a+1))` to the left of `1/(a+1)` when `a ≥ 3`. -/theorem left_end_beyond (a : ℕ) (ha : 3 ≤ a) : 1 / ((a : ℝ) + 2) < 1 / ((a : ℝ) + 1) - 1 / (2 * (a : ℝ) * ((a : ℝ) + 1)) := by have ha3 : (3 : ℝ) ≤ a := by exact_mod_cast ha rw [div_sub_div _ _ (by positivity) (by positivity), div_lt_div_iff₀ (by positivity) (by positivity)] nlinarith /-- Paragraph after Theorem 5 of Part IV, in terms of the profile: the limit `F_a(θ)` of theambiguous proportion is the tent on `[1/(a+2), 1/a]` and exceeds it on `(0, 1/(a+2))`. -/theorem profile_vs_tent (a : ℕ) (ha : 2 ≤ a) : (∀ θ : ℝ, 1 / ((a : ℝ) + 2) ≤ θ → θ ≤ 1 / (a : ℝ) → Tendsto (fun b : ℕ => ambProportion a b θ) atTop (𝓝 (tent a θ))) ∧ (∀ θ : ℝ, 0 < θ → θ < 1 / ((a : ℝ) + 2) → ∃ F : ℝ, Tendsto (fun b : ℕ => ambProportion a b θ) atTop (𝓝 F) ∧ tent a θ < F) := by obtain ⟨-, hlim, -⟩ := CaballeroPrimaryPhase.primary_phase a ha have ha0 : (0 : ℝ) < a := by exact_mod_cast (by omega : 0 < a) have hstrip : 1 / ((a : ℝ) + 2) ≤ 1 / (a : ℝ) := one_div_le_one_div_of_le ha0 (by linarith) refine ⟨fun θ h1 h2 => ?_, fun θ h0 h1 => ⟨primaryPhase a θ, hlim θ h0 (h1.le.trans hstrip), tent_lt_primaryPhase a ha θ h0 h1⟩⟩ have h0 : 0 < θ := lt_of_lt_of_le (by positivity) h1 rw [← primaryPhase_eq_tent a ha θ h1 h2] exact hlim θ h0 h2 end CaballeroTent