Git Product home page Git Product logo

Comments (14)

Gbury avatar Gbury commented on May 25, 2024

Unfortunately, there is no current workaround, but I'm planning to work on one in the coming days.

For a bit of context: although supported by Z3, CVC4 and CVC5, bv2nat is not part of the official standard defined by the smtlib. More specifically, the theory for BV internally defines bv2nat but only so that it can be used in its semantic specification.

Until now, dolmen has strived to implement the standard, at least as a first goal, so that it could be used to check conformity against that standard. However, it appears that it's not sufficient anymore, so I'm planning to add a notion of typing extensions: these extensions would be enabled by cli flags and effectively add new functions to the typing builtins (similar to how the parsing extensions work, see #190 ).

from dolmen.

rod-chapman avatar rod-chapman commented on May 25, 2024

Understood. I'm trying to get a non-trivial program verification benchmark into the SMTComp suite. The code is cryptographic, so it has modular arithmetic and BV stuff all over the place...

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

I should have an experimental version of dolmen that can accept bv2nat by the end of the week.

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

Just to make sure, what would be the expected signature of the bv2nat function ?

from dolmen.

rod-chapman avatar rod-chapman commented on May 25, 2024

Not sure.... how is it declared in Z3, CVC4 and CVC5?

from dolmen.

bclement-ocp avatar bclement-ocp commented on May 25, 2024

As far as I could tell when implementing these functions for Alt-Ergo, they use a family of function symbols of the form (bv2nat (_ BitVec n) Int) for all n > 0, and indexed function symbols ((_ int2bv n) Int (_ BitVec n)) for n > 0.

(I believe Z3 also supports nat2bv but CVC5 only supports int2bv because the developers didn't like nat2bv allowing negative arguments)

from dolmen.

hansjoergschurr avatar hansjoergschurr commented on May 25, 2024

In the cvc5 AletheLF proof signatures bv2nat and int2nat have the following signatures. This is roughly SMT-LIB 3 syntax.

(declare-const int2bv (->
  (! Int :var w)
  Int (BitVec w))
)

(declare-const bv2nat (->
  (! Int :var m :implicit)
  (BitVec m) Int)
)

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

#208 adds a way for dolmen to accept the bv2nat and int2bv functions.

from dolmen.

rod-chapman avatar rod-chapman commented on May 25, 2024

Is this merged now?

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

Apologies for the delay, yes it has been merged.

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

Solved by #208

One can now use the --ext=bvconv option of the dolmen binary to allow bv2nat and int2bv.

from dolmen.

rod-chapman avatar rod-chapman commented on May 25, 2024

OK... now need to update the GitHub action associated with the smtcomp benchmark_submission repo so it will run the new binary with that option. Any idea how to do that?

from dolmen.

Gbury avatar Gbury commented on May 25, 2024

I had a look at the smt-comp repo, and its github actions will need a bit more code than currently to use the dev version of dolmen (since there is no release including PR#208 yet). You basically need two changes:

  • First, the github action downloads the release binary for version 0.9, see these lines. Instead, you'll need to build the latest dev version of dolmen (or wait until I make a new release including the bvconv extension). To do that, build steps along these lines should be work (though I have not tested these):
# Setup ocaml/opam
    - name: Setup ocaml/opam
      uses: avsm/setup-ocaml@v2
      with:
        ocaml-compiler: ocaml-base-compiler.4.14.0
# Run opam udpate to get an up-to-date repo
    - name: Update opam repo
      run: opam update
# Install dev version of dolmen
   - name: Install dolmen
     run: opam pin --dev-repo dolmen dolmen_type dolmen_loop dolmen_model dolmen_bin
# Copy the dolmen binary
   - name: Copy the dolmen binary
     run: cp `opam exec -- which dolmen` ./dolmen-linux-amd64

Alternatively, I could try and see how to setup a github actions file that would build and upload a nightly release of dolmen (that wya, only the download url for the dolmen binary would need to change), but last time I looked, it was quite a bit of work.

  • Second, you'll need to add the adequate extension on this line. Just adding --ext=bvconv should be enough.

from dolmen.

rod-chapman avatar rod-chapman commented on May 25, 2024

I think it's best for us to wait for the next formal binary release. Many thanks for all your efforts.

from dolmen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.