feat(Mathematics): add Physlib/Mathematics/GoldenRatio.lean#1122
feat(Mathematics): add Physlib/Mathematics/GoldenRatio.lean#1122gHashTag wants to merge 4 commits into
Conversation
Adds a thin Physlib-namespace wrapper around mathlib's Mathlib.NumberTheory.Real.GoldenRatio plus physics-flavoured derived identities that mathlib does not state. 33 declarations (31 theorems + 2 abbrevs), 0 sorry, 0 axiom. Contributed by gHashTag/trinity-s3ai Wave 7, W7.3. https://github.com/gHashTag/trinity-s3ai
| /-! ## Section 1: `Physlib`-level shortcuts -/ | ||
|
|
||
| /-- The golden ratio `φ := (1 + √5) / 2`. Re-export of `Real.goldenRatio`. -/ | ||
| abbrev phi : ℝ := Real.goldenRatio |
There was a problem hiding this comment.
I don't think this is a good idea, there are many uses of phi throughout physics (most notably as a phase, or as a potential) and dedicating it to golden ratio doesn't seem right to me. Maybe you could use local notation here for Real.goldenRatio, and add the API directly around that?
There was a problem hiding this comment.
@zhikaip: dropped the phi/psi abbrevs entirely. The module now builds the API directly on Real.goldenRatio / Real.goldenConj and uses mathlib's own scoped[goldenRatio] notation via open scoped goldenRatio, so φ/ψ stay file-local and are never exported globally -- no collision with φ-as-phase / φ-as-potential. I also removed the thin re-export lemmas that only wrapped mathlib; what remains is just the handful of identities mathlib does not state.
|
Maybe I can ask where the direction of this PR is heading in terms of physics, do you have plans to do something which uses this? |
Per reviewer guidance (@zhikaip): do not introduce new phi/psi names that could collide with phi-as-phase / phi-as-potential elsewhere in physics. - Remove abbrev phi/psi and the thin re-export lemmas that only wrapped mathlib (goldenRatio_sq, _pos, _add_goldenConj, etc.). - Use mathlib's own scoped notation phi/psi via 'open scoped goldenRatio' (scoped[goldenRatio], file-local, not exported globally). - Move the module into namespace Physlib.GoldenRatio. - Keep only the lemmas not in mathlib: continued-fraction fixed point, phi = 2 cos(pi/5) (icosian/H4 bridge), pow_three/four/five closed forms, and explicit numerical bounds. Proofs unchanged apart from renaming.
Real.goldenRatio is an abbrev for (1+sqrt 5)/2, so reduce via 'show' on the unfolded form plus 'ring' instead of 'unfold Real.goldenRatio', which can be brittle on abbrevs across mathlib versions.
@jstoobysmith: on direction -- the physics use is the H4 / icosahedral thread: φ = 2 cos(π/5) as the bridge from the algebraic golden ratio to the 5-fold symmetry of the pentagon, the 600-cell and the binary icosahedral group 2I ⊂ SU(2), plus the 1/φ "most irrational" rotation number for KAM / quasicrystal contexts. If you'd prefer this not live as a dedicated module, I'm happy to either trim it to just φ = 2 cos(π/5) + the φ^n closed forms, or upstream the genuinely-missing lemmas straight to Mathlib.NumberTheory.Real.GoldenRatio. Whichever fits Physlib better. |
Summary
This PR adds
Physlib/Mathematics/GoldenRatio.lean, a Lean 4 module that provides aPhyslib-namespace wrapper around Mathlib'sMathlib.NumberTheory.Real.GoldenRatio, extended with physics-flavoured derived identities that Mathlib does not state.Motivation
The constant φ = (1 + √5)/2 appears throughout physics:
Mathlib already proves the purely algebraic facts (golden equation, positivity, irrationality, Binet's formula). Physlib downstream code needs both a namespace shortcut and a handful of derived results.
Contents
phi,psi(abbrevs)phi_sq,phi_pos,phi_ne_zero,one_lt_phi,phi_lt_two,psi_neg,psi_ne_zero,psi_sq,phi_psi_sum,phi_psi_prod,phi_inv_eq_neg_psi,psi_inv_eq_neg_phiphi_inv_pos,phi_inv_lt_one,phi_continued_fraction(φ = 1 + 1/φ),phi_two_cos_pi_div_five(φ = 2 cos π/5),phi_quadratic,psi_quadratic,phi_psi_vietaphi_lower_bound,phi_upper_bound,phi_bounds(1.6 < φ < 1.7)phi_pow_three,phi_pow_four,phi_pow_five(Fibonacci-coefficient pattern)phi_irrational,psi_irrational(re-export)Total: 226 lines, 33 declarations (31 theorems + 2 abbrevs), 0 sorry, 0 axiom.
Aggregator
Added
public import Physlib.Mathematics.GoldenRatiotoPhyslib.leanalphabetically betweenGeometry.Metric.Riemannian.DefsandInnerProductSpace.Adjoint.Lean / Mathlib version
leanprover/lean4:v4.29.1lakefile.lean)Origin
Contributed by the trinity-s3ai project, Wave 7 task W7.3. All proofs use standard Mathlib tactics (
linarith,ring,nlinarith,norm_num,Real.sqrt_lt_sqrt,Real.cos_pi_div_five).