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

Expose the bv2nat and int2bv primitives #743

Merged
merged 1 commit into from
Jul 21, 2023

Conversation

bclement-ocp
Copy link
Collaborator

This patch exposes the bv2nat and int2bv primitives as symbols available to the user. Even though these symbols are not part of the official smtlib theories, they are useful for mixed bitvector/integer specifications that are likely to occur in the context of program verification, and they are also supported by other solvers such as Z3 and CVC5.

This patch exposes the bv2nat and int2bv primitives as symbols available
to the user. Even though these symbols are not part of the official
smtlib theories, they are useful for mixed bitvector/integer
specifications that are likely to occur in the context of program
verification, and they are also supported by other solvers such as Z3
and CVC5.
Copy link
Collaborator

@Halbaroth Halbaroth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cache really useful?

@bclement-ocp
Copy link
Collaborator Author

I believe it is necessary to ensure that Dolmen knows that multiple uses of the primitive are actually the same primitive. I am not 100% sure we need it in this case though, @Gbury would know.

@Halbaroth Halbaroth merged commit 1ac7e92 into OCamlPro:next Jul 21, 2023
9 of 10 checks passed
@Gbury
Copy link
Collaborator

Gbury commented Jul 21, 2023

So, for terms, the cache is useful and better, but not absolutely necessary. Basically, the cache ensures that we correctly identify two instances of what is the same symbol: without the cache, you would generate two different symbols for the same semantic one (e.g. two instance of bv2nat on bitvectors of size 3), and then end up in a situation where two terms that should be equal are not equal, that should not be too big of a problem (contrary to the same situation for types), especially since you then translate those terms to alt-ergo's terms. That being said, unless it becomes a problem, it's better to use a cache.

@bclement-ocp
Copy link
Collaborator Author

I think that fits with my understanding, thanks for the clarification. I think it's better to have the cache since Dolmen has it everywhere so we don't break the fact that identical constructors are physically equal, even if we don't currently depend on that.

(I've aso opened Gbury/dolmen#176 to suggest exposing with_cache so that we don't have to reimplement it)

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 this pull request may close these issues.

3 participants