Skip to content

feat(Mathematics): add Physlib/Mathematics/GoldenRatio.lean#1122

Open
gHashTag wants to merge 4 commits into
leanprover-community:masterfrom
gHashTag:feat/golden-ratio-from-trinity
Open

feat(Mathematics): add Physlib/Mathematics/GoldenRatio.lean#1122
gHashTag wants to merge 4 commits into
leanprover-community:masterfrom
gHashTag:feat/golden-ratio-from-trinity

Conversation

@gHashTag

@gHashTag gHashTag commented May 23, 2026

Copy link
Copy Markdown

Summary

This PR adds Physlib/Mathematics/GoldenRatio.lean, a Lean 4 module that provides a Physlib-namespace wrapper around Mathlib's Mathlib.NumberTheory.Real.GoldenRatio, extended with physics-flavoured derived identities that Mathlib does not state.

Motivation

The constant φ = (1 + √5)/2 appears throughout physics:

  • Quasicrystals: Penrose tilings, icosahedral viral capsids, metallic alloys
  • Coxeter geometry: H₄ root system underlying the 600-cell and the binary icosahedral group 2I ⊂ SU(2)
  • KAM theory: 1/φ is the "most irrational" rotation number
  • Icosian Coxeter program: coupling-constant relations

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

Section Declarations
§1 Shortcuts phi, psi (abbrevs)
§2 Mathlib re-exports 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_phi
§3 Physics-flavoured identities phi_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_vieta
§4 Numerical bounds phi_lower_bound, phi_upper_bound, phi_bounds (1.6 < φ < 1.7)
§5 Powers of φ phi_pow_three, phi_pow_four, phi_pow_five (Fibonacci-coefficient pattern)
§6 Irrationality 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.GoldenRatio to Physlib.lean alphabetically between Geometry.Metric.Riemannian.Defs and InnerProductSpace.Adjoint.

Lean / Mathlib version

  • leanprover/lean4:v4.29.1
  • Mathlib v4.29.1 (the rev currently pinned in lakefile.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).

gHashTag added 2 commits May 23, 2026 05:24
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
Comment thread Physlib/Mathematics/GoldenRatio.lean Outdated
/-! ## Section 1: `Physlib`-level shortcuts -/

/-- The golden ratio `φ := (1 + √5) / 2`. Re-export of `Real.goldenRatio`. -/
abbrev phi : ℝ := Real.goldenRatio

@zhikaip zhikaip May 23, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

@jstoobysmith

Copy link
Copy Markdown
Member

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?

@jstoobysmith jstoobysmith added the awaiting-author A reviewer has asked the author a question or requested changes label Jun 11, 2026
gHashTag added 2 commits June 18, 2026 14:10
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.
@gHashTag

Copy link
Copy Markdown
Author

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?

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-author A reviewer has asked the author a question or requested changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants