Skip to content

Fix invalid assumptions and invariants in GraphML witness generation#8802

Merged
tautschnig merged 1 commit intodiffblue:developfrom
tautschnig:fix-5264-graphml
Mar 12, 2026
Merged

Fix invalid assumptions and invariants in GraphML witness generation#8802
tautschnig merged 1 commit intodiffblue:developfrom
tautschnig:fix-5264-graphml

Conversation

@tautschnig
Copy link
Copy Markdown
Collaborator

  • Remove assumptions with __CPROVER_initialize scope
  • Filter out assumptions for internal variables of external functions
  • Remove assumptions referencing out-of-scope local variables

Co-authored-by: Kiro autonomous agent

Fixes: #5264

  • 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 Feb 24, 2026
@tautschnig tautschnig marked this pull request as ready for review March 10, 2026 19:15
Copilot AI review requested due to automatic review settings March 10, 2026 19:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adjusts GraphML witness generation to avoid emitting invalid assumptions/invariants by filtering based on scope and excluding init/built-in/extern contexts.

Changes:

  • Omits empty invariant.scope entries in GraphML output.
  • Adds filtering to skip assumptions/invariants from __CPROVER_initialize, built-in/extern functions, and RHS expressions referencing out-of-scope locals.
  • Infers an “effective scope” for assumptions/invariants based on the assigned symbol name.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/xmllang/graphml.cpp Avoids writing empty invariant.scope attributes.
src/goto-programs/graphml_witness.cpp Introduces scope/built-in/extern filtering for assumptions and invariants.

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

Comment thread src/goto-programs/graphml_witness.cpp
Comment thread src/goto-programs/graphml_witness.cpp Outdated
Comment thread src/goto-programs/graphml_witness.cpp Outdated
- Remove assumptions with `__CPROVER_initialize` scope
- Filter out assumptions for internal variables of external functions
- Remove assumptions referencing out-of-scope local variables

Fixes: diffblue#5264

Co-authored-by: Kiro (autonomous agent) <kiro-agent@users.noreply.github.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 11, 2026

Codecov Report

❌ Patch coverage is 50.94340% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.00%. Comparing base (b191cc1) to head (1b78fa1).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/goto-programs/graphml_witness.cpp 55.10% 22 Missing ⚠️
src/xmllang/graphml.cpp 0.00% 4 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #8802      +/-   ##
===========================================
- Coverage    80.01%   80.00%   -0.01%     
===========================================
  Files         1700     1700              
  Lines       188345   188377      +32     
  Branches        73       73              
===========================================
+ Hits        150696   150707      +11     
- Misses       37649    37670      +21     

☔ View full report in Codecov by Sentry.
📢 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.

/// Check if all symbols in an expression are in scope.
/// Note: scope is determined by the prefix before the first "::". This is
/// correct for CBMC's C front-end where locals are named "function::N::var"
/// and function_id is "function". JBMC does not use graphml witnesses.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

JBMC does not use graphml witnesses.

That's incorrect, but probably doesn't matter because graphml witnesses are deprecated anyway.

@tautschnig tautschnig merged commit ac80dfa into diffblue:develop Mar 12, 2026
39 of 41 checks passed
@tautschnig tautschnig deleted the fix-5264-graphml branch March 12, 2026 12:24
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.

Invalid assumptions and invariants in witnesses of CBMC

3 participants