TruthMines: validate constituent libraries independently - #595
Merged
Conversation
johnchandlerburnham
force-pushed
the
jcb/truthmines-validation
branch
from
August 25, 2026 17:11
8b05c82 to
697fd8c
Compare
Member
|
!benchmark aiur-sharded-env |
Contributor
|
| constant | check-time (main) | check-time (PR) | Δ% | throughput (const/s) (main) | throughput (const/s) (PR) | Δ% | peak-ram (main) | peak-ram (PR) | Δ% | constants (main) | constants (PR) | Δ% | shards (main) | shards (PR) | Δ% |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ISLB |
1m 21.7s | 1m 18.9s | -3.4% 🟢 | 2.24K | 2.32K | +3.5% 🟢 | 94.18 GiB | 96.14 GiB | +2.1% | 183,062 | 183,062 | +0.0% | 151 | 151 | +0.0% |
samuelburnham
approved these changes
Aug 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an independently addressable
Benchmarks/Compilefidelity surfacefor every native TruthMines library and for the standalone Palomar.ix aggregate,
then runs the full eight-phase
ix validatepipeline over all of them.The resulting validation matrix contains 79 targets:
Benchmarks/Compile/TruthMines/Members/<Qualifier>.leandriver.Members/Palomar.leanwithout moving Palomar's isolated constituentworkspaces or compatibility ports back into this repository.
All 79 targets pass.
The sweep also found and fixed a real compiler fidelity bug in generated indexed
.brecOn.eqdeclarations. Our Lean and Rust models ofsubstCorepreservedforward dependencies in their original local-context positions, while Lean
actually reverts those declarations and reintroduces them after every unaffected
declaration. The resulting binder-order difference broke Plfl's
Compositional.Holed.brecOn.eqandInference.TyS.brecOn.eq. Both compilerimplementations now reproduce Lean's ordering, and a source-contained regression
fixture pins the behavior.
Motivation
TruthMines already compiled each native library independently into a catalog
piece, but metadata fidelity was not exposed as an ordinary per-library
Benchmarks/Compiletarget. That made it unnecessarily difficult to:ix validateagainst one constituent without building or checking thecomplete corpus.
kernel-checking failure.
workspaces into the native TruthMines Lake workspace.
The new surface keeps the typed TruthMines records and generated canonical
workspace as the authority for native dependency pins. It adds only thin import
wrappers, plus one explicit pin for the independently maintained Palomar.ix
aggregate.
What changed
1. Generated per-library compile workspace
Benchmarks/Compile/TruthMinesis a nested Lake workspace with one module pervalidation target:
Each native wrapper is deliberately minimal:
import Drivers.<Qualifier>The imported
Drivers.<Qualifier>module is generated by the canonicalTruthMines workspace from the typed member record, so its roots and dependency
closure cannot drift into a second hand-maintained pin set.
The compile workspace:
../../TruthMinesby path.../../TruthMines/.lake/packagesrather than fetching another copy ofthe native dependency graph.
879aba8e6c7419bf40549f470e8867ef52c12a54.TruthMinesMemberslibrary target.The projection generator now owns the workspace configuration, toolchain, all
native member wrappers, and the Palomar aggregate wrapper. Therefore:
create and verify both the catalog workspace and the independent compile
workspace.
The fast
truthmines-specsuite additionally checks that:2. Palomar.ix as one aggregate validation library
Palomar's 19 projects intentionally remain in isolated Lake workspaces because
their source module names collide. They cannot safely be imported as 19 peers in
one ordinary
Benchmarks/Compileworkspace.Instead, the new
Members/Palomar.leanimportsPalomar.Mainfrom the standalonePalomar.ix repository. This
provides one coherent 207,030-constant validation environment while preserving
Palomar's repository boundary and the isolated workspaces used to build its
catalog pieces.
Palomar is included in the full validation tier and can be selected directly:
lake exe truthmines validate --only PalomarIt is not added to the native catalog member registry and is not included in the
mini tier.
3. Deterministic prebuild boundary for parallel validation
ix validate <file>normally performs its own Lake build before loading thefile environment. That is convenient for an interactive single-file command,
but it is unsafe for a corpus orchestrator to launch several validators against
one shared package store: each validator starts an independent Lake process, and
those processes can race while updating the same artifacts.
This appeared during a two-job Carleson/Cslib sweep as false cross-process
metadata corruption, including 167 Carleson identity mismatches such as
const name mismatch: Option vs Option. Carleson validated cleanly when run byitself, confirming that the failure was in the build boundary rather than the
compiler result.
The TruthMines runner now:
Members.<Qualifier>targets in one authoritative Lakeprocess.
--no-buildto each validator so it only loads and validates thealready-built environment.
The single-job path uses the same prebuild boundary, so serial and parallel
sweeps exercise identical artifact state.
ix validategains the opt-in flag:ix validate Some/Driver.lean --no-buildThe default behavior remains unchanged. Without
--no-build,ix validatestill builds the source file and fetches the Mathlib cache when necessary.
The Mathlib cache lookup now reads a workspace's configured
packagesDirfromlake-manifest.jsoninstead of assuming.lake/packages. This makes the normalinteractive validation path work for the nested compile workspace as well.
4. Full per-library TruthMines validation command
truthmines validatenow operates on validation libraries rather than catalogmember driver paths:
The existing watchdog and memory-ceiling behavior remains in place. The default
is still one validator at a time because Mathlib-scale validation retains both
compile and decompile state;
--jobsis intended for explicitly chosensmall-member batches or suitably provisioned machines.
Every failure remains exit-code gated and names its validation target. No side
report artifact is required.
5. Indexed
.brecOn.eqlocal-context fidelityThe full sweep was clean except for Plfl, where six checks failed across
aux-generation congruence, roundtrip aux congruence, and per-constant fidelity.
The reduced failures were:
Compositional.Holed.brecOn.eqInference.TyS.brecOn.eqBoth declarations are generated for indexed inductives with constructor fields
whose dependency sets overlap only after an earlier index substitution.
Lean's
substCorebehavior is significant here. It:declaration.
For a constructor shaped like:
substituting
ifirst moves the recursiveIfield behind the unaffectedTfield. A subsequent substitution ofjmust therefore discover forwarddependencies in
T, Iorder.The old Ix model substituted forward dependencies in place. That preserved the
stale
I, Torder and generated an observably different proof telescope. Thefix, mirrored in Lean and Rust, is to:
The new
TypeBrecOnForwardDepOrderfixture includes recursive-then-payload andpayload-then-recursive constructor shapes. It reproduces the ordering condition
without importing Plfl and runs through the existing aux-generation validation
suite.
Validation results
All 79 independently addressable libraries pass the complete
ix validatepipeline. Notable large environments include:
Plfl's final run reported zero failures in every phase:
The complete generated
TruthMinesMemberslibrary also builds successfully(14,850 Lake jobs), establishing that every independent driver elaborates in
the shared workspace before validation begins.
The Carleson/Cslib two-job regression sweep is clean with the new prebuild
boundary and no longer launches Lake from the individual validator processes.
Tests
The following checks are green:
The generated compile workspace was built with:
The 79 validation targets were exercised in controlled batches through
truthmines validate --only ..., with focused reruns for the concurrency andPlfl regressions.
Review guide
The change is easiest to review in four layers:
Projection and workspace shape
Benchmarks/TruthMinesSpec/Projection.leanBenchmarks/Compile/TruthMines/lakefile.tomlTests/Ix/TruthMinesRecords.leanValidation orchestration
Benchmarks/TruthMinesSpec/Main.leanIx/Cli/ValidateCmd.leanIx/Meta.leanCompiler fidelity fix
crates/compile/src/compile/aux_gen/brecon.rsIx/AuxGen/BRecOn.leanRegression fixture and documentation
Tests/Ix/Compile/Mutual.leanTests/Ix/TruthMines.leanBenchmarks/Compile/README.mdMost of the file count is generated two-line member wrappers and the Lake
lockfile. The substantive logic is concentrated in the files listed above.
Compatibility and risk
ix validateretains its existing build behavior unless callers explicitlypass
--no-build.records and canonical generated workspace.
.brecOn.eqchange makes both Ix implementations match Lean's actuallocal-context ordering and is covered by the same eight-phase fixture pipeline
used to diagnose the external failure.
this PR does not weaken watchdog or memory-ceiling enforcement.
Non-goals
workspace.
.ixccomposition.ix validatecommands.