Skip to content

Fix shared substitution slices and open-variable capture - #229

Open
RSoulatIOHK wants to merge 1 commit into
fix/beta-empty-quantifiersfrom
fix/beta-shared-substitution
Open

Fix shared substitution slices and open-variable capture#229
RSoulatIOHK wants to merge 1 commit into
fix/beta-empty-quantifiersfrom
fix/beta-shared-substitution

Conversation

@RSoulatIOHK

Copy link
Copy Markdown
Collaborator

Shared substitution disagrees with Lean's native implementation when the argument slice begins after zero, and it captures open replacement variables under binders. For example, substituting slice [1, 2) of [10, 20] into bvar 0 returns bvar 0 instead of 20.

Use the slice offset only when indexing the replacement array, lift open replacements by the binder depth, and pass the requested slice through shared beta reduction. Closed arguments keep their existing fast path; empty slices return immediately.

Fixes #227. Tests/FixedIssues/Issue227.lean compares 3,600 substitution cases and 40 beta cases with Lean's native implementation, and includes two optimizer regressions and a Blaster call. lake build Tests.FixedIssues.Issue227 passes.

This is a helper correctness fix; the reported cases have not been shown to produce a false top-level Blaster theorem. Stacked on #224.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant