--verdict: safe.ts's group_of picks a group by a def's first later-filled name, not by membership — a dead forward reference to a law crashes -o/--verdict, emits a non-member selector, or (with a name_tt collision) PASSes a book computing a different value
What you did
bend fb3.bend; bend fb3.bend --verdict; then kernel oracles on bend fb3.bend -o fb3.bendtt (and --verdict on g4.bend, g2.bend)
What happened
fb3.bend (with a-b.bend beside it):
$ bend fb3.bend --check-only ALL PROOFS CHECK
$ bend fb3.bend False{}
$ bend fb3.bend -o fb3.bendtt exit 0, no out-of-scope lines
$ bend fb3.bend --verdict ALL PROOFS CHECK
Kernel oracles appended to fb3.bendtt:
ora : {main == (.True, ()) : Bool} = {==} -> ALL PROOFS CHECK
ora : {main == (.False, ()) : Bool} = {==} -> In ora: expected: main / observed: (.False, ())
g4.bend:
$ bend g4.bend --check-only ALL PROOFS CHECK
$ bend g4.bend --verdict TypeError: null is not an object (evaluating 'g.k') (exit 1, no FAIL header)
$ bend g4.bend -o g4.bendtt the same TypeError; no file written
g2.bend:
$ bend g2.bend --verdict SOME PROOFS FAIL (MISMATCH)
-o emits use : ∀x0 : Nat -> Nat = λx0 => {(L.group x0 (.d, (.L, ()))) : Nat}
kernel: In use: a label of <L, h>The file
# ---- a-b.bend ----
def ign(-b: Bool, r: Bool) -> Bool:
r
law L:
for n: Nat
Bool
def M(n: Nat) -> Bool:
ign(L(n), True{})
# ---- fb3.bend ----
import Base
import ./a-b.bend as AB
def a_2d_b.M(n: Nat) -> Bool:
AB.ign(AB.L(n), False{})
def AB.L(n):
match n:
case Zero{}:
True{}
case Succ{p}:
AB.M(p)
def main() -> Bool:
a_2d_b.M(Zero{})
# ---- g4.bend ----
import Base
def keep(-p: Nat, x: Nat) -> Nat:
x
law L:
for n: Nat
Nat
law L2:
for n: Nat
Nat
def h(n: Nat) -> Nat:
keep(L(n), n)
def L(n):
match n:
case Zero{}:
keep(L2(0n), 0n)
case Succ{m}:
h(m)
def L2(n):
0nHow a group forms. later(k)
(safe.ts#L942-L945)
lists the defs k's body names that are filled after k. It reads refs (L1074-1089), which walks every
field except s, v and T, so a reference in an erased argument counts. group_of(k) (L947-953) is
group_new(later(k)[0] ?? k): the group led by k's first later-filled name, whether or not k is in it.
A live forward call to an unfilled law is rejected by bend2, but a dead one (keep(L(n), n) with
keep(-p: Nat, x: Nat)) is not.
Three faces from that.
- Crash (
g4). A call to the memberhqueues the item'\t' + L;item_emit(L272-274) rebuilds the group withgroup_of(e, L)— a different computation — and L's own dead reference toL2givesgroup_new(L2), which is null because nothing namesL2back.group_emitdereferencesg.k(L1014). ATypeErrorisn't aScope_Error, so it escapes to main.ts as a raw trace. - Non-member selector (
g2).args(L918-921) routes a call throughgroup_callwhenevergroup_of(k)is non-null, without checking membership.dhas a dead reference toL, so its call goes out asL.groupwith selector.d, which isn't in the enum<L, h>. - Wrong program, PASS (
fb3). Same misroute, but the non-member's namea_2d_b.Mcollides undername_ttwith the module's membera-b.M(#1131), so the label lands inside the enum<a_2d_b.L, a_2d_b.M>and the kernel accepts.mainis wired to the module'sM(True); the local def the source names is emitted asa_2d_b.M_and nothing references it.
Not a proof of Empty: bend2 checks the source at the source's types and the misroute only rewrites
safe.ts's copy, so whichever side reads a type as Empty rejects. But a --verdict PASS here no longer
attests to the source book.
item_emit(L274): rebuild the group from its lead,group_emit(e, group_new(e, k.slice(1)) as Group, cols, n).args(L919):if (g !== null && g.ms.includes(k as Name)). With both,g2andg4PASS andusebecomesλx0 => (d x0).- Alternatively, have
refs/latercount only live positions, so a dead reference never forms a group (not tested).
Separately, C3 on #1131 (labels aren't made unique the way def names are) is what turns the misroute into a silent PASS.
bend --version
bend 2.0.34
uname -sm
Linux x86_64
clang --version (the first line)
No response
Source: HigherOrderCO/Bend