Skip to content

goto-symex: handle plain-symbol quantifier bound variables in rewrite_quantifiers#9066

Open
tautschnig wants to merge 1 commit into
developfrom
strata/symex-rewrite-quantifiers-plain-symbol
Open

goto-symex: handle plain-symbol quantifier bound variables in rewrite_quantifiers#9066
tautschnig wants to merge 1 commit into
developfrom
strata/symex-rewrite-quantifiers-plain-symbol

Conversation

@tautschnig

@tautschnig tautschnig commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

rewrite_quantifiers calls to_ssa_expr on a quantifier's bound variable, but the bound variable may be a plain (non-SSA) symbol. Guard the unwrap with is_ssa_expr.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@tautschnig tautschnig self-assigned this Jun 18, 2026
Copilot AI review requested due to automatic review settings June 18, 2026 20:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes a crash/assert in rewrite_quantifiers when a quantifier’s bound variable is a plain (non-SSA) symbol by guarding SSA unwrapping with is_ssa_expr.

Changes:

  • Introduce a local qsym binding for the quantifier symbol and check is_ssa_expr before calling to_ssa_expr
  • Preserve existing behavior for SSA-bound variables by unwrapping to the original symbol when applicable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/goto-symex/symex_main.cpp Outdated
Comment thread src/goto-symex/symex_main.cpp Outdated
@tautschnig tautschnig force-pushed the strata/symex-rewrite-quantifiers-plain-symbol branch from 12cc4f4 to 7325d62 Compare June 18, 2026 21:07
@tautschnig tautschnig force-pushed the strata/symex-rewrite-quantifiers-plain-symbol branch from 7325d62 to 906564a Compare June 22, 2026 10:38
@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.69%. Comparing base (7483d0d) to head (32e86d2).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #9066   +/-   ##
========================================
  Coverage    80.68%   80.69%           
========================================
  Files         1714     1715    +1     
  Lines       189593   189650   +57     
  Branches        73       73           
========================================
+ Hits        152979   153033   +54     
- Misses       36614    36617    +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…_quantifiers

rewrite_quantifiers unwraps the quantifier's bound variable with
to_ssa_expr to recover the original symbol. The C front end always
presents the bound variable as an SSA expression at this point, but other
front ends (e.g. Strata) may present it as a plain symbol, for which
to_ssa_expr fails with "wrong SSA expression ID". Guard the unwrapping
with is_ssa_expr (written as an explicit if, so the guard cannot be
dropped by accident) and use the symbol as-is when it is not an SSA
expression.

Adds a unit test that drives rewrite_quantifiers with a plain-symbol
bound variable in both the assertion (forall) and assumption (exists)
code paths. The test puts invariants into throwing mode
(cbmc_invariants_should_throwt) so that, without the guard, the
to_ssa_expr invariant surfaces as a clean REQUIRE_NOTHROW failure rather
than aborting the whole unit binary.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig force-pushed the strata/symex-rewrite-quantifiers-plain-symbol branch from 906564a to 32e86d2 Compare June 24, 2026 15:20
@tautschnig tautschnig assigned kroening and unassigned tautschnig Jun 24, 2026
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.

3 participants