Skip to content

--verdict: the cached kernel is reused whatever Lean built it, and the PATH fallback never checks the Lean version (2.0.35) #1332

Closed

Description

@Gerry9000

Where

bend2/safe.ts, function kernel_bin, at tag v2.0.35 (commit 79df8d9c), lines 1472 to 1500.

What happens

The kernel is cached in ~/.bend/bendtt/<hash>, where <hash> covers only the text of bendtt.lean. When ~/.elan/toolchains/leanprover--lean4---v4.34.0 is absent, the kernel is built with whatever lean and leanc are on PATH, and their version is never checked, although the error text says --verdict needs Lean v4.34.0. Once built, that binary is reused for every later run, even after the right toolchain is installed.

Observed

On a machine whose only Lean toolchain was 4.32.1, --verdict on Bend 2.0.34 built and cached a kernel from Lean 4.32.1 output. Installing the leanprover/lean4:v4.34.0 toolchain later did not rebuild it: the cache key is unchanged, so the kernel built by 4.32.1 would still judge every 2.0.34 book.

Steps to reproduce

  1. Use an environment with no leanprover--lean4---v4.34.0 elan toolchain, Lean 4.32.1 on PATH, BENDTT unset and no cached kernel for the current bendtt.lean.
  2. Run bend --verdict on any file. A kernel is built and cached under ~/.bend/bendtt/<hash>/bendtt.
  3. Install leanprover/lean4:v4.34.0 with elan and run bend --verdict again. The cached binary from step 2 is reused unchanged.

Expected

  • Build the kernel only with Lean v4.34.0, or refuse with the existing message when the PATH Lean reports another version.
  • Include the toolchain's lean --version in the cache key, or verify it on reuse, so a kernel built by another Lean is rebuilt rather than trusted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions