Repository navigation
A λ that copies its variable goes to BendTT as a plain λ over a λ+ redex, so it converts with the η-long abstract function it stands for (#1189) - #1223
Closed
nicolas-abril wants to merge 1 commit into
Conversation
…dex, so it converts with the η-long abstract function it stands for (bendlang#1189) safe.ts promoted a q=1 λ whose body uses its variable twice to a λ+. The kernel types a λ+ at a q=1 ∀ (only liveness must match), but converts two λs only at the same quantity, and has no η. An abstract f : Nat -> Nat goes out η-long as a plain λx => (f x), so once instantiated at +a => Nat.add(a, a) it became λx => ({λ+a => ..} x), which the kernel never identified with the λ+ the call site emitted; bend2 compares λs by η and accepts it. A λ term (not a def's case tree, whose λs the kernel walks to unfold and to check descent) now goes out as λx => ({λ+y => f : ∀y:A -> B} x), the shape η-expansion gives it, so both sides are plain λs whose bodies reduce to the same term. Closes bendlang#1189 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Collaborator
Author
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.
Closes #1189.
Cause
tree()insafe.tspromoted a q=1 λ whose body uses its variable twice to aλ+. The kernel types aλ+at a q=1∀, becauseTerm.checkonly asks that liveness matches. Conversion is stricter:Term.partspairs two λs only at the same quantity, and there is no η. The declarativePar.lamkeepsqtoo, so this is the theory, not just the executable check.An abstract
f : Nat -> Natin a type goes out η-long as a plainλx => (f x). Instantiated at+a => Nat.add(a, a), it becomesλx => ({λ+a => … : ∀} x). The call site emittedλ+a => …, so the kernel failed at the heads before it reached the redex. bend2 compares λs by η and accepts the file.Change
A λ term that copies its variable now goes out the way η-expansion shapes it:
Both sides are plain λs, and their bodies reduce to the same term. A new
Scope.lamflag limits this to λ terms, whichterm()lowers. A def's case tree (arm()) keeps itsλ+, since the kernel walks those λs to decide when the def unfolds and to check that recursive calls descend.o_upshifts the body's levels under the new outer binder. The change adds 290 ttok tosafe.ts(20,497 / 24,000).Checks
tests/proof/lam_copy_eta.bendholds the issue's case and the used-once case. It fails--verdicton main with the issue's error and passes here.--verdicton all 1,526 files undertests/, run locally against main with the same kernel build: 974 vs. 973 check and 552 fail on both. The one extra pass is the new test, and every other file's output is byte-identical.do-chain shape from the issue)gates/repo.ts: PASS 49 / 49.gates/test.tsandgates/safe.tsdid not run: the cluster refused my SSH key from this session. The change only affects the--verdictand-o .bendttoutput.🤖 Generated with Claude Code