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

Non-deterministic compare #70

Open
BrunoDutertre opened this issue Mar 16, 2022 · 2 comments · May be fixed by #73
Open

Non-deterministic compare #70

BrunoDutertre opened this issue Mar 16, 2022 · 2 comments · May be fixed by #73
Assignees

Comments

@BrunoDutertre
Copy link

In run_code, the evaluation of compare uses pointer comparison.

This looks like undefined C/C++ behavior.

It also means that the semantics of compare is not well defined and
that running the same code is not deterministic. Results may depend
on how symbols are stored in memory.

Example:

(declare sort type)
(declare x sort)
(declare y sort)
(run (compare x y 1 0))

On my computer, the result is 0 in most cases, but once in a while, it's 1:

[Running-sc (compare x y 1 0)] = 
0
Proof checked successfully!

time = 115
sym count = 0
marked count = 0

[Running-sc (compare x y 1 0)] = 
1
Proof checked successfully!

time = 189
sym count = 0
marked count = 0

@ajreynol ajreynol self-assigned this Mar 16, 2022
@ajreynol
Copy link
Member

I agree this is not ideal behavior.

In detail, the side condition primitive compare was introduced for this paper: https://homepage.divms.uiowa.edu/~ajreynol/report-lra-pf.pdf as a way of introducing an arbitrary ordering on variables. This is used for e.g. polynomial normalization. The use of pointer comparison was done intentionally, but indeed it makes LFSC non-deterministic.

I am considering eliminating this primitive from the language altogether, since it is not necessary in the new signature.

@BrunoDutertre
Copy link
Author

If I have a vote on this: remove. Simpler is better.

Bruno

@ajreynol ajreynol linked a pull request Mar 17, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants