Contract pass: assert postconditions in body for opaque procs - #48
Draft
keyboardDrummer-bot wants to merge 4 commits into
Draft
Contract pass: assert postconditions in body for opaque procs#48keyboardDrummer-bot wants to merge 4 commits into
keyboardDrummer-bot wants to merge 4 commits into
Conversation
Tests added to T2_ImpureExpressions.lean: - Dangling if in expression position (needsCondVar == false) - Assert/assume in expression position (lifted by the pass) - Assignment to fresh variable in expression position Removed commented-out code: - Assert/Assume cases in onlyKeepSideEffectStmtsAndLast - Old conditional guards in transformStmt for Assert/Assume - LiftExpressionAssignments pass from Laurel pipeline - EliminateMultipleOutputs/InlineLocalVariablesInExpressions from corePipeline
Add tests for lifting pass features and remove commented-out code
Move postcondition assertions into the procedure body for opaque procedures with implementation, matching the transparent case. The postconditions are now asserted as inline statements after the implementation rather than being kept in the Opaque postconditions list for the Core translator to handle. This ensures consistent behavior: separate $pre and $post helper procedures are generated per condition, used at call sites via assert/assume, while the procedure's own body asserts the raw conditions directly.
The original change cleared postconditions from the Opaque list and added inline assertions. This broke pyAnalyze golden-file tests because the Core translator uses the Opaque postconditions list to generate spec postconditions (which produce the named obligation results in verification output). Keep postconditions in the Opaque list for spec generation while preserving the refactoring that hoists postAsserts computation and fixes the Abstract pattern binding.
keyboardDrummer
force-pushed
the
issue-924-contract-and-proof-pass
branch
from
June 10, 2026 08:23
743cc5a to
87d7214
Compare
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.
Summary
Moves postcondition assertions into the procedure body for opaque procedures with implementation, matching the transparent case.
Previously, for
.Opaque _ (some impl) _, postconditions were kept in the Opaque postconditions list and handled by the Core translator'stranslateChecks. Now they are asserted as inline statements after the implementation body, consistent with how transparent bodies work.The separate
$pre{i}and$post{i}helper procedures are generated per condition (one each), used at call sites via assert/assume. The procedure's own body asserts the raw conditions directly for better verifier interaction.What was tested