Skip to content

feat(Cosmology): comoving distance, redshift, Hubble-Lemaitre law, transverse distance and horizons - #1639

Open
KevorkianPhilippe wants to merge 58 commits into
leanprover-community:masterfrom
KevorkianPhilippe:flrw-distances-8
Open

KevorkianPhilippe wants to merge 58 commits into
leanprover-community:masterfrom
KevorkianPhilippe:flrw-distances-8

Conversation

@KevorkianPhilippe

@KevorkianPhilippe KevorkianPhilippe commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

AI disclosure

AI disclosure. This PR was generated with Claude Fable 5.1 (Claude Code) under my
supervision, following AI-POLICY.md and AGENTS.md. I have read every definition and lemma
statement and vouch that they state what the docstrings say. The statements were fixed before
the proofs were written and checked symbolically (sympy) against the Friedmann equations of
Physlib.Cosmology.FLRW.Basic; no textbook is cited, the TODO items of the file are the
specification.

Stacked on #1638 (flrw-dynamics-7): the diff includes the earlier commits of this series; only the last commit is new here.

Resolves six of the ten TODOs of Physlib/Cosmology/FLRW/Distances.lean and the
change-of-variable TODO of Basic.lean (the only change to Basic.lean: that TODO is removed).

Declarations added (namespace Cosmology.FLRW.FriedmannEquation):

  • comovingDistance: χ = c ∫_t^{t₀} dτ / a; deriv_comovingDistance: ∂ₜ χ = - c / a
    (fundamental theorem of calculus, a continuous and positive).
  • redshift: 1 + z = a(t₀) / a(t); one_add_redshift; deriv_redshift: ∂ₜ z = -(1 + z) H;
    deriv_eq_mul_hubbleConstant: ∂ₜ a = a H; deriv_comovingDistance_eq_mul_deriv_redshift:
    ∂ₜ χ = (c / (a(t₀) H)) ∂ₜ z, the relation dχ = c dz / H behind the distance integrals in z.
  • properDistance, deriv_properDistance (Hubble-Lemaître law ∂ₜ D = H D); hubbleRadius,
    deriv_properDistance_eq_iff (recession velocity c exactly at R_H).
  • spatialGeometryOfCurvature, transverseComovingDistance, and the closed forms
    transverseComovingDistance_of_pos, _zero, _of_neg (curvature radius 1 / √|K|).
  • particleHorizon, eventHorizon, particleHorizon_einsteinDeSitter (3 c t₀^(2/3) t^(1/3)).

Not included, said in the module docstring: the redshift law E ∝ 1 / a of a photon (needs the
metric and null geodesics) and χ(z) as an integral in z (needs H as a function of z).

Reviewer map: A (FTC), B (redshift and change of variables), C, D (conventions of
SpatialGeometry), E.

Update (Sept 11). Applied the review remarks of #1642 across the series: no isolated general-purpose lemma (the one-off HasDerivAt and rpow helpers are inlined in the proofs that used them), and the three small bridges between Time.deriv and Mathlib's HasDerivAt now live next to the definition of the time derivative, in Physlib/SpaceAndTime/Time/Derivatives.lean (deriv_comp_val, deriv_eq_of_hasDerivAt, hasDerivAt_mk_of_differentiableAt, each introduced by the first PR of the series that needs it). Section letters shifted accordingly.

Update (Sept 17). Merged the review of #1635 (statements at t : Time, Time.deriv_comp_val dropped in favour of Time.deriv_eq_of_hasDerivAt); API-map.yaml now records what this PR completes.

🤖 Generated with Claude Code

Philippe Kevorkian and others added 8 commits September 10, 2026 18:05
Adds to Physlib/Cosmology/FLRW/Solutions.lean the de Sitter scale factor
deSitterScaleFactor, its time derivatives, and the lemmas
deSitterScaleFactor_firstOrderFriedmann, deSitterScaleFactor_secondOrderFriedmann,
hubbleConstant_deSitterScaleFactor and decelerationParameter_deSitterScaleFactor,
resolving the first TODO of the file. Also deriv_comp_val, the time derivative of a
curve given as a function of the time coordinate.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Adds to Physlib/Cosmology/FLRW/Solutions.lean the power-law scale factor
powerLawScaleFactor with its derivatives, Hubble and deceleration parameters, the
density powerLawDensity it imposes, and the radiation-dominated
(radiationScaleFactor, radiationDensity, radiationPressure) and Einstein-de Sitter
(einsteinDeSitterScaleFactor, einsteinDeSitterDensity) instances with their Friedmann
lemmas, q and H(t0), resolving two TODOs of the file. Also deriv_eq_of_hasDerivAt.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Adds to Physlib/Cosmology/FLRW/Solutions.lean the Milne scale factor milneScaleFactor
with its Friedmann lemmas (k = -1, empty universe) and q = 0, the density
cosmologicalConstantDensity, and the equilibrium relations of the Einstein static
universe: einsteinStatic_density (rho = 2 rho_Lambda), einsteinStatic_curvature
(k c^2 / a^2 = 4 pi G rho) and einsteinStatic_curvature_pos. The curvature of the
Milne model and the instability of the static universe stay as narrowed TODOs.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…edmann equations

Adds to Physlib/Cosmology/FLRW/MatterContent.lean the predicate ContinuityEquation,
the derivative of the first-order Friedmann equation (deriv_firstOrderFriedmann), the
derivation of the continuity equation from the two Friedmann equations
(continuityEquation_of_friedmann) and the converse derivation of the second-order
equation from the first-order and continuity equations
(secondOrderFriedmann_of_continuityEquation), resolving two TODOs of the file. Also
hasDerivAt_mk_of_differentiableAt, the bridge from a time derivative to HasDerivAt.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…cosmological constant as a fluid

Adds to Physlib/Cosmology/FLRW/MatterContent.lean barotropicPressure, the density
scaling law density_scaling with its converse continuityEquation_of_scaling and the
dust, radiation and vacuum specialisations, and cosmologicalConstantDensity and
cosmologicalConstantPressure with firstOrderFriedmann_iff_lambdaFluid,
secondOrderFriedmann_iff_lambdaFluid and cosmologicalConstantPressure_eq_barotropic,
resolving three TODOs. Moves cosmologicalConstantDensity from Solutions.lean, which now
imports MatterContent.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
… function and age

Adds to Physlib/Cosmology/FLRW/DensityParameters.lean criticalDensity, densityParameter,
curvatureDensityParameter and lambdaDensityParameter, the closure relation
densityParameter_add_lambda_add_curvature (and its Lambda = 0 form), the reduced Hubble
function reducedHubble of the standard model with sq_hubbleConstant_eq_reducedHubble and
hubbleConstant_eq_reducedHubble, the age of the universe age with age_eq, and the equality
scale factors equalityScaleFactorRadiationMatter and equalityScaleFactorMatterLambda with
their specifications, resolving the seven TODOs of the file.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ion parameter, eternal expansion and Big-Bang bound

Adds to Physlib/Cosmology/FLRW/Dynamics.lean the four energy conditions with their
implications, deriv_deriv_pos_iff (acceleration iff the strong energy condition fails),
decelerationParameter_eq_sum (q = 1/2 sum Omega_i (1 + 3 w_i)) and its LambdaCDM form,
deriv_ne_zero_of_friedmann and deriv_pos_of_friedmann (eternal expansion for k <= 0),
deriv_deriv_nonpos_of_friedmann, scaleFactor_nonpos_of_decelerating and
exists_scaleFactor_eq_zero (the Big-Bang bound t0 - 1/H0 and the existence of a zero of
the scale factor), and deSitterScaleFactor_pos, resolving the five TODOs of the file.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ansverse distance and horizons

Adds to Physlib/Cosmology/FLRW/Distances.lean the comoving distance comovingDistance with
deriv_comovingDistance (fundamental theorem of calculus), the redshift with deriv_redshift
and the change-of-variables relation deriv_comovingDistance_eq_mul_deriv_redshift, the
proper distance with the Hubble-Lemaitre law deriv_properDistance, the Hubble radius with
deriv_properDistance_eq_iff, spatialGeometryOfCurvature and transverseComovingDistance with
its three closed forms, the particle and event horizons and
particleHorizon_einsteinDeSitter. Removes the change-of-variable TODO of Basic.lean, which
deriv_eq_mul_hubbleConstant, deriv_redshift and
deriv_comovingDistance_eq_mul_deriv_redshift resolve.

Generated with Claude Code under human supervision (see AI-POLICY.md).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for this pull-request (PR). If this is your first PR, welcome to the community!

Below is what will happen next. Please read carefully if you are not familiar with the process. You may open other PRs while this one is being reviewed, and can stack PRs on top of each other, so don't let these steps slow you down.

  1. Some automated checks will be run on your PR. You can see the results of these checks at the buttom of your PR page. If any of these checks fail, you will need to fix the issues before your PR can be merged. You can learn more about these here, including how to run them locally, which is sometimes quicker than relying on the GitHub Actions. If you have never had a PR merged before, you may have to wait for a reviewer to manually start these checks (this is for security).

  2. A reviewer will look at your PR and may ask you to make changes. This may happen a couple of days after you submit your PR, so you may need to be patient. But it should not be longer than that - if it is please bring it to the attention of the community on the Zulip. The level of review will depend on where your PR is submitted. If it is submitted to ./Physlib or ./QuantumInfo, the review will be more thorough than if it is submitted to ./PhyslibAlpha. You can find out more about what the review process is looking for in our review guidelines. If a reviewer adds an awaiting-author label to your PR, address the review comments, then please remove that label by adding a comment with -awaiting-author. This helps us keep track of reviews.

  3. The reviewer will either approve your PR, or request more changes (in which case we return to step 2). Once your PR is approved, it will be merged by a maintainer, this should happen shortly after approval, though you may get more comments at this stage.

Tip: The easiest way to get have a fast review is to submit a PR that is small and self-contained, and has clear documentation explaining why things are the way they are in your chages.

If you have any problems or questions, please reach out to the community on the Zulip.

@github-actions github-actions Bot added the t-cosmology Cosmology label Sep 10, 2026
Philippe Kevorkian and others added 18 commits September 11, 2026 09:30
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ive bridges next to their definition

Applies the review remarks of leanprover-community#1642 across the series: no isolated general-purpose lemma, and
lemmas about the time derivative live in SpaceAndTime/Time/Derivatives.lean.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Philippe Kevorkian and others added 11 commits September 12, 2026 11:48
…utions

The general power-law solution a = (t / t0) ^ n is stated inline in the lemmas, quantified
over n; the defs powerLawScaleFactor, powerLawDensity, radiationDensity, radiationPressure and
einsteinDeSitterDensity and the two _eq glue lemmas are removed, the densities and the
pressure now appear in the theorem statements, and radiationScaleFactor and
einsteinDeSitterScaleFactor are defined directly.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ns is a Time

t0 : Time instead of a real number in the power-law, radiation-dominated and Einstein-de Sitter
solutions (so H(t0) is stated at t0 itself), and docstrings saying that t0 is the
normalisation epoch a(t0) = 1, that the Big Bang sits at the origin t.val = 0 of the time
chart, and that the values for t.val <= 0 are junk.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
# Conflicts:
#	Physlib/Cosmology/FLRW/Solutions.lean
…in of the time chart

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
The density of the Einstein static universe is stated as rho = Lambda c^2 / (4 pi G); the def
cosmologicalConstantDensity is dropped from this file, the cosmological constant as a w = -1
fluid being the matter-content TODO of Physlib.Cosmology.FLRW.MatterContent.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
# Conflicts:
#	Physlib/Cosmology/FLRW/Solutions.lean
#	Physlib/SpaceAndTime/Time/Derivatives.lean
# Conflicts:
#	Physlib/Cosmology/FLRW/MatterContent.lean
#	Physlib/Cosmology/FLRW/Solutions.lean
# Conflicts:
#	Physlib/Cosmology/FLRW/Solutions.lean
# Conflicts:
#	Physlib/Cosmology/FLRW/Solutions.lean
# Conflicts:
#	Physlib/Cosmology/FLRW/Solutions.lean
… t0 : Time

Follows the review of leanprover-community#1633: einsteinDeSitterScaleFactor now takes the normalisation epoch as
a Time and is defined directly, without powerLawScaleFactor.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
@morrison-daniel morrison-daniel added the blocked-by-PR This PR depends on another PR label Sep 13, 2026
Philippe Kevorkian and others added 17 commits September 16, 2026 09:40
…tOrderFriedmann at t : Time

Review of leanprover-community#1635 by doxtor6. Time.hasDerivAt_mk_of_differentiableAt is stated at t : Time
(derivative at t.val) instead of at the constructor form with a real parameter, so that callers
no longer destructure t; deriv_firstOrderFriedmann is stated at t : Time as well and
destructures inside its proof, and the two theorems of MatterContent.lean no longer do.
Time.deriv_comp_val is dropped: it is the special case f := fun s => g s.val of
Time.deriv_eq_of_hasDerivAt, which replaces it in Solutions.lean (its only user). The two
surviving bridges are listed in the key results of Time/Derivatives.lean.

Nits: continuityEquation_of_friedmann only needs G ≠ 0; the non-vanishing hypothesis of
secondOrderFriedmann_of_continuityEquation is named ha'; the overview names the bridge the
proofs actually use.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…rgy equation, API map

Review of leanprover-community#1635 by doxtor6. The non-independence TODO is narrowed rather than deleted (derive
it from the contracted Bianchi identity once the FLRW metric exists), and a TODO records the
bridge to fluid dynamics: ContinuityEquation is the fluid energy equation for the Hubble flow,
which needs an energy equation in Physlib.FluidDynamics first. The FLRW TODO of Basic.lean and
the overview of MatterContent.lean record the design point that the two Friedmann equations
are the primitive pair (where the scale factor is stationary, the first-order and continuity
equations leave the pressure unconstrained). API-map.yaml: the continuity-equation requirement
is split from the equation of state and marked done.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…sity_scaling, API map

Follows the review of leanprover-community#1635: no statement of the API exposes the constructor form of a time
any more. hasDerivAt_mul_rpow_of_continuityEquation, a helper stated on the real curve
obtained through the time chart and used once, is inlined into density_scaling.
API-map.yaml: the equation-of-state requirement is marked done and the cosmological constant
as a fluid is recorded.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ard model

Follows the review of leanprover-community#1635, which asked for API-map.yaml to track what each PR of the series
completes: two requirements for DensityParameters.lean (critical density, density parameters
and closure relation; reduced Hubble function, age and equality scale factors), and the
overview no longer lists that module as containing only TODO items.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…ng bound

Follows the review of leanprover-community#1635, which asked for API-map.yaml to track what each PR of the series
completes: two requirements for Dynamics.lean (energy conditions, acceleration criterion and
deceleration parameter; eternal expansion and the Big-Bang bound), and the overview no longer
lists that module as containing only TODO items.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
…distances and the horizons

Follows the review of leanprover-community#1635, which asked for API-map.yaml to track what each PR of the series
completes: two requirements for Distances.lean (comoving distance, redshift and the
Hubble-Lemaitre law; transverse comoving distance and the horizons), and the overview no
longer lists that module as containing only TODO items.

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocked-by-PR This PR depends on another PR large t-cosmology Cosmology

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants