GithubHelp home page GithubHelp logo

Comments (10)

mpreiner avatar mpreiner commented on July 21, 2024 1

Boolector currently does not have an API function for this, but can handle it internally. We can add this functionality.

from boolector.

mpreiner avatar mpreiner commented on July 21, 2024 1

Thanks for reporting! This was a bug in the model generation and was not directly related to constant arrays, but was uncovered by it. This is now fixed on master e69de24.

from boolector.

cdisselkoen avatar cdisselkoen commented on July 21, 2024

I'm happy to assist on the implementation if that would be helpful. I haven't ever touched the Boolector codebase, but if you would give me a pointer for how this should be implemented I can give it a shot.

from boolector.

mpreiner avatar mpreiner commented on July 21, 2024

Thanks for the offer, but I already have an implementation for it, just need to test it. I'll probably merge it back to master early next week.

from boolector.

mpreiner avatar mpreiner commented on July 21, 2024

@cdisselkoen This is now implemented on master with commit a1b1408. However, we do not yet fully support equality over constant arrays. In this case, Boolector will abort with an error.

from boolector.

cdisselkoen avatar cdisselkoen commented on July 21, 2024

Awesome, thanks!

from boolector.

cdisselkoen avatar cdisselkoen commented on July 21, 2024

Hmm, is it possible this feature doesn't yet work in incremental solving mode? I have the following minimal example using the C API (omitting resource cleanup etc for brevity):

#include <stdio.h>
#include <stdlib.h>
#include "boolector.h"

int main() {
  Btor *btor = boolector_new();
  boolector_set_opt(btor, BTOR_OPT_MODEL_GEN, 2);
  boolector_set_opt(btor, BTOR_OPT_INCREMENTAL, 1);
  BoolectorSort eight_bit = boolector_bitvec_sort(btor, 8);
  BoolectorSort array_sort = boolector_array_sort(btor, eight_bit, eight_bit);

  BoolectorNode *fortytwo = boolector_unsigned_int(btor, 42, eight_bit);
  BoolectorNode *const_array = boolector_const_array(btor, array_sort, fortytwo, 0);

  BoolectorNode *seven = boolector_unsigned_int(btor, 7, eight_bit);
  BoolectorNode *val = boolector_read(btor, const_array, seven);
  printf("val is %sconstant\n", boolector_is_const(btor, val) ? "" : "not ");
  // printf("val's bits are %s\n", boolector_get_bits(btor, val));

  if (boolector_sat(btor) != BOOLECTOR_SAT) abort();
  printf("assignment for val is %s\n", boolector_bv_assignment(btor, val));
}

If I comment out the BTOR_OPT_INCREMENTAL line, it works fine: it gives a value of 42 for val as expected. However, as written, with incremental mode, it gives a value of 0 for val.

I'm testing on macOS with Boolector commit dfce248e and the Lingeling solver.

from boolector.

copy avatar copy commented on July 21, 2024

@mpreiner Does this have a matching smt2 syntax? Z3 uses ((as const (Array Int Int)) 1)), which I believe is non-standard.

from boolector.

mpreiner avatar mpreiner commented on July 21, 2024

I haven't added support in the SMT2 parser yet. I's on my TODO list. I'll let you know as soon as this is supported.

from boolector.

mpreiner avatar mpreiner commented on July 21, 2024

It's not in the standard (yet), but at least CVC4 and Z3 support defining constant arrays like that.

from boolector.

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.