Skip to content

Reduce var_eq witness invariants from quadratic to linear#1826

Merged
sim642 merged 2 commits intomasterfrom
var_eq-invariant
Oct 7, 2025
Merged

Reduce var_eq witness invariants from quadratic to linear#1826
sim642 merged 2 commits intomasterfrom
var_eq-invariant

Conversation

@sim642
Copy link
Copy Markdown
Member

@sim642 sim642 commented Sep 26, 2025

@karoliineh found that for ldv-linux-3.4-simple/32_1_cilled_ok_nondet_linux-3.4-32_1-drivers--block--paride--on26.ko-ldv_main0_sequence_infinite_withcheck_stateful.cil.out in sv-benchmarks we output tens of thousands of invariants into the YAML witness. As of current master, 43083 loop invariants to be exact.

Most of them seemed to be equalities between __cil_tmp variables which are actually in the program (because it is cilled), not introduced by us, so it's not the filtering of temporaries at fault.
Instead, these equalities come from large var_eq equality clusters because there are many of those variables pulled up to function level, so all of the equalities are in scope in many points in large functions.

The current var_eq invariant generation is not that great: it outputs a quadratic number of pairwise equalities from a cluster (only deduplicating by reflexivity and symmetry). Arguably, this is very redundant: we shouldn't have to make transitivity explicit.
Therefore, this PR changes var_eq invariant generation to output a linear number of equalities with a single element from the cluster, the rest follow by transitivity implicitly.

For the SV-COMP task above, we now only output 859 loop invariants!
We no longer OOM when trying to validate our own witness to this task. However, we also don't confirm it yet because of #1710.

@sim642 sim642 added this to the SV-COMP 2026 milestone Sep 26, 2025
@sim642 sim642 requested a review from karoliineh September 26, 2025 11:19
@sim642 sim642 added usability sv-comp SV-COMP (analyses, results), witnesses performance Analysis time, memory usage labels Sep 26, 2025
@sim642 sim642 merged commit 657bc6b into master Oct 7, 2025
19 checks passed
@sim642 sim642 deleted the var_eq-invariant branch October 7, 2025 13:01
@sim642
Copy link
Copy Markdown
Member Author

sim642 commented Oct 10, 2025

Out of curiosity, I did some experiments to see how the number of invariants in witnesses changed:
image
(https://goblint.cs.ut.ee/results/279-all-pr-1818-after/table-generator-cmp.table.html#/scatter?toolX=1&columnX=5&toolY=2&columnY=5&results=All&line=10)

sim642 added a commit to sim642/opam-repository that referenced this pull request Nov 27, 2025
CHANGES:

Functionally equivalent to Goblint in SV-COMP 2026.

* Add sequential portfolio for SV-COMP (goblint/analyzer#1845, goblint/analyzer#1867, goblint/analyzer#1877).
* Add struct bitfield support (goblint/analyzer#1739, goblint/analyzer#1823).
* Improve bitwise operations for integer domains (goblint/analyzer#1739).
* Reimplement HTML output in OCaml (goblint/analyzer#1752).
* Remove YAML witness version 0.1 support (goblint/analyzer#1812, goblint/analyzer#1817, goblint/analyzer#1852, goblint/analyzer#1853, goblint/analyzer#1855).
* Fix incorrect invariants in witnesses (goblint/analyzer#1818, goblint/analyzer#1876).
* Simplify relational invariants in witnesses (goblint/analyzer#1826, goblint/analyzer#1871, goblint/analyzer#1873).
* Fix argument types in Goblint stubs (goblint/analyzer#1684, goblint/analyzer#1814, goblint/analyzer#1779, goblint/analyzer#1820).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance Analysis time, memory usage sv-comp SV-COMP (analyses, results), witnesses usability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant