3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-20 02:00:22 +00:00

Nlsat simplify (#7227)

* dev branch for simplification

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* bug fixes

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* bugfixes

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* fix factorization

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* separate out simplification functionality

* reorder initialization

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* reorder initialization

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* Update README.md

* initial warppers for seq-map/seq-fold

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* expose fold as well

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add C++ bindings for sequence operations

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add abs function to API

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add parameter validation to ternary and 4-ary functions for API #7219

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add pre-processing and reorder

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

* add pre-processing and reorder

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>

---------

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2024-05-14 22:19:33 -07:00 committed by GitHub
parent e036a5bd9b
commit 8fe357f1f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 1275 additions and 844 deletions

View file

@ -24,6 +24,7 @@ Revision History:
#include "util/params.h"
#include "util/statistics.h"
#include "util/rlimit.h"
#include "util/dependency.h"
namespace nlsat {
@ -36,6 +37,15 @@ namespace nlsat {
virtual std::ostream& operator()(std::ostream& out, assumption a) const = 0;
};
struct bound_constraint {
var x;
polynomial_ref A, B;
bool is_strict;
clause* c;
bound_constraint(var x, polynomial_ref& A, polynomial_ref& B, bool is_strict, clause* c) :
x(x), A(A), B(B), is_strict(is_strict), c(c) {}
};
class solver {
struct imp;
struct ctx;
@ -103,7 +113,7 @@ namespace nlsat {
e[i] = 1 if is_even[i] is false
e[i] = 2 if is_even[i] is true
*/
literal mk_ineq_literal(atom::kind k, unsigned sz, poly * const * ps, bool const * is_even);
literal mk_ineq_literal(atom::kind k, unsigned sz, poly * const * ps, bool const * is_even, bool simplify = false);
/**
\brief Create an atom of the form: x=root[i](p), x<root[i](p), x>root[i](p)
@ -114,6 +124,9 @@ namespace nlsat {
void inc_ref(literal l) { inc_ref(l.var()); }
void dec_ref(bool_var b);
void dec_ref(literal l) { dec_ref(l.var()); }
void inc_ref(assumption a);
void dec_ref(assumption a);
/**
\brief Create a new clause.
@ -172,6 +185,17 @@ namespace nlsat {
void get_bvalues(svector<bool_var> const& bvars, svector<lbool>& vs);
void set_bvalues(svector<lbool> const& vs);
/**
* \brief Access functions for simplify module.
*/
void del_clause(clause* c);
clause* mk_clause(unsigned n, literal const* lits, bool learned, internal_assumption a);
bool has_root_atom(clause const& c) const;
assumption join(assumption a, assumption b);
void inc_simplify();
void add_bound(bound_constraint const& c);
/**
\brief reorder variables.
*/
@ -244,6 +268,8 @@ namespace nlsat {
std::ostream& display(std::ostream & out, unsigned n, literal const* ls) const;
std::ostream& display(std::ostream& out, clause const& c) const;
std::ostream& display(std::ostream & out, literal_vector const& ls) const;
std::ostream& display(std::ostream & out, atom const& a) const;
@ -254,9 +280,10 @@ namespace nlsat {
std::ostream& display_smt2(std::ostream & out, literal_vector const& ls) const;
std::ostream& display_smt2(std::ostream & out) const;
std::ostream& display_smt2(std::ostream & out) const;
/**
\brief Display variable
*/