Skip to content

--verdict: a template lambda that captures a run-time value inside a type is out of scope for BendTT, but bend2 accepts it #1483

Open

Description

@nohzafk

Reproducer (bend 2.0.36)

import Base

def least(lo: Nat, xs: List<&2, Nat>) -> Data:
  {List.all(~&2, ~Nat, ~(y => Nat.is_le(lo, y)), xs) == True{} : Bool}

def least_nil(lo: Nat) -> least(lo, Nil{}):
  {==}
$ bend u1.bend --check-only
ALL PROOFS CHECK
$ bend u1.bend --verdict
SOME PROOFS FAIL
Sorry - this is a mismatch between the TypeScript implementation, and the formalized BendTT kernel. ...
$ bend u1.bend -o u1.bendtt
BendTT: out of scope, so not in u1.bendtt:
- least: a template argument that depends on a run-time value
- least_nil: names least, out of scope: a template argument that depends on a run-time value

The same template applied in live code is rejected by bend2 itself, with a clear message (expected : a template applied to closed ~ arguments (lo is a variable here, not comptime: pass it at run time)). Inside a type, bend2 accepts it and only --verdict fails, with the generic mismatch message.

Expected

One of:

  • the BendTT translation handles a template lambda that captures a variable in a dead position (a type), or
  • bend2 rejects it there too, with the same message it gives in live code, so the check and --verdict agree.

Impact

bend-mathlib's sort.bend states "every element is at least lo" this way (internal_least), so all its merge-sort lemmas (merge_by_sorted, msort_by_sorted and helpers) are out of scope under --verdict. This is separate from #1182, which is the ~le_total part of the same file.

Related: #1182, #1180 (closed; a different "depends on a run-time value" case).

Activity

  1. changed the title [-]Title: --verdict: a template lambda that captures a run-time value inside a type is out of scope for BendTT, but bend2 accepts it[/-] [+]--verdict: a template lambda that captures a run-time value inside a type is out of scope for BendTT, but bend2 accepts it[/+] on Oct 11, 2026
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