Skip to content

Conversation

@sim642
Copy link
Member

@sim642 sim642 commented Jun 6, 2022

Adds the experimental YAML witness entry type precondition_loop_invariant, which is like loop_invariant, but has a second precondition expression to match contexts.
Current validation semantics is that the invariant is only checked for contexts where the precondition must hold.

Additionally refactors all the YAML witness type definitions etc to be more type-safe and extensible.

@sim642 sim642 added cleanup Refactoring, clean-up feature type-safety Type-safety improvements sv-comp SV-COMP (analyses, results), witnesses precision labels Jun 6, 2022
@sim642
Copy link
Member Author

sim642 commented Jun 15, 2022

Although the entry type for invariants with preconditions is currently unofficial, it would be good to get this merged for its refactoring of the YAML witnesses. The refactoring makes it easy to work with different entry types, possibly including location_invariant, which is to be added as well.

@sim642 sim642 marked this pull request as ready for review June 15, 2022 10:45
Copy link
Member

@jerhard jerhard left a comment

Choose a reason for hiding this comment

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

We discussed this here a bit in Munich, with @michael-schwarz, @stilscher.
It probably makes sense to implement this grouping of preconditions before merging this, as otherwise the produced precondition-witnesses could be misleading.

For a function, one would first generate all the invariant expressions for the contexts, and then check which of the start states may satisfy the condition and group them. Subsequently one would generate the precondition-invariants for these groups of contexts.

jerhard added 6 commits July 14, 2022 12:27
In this example, among others, the following precondition_loop_invariants are generated:

loop_invariant:
    string: result == 1
    [...]
  precondition:
    string: '*ptr1 == 5 && *ptr2 == 5'

and:

loop_invariant:
    string: result == 0
    [...]
  precondition:
    string: '*ptr1 == 5 && *ptr2 == 5'

To fix this issue, grouping of precondition_loop_invariants is required.
Copy link
Member

@jerhard jerhard left a comment

Choose a reason for hiding this comment

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

Looks good!

@sim642 sim642 merged commit f0e71e3 into master Aug 4, 2022
@sim642 sim642 deleted the yaml-witness-precondition branch August 4, 2022 09:05
sim642 added a commit that referenced this pull request Aug 4, 2022
@sim642 sim642 added this to the v2.0.0 milestone Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Refactoring, clean-up feature precision sv-comp SV-COMP (analyses, results), witnesses type-safety Type-safety improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants