Peptiter / DiscoveryLab
Proof
Mechanism proof

TensFormer — typed world-model spine.

TensFormer is the typed world-model spine that the rest of the proof stack composes against.

TensFormer · world-model spine

TensFormer: a typed, verifiable world model for peptide intervention.

The in-silico lab above triages every candidate through standardized assessments. TensFormer is the second, complementary spine: a JEPA-style predictive world model whose mechanism claims are projected through a typed tensor IR, exhaustively checked locally, and re-derived in Lean 4 under a shared semantic hash. Neural confidence does not imply proof; the TensFormer contract makes that boundary explicit and machine-checkable.

01 · Neural backbone

Learns continuous biology

A graph transformer with structure-aware features (AlphaFold / Boltz-class priors) trained with JEPA-style objectives. It predicts a latent body-state shift under intervention plus a candidate mechanism hypothesis, but never claims to be the truth.

PyTorch / JAX · billions of parameters · existing structure ecosystems
02 · TensorLang IR

Types and executes the symbolic projection

An independent open-source DSL inspired by Pedro Domingos's Tensor Logic. The neural backbone emits a typed module over biological domains; semiring-einsum gives Bool reachability and signed mechanism in one schema; finite-Bool fragments are exhaustively verified locally.

TensorLang v1.3 · finite Bool · plus-times · semantic-hashed manifests
03 · Lean 4 verifier

Issues formal proof receipts

PathwayLean re-derives the same closure under reachFuel and decides each obligation with native_decide. It binds an auditIdentity checksum to TensorLang's semantic_hash so the two backends prove the same finite fragment — disagreement is itself an audit failure.

Lean 4 · native_decide · package PathwayLean · Swift LeanExternalVerifier
04 · Wet lab

Adjudicates biological truth

Verified mechanism hypotheses and surfaced counterexamples flow into LabSpace as testable batches. Outcomes update the relation tensors for the next iteration. The IR contract stays stable across model and biology changes.

LabSpace · standardized assay packages · active-learning loop (planned)

Roles do not overlap. Neural is the only thing that learns continuous biology. TensorLang is the only thing that types and executes the symbolic projection. Lean is the only thing that issues formal proof receipts. Wet lab is the only thing that decides what is true.

Two semiring tiers, one schema

Same biological domains, different reasoning modes — Bool for reachability, signed plus-times for net effect.

A peptide mechanism graph carries the same Peptide × Target × Pathway × CellState × Endpoint axes for both tiers. The semiring choice — not the schema — controls whether the model reasons about possible reach, weighted product, or (planned) probabilistic flow.

Tier 1 · Bool reachability · biology_v0 / biology_v1
(semiring-einsum bool-or-and "pt,tw->pw" Binds ParticipatesIn)
asksDoes any mechanism path exist?
strengthExhaustively verifiable with counterexample search; trivially Lean-mirror-able.
limitCannot distinguish blockade from agonism — Bool models are undirected.
Tier 2 · Signed plus-times · biology_v2
(einsum "pt,tw->pw" BindsSign ParticipatesInSign)
asksIs the net mechanism activating or protective?
strengthSigned F32 path products distinguish efficacy (net protect) from risk (net activate); projects to Bool via threshold for verification.
limitSums over paths; near-cancellation can hide opposing effects. Per-path attribution is on the roadmap.
Live regression bench

Both tiers scored against published clinical truth — the signed layer wins where it matters most.

The eval harness encodes 5 peptide candidates modeling guselkumab, ustekinumab, secukinumab, a broad-JAK inhibitor, and an anti-TNF — annotated against their FDA-label intended indications and documented black-box signals. Every change to the model regenerates this table.

EVAL.md · per-question metrics
Metricv1 Boolv2 signedΔ
Aggregate F10.7500.818+0.07
Aggregate accuracy0.7600.840+0.08
Efficacy F10.8000.800
Safety F10.6670.857+0.19
Safety precision0.6001.000+0.40
Safety recall0.7500.750

Smoke-test scope (5 × 5 = 25 cells per model). Aggregate F1 has high variance at this scale; per-question metrics are the more honest signal. Recall is unchanged because both tiers share the same Bool reachability backbone — the win is in eliminating false safety alarms, not in finding more risks.

tl verify · biology_v2.tl3 counterexamples · 1 v1 false positive resolved
real signal
ustekinumab_like
infection_burden

Anti-IL12/IL23 (p40) blockade suppresses Th1 antiviral defense. The TB / herpes-zoster signal in the FDA label is what the verifier reproduces.

real signal
broad_jak_pep
anemia_severity

JAK2 inhibition disrupts erythropoietin signaling. Matches the well-documented anemia signal in the broad JAK-inhibitor class.

v1 → v2 · resolved
secukinumab_like
cytokine_storm_severity

Bool reachability flagged this as a v1 false positive. The signed layer correctly reads the path product as net protective — secukinumab is an IL-17A antagonist.

$ tl verify biology_v2.tl --json
  efficacy_*_protects_psoriasis            → passed   (×3)
  efficacy_tnf_decoy_protects_ibd          → passed
  safety_no_peptide_activates_storm        → passed   ← v1 false positive resolved
  safety_no_peptide_activates_infection    → failed   (p: ustekinumab_like)
  safety_no_peptide_activates_anemia       → failed   (p: broad_jak_pep)
  v1_false_positive_resolved               → passed
Hash-bound audit

The TensorLang verifier and Lean 4 prove the same finite fragment under the same semantic hash.

Every TensorLang module hashes deterministically over its source. Lean's auditIdentity.artifactChecksum embeds that hash. A Swift verifier loads both, confirms they agree, and (when an elan toolchain is present) drives lake build to confirm Lean re-derives every obligation. Drift becomes an audit failure, not a silent regression.

peptiter.biology_v1 · audit receiptSwift LeanExternalVerifier
let receipt = try LeanExternalVerifier().verify(.init(
  manifestPath:         .../biology_v1.reasoner.json,
  leanSourcePath:       .../BiologyV1.lean,
  lakeExecutable:       .../.elan/bin/lake,
  lakeWorkingDirectory: .../Packages/PathwayLean
))

receipt.module                 == "peptiter.biology_v1"
receipt.manifestSemanticHash   == "e065d18796a17c58…"
receipt.leanArtifactChecksum   == "e065d18796a17c58…"
receipt.hashesMatch            == true
receipt.lakeBuildSucceeded     == true
receipt.status                 == .verified

// per-property TL verdict carried through:
receipt.tensorlangResults
  // [efficacy_* → passed, safety_no_peptide_to_anemia → failed (p: broad_jak_pep), …]
What the receipt commits to
typed contract

Manifest declares input/output shapes over biological domains.

semantic hash

Deterministic over module source. Drift is detectable.

Bool verdict

Per-property pass/fail with explicit counterexamples.

Lean re-derivation

native_decide on the same fragment — independent witness.

Hash binding

Lean's auditIdentity is the manifest's semantic_hash.

Swift surface

First-class Codable types, four-state status, testable.

Roadmap · the underlying science

Where TensFormer's modeling spine grows next.

The integration spine is in place. Each future change publishes a regenerated EVAL.md so we can tell which moves help and which add complexity without a measurable win. None of these are speculative product features — they are concrete extensions of the typed schema, the semiring layer, and the Lean theory.

Shipped

Per-path attribution

emit_biology_v2.py enumerates every signed mechanism path through biology_v2 (23 paths across 14 peptide × endpoint pairs). The Swift LeanExternalVerifier surfaces per-path verdicts so opposing edges from the same peptide no longer cancel into a silent zero — both the protective and risk paths reach the reviewer.

Shipped

BiologyV2.lean signed-sum theorems

BiologyV2.lean encodes 14 signed-sum theorems and 28 path-count theorems decided by native_decide; lake build is green. auditIdentity.artifactChecksum binds to TensorLang's biology_v2 semantic hash so drift between the two backends is an audit failure.

Shipped

Weighted PathwayLean.Core predicates

PathwayLean.Core gained SignedPathRecord plus signedSum / riskPathCount / protectivePathCount / netActivator / netProtective — generic over Peptide and Endpoint inductive types. BiologyV3.lean ships 30 qualitative theorems (net_activator / net_protective / no_net_effect, one per non-zero peptide × endpoint cell) decided by native_decide.

Shipped

Reactome / Open Targets transpiler

reactome_loader + opentargets_loader + transpile_biology compose public mechanism data with the Peptiter-specific BIOLOGY_OVERLAY (cell-state and endpoint annotations) into a SignedV2Spec. biology_v3 (10 peptides, 7 targets, 9 pathways via the IL-23/IL-17/JAK-STAT fixture) and biology_v3_signed (47 enumerated signed paths) are emitted via the same pipeline; tl verify + lake build green. Real Reactome download bootstrap (download_reactome.py + build_biology_v4.py) ships gitignored under transpiler/real/ — pyarrow-gated Open Targets Parquet adapter for the next data scale-up.

Shipped

Closed-loop active learning seeded from biology_v3

V3LabLoopOrchestrator composes ActiveLearningEngine + AssayPlanDrafter + LabJobQueue: pick highest-uncertainty candidate via Beta(α, β) priors, draft an AssayPlan (vehicle / dose schedule / plate map / risk screen all gated), route through the approval gate, walk the LabJob lifecycle drafted → approved → queued → running → returned → analyzed, attach the simulated outcome, update the belief. SCIENTIST.md §11.6 contract demonstrated end-to-end.

Shipped

Probabilistic third tier (log-sum-exp)

A log-sum-exp semiring over the committed biology_v2 schema — same domains, same einsum spec. semiring_spine.py reproduces the hard tiers exactly (14/14 decisive claims) and adds calibrated P(net-protective) + evidence strength. Now Lean-verified to v2 parity: biology_prob_v1.tl (tl check green) + BiologyProbV1.lean (native_decide, lake build green) re-derive P = protective/(protective+risk) exactly — efficacy = 100%, the broad-JAK infection catch = 0%, MAP equals the signed verdict — all three artifacts bound to one semantic hash (3d7281c9…).

Long-term

Tiny neural backbone emitting BiologySpec

Today emit_biology.py is hand-curated. A small transformer that consumes (peptide, context) and emits a BiologySpec JSON validates the boundary in INTERFACE.md before any large pretraining run.

Shipped

Multi-step temporal dynamics

Beyond static reachability to perturbation-conditioned trajectories. The v2 signed mechanism is a per-step influence operator; a discrete Euler update state_t + intervention → state_t+1 over scaled-integer cell-state is now Lean-verified: BiologyTemporalV1.lean (native_decide, lake build green, hash 486594b9…) proves a guselkumab_like intervention is monotone-down on treatment, halved at trough, bounded, and rebounds after washout — plus a discriminator theorem that an adverse Th17-promoting driver is NOT suppressive.

Shipped

Real per-edge confidences (OpenTargets), Lean-verified

The probabilistic tier's uniform prior is replaced with live OpenTargets Platform target↔disease association scores. A noisy-OR over each path's MoA × association gives calibrated confidence varying 0.00–0.83 where the hard tier flattens to ~1. Validated: secukinumab → IBD scores only 0.23 (IL17A–IBD 0.13) — IL-17 blockade is genuinely weak/harmful in IBD — correctly down-weighted. Lean-verified and tightened: BiologyConfV1.lean encodes each score as a ±5% permille interval and native_decide pins an EXACT confidence band [lo,hi] for all 10 claims (width ≤120), proves the robust strongest/weakest, and — honestly — proves the overlapping middle is NOT strictly orderable (no false precision). hash da856445….

Shipped

Claim-specific evidence bands (per-datatype)

BiologyConfV2.lean tightens the uniform band into a claim-specific one from OpenTargets evidence breadth — band = clamp(80−20·n_datatypes,15,80) permille, so well-corroborated associations earn narrower bands. native_decide proves 2 robust orderings the uniform band could not: e.g. guselkumab→IBD [615,653] now sits above guselkumab→psoriasis [511,587] (same drug; IL23R↔IBD has 3 corroborating datatypes vs 2). And it proves the genuinely-similar IBD mid-cluster still overlaps — no false precision. hash 116deb02….

Shipped

Swift Semiring engine + catalog

The explicit semiring abstraction is lifted into the production engine: SemiringSpine.swift defines a Semiring protocol (zero/one/⊕/⊗/edge) with Bool / signed / log-sum-exp instances and one generic contraction that runs the same mechanism chain under any tier. All three new tiers are registered in the MCP catalog; SemiringSpineTests checks the engine and that each tier's manifest hash binds its Lean auditIdentity.

Continuous

Ground-truth coverage

peptide_ground_truth.json now covers 10 candidates (the original 5 plus risankizumab, ixekizumab, adalimumab, baricitinib, upadacitinib) with FDA-label provenance. Every release ships an EVAL.md diff via eval_harness --diff-against-base, plus an SVG badge consumable from any README or dashboard.

Claim boundary. A TensFormer verification receipt proves that a candidate's mechanism claim is internally valid under declared assumptions and that two independent verifiers agree. It does not prove the underlying biology is true. That remains the wet lab's job. The IR contract makes that distinction machine-checkable instead of editorial.

source · open implementation
Packages/PathwayLean/tensorlang/biology_v0.tl
Packages/PathwayLean/tensorlang/biology_v1.tl
Packages/PathwayLean/tensorlang/biology_v2.tl
Packages/PathwayLean/tensorlang/emit_biology.py
Packages/PathwayLean/tensorlang/eval/eval_harness.py
Packages/PathwayLean/PathwayLean/Examples/BiologyV1.lean
Packages/PeptiterDiscovery/.../LeanExternalVerification.swift

TensorLang is an independent open project inspired by Pedro Domingos's Tensor Logic: The Language of AI (arXiv:2510.12269). TensFormer is the peptide-discovery application of that IR.