← Session 18 — Lean tier (ii): finite-height proof + certified base points
thinking (43328 chars)
Refactor compiles green (only the expected sorry warning on lambda_pos_finite_height at line 55). The marginTilde_convex now takes ContDiffOn ℝ 2 F (Set.Ioi 1), no hmaj.
Now add the new sections. I'll insert after the end of marginTilde_convex (before `end NguyenRH1`). Content:
1. FAlt, Bn, Sf, SfBoundProp defs + marginTilde_eq_sub
2. ψ-block lemmas for FAlt blocks + psiOf_add/const_mul + psiOf_FAlt_neg + contDiffOn_FAlt
3. pos_of_convex_of_base
4. lambda_pos_finite_height assembly (replacing the old sorry'd statement — with hbase/hbase′ interim)
Wait — the old lambda_pos_finite_height (line 55, with sorry) needs to be REPLACED by the new assembly. I'll replace it with the new full version. Where to place the new machinery: the old theorem is at line ~55 in section 1; the machinery (marginTilde etc.) is later. I'll keep the file structure: replace the old theorem's `sorry` with... no — the assembly needs marginTilde_convex which comes later in the file. So: move the theorem — replace the old skeleton theorem with a comment pointer, and put the real assembly at the end. Actually cleaner: DELETE the old sorry'd theorem from section 1 and add the new one at the end with all the machinery. But the old theorem statement is referenced in PrintAxioms (name only ✓) and the file header. Fine.
Let me write the new code. Key pieces:
```lean
/-! ## 4. The assembly (session 012, tier (ii) step 1): the finite-height
Li theorem modulo the single named analytic hypothesis `SfBoundProp`. -/
/-- The explicit Trudgian-shape zero-count majorant used in the assembly
(session 012 design, D-057 §2 rows #1–#4):
FAlt(T) = (1/2π)·T·log T + 0.137·log T + 0.443·log log T + (7/8 + 1.588).
This is the Trudgian 2014 majorant F(T) + S_b(T) with the negative-weight
−(log 2πe/2π)·T term DROPPED (FAlt ≥ F + S_b pointwise: the dropped term
is ≥ 0 for T ≥ 1), so any N(T) ≤ F + S_b bound upgrades to N(T) ≤ FAlt;
all four surviving blocks have provably negative ψ (D-057 rows #1/#3/#4),
which the true F + S_b does NOT (its ψ crosses positive on [5.47, ~16]).
The margin cost of the swap is (log 2πe/2π)·2T ≈ 0.9√n, negligible against
margiñ(8×10⁴) ≈ 1.6×10⁴ (E-028). -/
def FAlt (T : ℝ) : ℝ :=
(1 / (2 * Real.pi)) * (T * Real.log T) + 0.137 * Real.log T +
0.443 * Real.log (Real.log T) + (7 / 8 + 1.588)
```
Wait — hmm, one important check: "FAlt ≥ F + S_b pointwise" — F(T)+S_b(T) = (T/2π)log(T/2πe) + 7/8 + S_b(T) = (1/2π)T log T − (log 2πe/2π)T + 7/8 + S_b(T). FAlt − (F+S_b) = (log 2πe/2π)·T ≥ 0 for T ≥ 0 ✓. Good. (For T < 0 junk — irrelevant.)
```lean
/-- The explicit finite-part bound B(n) (D-037 (4.1), constants A = 10.5,
B₀ = 48 from D-056; Ĉ₀/Ĥ closed forms; M₀ = 1.3352; I_I majorant IIMaj),
written with the zero-count majorant F as a parameter:
B(n) = 2F(T) + 4T[(2/3)Ĉ₀(T) + 10.5 log(T+2) + 48] + 40·1.3352
+ 2(e⁴+1)[7Ĥ(T) + 3.3] + IIMaj(n) + 1, T = √n + 1. -/
def Bn (F : ℝ → ℝ) (n : ℝ) : ℝ :=
let T := Real.sqrt n + 1
2 * F T + 4 * T * ((2 / 3) * C0hat T + 10.5 * Real.log (T + 2) + 48) +
40 * 1.3352 + 2 * (Real.exp 4 + 1) * (7 * Hhat T + 3.3) + IIMaj n + 1
/-- marginTilde IS sInftyLower − Bn + 1 (definitional bookkeeping). -/
theorem marginTilde_eq_sub (F : ℝ → ℝ) (n : ℝ) :
marginTilde F n = sInftyLower n - Bn F n + 1 := by
simp only [marginTilde, Bn, sInftyLower]
ring
/-- The finite part S_f(n) of the Bombieri–Lagarias decomposition
λ_n = S_∞(n) − S_f(n) + 1 (BL 1999 Thm 2, D-037 P1), here DEFINED by the
identity (so the identity holds by construction); the analytic content —
that this prime-side quantity satisfies the contour bound B(n) — is
isolated in `SfBoundProp` below. -/
def Sf (n : ℕ) : ℝ := SInfty n + 1 - (liCoeff n).re
/-- ⭐ THE named analytic hypothesis of tier (ii) (session-012 design,
session-012-notes.txt step 1): the finite part is bounded by the explicit
traced B(n) on the whole margin range N₀ = 8×10⁴ ≤ n ≤ N₁ = (T₀−1)².
Proof content (triage in D-062): the D-036/D-056 contour estimate —
kernel bounds + R-bound (Mathlib-tractable complex analysis), Trudgian
2014 N(T)/S(T) (trusted-perimeter literature), the bridge via
RHUpTo T₀ (perimeter), M₀ (E-023 grid / E-023b acb). -/
def SfBoundProp : Prop :=
∀ n : ℕ, 80000 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →
|Sf n| ≤ Bn FAlt n
```
Then the ψ machinery. First psiOf_add, psiOf_const_mul, psiOf_const:
```lean
/-- ψ is additive (given the deriv²-splitting regularity). -/
theorem psiOf_add {f g : ℝ → ℝ} {T : ℝ}
(hf1 : DifferentiableAt ℝ (deriv f) T) (hg1 : DifferentiableAt ℝ (deriv g) T)
(hf2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ f m)
(hg2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ g m) :
psiOf (fun x => f x + g x) T = psiOf f T + psiOf g T := by
unfold psiOf
rw [deriv2_add hf1 hg1 hf2 hg2,
deriv_add hf2.self_of_nhds hg2.self_of_nhds]
ring
/-- ψ commutes with constant multiplication. -/
theorem psiOf_const_mul {f : ℝ → ℝ} {T : ℝ} (c : ℝ)
(hf1 : DifferentiableAt ℝ (deriv f) T)
(hf2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ f m) :
psiOf (fun x => c * f x) T = c * psiOf f T := by
unfold psiOf
rw [deriv2_const_mul c hf1 hf2, deriv_const_mul c hf2.self_of_nhds]
ring
/-- ψ of a constant function is 0. -/
theorem psiOf_const (K T : ℝ) : psiOf (fun _ => K) T = 0 := by
unfold psiOf
rw [deriv2_const_val, deriv_const]
ring
```
Wait deriv_const: `deriv (fun _ => K) T = 0` — Mathlib: `deriv_const (c : ℝ) (x : ℝ) : deriv (fun _ => c) x = 0`? There's `deriv_const (c : α) : deriv (fun _ => c) = 0`... I think `deriv_const (c) (x)`? Let me check: Mathlib has `deriv_const (c : F) : deriv (fun _ => c) = 0`? Hmm, in current Mathlib: `theorem deriv_const (c : F) : deriv (fun _ => c) = 0` — funext version? There's also `deriv_const (c : ℝ) (x : ℝ)`? I'll write `simp` fallback: `rw [deriv2_const_val, deriv_const]` then fix at compile. Actually safer: `have : deriv (fun _ : ℝ => K) T = 0 := by simp` — hmm. deriv_const in Mathlib (Analysis.Calculus.Deriv.Basic): `theorem deriv_const (c : F) : deriv (fun _ => c) = 0` — as a function equation; so `deriv (fun _ => K) T = 0` follows by rw [deriv_const] then... `deriv_const K : deriv (fun _ => K) = fun _ => 0`? then `rw [deriv_const K]`; goal 0 - 0/(T-1) = 0... After `rw [deriv2_const_val]`: goal `0 - deriv (fun _ => K) T / (T-1) = 0`. Then `rw [deriv_const]`: if deriv_const is the funext form, `rw [deriv_const K]` rewrites deriv (fun _ => K) to fun _ => 0, then the application... `simp` is simplest: `simp [deriv2_const_val, deriv_const]`? Let me just write:
```
theorem psiOf_const (K T : ℝ) : psiOf (fun _ => K) T = 0 := by
unfold psiOf
rw [deriv2_const_val]
simp
```
deriv_const is a simp lemma? `deriv_const` is marked simp I believe. After rw deriv2_const_val: goal `0 - deriv (fun _ => K) T / (T - 1) = 0`; simp should rewrite deriv_const to 0 and close. OK.
Blocks:
```lean
/-- [PROVED session 012] Block A (T·log T, D-057 row #1): ψ-formula. -/
theorem psiOf_T_mul_log (T : ℝ) (hT : 1 < T) :
psiOf (fun t => t * Real.log t) T = 1 / T - (Real.log T + 1) / (T - 1) := by
have hT0 : (0 : ℝ) < T := by linarith
have h1 : ∀ᶠ x in 𝓝 T, HasDerivAt (fun t => t * Real.log t) (Real.log x + 1) x := by
filter_upwards [eventually_gt_nhds hT0] with x hx
have h := (hasDerivAt_id' x).mul (Real.hasDerivAt_log (ne_of_gt hx))
rwa [one_mul, mul_inv_cancel₀ (ne_of_gt hx)] at h
have h2 : HasDerivAt (fun t => Real.log t + 1) T⁻¹ T :=
(Real.hasDerivAt_log (ne_of_gt hT0)).add_const 1
have hd2 := deriv2_of_hasDerivAt_nhds h1 h2
have hd1 : deriv (fun t => t * Real.log t) T = Real.log T + 1 := h1.self_of_nhds.deriv
unfold psiOf
rw [hd2, hd1]
```
Hmm wait: HasDerivAt (fun t => t * log t) ... gives derivative `1 * log T + T * T⁻¹`. `mul_inv_cancel₀`: T * T⁻¹ = 1 ✓ so derivative value = log T + 1 ✓ rwa [one_mul, mul_inv_cancel₀]. ✓ And h2: deriv of (log t + 1) is 1/t = T⁻¹: Real.hasDerivAt_log gives HasDerivAt Real.log T⁻¹ T ✓ .add_const 1: HasDerivAt (fun t => log t + 1) (T⁻¹ + 0)? add_const adds const to FUNCTION, derivative unchanged: HasDerivAt (fun x => f x + c) (f') — `HasDerivAt.add_const : HasDerivAt f f' x → HasDerivAt (fun x => f x + c) f' x` ✓. But careful — session-011 gotcha: "HasDerivAt.add_const adds to VALUE (use .comp for precomposition)" — (Real.hasDerivAt_log ...).add_const 1 : HasDerivAt (fun t => Real.log t + 1) T⁻¹ T ✓ correct usage here (value shift).
Then sign:
```lean
/-- Block A sign: ψ < 0 for T > 1 (⟺ −1 < T log T). -/
theorem psiOf_T_mul_log_neg {T : ℝ} (hT : 1 < T) :
psiOf (fun t => t * Real.log t) T < 0 := by
rw [psiOf_T_mul_log T hT]
have hT0 : (0 : ℝ) < T := by linarith
have hT1 : (0 : ℝ) < T - 1 := by linarith
have hlog : (0 : ℝ) < Real.log T := Real.log_pos hT
-- 1/T < (log T + 1)/(T−1) ⟺ T−1 < T(log T + 1) ⟺ −1 < T log T
rw [div_lt_div_iff₀ hT0 hT1] -- 1·(T−1) < (log T + 1)·T
nlinarith [mul_pos hT0 hlog]
```
div_lt_div_iff₀ (ha : 0 < a) (hb : 0 < b) : c/a < d/b ↔ c*b < d*a. So 1/T − ... wait the goal is `1/T − (log T+1)/(T−1) < 0` — that's a difference, not a single div comparison. Better: show `1/T < (log T + 1)/(T−1)` then linarith.
```
have key : (1 : ℝ)/T < (Real.log T + 1)/(T - 1) := by
rw [div_lt_div_iff₀ hT0 hT1]
nlinarith [mul_pos hT0 hlog]
-- goal: 1/T − (log T+1)/(T−1) < 0
linarith
```
nlinarith: goal after rw: 1*(T−1) < (log T + 1)*T ⟺ T − 1 < T log T + T ⟺ −1 < T log T ✓ from mul_pos hT0 hlog : 0 < T * log T. nlinarith should close: T−1 < (log T + 1)*T. Provide hint [mul_pos hT0 hlog]. ✓
Block B (log T):
```lean
theorem psiOf_log (T : ℝ) (hT : 0 < T) :
psiOf Real.log T = -1 / T ^ 2 - 1 / (T * (T - 1)) := by
have h1 : ∀ᶠ x in 𝓝 T, HasDerivAt Real.log x⁻¹ x := by
filter_upwards [eventually_ne_nhds (ne_of_gt hT)] with x hx
exact Real.hasDerivAt_log hx
have h2 : HasDerivAt (fun t => t⁻¹) (-1 / T^2) T := ...
```
Hmm — HasDerivAt (fun t => t⁻¹) (-(T^2)⁻¹)? Mathlib: HasDerivAt.inv: (hasDerivAt_id' T).inv (ne_of_gt hT) gives HasDerivAt (fun t => t⁻¹) (-(T^2)⁻¹)? The derivative of x⁻¹ is -(x²)⁻¹. In psiOf_log_shift they did: ((hasDerivAt_id' T).add_const 2).inv h gives -1/(T+2)^2 form via ring-normalizing `-(1:ℝ)/(T+2)^2 = -1/(T+2)^2`. For unshifted: (hasDerivAt_id' T).inv (ne_of_gt hT) : HasDerivAt (fun t => (id t)⁻¹) (-(T^2)⁻¹)... the file's pattern:
```
have h := ((hasDerivAt_id' T).add_const 2).inv (by linarith : (T + 2) ≠ 0)
have e : (-(1 : ℝ)) / (T + 2) ^ 2 = -1 / (T + 2) ^ 2 := by ring
rwa [e] at h
```
So for unshifted: h := (hasDerivAt_id' T).inv (ne_of_gt hT) : HasDerivAt (fun t => (id t)⁻¹) (-1/T^2)? The inv rule: HasDerivAt f f' x → HasDerivAt (fun x => (f x)⁻¹) (-f'/f x ^2) x given f x ≠ 0. So derivative value: -(1)/T^2 = -1/T^2 ✓ and function fun t => (id t)⁻¹ = fun t => t⁻¹ ✓ (id t = t). The pattern `rwa [e] at h` with e : -(1:ℝ)/T^2 = -1/T^2 by ring — actually -1/T^2 is already -(1)/T^2? -(1)/T^2 parses as (-1)/T^2 = -1/T^2 ✓ defeq; might not even need the ring step. I'll write:
```
have h2 : HasDerivAt (fun t : ℝ => t⁻¹) (-1 / T ^ 2) T := by
have h := (hasDerivAt_id' T).inv (ne_of_gt hT)
rwa [one_div] at h -- hmm
```
HasDerivAt.inv statement: `HasDerivAt.inv (hf : HasDerivAt f f' x) (hx : f x ≠ 0) : HasDerivAt (fun x => (f x)⁻¹) (-f' / (f x)^2) x`. With f = id: f' = 1: derivative -1/(id T)^2 = -1/T^2. id T = T. So h : HasDerivAt (fun x => (id x)⁻¹) (-1/T^2) T. Goal function (fun t => t⁻¹) vs (fun x => (id x)⁻¹): (id x)⁻¹ = x⁻¹ ✓ defeq (id x unfolds). And -1/(id T)^2 — id T is defeq T but maybe not syntactically. Just use `exact h` and if defeq works it's fine — -1/(id T)^2: id T reduces to T definitionally ✓. Should be fine with `exact h` or `rwa`.
Then ψ[log] = -1/T² - (T⁻¹)/(T-1) = -1/T² - 1/(T(T-1)): field_simp [hT.ne', hT1.ne'].
```
have hd2 := deriv2_of_hasDerivAt_nhds h1 h2
have hd1 : deriv Real.log T = T⁻¹ := h1.self_of_nhds.deriv
unfold psiOf
rw [hd2, hd1]
have hT1 : (T - 1) ≠ 0 := ...
field_simp [ne_of_gt hT, hT1]
```
Wait psiOf_log needs hT : 0 < T for formula but the T−1 denominator: -1/(T(T-1)) — the formula as stated needs T ≠ 1 for the VALUE to be meaningful, but deriv value (log T+... the formula 1/(T(T−1)) has T−1 in it. psiOf φ T = deriv(deriv φ) T − deriv φ T/(T−1) is defined for all T (junk at T = 1). For the formula statement, require 0 < T and T ≠ 1? We apply at T ≥ √20+1 so T > 1. State with hT : 1 < T to keep it clean (matches other blocks).
ψ[log] formula: -1/T^2 - (T⁻¹)/(T-1). After field_simp: -1/T² − 1/(T(T−1)) — need to show deriv(deriv log) T − deriv log T/(T−1) = -1/T² − 1/(T(T−1)): LHS = -1/T² − T⁻¹/(T−1). field_simp [hT0.ne', hT1.ne'] then ring. In psiOf_log_shift they ended with just `field_simp [hT1, hT2']` (no ring) — "field_simp often closes goals (trailing ring errors)" per gotchas. So: field_simp [hT0.ne', hT1.ne'] — may close directly. I'll add `<;> ring` fallback... can't have both; write `field_simp [...]` then `ring` — if field_simp closes, ring errors "no goals". Session-011 gotcha says field_simp often closes goals (trailing ring errors) — meaning they dropped the trailing ring. I'll write field_simp only, fix if needed.
Sign: ψ[log] < 0 for T > 1: both terms negative:
```
theorem psiOf_log_neg {T : ℝ} (hT : 1 < T) : psiOf Real.log T < 0 := by
rw [psiOf_log T hT]
have h1 : (0:ℝ) < 1/T^2 := one_div_pos.mpr (pow_pos (by linarith) 2)
have h2 : (0:ℝ) < 1/(T*(T-1)) := one_div_pos.mpr (mul_pos (by linarith) (by linarith))
have e : -1/T^2 - 1/(T*(T-1)) = -(1/T^2 + 1/(T*(T-1))) := by ring
rw [e]; linarith [add_pos h1 h2]
```
Block C (log log T): pattern after psiOf_log_log_shift but unshifted:
- hasDerivAt_log_log_unshifted: HasDerivAt (fun t => Real.log (Real.log t)) ((Real.log T)⁻¹ * T⁻¹) T for T > 1:
```
have hin : HasDerivAt Real.log T⁻¹ T := Real.hasDerivAt_log (ne_of_gt (by linarith : 0 < T))
have hout : HasDerivAt Real.log (Real.log T)⁻¹ (Real.log T) := Real.hasDerivAt_log (ne_of_gt (Real.log_pos hT))
exact hout.comp T hin
```
- D2: HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) (-(log T + 1)/((T * log T)^2)) T:
hu : HasDerivAt (fun t => (log t)⁻¹) (-(T⁻¹)/ (log T)^2)? inv rule: derivative of (log t)⁻¹ = -(T⁻¹)/(log T)^2 = -1/(T (log T)^2)... form: -(T⁻¹)/(Real.log T)^2. In psiOf_log_log_shift: `hin.inv (ne_of_gt hL1)` gives HasDerivAt (fun t => (log (t+2))⁻¹) (-(T+2)⁻¹ / log(T+2)^2) T. So hu := hin.inv ... : HasDerivAt (fun t => (Real.log t)⁻¹) (-T⁻¹ / (Real.log T)^2) T ✓.
hv : HasDerivAt (fun t => t⁻¹) (-1/T^2) T (from above).
hu.mul hv: derivative = (-T⁻¹/(log T)^2)·T⁻¹ + (log T)⁻¹·(-1/T²). Target closed: -(log T + 1)/((T log T)^2). Check: -(log T+1)/(T²(log T)²) = -1/(T² log T) − 1/(T² (log T)²). First: (-T⁻¹/(log T)²)·T⁻¹ = -1/(T² (log T)²) ✓. Second: (log T)⁻¹·(-1/T²) = -1/(T² log T) ✓. Sum ✓. field_simp + ring as in the shifted version.
- ψ = D2 − D1/(T−1) = -(log T+1)/((T log T)^2) − ((log T)⁻¹ T⁻¹)/(T−1) = -(log T+1)/((T·log T)^2) − 1/(T·log T·(T−1)). field_simp.
Sign: for T > 1: log T > 0 ⟹ both terms negative ✓ (mirror psiOf_log_log_shift_neg).
Now assemble FAlt:
```lean
/-- The block decomposition of FAlt for the ψ-computation. -/
private def faltA : ℝ → ℝ := fun T => T * Real.log T
private def faltB : ℝ → ℝ := Real.log
private def faltC : ℝ → ℝ := fun T => Real.log (Real.log T)
```
Hmm — actually psiOf_FAlt_neg needs ψ[FAlt] where FAlt T = (1/(2π))*(T*log T) + 0.137*log T + 0.443*log(log T) + (7/8+1.588). As a λ: fun T => (1/(2*Real.pi)) * (T * Real.log T) + 0.137 * Real.log T + 0.443 * Real.log (Real.log T) + (7/8 + 1.588). psiOf_add applies to (fun x => f x + g x) — the expression `a + b + c + d` parses as ((a + b) + c) + d ✓ nested adds fine. But the pieces are (fun T => (1/(2π)) * (T * log T)) = fun T => (1/(2π)) * (faltA T)? (T * Real.log T) with T the bound var: (1/(2*Real.pi)) * (T * Real.log T) — is this `c * f x` shape with f = fun T => T * log T? Yes: c * f x with c = 1/(2π), f x = x * log x ✓ syntactically (c * (x * log x)) — the lambda body is `(1/(2π)) * (T * Real.log T)` = HMul.hMul c (f T) ✓ matches `fun x => c * f x` with f := fun T => T * Real.log T. ✓
For psiOf_const_mul/psiOf_add I need per-piece regularity:
- For f = fun T => T * log T: DifferentiableAt ℝ (deriv f) T and ∀ᶠ m ∈ 𝓝 T, DifferentiableAt f m.
From ContDiffOn: faltA_contDiffOn : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1)? Or even Ioi 0. Then at T > 1: hdd/hev patterns:
```
have hddA : DifferentiableAt ℝ (deriv (fun t => t * Real.log t)) T :=
((hCDA.deriv_of_isOpen (m := 1) isOpen_Ioi (by norm_num)).differentiableOn one_ne_zero).differentiableAt (Ioi_mem_nhds hT)
have hevA : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ (fun t => t * Real.log t) m := by
filter_upwards [Ioi_mem_nhds hT] with m hm
exact (hCDA.differentiableOn (by norm_num)).differentiableAt (Ioi_mem_nhds hm)
```
with hCDA : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1) := contDiffOn_id.mul (contDiffOn_id.log (fun x hx => ne_of_gt (zero_lt_one.trans hx)))... wait ContDiffOn ℝ 2 id.log: `(contDiffOn_id.log (h : ∀ x ∈ s, id x ≠ 0))`: for s = Ioi 1: x > 1 ⟹ x ≠ 0 ✓.
Simpler: build contDiffOn_FAlt first, and derive per-piece differentiability from per-piece ContDiffOns. I need per-piece ContDiffOn anyway? For contDiffOn_FAlt assembly:
```
theorem contDiffOn_FAlt : ContDiffOn ℝ 2 FAlt (Set.Ioi 1) := by
unfold FAlt
exact (((contDiffOn_const.mul (contDiffOn_id.mul (contDiffOn_id.log fun x hx => ...))).add
(contDiffOn_const.mul (contDiffOn_id.log ...))).add
(contDiffOn_const.mul ((contDiffOn_id.log ...).log ...))).add contDiffOn_const
```
where for the log log piece: (contDiffOn_id.log h0).log h1: h0 : ∀ x ∈ Ioi 1, id x ≠ 0 (x > 1); h1 : ∀ x ∈ Ioi 1, Real.log (id x) ≠ 0 — log x ≠ 0 for x > 1: ne_of_gt (Real.log_pos hx) ✓. Note Real.log (id x) — id x = x; Real.log_pos needs 1 < x ✓.
Then per-piece ContDiffOn (extract as separate lemmas so psiOf_FAlt_neg can use):
- hCDA : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1)
- hCDB : ContDiffOn ℝ 2 Real.log (Set.Ioi 1)
- hCDC : ContDiffOn ℝ 2 (fun t => Real.log (Real.log t)) (Set.Ioi 1)
- const: contDiffOn_const / contDiff_const.
And contDiffOn_FAlt := combination.
psiOf_FAlt_neg:
```
theorem psiOf_FAlt_neg {T : ℝ} (hT : Real.sqrt 20 + 1 ≤ T) : psiOf FAlt T < 0 := by
have h1T : 1 < T := by ... (√20+1 ≥ 5.47 via Real.le_sqrt) — reuse pattern from block_range_bounds: have hs : (4.4721:ℝ) ≤ Real.sqrt 20 := ...; linarith
-- differentiability bundles per piece
...
have hdecomp : psiOf FAlt T =
(1/(2*Real.pi)) * psiOf (fun t => t * Real.log t) T +
0.137 * psiOf Real.log T +
0.443 * psiOf (fun t => Real.log (Real.log t)) T + psiOf (fun _ => (7/8 + 1.588 : ℝ)) T := by
unfold FAlt
rw [psiOf_add hdd123 hddK hnev123 hnevK, psiOf_const, ...]
```
Hmm — the nested structure: FAlt T = A + B + C + K = ((A + B) + C) + K where A = c₁ f₁, B = c₂ f₂, C = c₃ f₃. psiOf_add on ((A+B)+C)+K: = psiOf (A+B+C) + psiOf K; psiOf (A+B+C) = psiOf (A+B) + psiOf C = psiOf A + psiOf B + psiOf C. Each psiOf (cᵢ fᵢ) = cᵢ psiOf fᵢ via psiOf_const_mul. Conditions accumulate: for psiOf_add I need DifferentiableAt (deriv (A+B+C)) T and DifferentiableAt (deriv K) T etc. deriv K: deriv (fun _ => K) = fun _ => 0 — differentiable: differentiableAt_const. DifferentiableAt (deriv (A+B+C)) T: deriv of sum = sum of derivs eventually... this is getting heavy. ALTERNATIVE: avoid psiOf_add entirely — compute ψ[FAlt] directly via deriv2_of_hasDerivAt_nhds like the other blocks:
h1 : ∀ᶠ x ∈ 𝓝 T, HasDerivAt FAlt (D1 x) x where D1 x = (1/(2π))(log x + 1) + 0.137 * x⁻¹ + 0.443 * ((log x)⁻¹ * x⁻¹).
h2 : HasDerivAt D1 (D2) T where D2 = (1/(2π)) T⁻¹ + 0.137 * (-1/T²) + 0.443 * (-(log T + 1)/((T * log T)²)).
Then ψ[FAlt] = D2 − D1/(T−1), and sign: group:
ψ = (1/(2π))[T⁻¹ − (log T + 1)/(T−1)] + 0.137[−1/T² − 1/(T(T−1))] + 0.443[−(log T+1)/((T log T)²) − 1/(T log T (T−1))]
Each bracket < 0 for T > 1 (proven as the block lemmas). Weights positive ⟹ ψ < 0.
The direct approach needs HasDerivAt-proofs for FAlt's D1 and D2 — basically the same work as the three blocks combined but ONE assembly. The block lemmas (psiOf_T_mul_log etc.) are independently useful (they're D-057 rows #1/#3/#4). I'll do: block formulas + block signs (standalone, useful), PLUS psiOf_FAlt via direct HasDerivAt assembly reusing per-piece HasDerivAt lemmas. Hmm, but that duplicates the derivative computations.
Cleaner: prove psiOf_add/const_mul ONCE (general machinery, small), then per-piece differentiability from ContDiffOn (mechanical), then decompose. The differentiableAt (deriv (A+B+C)) conditions for psiOf_add — wait NO: psiOf_add as I stated takes hf1 : DifferentiableAt ℝ (deriv f) T for the PIECES f and g (not their sum), and hf2/hg2 eventual — deriv2_add handles the sum. So applying psiOf_add to split ((A+B)+C)+K: need DifferentiableAt (deriv (A+B+C)) T — the SUM's deriv differentiability! Hmm, for the left-nested split: psiOf ((A+B+C)+K) = psiOf (A+B+C) + psiOf K needs DifferentiableAt (deriv (A+B+C)) T. deriv (A+B+C) = deriv A + deriv B + deriv C eventually → differentiable since each deriv differentiable. Proving that needs deriv_add chains again... PAIN.
Better: give psiOf_add a ContDiffOn-flavored variant:
```
theorem psiOf_add_cd {f g : ℝ → ℝ} {c : ℝ} (hc : c < T) -- T ∈ Ioi c
(hf : ContDiffOn ℝ 2 f (Set.Ioi c)) (hg : ContDiffOn ℝ 2 g (Set.Ioi c)) :
psiOf (fun x => f x + g x) T = psiOf f T + psiOf g T
```
with the differentiability derived inside via the hdd/hev patterns. Then nesting: psiOf ((A+B+C)+K): hf = ContDiffOn of (A+B+C) — build via .add chains (ContDiffOn.add). All mechanical:
```
theorem psiOf_FAlt_neg {T : ℝ} (hT : Real.sqrt 20 + 1 ≤ T) : psiOf FAlt T < 0
```
proof sketch:
```
have h1T : 1 < T := ...
-- ContDiffOn bundles
have hA : ContDiffOn ℝ 2 (fun t : ℝ => t * Real.log t) (Set.Ioi 1) := ...
have hB : ContDiffOn ℝ 2 Real.log (Set.Ioi 1) := ...
have hC : ContDiffOn ℝ 2 (fun t : ℝ => Real.log (Real.log t)) (Set.Ioi 1) := ...
-- ψ decomposition
have hψ : psiOf FAlt T = (1/(2*Real.pi)) * psiOf (fun t => t * Real.log t) T +
0.137 * psiOf Real.log T + 0.443 * psiOf (fun t => Real.log (Real.log t)) T := by
unfold FAlt
rw [psiOf_add_cd h1T (((contDiffOn_const.mul hA).add (contDiffOn_const.mul hB)).add (contDiffOn_const.mul hC)) contDiffOn_const, psiOf_const,
psiOf_add_cd h1T ((contDiffOn_const.mul hA).add (contDiffOn_const.mul hB)) (contDiffOn_const.mul hC),
psiOf_add_cd h1T (contDiffOn_const.mul hA) (contDiffOn_const.mul hB),
psiOf_const_mul_cd h1T contDiffOn_const hA, ...]
```
Hmm wait — psiOf_const_mul_cd: ψ[c·f] = c·ψ[f] with ContDiffOn flavor. And after decomposition: psiOf (fun _ => K) T = 0 via psiOf_const. The rw order/unfold FAlt: goal psiOf (fun T => c₁*(T*log T) + c₂*log T + c₃*log(log T) + K) T = ... — the λ-expression must match (fun x => f x + g x) shapes: ((c₁f₁ + c₂f₂) + c₃f₃) + K with f₁ = fun t => t*log t etc. — syntactically (fun T => X + Y) where X = c₁*(T*log T)... For the rw to fire, psiOf_add_cd's LHS pattern `psiOf (fun x => f x + g x) T` must unify with `psiOf (fun T => body) T` where body = ((c₁*(T*log T) + c₂*log T) + c₃*log(log T)) + K — higher-order unification: f x + g x =?= body: f := fun t => (c₁*(t*log t) + c₂*log t) + c₃*log(log t), g := fun _ => K — should unify (pattern unification, body is an application-structure). Lean's rw with lambdas: `psiOf (fun x => f x + g x)` — f and g are metavariables; matching `fun T => P T + Q T` against `fun x => ?f x + ?g x` — standard pattern, works (like deriv2_add applications in marginTilde_convex which rw on unfolded marginExpanded ✓ precedent exists).
Hmm — but actually deriv2_add was applied in marginTilde_convex via explicit `rw [deriv2_add (hdd hCD10) ...]` after `unfold marginExpanded; dsimp only`. So this style works. But the conditions for psiOf_add_cd at the TOP split: hf = ContDiffOn ((A+B)+C) — I pass the explicit ContDiffOn expression; the f/g unification determines f = (A+B+C)-λ, g = K-λ, and hf's type must be ContDiffOn ℝ 2 ((A+B+C)-λ) (Ioi 1) — my provided term `((contDiffOn_const.mul hA).add ...)` has type ContDiffOn ℝ 2 (fun T => ((c₁*(T*log T) + c₂*log T) + c₃*log(log T)))? NO — contDiffOn_const.mul hA : ContDiffOn ℝ 2 ((fun _ => c₁) * (fun t => t * log t)) — the Pi.mul form: ((fun _ => c₁) * f) t = c₁ * f t ✓ defeq to fun t => c₁*(t*log t) but syntactically Pi.mul_apply. When I pass it as hf : ContDiffOn ℝ 2 ?f (Ioi 1) with ?f unified from the rw match, the provided term's type must be DEFEQ to ContDiffOn ℝ 2 ?f — rw will assign ?f := the lambda from matching the goal, and my hf term's type must check defeq against it. (fun _ => c₁) * (fun t => t*log t) vs fun t => c₁*(t*log t): defeq by Pi.mul_apply ✓ (iota/beta). Type-checking hf against the expected type: isDefEq should handle Pi.mul_apply reduction ✓ (session-011 gotcha: "Pi.mul_apply/Pi.add_apply/Pi.sub_apply simp after .mul/.add/.sub" — they used simp only to CONVERT derivative VALUES; for type-checking provided terms, defeq handles it... they used convert ... first | rfl | ring suggesting defeq sometimes needed help. Risk noted; fix at compile.)
Hmm, honestly — this psiOf_add_cd route has multiple defeq risk points. The DIRECT route (one deriv2_of_hasDerivAt_nhds for FAlt with explicit D1, D2) is longer but each step is a pattern I've already seen work in this file. Actually — wait. Even simpler: I DON'T need ψ[FAlt] via psiOf at all! Look at how marginTilde_convex consumes hψ: `hψn : psiOf F (√n+1) < 0 := hψ _ hTn` where psiOf F T = deriv (deriv F) T − deriv F T/(T−1). The assembly needs to PROVIDE hψ : ∀ T ≥ √20+1, deriv (deriv FAlt) T − deriv FAlt T/(T−1) < 0. I can prove this directly:
```
theorem FAlt_psi_neg (T : ℝ) (hT : Real.sqrt 20 + 1 ≤ T) :
deriv (deriv FAlt) T - deriv FAlt T / (T - 1) < 0
```
via deriv2_of_hasDerivAt_nhds with explicit D1/D2 (giving deriv FAlt T = D1 T and deriv (deriv FAlt) T = D2 T), then the closed-form sign argument grouping into the three negative brackets. The D1/D2 HasDerivAt proofs: build from per-piece hasDerivAt lemmas (which I need for the block formulas anyway):
- hasDerivAt_A : HasDerivAt (fun t => t * Real.log t) (Real.log x + 1) x (x > 0)
- hasDerivAt_A1 : HasDerivAt (fun t => Real.log t + 1) x⁻¹ x — D2 of A
- hasDerivAt_B : HasDerivAt Real.log x⁻¹ x (x ≠ 0)
- hasDerivAt_B1 : HasDerivAt (fun t => t⁻¹) (-1/x²) x — D2 of B
- hasDerivAt_C : HasDerivAt (fun t => log (log t)) ((log x)⁻¹ * x⁻¹) x (x > 1)
- hasDerivAt_C1 : HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) (-(log x + 1)/((x * log x)²)) x — D2 of C
Then:
D1F x := (1/(2π))*(log x + 1) + 0.137*x⁻¹ + 0.443*((log x)⁻¹*x⁻¹) [+ 0 for const]
hD1 : ∀ᶠ x ∈ 𝓝 T, HasDerivAt FAlt (D1F x) x — from (hasDerivAt_A).const_mul (1/(2π)) |>.add ((hasDerivAt_B).const_mul 0.137) |>.add ... |>.add (hasDerivAt_const x K), with convert/field_simp to match the exact D1F form. Hmm — const_mul: HasDerivAt (fun t => c * f t) (c * f') — the assembled function: fun t => c₁*(t*log t) + c₂*log t + ... — matches FAlt's body ✓ (after unfold FAlt). Derivative value: c₁*(log x+1) + c₂*x⁻¹ + c₃*((log x)⁻¹*x⁻¹) + 0 ✓ defeq/ring to D1F x.
D2F := (1/(2π))*T⁻¹ + 0.137*(-1/T²) + 0.443*(-(log T + 1)/((T*log T)²))
hD2 : HasDerivAt D1F-as-function D2F T — from (hasDerivAt_A1).const_mul ... — D1F as function of t: fun t => c₁*(log t + 1) + c₂*t⁻¹ + c₃*((log t)⁻¹*t⁻¹): derivative c₁*T⁻¹ + c₂*(-1/T²) + c₃*(-(log T+1)/((T log T)²)) ✓.
Then deriv FAlt T = D1F T (hD1.self_of_nhds.deriv) and deriv (deriv FAlt) T = D2F (deriv2_of_hasDerivAt_nhds hD1 hD2). Sign:
ψ = D2F − D1F T/(T−1) = c₁[T⁻¹ − (log T + 1)/(T−1)] + c₂[−1/T² − (T⁻¹)/(T−1)] + c₃[−(log T+1)/((T log T)²) − ((log T)⁻¹ T⁻¹)/(T−1)]
= c₁·brA + c₂·brB + c₃·brC with brA < 0 (block #1 sign), brB < 0 (#3), brC < 0 (#4), c₁,c₂,c₃ > 0 ⟹ ψ < 0.
The equality ψ = c₁brA + c₂brB + c₃brC: field_simp [hT0.ne', hT1.ne', hlog.ne'] + ring. Then positivity of weights: c₁ = 1/(2π) > 0 (Real.pi_pos), c₂ = 0.137 > 0, c₃ = 0.443 > 0. Each bracket negative:
- brA: T⁻¹ − (log T + 1)/(T−1) < 0 — from psiOf_T_mul_log_neg? If I prove the standalone block lemmas FIRST, I can reuse their SIGN parts (not the deriv machinery) here: brA = psiOf (fun t => t*log t) T — no wait, brA is just the closed-form expression; the standalone block lemma psiOf_T_mul_log_neg proves psiOf (fun t => t*log t) T < 0 which after rw [psiOf_T_mul_log] becomes 1/T − (log T + 1)/(T−1) < 0 — exactly brA < 0 modulo T⁻¹ vs 1/T (defeq via one_div). So I can reuse: have hbrA := psiOf_T_mul_log_neg h1T — its statement: psiOf (fun t => t * Real.log t) T < 0 — and psiOf_T_mul_log T h1T : psiOf ... = 1/T − (log T + 1)/(T−1). So brA expression < 0 ✓. Similarly brB, brC. So prove the three block lemmas standalone (formula + sign), then FAlt_psi_neg uses direct HasDerivAt assembly for the deriv VALUES + reuses block SIGNS.
Total new code estimate: ~350-450 lines. Let me write it all now, append before `end NguyenRH1`, and compile iteratively.
One more piece: pos_of_convex_of_base + assembly + defs. And replacing the old sorry'd theorem.
For the assembly theorem, casts: hfinite : LiVerifiedUpTo (5*10^5) — the def: ∀ n : ℕ, 1 ≤ n → n ≤ N → 0 < (liCoeff n).re with N : ℕ := 5*10^5. In Lean: LiVerifiedUpTo (5 * 10 ^ 5) — 5*10^5 : ℕ.
hSf : SfBoundProp := ∀ n : ℕ, 80000 ≤ n → (n : ℝ) ≤ (3*10^12-1 : ℝ)^2 → |Sf n| ≤ Bn FAlt (n : ℝ).
The theorem:
```
theorem lambda_pos_finite_height
(hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5))
(hbase : 0 < marginTilde FAlt 80000) (hbase' : 0 < deriv (marginTilde FAlt) 80000)
(hSf : SfBoundProp) :
∀ n : ℕ, 1 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →
0 < (liCoeff n).re := by
intro n hn1 hnN
rcases lt_or_ge n 80000 with hlt | hge
· exact hfinite n hn1 (by omega)
· have hn20 : 20 ≤ n := by omega
have h1 := sInfty_lower_bound n hn20
have h2 := hSf n hge hnN
have h3 : (liCoeff n).re = SInfty n - Sf n + 1 := by
unfold Sf; ring
have h4 : marginTilde FAlt (n : ℝ) = sInftyLower (n : ℝ) - Bn FAlt (n : ℝ) + 1 :=
marginTilde_eq_sub FAlt n
have h5 : 0 < marginTilde FAlt (n : ℝ) := by
apply pos_of_convex_of_base (marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)
(continuousOn_marginExpanded'...) ...
```
Wait — pos_of_convex_of_base needs ContinuousOn (marginTilde FAlt) (Ici 20): from continuousOn_marginExpanded FAlt contDiffOn_FAlt via marginTilde_eq_expanded: ContinuousOn (marginExpanded FAlt) (Ici 20); marginTilde FAlt = marginExpanded FAlt (marginTilde_eq_expanded) — rw. ✓ And hdiff : ∀ y ∈ Ioi 20, DifferentiableAt ℝ (marginTilde FAlt) y: from contDiffOn_marginExpanded: ContDiffOn ℝ 2 (marginExpanded FAlt) (Ioi 20) → differentiableOn → differentiableAt (Ioi_mem_nhds). ✓
pos_of_convex_of_base application: N₀ := (80000 : ℝ), x := (n : ℝ) with 80000 ≤ n (ℕ) → (80000:ℝ) ≤ n ✓ exact_mod_cast hge. hN : 20 < 80000 norm_num. h0/h0' : hbase/hbase′ — types: marginTilde FAlt 80000 — the 80000 in hbase is ℝ literal ✓ matches N₀ := (80000:ℝ) ✓.
Then final:
```
have habs : Sf n ≤ |Sf n| := le_abs_self _
-- combine: (liCoeff n).re = SInfty n − Sf n + 1 ≥ sInftyLower n − Bn FAlt n + 1 = marginTilde FAlt n > 0
rw [h3]
-- goal: 0 < SInfty n − Sf n + 1
-- h5 + h4: 0 < sInftyLower n − Bn FAlt n + 1
linarith [h1, h2, h5, habs]
```
h4 : marginTilde FAlt ↑n = sInftyLower ↑n − Bn FAlt ↑n + 1; h5 : 0 < marginTilde FAlt ↑n; h1 : sInftyLower ↑n ≤ SInfty n; h2 : |Sf n| ≤ Bn FAlt ↑n; habs : Sf n ≤ |Sf n|. Goal: 0 < SInfty n − Sf n + 1. linarith: SInfty n − Sf n + 1 ≥ sInftyLower ↑n − Bn FAlt ↑n + 1 = marginTilde > 0 ✓ linarith should close with h4 as equation hint: linarith [h1, h2, h4, h5, habs]. ✓
hRH unused — linter warning "unused variable hRH" (not error). To keep the signature honest AND warning-free, name it `_hRH`? But the paper statement wants hRH visible... The theorem's hypothesis list IS the statement; `_hRH : RHUpTo (3*10^12)` is still visible in the signature, just marked intentionally-unused. Hmm — but then PrintAxioms/journal can note "hRH enters through SfBoundProp's eventual proof". Actually NO WAIT. Think again: is hRH really unused in the final intended theorem? The intended final theorem (tier ii complete) would prove SfBoundProp from hRH + Trudgian perimeter + M₀ etc. So in the FINAL assembled form, hRH IS used (to prove hSf). In the CURRENT assembly-first stage, hSf is a hypothesis and hRH is idle. Options: (a) keep `_hRH` with a comment; (b) keep hRH and accept the unusedVariable linter warning (file already tolerates warnings). I'll use `_hRH` with a doc comment explaining it documents the bridge input consumed by SfBoundProp's eventual proof. Hmm — actually, wait: is that true? Does the eventual SfBoundProp proof use RHUpTo? YES — D-037 §6 bridge: zeros |γ| ≤ T on the line ⟹ |ρ/(ρ−1)|ⁿ = 1 ⟹ each term ≤ 2. Without RH-to-T₀, B(n) doesn't bound |S_f|. So hRH is consumed by SfBoundProp's proof. Document exactly that. ✓
hbase/hbase′: interim hypotheses (12.2 will discharge). The aux name: keep the name lambda_pos_finite_height for the theorem WITH hbase/hbase′? After 12.2 they get discharged and the signature shrinks to (hRH)(hfinite)(hSf). Plan: this session's milestone 1 = theorem with 5 hypotheses compiling; milestone 2 = discharge hbase/hbase′. Name the final one lambda_pos_finite_height; if 12.2 spills, the interim version keeps the name with hbase/hbase′ and a TODO note. OK.
pos_of_convex_of_base statement — generalize over the domain constant? Keep it specific to Ici 20 to match marginTilde_convex... Actually make it general over (a : ℝ) with N₀ > a: cleaner and no extra cost:
```
theorem pos_of_convex_of_base {f : ℝ → ℝ} {a N₀ x : ℝ}
(hconv : ConvexOn ℝ (Set.Ici a) f)
(hdiff : ∀ y : ℝ, y ∈ Set.Ioi a → DifferentiableAt ℝ f y)
(hN : a < N₀) (hx : N₀ ≤ x) (h0 : 0 < f N₀) (h0' : 0 < deriv f N₀) :
0 < f x := by
rcases eq_or_lt_of_le hx with heq | hlt
· rw [← heq]; exact h0
· -- MVT on [N₀, x]
have hN20 : a < N₀ := hN
have hfc : ContinuousOn f (Set.Icc N₀ x) := by
-- differentiable on Ioi a ⊇ Icc N₀ x ⟹ continuous there
apply DifferentiableOn.continuousOn
intro y hy
have hya : a < y := by
have : N₀ ≤ y := hy.1
linarith
exact (hdiff y hya).differentiableWithinAt
have hfd : DifferentiableOn ℝ f (Set.Ioo N₀ x) := by
intro y hy
have hya : a < y := by have := hy.1; linarith
exact (hdiff y hya).differentiableWithinAt
obtain ⟨ξ, hξ, hξeq⟩ := exists_deriv_eq_slope f hlt hfc hfd
-- monotonicity of deriv on Ici N₀
have hconv' : ConvexOn ℝ (Set.Ici N₀) f :=
hconv.mono (Set.Ici_subset_Ici.mpr (le_of_lt hN))
have hfd' : ∀ y : ℝ, y ∈ Set.Ici N₀ → DifferentiableAt ℝ f y := by
intro y hy
have : a < y := by have : N₀ ≤ y := hy; linarith
exact hdiff y this
have hmono := hconv'.monotoneOn_deriv hfd' (Set.mem_Ici.mpr (le_refl N₀))
(Set.mem_Ici.mpr (le_of_lt hξ.1)) (le_of_lt hξ.1)
-- hξeq : deriv f ξ = (f x − f N₀)/(x − N₀)
have hpos : (0 : ℝ) < x - N₀ := sub_pos.mpr hlt
have hkey : (0 : ℝ) < (f x - f N₀) / (x - N₀) := hξeq ▸ lt_of_lt_of_le h0' hmono
have := (div_pos_iff_of_pos_right hpos).mp hkey
linarith
```
Wait hξeq : deriv f ξ = (f x − f N₀)/(x − N₀); hmono : deriv f N₀ ≤ deriv f ξ; so (f x − f N₀)/(x−N₀) = deriv f ξ ≥ deriv f N₀ > 0 ✓. hξeq ▸ ... : hξeq ▸ rewrites goal... `hξeq ▸ lt_of_lt_of_le h0' hmono` : lt_of_lt_of_le h0' hmono : 0 < deriv f ξ; ▸ hξeq rewrites deriv f ξ → (f x − f N₀)/(x − N₀): gives 0 < (f x − f N₀)/(x−N₀) ✓. Then div_pos_iff_of_pos_right... Mathlib: `div_pos_iff_of_pos_right (hb : 0 < b) : 0 < a / b ↔ 0 < a` ✓. So f x − f N₀ > 0 ⟹ f x > f N₀ > 0 ✓ linarith [h0].
Details: eq_or_lt_of_le hx : x = N₀ ∨ N₀ < x — first case x = N₀: `rw [← heq]`? heq : x = N₀; goal 0 < f x; rw [← heq] changes goal to 0 < f N₀? ← heq rewrites N₀ → x... hmm: heq : x = N₀; ← heq rewrites occurrences of N₀ with x. Goal has f x — rw [heq] changes x to N₀: goal 0 < f N₀ = h0 ✓. Use `rw [heq]; exact h0`.
Also `exists_deriv_eq_slope f hlt hfc hfd` — binders (f) (hab) (hfc) then hfd? From the source: variable line shows (f f') {a b} (hab) (hfc) and presumably (hfd : DifferentiableOn ℝ f (Ioo a b)) on the next variable line. exists_deriv_eq_slope's `include hab hfc hfd` — so explicit args: f, hab, hfc, hfd ✓.
DifferentiableOn def: ∀ x ∈ s, DifferentiableWithinAt ℝ f s x. My hfc: `apply DifferentiableOn.continuousOn; intro y hy; exact (hdiff y hya).differentiableWithinAt` — DifferentiableAt.differentiableWithinAt ✓.
hconv'.monotoneOn_deriv hfd' : MonotoneOn (deriv f) (Ici N₀); applied to (hN₀ : N₀ ∈ Ici N₀) (hξmem : ξ ∈ Ici N₀) (hle : N₀ ≤ ξ) ✓.
Set.Ici_subset_Ici.mpr : a ≤ b → Ici b ⊆ Ici a. Ici N₀ ⊆ Ici a needs a ≤ N₀ ✓ le_of_lt hN. hconv.mono : ConvexOn ℝ s f → t ⊆ s → ConvexOn ℝ t f — signature: ConvexOn.mono (h : s ⊆ t)?? `ConvexOn.mono (hfc : ConvexOn ℝ s f) (h : t ⊆ s) : ConvexOn ℝ t f`? Actually protected theorem ConvexOn.mono (hf : ConvexOn ℝ s f) (ht : t ⊆ s) : ConvexOn ℝ t f — hmm argument order: hf.mono ht. ✓
OK. Now also the OLD theorem replacement. Old:
```
/-- [SKELETON] R-004, the finite-height Li theorem (draft Thm 3.1): ... -/
theorem lambda_pos_finite_height
(hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5)) :
∀ n : ℕ, 1 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →
0 < (liCoeff n).re := by
sorry
```
Replace with a forward-reference comment (the real one goes at file end). Delete the sorry'd theorem, and put a comment in §1 pointing to the end-of-file assembly.
Also update file header docstring (stage note: tier ii step 1 assembled).
Let me now write all the new code. I'll append before `end NguyenRH1`. Note the file ends:
```
linarith [hIIM, hnn1, ...]
end NguyenRH1
end
```
The final `end` closes noncomputable section.
Also — check: ` deriv (marginTilde FAlt) 80000` in hbase′: deriv of marginTilde FAlt at the real 80000. For 12.2 discharge I'll need deriv of marginExpanded pieces... later.
Also should I keep hbase/hbase′ as reals `(80000 : ℝ)`. ✓
Writing the code now. One concern about `psiOf_T_mul_log` D1: `(hasDerivAt_id' x).mul (Real.hasDerivAt_log hx)` gives HasDerivAt (fun t => t * Real.log t) (1 * log x + x * x⁻¹) — the mul rule: HasDerivAt (f*g) (f' * g x + f x * g')? Mathlib HasDerivAt.mul : HasDerivAt (fun x => f x * g x) (f' * g x + f x * g')?? Actually: (hf.mul hg) : HasDerivAt (fun x => f x * g x) (f' * g x + f x * g') x. With f = id, f' = 1: 1 * Real.log x + x * x⁻¹. rwa [one_mul, mul_inv_cancel₀ hx] at h — gives Real.log x + 1 ✓.
Hmm wait, in psiOf_T_mul_log_shift they did exactly: `have h := (hasDerivAt_id' x).mul (hasDerivAt_log_shift x ...); rwa [one_mul] at h` — the shift version's log-shift derivative is (x+2)⁻¹ and x*(x+2)⁻¹ stays as is (no cancellation). For unshifted I need mul_inv_cancel₀. Fine.
For hasDerivAt_B1 (deriv of t⁻¹): (hasDerivAt_id' T).inv (ne_of_gt hT0): HasDerivAt (fun t => (id t)⁻¹) (-(1)/(id T)^2)? inv rule: -f'/(f x)^2 = -1/T^2. Function: (id t)⁻¹ vs t⁻¹ — defeq. The result type HasDerivAt (fun t => t⁻¹) (-1/T^2) — hmm -(1)/T^2 displays as -1/T^2? -1/T^2 = -(1/T^2)... the inv rule gives -(f')/(f x)^2 = -1/T^2 which is (-1)/T^2 = -(1/T^2) — all defeq by ring but for `exact h` defeq suffices ✓ (these are just different but defeq terms: -1/T^2 elaborates as Neg (HDiv 1 (T^2))? and -f'/f x ^2 = Neg (HDiv 1 ...) — with f' = 1: -(1/T^2) ✓ same). Should be fine; add `rwa` patterns from the file if needed.
hasDerivAt_C: hout.comp T hin where hin : HasDerivAt Real.log T⁻¹ T, hout : HasDerivAt Real.log (Real.log T)⁻¹ (Real.log T). comp: HasDerivAt (Real.log ∘ Real.log) ((Real.log T)⁻¹ * T⁻¹)? Chain rule: HasDerivAt.comp : HasDerivAt g (g') (f x) → HasDerivAt f f' x → HasDerivAt (g ∘ f) (g' * f') x. So hout.comp T hin : HasDerivAt (Real.log ∘ Real.log) ((Real.log T)⁻¹ * T⁻¹) T ✓. Function Real.log ∘ Real.log vs fun t => Real.log (Real.log t) — defeq ✓ (use show or exact; the shifted version psiOf_log_log_shift used exactly this pattern with hasDerivAt_log_shift and it worked: `exact hout.comp x hin` where target was HasDerivAt (fun t => Real.log (Real.log (t + 2))) ... ✓).
hasDerivAt_C1: D2 of C: (fun t => (log t)⁻¹ * t⁻¹): hu.mul hv where hu : HasDerivAt (fun t => (Real.log t)⁻¹) (-T⁻¹/(Real.log T)^2) T := hin.inv (ne_of_gt hlog) — inv rule: -f'/f^2 = -(T⁻¹)/(log T)^2 ✓. hv := hasDerivAt_B1. hu.mul hv : HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) ((-T⁻¹/(log T)^2) * T⁻¹ + (log T)⁻¹ * (-1/T^2)) T. Convert to -(log T + 1)/((T * log T)^2): field_simp [hT0.ne', hlog.ne'] + ring — the shifted version did:
```
have e : (-(T + 2)⁻¹ / Real.log (T + 2) ^ 2) * (T + 2)⁻¹ + (Real.log (T + 2))⁻¹ * (-1 / (T + 2) ^ 2) = -(Real.log (T + 2) + 1) / ((T + 2) * Real.log (T + 2)) ^ 2 := by field_simp [...]; ring
rwa [e] at h
```
✓ same pattern.
Then the psiOf block formula theorems via deriv2_of_hasDerivAt_nhds.
Let me also double check deriv2_of_hasDerivAt_nhds needs h1 : ∀ᶠ x in 𝓝 T, HasDerivAt φ (D1 x) x — ✓ built via filter_upwards [eventually_gt_nhds ...].
Now — marginTilde_eq_sub: marginTilde has `let T := Real.sqrt n + 1` then body. simp only [marginTilde, Bn, sInftyLower]: unfolds defs incl. let? `simp only [marginTilde]` unfolds the def including the let (zeta reduction in dsimp). The existing marginTilde_eq_expanded did `simp only [marginTilde, marginExpanded, ...]` then ring ✓ precedent. Bn also has let T. Should be fine.
Now write everything. Also the hdiff argument for the assembly:
```
have hdiffM : ∀ y : ℝ, y ∈ Set.Ioi 20 → DifferentiableAt ℝ (marginTilde FAlt) y := by
intro y hy
rw [marginTilde_eq_expanded FAlt]
exact ((contDiffOn_marginExpanded FAlt contDiffOn_FAlt).differentiableOn (by norm_num)).differentiableAt (Ioi_mem_nhds hy)
```
And hcontM : ContinuousOn (marginTilde FAlt) (Ici 20): not needed by pos_of_convex_of_base as I designed it (hfc derived from hdiff). ✓ drop hcont.
pos_of_convex_of_base args order: (hconv)(hdiff)(hN)(hx)(h0)(h0') with {f a N₀ x} implicit — apply with named: pos_of_convex_of_base hconv hdiffM (by norm_num) hx hbase hbase' — f, a, N₀, x inferred from hconv (ConvexOn ℝ (Ici 20) (marginTilde FAlt)) and hbase (0 < marginTilde FAlt 80000) and hx ((80000:ℝ) ≤ ↑n). a = 20, N₀ = 80000 ✓ unification from hconv/hbase/hx types. hx : (80000:ℝ) ≤ (n:ℝ) — I provide. hN : (20:ℝ) < 80000 — norm_num ✓. Should unify.
One risk: pos_of_convex_of_base's implicit {a N₀ x} with hconv : ConvexOn ℝ (Set.Ici a) f etc. — apply order. I'll write it as a direct term/tactic proof in the assembly:
```
have h5 : 0 < marginTilde FAlt (n : ℝ) :=
pos_of_convex_of_base
(marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)
hdiffM (by norm_num) (by exact_mod_cast hge) hbase hbase'
```
hge : 80000 ≤ n (ℕ); need (80000 : ℝ) ≤ (n : ℝ): exact_mod_cast hge ✓.
marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg : needs FAlt_psi_neg : ∀ T : ℝ, Real.sqrt 20 + 1 ≤ T → deriv (deriv FAlt) T − deriv FAlt T/(T−1) < 0 ✓ matches hψ shape.
Also marginTilde_convex's hF : ContDiffOn ℝ 2 F (Set.Ioi 1) := contDiffOn_FAlt ✓.
Now — realize one more potential issue: marginTilde_convex's proof uses hF only via contDiffOn_mFblock F hF and hCDFc and vF — all now ContDiffOn-based ✓ already refactored above.
Write the code block now. Also replace the old sorry theorem. Let me do it in pieces: first replace old theorem, then append new section.
Refactor compiles green (only the expected `sorry` warning on line 55). Now replacing the old skeleton theorem with a forward pointer, then appending the assembly machinery.
tool: Edit
input
{
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiSkeleton.lean",
"old_string": "/-- [SKELETON] R-004, the finite-height Li theorem (draft Thm 3.1):\nassuming RH verified to T\u2080 = 3\u00d710\u00b9\u00b2 and finite Li verification to\n5\u00d710\u2075, \u03bb_n > 0 for all n \u2264 (T\u2080\u22121)\u00b2 \u2248 9.0\u00d710\u00b2\u2074.\nProof content to formalize: D-037 assembly (archimedean lower bound +\ntraced contour bound + bridge + margin argument). -/\ntheorem lambda_pos_finite_height\n (hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5)) :\n \u2200 n : \u2115, 1 \u2264 n \u2192 (n : \u211d) \u2264 (3 * 10 ^ 12 - 1 : \u211d) ^ 2 \u2192\n 0 < (liCoeff n).re := by\n sorry",
"new_string": "/-- [PROVED session 012, tier (ii) step 1 \u2014 assembly modulo the named\nanalytic hypothesis] R-004, the finite-height Li theorem (draft Thm 3.1).\nThe full statement and proof are at the END of this file (\u00a74), after the\nmargin machinery they depend on: `lambda_pos_finite_height` there is\nproved from `SfBoundProp` (the single named analytic hypothesis, D-062\ntriage) + the computational perimeter (Platt\u2013Trudgian `RHUpTo`,\n`LiVerifiedUpTo`) + two elementary base-point evaluations. -/"
}
raw content_json (database row)
[{"type":"thinking","thinking":"Refactor compiles green (only the expected sorry warning on lambda_pos_finite_height at line 55). The marginTilde_convex now takes ContDiffOn ℝ 2 F (Set.Ioi 1), no hmaj.\n\nNow add the new sections. I'll insert after the end of marginTilde_convex (before `end NguyenRH1`). Content:\n\n1. FAlt, Bn, Sf, SfBoundProp defs + marginTilde_eq_sub\n2. ψ-block lemmas for FAlt blocks + psiOf_add/const_mul + psiOf_FAlt_neg + contDiffOn_FAlt\n3. pos_of_convex_of_base\n4. lambda_pos_finite_height assembly (replacing the old sorry'd statement — with hbase/hbase′ interim)\n\nWait — the old lambda_pos_finite_height (line 55, with sorry) needs to be REPLACED by the new assembly. I'll replace it with the new full version. Where to place the new machinery: the old theorem is at line ~55 in section 1; the machinery (marginTilde etc.) is later. I'll keep the file structure: replace the old theorem's `sorry` with... no — the assembly needs marginTilde_convex which comes later in the file. So: move the theorem — replace the old skeleton theorem with a comment pointer, and put the real assembly at the end. Actually cleaner: DELETE the old sorry'd theorem from section 1 and add the new one at the end with all the machinery. But the old theorem statement is referenced in PrintAxioms (name only ✓) and the file header. Fine.\n\nLet me write the new code. Key pieces:\n\n```lean\n/-! ## 4. The assembly (session 012, tier (ii) step 1): the finite-height\nLi theorem modulo the single named analytic hypothesis `SfBoundProp`. -/\n\n/-- The explicit Trudgian-shape zero-count majorant used in the assembly\n(session 012 design, D-057 §2 rows #1–#4):\nFAlt(T) = (1/2π)·T·log T + 0.137·log T + 0.443·log log T + (7/8 + 1.588).\nThis is the Trudgian 2014 majorant F(T) + S_b(T) with the negative-weight\n−(log 2πe/2π)·T term DROPPED (FAlt ≥ F + S_b pointwise: the dropped term\nis ≥ 0 for T ≥ 1), so any N(T) ≤ F + S_b bound upgrades to N(T) ≤ FAlt;\nall four surviving blocks have provably negative ψ (D-057 rows #1/#3/#4),\nwhich the true F + S_b does NOT (its ψ crosses positive on [5.47, ~16]).\nThe margin cost of the swap is (log 2πe/2π)·2T ≈ 0.9√n, negligible against\nmargiñ(8×10⁴) ≈ 1.6×10⁴ (E-028). -/\ndef FAlt (T : ℝ) : ℝ :=\n (1 / (2 * Real.pi)) * (T * Real.log T) + 0.137 * Real.log T +\n 0.443 * Real.log (Real.log T) + (7 / 8 + 1.588)\n```\n\nWait — hmm, one important check: \"FAlt ≥ F + S_b pointwise\" — F(T)+S_b(T) = (T/2π)log(T/2πe) + 7/8 + S_b(T) = (1/2π)T log T − (log 2πe/2π)T + 7/8 + S_b(T). FAlt − (F+S_b) = (log 2πe/2π)·T ≥ 0 for T ≥ 0 ✓. Good. (For T < 0 junk — irrelevant.)\n\n```lean\n/-- The explicit finite-part bound B(n) (D-037 (4.1), constants A = 10.5,\nB₀ = 48 from D-056; Ĉ₀/Ĥ closed forms; M₀ = 1.3352; I_I majorant IIMaj),\nwritten with the zero-count majorant F as a parameter:\nB(n) = 2F(T) + 4T[(2/3)Ĉ₀(T) + 10.5 log(T+2) + 48] + 40·1.3352\n + 2(e⁴+1)[7Ĥ(T) + 3.3] + IIMaj(n) + 1, T = √n + 1. -/\ndef Bn (F : ℝ → ℝ) (n : ℝ) : ℝ :=\n let T := Real.sqrt n + 1\n 2 * F T + 4 * T * ((2 / 3) * C0hat T + 10.5 * Real.log (T + 2) + 48) +\n 40 * 1.3352 + 2 * (Real.exp 4 + 1) * (7 * Hhat T + 3.3) + IIMaj n + 1\n\n/-- marginTilde IS sInftyLower − Bn + 1 (definitional bookkeeping). -/\ntheorem marginTilde_eq_sub (F : ℝ → ℝ) (n : ℝ) :\n marginTilde F n = sInftyLower n - Bn F n + 1 := by\n simp only [marginTilde, Bn, sInftyLower]\n ring\n\n/-- The finite part S_f(n) of the Bombieri–Lagarias decomposition\nλ_n = S_∞(n) − S_f(n) + 1 (BL 1999 Thm 2, D-037 P1), here DEFINED by the\nidentity (so the identity holds by construction); the analytic content —\nthat this prime-side quantity satisfies the contour bound B(n) — is\nisolated in `SfBoundProp` below. -/\ndef Sf (n : ℕ) : ℝ := SInfty n + 1 - (liCoeff n).re\n\n/-- ⭐ THE named analytic hypothesis of tier (ii) (session-012 design,\nsession-012-notes.txt step 1): the finite part is bounded by the explicit\ntraced B(n) on the whole margin range N₀ = 8×10⁴ ≤ n ≤ N₁ = (T₀−1)².\nProof content (triage in D-062): the D-036/D-056 contour estimate —\nkernel bounds + R-bound (Mathlib-tractable complex analysis), Trudgian\n2014 N(T)/S(T) (trusted-perimeter literature), the bridge via\nRHUpTo T₀ (perimeter), M₀ (E-023 grid / E-023b acb). -/\ndef SfBoundProp : Prop :=\n ∀ n : ℕ, 80000 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →\n |Sf n| ≤ Bn FAlt n\n```\n\nThen the ψ machinery. First psiOf_add, psiOf_const_mul, psiOf_const:\n\n```lean\n/-- ψ is additive (given the deriv²-splitting regularity). -/\ntheorem psiOf_add {f g : ℝ → ℝ} {T : ℝ}\n (hf1 : DifferentiableAt ℝ (deriv f) T) (hg1 : DifferentiableAt ℝ (deriv g) T)\n (hf2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ f m)\n (hg2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ g m) :\n psiOf (fun x => f x + g x) T = psiOf f T + psiOf g T := by\n unfold psiOf\n rw [deriv2_add hf1 hg1 hf2 hg2,\n deriv_add hf2.self_of_nhds hg2.self_of_nhds]\n ring\n\n/-- ψ commutes with constant multiplication. -/\ntheorem psiOf_const_mul {f : ℝ → ℝ} {T : ℝ} (c : ℝ)\n (hf1 : DifferentiableAt ℝ (deriv f) T)\n (hf2 : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ f m) :\n psiOf (fun x => c * f x) T = c * psiOf f T := by\n unfold psiOf\n rw [deriv2_const_mul c hf1 hf2, deriv_const_mul c hf2.self_of_nhds]\n ring\n\n/-- ψ of a constant function is 0. -/\ntheorem psiOf_const (K T : ℝ) : psiOf (fun _ => K) T = 0 := by\n unfold psiOf\n rw [deriv2_const_val, deriv_const]\n ring\n```\n\nWait deriv_const: `deriv (fun _ => K) T = 0` — Mathlib: `deriv_const (c : ℝ) (x : ℝ) : deriv (fun _ => c) x = 0`? There's `deriv_const (c : α) : deriv (fun _ => c) = 0`... I think `deriv_const (c) (x)`? Let me check: Mathlib has `deriv_const (c : F) : deriv (fun _ => c) = 0`? Hmm, in current Mathlib: `theorem deriv_const (c : F) : deriv (fun _ => c) = 0` — funext version? There's also `deriv_const (c : ℝ) (x : ℝ)`? I'll write `simp` fallback: `rw [deriv2_const_val, deriv_const]` then fix at compile. Actually safer: `have : deriv (fun _ : ℝ => K) T = 0 := by simp` — hmm. deriv_const in Mathlib (Analysis.Calculus.Deriv.Basic): `theorem deriv_const (c : F) : deriv (fun _ => c) = 0` — as a function equation; so `deriv (fun _ => K) T = 0` follows by rw [deriv_const] then... `deriv_const K : deriv (fun _ => K) = fun _ => 0`? then `rw [deriv_const K]`; goal 0 - 0/(T-1) = 0... After `rw [deriv2_const_val]`: goal `0 - deriv (fun _ => K) T / (T-1) = 0`. Then `rw [deriv_const]`: if deriv_const is the funext form, `rw [deriv_const K]` rewrites deriv (fun _ => K) to fun _ => 0, then the application... `simp` is simplest: `simp [deriv2_const_val, deriv_const]`? Let me just write:\n```\ntheorem psiOf_const (K T : ℝ) : psiOf (fun _ => K) T = 0 := by\n unfold psiOf\n rw [deriv2_const_val]\n simp\n```\nderiv_const is a simp lemma? `deriv_const` is marked simp I believe. After rw deriv2_const_val: goal `0 - deriv (fun _ => K) T / (T - 1) = 0`; simp should rewrite deriv_const to 0 and close. OK.\n\nBlocks:\n\n```lean\n/-- [PROVED session 012] Block A (T·log T, D-057 row #1): ψ-formula. -/\ntheorem psiOf_T_mul_log (T : ℝ) (hT : 1 < T) :\n psiOf (fun t => t * Real.log t) T = 1 / T - (Real.log T + 1) / (T - 1) := by\n have hT0 : (0 : ℝ) < T := by linarith\n have h1 : ∀ᶠ x in 𝓝 T, HasDerivAt (fun t => t * Real.log t) (Real.log x + 1) x := by\n filter_upwards [eventually_gt_nhds hT0] with x hx\n have h := (hasDerivAt_id' x).mul (Real.hasDerivAt_log (ne_of_gt hx))\n rwa [one_mul, mul_inv_cancel₀ (ne_of_gt hx)] at h\n have h2 : HasDerivAt (fun t => Real.log t + 1) T⁻¹ T :=\n (Real.hasDerivAt_log (ne_of_gt hT0)).add_const 1\n have hd2 := deriv2_of_hasDerivAt_nhds h1 h2\n have hd1 : deriv (fun t => t * Real.log t) T = Real.log T + 1 := h1.self_of_nhds.deriv\n unfold psiOf\n rw [hd2, hd1]\n```\n\nHmm wait: HasDerivAt (fun t => t * log t) ... gives derivative `1 * log T + T * T⁻¹`. `mul_inv_cancel₀`: T * T⁻¹ = 1 ✓ so derivative value = log T + 1 ✓ rwa [one_mul, mul_inv_cancel₀]. ✓ And h2: deriv of (log t + 1) is 1/t = T⁻¹: Real.hasDerivAt_log gives HasDerivAt Real.log T⁻¹ T ✓ .add_const 1: HasDerivAt (fun t => log t + 1) (T⁻¹ + 0)? add_const adds const to FUNCTION, derivative unchanged: HasDerivAt (fun x => f x + c) (f') — `HasDerivAt.add_const : HasDerivAt f f' x → HasDerivAt (fun x => f x + c) f' x` ✓. But careful — session-011 gotcha: \"HasDerivAt.add_const adds to VALUE (use .comp for precomposition)\" — (Real.hasDerivAt_log ...).add_const 1 : HasDerivAt (fun t => Real.log t + 1) T⁻¹ T ✓ correct usage here (value shift).\n\nThen sign:\n```lean\n/-- Block A sign: ψ < 0 for T > 1 (⟺ −1 < T log T). -/\ntheorem psiOf_T_mul_log_neg {T : ℝ} (hT : 1 < T) :\n psiOf (fun t => t * Real.log t) T < 0 := by\n rw [psiOf_T_mul_log T hT]\n have hT0 : (0 : ℝ) < T := by linarith\n have hT1 : (0 : ℝ) < T - 1 := by linarith\n have hlog : (0 : ℝ) < Real.log T := Real.log_pos hT\n -- 1/T < (log T + 1)/(T−1) ⟺ T−1 < T(log T + 1) ⟺ −1 < T log T\n rw [div_lt_div_iff₀ hT0 hT1] -- 1·(T−1) < (log T + 1)·T\n nlinarith [mul_pos hT0 hlog]\n```\ndiv_lt_div_iff₀ (ha : 0 < a) (hb : 0 < b) : c/a < d/b ↔ c*b < d*a. So 1/T − ... wait the goal is `1/T − (log T+1)/(T−1) < 0` — that's a difference, not a single div comparison. Better: show `1/T < (log T + 1)/(T−1)` then linarith. \n```\n have key : (1 : ℝ)/T < (Real.log T + 1)/(T - 1) := by\n rw [div_lt_div_iff₀ hT0 hT1]\n nlinarith [mul_pos hT0 hlog]\n -- goal: 1/T − (log T+1)/(T−1) < 0\n linarith\n```\nnlinarith: goal after rw: 1*(T−1) < (log T + 1)*T ⟺ T − 1 < T log T + T ⟺ −1 < T log T ✓ from mul_pos hT0 hlog : 0 < T * log T. nlinarith should close: T−1 < (log T + 1)*T. Provide hint [mul_pos hT0 hlog]. ✓\n\nBlock B (log T):\n```lean\ntheorem psiOf_log (T : ℝ) (hT : 0 < T) :\n psiOf Real.log T = -1 / T ^ 2 - 1 / (T * (T - 1)) := by\n have h1 : ∀ᶠ x in 𝓝 T, HasDerivAt Real.log x⁻¹ x := by\n filter_upwards [eventually_ne_nhds (ne_of_gt hT)] with x hx\n exact Real.hasDerivAt_log hx\n have h2 : HasDerivAt (fun t => t⁻¹) (-1 / T^2) T := ...\n```\nHmm — HasDerivAt (fun t => t⁻¹) (-(T^2)⁻¹)? Mathlib: HasDerivAt.inv: (hasDerivAt_id' T).inv (ne_of_gt hT) gives HasDerivAt (fun t => t⁻¹) (-(T^2)⁻¹)? The derivative of x⁻¹ is -(x²)⁻¹. In psiOf_log_shift they did: ((hasDerivAt_id' T).add_const 2).inv h gives -1/(T+2)^2 form via ring-normalizing `-(1:ℝ)/(T+2)^2 = -1/(T+2)^2`. For unshifted: (hasDerivAt_id' T).inv (ne_of_gt hT) : HasDerivAt (fun t => (id t)⁻¹) (-(T^2)⁻¹)... the file's pattern: \n```\nhave h := ((hasDerivAt_id' T).add_const 2).inv (by linarith : (T + 2) ≠ 0)\nhave e : (-(1 : ℝ)) / (T + 2) ^ 2 = -1 / (T + 2) ^ 2 := by ring\nrwa [e] at h\n```\nSo for unshifted: h := (hasDerivAt_id' T).inv (ne_of_gt hT) : HasDerivAt (fun t => (id t)⁻¹) (-1/T^2)? The inv rule: HasDerivAt f f' x → HasDerivAt (fun x => (f x)⁻¹) (-f'/f x ^2) x given f x ≠ 0. So derivative value: -(1)/T^2 = -1/T^2 ✓ and function fun t => (id t)⁻¹ = fun t => t⁻¹ ✓ (id t = t). The pattern `rwa [e] at h` with e : -(1:ℝ)/T^2 = -1/T^2 by ring — actually -1/T^2 is already -(1)/T^2? -(1)/T^2 parses as (-1)/T^2 = -1/T^2 ✓ defeq; might not even need the ring step. I'll write:\n```\n have h2 : HasDerivAt (fun t : ℝ => t⁻¹) (-1 / T ^ 2) T := by\n have h := (hasDerivAt_id' T).inv (ne_of_gt hT)\n rwa [one_div] at h -- hmm\n```\nHasDerivAt.inv statement: `HasDerivAt.inv (hf : HasDerivAt f f' x) (hx : f x ≠ 0) : HasDerivAt (fun x => (f x)⁻¹) (-f' / (f x)^2) x`. With f = id: f' = 1: derivative -1/(id T)^2 = -1/T^2. id T = T. So h : HasDerivAt (fun x => (id x)⁻¹) (-1/T^2) T. Goal function (fun t => t⁻¹) vs (fun x => (id x)⁻¹): (id x)⁻¹ = x⁻¹ ✓ defeq (id x unfolds). And -1/(id T)^2 — id T is defeq T but maybe not syntactically. Just use `exact h` and if defeq works it's fine — -1/(id T)^2: id T reduces to T definitionally ✓. Should be fine with `exact h` or `rwa`.\n\nThen ψ[log] = -1/T² - (T⁻¹)/(T-1) = -1/T² - 1/(T(T-1)): field_simp [hT.ne', hT1.ne'].\n```\n have hd2 := deriv2_of_hasDerivAt_nhds h1 h2\n have hd1 : deriv Real.log T = T⁻¹ := h1.self_of_nhds.deriv\n unfold psiOf\n rw [hd2, hd1]\n have hT1 : (T - 1) ≠ 0 := ...\n field_simp [ne_of_gt hT, hT1]\n```\nWait psiOf_log needs hT : 0 < T for formula but the T−1 denominator: -1/(T(T-1)) — the formula as stated needs T ≠ 1 for the VALUE to be meaningful, but deriv value (log T+... the formula 1/(T(T−1)) has T−1 in it. psiOf φ T = deriv(deriv φ) T − deriv φ T/(T−1) is defined for all T (junk at T = 1). For the formula statement, require 0 < T and T ≠ 1? We apply at T ≥ √20+1 so T > 1. State with hT : 1 < T to keep it clean (matches other blocks).\n\nψ[log] formula: -1/T^2 - (T⁻¹)/(T-1). After field_simp: -1/T² − 1/(T(T−1)) — need to show deriv(deriv log) T − deriv log T/(T−1) = -1/T² − 1/(T(T−1)): LHS = -1/T² − T⁻¹/(T−1). field_simp [hT0.ne', hT1.ne'] then ring. In psiOf_log_shift they ended with just `field_simp [hT1, hT2']` (no ring) — \"field_simp often closes goals (trailing ring errors)\" per gotchas. So: field_simp [hT0.ne', hT1.ne'] — may close directly. I'll add `<;> ring` fallback... can't have both; write `field_simp [...]` then `ring` — if field_simp closes, ring errors \"no goals\". Session-011 gotcha says field_simp often closes goals (trailing ring errors) — meaning they dropped the trailing ring. I'll write field_simp only, fix if needed.\n\nSign: ψ[log] < 0 for T > 1: both terms negative:\n```\ntheorem psiOf_log_neg {T : ℝ} (hT : 1 < T) : psiOf Real.log T < 0 := by\n rw [psiOf_log T hT]\n have h1 : (0:ℝ) < 1/T^2 := one_div_pos.mpr (pow_pos (by linarith) 2)\n have h2 : (0:ℝ) < 1/(T*(T-1)) := one_div_pos.mpr (mul_pos (by linarith) (by linarith))\n have e : -1/T^2 - 1/(T*(T-1)) = -(1/T^2 + 1/(T*(T-1))) := by ring\n rw [e]; linarith [add_pos h1 h2]\n```\n\nBlock C (log log T): pattern after psiOf_log_log_shift but unshifted:\n- hasDerivAt_log_log_unshifted: HasDerivAt (fun t => Real.log (Real.log t)) ((Real.log T)⁻¹ * T⁻¹) T for T > 1:\n```\nhave hin : HasDerivAt Real.log T⁻¹ T := Real.hasDerivAt_log (ne_of_gt (by linarith : 0 < T))\nhave hout : HasDerivAt Real.log (Real.log T)⁻¹ (Real.log T) := Real.hasDerivAt_log (ne_of_gt (Real.log_pos hT))\nexact hout.comp T hin\n```\n- D2: HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) (-(log T + 1)/((T * log T)^2)) T:\n hu : HasDerivAt (fun t => (log t)⁻¹) (-(T⁻¹)/ (log T)^2)? inv rule: derivative of (log t)⁻¹ = -(T⁻¹)/(log T)^2 = -1/(T (log T)^2)... form: -(T⁻¹)/(Real.log T)^2. In psiOf_log_log_shift: `hin.inv (ne_of_gt hL1)` gives HasDerivAt (fun t => (log (t+2))⁻¹) (-(T+2)⁻¹ / log(T+2)^2) T. So hu := hin.inv ... : HasDerivAt (fun t => (Real.log t)⁻¹) (-T⁻¹ / (Real.log T)^2) T ✓.\n hv : HasDerivAt (fun t => t⁻¹) (-1/T^2) T (from above).\n hu.mul hv: derivative = (-T⁻¹/(log T)^2)·T⁻¹ + (log T)⁻¹·(-1/T²). Target closed: -(log T + 1)/((T log T)^2). Check: -(log T+1)/(T²(log T)²) = -1/(T² log T) − 1/(T² (log T)²). First: (-T⁻¹/(log T)²)·T⁻¹ = -1/(T² (log T)²) ✓. Second: (log T)⁻¹·(-1/T²) = -1/(T² log T) ✓. Sum ✓. field_simp + ring as in the shifted version.\n- ψ = D2 − D1/(T−1) = -(log T+1)/((T log T)^2) − ((log T)⁻¹ T⁻¹)/(T−1) = -(log T+1)/((T·log T)^2) − 1/(T·log T·(T−1)). field_simp.\n\nSign: for T > 1: log T > 0 ⟹ both terms negative ✓ (mirror psiOf_log_log_shift_neg).\n\nNow assemble FAlt:\n\n```lean\n/-- The block decomposition of FAlt for the ψ-computation. -/\nprivate def faltA : ℝ → ℝ := fun T => T * Real.log T\nprivate def faltB : ℝ → ℝ := Real.log\nprivate def faltC : ℝ → ℝ := fun T => Real.log (Real.log T)\n```\nHmm — actually psiOf_FAlt_neg needs ψ[FAlt] where FAlt T = (1/(2π))*(T*log T) + 0.137*log T + 0.443*log(log T) + (7/8+1.588). As a λ: fun T => (1/(2*Real.pi)) * (T * Real.log T) + 0.137 * Real.log T + 0.443 * Real.log (Real.log T) + (7/8 + 1.588). psiOf_add applies to (fun x => f x + g x) — the expression `a + b + c + d` parses as ((a + b) + c) + d ✓ nested adds fine. But the pieces are (fun T => (1/(2π)) * (T * log T)) = fun T => (1/(2π)) * (faltA T)? (T * Real.log T) with T the bound var: (1/(2*Real.pi)) * (T * Real.log T) — is this `c * f x` shape with f = fun T => T * log T? Yes: c * f x with c = 1/(2π), f x = x * log x ✓ syntactically (c * (x * log x)) — the lambda body is `(1/(2π)) * (T * Real.log T)` = HMul.hMul c (f T) ✓ matches `fun x => c * f x` with f := fun T => T * Real.log T. ✓\n\nFor psiOf_const_mul/psiOf_add I need per-piece regularity:\n- For f = fun T => T * log T: DifferentiableAt ℝ (deriv f) T and ∀ᶠ m ∈ 𝓝 T, DifferentiableAt f m.\n From ContDiffOn: faltA_contDiffOn : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1)? Or even Ioi 0. Then at T > 1: hdd/hev patterns:\n ```\n have hddA : DifferentiableAt ℝ (deriv (fun t => t * Real.log t)) T :=\n ((hCDA.deriv_of_isOpen (m := 1) isOpen_Ioi (by norm_num)).differentiableOn one_ne_zero).differentiableAt (Ioi_mem_nhds hT)\n have hevA : ∀ᶠ m in 𝓝 T, DifferentiableAt ℝ (fun t => t * Real.log t) m := by\n filter_upwards [Ioi_mem_nhds hT] with m hm\n exact (hCDA.differentiableOn (by norm_num)).differentiableAt (Ioi_mem_nhds hm)\n ```\n with hCDA : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1) := contDiffOn_id.mul (contDiffOn_id.log (fun x hx => ne_of_gt (zero_lt_one.trans hx)))... wait ContDiffOn ℝ 2 id.log: `(contDiffOn_id.log (h : ∀ x ∈ s, id x ≠ 0))`: for s = Ioi 1: x > 1 ⟹ x ≠ 0 ✓.\n\nSimpler: build contDiffOn_FAlt first, and derive per-piece differentiability from per-piece ContDiffOns. I need per-piece ContDiffOn anyway? For contDiffOn_FAlt assembly:\n```\ntheorem contDiffOn_FAlt : ContDiffOn ℝ 2 FAlt (Set.Ioi 1) := by\n unfold FAlt\n exact (((contDiffOn_const.mul (contDiffOn_id.mul (contDiffOn_id.log fun x hx => ...))).add\n (contDiffOn_const.mul (contDiffOn_id.log ...))).add\n (contDiffOn_const.mul ((contDiffOn_id.log ...).log ...))).add contDiffOn_const\n```\nwhere for the log log piece: (contDiffOn_id.log h0).log h1: h0 : ∀ x ∈ Ioi 1, id x ≠ 0 (x > 1); h1 : ∀ x ∈ Ioi 1, Real.log (id x) ≠ 0 — log x ≠ 0 for x > 1: ne_of_gt (Real.log_pos hx) ✓. Note Real.log (id x) — id x = x; Real.log_pos needs 1 < x ✓.\n\nThen per-piece ContDiffOn (extract as separate lemmas so psiOf_FAlt_neg can use):\n- hCDA : ContDiffOn ℝ 2 (fun t => t * Real.log t) (Set.Ioi 1)\n- hCDB : ContDiffOn ℝ 2 Real.log (Set.Ioi 1)\n- hCDC : ContDiffOn ℝ 2 (fun t => Real.log (Real.log t)) (Set.Ioi 1)\n- const: contDiffOn_const / contDiff_const.\n\nAnd contDiffOn_FAlt := combination.\n\npsiOf_FAlt_neg:\n```\ntheorem psiOf_FAlt_neg {T : ℝ} (hT : Real.sqrt 20 + 1 ≤ T) : psiOf FAlt T < 0 := by\n have h1T : 1 < T := by ... (√20+1 ≥ 5.47 via Real.le_sqrt) — reuse pattern from block_range_bounds: have hs : (4.4721:ℝ) ≤ Real.sqrt 20 := ...; linarith\n -- differentiability bundles per piece\n ...\n have hdecomp : psiOf FAlt T =\n (1/(2*Real.pi)) * psiOf (fun t => t * Real.log t) T +\n 0.137 * psiOf Real.log T +\n 0.443 * psiOf (fun t => Real.log (Real.log t)) T + psiOf (fun _ => (7/8 + 1.588 : ℝ)) T := by\n unfold FAlt\n rw [psiOf_add hdd123 hddK hnev123 hnevK, psiOf_const, ...]\n```\nHmm — the nested structure: FAlt T = A + B + C + K = ((A + B) + C) + K where A = c₁ f₁, B = c₂ f₂, C = c₃ f₃. psiOf_add on ((A+B)+C)+K: = psiOf (A+B+C) + psiOf K; psiOf (A+B+C) = psiOf (A+B) + psiOf C = psiOf A + psiOf B + psiOf C. Each psiOf (cᵢ fᵢ) = cᵢ psiOf fᵢ via psiOf_const_mul. Conditions accumulate: for psiOf_add I need DifferentiableAt (deriv (A+B+C)) T and DifferentiableAt (deriv K) T etc. deriv K: deriv (fun _ => K) = fun _ => 0 — differentiable: differentiableAt_const. DifferentiableAt (deriv (A+B+C)) T: deriv of sum = sum of derivs eventually... this is getting heavy. ALTERNATIVE: avoid psiOf_add entirely — compute ψ[FAlt] directly via deriv2_of_hasDerivAt_nhds like the other blocks:\n\nh1 : ∀ᶠ x ∈ 𝓝 T, HasDerivAt FAlt (D1 x) x where D1 x = (1/(2π))(log x + 1) + 0.137 * x⁻¹ + 0.443 * ((log x)⁻¹ * x⁻¹).\nh2 : HasDerivAt D1 (D2) T where D2 = (1/(2π)) T⁻¹ + 0.137 * (-1/T²) + 0.443 * (-(log T + 1)/((T * log T)²)).\nThen ψ[FAlt] = D2 − D1/(T−1), and sign: group:\nψ = (1/(2π))[T⁻¹ − (log T + 1)/(T−1)] + 0.137[−1/T² − 1/(T(T−1))] + 0.443[−(log T+1)/((T log T)²) − 1/(T log T (T−1))]\nEach bracket < 0 for T > 1 (proven as the block lemmas). Weights positive ⟹ ψ < 0.\n\nThe direct approach needs HasDerivAt-proofs for FAlt's D1 and D2 — basically the same work as the three blocks combined but ONE assembly. The block lemmas (psiOf_T_mul_log etc.) are independently useful (they're D-057 rows #1/#3/#4). I'll do: block formulas + block signs (standalone, useful), PLUS psiOf_FAlt via direct HasDerivAt assembly reusing per-piece HasDerivAt lemmas. Hmm, but that duplicates the derivative computations.\n\nCleaner: prove psiOf_add/const_mul ONCE (general machinery, small), then per-piece differentiability from ContDiffOn (mechanical), then decompose. The differentiableAt (deriv (A+B+C)) conditions for psiOf_add — wait NO: psiOf_add as I stated takes hf1 : DifferentiableAt ℝ (deriv f) T for the PIECES f and g (not their sum), and hf2/hg2 eventual — deriv2_add handles the sum. So applying psiOf_add to split ((A+B)+C)+K: need DifferentiableAt (deriv (A+B+C)) T — the SUM's deriv differentiability! Hmm, for the left-nested split: psiOf ((A+B+C)+K) = psiOf (A+B+C) + psiOf K needs DifferentiableAt (deriv (A+B+C)) T. deriv (A+B+C) = deriv A + deriv B + deriv C eventually → differentiable since each deriv differentiable. Proving that needs deriv_add chains again... PAIN.\n\nBetter: give psiOf_add a ContDiffOn-flavored variant:\n```\ntheorem psiOf_add_cd {f g : ℝ → ℝ} {c : ℝ} (hc : c < T) -- T ∈ Ioi c\n (hf : ContDiffOn ℝ 2 f (Set.Ioi c)) (hg : ContDiffOn ℝ 2 g (Set.Ioi c)) :\n psiOf (fun x => f x + g x) T = psiOf f T + psiOf g T\n```\nwith the differentiability derived inside via the hdd/hev patterns. Then nesting: psiOf ((A+B+C)+K): hf = ContDiffOn of (A+B+C) — build via .add chains (ContDiffOn.add). All mechanical:\n\n```\ntheorem psiOf_FAlt_neg {T : ℝ} (hT : Real.sqrt 20 + 1 ≤ T) : psiOf FAlt T < 0\n```\nproof sketch:\n```\n have h1T : 1 < T := ...\n -- ContDiffOn bundles\n have hA : ContDiffOn ℝ 2 (fun t : ℝ => t * Real.log t) (Set.Ioi 1) := ...\n have hB : ContDiffOn ℝ 2 Real.log (Set.Ioi 1) := ...\n have hC : ContDiffOn ℝ 2 (fun t : ℝ => Real.log (Real.log t)) (Set.Ioi 1) := ...\n -- ψ decomposition\n have hψ : psiOf FAlt T = (1/(2*Real.pi)) * psiOf (fun t => t * Real.log t) T +\n 0.137 * psiOf Real.log T + 0.443 * psiOf (fun t => Real.log (Real.log t)) T := by\n unfold FAlt\n rw [psiOf_add_cd h1T (((contDiffOn_const.mul hA).add (contDiffOn_const.mul hB)).add (contDiffOn_const.mul hC)) contDiffOn_const, psiOf_const,\n psiOf_add_cd h1T ((contDiffOn_const.mul hA).add (contDiffOn_const.mul hB)) (contDiffOn_const.mul hC),\n psiOf_add_cd h1T (contDiffOn_const.mul hA) (contDiffOn_const.mul hB),\n psiOf_const_mul_cd h1T contDiffOn_const hA, ...]\n```\nHmm wait — psiOf_const_mul_cd: ψ[c·f] = c·ψ[f] with ContDiffOn flavor. And after decomposition: psiOf (fun _ => K) T = 0 via psiOf_const. The rw order/unfold FAlt: goal psiOf (fun T => c₁*(T*log T) + c₂*log T + c₃*log(log T) + K) T = ... — the λ-expression must match (fun x => f x + g x) shapes: ((c₁f₁ + c₂f₂) + c₃f₃) + K with f₁ = fun t => t*log t etc. — syntactically (fun T => X + Y) where X = c₁*(T*log T)... For the rw to fire, psiOf_add_cd's LHS pattern `psiOf (fun x => f x + g x) T` must unify with `psiOf (fun T => body) T` where body = ((c₁*(T*log T) + c₂*log T) + c₃*log(log T)) + K — higher-order unification: f x + g x =?= body: f := fun t => (c₁*(t*log t) + c₂*log t) + c₃*log(log t), g := fun _ => K — should unify (pattern unification, body is an application-structure). Lean's rw with lambdas: `psiOf (fun x => f x + g x)` — f and g are metavariables; matching `fun T => P T + Q T` against `fun x => ?f x + ?g x` — standard pattern, works (like deriv2_add applications in marginTilde_convex which rw on unfolded marginExpanded ✓ precedent exists).\n\nHmm — but actually deriv2_add was applied in marginTilde_convex via explicit `rw [deriv2_add (hdd hCD10) ...]` after `unfold marginExpanded; dsimp only`. So this style works. But the conditions for psiOf_add_cd at the TOP split: hf = ContDiffOn ((A+B)+C) — I pass the explicit ContDiffOn expression; the f/g unification determines f = (A+B+C)-λ, g = K-λ, and hf's type must be ContDiffOn ℝ 2 ((A+B+C)-λ) (Ioi 1) — my provided term `((contDiffOn_const.mul hA).add ...)` has type ContDiffOn ℝ 2 (fun T => ((c₁*(T*log T) + c₂*log T) + c₃*log(log T)))? NO — contDiffOn_const.mul hA : ContDiffOn ℝ 2 ((fun _ => c₁) * (fun t => t * log t)) — the Pi.mul form: ((fun _ => c₁) * f) t = c₁ * f t ✓ defeq to fun t => c₁*(t*log t) but syntactically Pi.mul_apply. When I pass it as hf : ContDiffOn ℝ 2 ?f (Ioi 1) with ?f unified from the rw match, the provided term's type must be DEFEQ to ContDiffOn ℝ 2 ?f — rw will assign ?f := the lambda from matching the goal, and my hf term's type must check defeq against it. (fun _ => c₁) * (fun t => t*log t) vs fun t => c₁*(t*log t): defeq by Pi.mul_apply ✓ (iota/beta). Type-checking hf against the expected type: isDefEq should handle Pi.mul_apply reduction ✓ (session-011 gotcha: \"Pi.mul_apply/Pi.add_apply/Pi.sub_apply simp after .mul/.add/.sub\" — they used simp only to CONVERT derivative VALUES; for type-checking provided terms, defeq handles it... they used convert ... first | rfl | ring suggesting defeq sometimes needed help. Risk noted; fix at compile.)\n\nHmm, honestly — this psiOf_add_cd route has multiple defeq risk points. The DIRECT route (one deriv2_of_hasDerivAt_nhds for FAlt with explicit D1, D2) is longer but each step is a pattern I've already seen work in this file. Actually — wait. Even simpler: I DON'T need ψ[FAlt] via psiOf at all! Look at how marginTilde_convex consumes hψ: `hψn : psiOf F (√n+1) < 0 := hψ _ hTn` where psiOf F T = deriv (deriv F) T − deriv F T/(T−1). The assembly needs to PROVIDE hψ : ∀ T ≥ √20+1, deriv (deriv FAlt) T − deriv FAlt T/(T−1) < 0. I can prove this directly:\n\n```\ntheorem FAlt_psi_neg (T : ℝ) (hT : Real.sqrt 20 + 1 ≤ T) :\n deriv (deriv FAlt) T - deriv FAlt T / (T - 1) < 0\n```\nvia deriv2_of_hasDerivAt_nhds with explicit D1/D2 (giving deriv FAlt T = D1 T and deriv (deriv FAlt) T = D2 T), then the closed-form sign argument grouping into the three negative brackets. The D1/D2 HasDerivAt proofs: build from per-piece hasDerivAt lemmas (which I need for the block formulas anyway):\n- hasDerivAt_A : HasDerivAt (fun t => t * Real.log t) (Real.log x + 1) x (x > 0)\n- hasDerivAt_A1 : HasDerivAt (fun t => Real.log t + 1) x⁻¹ x — D2 of A\n- hasDerivAt_B : HasDerivAt Real.log x⁻¹ x (x ≠ 0)\n- hasDerivAt_B1 : HasDerivAt (fun t => t⁻¹) (-1/x²) x — D2 of B\n- hasDerivAt_C : HasDerivAt (fun t => log (log t)) ((log x)⁻¹ * x⁻¹) x (x > 1)\n- hasDerivAt_C1 : HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) (-(log x + 1)/((x * log x)²)) x — D2 of C\n\nThen:\nD1F x := (1/(2π))*(log x + 1) + 0.137*x⁻¹ + 0.443*((log x)⁻¹*x⁻¹) [+ 0 for const]\nhD1 : ∀ᶠ x ∈ 𝓝 T, HasDerivAt FAlt (D1F x) x — from (hasDerivAt_A).const_mul (1/(2π)) |>.add ((hasDerivAt_B).const_mul 0.137) |>.add ... |>.add (hasDerivAt_const x K), with convert/field_simp to match the exact D1F form. Hmm — const_mul: HasDerivAt (fun t => c * f t) (c * f') — the assembled function: fun t => c₁*(t*log t) + c₂*log t + ... — matches FAlt's body ✓ (after unfold FAlt). Derivative value: c₁*(log x+1) + c₂*x⁻¹ + c₃*((log x)⁻¹*x⁻¹) + 0 ✓ defeq/ring to D1F x.\n\nD2F := (1/(2π))*T⁻¹ + 0.137*(-1/T²) + 0.443*(-(log T + 1)/((T*log T)²))\nhD2 : HasDerivAt D1F-as-function D2F T — from (hasDerivAt_A1).const_mul ... — D1F as function of t: fun t => c₁*(log t + 1) + c₂*t⁻¹ + c₃*((log t)⁻¹*t⁻¹): derivative c₁*T⁻¹ + c₂*(-1/T²) + c₃*(-(log T+1)/((T log T)²)) ✓.\n\nThen deriv FAlt T = D1F T (hD1.self_of_nhds.deriv) and deriv (deriv FAlt) T = D2F (deriv2_of_hasDerivAt_nhds hD1 hD2). Sign: \nψ = D2F − D1F T/(T−1) = c₁[T⁻¹ − (log T + 1)/(T−1)] + c₂[−1/T² − (T⁻¹)/(T−1)] + c₃[−(log T+1)/((T log T)²) − ((log T)⁻¹ T⁻¹)/(T−1)]\n= c₁·brA + c₂·brB + c₃·brC with brA < 0 (block #1 sign), brB < 0 (#3), brC < 0 (#4), c₁,c₂,c₃ > 0 ⟹ ψ < 0.\n\nThe equality ψ = c₁brA + c₂brB + c₃brC: field_simp [hT0.ne', hT1.ne', hlog.ne'] + ring. Then positivity of weights: c₁ = 1/(2π) > 0 (Real.pi_pos), c₂ = 0.137 > 0, c₃ = 0.443 > 0. Each bracket negative:\n- brA: T⁻¹ − (log T + 1)/(T−1) < 0 — from psiOf_T_mul_log_neg? If I prove the standalone block lemmas FIRST, I can reuse their SIGN parts (not the deriv machinery) here: brA = psiOf (fun t => t*log t) T — no wait, brA is just the closed-form expression; the standalone block lemma psiOf_T_mul_log_neg proves psiOf (fun t => t*log t) T < 0 which after rw [psiOf_T_mul_log] becomes 1/T − (log T + 1)/(T−1) < 0 — exactly brA < 0 modulo T⁻¹ vs 1/T (defeq via one_div). So I can reuse: have hbrA := psiOf_T_mul_log_neg h1T — its statement: psiOf (fun t => t * Real.log t) T < 0 — and psiOf_T_mul_log T h1T : psiOf ... = 1/T − (log T + 1)/(T−1). So brA expression < 0 ✓. Similarly brB, brC. So prove the three block lemmas standalone (formula + sign), then FAlt_psi_neg uses direct HasDerivAt assembly for the deriv VALUES + reuses block SIGNS. \n\nTotal new code estimate: ~350-450 lines. Let me write it all now, append before `end NguyenRH1`, and compile iteratively.\n\nOne more piece: pos_of_convex_of_base + assembly + defs. And replacing the old sorry'd theorem.\n\nFor the assembly theorem, casts: hfinite : LiVerifiedUpTo (5*10^5) — the def: ∀ n : ℕ, 1 ≤ n → n ≤ N → 0 < (liCoeff n).re with N : ℕ := 5*10^5. In Lean: LiVerifiedUpTo (5 * 10 ^ 5) — 5*10^5 : ℕ.\n\nhSf : SfBoundProp := ∀ n : ℕ, 80000 ≤ n → (n : ℝ) ≤ (3*10^12-1 : ℝ)^2 → |Sf n| ≤ Bn FAlt (n : ℝ).\n\nThe theorem:\n```\ntheorem lambda_pos_finite_height\n (hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5))\n (hbase : 0 < marginTilde FAlt 80000) (hbase' : 0 < deriv (marginTilde FAlt) 80000)\n (hSf : SfBoundProp) :\n ∀ n : ℕ, 1 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →\n 0 < (liCoeff n).re := by\n intro n hn1 hnN\n rcases lt_or_ge n 80000 with hlt | hge\n · exact hfinite n hn1 (by omega)\n · have hn20 : 20 ≤ n := by omega\n have h1 := sInfty_lower_bound n hn20\n have h2 := hSf n hge hnN\n have h3 : (liCoeff n).re = SInfty n - Sf n + 1 := by\n unfold Sf; ring\n have h4 : marginTilde FAlt (n : ℝ) = sInftyLower (n : ℝ) - Bn FAlt (n : ℝ) + 1 :=\n marginTilde_eq_sub FAlt n\n have h5 : 0 < marginTilde FAlt (n : ℝ) := by\n apply pos_of_convex_of_base (marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)\n (continuousOn_marginExpanded'...) ...\n```\nWait — pos_of_convex_of_base needs ContinuousOn (marginTilde FAlt) (Ici 20): from continuousOn_marginExpanded FAlt contDiffOn_FAlt via marginTilde_eq_expanded: ContinuousOn (marginExpanded FAlt) (Ici 20); marginTilde FAlt = marginExpanded FAlt (marginTilde_eq_expanded) — rw. ✓ And hdiff : ∀ y ∈ Ioi 20, DifferentiableAt ℝ (marginTilde FAlt) y: from contDiffOn_marginExpanded: ContDiffOn ℝ 2 (marginExpanded FAlt) (Ioi 20) → differentiableOn → differentiableAt (Ioi_mem_nhds). ✓\n\npos_of_convex_of_base application: N₀ := (80000 : ℝ), x := (n : ℝ) with 80000 ≤ n (ℕ) → (80000:ℝ) ≤ n ✓ exact_mod_cast hge. hN : 20 < 80000 norm_num. h0/h0' : hbase/hbase′ — types: marginTilde FAlt 80000 — the 80000 in hbase is ℝ literal ✓ matches N₀ := (80000:ℝ) ✓.\n\nThen final: \n```\n have habs : Sf n ≤ |Sf n| := le_abs_self _\n -- combine: (liCoeff n).re = SInfty n − Sf n + 1 ≥ sInftyLower n − Bn FAlt n + 1 = marginTilde FAlt n > 0\n rw [h3]\n -- goal: 0 < SInfty n − Sf n + 1\n -- h5 + h4: 0 < sInftyLower n − Bn FAlt n + 1\n linarith [h1, h2, h5, habs]\n```\nh4 : marginTilde FAlt ↑n = sInftyLower ↑n − Bn FAlt ↑n + 1; h5 : 0 < marginTilde FAlt ↑n; h1 : sInftyLower ↑n ≤ SInfty n; h2 : |Sf n| ≤ Bn FAlt ↑n; habs : Sf n ≤ |Sf n|. Goal: 0 < SInfty n − Sf n + 1. linarith: SInfty n − Sf n + 1 ≥ sInftyLower ↑n − Bn FAlt ↑n + 1 = marginTilde > 0 ✓ linarith should close with h4 as equation hint: linarith [h1, h2, h4, h5, habs]. ✓\n\nhRH unused — linter warning \"unused variable hRH\" (not error). To keep the signature honest AND warning-free, name it `_hRH`? But the paper statement wants hRH visible... The theorem's hypothesis list IS the statement; `_hRH : RHUpTo (3*10^12)` is still visible in the signature, just marked intentionally-unused. Hmm — but then PrintAxioms/journal can note \"hRH enters through SfBoundProp's eventual proof\". Actually NO WAIT. Think again: is hRH really unused in the final intended theorem? The intended final theorem (tier ii complete) would prove SfBoundProp from hRH + Trudgian perimeter + M₀ etc. So in the FINAL assembled form, hRH IS used (to prove hSf). In the CURRENT assembly-first stage, hSf is a hypothesis and hRH is idle. Options: (a) keep `_hRH` with a comment; (b) keep hRH and accept the unusedVariable linter warning (file already tolerates warnings). I'll use `_hRH` with a doc comment explaining it documents the bridge input consumed by SfBoundProp's eventual proof. Hmm — actually, wait: is that true? Does the eventual SfBoundProp proof use RHUpTo? YES — D-037 §6 bridge: zeros |γ| ≤ T on the line ⟹ |ρ/(ρ−1)|ⁿ = 1 ⟹ each term ≤ 2. Without RH-to-T₀, B(n) doesn't bound |S_f|. So hRH is consumed by SfBoundProp's proof. Document exactly that. ✓\n\nhbase/hbase′: interim hypotheses (12.2 will discharge). The aux name: keep the name lambda_pos_finite_height for the theorem WITH hbase/hbase′? After 12.2 they get discharged and the signature shrinks to (hRH)(hfinite)(hSf). Plan: this session's milestone 1 = theorem with 5 hypotheses compiling; milestone 2 = discharge hbase/hbase′. Name the final one lambda_pos_finite_height; if 12.2 spills, the interim version keeps the name with hbase/hbase′ and a TODO note. OK.\n\npos_of_convex_of_base statement — generalize over the domain constant? Keep it specific to Ici 20 to match marginTilde_convex... Actually make it general over (a : ℝ) with N₀ > a: cleaner and no extra cost:\n\n```\ntheorem pos_of_convex_of_base {f : ℝ → ℝ} {a N₀ x : ℝ}\n (hconv : ConvexOn ℝ (Set.Ici a) f)\n (hdiff : ∀ y : ℝ, y ∈ Set.Ioi a → DifferentiableAt ℝ f y)\n (hN : a < N₀) (hx : N₀ ≤ x) (h0 : 0 < f N₀) (h0' : 0 < deriv f N₀) :\n 0 < f x := by\n rcases eq_or_lt_of_le hx with heq | hlt\n · rw [← heq]; exact h0\n · -- MVT on [N₀, x]\n have hN20 : a < N₀ := hN\n have hfc : ContinuousOn f (Set.Icc N₀ x) := by\n -- differentiable on Ioi a ⊇ Icc N₀ x ⟹ continuous there\n apply DifferentiableOn.continuousOn\n intro y hy\n have hya : a < y := by\n have : N₀ ≤ y := hy.1\n linarith\n exact (hdiff y hya).differentiableWithinAt\n have hfd : DifferentiableOn ℝ f (Set.Ioo N₀ x) := by\n intro y hy\n have hya : a < y := by have := hy.1; linarith\n exact (hdiff y hya).differentiableWithinAt\n obtain ⟨ξ, hξ, hξeq⟩ := exists_deriv_eq_slope f hlt hfc hfd\n -- monotonicity of deriv on Ici N₀\n have hconv' : ConvexOn ℝ (Set.Ici N₀) f :=\n hconv.mono (Set.Ici_subset_Ici.mpr (le_of_lt hN))\n have hfd' : ∀ y : ℝ, y ∈ Set.Ici N₀ → DifferentiableAt ℝ f y := by\n intro y hy\n have : a < y := by have : N₀ ≤ y := hy; linarith\n exact hdiff y this\n have hmono := hconv'.monotoneOn_deriv hfd' (Set.mem_Ici.mpr (le_refl N₀))\n (Set.mem_Ici.mpr (le_of_lt hξ.1)) (le_of_lt hξ.1)\n -- hξeq : deriv f ξ = (f x − f N₀)/(x − N₀)\n have hpos : (0 : ℝ) < x - N₀ := sub_pos.mpr hlt\n have hkey : (0 : ℝ) < (f x - f N₀) / (x - N₀) := hξeq ▸ lt_of_lt_of_le h0' hmono\n have := (div_pos_iff_of_pos_right hpos).mp hkey\n linarith\n```\nWait hξeq : deriv f ξ = (f x − f N₀)/(x − N₀); hmono : deriv f N₀ ≤ deriv f ξ; so (f x − f N₀)/(x−N₀) = deriv f ξ ≥ deriv f N₀ > 0 ✓. hξeq ▸ ... : hξeq ▸ rewrites goal... `hξeq ▸ lt_of_lt_of_le h0' hmono` : lt_of_lt_of_le h0' hmono : 0 < deriv f ξ; ▸ hξeq rewrites deriv f ξ → (f x − f N₀)/(x − N₀): gives 0 < (f x − f N₀)/(x−N₀) ✓. Then div_pos_iff_of_pos_right... Mathlib: `div_pos_iff_of_pos_right (hb : 0 < b) : 0 < a / b ↔ 0 < a` ✓. So f x − f N₀ > 0 ⟹ f x > f N₀ > 0 ✓ linarith [h0].\n\nDetails: eq_or_lt_of_le hx : x = N₀ ∨ N₀ < x — first case x = N₀: `rw [← heq]`? heq : x = N₀; goal 0 < f x; rw [← heq] changes goal to 0 < f N₀? ← heq rewrites N₀ → x... hmm: heq : x = N₀; ← heq rewrites occurrences of N₀ with x. Goal has f x — rw [heq] changes x to N₀: goal 0 < f N₀ = h0 ✓. Use `rw [heq]; exact h0`.\n\nAlso `exists_deriv_eq_slope f hlt hfc hfd` — binders (f) (hab) (hfc) then hfd? From the source: variable line shows (f f') {a b} (hab) (hfc) and presumably (hfd : DifferentiableOn ℝ f (Ioo a b)) on the next variable line. exists_deriv_eq_slope's `include hab hfc hfd` — so explicit args: f, hab, hfc, hfd ✓.\n\nDifferentiableOn def: ∀ x ∈ s, DifferentiableWithinAt ℝ f s x. My hfc: `apply DifferentiableOn.continuousOn; intro y hy; exact (hdiff y hya).differentiableWithinAt` — DifferentiableAt.differentiableWithinAt ✓.\n\nhconv'.monotoneOn_deriv hfd' : MonotoneOn (deriv f) (Ici N₀); applied to (hN₀ : N₀ ∈ Ici N₀) (hξmem : ξ ∈ Ici N₀) (hle : N₀ ≤ ξ) ✓.\n\nSet.Ici_subset_Ici.mpr : a ≤ b → Ici b ⊆ Ici a. Ici N₀ ⊆ Ici a needs a ≤ N₀ ✓ le_of_lt hN. hconv.mono : ConvexOn ℝ s f → t ⊆ s → ConvexOn ℝ t f — signature: ConvexOn.mono (h : s ⊆ t)?? `ConvexOn.mono (hfc : ConvexOn ℝ s f) (h : t ⊆ s) : ConvexOn ℝ t f`? Actually protected theorem ConvexOn.mono (hf : ConvexOn ℝ s f) (ht : t ⊆ s) : ConvexOn ℝ t f — hmm argument order: hf.mono ht. ✓\n\nOK. Now also the OLD theorem replacement. Old:\n```\n/-- [SKELETON] R-004, the finite-height Li theorem (draft Thm 3.1): ... -/\ntheorem lambda_pos_finite_height\n (hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5)) :\n ∀ n : ℕ, 1 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →\n 0 < (liCoeff n).re := by\n sorry\n```\nReplace with a forward-reference comment (the real one goes at file end). Delete the sorry'd theorem, and put a comment in §1 pointing to the end-of-file assembly. \n\nAlso update file header docstring (stage note: tier ii step 1 assembled).\n\nLet me now write all the new code. I'll append before `end NguyenRH1`. Note the file ends:\n```\n linarith [hIIM, hnn1, ...]\nend NguyenRH1\n\nend\n```\nThe final `end` closes noncomputable section.\n\nAlso — check: ` deriv (marginTilde FAlt) 80000` in hbase′: deriv of marginTilde FAlt at the real 80000. For 12.2 discharge I'll need deriv of marginExpanded pieces... later.\n\nAlso should I keep hbase/hbase′ as reals `(80000 : ℝ)`. ✓\n\nWriting the code now. One concern about `psiOf_T_mul_log` D1: `(hasDerivAt_id' x).mul (Real.hasDerivAt_log hx)` gives HasDerivAt (fun t => t * Real.log t) (1 * log x + x * x⁻¹) — the mul rule: HasDerivAt (f*g) (f' * g x + f x * g')? Mathlib HasDerivAt.mul : HasDerivAt (fun x => f x * g x) (f' * g x + f x * g')?? Actually: (hf.mul hg) : HasDerivAt (fun x => f x * g x) (f' * g x + f x * g') x. With f = id, f' = 1: 1 * Real.log x + x * x⁻¹. rwa [one_mul, mul_inv_cancel₀ hx] at h — gives Real.log x + 1 ✓.\n\nHmm wait, in psiOf_T_mul_log_shift they did exactly: `have h := (hasDerivAt_id' x).mul (hasDerivAt_log_shift x ...); rwa [one_mul] at h` — the shift version's log-shift derivative is (x+2)⁻¹ and x*(x+2)⁻¹ stays as is (no cancellation). For unshifted I need mul_inv_cancel₀. Fine.\n\nFor hasDerivAt_B1 (deriv of t⁻¹): (hasDerivAt_id' T).inv (ne_of_gt hT0): HasDerivAt (fun t => (id t)⁻¹) (-(1)/(id T)^2)? inv rule: -f'/(f x)^2 = -1/T^2. Function: (id t)⁻¹ vs t⁻¹ — defeq. The result type HasDerivAt (fun t => t⁻¹) (-1/T^2) — hmm -(1)/T^2 displays as -1/T^2? -1/T^2 = -(1/T^2)... the inv rule gives -(f')/(f x)^2 = -1/T^2 which is (-1)/T^2 = -(1/T^2) — all defeq by ring but for `exact h` defeq suffices ✓ (these are just different but defeq terms: -1/T^2 elaborates as Neg (HDiv 1 (T^2))? and -f'/f x ^2 = Neg (HDiv 1 ...) — with f' = 1: -(1/T^2) ✓ same). Should be fine; add `rwa` patterns from the file if needed.\n\nhasDerivAt_C: hout.comp T hin where hin : HasDerivAt Real.log T⁻¹ T, hout : HasDerivAt Real.log (Real.log T)⁻¹ (Real.log T). comp: HasDerivAt (Real.log ∘ Real.log) ((Real.log T)⁻¹ * T⁻¹)? Chain rule: HasDerivAt.comp : HasDerivAt g (g') (f x) → HasDerivAt f f' x → HasDerivAt (g ∘ f) (g' * f') x. So hout.comp T hin : HasDerivAt (Real.log ∘ Real.log) ((Real.log T)⁻¹ * T⁻¹) T ✓. Function Real.log ∘ Real.log vs fun t => Real.log (Real.log t) — defeq ✓ (use show or exact; the shifted version psiOf_log_log_shift used exactly this pattern with hasDerivAt_log_shift and it worked: `exact hout.comp x hin` where target was HasDerivAt (fun t => Real.log (Real.log (t + 2))) ... ✓).\n\nhasDerivAt_C1: D2 of C: (fun t => (log t)⁻¹ * t⁻¹): hu.mul hv where hu : HasDerivAt (fun t => (Real.log t)⁻¹) (-T⁻¹/(Real.log T)^2) T := hin.inv (ne_of_gt hlog) — inv rule: -f'/f^2 = -(T⁻¹)/(log T)^2 ✓. hv := hasDerivAt_B1. hu.mul hv : HasDerivAt (fun t => (log t)⁻¹ * t⁻¹) ((-T⁻¹/(log T)^2) * T⁻¹ + (log T)⁻¹ * (-1/T^2)) T. Convert to -(log T + 1)/((T * log T)^2): field_simp [hT0.ne', hlog.ne'] + ring — the shifted version did:\n```\nhave e : (-(T + 2)⁻¹ / Real.log (T + 2) ^ 2) * (T + 2)⁻¹ + (Real.log (T + 2))⁻¹ * (-1 / (T + 2) ^ 2) = -(Real.log (T + 2) + 1) / ((T + 2) * Real.log (T + 2)) ^ 2 := by field_simp [...]; ring\nrwa [e] at h\n```\n✓ same pattern.\n\nThen the psiOf block formula theorems via deriv2_of_hasDerivAt_nhds.\n\nLet me also double check deriv2_of_hasDerivAt_nhds needs h1 : ∀ᶠ x in 𝓝 T, HasDerivAt φ (D1 x) x — ✓ built via filter_upwards [eventually_gt_nhds ...].\n\nNow — marginTilde_eq_sub: marginTilde has `let T := Real.sqrt n + 1` then body. simp only [marginTilde, Bn, sInftyLower]: unfolds defs incl. let? `simp only [marginTilde]` unfolds the def including the let (zeta reduction in dsimp). The existing marginTilde_eq_expanded did `simp only [marginTilde, marginExpanded, ...]` then ring ✓ precedent. Bn also has let T. Should be fine.\n\nNow write everything. Also the hdiff argument for the assembly: \n```\nhave hdiffM : ∀ y : ℝ, y ∈ Set.Ioi 20 → DifferentiableAt ℝ (marginTilde FAlt) y := by\n intro y hy\n rw [marginTilde_eq_expanded FAlt]\n exact ((contDiffOn_marginExpanded FAlt contDiffOn_FAlt).differentiableOn (by norm_num)).differentiableAt (Ioi_mem_nhds hy)\n```\nAnd hcontM : ContinuousOn (marginTilde FAlt) (Ici 20): not needed by pos_of_convex_of_base as I designed it (hfc derived from hdiff). ✓ drop hcont.\n\npos_of_convex_of_base args order: (hconv)(hdiff)(hN)(hx)(h0)(h0') with {f a N₀ x} implicit — apply with named: pos_of_convex_of_base hconv hdiffM (by norm_num) hx hbase hbase' — f, a, N₀, x inferred from hconv (ConvexOn ℝ (Ici 20) (marginTilde FAlt)) and hbase (0 < marginTilde FAlt 80000) and hx ((80000:ℝ) ≤ ↑n). a = 20, N₀ = 80000 ✓ unification from hconv/hbase/hx types. hx : (80000:ℝ) ≤ (n:ℝ) — I provide. hN : (20:ℝ) < 80000 — norm_num ✓. Should unify.\n\nOne risk: pos_of_convex_of_base's implicit {a N₀ x} with hconv : ConvexOn ℝ (Set.Ici a) f etc. — apply order. I'll write it as a direct term/tactic proof in the assembly:\n```\nhave h5 : 0 < marginTilde FAlt (n : ℝ) :=\n pos_of_convex_of_base\n (marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)\n hdiffM (by norm_num) (by exact_mod_cast hge) hbase hbase'\n```\nhge : 80000 ≤ n (ℕ); need (80000 : ℝ) ≤ (n : ℝ): exact_mod_cast hge ✓.\n\nmarginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg : needs FAlt_psi_neg : ∀ T : ℝ, Real.sqrt 20 + 1 ≤ T → deriv (deriv FAlt) T − deriv FAlt T/(T−1) < 0 ✓ matches hψ shape.\n\nAlso marginTilde_convex's hF : ContDiffOn ℝ 2 F (Set.Ioi 1) := contDiffOn_FAlt ✓.\n\nNow — realize one more potential issue: marginTilde_convex's proof uses hF only via contDiffOn_mFblock F hF and hCDFc and vF — all now ContDiffOn-based ✓ already refactored above.\n\nWrite the code block now. Also replace the old sorry theorem. Let me do it in pieces: first replace old theorem, then append new section.","signature":""},{"type":"text","text":"Refactor compiles green (only the expected `sorry` warning on line 55). Now replacing the old skeleton theorem with a forward pointer, then appending the assembly machinery."},{"type":"tool_use","id":"Edit_52","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiSkeleton.lean","old_string":"/-- [SKELETON] R-004, the finite-height Li theorem (draft Thm 3.1):\nassuming RH verified to T₀ = 3×10¹² and finite Li verification to\n5×10⁵, λ_n > 0 for all n ≤ (T₀−1)² ≈ 9.0×10²⁴.\nProof content to formalize: D-037 assembly (archimedean lower bound +\ntraced contour bound + bridge + margin argument). -/\ntheorem lambda_pos_finite_height\n (hRH : RHUpTo (3 * 10 ^ 12)) (hfinite : LiVerifiedUpTo (5 * 10 ^ 5)) :\n ∀ n : ℕ, 1 ≤ n → (n : ℝ) ≤ (3 * 10 ^ 12 - 1 : ℝ) ^ 2 →\n 0 < (liCoeff n).re := by\n sorry","new_string":"/-- [PROVED session 012, tier (ii) step 1 — assembly modulo the named\nanalytic hypothesis] R-004, the finite-height Li theorem (draft Thm 3.1).\nThe full statement and proof are at the END of this file (§4), after the\nmargin machinery they depend on: `lambda_pos_finite_height` there is\nproved from `SfBoundProp` (the single named analytic hypothesis, D-062\ntriage) + the computational perimeter (Platt–Trudgian `RHUpTo`,\n`LiVerifiedUpTo`) + two elementary base-point evaluations. -/"},"extra_content":null}]