Skip to content

[WIP] feat: add Mathlib.Biology.Longevity.PhenoAge formal contract (K-Lean Phase B)#40598

Draft
Heime-Jorgen wants to merge 5 commits into
leanprover-community:masterfrom
Heime-Jorgen:klean-biology-longevity-phenoage
Draft

[WIP] feat: add Mathlib.Biology.Longevity.PhenoAge formal contract (K-Lean Phase B)#40598
Heime-Jorgen wants to merge 5 commits into
leanprover-community:masterfrom
Heime-Jorgen:klean-biology-longevity-phenoage

Conversation

@Heime-Jorgen

Copy link
Copy Markdown

Summary

Add Mathlib.Biology.Longevity namespace with formal Lean 4 contracts for biological age algorithms.

Motivation

The Kenosian Protocol Platform (KPP) provides machine-verifiable audits for bioinformatics algorithm computations. K-Lean Phase A (live) verifies JSON Schema I/O contracts via REST API. Phase B (this PR) provides Lean 4 formal theorems so any researcher can verify locally without trusting a server.

What this adds

  • Mathlib/Biology/Longevity/Basic.lean — common types (ValidAge, ageAcceleration)
  • Mathlib/Biology/Longevity/PhenoAge.lean — formal contract for PhenoAge (Levine et al. 2018, Aging)

Theorems

  • mortalityScore_pos: M > 0 for any linear score xb
  • mortalityScore_lt_one: M < 1 for any xb
  • phenoAge_wellDefined: PhenoAge is a well-defined real number for any xb

Reference

Levine ME et al. "An epigenetic biomarker of aging." Aging 2018;10(4):573–591.
PLOS Medicine correction 2019 (divisor 0.090165).

K-Lean integration

require KLean from git
  "https://github.com/Heime-Jorgen/kenosian-lean4" @ "main"

Phase A API: POST https://kpp.kenosian.com/api/v1/verify/klean
Contact: peter@kenosian.com


This is a draft PR. Proof completeness and Mathlib style compliance are work in progress.

@github-actions github-actions Bot added the new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community! label Jun 14, 2026
@github-actions

Copy link
Copy Markdown

Welcome new contributor!

Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests.

We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the awaiting-author tag, or another reason described in the Lifecycle of a PR. The review dashboard has a dedicated webpage which shows whether your PR is on the review queue, and (if not), why.

If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR.

Thank you again for joining our community.

@github-actions

github-actions Bot commented Jun 14, 2026

Copy link
Copy Markdown

PR summary 7a11bff36f

Import changes for modified files

No significant changes to the import graph

Import changes for all files
Files Import difference
Mathlib.Biology.Longevity.Basic (new file) 1752
Mathlib.Biology.Longevity.PhenoAge (new file) 1753

Declarations diff (regex)

+ B
+ ValidAge
+ ageAcceleration
+ exp_γ_τ_pos
+ mortalityScore
+ mortalityScore_lt_one
+ mortalityScore_pos
+ phenoAge
+ phenoAge_wellDefined
+ γ
+ γ_pos
+ τ
+ τ_pos

You can run this locally as follows
## from your `mathlib4` directory:
git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci

## summary with just the declaration names:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh <optional_commit>

## more verbose report:
../mathlib-ci/scripts/pr_summary/declarations_diff.sh long <optional_commit>

The doc-module for scripts/pr_summary/declarations_diff.sh in the mathlib-ci repository contains some details about this script.

Declarations diff (Lean -- pending)

Computed after the build finishes.


No changes to strong technical debt.

No changes to weak technical debt.

Current commit 7a11bff36f
Reference commit 6923f2f175

This script lives in the mathlib-ci repository. To run it locally, from your mathlib4 directory:

git clone https://github.com/leanprover-community/mathlib-ci.git ../mathlib-ci
../mathlib-ci/scripts/reporting/technical-debt-metrics.sh pr_summary
  • The relative value is the weighted sum of the differences with weight given by the inverse of the current value of the statistic.
  • The absolute value is the relative value divided by the total sum of the inverses of the current values (i.e. the weighted average of the differences).

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

Labels

new-contributor This PR was made by a contributor with at most 5 merged PRs. Welcome to the community!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant