Repository navigation
fix(base): stop list searches when the result is known - #1548
Merged
Lorenzobattistela merged 2 commits intoOct 13, 2026
Merged
Lorenzobattistela merged 2 commits into
Lorenzobattistela merged 2 commits into
Conversation
Lorenzobattistela
approved these changes
Oct 13, 2026
MuhDur
added a commit
to bendlib/bendlib
that referenced
this pull request
Oct 16, 2026
…ugh bridge lemmas bend main after 2.0.37 redefines these Base functions (bendlang/bend#1548, #1459), and proofs that unfold them stop checking (PLAN F39). Proofs now reach their cons cases through internal_ bridge lemmas whose bodies are {==} on 2.0.37; research/candidates/base-next-bridges.bend holds the proofs for the new Base, checked at bend 234cb9b. string.bend checks on bend main with them; list.bend is partly converted. Seven frozen list lemmas have no proof on the new Base at all (bendlang/bend#1616). All statements are unchanged; the full gate and --verdict of list and string pass on 2.0.37. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NJjQ47v3mvnKmc8XojZitg
Lorenzobattistela
added a commit
that referenced
this pull request
Oct 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On the C and JavaScript backends,
List.any,List.all,List.findandList.containsevaluate the recursive search as a strict argument. Because of that they:List.find's predicate from the end of the list, andThis PR has each function call a tail-recursive
.gohelper that carries the previous result. The helper stops whenanyorcontainsfinds a match, whenallsees a false, or whenfindreaches its first match. The signatures, the empty-list results and support for affine elements stay the same.tests/base/list_search.bendcovers:findreturns the first matchOn main, the long-list cases overflow on the interpreter and JavaScript lanes.
Checks (macOS arm64, merged with main):
!call runs the same with--gpu onandoff(Metal)Not run: CUDA, Linux, Windows.