-
Notifications
You must be signed in to change notification settings - Fork 43
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
XSTS: support choice-else operations #302
Comments
I think this would be challenging to introduce to Theta, because in a Theta choice statement, assumptions can appear in arbitrary places (inside very complicated control structures), not just the beginning. Consider the following choice for example:
|
Yes, that is one of the strongest motivations for this proposal. In OXSTS, assumptions can also appear anywhere in a choice, which is mostly handled correctly, except in some edge cases. I remember a conversation about possibly mapping a choice-else into logical formulae that could be interpreted by the solver. Was this proven to be impossible? I tried to implement something similar in my fork, but I was not able to complete it alone: |
After a brief discussion, we arrived at the following conclusion. Choice-else operations can not be efficiently mapped to SMT formulae because they require a Solving this requires further constraints on assumptions, which could possibly require the introduction of more high-level language constructs - such as switch operations - whose guard assumptions may only appear at fixed places in the model. It has not yet been decided whether these language features would be implemented on the Theta side or the Gamma/Semantifyr side. |
I propose the extension of the XSTS language with a choice-else branch.
The else branch on a choice would behave as a last resort default branch, that is only executed iff all other branches are disallowed (because of failing assume operations).
Doing so would allow the simple representation of a frequent pattern in Gamma and Semantifyr. Currently, choice-else is supported using a model rewrite logic, which is difficult to verify and produces unreadable XSTS code.
If the choice-else could be mapped to an efficient solver formula, then it would be worth implementing on the Theta side. Otherwise, it may or may not have any benefit, considering that the choice-else rewrite logic already exists in OXSTS.
Example:
Is rewritten into:
The text was updated successfully, but these errors were encountered: