kenoslean
Machine-verified computational biology contracts — Lean 4 kernel-checked, Rust-accelerated, exposed to Python.
Each function in this package corresponds to a contract whose mathematical
invariants are stated and proven in a Lean 4 module (KLean.Contracts.*). The
Rust implementation reproduces the algorithm; pre-condition violations raise
ValueError, and post-conditions are guarded with debug_assert! in debug
builds.
Naming. The PyPI distribution is
kenoslean(the namekleanwas already taken on PyPI by an unrelated project). The import module name isklean:pip install kenoslean # distributionimport klean # module
Quick start
import klean
klean.gc_content("ATGCGCATGC") # 0.5 — GCContent ∈ [0,1]
klean.mrna_halflife_concentration(100.0, 0.1, 5.0) # MrnaHalfLife > 0
klean.sequence_identity("ACGT", "ACGG") # 0.75 — SequenceIdentity ∈ [0,1]
klean.nussinov("GGGAAACCC") # 3 — max non-crossing base pairs
What is and is not proven (honest scope)
The Lean kernel checks are about algorithmic correctness and bounds, not about closing open scientific problems. Specifically:
- Nussinov (
nussinov): the Lean theoremnussinov_optimalproves the DP recurrence returns exactly the maximum number of non-crossing canonical base pairs (sound + achievable). This is a proof about the counting algorithm, with a parameterized pairing cost. It is not a claim that RNA minimum-free-energy (MFE) structure is "solved": the realistic Turner nearest-neighbor energy table is left as open input, and stacking-rule optimality under the full Turner model is not proven here. - Real-valued contracts (concentrations, kinetics, ages, etc.): the Lean
proofs are over the reals (ℝ). The Rust/Python runtime uses IEEE-754
f64. A formal floating-point error bound is not proven — runtime values are numerically close but the gap betweenf64and ℝ is not certified here.
In one line: we prove algorithm optimality / invariants (parameterized cost); the empirical energy tables are open inputs, and Real-valued results carry no proven floating-point error bound (only runtime closeness).
Contracts
mRNA / Ribosome, sequence analysis, pharmacokinetics, longevity, statistics,
thermodynamics, enzyme kinetics, spectroscopy/transport, growth/population
dynamics, clinical/physiology, molecular biology, structural alignment, and RNA
secondary structure (Nussinov). See the module docstring in klean for the
full list and the backing Lean module names.
Build from source
Requires a Rust toolchain and maturin.
maturin build --release # produces target/wheels/kenoslean-*.whl
pip install target/wheels/kenoslean-*.whl
HTTP server (separate binary)
The same contracts are also served over HTTP by the klean-server binary
(Rust/Axum), built with the server feature:
cargo build --release --bin klean-server --features server
./target/release/klean-server # listens on 0.0.0.0:8090
Endpoints (each response carries "verified": true):
GET /health
GET /v1/gc_content?seq=ATGCATGC
GET /v1/sequence_identity?seq1=ACGT&seq2=ACGG
GET /v1/shannon_entropy?p=0.5
GET /v1/mrna_halflife_concentration?initial=100&decay_rate=0.1&time=5
GET /v1/mrna_halflife?decay_rate=0.1
GET /v1/ribosome_density?n_ribosomes=10&length=100
GET /v1/translation_rate?codon_rate=5&ribosome_density=0.5&mrna_copies=10
GET /v1/first_order_pk?c0=100&ke=0.1&time=5
GET /v1/ic50?ki=10&substrate=5&km=2
GET /v1/michaelis_menten?vmax=100&km=5&substrate=10
GET /v1/biological_age?pheno=45&telomere=42&epigenetic=48
GET /v1/telomere_length?age=50
GET /v1/gompertz_hazard?alpha=0.0001&beta=0.08&time=65
GET /v1/hardy_weinberg?p=0.6
License
MIT
Metadata
Release files for kenoslean 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| kenoslean-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl | CPython 3.13 | CPython 3.13 | Linux glibc 2.39+ x86-64 | Details for kenoslean-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl |
| kenoslean-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ x86-64 | Details for kenoslean-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl |
| kenoslean-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.39+ x86-64 | Details for kenoslean-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl |
| kenoslean-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details for kenoslean-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Total release size: 1.1 MB
Release files / kenoslean-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl
| Download URL | kenoslean-0.1.0-cp313-cp313-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 297.0 kB |
| Tags | CPython 3.13 Linux glibc 2.39+ x86-64 |
|
SHA-256 checksum How to use checksums |
0968e9088470639ff2e944a62a368e05251f029c0b62e9552f083f8265b2a0c2
|
|
BLAKE2b-256 checksum How to use checksums |
c53570df5581413d89d96529ec5fa2ca222ed397c623ef974063ff01c03accae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / kenoslean-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | kenoslean-0.1.0-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 258.8 kB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ba83d9277d550c40f32dab12d0465d754fbbc24e5c7740ce547ee280eddc7901
|
|
BLAKE2b-256 checksum How to use checksums |
464f325a1d5806ded2299e784a27485ac25234057d765bee97d3f2b4117bd1ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / kenoslean-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl
| Download URL | kenoslean-0.1.0-cp38-abi3-manylinux_2_39_x86_64.whl |
|---|---|
| Size | 298.0 kB |
| Tags | CPython 3.8 Linux glibc 2.39+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
44f9cb4d4680f2ed1473ae1d41f1282b9f1ecf2b50ab135d19b6d32586f09c76
|
|
BLAKE2b-256 checksum How to use checksums |
408b4b018185263e7fedbbf9801f64e23d340d43a6a6926b4a66f095b6311799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / kenoslean-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | kenoslean-0.1.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 260.5 kB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
e302ca2d2d9333a1e3d83c18f0bd109ce7135c81ba108b40a1357fb7697f3d29
|
|
BLAKE2b-256 checksum How to use checksums |
f387ff92c730b5991942f5c4e66ac1c8e37643fe84e477d629c6a5cd4099e777
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for kenoslean 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.