Comments (7)
Through the SMT2 file-based interface there is no "easier" way; in general models for arrays are functions (maps) of indices to values. Some of our APIs try to make that a little bit easier by hiding the k! entries and resolving that link to the function, but that's not possible in SMT2. There have been many questions (and bug reports) about this on StackOverflow.
I don't think there is a "correct" way of implementing string constraints. This is subject of ongoing research and there are plans to create an SMT theory for strings, but that's still in a draft state I think.
from z3.
Closing this issue, please reopen if necessary.
from z3.
Thank you! Do you think that this will be addressed with a newer SMT-LIB version?
from z3.
Yes, all interested parties are already working on an SMT string logic and solvers. I don't know exactly who's leading the discussion, but I know that Cesare Tinelli knows :)
There is also a Z3-based string solver prototype, but AFAIK it's not available in source code yet. I'll notify those responsible to add any additional information here.
from z3.
Do you mean https://github.com/z3str/Z3-str ?
from z3.
No, that's an independent effort, but it's also based on Z3. I don't know about technical differences between the two, but I'm sure the authors would be happy to point those out.
from z3.
I have a working solution and I am working on some additional functionality around strings. I noticed something odd (at least odd to me) about Z3.
When I take the example above and just negate the assertion, Z3 does not pick the empty array which would fulfill the assertion. For example this SMTLIB
(set-option :produce-models true)
(declare-const a (Array Int Int))
(assert (not (= a (store (store (store (store ((as const(Array Int Int)) 0) 0 99) 1 111) 2 111) 3 108))))
(check-sat)
(get-value (a))
(get-model)
prints the following
sat
((a (_ as-array k!0)))
(model
(define-fun a () (Array Int Int)
(_ as-array k!0))
(define-fun k!3 ((x!1 Int)) Int
(ite (= x!1 1) 111
(ite (= x!1 0) 99
0)))
(define-fun k!0 ((x!1 Int)) Int
(ite (= x!1 1) 5
4))
(define-fun k!4 ((x!1 Int)) Int
(ite (= x!1 2) 111
(ite (= x!1 1) 111
(ite (= x!1 0) 99
0))))
(define-fun k!1 ((x!1 Int)) Int
0)
(define-fun k!5 ((x!1 Int)) Int
(ite (= x!1 3) 108
(ite (= x!1 2) 111
(ite (= x!1 1) 111
(ite (= x!1 0) 99
0)))))
(define-fun k!2 ((x!1 Int)) Int
(ite (= x!1 0) 99
0))
)
So get-value
suggests that k!0 should be used which is the array [4, 5]. Why does Z3 use the "odd" numbers [4, 5]? And why does Z3 not suggest the empty array of k!1? Also k!0 to k!4 could be used as witnesses but not k!5. So I am wondering why k!5 in the model at all? Is there a paper on this behavior or should I dive into the Z3 source code to get a better understanding?
from z3.
Related Issues (20)
- assertion violation z3
- FYI: Warnings during compilation
- Release 4.13.1 does not contain libz3java.so HOT 1
- __GNUC__ isn't always defined HOT 3
- Invalid model is generated but not reported with option model-validate HOT 1
- Invalid model issue on floats
- Calculating division, obtaining an incorrect solution; the divisor is 0 HOT 1
- Slow performance on simple inequality HOT 1
- the Identity Problem for Semigroups
- Bug: SMTLIB2 formatted output does not contain Recursive Function definitions
- Java API: ClassCastException when getting EnumSort of constant
- Unable to resolve apparently contradictory assert
- unknown about a simple formula
- Memory leaks about smt.string_solver
- [SECURITY] Global Buffer Overflow in WCNF Parser
- Issues related to options in smt module
- z3.Tactics returning z3.unknown upon BitVecRef < BitVecRef HOT 2
- Performance issues after adding check-sat statement HOT 1
- Potential non-termination or bitvector performance
- Python Error on Optimize deepcopy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from z3.