← Session 18 — Lean tier (ii): finite-height proof + certified base points
thinking (24989 chars)
`ConvexOn.slope_mono_adjacent (hf) (hx : x ∈ s) (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f y − f x)/(y − x) ≤ (f z − f y)/(z − y)` — exactly the three-chord lemma.
pos_of_convex_of_two_points:
```
theorem pos_of_convex_of_two_points {f : ℝ → ℝ} {a N₀ N₁ x : ℝ}
(hconv : ConvexOn ℝ (Set.Ici a) f)
(hN : a < N₀) (hN01 : N₀ < N₁) (hx : N₁ ≤ x)
(h0 : 0 < f N₀) (h01 : f N₀ < f N₁) :
0 < f x := by
rcases eq_or_lt_of_le hx with heq | hlt
· rw [← heq]; linarith
· have hslope := hconv.slope_mono_adjacent
(Set.mem_Ici.mpr (le_of_lt hN)) -- N₀ ∈ Ici a
(Set.mem_Ici.mpr (by linarith)) -- x ∈ Ici a
hN01 hlt
-- (f N₁ − f N₀)/(N₁ − N₀) ≤ (f x − f N₁)/(x − N₁)
have hp1 : (0:ℝ) < N₁ - N₀ := by linarith
have hp2 : (0:ℝ) < x - N₁ := by linarith
have hs : (0:ℝ) < (f N₁ - f N₀)/(N₁ - N₀) := div_pos (by linarith) hp1
have hs2 : (0:ℝ) < (f x - f N₁)/(x - N₁) := lt_of_lt_of_le hs hslope
have hfx : (0:ℝ) < f x - f N₁ := (div_pos_iff_of_pos_right hp2).mp hs2
linarith
```
Wait — slope_mono_adjacent hx hz needs x,z ∈ s (the endpoints), y free. With x := N₀, y := N₁, z := x: (f N₁ − f N₀)/(N₁ − N₀) ≤ (f x − f N₁)/(x − N₁) ✓.
N₀ ∈ Ici a: le_of_lt hN (a < N₀ ⟹ a ≤ N₀) ✓. x ∈ Ici a: a < N₀ < N₁ ≤ x ✓ linarith.
Then the main theorem's hypotheses become:
(hbase : 0 < marginTilde FAlt 80000) (hbase2 : marginTilde FAlt 80000 < marginTilde FAlt 100000)
and in the proof replace pos_of_convex_of_base with pos_of_convex_of_two_points:
```
have h5 : 0 < marginTilde FAlt (n : ℝ) :=
pos_of_convex_of_two_points
(marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)
(by norm_num) (by norm_num) (by exact_mod_cast hge') hbase hbase2
```
where the case split: n < 80000 (finite) / n ≥ 80000. For two-point: need n ≥ N₁ = 100000 for the slope argument... NO wait — pos_of_convex_of_two_points as stated needs x ≥ N₁. But we need positivity for n ∈ [80000, 100000) too! For n ∈ [80000, 100000]: margin(n) ≥ ? Convexity doesn't give positivity between the points from these two facts alone... Hmm — actually YES it does: f convex, f(N₀) > 0, f(N₁) > f(N₀): for x ∈ [N₀, N₁]: hmm, convex functions can dip below... NO: convex + f(N₀) > 0 + f(N₁) > f(N₀) ⟹ for x ∈ (N₀, N₁): f(x) ≤ max? convex gives upper bound on the segment, not lower! f could dip below f(N₀) inside. Counterexample: f(x) = (x−N₀)(N₁−x)·(−1)... no that's concave. Convex: f(x) = f(N₀) + s(x−N₀) + g(x) with g convex, g(N₀) = 0, s > 0... f could still dip then rise: f(x) = (x−1)² on [0,2]: f(0) = 1, f(2) = 1 — not increasing. Take f(0) = 1, f(2) = 3, convex, but f(0.5) = 0? f(x) = 1 − 2x + 2x²: f(0)=1, f(2)=5>1, f(0.5) = 1−1+0.5 = 0.5 > 0. Try f(x) = 1 − 3x + 3x²: f(0) = 1, f(0.5) = 1 − 1.5 + 0.75 = 0.25 > 0. f(x) = 1 − 4x + 4x²: f(0)=1, f(2) = 9 > 1, f(0.5) = 0. NOT > 0! So convex + two points does NOT give positivity between. I need x ≥ N₁ (after the second point, slopes ⟹ increasing ⟹ positive), and for [N₀, N₁] I need... the DERIVATIVE version had the same issue? No — the deriv version: f′(N₀) > 0 + convex ⟹ f′ ≥ 0 on [N₀,∞) ⟹ f increasing on [N₀,∞) ⟹ f(x) ≥ f(N₀) > 0 for ALL x ≥ N₀. The deriv version is STRICTLY stronger!
So two-point version covers only n ≥ 100000; for 80000 ≤ n < 100000 I'd need... hfinite covers n ≤ 5×10⁵ = 500000 ⊇ [80000, 100000)! Of course — the finite verification overlaps up to 5×10⁵. So: split at 100000: n < 100000 → hfinite (n ≤ 99999 ≤ 500000 ✓); n ≥ 100000 → two-point convex argument with N₀ = 80000, N₁ = 100000. Then SfBoundProp range starts at 100000. Hmm — but SfBoundProp currently starts at 80000. Change to 100000? The contour bound holds there too (B is even more comfortably valid). But hmm — the bridge N₁ and margins: margin needed only for n ≥ 100000 then. The base points: margin(80000) > 0 AND margin(100000) > margin(80000). Fine.
Wait, actually simpler: N₀ = 80000, N₁ = 100000 — hfinite covers to 500000 anyway, so why not just split at 80000 as now, and handle [80000, 100000] ALSO by hfinite? The three regimes:
- n < 100000: hfinite (needs n ≤ 500000: n ≤ 99999 ✓).
- n ≥ 100000: margin argument (convex + two points).
SfBoundProp range: [100000, N₁_target]. Consistent.
Hmm, but hold on — is it cleaner to keep SfBoundProp from 80000? The eventual SfBound proof will handle all n ≥ 80000 or 100000 — either fine. Choose 100000 = N₁ (call it N₁_eval... no, N₁ is taken = (T₀−1)²; call the second point N₂ = 100000).
Now — the numeric discharge itself (hbase, hbase2 as PROVED theorems):
Theorem base₁ : 0 < marginTilde FAlt 80000.
Proof: marginTilde FAlt 80000 = sInftyLower 80000 − Bn FAlt 80000 + 1 (marginTilde_eq_sub).
- slower(80000) ≥ 337000: unfold sInftyLower lagariasC1; γ cancels (ring_nf to expose): slower(80000) = (1/2)(80000) log 80000 − ((1 + log 2 + log π)/2)·80000 − 4. Need: log 80000 ≥ 11.263 (say) and log 2 ≤ 0.6932, log π ≤ 1.1448 (Mathlib: Real.log_pi_gt/lt? There are Real.log_pi lemmas? I don't remember d9 for π. log π: π ≤ 3.15 ⟹ log π ≤ log 3.15 ≤ ... e^1.1448 ≥ 3.1416? partial sums. Or Real.log_pi_lt_d9? Let me grep for log_pi bounds in Mathlib.)
With log 80000 ≥ 11.263, log 2 ≤ 0.6931472, log π ≤ 1.14473: slower ≥ 40000·11.263 − 40000·(1 + 0.6931472 + 1.14473) − 4 = 450520 − 40000·2.8378772 − 4 = 450520 − 113515.1 − 4 = 337000.9 ≥ 337000 ✓.
- Bn FAlt 80000 ≤ 321237 + ... let me budget: need Bn ≤ 337001 (to get margin ≥ 337000 − 337001 + 1 = 0)... cutting too close! slower ≥ 337000.9 and margin = slower − Bn + 1 > 0 needs Bn < 337001.9. TRUE Bn = 322309 — so Bn ≤ 337000 has 14691 slack ✓ but I need my upper-bound ESTIMATE of Bn to land below 337001. My bounding error budget for Bn: ~14600. Bn pieces (true values): T = 283.84; 2FAlt(T) = 517.8; 4T·[...] = 127132; 40·1.3352 = 53.4; 2(e⁴+1)(7Ĥ+3.3) = 194604; IIMaj ≈ tiny; +1. Sum 322309.
Upper bounds needed: T ≤ 284 (via √80000 ≤ 283: 80000 ≤ 283² = 80089 ✓ — Real.sqrt_le' or le_sqrt... `Real.sqrt_le' : 0 < y → (√x ≤ y ↔ x ≤ y^2)`? or Real.sqrt_le_sqrt (80000 ≤ 80089) then √80089 = 283 (Real.sqrt_eq_cases? norm_num can do √80089 = 283? Real.sqrt_eq_iff... there's a norm_num extension for sqrt of squares? `Real.sqrt_eq_cases`... simplest: √80000 ≤ 283 ⟺ (Real.sqrt_le_iff ...). Use: Real.sqrt_le' (by norm_num : (0:ℝ) < 283) — gives √80000 ≤ 283 ↔ 80000 ≤ 283^2 — mpr with norm_num 80000 ≤ 80089 ✓.)
- log T ≤ log 284 ≤ 5.66 (via 284 ≤ e^5.66 — partial-sum lower bound on exp: e^5.66 = e^5·e^0.66; e^5 ≥ (2.7182818283)^5 via pow (Real.exp_one_gt_d9) — 2.7182818283^5 = 148.328...; e^0.66 ≥ Σ_{i<7} 0.66^i/i! = 1+0.66+0.2178+0.047916+0.0079061+0.0010435+0.0001147 = 1.9347803+... let me compute: 1+0.66 = 1.66; +0.2178 = 1.8778; +0.047916 = 1.925716; +0.00790614 = 1.93362214; +0.00104361 = 1.93466575; +0.00011477 = 1.93478052. → 1.9348. e^5.66 ≥ 148.328·1.9348 = 286.98 ≥ 284 ✓ margin 1%.). In Lean: Real.log_le_log (by positivity : 0 < 284...) hmm direction: log T ≤ 5.66 ⟸ T ≤ 284 (log mono) and 284 ≤ exp 5.66 ⟹ log 284 ≤ log (exp 5.66) = 5.66 (Real.log_le_log + Real.log_exp). Chain: T ≤ 284 → log T ≤ log 284; log 284 ≤ 5.66 from 284 ≤ Real.exp 5.66 via Real.log_le_log (exp_pos) h → log 284 ≤ log (exp 5.66) = 5.66. Where 284 ≤ exp 5.66: exp 5.66 = exp(5 + 0.66)... 5.66 = 5 + 0.66: Real.exp_add: exp 5.66 = exp 5 * exp 0.66. exp 5 = (exp 1)^5: Real.exp_nat? Real.exp 5 = Real.exp (5:ℝ)... exp 5 = (exp 1)^5? Real.exp_nat_cast? There's `Real.exp_nat` hmm: Real.exp (5:ℕ) = (exp 1)^5 — `Real.exp_nat (x : ℝ) (n : ℕ) : Real.exp (n * x) = (Real.exp x)^n`? I recall `Real.exp_nat_mul`... There's Real.exp_int... For 5: Real.exp 5 — 5 as ℝ. exp 5 = exp(1+1+1+1+1) = (exp 1)^5 via repeated exp_add — or `Real.exp_nat_cast`: exp(↑n) = (exp 1)^n? I'm fairly sure there's something like `Real.exp_natCast` or do it via Real.exp_add manually. And 5.66 = 5 + 0.66 by norm_num ring_nf. Feasible.
- log log T ≤ log 5.66 ≤ 1.74 (5.66 ≤ e^1.74: e^1.74 = e·e^0.74; e^0.74 ≥ Σ_{i<7}: 1+0.74+0.2738+0.067537+0.012494+0.0018487+0.0002280 = 2.0957; ×2.71828 = 5.6959 ≥ 5.66 ✓ margin 0.6% — tightish; use 1.75: e^0.75 partial: 1+.75+.28125+.0703125+.0131836+.0019775+.0002473 = 2.1170; ×2.71828 = 5.7546 ≥ 5.66 ✓ 1.7%. Use 1.75.) So log log T ≤ 1.75 (needs log T ≤ 5.66 first, then log mono: log log T ≤ log 5.66 ≤ 1.75).
Now Bn upper assembly (each factor bounded above, all positive):
- T ≤ 284, log T ≤ 5.66, log log T ≤ 1.75, log(T+2) ≤ log 286 ≤ 5.66 (286 ≤ e^5.66 = 286.98 ✓ margin 0.3% — TOO tight! e^5.66 lower bound was 286.98 vs 286: margin 0.34%. Hmm — risky for norm_num precision. My exp lower bounds are themselves lower bounds: e^5.66 ≥ 148.328·1.9348 = 286.98 — the true e^5.66 = 287.10. So 286 ≤ 286.98 ≤ e^5.66 ✓ with the CERTIFIED lower bound 286.98 > 286 — margin 0.98/286.98 = 0.34% — workable since all my numbers are exact rationals: 148.328·1.9348 — but wait, the CERTIFIED pieces: e^5 ≥ 2.7182818283^5 — this is an exact rational computation: 2.7182818283^5 = 148.32785...; e^0.66 ≥ 1.93478052 (partial sum, exact rational); product ≥ 286.98... exact rational arithmetic — norm_num handles ✓. The margin is genuinely 0.34% — fine for exact rational comparison.)
Hmm wait — actually let me recompute more carefully to pick comfortable constants. Let me just do a Python sizing pass computing each needed bound with my chosen certified constants, to make sure every inequality has ≥ 0.3% margin. Then write the Lean.
Actually, alternative simplification: use log T ≤ 5.7 for everything (T + 2 ≤ 286 ≤ e^5.7): e^5.7 = e^5·e^0.7: e^0.7 ≥ 1+0.7+0.245+0.0571667+0.0100042+0.0014006+0.0001634 = 2.0139 (7 terms); 148.328·2.0139 = 298.72 ≥ 286 ✓ 4.5% margin ✓✓. And log log T: log T ≤ 5.7; log 5.7 ≤ 1.75 (5.7 ≤ 5.7546 ✓ 1%). ✓ Use log T ≤ 5.7, log log T ≤ 1.75 uniformly.
Then:
- FAlt(T) ≤ (1/(2π))·284·5.7 + 0.137·5.7 + 0.443·1.75 + (7/8 + 1.588). Need 1/(2π) bounds: π ≥ 3.1415 (Real.pi_gt_d9: 3.141592653 < π? Mathlib Real.pi_gt_d9 : 3.1415926535 < Real.pi; Real.pi_lt_d9 : π < 3.1415926536). 1/(2π) ≤ 1/(2·3.1415926535) = 1/6.283185307 ≤ 0.159155. So FAlt(T) ≤ 0.159155·284·5.7 + 0.7809 + 0.77525 + 2.463 = 0.159155·1618.8 + 4.019 = 257.667 + 4.019 = 261.69. 2F ≤ 523.4.
- Ĉ₀(T) = 0.433·log(T+2) + 0.886·log log(T+2) + 2.9: log(T+2) ≤ 5.7 (T+2 ≤ 286 ✓), log log(T+2) ≤ 1.75 (log(T+2) ≤ 5.7 ⟹ log log ≤ log 5.7 ≤ 1.75 ✓). Ĉ₀ ≤ 0.433·5.7 + 0.886·1.75 + 2.9 = 2.4681 + 1.5505 + 2.9 = 6.9186.
- 4T·[(2/3)Ĉ₀ + 10.5 log(T+2) + 48] ≤ 4·284·[(2/3)(6.9186) + 10.5·5.7 + 48] = 1136·[4.6124 + 59.85 + 48] = 1136·112.4624 = 127757.2.
- Ĥ(T) = 3Ĉ₀² + 10.5 log(T+2) + 48 ≤ 3·6.9186² + 59.85 + 48 = 3·47.867 + 107.85 = 143.60 + 107.85 = 251.45.
- 2(e⁴+1)·[7Ĥ + 3.3]: e⁴ ≤ 2.7182818286^4 = 54.6015 (norm_num); e⁴+1 ≤ 55.6015; 7Ĥ+3.3 ≤ 7·251.45 + 3.3 = 1763.45; 2·55.6015·1763.45 = 111.203·1763.45 = 196101.6.
- 40·1.3352 = 53.408.
- IIMaj(80000) ≤ 1 (tiny, ~e^{−0.886·282.8}·poly ≈ 0 — but need a Lean bound: IIMaj n = 2(√n+1)(e^{√n/2}+1)·0.57·2^{−(2√n−2)}. Bound: 2^{−(2√n−2)} ≤ 1 and... no — need small? For the UPPER bound of Bn just need IIMaj ≤ something small-ish; crude: 2^{−(2√n−2)} ≤ 2^{−564} (tiny) but proving... simpler crude: IIMaj(80000) ≤ 2(284)(e^{142}+1)·0.57·2^{−564}... e^{142} is astronomically larger than 2^{564} = e^{391}... so IIMaj ≤ huge unless handled as a ratio. IIMaj = 2.28(s+1)(e^{s/2}+1)·2^{−(2s−2)} with s = √80000 ∈ [282, 284]: = 2.28·285·(e^{142}+1)·2^{−562} hmm. (e^{142}+1)·2^{−562} = e^{142}·2^{−562} + 2^{−562} = 2^{142/log... e^{142} = 2^{142/ln2} = 2^{204.85} so product = 2^{204.85−562} + 2^{−562} = 2^{−357} tiny. Proving THAT in Lean: need e^{142} ≤ 2^{205} ⟺ 142 ≤ 205 log 2 = 205·0.69315 = 142.09 ✓ (margin 0.06% — tight! log 2 lower: 0.69314718; 205·0.69314718 = 142.0952 ≥ 142 ✓ 0.07%). So e^{142} ≤ 2^{205} via Real.exp 142 ≤ (2^205 : ℝ)... exp 142 vs 2^205: take logs: 142 ≤ 205 log 2 ⟸ log 2 ≥ 142/205 = 0.69268 — have log 2 ≥ 0.6931471803 ✓. Formalize: (142 : ℝ) ≤ 205 * Real.log 2 (norm_num with Real.log_two_gt_d9); then Real.exp 142 ≤ Real.exp (205 log 2) = 2^205 (Real.exp_log of 2^205 > 0; need (2:ℝ)^205 = Real.exp (205 log 2): Real.exp (205 * log 2) = (exp (log 2))^205 = 2^205 via Real.exp_nat_mul? Real.exp_nat_mul : Real.exp (n * x) = (Real.exp x)^n ✓ probably exists). Then IIMaj ≤ 2·285·(2^205 + 1)·0.57·2^{−562}... 2^{−562}·2^{205} = 2^{−357}: rpow/pow algebra: (2:ℝ)^{−562} — the IIMaj def uses 2 ^ (-(2*√n−2)) as ℝ rpow? In IIMaj: `2 ^ (-(2 * Real.sqrt n - 2))` — exponent is ℝ so it's rpow (via ↑). The bookkeeping: 2^{−(2s−2)} = 4·(2^{−2})^s... this was handled in IIMaj_eq_psiTilde_sqrt. For the bound, work with psiTilde form: IIMaj n = psiTilde (√n) = 4.56(s+1)(e^{−as} + e^{−bs}) ≤ 4.56·285·(e^{−0.886·282} + tiny) ≤ 4.56·285·2·e^{−249.9} — astronomically small; Lean bound: e^{−as} ≤ 1 for as ≥ 0 ✓ TRIVIAL: e^{−a s} ≤ 1 (Real.exp_neg... exp of nonpositive ≤ 1: Real.exp_le_one_iff). So psiTilde(s) ≤ 4.56(s+1)·2 = 9.12·285 = 2599 — crude but FINE (budget has 14600 slack). IIMaj ≤ 2600 via e^{−as} ≤ 1, e^{−bs} ≤ 1, s+1 ≤ 285. EASY.
Wait, even easier: IIMaj n = psiTilde (√n) via IIMaj_eq_psiTilde_sqrt; psiTilde s = 4.56·((s+1)·(e^{−as}+e^{−bs})) ≤ 4.56·(s+1)·2 with s = √80000 ≤ 283 ⟹ ≤ 4.56·284·2 = 2590.1. ✓ (Need e^{−iimA·s} ≤ 1: exponent −iimA·s ≤ 0 since iimA > 0, s ≥ 0 ✓ Real.exp_le_one_iff.mpr (by positivity/nonpos).)
- Sum: Bn ≤ 523.4 + 127757.2 + 53.408 + 196101.6 + 2600 + 1 = 327036.6. Then margin ≥ 337000.9 − 327036.6 + 1 = 9965.3 > 0 ✓✓ COMFORTABLE.
For hbase2: margin(80000) < margin(100000):
margin(100000) ≥ slower(100000) − Bn(100000) + 1:
- slower(100000) = 50000·log 100000 − 1.41894·100000 − 4: log 100000 = log 10^5 = 5 log 10 = 11.5129. Lower bound log 100000 ≥ 11.5: 100000 ≥ e^11.5 = e^11·e^0.5: e^11 ≤ 59874.2; e^0.5 ≤ 1/(1−0.5/8)^8 = 1/(0.9375)^8 = 1/0.5967 = 1.6759; e^11.5 ≤ 59874.2·1.6759 = 100344 > 100000 ✗ FAILS. More terms: e^0.5 ≤ 1/(1−0.5/16)^16 = 1/(0.96875)^16 = 1/0.6008 = 1.6644; 59874.2·1.6644 = 99649 ≤ 100000 ✓ margin 0.35%. Hmm the 1/(1−x/k)^k trick with k = 16. Or prove e^0.5 ≤ 1.6644 directly: e^0.5 = 1/e^{−0.5}; e^{−0.5} ≥ 1 − 0.5 + 0.125 − 0.0208 + ... alternating bounds for NEGATIVE argument — Mathlib? Real.exp_neg... there's no alternating series lemma readily. The 1/(1−x/k)^k route: exp(x) = (exp(x/k))^k ≤ (1/(1−x/k))^k uses exp(y) ≤ 1/(1−y) for y < 1 (from exp(−y) ≥ 1−y i.e. Real.add_one_le_exp (−y)... `Real.add_one_le_exp : x + 1 ≤ Real.exp x`? I believe Mathlib has `Real.add_one_le_exp (x : ℝ) : x + 1 ≤ Real.exp x`. Then exp(−y) ≥ 1 − y > 0 for y < 1 ⟹ exp y = 1/exp(−y) ≤ 1/(1−y) (Real.exp_neg, one_div_le_one_div...). And (exp(x/k))^k = exp x via Real.exp_nat_mul (x/k · k = x). So: exp(0.5) = (exp(0.5/16))^16 ≤ (1/(1−0.03125))^16 = (1/0.96875)^16 = (32/31)^16. (32/31)^16 ≤ 1.6644? 32/31 = 1.032258; ^16: ln = 16·0.03175 = 0.508; e^0.508 = 1.6620. So (32/31)^16 ≈ 1.6620 ≤ 1.6644 ✓ margin 0.14% — tight for norm_num? (32/31)^16 exact rational compared to 1.6644 — norm_num should evaluate pow of rational fine. margin 0.14% OK since exact.
Then e^11.5 ≤ 59874.2·1.6644 = 99648.6 ≤ 100000 ✓ margin 0.35%. So log 100000 ≥ 11.5 ✓.
slower(100000) ≥ 50000·11.5 − 1.41894·100000 − 4 = 575000 − 141894 − 4 = 433102. (True slower(100000) = 50000·11.5129 − 141898 ≈ 433747.)
Hmm wait — I need (1+log 2+log π)/2·n upper: (1 + 0.6931472 + 1.1447299)/2 = 1.4189386; ×100000 = 141893.86. slower ≥ 50000·11.5 − 141894 − 4 = 433102.
- Bn(100000) upper: T = √100000+1 = 317.23; T ≤ 318 (√100000 ≤ 317 ⟸ 100000 ≤ 317² = 100489 ✓; use T ≤ 318). log T ≤ log 318 ≤ 5.77 (318 ≤ e^5.77: e^5.77 = e^5·e^0.77: e^0.77 ≥ 1+.77+.29645+.0760883+.0146470+.0022496+.0002880 = 2.1597 (7 terms... compute: 1+0.77 = 1.77; +0.29645 = 2.06645; +0.07608833 = 2.14253833; +0.01464699 = 2.15718532; +0.00224959 = 2.15943491; +0.00028803 = 2.15972294); 148.328·2.1597 = 320.34 ≥ 318 ✓ 0.7% margin). Or just reuse log T ≤ 5.8 for comfort: e^5.8 = e^5·e^0.8; e^0.8 ≥ 1+.8+.32+.0853333+.0170667+.0027307+.0003641 = 2.2255; 148.328·2.2255 = 330.10 ≥ 318 ✓ 3.8%. Use log T ≤ 5.8; log log T ≤ log 5.8 ≤ 1.77 (5.8 ≤ e^1.77: e^1.77 = e·e^0.77 ≥ 2.71828·2.1597 = 5.8708 ≥ 5.8 ✓ 1.2%). And log(T+2) ≤ log 320 ≤ 5.8 (320 ≤ 330.1 ✓). log log(T+2) ≤ 1.77.
- FAlt(T) ≤ 0.159155·318·5.8 + 0.137·5.8 + 0.443·1.77 + 2.463 = 0.159155·1844.4 + 0.7946 + 0.7841 + 2.463 = 293.52 + 4.04 = 297.56. 2F ≤ 595.1.
- Ĉ₀ ≤ 0.433·5.8 + 0.886·1.77 + 2.9 = 2.5114 + 1.5682 + 2.9 = 6.9796.
- 4T·[...] ≤ 4·318·[(2/3)(6.9796) + 10.5·5.8 + 48] = 1272·[4.6531 + 60.9 + 48] = 1272·113.5531 = 144439.5.
- Ĥ ≤ 3·6.9796² + 60.9 + 48 = 3·48.715 + 108.9 = 146.15 + 108.9 = 255.05.
- 2(e⁴+1)(7Ĥ+3.3) ≤ 111.203·(7·255.05 + 3.3) = 111.203·1788.65 = 198893.9.
- 40·1.3352 = 53.408; IIMaj ≤ 4.56·319·2 = 2909.3; +1.
- Bn ≤ 595.1 + 144439.5 + 53.4 + 198893.9 + 2909.3 + 1 = 346892.2.
- margin(100000) ≥ 433102 − 346893 + 1 = 86210. (True ≈ 93000.) ✓
- margin(80000) ≤ ?: slower(80000) ≤ 40000·log 80000 − 113511.9 − 4 with log 80000 ≤ 11.30 (80000 ≤ e^11.3? e^11.3 = e^11·e^0.3: e^0.3 ≤ (1/(1−0.3/16))^16 = (1/0.98125)^16 = (1.018987)^16 ≈ 1.3512 (16·ln(1.018987) = 16·0.018809 = 0.30095; e^0.30095 = 1.3512); 59874.2·1.3512 = 80906 ≥ 80000 ✓ 1.1% margin). So log 80000 ≤ 11.3; slower ≤ 40000·11.3 − 40000·(1+0.6931471+1.1447298)/2 − 4: lower bound on (1+log2+logπ)/2: log 2 ≥ 0.6931471, log π ≥ 1.1447298 (need LOWER bound on log π: π ≥ 3.1415926535 ⟹ log π ≥ log 3.1415926535 ≥ 1.1447 ⟸ 3.1415926535 ≥ e^1.1447: e^1.1447 = e·e^0.1447: e^0.1447 ≥ 1+.1447+.010469+... = 1.1558; 2.71828·1.1558 = 3.1418 ≥ 3.14159 ✓ 0.007% — VERY tight. Use log π ≥ 1.1447 with more terms: e^0.1447 partial 7 terms: 1+0.1447+0.010469+0.00050487+0.00001826+0.00000053 = 1.15569266... hmm compute: x=0.1447: x²/2 = 0.010469; x³/6 = 0.000504869; x⁴/24 = 0.0000182638; x⁵/120 = 5.285e-7; x⁶/720 = 1.2747e-8. Sum: 1+0.1447+0.010469+0.000504869+0.0000182638+0.0000005285+0.0000000127 = 1.15569267. ×e: 2.7182818283·1.15569267 = 3.14175... compute: 2.7182818283·1.15569267 ≈ 3.141752. vs π ≥ 3.1415926535: 3.1415926 ≤ 3.141752 ≤ e^1.1447 ✓ margin 0.005%. Tight but exact-rational OK. Hmm — this precision is fine for norm_num? The comparison 2.7182818283·1.15569267 ≥ 3.1415926535 is exact decimal arithmetic ✓.)
This is getting REALLY fiddly with tight margins. Let me RELAX: for margin(80000) upper I don't need tightness at all — budget: margin(80000) ≤ 86209 (to be < margin(100000) ≥ 86210). True margin(80000) = 15764 — slack 70000! So crude: slower(80000) ≤ 40000·11.3 − 4 (just drop the negative term? NO — slower = 40000·log 80000 − 1.4189·80000 − 4; the −1.4189·80000 term is NEGATIVE so for an UPPER bound on slower I need a LOWER bound on 1.4189 = (1+log2+logπ)/2 — or just use (1+log2+logπ)/2 ≥ (1+0+1)/2 = 1 (log 2 ≥ 0, log π ≥ 1 ⟸ π ≥ e: 3.14159 ≥ 2.7183 ✓ EASY). So slower(80000) ≤ 40000·11.3 − 1·80000 − 4 = 452000 − 80004 = 371996.
Bn(80000) ≥ ?: every term of Bn is POSITIVE: 2F(T) — F(T) = (1/2π)T log T + ... ≥ 0 for T ≥ 1 ✓; 4T[...] ≥ 0 ✓; so Bn ≥ 0 crudely, or Bn ≥ 40·1.3352 = 53.4. margin(80000) ≤ 371996 − 0 + 1 = 371997. Is 371997 < margin(100000) ≥ 86210? NO! 371997 > 86210 ✗. Crude upper on margin(80000) exceeds crude lower on margin(100000). Need SOME care: margin(80000) upper ≤ 86210 needs slower ≤ Bn + 86209: slower ≤ 40000·11.3 − 80004 = 371996 needs Bn(80000) ≥ 285787. Bn lower bound: Bn ≥ 4T[(2/3)Ĉ₀ + 10.5 log(T+2) + 48] with T ≥ 283 (√80000 ≥ 283 ⟸ 283² = 80089 ≥ 80000... NO: √80000 ≥ 283 ⟺ 80000 ≥ 283² = 80089 ✗ FALSE! √80000 = 282.84 < 283. T ≥ 282: 282² = 79524 ≤ 80000 ✓). T ≥ 283.8? use T ≥ 283 (282.84+1 = 283.84 ≥ 283 ✓). log(T+2) ≥ log 285 ≥ ? log 285 ≥ 5.65 (285 ≥ e^5.65: e^5.65 ≥ 148.328·1.9155(7-term e^0.65) = 284.1 ≤ 285 ✓ 0.3% margin — meh. e^0.65 8 terms: +x⁷/5040 = 0.65^7/5040 = 0.0490/5040 = 9.7e-6 → 1.9155 same to 4 digits. 284.11 ≤ 285 ✓ 0.3%.) OK log 285 ≥ 5.65. Ĉ₀ ≥ 0.433·5.65 + 0 + 2.9 = 5.347 (log log ≥ 0 since log(T+2) ≥ 5.65 > 1 ⟹ log log ≥ log 5.65... log log(T+2) ≥ 0 ⟸ log(T+2) ≥ 1 ✓). 4T[...] ≥ 4·283·[(2/3)(5.347) + 10.5·5.65 + 48] = 1132·[3.565 + 59.325 + 48] = 1132·110.89 = 125527. Bn ≥ 125527 + (other positive terms ≥ 0... plus 40·1.3352 ≥ 53). margin(80000) ≤ 371996 − 125527 + 1 = 246470. Still > 86210 ✗✗.
The problem: my slower(80000) UPPER bound is loose (log 80000 ≤ 11.3 vs true 11.2898 is fine; the −1.4189n ≥ −n·1 relaxation loses 0.4189·80000 = 33512!). Need the (1+log2+logπ)/2 ≥ 1.41 lower bound: (1 + 0.6931471 + 1.1447298)/2 = 1.41893855 — need log π ≥ 1.1447-ish. That's the tight e^1.1447 ≥ π computation. Alternatively log π ≥ 1.14: e^1.14 ≥ π? e^1.14 = e·e^0.14: e^0.14 ≥ 1+0.14+0.0098+0.000457+0.000016 = 1.150273; 2.71828·1.150273 = 3.1269 < 3.14159 ✗ FALSE direction: log π ≥ 1.14 ⟺ π ≥ e^1.14 ⟸ 3.1415926 ≥ e^1.14: need e^1.14 ≤ 3.1415926: e^1.14 ≤ e·[upper e^0.14]: upper e^0.14 = 1/(1−0.14/16)^16 = (1/0.99125)^16 = (1.008827)^16 ≈ 1.1509 (16 ln(1.008827) = 16·0.008788 = 0.14061, e^0.14061 = 1.1510). e^1.14 ≤ 2.7182818·1.1510 = 3.1289 ≤ 3.1415926 ✓ 0.4% margin ✓. So log π ≥ 1.14, giving (1+log2+logπ)/2 ≥ (1+0.6931471+1.14)/2 = 1.41657355; slower(80000) ≤ 40000·11.3 − 1.41657355·80000 − 4 = 452000 − 113325.9 − 4 = 338670.1. margin(80000) ≤ 338670.1 − 125527 + 1 = 213144. STILL > 86210 ✗.
Grr — the Bn(80000) lower bound 125527 is too weak (true Bn = 322309; the big missing piece: 2(e⁴+1)(7Ĥ+3.3) ≈ 194604 — its lower bound: Ĥ ≥ 3Ĉ₀² + 10.5·5.65 + 48 ≥ 3·28.59 + 59.325 + 48 = 193.1; 2(e⁴+1) ≥ 2(54.598+1) = 111.196 (e⁴ ≥ 2.71828^4 = 54.5978); 7Ĥ+3.3 ≥ 1355.0; → 2(e⁴+1)(7Ĥ+3.3) ≥ 111.196·1355.0 = 150671. Bn ≥ 125527 + 150671 + 53 = 276251. margin(80000) ≤ 338670 − 276251 + 1 = 62420 < 86210 ✓✓ FINALLY.
So hbase2 needs two-sided bounds with e⁴ lower (easy: (2.7182818283)^4 = 54.59781 via pow), log 285 ≥ 5.65, log π ≥ 1.14, etc. All OK but the proof is LONG.
Total assessment for 12.2 full discharge: ~500-700 lines of tight numeric Lean. That's a big chunk — realistically its own sub-stage. The session has already delivered the core milestone (committed). Per pacing rules (NO RUSH; sub-stages clean), the right move:
1. Do the secant two-point variant NOW (cheap, removes deriv hypothesis — cleaner interim signature: hbase, hbase2 are then both plain function evaluations, ready for the numeric grind).
2. Write D-062 triage (the notes' step-2 design decision — the deliberation the notes ASK for: where to draw the Trudgian perimeter).
3. Session protocol (journal, STATE, db, NGUYEN.md, commit).
4. Leave the numeric discharge of hbase/hbase2 as the precisely-scoped next sub-stage (with the sizing computations above recorded in D-062 or the journal — the bound values I worked out: log 80000 ∈ [11.263, 11.3], log T ≤ 5.7/5.8 grids, etc.).
Hmm wait — actually, should I do the secant variant at all? It changes SfBoundProp's range to start at 100000 and the theorem signature to (hbase)(hbase2). The current committed version uses hbase + hbase′ (derivative). The two-point version is strictly easier to discharge later (two evals vs eval + derivative machinery). Yes, do it — it's 30 lines.
Also actually — wait. Reconsider: maybe keep it even simpler. Since hfinite covers n ≤ 500000 anyway, why not push the margin regime to start at 500000 and pick base points at 500000/500001+? No — margin argument needs n ≥ N₁ point... the two-point version needs x ≥ N₁ = second point. If I set N₀ = 80000, N₁ = 100000, margin regime [100000, ∞). Finite covers < 100000 ✓ (100000 ≤ 500000 ✓). Fine as planned.
Let me also double check pos_of_convex_of_two_points handles x ∈ [N₁, ∞): yes with hx : N₁ ≤ x.
And in the assembly, the split becomes: n < 100000 → hfinite (n ≤ 99999 → n ≤ 500000 ✓ omega); n ≥ 100000 → margin with hge : 100000 ≤ n → (100000:ℝ) ≤ (n:ℝ) ✓ exact_mod_cast.
SfBoundProp: ∀ n, 100000 ≤ n → (n:ℝ) ≤ (3*10^12−1)^2 → |Sf n| ≤ Bn FAlt n.
Hmm — wait, one consideration: the eventual SfBound proof for n ∈ [100000, N₁]. The D-037 B(n) bound derivation assumed n ≥ 20-ish (T ≥ √20+1 for the block table; n ≥ 100000 ⟹ T ≥ 317 ✓ fine).
Now — the assembly proof also needs updating: pos_of_convex_of_base → two-point version. hdiffM no longer needed! (Two-point version needs only convexity.) Simpler.
Let me implement:
1. Add pos_of_convex_of_two_points after pos_of_convex_of_base (keep both — pos_of_convex_of_base is proved and may be useful; actually delete it? It becomes unused... keep both is fine — no, unused proved lemmas are harmless but the audit rule says every claim tagged; it's fine. Hmm — minimalism: the derivative version might still be useful if someone discharges hbase′ instead. Keep both, note in comment.)
Actually — decision: keep pos_of_convex_of_base (proved, harmless), add two-point variant, switch the main theorem.
2. Change SfBoundProp 80000 → 100000.
3. Change main theorem: hypotheses (hbase : 0 < marginTilde FAlt 80000) (hbase2 : marginTilde FAlt 80000 < marginTilde FAlt 100000); split at 100000.
Then compile, audit, commit. Then D-062 triage + session protocol.
Also update the hbase/hbase′ doc references in §4 header comment.
`ConvexOn.slope_mono_adjacent` confirmed. Implementing the two-point variant (drops the derivative hypothesis — both remaining facts become plain function evaluations, the cheapest possible numeric obligation).
tool: Edit
input
{
"file_path": "D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiSkeleton.lean",
"old_string": "/-- [PROVED session 012 \u2014 TIER (ii) STEP 1, assembly modulo `SfBoundProp`]",
"new_string": "/-- [PROVED session 012] Convexity + f(N\u2080) > 0 + f(N\u2081) > f(N\u2080) \u27f9\npositivity on [N\u2081, \u221e) (three-chord secant monotonicity; the increasing\nsecant slope is positive, so f keeps climbing). Cheaper to discharge than\nthe derivative base point: two plain evaluations, no deriv machinery. -/\ntheorem pos_of_convex_of_two_points {f : \u211d \u2192 \u211d} {a N\u2080 N\u2081 x : \u211d}\n (hconv : ConvexOn \u211d (Set.Ici a) f)\n (hN : a < N\u2080) (hN01 : N\u2080 < N\u2081) (hx : N\u2081 \u2264 x)\n (h0 : 0 < f N\u2080) (h01 : f N\u2080 < f N\u2081) :\n 0 < f x := by\n rcases eq_or_lt_of_le hx with heq | hlt\n \u00b7 rw [\u2190 heq]\n linarith\n \u00b7 have hslope := hconv.slope_mono_adjacent\n (Set.mem_Ici.mpr (le_of_lt hN)) (Set.mem_Ici.mpr (by linarith)) hN01 hlt\n have hp1 : (0 : \u211d) < N\u2081 - N\u2080 := by linarith\n have hp2 : (0 : \u211d) < x - N\u2081 := by linarith\n have hs : (0 : \u211d) < (f N\u2081 - f N\u2080) / (N\u2081 - N\u2080) := div_pos (by linarith) hp1\n have hs2 : (0 : \u211d) < (f x - f N\u2081) / (x - N\u2081) := lt_of_lt_of_le hs hslope\n have hfx : (0 : \u211d) < f x - f N\u2081 := (div_pos_iff_of_pos_right hp2).mp hs2\n linarith\n\n/-- [PROVED session 012 \u2014 TIER (ii) STEP 1, assembly modulo `SfBoundProp`]"
}
raw content_json (database row)
[{"type":"thinking","thinking":"`ConvexOn.slope_mono_adjacent (hf) (hx : x ∈ s) (hz : z ∈ s) (hxy : x < y) (hyz : y < z) : (f y − f x)/(y − x) ≤ (f z − f y)/(z − y)` — exactly the three-chord lemma. \n\npos_of_convex_of_two_points:\n```\ntheorem pos_of_convex_of_two_points {f : ℝ → ℝ} {a N₀ N₁ x : ℝ}\n (hconv : ConvexOn ℝ (Set.Ici a) f)\n (hN : a < N₀) (hN01 : N₀ < N₁) (hx : N₁ ≤ x)\n (h0 : 0 < f N₀) (h01 : f N₀ < f N₁) :\n 0 < f x := by\n rcases eq_or_lt_of_le hx with heq | hlt\n · rw [← heq]; linarith\n · have hslope := hconv.slope_mono_adjacent\n (Set.mem_Ici.mpr (le_of_lt hN)) -- N₀ ∈ Ici a\n (Set.mem_Ici.mpr (by linarith)) -- x ∈ Ici a\n hN01 hlt\n -- (f N₁ − f N₀)/(N₁ − N₀) ≤ (f x − f N₁)/(x − N₁)\n have hp1 : (0:ℝ) < N₁ - N₀ := by linarith\n have hp2 : (0:ℝ) < x - N₁ := by linarith\n have hs : (0:ℝ) < (f N₁ - f N₀)/(N₁ - N₀) := div_pos (by linarith) hp1\n have hs2 : (0:ℝ) < (f x - f N₁)/(x - N₁) := lt_of_lt_of_le hs hslope\n have hfx : (0:ℝ) < f x - f N₁ := (div_pos_iff_of_pos_right hp2).mp hs2\n linarith\n```\nWait — slope_mono_adjacent hx hz needs x,z ∈ s (the endpoints), y free. With x := N₀, y := N₁, z := x: (f N₁ − f N₀)/(N₁ − N₀) ≤ (f x − f N₁)/(x − N₁) ✓.\n\nN₀ ∈ Ici a: le_of_lt hN (a < N₀ ⟹ a ≤ N₀) ✓. x ∈ Ici a: a < N₀ < N₁ ≤ x ✓ linarith.\n\nThen the main theorem's hypotheses become:\n(hbase : 0 < marginTilde FAlt 80000) (hbase2 : marginTilde FAlt 80000 < marginTilde FAlt 100000)\n\nand in the proof replace pos_of_convex_of_base with pos_of_convex_of_two_points:\n```\nhave h5 : 0 < marginTilde FAlt (n : ℝ) :=\n pos_of_convex_of_two_points\n (marginTilde_convex FAlt contDiffOn_FAlt FAlt_psi_neg)\n (by norm_num) (by norm_num) (by exact_mod_cast hge') hbase hbase2\n```\nwhere the case split: n < 80000 (finite) / n ≥ 80000. For two-point: need n ≥ N₁ = 100000 for the slope argument... NO wait — pos_of_convex_of_two_points as stated needs x ≥ N₁. But we need positivity for n ∈ [80000, 100000) too! For n ∈ [80000, 100000]: margin(n) ≥ ? Convexity doesn't give positivity between the points from these two facts alone... Hmm — actually YES it does: f convex, f(N₀) > 0, f(N₁) > f(N₀): for x ∈ [N₀, N₁]: hmm, convex functions can dip below... NO: convex + f(N₀) > 0 + f(N₁) > f(N₀) ⟹ for x ∈ (N₀, N₁): f(x) ≤ max? convex gives upper bound on the segment, not lower! f could dip below f(N₀) inside. Counterexample: f(x) = (x−N₀)(N₁−x)·(−1)... no that's concave. Convex: f(x) = f(N₀) + s(x−N₀) + g(x) with g convex, g(N₀) = 0, s > 0... f could still dip then rise: f(x) = (x−1)² on [0,2]: f(0) = 1, f(2) = 1 — not increasing. Take f(0) = 1, f(2) = 3, convex, but f(0.5) = 0? f(x) = 1 − 2x + 2x²: f(0)=1, f(2)=5>1, f(0.5) = 1−1+0.5 = 0.5 > 0. Try f(x) = 1 − 3x + 3x²: f(0) = 1, f(0.5) = 1 − 1.5 + 0.75 = 0.25 > 0. f(x) = 1 − 4x + 4x²: f(0)=1, f(2) = 9 > 1, f(0.5) = 0. NOT > 0! So convex + two points does NOT give positivity between. I need x ≥ N₁ (after the second point, slopes ⟹ increasing ⟹ positive), and for [N₀, N₁] I need... the DERIVATIVE version had the same issue? No — the deriv version: f′(N₀) > 0 + convex ⟹ f′ ≥ 0 on [N₀,∞) ⟹ f increasing on [N₀,∞) ⟹ f(x) ≥ f(N₀) > 0 for ALL x ≥ N₀. The deriv version is STRICTLY stronger!\n\nSo two-point version covers only n ≥ 100000; for 80000 ≤ n < 100000 I'd need... hfinite covers n ≤ 5×10⁵ = 500000 ⊇ [80000, 100000)! Of course — the finite verification overlaps up to 5×10⁵. So: split at 100000: n < 100000 → hfinite (n ≤ 99999 ≤ 500000 ✓); n ≥ 100000 → two-point convex argument with N₀ = 80000, N₁ = 100000. Then SfBoundProp range starts at 100000. Hmm — but SfBoundProp currently starts at 80000. Change to 100000? The contour bound holds there too (B is even more comfortably valid). But hmm — the bridge N₁ and margins: margin needed only for n ≥ 100000 then. The base points: margin(80000) > 0 AND margin(100000) > margin(80000). Fine.\n\nWait, actually simpler: N₀ = 80000, N₁ = 100000 — hfinite covers to 500000 anyway, so why not just split at 80000 as now, and handle [80000, 100000] ALSO by hfinite? The three regimes:\n- n < 100000: hfinite (needs n ≤ 500000: n ≤ 99999 ✓).\n- n ≥ 100000: margin argument (convex + two points).\nSfBoundProp range: [100000, N₁_target]. Consistent.\n\nHmm, but hold on — is it cleaner to keep SfBoundProp from 80000? The eventual SfBound proof will handle all n ≥ 80000 or 100000 — either fine. Choose 100000 = N₁ (call it N₁_eval... no, N₁ is taken = (T₀−1)²; call the second point N₂ = 100000).\n\nNow — the numeric discharge itself (hbase, hbase2 as PROVED theorems):\n\nTheorem base₁ : 0 < marginTilde FAlt 80000.\nProof: marginTilde FAlt 80000 = sInftyLower 80000 − Bn FAlt 80000 + 1 (marginTilde_eq_sub).\n- slower(80000) ≥ 337000: unfold sInftyLower lagariasC1; γ cancels (ring_nf to expose): slower(80000) = (1/2)(80000) log 80000 − ((1 + log 2 + log π)/2)·80000 − 4. Need: log 80000 ≥ 11.263 (say) and log 2 ≤ 0.6932, log π ≤ 1.1448 (Mathlib: Real.log_pi_gt/lt? There are Real.log_pi lemmas? I don't remember d9 for π. log π: π ≤ 3.15 ⟹ log π ≤ log 3.15 ≤ ... e^1.1448 ≥ 3.1416? partial sums. Or Real.log_pi_lt_d9? Let me grep for log_pi bounds in Mathlib.)\n With log 80000 ≥ 11.263, log 2 ≤ 0.6931472, log π ≤ 1.14473: slower ≥ 40000·11.263 − 40000·(1 + 0.6931472 + 1.14473) − 4 = 450520 − 40000·2.8378772 − 4 = 450520 − 113515.1 − 4 = 337000.9 ≥ 337000 ✓.\n- Bn FAlt 80000 ≤ 321237 + ... let me budget: need Bn ≤ 337001 (to get margin ≥ 337000 − 337001 + 1 = 0)... cutting too close! slower ≥ 337000.9 and margin = slower − Bn + 1 > 0 needs Bn < 337001.9. TRUE Bn = 322309 — so Bn ≤ 337000 has 14691 slack ✓ but I need my upper-bound ESTIMATE of Bn to land below 337001. My bounding error budget for Bn: ~14600. Bn pieces (true values): T = 283.84; 2FAlt(T) = 517.8; 4T·[...] = 127132; 40·1.3352 = 53.4; 2(e⁴+1)(7Ĥ+3.3) = 194604; IIMaj ≈ tiny; +1. Sum 322309.\n Upper bounds needed: T ≤ 284 (via √80000 ≤ 283: 80000 ≤ 283² = 80089 ✓ — Real.sqrt_le' or le_sqrt... `Real.sqrt_le' : 0 < y → (√x ≤ y ↔ x ≤ y^2)`? or Real.sqrt_le_sqrt (80000 ≤ 80089) then √80089 = 283 (Real.sqrt_eq_cases? norm_num can do √80089 = 283? Real.sqrt_eq_iff... there's a norm_num extension for sqrt of squares? `Real.sqrt_eq_cases`... simplest: √80000 ≤ 283 ⟺ (Real.sqrt_le_iff ...). Use: Real.sqrt_le' (by norm_num : (0:ℝ) < 283) — gives √80000 ≤ 283 ↔ 80000 ≤ 283^2 — mpr with norm_num 80000 ≤ 80089 ✓.)\n - log T ≤ log 284 ≤ 5.66 (via 284 ≤ e^5.66 — partial-sum lower bound on exp: e^5.66 = e^5·e^0.66; e^5 ≥ (2.7182818283)^5 via pow (Real.exp_one_gt_d9) — 2.7182818283^5 = 148.328...; e^0.66 ≥ Σ_{i<7} 0.66^i/i! = 1+0.66+0.2178+0.047916+0.0079061+0.0010435+0.0001147 = 1.9347803+... let me compute: 1+0.66 = 1.66; +0.2178 = 1.8778; +0.047916 = 1.925716; +0.00790614 = 1.93362214; +0.00104361 = 1.93466575; +0.00011477 = 1.93478052. → 1.9348. e^5.66 ≥ 148.328·1.9348 = 286.98 ≥ 284 ✓ margin 1%.). In Lean: Real.log_le_log (by positivity : 0 < 284...) hmm direction: log T ≤ 5.66 ⟸ T ≤ 284 (log mono) and 284 ≤ exp 5.66 ⟹ log 284 ≤ log (exp 5.66) = 5.66 (Real.log_le_log + Real.log_exp). Chain: T ≤ 284 → log T ≤ log 284; log 284 ≤ 5.66 from 284 ≤ Real.exp 5.66 via Real.log_le_log (exp_pos) h → log 284 ≤ log (exp 5.66) = 5.66. Where 284 ≤ exp 5.66: exp 5.66 = exp(5 + 0.66)... 5.66 = 5 + 0.66: Real.exp_add: exp 5.66 = exp 5 * exp 0.66. exp 5 = (exp 1)^5: Real.exp_nat? Real.exp 5 = Real.exp (5:ℝ)... exp 5 = (exp 1)^5? Real.exp_nat_cast? There's `Real.exp_nat` hmm: Real.exp (5:ℕ) = (exp 1)^5 — `Real.exp_nat (x : ℝ) (n : ℕ) : Real.exp (n * x) = (Real.exp x)^n`? I recall `Real.exp_nat_mul`... There's Real.exp_int... For 5: Real.exp 5 — 5 as ℝ. exp 5 = exp(1+1+1+1+1) = (exp 1)^5 via repeated exp_add — or `Real.exp_nat_cast`: exp(↑n) = (exp 1)^n? I'm fairly sure there's something like `Real.exp_natCast` or do it via Real.exp_add manually. And 5.66 = 5 + 0.66 by norm_num ring_nf. Feasible.\n - log log T ≤ log 5.66 ≤ 1.74 (5.66 ≤ e^1.74: e^1.74 = e·e^0.74; e^0.74 ≥ Σ_{i<7}: 1+0.74+0.2738+0.067537+0.012494+0.0018487+0.0002280 = 2.0957; ×2.71828 = 5.6959 ≥ 5.66 ✓ margin 0.6% — tightish; use 1.75: e^0.75 partial: 1+.75+.28125+.0703125+.0131836+.0019775+.0002473 = 2.1170; ×2.71828 = 5.7546 ≥ 5.66 ✓ 1.7%. Use 1.75.) So log log T ≤ 1.75 (needs log T ≤ 5.66 first, then log mono: log log T ≤ log 5.66 ≤ 1.75).\n \n Now Bn upper assembly (each factor bounded above, all positive):\n - T ≤ 284, log T ≤ 5.66, log log T ≤ 1.75, log(T+2) ≤ log 286 ≤ 5.66 (286 ≤ e^5.66 = 286.98 ✓ margin 0.3% — TOO tight! e^5.66 lower bound was 286.98 vs 286: margin 0.34%. Hmm — risky for norm_num precision. My exp lower bounds are themselves lower bounds: e^5.66 ≥ 148.328·1.9348 = 286.98 — the true e^5.66 = 287.10. So 286 ≤ 286.98 ≤ e^5.66 ✓ with the CERTIFIED lower bound 286.98 > 286 — margin 0.98/286.98 = 0.34% — workable since all my numbers are exact rationals: 148.328·1.9348 — but wait, the CERTIFIED pieces: e^5 ≥ 2.7182818283^5 — this is an exact rational computation: 2.7182818283^5 = 148.32785...; e^0.66 ≥ 1.93478052 (partial sum, exact rational); product ≥ 286.98... exact rational arithmetic — norm_num handles ✓. The margin is genuinely 0.34% — fine for exact rational comparison.)\n \n Hmm wait — actually let me recompute more carefully to pick comfortable constants. Let me just do a Python sizing pass computing each needed bound with my chosen certified constants, to make sure every inequality has ≥ 0.3% margin. Then write the Lean.\n\n Actually, alternative simplification: use log T ≤ 5.7 for everything (T + 2 ≤ 286 ≤ e^5.7): e^5.7 = e^5·e^0.7: e^0.7 ≥ 1+0.7+0.245+0.0571667+0.0100042+0.0014006+0.0001634 = 2.0139 (7 terms); 148.328·2.0139 = 298.72 ≥ 286 ✓ 4.5% margin ✓✓. And log log T: log T ≤ 5.7; log 5.7 ≤ 1.75 (5.7 ≤ 5.7546 ✓ 1%). ✓ Use log T ≤ 5.7, log log T ≤ 1.75 uniformly.\n\n Then:\n - FAlt(T) ≤ (1/(2π))·284·5.7 + 0.137·5.7 + 0.443·1.75 + (7/8 + 1.588). Need 1/(2π) bounds: π ≥ 3.1415 (Real.pi_gt_d9: 3.141592653 < π? Mathlib Real.pi_gt_d9 : 3.1415926535 < Real.pi; Real.pi_lt_d9 : π < 3.1415926536). 1/(2π) ≤ 1/(2·3.1415926535) = 1/6.283185307 ≤ 0.159155. So FAlt(T) ≤ 0.159155·284·5.7 + 0.7809 + 0.77525 + 2.463 = 0.159155·1618.8 + 4.019 = 257.667 + 4.019 = 261.69. 2F ≤ 523.4.\n - Ĉ₀(T) = 0.433·log(T+2) + 0.886·log log(T+2) + 2.9: log(T+2) ≤ 5.7 (T+2 ≤ 286 ✓), log log(T+2) ≤ 1.75 (log(T+2) ≤ 5.7 ⟹ log log ≤ log 5.7 ≤ 1.75 ✓). Ĉ₀ ≤ 0.433·5.7 + 0.886·1.75 + 2.9 = 2.4681 + 1.5505 + 2.9 = 6.9186.\n - 4T·[(2/3)Ĉ₀ + 10.5 log(T+2) + 48] ≤ 4·284·[(2/3)(6.9186) + 10.5·5.7 + 48] = 1136·[4.6124 + 59.85 + 48] = 1136·112.4624 = 127757.2.\n - Ĥ(T) = 3Ĉ₀² + 10.5 log(T+2) + 48 ≤ 3·6.9186² + 59.85 + 48 = 3·47.867 + 107.85 = 143.60 + 107.85 = 251.45.\n - 2(e⁴+1)·[7Ĥ + 3.3]: e⁴ ≤ 2.7182818286^4 = 54.6015 (norm_num); e⁴+1 ≤ 55.6015; 7Ĥ+3.3 ≤ 7·251.45 + 3.3 = 1763.45; 2·55.6015·1763.45 = 111.203·1763.45 = 196101.6.\n - 40·1.3352 = 53.408.\n - IIMaj(80000) ≤ 1 (tiny, ~e^{−0.886·282.8}·poly ≈ 0 — but need a Lean bound: IIMaj n = 2(√n+1)(e^{√n/2}+1)·0.57·2^{−(2√n−2)}. Bound: 2^{−(2√n−2)} ≤ 1 and... no — need small? For the UPPER bound of Bn just need IIMaj ≤ something small-ish; crude: 2^{−(2√n−2)} ≤ 2^{−564} (tiny) but proving... simpler crude: IIMaj(80000) ≤ 2(284)(e^{142}+1)·0.57·2^{−564}... e^{142} is astronomically larger than 2^{564} = e^{391}... so IIMaj ≤ huge unless handled as a ratio. IIMaj = 2.28(s+1)(e^{s/2}+1)·2^{−(2s−2)} with s = √80000 ∈ [282, 284]: = 2.28·285·(e^{142}+1)·2^{−562} hmm. (e^{142}+1)·2^{−562} = e^{142}·2^{−562} + 2^{−562} = 2^{142/log... e^{142} = 2^{142/ln2} = 2^{204.85} so product = 2^{204.85−562} + 2^{−562} = 2^{−357} tiny. Proving THAT in Lean: need e^{142} ≤ 2^{205} ⟺ 142 ≤ 205 log 2 = 205·0.69315 = 142.09 ✓ (margin 0.06% — tight! log 2 lower: 0.69314718; 205·0.69314718 = 142.0952 ≥ 142 ✓ 0.07%). So e^{142} ≤ 2^{205} via Real.exp 142 ≤ (2^205 : ℝ)... exp 142 vs 2^205: take logs: 142 ≤ 205 log 2 ⟸ log 2 ≥ 142/205 = 0.69268 — have log 2 ≥ 0.6931471803 ✓. Formalize: (142 : ℝ) ≤ 205 * Real.log 2 (norm_num with Real.log_two_gt_d9); then Real.exp 142 ≤ Real.exp (205 log 2) = 2^205 (Real.exp_log of 2^205 > 0; need (2:ℝ)^205 = Real.exp (205 log 2): Real.exp (205 * log 2) = (exp (log 2))^205 = 2^205 via Real.exp_nat_mul? Real.exp_nat_mul : Real.exp (n * x) = (Real.exp x)^n ✓ probably exists). Then IIMaj ≤ 2·285·(2^205 + 1)·0.57·2^{−562}... 2^{−562}·2^{205} = 2^{−357}: rpow/pow algebra: (2:ℝ)^{−562} — the IIMaj def uses 2 ^ (-(2*√n−2)) as ℝ rpow? In IIMaj: `2 ^ (-(2 * Real.sqrt n - 2))` — exponent is ℝ so it's rpow (via ↑). The bookkeeping: 2^{−(2s−2)} = 4·(2^{−2})^s... this was handled in IIMaj_eq_psiTilde_sqrt. For the bound, work with psiTilde form: IIMaj n = psiTilde (√n) = 4.56(s+1)(e^{−as} + e^{−bs}) ≤ 4.56·285·(e^{−0.886·282} + tiny) ≤ 4.56·285·2·e^{−249.9} — astronomically small; Lean bound: e^{−as} ≤ 1 for as ≥ 0 ✓ TRIVIAL: e^{−a s} ≤ 1 (Real.exp_neg... exp of nonpositive ≤ 1: Real.exp_le_one_iff). So psiTilde(s) ≤ 4.56(s+1)·2 = 9.12·285 = 2599 — crude but FINE (budget has 14600 slack). IIMaj ≤ 2600 via e^{−as} ≤ 1, e^{−bs} ≤ 1, s+1 ≤ 285. EASY. \n \n Wait, even easier: IIMaj n = psiTilde (√n) via IIMaj_eq_psiTilde_sqrt; psiTilde s = 4.56·((s+1)·(e^{−as}+e^{−bs})) ≤ 4.56·(s+1)·2 with s = √80000 ≤ 283 ⟹ ≤ 4.56·284·2 = 2590.1. ✓ (Need e^{−iimA·s} ≤ 1: exponent −iimA·s ≤ 0 since iimA > 0, s ≥ 0 ✓ Real.exp_le_one_iff.mpr (by positivity/nonpos).)\n\n - Sum: Bn ≤ 523.4 + 127757.2 + 53.408 + 196101.6 + 2600 + 1 = 327036.6. Then margin ≥ 337000.9 − 327036.6 + 1 = 9965.3 > 0 ✓✓ COMFORTABLE.\n\n For hbase2: margin(80000) < margin(100000):\n margin(100000) ≥ slower(100000) − Bn(100000) + 1: \n - slower(100000) = 50000·log 100000 − 1.41894·100000 − 4: log 100000 = log 10^5 = 5 log 10 = 11.5129. Lower bound log 100000 ≥ 11.5: 100000 ≥ e^11.5 = e^11·e^0.5: e^11 ≤ 59874.2; e^0.5 ≤ 1/(1−0.5/8)^8 = 1/(0.9375)^8 = 1/0.5967 = 1.6759; e^11.5 ≤ 59874.2·1.6759 = 100344 > 100000 ✗ FAILS. More terms: e^0.5 ≤ 1/(1−0.5/16)^16 = 1/(0.96875)^16 = 1/0.6008 = 1.6644; 59874.2·1.6644 = 99649 ≤ 100000 ✓ margin 0.35%. Hmm the 1/(1−x/k)^k trick with k = 16. Or prove e^0.5 ≤ 1.6644 directly: e^0.5 = 1/e^{−0.5}; e^{−0.5} ≥ 1 − 0.5 + 0.125 − 0.0208 + ... alternating bounds for NEGATIVE argument — Mathlib? Real.exp_neg... there's no alternating series lemma readily. The 1/(1−x/k)^k route: exp(x) = (exp(x/k))^k ≤ (1/(1−x/k))^k uses exp(y) ≤ 1/(1−y) for y < 1 (from exp(−y) ≥ 1−y i.e. Real.add_one_le_exp (−y)... `Real.add_one_le_exp : x + 1 ≤ Real.exp x`? I believe Mathlib has `Real.add_one_le_exp (x : ℝ) : x + 1 ≤ Real.exp x`. Then exp(−y) ≥ 1 − y > 0 for y < 1 ⟹ exp y = 1/exp(−y) ≤ 1/(1−y) (Real.exp_neg, one_div_le_one_div...). And (exp(x/k))^k = exp x via Real.exp_nat_mul (x/k · k = x). So: exp(0.5) = (exp(0.5/16))^16 ≤ (1/(1−0.03125))^16 = (1/0.96875)^16 = (32/31)^16. (32/31)^16 ≤ 1.6644? 32/31 = 1.032258; ^16: ln = 16·0.03175 = 0.508; e^0.508 = 1.6620. So (32/31)^16 ≈ 1.6620 ≤ 1.6644 ✓ margin 0.14% — tight for norm_num? (32/31)^16 exact rational compared to 1.6644 — norm_num should evaluate pow of rational fine. margin 0.14% OK since exact.\n Then e^11.5 ≤ 59874.2·1.6644 = 99648.6 ≤ 100000 ✓ margin 0.35%. So log 100000 ≥ 11.5 ✓.\n slower(100000) ≥ 50000·11.5 − 1.41894·100000 − 4 = 575000 − 141894 − 4 = 433102. (True slower(100000) = 50000·11.5129 − 141898 ≈ 433747.) \n \n Hmm wait — I need (1+log 2+log π)/2·n upper: (1 + 0.6931472 + 1.1447299)/2 = 1.4189386; ×100000 = 141893.86. slower ≥ 50000·11.5 − 141894 − 4 = 433102.\n \n - Bn(100000) upper: T = √100000+1 = 317.23; T ≤ 318 (√100000 ≤ 317 ⟸ 100000 ≤ 317² = 100489 ✓; use T ≤ 318). log T ≤ log 318 ≤ 5.77 (318 ≤ e^5.77: e^5.77 = e^5·e^0.77: e^0.77 ≥ 1+.77+.29645+.0760883+.0146470+.0022496+.0002880 = 2.1597 (7 terms... compute: 1+0.77 = 1.77; +0.29645 = 2.06645; +0.07608833 = 2.14253833; +0.01464699 = 2.15718532; +0.00224959 = 2.15943491; +0.00028803 = 2.15972294); 148.328·2.1597 = 320.34 ≥ 318 ✓ 0.7% margin). Or just reuse log T ≤ 5.8 for comfort: e^5.8 = e^5·e^0.8; e^0.8 ≥ 1+.8+.32+.0853333+.0170667+.0027307+.0003641 = 2.2255; 148.328·2.2255 = 330.10 ≥ 318 ✓ 3.8%. Use log T ≤ 5.8; log log T ≤ log 5.8 ≤ 1.77 (5.8 ≤ e^1.77: e^1.77 = e·e^0.77 ≥ 2.71828·2.1597 = 5.8708 ≥ 5.8 ✓ 1.2%). And log(T+2) ≤ log 320 ≤ 5.8 (320 ≤ 330.1 ✓). log log(T+2) ≤ 1.77.\n - FAlt(T) ≤ 0.159155·318·5.8 + 0.137·5.8 + 0.443·1.77 + 2.463 = 0.159155·1844.4 + 0.7946 + 0.7841 + 2.463 = 293.52 + 4.04 = 297.56. 2F ≤ 595.1.\n - Ĉ₀ ≤ 0.433·5.8 + 0.886·1.77 + 2.9 = 2.5114 + 1.5682 + 2.9 = 6.9796.\n - 4T·[...] ≤ 4·318·[(2/3)(6.9796) + 10.5·5.8 + 48] = 1272·[4.6531 + 60.9 + 48] = 1272·113.5531 = 144439.5.\n - Ĥ ≤ 3·6.9796² + 60.9 + 48 = 3·48.715 + 108.9 = 146.15 + 108.9 = 255.05.\n - 2(e⁴+1)(7Ĥ+3.3) ≤ 111.203·(7·255.05 + 3.3) = 111.203·1788.65 = 198893.9.\n - 40·1.3352 = 53.408; IIMaj ≤ 4.56·319·2 = 2909.3; +1.\n - Bn ≤ 595.1 + 144439.5 + 53.4 + 198893.9 + 2909.3 + 1 = 346892.2.\n - margin(100000) ≥ 433102 − 346893 + 1 = 86210. (True ≈ 93000.) ✓\n - margin(80000) ≤ ?: slower(80000) ≤ 40000·log 80000 − 113511.9 − 4 with log 80000 ≤ 11.30 (80000 ≤ e^11.3? e^11.3 = e^11·e^0.3: e^0.3 ≤ (1/(1−0.3/16))^16 = (1/0.98125)^16 = (1.018987)^16 ≈ 1.3512 (16·ln(1.018987) = 16·0.018809 = 0.30095; e^0.30095 = 1.3512); 59874.2·1.3512 = 80906 ≥ 80000 ✓ 1.1% margin). So log 80000 ≤ 11.3; slower ≤ 40000·11.3 − 40000·(1+0.6931471+1.1447298)/2 − 4: lower bound on (1+log2+logπ)/2: log 2 ≥ 0.6931471, log π ≥ 1.1447298 (need LOWER bound on log π: π ≥ 3.1415926535 ⟹ log π ≥ log 3.1415926535 ≥ 1.1447 ⟸ 3.1415926535 ≥ e^1.1447: e^1.1447 = e·e^0.1447: e^0.1447 ≥ 1+.1447+.010469+... = 1.1558; 2.71828·1.1558 = 3.1418 ≥ 3.14159 ✓ 0.007% — VERY tight. Use log π ≥ 1.1447 with more terms: e^0.1447 partial 7 terms: 1+0.1447+0.010469+0.00050487+0.00001826+0.00000053 = 1.15569266... hmm compute: x=0.1447: x²/2 = 0.010469; x³/6 = 0.000504869; x⁴/24 = 0.0000182638; x⁵/120 = 5.285e-7; x⁶/720 = 1.2747e-8. Sum: 1+0.1447+0.010469+0.000504869+0.0000182638+0.0000005285+0.0000000127 = 1.15569267. ×e: 2.7182818283·1.15569267 = 3.14175... compute: 2.7182818283·1.15569267 ≈ 3.141752. vs π ≥ 3.1415926535: 3.1415926 ≤ 3.141752 ≤ e^1.1447 ✓ margin 0.005%. Tight but exact-rational OK. Hmm — this precision is fine for norm_num? The comparison 2.7182818283·1.15569267 ≥ 3.1415926535 is exact decimal arithmetic ✓.)\n This is getting REALLY fiddly with tight margins. Let me RELAX: for margin(80000) upper I don't need tightness at all — budget: margin(80000) ≤ 86209 (to be < margin(100000) ≥ 86210). True margin(80000) = 15764 — slack 70000! So crude: slower(80000) ≤ 40000·11.3 − 4 (just drop the negative term? NO — slower = 40000·log 80000 − 1.4189·80000 − 4; the −1.4189·80000 term is NEGATIVE so for an UPPER bound on slower I need a LOWER bound on 1.4189 = (1+log2+logπ)/2 — or just use (1+log2+logπ)/2 ≥ (1+0+1)/2 = 1 (log 2 ≥ 0, log π ≥ 1 ⟸ π ≥ e: 3.14159 ≥ 2.7183 ✓ EASY). So slower(80000) ≤ 40000·11.3 − 1·80000 − 4 = 452000 − 80004 = 371996.\n Bn(80000) ≥ ?: every term of Bn is POSITIVE: 2F(T) — F(T) = (1/2π)T log T + ... ≥ 0 for T ≥ 1 ✓; 4T[...] ≥ 0 ✓; so Bn ≥ 0 crudely, or Bn ≥ 40·1.3352 = 53.4. margin(80000) ≤ 371996 − 0 + 1 = 371997. Is 371997 < margin(100000) ≥ 86210? NO! 371997 > 86210 ✗. Crude upper on margin(80000) exceeds crude lower on margin(100000). Need SOME care: margin(80000) upper ≤ 86210 needs slower ≤ Bn + 86209: slower ≤ 40000·11.3 − 80004 = 371996 needs Bn(80000) ≥ 285787. Bn lower bound: Bn ≥ 4T[(2/3)Ĉ₀ + 10.5 log(T+2) + 48] with T ≥ 283 (√80000 ≥ 283 ⟸ 283² = 80089 ≥ 80000... NO: √80000 ≥ 283 ⟺ 80000 ≥ 283² = 80089 ✗ FALSE! √80000 = 282.84 < 283. T ≥ 282: 282² = 79524 ≤ 80000 ✓). T ≥ 283.8? use T ≥ 283 (282.84+1 = 283.84 ≥ 283 ✓). log(T+2) ≥ log 285 ≥ ? log 285 ≥ 5.65 (285 ≥ e^5.65: e^5.65 ≥ 148.328·1.9155(7-term e^0.65) = 284.1 ≤ 285 ✓ 0.3% margin — meh. e^0.65 8 terms: +x⁷/5040 = 0.65^7/5040 = 0.0490/5040 = 9.7e-6 → 1.9155 same to 4 digits. 284.11 ≤ 285 ✓ 0.3%.) OK log 285 ≥ 5.65. Ĉ₀ ≥ 0.433·5.65 + 0 + 2.9 = 5.347 (log log ≥ 0 since log(T+2) ≥ 5.65 > 1 ⟹ log log ≥ log 5.65... log log(T+2) ≥ 0 ⟸ log(T+2) ≥ 1 ✓). 4T[...] ≥ 4·283·[(2/3)(5.347) + 10.5·5.65 + 48] = 1132·[3.565 + 59.325 + 48] = 1132·110.89 = 125527. Bn ≥ 125527 + (other positive terms ≥ 0... plus 40·1.3352 ≥ 53). margin(80000) ≤ 371996 − 125527 + 1 = 246470. Still > 86210 ✗✗.\n\n The problem: my slower(80000) UPPER bound is loose (log 80000 ≤ 11.3 vs true 11.2898 is fine; the −1.4189n ≥ −n·1 relaxation loses 0.4189·80000 = 33512!). Need the (1+log2+logπ)/2 ≥ 1.41 lower bound: (1 + 0.6931471 + 1.1447298)/2 = 1.41893855 — need log π ≥ 1.1447-ish. That's the tight e^1.1447 ≥ π computation. Alternatively log π ≥ 1.14: e^1.14 ≥ π? e^1.14 = e·e^0.14: e^0.14 ≥ 1+0.14+0.0098+0.000457+0.000016 = 1.150273; 2.71828·1.150273 = 3.1269 < 3.14159 ✗ FALSE direction: log π ≥ 1.14 ⟺ π ≥ e^1.14 ⟸ 3.1415926 ≥ e^1.14: need e^1.14 ≤ 3.1415926: e^1.14 ≤ e·[upper e^0.14]: upper e^0.14 = 1/(1−0.14/16)^16 = (1/0.99125)^16 = (1.008827)^16 ≈ 1.1509 (16 ln(1.008827) = 16·0.008788 = 0.14061, e^0.14061 = 1.1510). e^1.14 ≤ 2.7182818·1.1510 = 3.1289 ≤ 3.1415926 ✓ 0.4% margin ✓. So log π ≥ 1.14, giving (1+log2+logπ)/2 ≥ (1+0.6931471+1.14)/2 = 1.41657355; slower(80000) ≤ 40000·11.3 − 1.41657355·80000 − 4 = 452000 − 113325.9 − 4 = 338670.1. margin(80000) ≤ 338670.1 − 125527 + 1 = 213144. STILL > 86210 ✗.\n\n Grr — the Bn(80000) lower bound 125527 is too weak (true Bn = 322309; the big missing piece: 2(e⁴+1)(7Ĥ+3.3) ≈ 194604 — its lower bound: Ĥ ≥ 3Ĉ₀² + 10.5·5.65 + 48 ≥ 3·28.59 + 59.325 + 48 = 193.1; 2(e⁴+1) ≥ 2(54.598+1) = 111.196 (e⁴ ≥ 2.71828^4 = 54.5978); 7Ĥ+3.3 ≥ 1355.0; → 2(e⁴+1)(7Ĥ+3.3) ≥ 111.196·1355.0 = 150671. Bn ≥ 125527 + 150671 + 53 = 276251. margin(80000) ≤ 338670 − 276251 + 1 = 62420 < 86210 ✓✓ FINALLY. \n\n So hbase2 needs two-sided bounds with e⁴ lower (easy: (2.7182818283)^4 = 54.59781 via pow), log 285 ≥ 5.65, log π ≥ 1.14, etc. All OK but the proof is LONG.\n\nTotal assessment for 12.2 full discharge: ~500-700 lines of tight numeric Lean. That's a big chunk — realistically its own sub-stage. The session has already delivered the core milestone (committed). Per pacing rules (NO RUSH; sub-stages clean), the right move:\n\n1. Do the secant two-point variant NOW (cheap, removes deriv hypothesis — cleaner interim signature: hbase, hbase2 are then both plain function evaluations, ready for the numeric grind).\n2. Write D-062 triage (the notes' step-2 design decision — the deliberation the notes ASK for: where to draw the Trudgian perimeter).\n3. Session protocol (journal, STATE, db, NGUYEN.md, commit).\n4. Leave the numeric discharge of hbase/hbase2 as the precisely-scoped next sub-stage (with the sizing computations above recorded in D-062 or the journal — the bound values I worked out: log 80000 ∈ [11.263, 11.3], log T ≤ 5.7/5.8 grids, etc.).\n\nHmm wait — actually, should I do the secant variant at all? It changes SfBoundProp's range to start at 100000 and the theorem signature to (hbase)(hbase2). The current committed version uses hbase + hbase′ (derivative). The two-point version is strictly easier to discharge later (two evals vs eval + derivative machinery). Yes, do it — it's 30 lines.\n\nAlso actually — wait. Reconsider: maybe keep it even simpler. Since hfinite covers n ≤ 500000 anyway, why not push the margin regime to start at 500000 and pick base points at 500000/500001+? No — margin argument needs n ≥ N₁ point... the two-point version needs x ≥ N₁ = second point. If I set N₀ = 80000, N₁ = 100000, margin regime [100000, ∞). Finite covers < 100000 ✓ (100000 ≤ 500000 ✓). Fine as planned.\n\nLet me also double check pos_of_convex_of_two_points handles x ∈ [N₁, ∞): yes with hx : N₁ ≤ x.\n\nAnd in the assembly, the split becomes: n < 100000 → hfinite (n ≤ 99999 → n ≤ 500000 ✓ omega); n ≥ 100000 → margin with hge : 100000 ≤ n → (100000:ℝ) ≤ (n:ℝ) ✓ exact_mod_cast.\n\nSfBoundProp: ∀ n, 100000 ≤ n → (n:ℝ) ≤ (3*10^12−1)^2 → |Sf n| ≤ Bn FAlt n.\n\nHmm — wait, one consideration: the eventual SfBound proof for n ∈ [100000, N₁]. The D-037 B(n) bound derivation assumed n ≥ 20-ish (T ≥ √20+1 for the block table; n ≥ 100000 ⟹ T ≥ 317 ✓ fine).\n\nNow — the assembly proof also needs updating: pos_of_convex_of_base → two-point version. hdiffM no longer needed! (Two-point version needs only convexity.) Simpler.\n\nLet me implement:\n1. Add pos_of_convex_of_two_points after pos_of_convex_of_base (keep both — pos_of_convex_of_base is proved and may be useful; actually delete it? It becomes unused... keep both is fine — no, unused proved lemmas are harmless but the audit rule says every claim tagged; it's fine. Hmm — minimalism: the derivative version might still be useful if someone discharges hbase′ instead. Keep both, note in comment.)\n\nActually — decision: keep pos_of_convex_of_base (proved, harmless), add two-point variant, switch the main theorem.\n\n2. Change SfBoundProp 80000 → 100000.\n3. Change main theorem: hypotheses (hbase : 0 < marginTilde FAlt 80000) (hbase2 : marginTilde FAlt 80000 < marginTilde FAlt 100000); split at 100000.\n\nThen compile, audit, commit. Then D-062 triage + session protocol.\n\nAlso update the hbase/hbase′ doc references in §4 header comment.","signature":""},{"type":"text","text":"`ConvexOn.slope_mono_adjacent` confirmed. Implementing the two-point variant (drops the derivative hypothesis — both remaining facts become plain function evaluations, the cheapest possible numeric obligation)."},{"type":"tool_use","id":"Edit_81","name":"Edit","input":{"file_path":"D:\\Python\\Quantum\\research\\lean\\NguyenRH1\\NguyenRH1\\LiSkeleton.lean","old_string":"/-- [PROVED session 012 — TIER (ii) STEP 1, assembly modulo `SfBoundProp`]","new_string":"/-- [PROVED session 012] Convexity + f(N₀) > 0 + f(N₁) > f(N₀) ⟹\npositivity on [N₁, ∞) (three-chord secant monotonicity; the increasing\nsecant slope is positive, so f keeps climbing). Cheaper to discharge than\nthe derivative base point: two plain evaluations, no deriv machinery. -/\ntheorem pos_of_convex_of_two_points {f : ℝ → ℝ} {a N₀ N₁ x : ℝ}\n (hconv : ConvexOn ℝ (Set.Ici a) f)\n (hN : a < N₀) (hN01 : N₀ < N₁) (hx : N₁ ≤ x)\n (h0 : 0 < f N₀) (h01 : f N₀ < f N₁) :\n 0 < f x := by\n rcases eq_or_lt_of_le hx with heq | hlt\n · rw [← heq]\n linarith\n · have hslope := hconv.slope_mono_adjacent\n (Set.mem_Ici.mpr (le_of_lt hN)) (Set.mem_Ici.mpr (by linarith)) hN01 hlt\n have hp1 : (0 : ℝ) < N₁ - N₀ := by linarith\n have hp2 : (0 : ℝ) < x - N₁ := by linarith\n have hs : (0 : ℝ) < (f N₁ - f N₀) / (N₁ - N₀) := div_pos (by linarith) hp1\n have hs2 : (0 : ℝ) < (f x - f N₁) / (x - N₁) := lt_of_lt_of_le hs hslope\n have hfx : (0 : ℝ) < f x - f N₁ := (div_pos_iff_of_pos_right hp2).mp hs2\n linarith\n\n/-- [PROVED session 012 — TIER (ii) STEP 1, assembly modulo `SfBoundProp`]"},"extra_content":null}]