Repository navigation
fix(bendtt): distinguish free variables in diagnostics - #1707
Open
vicmcorrea wants to merge 1 commit into
Open
vicmcorrea wants to merge 1 commit into
vicmcorrea wants to merge 1 commit into
Conversation
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.
Problem and fix
Term.showprints every free index asx0because natural-number subtraction saturates. For example,Ctx.fit (Book.of []) [] (Var 1) (Var 0)reportsexpected: x0 / observed: x0even though the terms differ.Preserve bound-variable names and print
free[i - d]when indexiis outside depthd. This isolates the diagnostic portion of #1448, following the maintainer's separate-scope guidance.Blast radius
Only the
Varbranch ofTerm.showinbend2/bendtt.leanchanges (+3/-1). The change affects printing open terms; parser/checker logic, reduction, claims and proofs are untouched. The default--verdictkernel cache uses a new source key.Regression evidence
Two native Lean harnesses use the actual source's THEORY section and its existing
Ctx.fit/Term.checkconsumers. The baseline fails the diagnostic guards; this change passes them. The example above now reportsexpected: free[0] / observed: free[1].Controls cover distinct free indices, depth-relative shifts, nested binders and rewrite motives. Bound names, successful closed checks and the direct
unbound variableerror remain unchanged.Checks
lean bend2/bendtt.leanwith Lean 4.34.0: passes.git diff --checkpasses.Validation limits
The reproduction constructs malformed open terms through the Lean API. Ordinary parsed
.bend/.bendttCLI reachability has not been established; this is a diagnostic cleanup, not a soundness fix. The native harnesses are private validation, not a new tracked test suite. Checks ran on macOS arm64; full cluster, GPU, performance gates and a full native-kernel CLI corpus were not run.