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

Implement proposed smtlib2 bitvector overflow predicates #6715

Merged

Conversation

aehyvari
Copy link
Contributor

@aehyvari aehyvari commented May 9, 2023

Smtlib2 is being extended to include overflow predicates for bit vectors (see https://groups.google.com/u/1/g/smt-lib/c/J4D99wT0aKI). This PR introduces the predicates bvumulo, bvsmulo, bvsdivo, bvnego, bvuaddo, bvsaddo, bvusubo, and bvssubo.

Currently, for example, the function declaration symbol member for
checking whether multiplication *does not* overflow is called
`m_bv_smul_ovfl`.  Since we are introducing the upcoming smtlib2 symbols
that check that multpliciation *does* overflow, the not overflow check
symbols are renamed to `m_bv_smul_no_ovfl` etc.
Smtlib2 is being extended to include overflow predicates for bit
vectors (see https://groups.google.com/u/1/g/smt-lib/c/J4D99wT0aKI).
This commit introduces the predicates `bvumulo` and `bvsmulo` that
return `true` if the unsigned multiplication overflows or the signed
multiplication underflows or overflows, respectively.
@aehyvari aehyvari force-pushed the antti/smtlib2-bv-of-predicates branch from 846b0e0 to 6f70788 Compare May 9, 2023 07:29
@aehyvari
Copy link
Contributor Author

aehyvari commented May 9, 2023

@microsoft-github-policy-service agree company="Certora"

@aehyvari
Copy link
Contributor Author

aehyvari commented May 9, 2023

I checked this branch against cvc5's overflow regression tests in https://github.com/cvc5/cvc5/tree/main/test/regress/cli/regress0/bv/overflow and everything passes.

@NikolajBjorner NikolajBjorner merged commit 12e45c9 into Z3Prover:master May 9, 2023
@mikekben
Copy link

Is there any way for API users to access these functions yet? I think they have not been added to the C or C++ APIs yet, but is there a way for a project using API calls also interact with these newly-added functions too?

@NikolajBjorner
Copy link
Contributor

there are already functions accessible over the API that serve this functionality. They have different names. They have been available for a very long time. They are not new.

mmcloughlin added a commit to avanhatt/wasmtime that referenced this pull request Nov 1, 2023
Adds the `bvsaddo` SMT-LIB operator.

This operator is due to be standardized in SMT-LIB 2.7, and is already supported in Z3.

https://groups.google.com/g/smt-lib/c/J4D99wT0aKI
Z3Prover/z3#6715
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