Research-Stack/lean_binned/RGUnitDistance.lean
allaun 5f80fd8429 chore(repo): push local 768-commit branch state onto clean remote baseline
This squashes all local history (768 commits) onto the scrubbed PR #90
baseline. Individual commits were lost during filter-repo corruption;
the working tree content is preserved intact.

Build: N/A (working tree state only)
2026-06-15 22:46:50 -05:00

65 lines
3.4 KiB
Text
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import Mathlib
open Real
/- ═══════════════════════════════════════════════════════════════
RG Bound on Unit Distances — Lean Formalization
Key identity: 9^(log₃4) = 16 exactly.
This gives recurrence F(n) = 9·F(n/9) + c·(n/9)^α → A = c/7.
-/
-- ═══════════════════════════════════════════════════════════════
-- §1 The RG constant α = log₃4
-- ═══════════════════════════════════════════════════════════════
noncomputable def alpha : := Real.log 4 / Real.log 3
/-- 9^α = 16 exactly. Uses the identity exp(2·ln4) = 4² = 16. -/
theorem nine_pow_alpha_eq_sixteen : (9 : ) ^ alpha = (16 : ) := by
have log3_pos : Real.log 3 ≠ 0 := by
exact ne_of_gt (Real.log_pos (by norm_num : (1 : ) < 3))
have h : 2 * Real.log 3 * (Real.log 4 / Real.log 3) = 2 * Real.log 4 := by
field_simp [log3_pos]
calc
(9 : ) ^ alpha = Real.exp (Real.log (9 : ) * alpha) := by
rw [Real.rpow_def_of_pos (by norm_num : (0 : ) < 9)]
_ = Real.exp (Real.log (9 : ) * (Real.log 4 / Real.log 3)) := rfl
_ = Real.exp ((2 * Real.log 3) * (Real.log 4 / Real.log 3)) := by
rw [show Real.log (9 : ) = 2 * Real.log 3 by
calc
Real.log (9 : ) = Real.log ((3 : )^2) := by norm_num
_ = 2 * Real.log 3 := by rw [Real.log_pow, Nat.cast_ofNat]
]
_ = Real.exp (2 * Real.log 4) := by rw [h]
_ = Real.exp (Real.log (4^2)) := by rw [Real.log_pow, Nat.cast_ofNat]
_ = Real.exp (Real.log (16 : )) := by norm_num
_ = (16 : ) := Real.exp_log (by norm_num : (0 : ) < 16)
/-- 9·(1/9)^α = 9/16 — the recurrence coefficient. -/
theorem recurrence_coefficient : (9 : ) * ((1 : ) / (9 : )) ^ alpha = (9 : ) / (16 : ) := by
calc
(9 : ) * ((1 : ) / (9 : )) ^ alpha = (9 : ) * ((1 : ) ^ alpha / (9 : ) ^ alpha) := by
rw [div_rpow (by norm_num : (0 : ) ≤ 1) (by norm_num : (0 : ) ≤ 9)]
_ = (9 : ) * ((1 : ) / (9 : ) ^ alpha) := by simp
_ = (9 : ) / (9 : ) ^ alpha := by ring
_ = (9 : ) / (16 : ) := by rw [nine_pow_alpha_eq_sixteen]
/-- Closed-form solution: if F(n) = A·n^α, then A = c/7. -/
theorem closed_form_coefficient (c : ) : (c / 7) * (9 : )^alpha = 9 * (c / 7) + c := by
calc
(c / 7) * (9 : )^alpha = (c / 7) * (16 : ) := by rw [nine_pow_alpha_eq_sixteen]
_ = (16 * c) / 7 := by ring
_ = (9 * c + 7 * c) / 7 := by ring
_ = 9 * (c / 7) + c := by ring
-- ═══════════════════════════════════════════════════════════════
-- §2 Executable receipts
-- ═══════════════════════════════════════════════════════════════
#eval "=== RG UNIT DISTANCE BOUND ==="
#eval "α = log₃4"
#eval "9^α = 16 (exact)"
#eval "9·(1/9)^α = 9/16"
#eval "Recurrence: F(n) = 9·F(n/9) + c·(n/9)^α → A = c/7"
#eval "7A = c because 9^α = 16 = 9 + 7"