Repository navigation
Conversation
…ers, so --verdict checks what bend2 checks (bendlang#1665)
…-verdict checks what bend2 checks (bendlang#1669)
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.
Fixes #1669. Depends on #1666, whose
subst(t, d)the fix uses. Until #1666 merges, this PR's diff also shows its two commits. Only the last commit, 45716b3, is new here.Cause
use(-f: P -> Nat)takesferased, so bend2 lets the λ passed for it use its variable twice.rebuildinsafe.tsturns that λ into a λ-match on the variable and calls the λ's body on each constructor, under a binder per field. bend2's annotations name a variable by the level bend2 checked it at, so they still name the variable's old level. With fields, that level now belongs to the first field, and the kernel rejects the term (expected: P). With no fields, no variable in scope has that level, and--verdictreports a free variable.Fix
rebuildpasses the λ throughsubst(x, s.d)before it calls the body, as #1666 does ineta. In the lowered form, an annotation names the body's binders as the body's own uses do, so the annotations move with the binders.Checks
On #1666's head (fce97a9), Linux x86_64, kernel built from main's
bendtt.leanwith Lean 4.34.0:tests/check/rebuild_levels.bendcovers an annotation that names the variable, for a type with two constructors (pair) and for one with no fields (unit), and one that names the binder of a λ inside the body (inner). Each one fails--verdicton A term η-expanded under a new λ keeps its annotations on its own binders, so --verdict checks what bend2 checks (#1665) #1666 when it is on its own.pairandinnerfail in the kernel, andunitfails as out of scope. A law pinsmainat6n. The file prints6nwhen run and from the JS and C builds, and--checkupexits 0.substats.d + 1ors.d - 1, fails all three.--verdictgives the same exit code and output as A term η-expanded under a new λ keeps its annotations on its own binders, so --verdict checks what bend2 checks (#1665) #1666, and-ois byte-identical. Both files in--verdictmismatch: a λ rebuilt as a match keeps its variable's old level in its annotations (NatwherePis expected) #1669 check, and the-oof itstwice.bendis byte-identical to the hand-written version's.bun gates/repo.tswithttok==0.3: 54 / 54.safe.tsgoes from 23,987 to 23,997 ttok.tsc: 11 errors, the same as main.Merge order
With #1657 as well, all three PRs apply cleanly and the tests above check, but
safe.tscomes to 24,006 ttok, over its 24,000 cap. Whichever of #1657 and this PR lands second has to save 6 tokens.