Repository navigation
Description
What you did
bend fuel.bend # bend2 only
bend fuel.bend --verdict # bend2, then the BendTT kernelBend 2.0.34 (release v2.0.34, 7d8a3eb0), Bun 1.3.14, kernel built from bend2/bendtt.lean (digest of the file: 61e0d2d9f4ddd7dd) with Lean 4.34.0.
What happened
bend2 checks the file at once; the kernel runs out of fuel, and --verdict reports it as a mismatch:
$ bend fuel.bend
ALL PROOFS CHECK
Use --verdict for mathematical validity.
$ bend fuel.bend --verdict
SOME PROOFS FAIL
Sorry - this is a mismatch between the TypeScript implementation, and the formalized BendTT kernel. Your proofs may or may not be correct, and we cannot validate them yet. This will be addressed in a future update. Meanwhile, feel free to open an issue to report this bug.
$ bend fuel.bend -o fuel.bendtt && ~/.bend/bendtt/<hash>/bendtt fuel.bendtt
SOME PROOFS FAIL
In bigLe:
out of fuel
A Nat literal past 256n is U32.to_nat(n); bend2 evaluates it natively, the kernel evaluates it in unary and compares step by step, so one conversion on literals of a few million exhausts FUEL (400 000 000 in bendtt.lean). Measurements, one law per file, same machine (--verdict takes about 8 s to give up):
Law (proven by {==}) |
bend2 | --verdict |
|---|---|---|
{Nat.is_le(2500000n, 2500001n) == True{} : Bool} |
pass | pass (7 s) |
{Nat.is_le(3000000n, 3000001n) == True{} : Bool} |
pass | out of fuel |
{Nat.is_le(4200000n, 4200001n) == True{} : Bool} |
pass | out of fuel |
{Bool.and(Nat.is_le(1600000n, 1600001n), Nat.is_le(1600000n, 1600001n)) == True{} : Bool} |
pass | out of fuel |
{Nat.is_le(1600000n, 1600001n) == True{} : Bool} & {Nat.is_le(1600000n, 1600001n) == True{} : Bool}, proven by ({==}, {==}) |
pass | pass |
The last two rows show the budget is per conversion (Term.check's Rfl case calls Term.conv … FUEL afresh, bendtt.lean:1102): two comparisons that pass as two separate equalities fail inside one Boolean conversion. The practical case that led here: a closed Bool computation over a list of 18 inclusive intervals of code points up to 1114111n (Unicode's noncharacters), checked by bend2 in 13 s and rejected by the kernel with the same notice.
This is not #1193 (the kernel running out of fuel where bend2 shares a graph): no sharing is involved here, only the unary evaluation of literals. WONTFIX.txt covers bend2's own exponential or overflowing conversions and asks for large constants to stay abstract; it says nothing about the kernel's fuel, and the 2.0.34 changelog mentions it only for shared graphs. If the kernel's unary literals are a known limit, a line there and a verdict message that says "out of fuel" (what the kernel prints) instead of the generic mismatch notice would save the next person the diagnosis.
Expected: either a native path for Nat literals in the kernel's evaluator (a normal form for U32.to_nat of a literal that converts without unfolding), or the limit documented with its order of magnitude and surfaced by --verdict.
Workaround used: keep every large literal comparison in its own equality obligation (one {==} each) and derive the closed Bool form from a generic law, so that no single conversion evaluates more than one such comparison.
The file
import Base
law bigLe:
{Nat.is_le(3000000n, 3000001n) == True{} : Bool}
def bigLe():
{==}The paired control (passes both checkers):
import Base
law paired:
{Nat.is_le(1600000n, 1600001n) == True{} : Bool} &
{Nat.is_le(1600000n, 1600001n) == True{} : Bool}
def paired():
({==}, {==})and the same two comparisons inside one conversion (bend2 passes, the kernel runs out of fuel):
import Base
law combined:
{Bool.and(Nat.is_le(1600000n, 1600001n),
Nat.is_le(1600000n, 1600001n)) == True{} : Bool}
def combined():
{==}bend --version
bend 2.0.34 (bend --version is not an option in this release; the version is the release tag v2.0.34, 7d8a3eb0)
uname -sm
Darwin arm64
clang --version (the first line)
Apple clang version 21.0.0 (clang-2100.3.34.2)
Activity
hotschmoe commentedon Oct 16, 2026
Another case of the same fuel limit, with no large literals and no sharing: a long
closed computation. This is the "proof by reflection" pattern (a decision procedure
all_ok() -> Boolproven by{==}). bend2 accepts it and--verdictrejects it onceone conversion needs more than
FUEL(400 000 000) steps.Same result on 2.0.34, on the 2.0.37 linux-arm64 release, and with a kernel built from
bendtt.leanat maind2aeefc1. The control with128npasses all three.The limit is about 14.1 M recursive calls per
{==}. I bisected the call count Nwith
{(walk3(256n, 256n, a) && walk2(256n, b)) && walk(c) == True{} : Bool}, whereN = 65536a + 256b + c:
RflconversionThat is about 28.3 fuel per call, linear in N. The fuel column comes from a copy of the
kernel's Part 1 (the theory, without the proofs) with
FUELraised to 10^12 and adbgTraceofFUEL - r.2inTerm.check'sRflcase. Its pass/fail boundary is thesame as the stock kernel's.
On real code this happens early. A GF(256) table-multiply law
{mul_comm_all() == True{} : Bool}, which enumerates all 65 536 pairs, checks in bend2in about 60 s. The kernel fits 16 rows of 256 pairs (4 096 pairs, 398 458 951 fuel) and
runs out at 17 rows (4 352 pairs, 424 359 031). The full law takes 6 619 901 069 (16.5×
FUEL), and its siblingdiv_mul_alltakes 8 570 460 762 (21.4×).I rebuilt the full
bendtt.lean, proofs included, with onlyFUELchanged:repro.bendand the 64-row law. It still rejects a falsevariant of the repro (
== False{}) withexpected:/observed:.BENDTT=<that kernel> bend PROOF.bend --verdicton the whole 13-law GF(256)file prints
ALL PROOFS CHECK(12 min).So this is a step budget, not a disagreement about what the terms reduce to.
Two notes on the reporting side:
adds the kernel's
In big: / out of fuelabove it. The notice still says "mismatch"and asks for an issue. fix(verdict): show kernel failure details (#1535) #1536 kept that on purpose, but for this class of failure the
kernel did not decide anything.
presents
{==}over a closed computation as a proof. One sentence giving the order ofmagnitude ("one
{==}may take about 4 × 10^8 kernel steps, about 10^7 simplerecursive calls; split larger closed checks into several laws") would have saved the
diagnosis. A kernel flag or env var for the budget would also do, since running out
only ever rejects.
Environment: Linux aarch64; Lean 4.35.0 for the kernel builds (not the 4.34.0 the CLI
asks for); bend 2.0.34 and 2.0.37.
Investigated with the help of Claude Code; the repro and its 128n control were re-run on 2.0.34 just before posting.
ScottMoore0 commentedon Oct 17, 2026
A variant that may help narrow this down (Bend 2.0.37): the literal only trips
--verdictwhen it is bound to a reusable (+) parameter that is used twice.--check-only: ALL PROOFS CHECK.--verdict: SOME PROOFS FAIL, with "this is a mismatch between the TypeScript implementation, and the formalized BendTT kernel".--verdict; with 16777216n or 2147483647n it fails.mused once, or with the same literal placed in a constructor field, it passes.In practice this hits ordinary code. An allocator range defaulting to 0..2^31-1, or a decoder's output limit, ends up as exactly such a parameter. Libraries then switch those fields to U32 to keep
--verdictusable.Found and tested with Claude Code, running Claude Opus 5.5, during an audit of
--verdict.oxura commentedon Oct 23, 2026
I checked the emitted book rather than the notice: the literals arrive as Nat.add/Nat.mul over Zero/Succ, then Nat.cmp walks them. The unchanged kernel is 62,686/64,000 tokens with the pinned counter.
For a real fast path, would you prefer compact literals with a proved expansion, or shortcuts for arithmetic definitions whose actual bodies match a proved model? The latter would keep the calculus unchanged; names like Nat.cmp alone wouldn't be trusted. I want to settle that shape before another PR, and won't trim the proof or change the cap.
oid: the registry's names and arcs are unique, each entry found again