Repository navigation
Closed
Labels
bugSomething isn't working
Description
What you did
bend root_cols_repro.bend --verdict && bend root_cols_repro.bend - root_cols_repro.bendtt
What happened
## Repro
bend root_cols_repro.bend --verdict
bend root_cols_repro.bend - root_cols_repro.bendtt
## Result
ALL PROOFS CHECK
The verdict passes, but the def `skipped` is missing from the kernel text.
The `.bendtt` output holds these defs only:
Void.arms
Void
seen
Nat.arms
Nat
`skipped` is not there, and it is not reported as out of scope either.
## Expectation
One of these:
1. `skipped` goes to the kernel, or
2. `--verdict` fails and names `skipped` as out of scope.
`safe.ts` states the rule itself: "What the kernel cannot express is out of
scope: it goes, with every def that names it, and --verdict fails."
## Cause
The cause is in `root_cols` in `bend2/safe.ts`.
1. `v` is a `~` parameter, so `spec_of` marks it as specialized.
2. Its type `Void` is a datatype with no parameters, and every constructor
has no fields. With zero constructors, that test is true by default.
3. So `vs` is the empty list: `adt.c.map(...)` over zero constructors.
4. `vs !== null`, so the function returns `vs.flatMap(at)`, which is `[]`.
5. `safe_book` pushes one root per entry. Zero entries give zero roots.
6. With no root, the def is never emitted, and `oos` never lists it.
The relevant lines:
const vs = A.$ === "Qnt" ? [B.None(), B.Lone(), B.Many()].map((q) => B.Qua(q))
: adt !== null && adt.c.every((c) => B.term_wnf(e.book, c.T).$ !== "All") ? adt.c.map((c) => B.Ctr(c.k, [])) : null;
if (vs !== null) {
return vs.flatMap(at);
}
## Impact
- The claim itself is sound. A def that takes a value of an empty type holds
for every argument, because there are none.
- The problem is the guarantee. `--verdict` reports that the kernel checked
every def, and here it checked none of the body of `skipped`. Only bend2
checked it.
- So any bend2 checker bug that sits inside such a def would pass
`--verdict` without the kernel seeing it.
- I did not find a way to turn this into a proof of `Empty`. A caller must
pass a closed value of the empty type, and none exists.
## Suggested fix
Treat an empty enumeration as out of scope, so the verdict fails loudly:
if (vs !== null) {
if (vs.length === 0) {
oos("a specialized parameter of an empty type");
}
return vs.flatMap(at);
}
An alternative is to emit the def once at an opaque constant, as the code
already does for a specialized parameter of any other type.
## Environment
| Field | Value |
|---|---|
| `bend version` | bend 2.0.32 |
| Commit | 3378e623 |
| `uname -sm` | Darwin arm64 |
| `clang --version` | Apple clang version 21.0.0 (clang-2100.1.1.101) |
| Lean | v4.34.0 |
The file
# root_cols_repro.bend
import Base
type Void is Data:
law skipped:
for ~v: Void
for n: Nat
Nat
def skipped(v, n):
n
def seen(n: Nat) -> Nat:
nbend --version
bend 2.0.32
uname -sm
Darwin arm64
clang --version (the first line)
Apple clang version 21.0.0 (clang-2100.1.1.101)
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
liampwll commentedon Sep 29, 2026
What's the usecase for proving dead code of that form? I don't think it should be marked out-of-scope because it's not and that generates noise, there's just nothing there to prove.
awilson9 commentedon Sep 29, 2026
Not much of one, just calling it out bc the docs slightly (although trivially so) contradict the observed output
from GUIDE.md
is not completely true since the kernel never sees
skippedand checks 0 lines of itfeel free to close just thought i'd flag
フック・docs: 法則がカーネルに渡っているかを commit 前に確かめる
A def specialized at a finite parameter goes to --verdict once, as a …
A def specialized at a finite parameter goes to --verdict once, as a …
A def specialized at a finite parameter goes to --verdict once, as a …
A def specialized at a finite parameter also goes to --verdict as a λ…