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

[FEATURE] Pack arithmetic operations in a single SMT expression #1342

Closed
1 of 2 tasks
konnov opened this issue Feb 15, 2022 · 1 comment · Fixed by #1545
Closed
1 of 2 tasks

[FEATURE] Pack arithmetic operations in a single SMT expression #1342

konnov opened this issue Feb 15, 2022 · 1 comment · Fixed by #1545
Assignees
Labels
good-first-issue Issues that are good candidates to be the first refactoring

Comments

@konnov
Copy link
Collaborator

konnov commented Feb 15, 2022

Currently, arithmetic operations are translated one by one, see IntArithRule and IntCmpRule. This is done mainly for historical reasons, as we wanted to keep the translation simple. For instance, the TLA+ expression x + 1 = 10 would be translated into a series of constraints:

// c_1 is the cell for x
(assert (= c_2 1))
(assert (= c_3 (+ c_1 c_2)))
(assert (= c_4 10))
(assert (= c_5 (= c_3 c_4)))

The Boolean result of the translation is stored in the cell c_5, whereas c_1, c_2, c_3, and c_4 are intermediate cells.

Instead of doing this translation, we could directly translate the above expression into the assertion:

(assert (= c_5 (c_1 + 1 = 10)))

We should only take care of the leaf expressions, which require rewriting, unless they are integer literals. It is not obvious, whether this would significantly improve the performance. However, it will decrease the number of constraints and ease debugging.

@konnov konnov added refactoring good-first-issue Issues that are good candidates to be the first labels Feb 15, 2022
@konnov
Copy link
Collaborator Author

konnov commented Feb 15, 2022

@thpani if you like to add this one on your queue, this is a very simple task related to the translator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Issues that are good candidates to be the first refactoring
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants