#1193·Bend

--verdict: the kernel runs out of fuel on conversion_shared_cells_once.bend, which bend2 checks by sharing (2.0.34)

Author: nicolas-abrilCreated Sep 29, 2026Updated Sep 29, 2026
Labelsbug

What you did

bash
cd tests/check
bun ../../bend2/main.ts conversion_shared_cells_once.bend --verdict

On main (eb8f58b1, Bend 2.0.34).

What happened

bend2 checks the file, but the kernel rejects it:

$ bun ../../bend2/main.ts conversion_shared_cells_once.bend --check-only
ALL PROOFS CHECK
Use --verdict for mathematical validity.

$ bun ../../bend2/main.ts conversion_shared_cells_once.bend --verdict
SOME PROOFS FAIL
Sorry - this is a mismatch between the TypeScript implementation, and the formalized BendTT kernel. ...

Running the kernel directly on the emitted book (9.8 KB) shows why:

$ bun ../../bend2/main.ts conversion_shared_cells_once.bend -o csc.bendtt
$ ~/.bend/bendtt/<hash>/bendtt csc.bendtt
SOME PROOFS FAIL
In agree_32:
out of fuel

It takes about 7 s to give up.

The test came in with 2.0.34 (#1071, PR #1151, 7d8a3eb0), which made bend2's conversion compare a shared graph once. As the test's own comment says, each of the 32 levels of both roots uses the level below twice, so comparing them as a tree takes about 2^32 steps. bend2 now avoids that blowup; the kernel in bend2/bendtt.lean doesn't, so it runs out of fuel on agree_32.

This wasn't caught because the normal gates don't run --verdict: gates/test.ts checks each test with --checkup, and gates/_run.ts runs repo, test, perf and ping. Only gates/safe.ts tests runs the kernel over the corpus. In a local --verdict sweep of all 1,522 files in tests/, this is the only kernel mismatch.

Expected

Either the kernel's conversion shares equal subterms the way bend2's now does (so agree_32 checks within its fuel), or the mismatch is recorded as a known limit of the kernel. Sharing in the kernel means bendtt.lean's proofs have to cover it.

The file

tests/check/conversion_shared_cells_once.bend:

python
import Base

def mix(a: U32, b: U32) -> U32:
  (a * 31 + b : U32)

def root_loop(d: Nat, +h: U32) -> U32:
  match d:
    case 0n: h
    case 1n+p: root_loop(p, mix(h, h))

def sq(+h: U32) -> U32:
  mix(h, h)

def root_rec(d: Nat, +x: U32) -> U32:
  match d:
    case 0n: x
    case 1n+p: sq(root_rec(p, x))

def agree_32(+x: U32) -> {root_loop(32n, x) == root_rec(32n, x) : U32}:
  {==}

bend --version

bend 2.0.34 (main at eb8f58b1)

uname -sm

Darwin arm64

clang --version (the first line)

Apple clang version 17.0.0 (clang-1700.6.4.2)