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)
- SAT solver runtime changes depending on Z3 version HOT 1
- Incorrect results yet no errors reported (with Datatypes and contexts)
- 4.13.0 hangs on an example that works in 4.8.7 HOT 2
- Solving with regular constraints doesn't finish in unsat case
- Link to C++ and C API HOT 1
- Issue with tactic `qsat` HOT 3
- In C++ code, using solver.unsat_core() yields an empty result. HOT 1
- Seq Theory Map / Fold functionality not exposed via C API HOT 1
- Empty universes HOT 1
- [Question]: z3 py in overflow checking for bit-vectors HOT 1
- Invalid model issue on String theory
- ASSERTION VIOLATION, File: ../src/sat/sat_drat.cpp HOT 2
- Failed to build libz3.so because of missing `LDFLAGS` in `SLIBEXTRAFLAGS` when cross compiling z3 HOT 1
- Remaining deprecated `distutils` in Python scripts.
- Z3_solver_pop() does not clear ASTs HOT 1
- Solver printing wrong model in C++ api HOT 1
- aarch64 linux wheel is tagged `manylinux2014` despite actually being `manylinux_2_34`
- Timeout not working on z3 python in the second `s.check()` call HOT 1
- reading string value from the output of z3 consequence API throws exception HOT 1
- Alternative solutions for z3-solver without using SharedArrayBuffer or COOP/COEP headers
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.