1

I am using Z3py but when I define a array

array = Array('array', IntSort(), IntSort())

I don't know how I can to know how many values have the array.

Kokoro
  • 13
  • 3
  • Try to use the build-in `len(array)` function, if this is not working just try to look which attributes are available for array object, `dir(array)` – dejanualex Jan 14 '20 at 10:16

1 Answers1

0

Arrays in Z3 (and in SMT) are of unbounded size. See, for instance, Create an array with fixed size and initialize it

Christoph Wintersteiger
  • 8,234
  • 1
  • 16
  • 30
  • Thanks for your reply, but If I define 5 instances of "array" how I can to know that exist 5 instances? For example `array[0] = ... ,array[1] = ... , array[2] = ..., array[3] = ... , array[4] = ... ` then, if I use for example a value like int i = 5, how can I compare with i if the number of instances of array are 5 or less? – Kokoro Jan 14 '20 at 10:47
  • 1
    As Christoph mentioned, an array from `IntSort` to `IntSort` will be defined for every integer element. (It's more like a function in that sense.) So, asking "5 or less" is meaningless. The answer is, it's always more than 5: It has an element for every integer value. Do not conflate it with arrays as found in languages like C or Java. – alias Jan 14 '20 at 12:01