ultimate-pa / ultimate

The Ultimate program analysis framework.
https://ultimate-pa.org/
200 stars 41 forks source link

Add ACSL support for ghost variables #649

Closed schuessf closed 1 year ago

schuessf commented 1 year ago

This PR adds support for (some) ACSL-Ghost-Statements, specifically:

This new language feature can then also help to validate witnesses with ghost variables (see here; a PR of that will be created this one is merged 🙂).

In our translation we create and declare a new Boogie-Variable #ghost~x and handle the assignment accordingly. Additionally we make sure that only ghost-variables are assigned in ghost-statements (so it should not have any side-effects on program-variables).

However, we need to handle the declaration of global variables (parsed as GlobalGhostDeclaration) and local variables (parsed as GhostDeclaration) slightly different, because the first is handled by CHandler and the latter by ACSLHandler. This leads to some duplicate code, but the handling is also slightly different.