Coder Social home page Coder Social logo

verifit / z3-noodler Goto Github PK

View Code? Open in Web Editor NEW

This project forked from z3prover/z3

5.0 5.0 5.0 126.19 MB

The Z3-Noodler String Solver

License: Other

Shell 0.01% JavaScript 0.01% C++ 88.46% Python 3.07% C 1.85% Java 1.55% OCaml 0.92% D 0.06% C# 2.38% TypeScript 0.90% Makefile 0.01% CMake 0.66% Batchfile 0.01% SMT 0.12% Dockerfile 0.01%
smt string-solving z3 z3-smt-solver

z3-noodler's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

z3-noodler's Issues

Too defensive `contains` handling

Currently, if we get contains predicate, we call both handle_contains() and handle_not_contains() functions. However, handle_not_contains can add it to m_not_contains_todo, which automatically leads to unknown result, even if negated contains does not occur in the formula. It should be checked in assign_eh whether we really got negated contains or not, and only return unknown in the negated case.

Quadratic equations

Implement the Nielsen transformation for efficient solving of quadratic equations.

Support for `replace_re`

The support for these predicates should be hopefully doable without major changes in the decision procedure.

Add support for `str.<` and `str.<=`

These two predicates are defined in the string theory, so we should probably add support for them eventually. But they do not show up in the benchmarks. We can probably solve it similarly to disequations, but there might be some problems.

Incorrect result

We give sat on QF_SLIA/2019-full_str_int/py-conbyte_trauc/leetcode_int-numDecodings/130.smt2 for z3-noodler-3233733-2cddb2f on release version on pikachu (and everywhere else we give unknown, so it is not possible to debug). See #133

Rewriting string rewriter

The current rewriter of Z3 does a lot of unknown stuff for us, and some of it can be damaging for noodler. Sometimes it even brings stuff from seq theory, for example by running this

(set-logic QF_S)
(declare-fun s1 () String)
(assert (str.in_re "abbbe" (str.to_re s1)))
(check-sat)

we get (seq.nth_i s1 0) in relevant_eh() which we cannot handle right now.

Automata in noodles are not reduced

For example running

(set-info :smt-lib-version 2.6)
(set-logic QF_SLIA)

(declare-fun var_x () String)
(declare-fun var_y () String)
(declare-fun var_z () String)
(declare-fun var_u () String)
(declare-fun var_w () String)

; xyx = zu ∧ ww = xa ∧ u ∈ (baba)^∗ a ∧ z ∈ a(ba)^∗
(assert (= (str.++ var_x var_y var_x) (str.++ var_z var_u)))
(assert (= (str.++ var_w var_w) (str.++ var_x "a")))
(assert (str.in_re var_u (re.++ (re.* (re.++ (str.to_re "b") (str.to_re "a") (str.to_re "b") (str.to_re "a"))) (str.to_re "a"))))
(assert (str.in_re var_z (re.++ (str.to_re "a") (re.* (re.++ (str.to_re "b") (str.to_re "a") )))))
(check-sat)
(exit)

somehow produces automata in noodles that have unreachable states, even though noodlification is called with reducing turned on.

Check that we are able to solve `re.replace`

In Slog benchmarks, there are instances using re.replace. In theory, we should be able to solve those, but we need to test that it is truth in praxis.

For example, see QF_S/2019-Jiang/slog/slog_stranger_56_sink.smt2.

Unify variable creation

So far we have util::mk_str_var_fresh and theory_str_noodler::mk_str_var_fresh with the same semantics. We should unify them.

Correctly determine whether `expr` is a variable

As of now, we say that expr is variable when it is app that has zero parameters. However, this holds true for, for example, integer literal, boolean constants and possibly more expr constructs.

We should find out how to precisely find variables in expr tree and use this solution in our solver.

As a temporary workaround, we now test only for string variables (as per #19) which we should be able to distinguish from string literals.

Specific predicate instances

Add support for efficient handling of specific predicate instances:

  • str.substr "B" z z
  • str.substr "" 1 z str.substr "" z z
  • str.replace "A" x y
  • str.replace "" x y
  • str.replace "B" x ""
  • str.replace "B" x "A"
  • str.replace "A" x "A"
  • str.substr x 1 1 == str.at x 1

Substring bug

Currently, it seems that handle_substr is totally broken. It somehow mixes concatenation and length constraints into some nonsense AST.

Create a dispatcher for different decision procedures

So far we have a stabilization-based decision procedure, procedure for solving regular language (dis)equalities, and in the future we will have a procedure tailored for quadratic equations. We should design a dispatcher that choses a best decision procedure for an instance in final_check.

Representation of `notconstains` and `to_int`/`from_int` in Formula

Add options to represent predicates of the form notcontains(x,y) and k = to_int(x), x = from_int(k) inside the class Formula. Modify FormulaPreprocessor to handle these predicates (and hence get rid of parameters representing variables from the conversion arguments).

Fresh literal

For the input slog_stranger_1828_sink.smt2, the procedure for replacing string literals by BasicTerms returns different BasicTerm for the same string literal "//". We should get the BasicTerm literal with the same name.

IntAlphabet in automata assignment

It seems there is a fishy thing in automata assignment. For some input slog_stranger_64_sink.smt2, we get in the preprocessing automata assignment containing an Mata::NFA having IntAlphabet as an alphabet. If we then call AutAssignment::update_alphabet we get an exception, since get_alphabet_symbols is not defined for IntAlphabet. I think IntAlphabet should not be used for automata in an automata assignment.

Error in Installing

I have followed the Readme instruction, unable to Install and got the following error. please do help.

z3-noodler/src/smt/theory_str_noodler/aut_assignment.h:12:10: fatal error: 'mata/nfa/nfa.hh' file not found
#include <mata/nfa/nfa.hh>
^~~~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [src/smt/CMakeFiles/smt.dir/smt_setup.cpp.o] Error 1
make[1]: *** [src/smt/CMakeFiles/smt.dir/all] Error 2
make: *** [all] Error 2

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.