Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify IntDomTuple witness invariants #1517

Merged
merged 13 commits into from
Aug 7, 2024
Merged

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Jun 19, 2024

Before this PR, IntDomTuple outputted witness invariants as conjunction of those from each int domain. Except when it was a definite integer, then only the single equality was returned.

This PR extends this logic to avoid obviously redundant and duplicate information in witness invariants, which can make them annoyingly large:

  1. If it is a definite integer, output single equality.
  2. If it is inclusion set, output disjunction of equalities (interval bounds and exclusions are redundant).
  3. Otherwise, output interval bounds based on all integer domains (avoids duplicate bounds from def_exc exclusion bit ranges). Moreover, exclusion set is filtered based on that interval because often def_exc has x != 0 which is pointless if interval has some strictly positive bounds. Congruence and interval set (latter not used in SV-COMP) domains are added unchanged, so all known information should still be there.

TODO

  • Add option: ana.base.invariant.int.simplify.

@sim642 sim642 added feature usability sv-comp SV-COMP (analyses, results), witnesses labels Jun 19, 2024
@sim642 sim642 added this to the SV-COMP 2025 milestone Jun 19, 2024
@michael-schwarz
Copy link
Member

Congruence ... (not used in SV-COMP)

I think congruences are enabled by the autotuner.

@sim642
Copy link
Member Author

sim642 commented Jun 19, 2024

I think congruences are enabled by the autotuner.

Sorry, yes. I meant that just about interval sets.

@sim642 sim642 force-pushed the witness-invariant-int branch from 0afc2c8 to 02ef2f9 Compare June 19, 2024 11:13
@sim642 sim642 self-assigned this Jun 25, 2024
@sim642
Copy link
Member Author

sim642 commented Jun 26, 2024

There's now an option to disable these simplifications. This includes the possibility to even disable the definite integer simplification.
These simplifications are the default, to give nicest output out of the box. If this turns out to not be precise enough and the abstract values are better, the option can be changed. Although it would be nicer to improve all simplifications for such cases as well, if possible.

@sim642 sim642 requested a review from michael-schwarz June 26, 2024 14:09
@sim642 sim642 removed their assignment Jun 26, 2024
| None ->
let is = to_list (mapp { fp = fun (type a) (module I:SOverflow with type t = a) -> I.invariant_ikind e ik } x)
in List.fold_left (fun a i ->
let invariant_ikind e ik ((_, _, _, x_cong, x_intset) as x) =
Copy link
Member

Choose a reason for hiding this comment

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

What do you think of doing a single refine call before generating invariant? This would ensure things such as inclusion sets being more precise than intervals etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

I looked at it now and the refinement wouldn't actually ensure that because we're missing a number of refinement directions at least. I added some TODOs about them.

Copy link
Member

@michael-schwarz michael-schwarz left a comment

Choose a reason for hiding this comment

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

LGTM! It's nice to see that we now make more use of the possibilities for reuse.

@sim642 sim642 merged commit 8556b70 into master Aug 7, 2024
21 checks passed
@sim642 sim642 deleted the witness-invariant-int branch August 7, 2024 08:29
sim642 added a commit to sim642/opam-repository that referenced this pull request Nov 28, 2024
CHANGES:

Functionally equivalent to Goblint in SV-COMP 2025.

* Add 32bit vs 64bit architecture support (goblint/analyzer#54, goblint/analyzer#1574).
* Add per-function context gas analysis (goblint/analyzer#1569, goblint/analyzer#1570, goblint/analyzer#1598).
* Adapt automatic static loop unrolling (goblint/analyzer#1516, goblint/analyzer#1582, goblint/analyzer#1583, goblint/analyzer#1584, goblint/analyzer#1590, goblint/analyzer#1595, goblint/analyzer#1599).
* Adapt automatic configuration tuning (goblint/analyzer#1450, goblint/analyzer#1612, goblint/analyzer#1181, goblint/analyzer#1604).
* Simplify non-relational integer invariants in witnesses (goblint/analyzer#1517).
* Fix excessive hash collisions (goblint/analyzer#1594, goblint/analyzer#1602).
* Clean up various code (goblint/analyzer#1095, goblint/analyzer#1523, goblint/analyzer#1554, goblint/analyzer#1575, goblint/analyzer#1588, goblint/analyzer#1597, goblint/analyzer#1614).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature sv-comp SV-COMP (analyses, results), witnesses usability
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants