Skip to content

Conversation

@sim642
Copy link
Member

@sim642 sim642 commented Oct 23, 2025

YAML witness 2.1 has loop_transition_invariants for describing proofs of termination. I think it will be a demo in SV-COMP 2026 but I was still wondering if we could generate something like that. These invariants basically relate values from a previous iteration with values from the current iteration.

The idea, which might already be wrong, is the following:

  1. Duplicate the local relational state with primed previous iteration variables.
  2. Put those together into one relational state with the original local state.
  3. Assert that the instrumented loop counter has strictly increased (or increased exactly by one?).
  4. Project out the loop counters.

For example, for 78-termination/01-simple-loop-terminating this can output

(long long )\at(i, AnyPrev) >= 1LL && (long long )i >= (long long )\at(i, AnyPrev) + 1LL

or

(long long )\at(i, LastPrev) + 1LL == (long long )i && (long long )i >= 2LL

These express a strict increase in program variables. The only thing missing here is an upper bound for i, which in this regression test actually comes from non-Apron intervals, but should be easily added as i <= 11. Together, these constitute some kind of proof of termination.

TODO

  • Convince ourselves that this method is correct.
  • Clean up the implementation.

@sim642 sim642 added feature sv-comp SV-COMP (analyses, results), witnesses pr-dependency Depends or builds on another PR, which should be merged before labels Oct 23, 2025
Base automatically changed from yaml-witness-2.1 to master October 30, 2025 14:59
@sim642 sim642 removed the pr-dependency Depends or builds on another PR, which should be merged before label Nov 6, 2025
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants