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

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.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • 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).
  • My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • 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 on lines +263 to +269
// The bound variable may be a plain symbol (e.g. from front ends other than
// C, such as Strata) rather than an already-renamed SSA expression; only
// unwrap via to_ssa_expr when it really is one.
const symbol_exprt &qsym = quant_expr.symbol();
symbol_exprt tmp0 =
to_symbol_expr(to_ssa_expr(quant_expr.symbol()).get_original_expr());
is_ssa_expr(qsym) ? to_symbol_expr(to_ssa_expr(qsym).get_original_expr())
: qsym;
Comment on lines +268 to +269
is_ssa_expr(qsym) ? to_symbol_expr(to_ssa_expr(qsym).get_original_expr())
: qsym;
Prevent field sensitivity and simplification from turning the bound
variables of forall/exists into non-symbol expressions (which violates the
invariant that quantifier bound variables are symbols): handle plain-symbol
bound variables in rewrite_quantifiers, skip renaming the bound-variable
operand in goto_symex_statet, and simplify only the body of a quantifier
(operand 1), not its bound variables.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@tautschnig tautschnig force-pushed the strata/symex-rewrite-quantifiers-plain-symbol branch from 12cc4f4 to 7325d62 Compare June 18, 2026 21:07
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.

2 participants