feat: add lake check as a comparator frontend - #14885
Draft
Kha wants to merge 3 commits into
Draft
Conversation
Collaborator
|
Reference manual CI status:
|
|
Mathlib CI status (docs):
|
lake check as a leanchecker/comparator frontendlake check as a comparator frontend
Kha
marked this pull request as ready for review
August 24, 2026 12:36
Kha
marked this pull request as draft
August 24, 2026 13:55
This PR ships the Lean NDJSON exporter as a new `leanexport` toolchain binary and vendors the proof-comparison libraries of [Comparator](https://github.com/leanprover/comparator) into Lake. There is no user-visible behavior change yet; `lake challenge` follows. The exporter lands under a single `LeanExport` module prefix (`src/LeanExport.lean` plus `src/LeanExport/{Basic,Parse}.lean`) and is built like `leanchecker`/`leanir`. Since `Lake.Check` imports `LeanExport.Parse`, `libLake_shared` additionally links `libLeanExport.a.export`; the archive is linked without `--whole-archive` so the exporter's `main` stays out of the shared library. `tests/lake/lakefile.toml`, which builds Lake standalone, gains a matching `LeanExport` library for the same reason. Every vendored file is byte-identical to its upstream source once the module header and the `LeanExport`/`Lake.Check` namespace wrapper are removed, so the diff can be checked mechanically rather than read. The sources are `lean4export` at `3de59f10` and Comparator at `8d84e678`. `leanexport` accordingly produces byte-identical output to upstream `lean4export` built against the same toolchain. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR vendors Comparator's `Main.lean` as `Lake/CLI/Check.lean`. There is no user-visible behavior change: nothing calls it yet, and `lake check` follows in the next commit. The code is transliterated rather than rewritten, so that it diffs cleanly against upstream: only the module header, the `Lake.Check` namespace, the `LeanExport` names and `Kernel.Environment.replay` (which `Environment.replay` is now deprecated in favor of) differ. The executable `main` is dropped, since this is a library module. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This PR ships Comparator as `lake challenge`, so judging a solution no longer means cloning a repository, matching its toolchain to the one that built the `.olean` files, and hand-writing the wiring: a challenge author distributes the project and its configuration, and a solver runs one command. `landrun` remains a hard requirement with no unsandboxed mode, so the command is available on Linux only. The configuration is Comparator's, unchanged, passed with `--config`. Exit codes now split three ways instead of raising a `userError` for everything: 2 for failing to start at all, such as a missing `landrun` or a configuration that is absent or malformed, and 1 for a rejected solution, so that a caller can tell an environment problem from a judgment. `lean4export` becomes the `leanexport` toolchain binary, so third-party checkers can keep using it standalone, and Comparator's libraries land under `Lake.Check`. Both are vendored from `lean4export` at `3de59f10` and Comparator at `4c921f7ab3ce`, byte-identical to their sources once the module header and the namespace wrapper are removed, so that part of the diff can be checked mechanically rather than read. `leanexport` accordingly produces byte-identical output to upstream built against the same toolchain. The commits separate the vendoring from the changes: the libraries, then Comparator's `Main.lean` as `Lake/CLI/Check.lean` wired to nothing, then the departures from that baseline, so that the third diff is the review surface. Those departures are the exit codes above; `LeanInstall.sysroot`, `LakeInstall.lake` and the bundled `leanexport` in place of `PATH` lookups, which removes a weak link inside the sandbox; `LEAN_PATH` taken from the loaded workspace rather than requiring a `lake env` wrapper; and a `git` lookup that reports absence instead of throwing. `COMPARATOR_LEAN4EXPORT` is deliberately not honored. The export format has to match the compiler that produced the `.olean` files, which is exactly the pinning this change removes, so honoring a stale setting from an existing CI configuration would quietly reintroduce it. `COMPARATOR_LANDRUN` and `COMPARATOR_NANODA` keep working, since neither tool is bundled. Comparator's test projects become `tests/lake/tests/check-*`, along with its `fake-landrun.sh` stand-in, which the tests select through `COMPARATOR_LANDRUN` since Landlock cannot be assumed available in CI containers. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
tydeu
removed their request for review
August 25, 2026 17:15
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 ships
lake checkas a frontend tocomparator, significantly simplifying its setup.landrunremains a hard requirement with no unsandboxed mode, so the command is available on Linux only for now.The configuration is unchanged from comparator, passed with
--config. Exit codes have become more fine-grained: 2 for failing to start at all, such as a missinglandrunor a configuration that is absent or malformed, and 1 for a rejected solution, so that a caller can tell an environment problem from a judgment.lean4exportbecomes theleanexporttoolchain binary, vendored at3de59f10, and comparator's libraries land underLake.Check(no separate executable), vendored at4c921f7ab3ce.To follow: additional checking modes and configurations.