Simplify list append and drop through symbolic tails - #235
Open
RSoulatIOHK wants to merge 4 commits into
Open
Conversation
# Conflicts: # Tests/FixedIssues.lean
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.
List append and drop stop when the remaining list is symbolic, even if known constructors determine part or all of the answer. For example,
[1, 2] ++ xsandList.drop 2 (1 :: 2 :: xs)remain unnecessarily opaque.Consume the known prefix, preserve the symbolic tail, and rebuild only the residual operation. Append reuses its right operand directly when the left prefix ends in nil. Drop visits at most the requested number of known constructors and returns the tail as soon as the count reaches zero.
Tests/FixedIssues/Issue233.leancontains kernel-checked witnesses, eleven optimizer regressions for complete/partial prefixes and zero/nil cases, an optimizer-only Blaster composition, and a negative near-miss. Issue #233 was opened with the minimal examples before implementation. Existing #101 and #103 handle different rewrite rules and do not cover these cases.Validation:
lake build Tests.FixedIssues.Issue233 Tests.Smt.SmtListandlake testpassed. The complete stack includes the scope-safe SMT-sharing change; tests use the same Z3 4.15.2 executable and 30-second process cap as the baseline.Fixes #233.
The review report records all findings, existing PR overlap, the stack, benchmark evidence and remaining draft work.