Range analysis: add symbolic constant folding for SymbExpr and cover identity simplification cases#14
Merged
Coursant merged 3 commits intoSymbexpr-Cfrom Apr 13, 2026
Conversation
Agent-Logs-Url: https://github.com/Coursant/RAP/sessions/13cf7262-b6c0-45ce-a71b-084abf763e95 Co-authored-by: Coursant <60531642+Coursant@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Coursant/RAP/sessions/13cf7262-b6c0-45ce-a71b-084abf763e95 Co-authored-by: Coursant <60531642+Coursant@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Coursant/RAP/sessions/13cf7262-b6c0-45ce-a71b-084abf763e95 Co-authored-by: Coursant <60531642+Coursant@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
Coursant
April 13, 2026 20:49
View session
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.
SymbExprsimplification was missing constant-identity folding, so symbolic bounds retained avoidable noise (x+0,x*1,x-0) and equivalent forms. This PR adds constant-aware simplification rules and extends symbolic range coverage to assert those expressions collapse as expected.Symbolic simplification: constant-aware folding
SymbExpr(const_bits, zero/one checks).try_simplify_constants()and integrated it intosimplify()before linear flattening.x + 0,0 + x→xx - 0→xx * 1,1 * x→xx * 0,0 * x→0(explicit zero-constant selection)x / 1→xx & 0,0 & x→0x | 0,0 | x→xx ^ 0,0 ^ x→xx << 0,x >> 0→x-(-x)/!(!x)→xSymbolic range fixture updates
const_identity_caseinrange_symbolicto exercise+0,*1,-0paths.test_symbolic_intervalexpectations to validate simplified symbolic output and guard against unsimplified identity forms.