Sketch Pulse short-circuiting for stateful boolean operands#4336
Draft
eluvane wants to merge 9 commits into
Draft
Sketch Pulse short-circuiting for stateful boolean operands#4336eluvane wants to merge 9 commits into
eluvane wants to merge 9 commits into
Conversation
Contributor
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.
This PR is a draft Pulse follow-up to #4322 and #4335. It is not intended as a polished final fix; it is a concrete sketch of the checker changes and regressions that may help the Pulse maintainers finish the design.
The change explores short-circuit-aware hoisting for stateful
&&and||operands in expression positions such aslet b = ...; b, while keeping top-level hoisting conservative so existing while-guard proofs continue to use the old path.The checker-side changes recognize
Prims.op_AmpAmpandPrims.op_BarBarbefore generic argument hoisting, reify them as Pulse control flow when hoisting nested/control-flow return bodies, and keep branch-post joining conservative. Existingrewrites_tofacts stay on the old elimination path, while plaineq2branch facts may substitute local result variables before those variables are closed. That lets inferred branch posts simplify under branch facts without broadly changingrewrites_tohandling.A new regression file,
ShortCircuitStatefulBool.fst, uses stateful boolean helpers that increment a counter when evaluated. The positive cases cover&&,||, nested short-circuiting, expression-position conditionals, and pure boolean operands. The while-guard case remains markedexpect_failure, documenting the remaining limitation without breaking existing Pulse examples.