3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-22 16:45:31 +00:00

Merge remote-tracking branch 'origin/master' into poly

This commit is contained in:
Jakob Rath 2024-02-26 11:46:22 +01:00
commit 183e911a79
260 changed files with 4131 additions and 3248 deletions

View file

@ -54,6 +54,7 @@ add_subdirectory(ast/euf)
add_subdirectory(ast/converters)
add_subdirectory(ast/substitution)
add_subdirectory(ast/simplifiers)
add_subdirectory(ast/sls)
add_subdirectory(tactic)
add_subdirectory(qe/mbp)
add_subdirectory(qe/lite)

View file

@ -146,8 +146,7 @@ extern "C" {
ast_manager& m = mk_c(c)->m();
recfun::decl::plugin& p = mk_c(c)->recfun().get_plugin();
if (!p.has_def(d)) {
std::string msg = "function " + mk_pp(d, m) + " needs to be declared using rec_func_decl";
SET_ERROR_CODE(Z3_INVALID_ARG, msg.c_str());
SET_ERROR_CODE(Z3_INVALID_ARG, "function " + mk_pp(d, m) + " needs to be declared using rec_func_decl");
return;
}
expr_ref abs_body(m);
@ -168,8 +167,7 @@ extern "C" {
return;
}
if (!pd.get_def()->get_cases().empty()) {
std::string msg = "function " + mk_pp(d, m) + " has already been given a definition";
SET_ERROR_CODE(Z3_INVALID_ARG, msg.c_str());
SET_ERROR_CODE(Z3_INVALID_ARG, "function " + mk_pp(d, m) + " has already been given a definition");
return;
}
@ -377,9 +375,7 @@ extern "C" {
RESET_ERROR_CODE();
symbol _s = to_symbol(s);
if (_s.is_numerical()) {
std::ostringstream buffer;
buffer << _s.get_num();
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::to_string(_s.get_num()));
}
else {
return mk_c(c)->mk_external_string(_s.str());
@ -823,7 +819,7 @@ extern "C" {
param_descrs descrs;
th_rewriter::get_param_descrs(descrs);
descrs.display(buffer);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN("");
}
@ -1031,7 +1027,7 @@ extern "C" {
default:
UNREACHABLE();
}
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN(nullptr);
}
@ -1066,7 +1062,7 @@ extern "C" {
pp.add_assumption(to_expr(assumptions[i]));
}
pp.display_smt2(buffer, to_expr(formula));
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN("");
}

View file

@ -160,8 +160,8 @@ extern "C" {
for (; it != end; ++it) {
buffer << "\n (" << mk_ismt2_pp(it->m_key, mng, 3) << "\n " << mk_ismt2_pp(it->m_value, mng, 3) << ")";
}
buffer << ")";
return mk_c(c)->mk_external_string(buffer.str());
buffer << ')';
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN(nullptr);
}

View file

@ -98,7 +98,10 @@ extern "C" {
LOG_Z3_set_param_value(c, param_id, param_value);
try {
ast_context_params * p = reinterpret_cast<ast_context_params*>(c);
p->set(param_id, param_value);
if (p->is_shell_only_parameter(param_id))
warning_msg("parameter %s can only be set for the shell, not binary API", param_id);
else
p->set(param_id, param_value);
}
catch (z3_exception & ex) {
// The error handler is only available for contexts
@ -111,7 +114,10 @@ extern "C" {
Z3_TRY;
LOG_Z3_update_param_value(c, param_id, param_value);
RESET_ERROR_CODE();
mk_c(c)->params().set(param_id, param_value);
if (mk_c(c)->params().is_shell_only_parameter(param_id))
warning_msg("parameter %s can only be set for the shell, not binary API", param_id);
else
mk_c(c)->params().set(param_id, param_value);
Z3_CATCH;
}

View file

@ -338,12 +338,12 @@ namespace api {
std::ostringstream buffer;
app * a = to_app(n);
buffer << mk_pp(a->get_decl(), m()) << " applied to: ";
if (a->get_num_args() > 1) buffer << "\n";
if (a->get_num_args() > 1) buffer << '\n';
for (unsigned i = 0; i < a->get_num_args(); ++i) {
buffer << mk_bounded_pp(a->get_arg(i), m(), 3) << " of sort ";
buffer << mk_pp(a->get_arg(i)->get_sort(), m()) << "\n";
buffer << mk_pp(a->get_arg(i)->get_sort(), m()) << '\n';
}
auto str = buffer.str();
auto str = std::move(buffer).str();
warning_msg("%s", str.c_str());
break;
}

View file

@ -1022,7 +1022,7 @@ extern "C" {
if (mpfm.is_inf(val)) mpqm.set(q, 0);
std::stringstream ss;
mpqm.display_decimal(ss, q, sbits);
return mk_c(c)->mk_external_string(ss.str());
return mk_c(c)->mk_external_string(std::move(ss).str());
Z3_CATCH_RETURN("");
}
@ -1100,7 +1100,7 @@ extern "C" {
}
std::stringstream ss;
ss << exp;
return mk_c(c)->mk_external_string(ss.str());
return mk_c(c)->mk_external_string(std::move(ss).str());
Z3_CATCH_RETURN("");
}

View file

@ -185,7 +185,7 @@ extern "C" {
std::ostringstream buffer;
to_goal_ref(g)->display(buffer);
// Hack for removing the trailing '\n'
std::string result = buffer.str();
std::string result = std::move(buffer).str();
SASSERT(result.size() > 0);
result.resize(result.size()-1);
return mk_c(c)->mk_external_string(std::move(result));
@ -203,7 +203,7 @@ extern "C" {
}
to_goal_ref(g)->display_dimacs(buffer, include_names);
// Hack for removing the trailing '\n'
std::string result = buffer.str();
std::string result = std::move(buffer).str();
SASSERT(result.size() > 0);
result.resize(result.size()-1);
return mk_c(c)->mk_external_string(std::move(result));

View file

@ -432,14 +432,14 @@ extern "C" {
if (mk_c(c)->get_print_mode() == Z3_PRINT_SMTLIB2_COMPLIANT) {
model_smt2_pp(buffer, mk_c(c)->m(), *(to_model_ref(m)), 0);
// Hack for removing the trailing '\n'
result = buffer.str();
result = std::move(buffer).str();
if (!result.empty())
result.resize(result.size()-1);
}
else {
model_params p;
model_v2_pp(buffer, *(to_model_ref(m)), p.partial());
result = buffer.str();
result = std::move(buffer).str();
}
return mk_c(c)->mk_external_string(std::move(result));
Z3_CATCH_RETURN(nullptr);

View file

@ -188,8 +188,8 @@ extern "C" {
bool ok = Z3_get_numeral_rational(c, a, r);
if (ok && r.is_int() && !r.is_neg()) {
std::stringstream strm;
r.display_bin(strm, r.get_num_bits());
return mk_c(c)->mk_external_string(strm.str());
strm << r.as_bin(r.get_num_bits());
return mk_c(c)->mk_external_string(std::move(strm).str());
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
@ -237,7 +237,7 @@ extern "C" {
else if (mk_c(c)->fpautil().is_numeral(to_expr(a), tmp)) {
std::ostringstream buffer;
fu.fm().display_smt2(buffer, tmp, false);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
}
else {
SET_ERROR_CODE(Z3_INVALID_ARG, nullptr);
@ -288,21 +288,21 @@ extern "C" {
if (u.is_numeral(e, r) && !r.is_int()) {
std::ostringstream buffer;
r.display_decimal(buffer, precision);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
}
if (u.is_irrational_algebraic_numeral(e)) {
algebraic_numbers::anum const & n = u.to_irrational_algebraic_numeral(e);
algebraic_numbers::manager & am = u.am();
std::ostringstream buffer;
am.display_decimal(buffer, n, precision);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
}
else if (mk_c(c)->fpautil().is_rm_numeral(to_expr(a), rm))
return Z3_get_numeral_string(c, a);
else if (mk_c(c)->fpautil().is_numeral(to_expr(a), ftmp)) {
std::ostringstream buffer;
fu.fm().display_decimal(buffer, ftmp, 12);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
}
else if (Z3_get_numeral_rational(c, a, r)) {
return mk_c(c)->mk_external_string(r.to_string());

View file

@ -170,8 +170,8 @@ extern "C" {
if (g_is_threaded || g_thread_id != std::this_thread::get_id()) {
g_is_threaded = true;
std::ostringstream strm;
strm << smt2log << "-" << std::this_thread::get_id();
smt2log = symbol(strm.str());
strm << smt2log << '-' << std::this_thread::get_id();
smt2log = symbol(std::move(strm).str());
}
to_solver(s)->m_pp = alloc(solver2smt2_pp, mk_c(c)->m(), smt2log.str());
}
@ -208,7 +208,7 @@ extern "C" {
if (!smt_logics::supported_logic(to_symbol(logic))) {
std::ostringstream strm;
strm << "logic '" << to_symbol(logic) << "' is not recognized";
SET_ERROR_CODE(Z3_INVALID_ARG, strm.str());
SET_ERROR_CODE(Z3_INVALID_ARG, std::move(strm).str());
RETURN_Z3(nullptr);
}
else {
@ -306,7 +306,7 @@ extern "C" {
if (!parse_smt2_commands(*ctx.get(), is)) {
ctx = nullptr;
SET_ERROR_CODE(Z3_PARSER_ERROR, errstrm.str());
SET_ERROR_CODE(Z3_PARSER_ERROR, std::move(errstrm).str());
return;
}
@ -333,7 +333,7 @@ extern "C" {
std::stringstream err;
sat::solver solver(to_solver_ref(s)->get_params(), m.limit());
if (!parse_dimacs(is, err, solver)) {
SET_ERROR_CODE(Z3_PARSER_ERROR, err.str());
SET_ERROR_CODE(Z3_PARSER_ERROR, std::move(err).str());
return;
}
sat2goal s2g;
@ -400,7 +400,7 @@ extern "C" {
if (!initialized)
to_solver(s)->m_solver = nullptr;
descrs.display(buffer);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN("");
}
@ -799,7 +799,7 @@ extern "C" {
init_solver(c, s);
std::ostringstream buffer;
to_solver_ref(s)->display(buffer);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN("");
}
@ -810,7 +810,7 @@ extern "C" {
init_solver(c, s);
std::ostringstream buffer;
to_solver_ref(s)->display_dimacs(buffer, include_names);
return mk_c(c)->mk_external_string(buffer.str());
return mk_c(c)->mk_external_string(std::move(buffer).str());
Z3_CATCH_RETURN("");
}

View file

@ -19,6 +19,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_ast_kind;
import java.lang.ref.ReferenceQueue;
/**
* The abstract syntax tree (AST) class.
**/
@ -196,7 +198,7 @@ public class AST extends Z3Object implements Comparable<AST>
@Override
void addToReferenceQueue() {
getContext().getASTDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ASTRef::new);
}
static AST create(Context ctx, long obj)
@ -217,4 +219,16 @@ public class AST extends Z3Object implements Comparable<AST>
throw new Z3Exception("Unknown AST kind");
}
}
private static class ASTRef extends Z3ReferenceQueue.Reference<AST> {
private ASTRef(AST referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.decRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ASTDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ASTDecRefQueue extends IDecRefQueue<AST>
{
public ASTDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.decRef(ctx.nCtx(), obj);
}
};

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Map from AST to AST
**/
@ -123,6 +125,18 @@ class ASTMap extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getASTMapDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ASTMapRef::new);
}
private static class ASTMapRef extends Z3ReferenceQueue.Reference<ASTMap> {
private ASTMapRef(ASTMap referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.astMapDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Vectors of ASTs.
**/
@ -101,16 +103,6 @@ public class ASTVector extends Z3Object {
super(ctx, Native.mkAstVector(ctx.nCtx()));
}
@Override
void incRef() {
Native.astVectorIncRef(getContext().nCtx(), getNativeObject());
}
@Override
void addToReferenceQueue() {
getContext().getASTVectorDRQ().storeReference(getContext(), this);
}
/**
* Translates the AST vector into an AST[]
* */
@ -241,4 +233,26 @@ public class ASTVector extends Z3Object {
res[i] = (RealExpr)Expr.create(getContext(), get(i).getNativeObject());
return res;
}
@Override
void incRef() {
Native.astVectorIncRef(getContext().nCtx(), getNativeObject());
}
@Override
void addToReferenceQueue() {
getContext().getReferenceQueue().storeReference(this, ASTVectorRef::new);
}
private static class ASTVectorRef extends Z3ReferenceQueue.Reference<ASTVector> {
private ASTVectorRef(ASTVector referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.astVectorDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* ApplyResult objects represent the result of an application of a tactic to a
* goal. It contains the subgoals that were produced.
@ -66,6 +68,18 @@ public class ApplyResult extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getApplyResultDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ApplyResultRef::new);
}
private static class ApplyResultRef extends Z3ReferenceQueue.Reference<ApplyResult> {
private ApplyResultRef(ApplyResult referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.applyResultDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ApplyResultDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ApplyResultDecRefQueue extends IDecRefQueue<ApplyResult>
{
public ApplyResultDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.applyResultDecRef(ctx.nCtx(), obj);
}
};

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
AstMapDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ASTMapDecRefQueue extends IDecRefQueue<ASTMap> {
public ASTMapDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.astMapDecRef(ctx.nCtx(), obj);
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
AstVectorDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ASTVectorDecRefQueue extends IDecRefQueue<ASTVector> {
public ASTVectorDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.astVectorDecRef(ctx.nCtx(), obj);
}
}

View file

@ -91,17 +91,13 @@ add_custom_command(OUTPUT ${Z3_JAVA_ENUMERATION_PACKAGE_FILES_FULL_PATH}
set(Z3_JAVA_JAR_SOURCE_FILES
AlgebraicNum.java
ApplyResultDecRefQueue.java
ApplyResult.java
ArithExpr.java
ArithSort.java
ArrayExpr.java
ArraySort.java
ASTDecRefQueue.java
AST.java
AstMapDecRefQueue.java
ASTMap.java
AstVectorDecRefQueue.java
ASTVector.java
BitVecExpr.java
BitVecNum.java
@ -109,9 +105,7 @@ set(Z3_JAVA_JAR_SOURCE_FILES
BoolExpr.java
BoolSort.java
CharSort.java
ConstructorDecRefQueue.java
Constructor.java
ConstructorListDecRefQueue.java
ConstructorList.java
Context.java
DatatypeExpr.java
@ -121,7 +115,6 @@ set(Z3_JAVA_JAR_SOURCE_FILES
FiniteDomainExpr.java
FiniteDomainNum.java
FiniteDomainSort.java
FixedpointDecRefQueue.java
Fixedpoint.java
FPExpr.java
FPNum.java
@ -130,13 +123,9 @@ set(Z3_JAVA_JAR_SOURCE_FILES
FPRMSort.java
FPSort.java
FuncDecl.java
FuncInterpDecRefQueue.java
FuncInterpEntryDecRefQueue.java
FuncInterp.java
Global.java
GoalDecRefQueue.java
Goal.java
IDecRefQueue.java
IntExpr.java
IntNum.java
IntSort.java
@ -144,16 +133,11 @@ set(Z3_JAVA_JAR_SOURCE_FILES
Lambda.java
ListSort.java
Log.java
ModelDecRefQueue.java
Model.java
OptimizeDecRefQueue.java
Optimize.java
ParamDescrsDecRefQueue.java
ParamDescrs.java
ParamsDecRefQueue.java
Params.java
Pattern.java
ProbeDecRefQueue.java
Probe.java
Quantifier.java
RatNum.java
@ -166,16 +150,12 @@ set(Z3_JAVA_JAR_SOURCE_FILES
SeqSort.java
SetSort.java
Simplifier.java
SimplifierDecRefQueue.java
SolverDecRefQueue.java
Solver.java
Sort.java
StatisticsDecRefQueue.java
Statistics.java
Status.java
StringSymbol.java
Symbol.java
TacticDecRefQueue.java
Tactic.java
TupleSort.java
UninterpretedSort.java
@ -183,6 +163,7 @@ set(Z3_JAVA_JAR_SOURCE_FILES
Version.java
Z3Exception.java
Z3Object.java
Z3ReferenceQueue.java
)
set(Z3_JAVA_JAR_SOURCE_FILES_FULL_PATH "")
foreach (java_src_file ${Z3_JAVA_JAR_SOURCE_FILES})
@ -204,11 +185,13 @@ add_custom_target(build_z3_java_bindings
# Rule to build ``com.microsoft.z3.jar``
# TODO: Should we set ``CMAKE_JNI_TARGET`` to ``TRUE``?
# REMARK: removed VERSION to fix issue with using this to create installations.
add_jar(z3JavaJar
SOURCES ${Z3_JAVA_JAR_SOURCE_FILES_FULL_PATH}
OUTPUT_NAME ${Z3_JAVA_PACKAGE_NAME}
OUTPUT_DIR "${PROJECT_BINARY_DIR}"
VERSION "${Z3_VERSION}"
# VERSION "${Z3_VERSION}"
)
###############################################################################
@ -219,21 +202,22 @@ if (Z3_INSTALL_JAVA_BINDINGS)
# Provide cache variables for the install locations that the user can change.
# This defaults to ``/usr/local/java`` which seems to be the location for ``.jar``
# files on Linux distributions
set(Z3_JAVA_JAR_INSTALLDIR
"${CMAKE_INSTALL_DATAROOTDIR}/java"
CACHE
PATH
"Directory to install Z3 Java jar file relative to install prefix"
)
# FIXME: I don't think this the right installation location
set(Z3_JAVA_JNI_LIB_INSTALLDIR
"${CMAKE_INSTALL_LIBDIR}"
CACHE
PATH
"Directory to install Z3 Java JNI bridge library relative to install prefix"
)
if (NOT Z3_JAVA_JAR_INSTALLDIR)
set(Z3_JAVA_JAR_INSTALLDIR
"${CMAKE_INSTALL_DATAROOTDIR}/java"
CACHE
PATH
"Directory to install Z3 Java jar file relative to install prefix"
)
endif()
if (NOT Z3_JAVA_JNI_LIB_INSTALLDIR)
set(Z3_JAVA_JNI_LIB_INSTALLDIR
"${CMAKE_INSTALL_LIBDIR}"
CACHE
PATH
"Directory to install Z3 Java JNI bridge library relative to install prefix"
)
endif()
install(TARGETS z3java DESTINATION "${Z3_JAVA_JNI_LIB_INSTALLDIR}")
# Note: Don't use ``DESTINATION`` here as the version of ``UseJava.cmake`` shipped
# with CMake 2.8.12.2 handles that incorrectly.
install_jar(z3JavaJar "${Z3_JAVA_JAR_INSTALLDIR}")
endif()

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Constructors are used for datatype sorts.
**/
@ -91,7 +93,7 @@ public class Constructor<R> extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getConstructorDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ConstructorRef::new);
}
static <R> Constructor<R> of(Context ctx, Symbol name, Symbol recognizer,
@ -114,4 +116,16 @@ public class Constructor<R> extends Z3Object {
return new Constructor<>(ctx, n, nativeObj);
}
private static class ConstructorRef extends Z3ReferenceQueue.Reference<Constructor<?>> {
private ConstructorRef(Constructor<?> referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.delConstructor(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,12 +0,0 @@
package com.microsoft.z3;
public class ConstructorDecRefQueue extends IDecRefQueue<Constructor<?>> {
public ConstructorDecRefQueue() {
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.delConstructor(ctx.nCtx(), obj);
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Lists of constructors
**/
@ -34,7 +36,7 @@ public class ConstructorList<R> extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getConstructorListDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ConstructorListRef::new);
}
ConstructorList(Context ctx, Constructor<R>[] constructors)
@ -43,4 +45,16 @@ public class ConstructorList<R> extends Z3Object {
constructors.length,
Constructor.arrayToNative(constructors)));
}
private static class ConstructorListRef extends Z3ReferenceQueue.Reference<ConstructorList<?>> {
private ConstructorListRef(ConstructorList<?> referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.delConstructorList(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,12 +0,0 @@
package com.microsoft.z3;
public class ConstructorListDecRefQueue extends IDecRefQueue<ConstructorList<?>> {
public ConstructorListDecRefQueue() {
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.delConstructorList(ctx.nCtx(), obj);
}
}

View file

@ -4319,119 +4319,9 @@ public class Context implements AutoCloseable {
checkContextMatch(a);
}
private ASTDecRefQueue m_AST_DRQ = new ASTDecRefQueue();
private ASTMapDecRefQueue m_ASTMap_DRQ = new ASTMapDecRefQueue();
private ASTVectorDecRefQueue m_ASTVector_DRQ = new ASTVectorDecRefQueue();
private ApplyResultDecRefQueue m_ApplyResult_DRQ = new ApplyResultDecRefQueue();
private FuncInterpEntryDecRefQueue m_FuncEntry_DRQ = new FuncInterpEntryDecRefQueue();
private FuncInterpDecRefQueue m_FuncInterp_DRQ = new FuncInterpDecRefQueue();
private GoalDecRefQueue m_Goal_DRQ = new GoalDecRefQueue();
private ModelDecRefQueue m_Model_DRQ = new ModelDecRefQueue();
private ParamsDecRefQueue m_Params_DRQ = new ParamsDecRefQueue();
private ParamDescrsDecRefQueue m_ParamDescrs_DRQ = new ParamDescrsDecRefQueue();
private ProbeDecRefQueue m_Probe_DRQ = new ProbeDecRefQueue();
private SolverDecRefQueue m_Solver_DRQ = new SolverDecRefQueue();
private StatisticsDecRefQueue m_Statistics_DRQ = new StatisticsDecRefQueue();
private TacticDecRefQueue m_Tactic_DRQ = new TacticDecRefQueue();
private SimplifierDecRefQueue m_Simplifier_DRQ = new SimplifierDecRefQueue();
private FixedpointDecRefQueue m_Fixedpoint_DRQ = new FixedpointDecRefQueue();
private OptimizeDecRefQueue m_Optimize_DRQ = new OptimizeDecRefQueue();
private ConstructorDecRefQueue m_Constructor_DRQ = new ConstructorDecRefQueue();
private ConstructorListDecRefQueue m_ConstructorList_DRQ =
new ConstructorListDecRefQueue();
private Z3ReferenceQueue m_RefQueue = new Z3ReferenceQueue(this);
public IDecRefQueue<Constructor<?>> getConstructorDRQ() {
return m_Constructor_DRQ;
}
public IDecRefQueue<ConstructorList<?>> getConstructorListDRQ() {
return m_ConstructorList_DRQ;
}
public IDecRefQueue<AST> getASTDRQ()
{
return m_AST_DRQ;
}
public IDecRefQueue<ASTMap> getASTMapDRQ()
{
return m_ASTMap_DRQ;
}
public IDecRefQueue<ASTVector> getASTVectorDRQ()
{
return m_ASTVector_DRQ;
}
public IDecRefQueue<ApplyResult> getApplyResultDRQ()
{
return m_ApplyResult_DRQ;
}
public IDecRefQueue<FuncInterp.Entry<?>> getFuncEntryDRQ()
{
return m_FuncEntry_DRQ;
}
public IDecRefQueue<FuncInterp<?>> getFuncInterpDRQ()
{
return m_FuncInterp_DRQ;
}
public IDecRefQueue<Goal> getGoalDRQ()
{
return m_Goal_DRQ;
}
public IDecRefQueue<Model> getModelDRQ()
{
return m_Model_DRQ;
}
public IDecRefQueue<Params> getParamsDRQ()
{
return m_Params_DRQ;
}
public IDecRefQueue<ParamDescrs> getParamDescrsDRQ()
{
return m_ParamDescrs_DRQ;
}
public IDecRefQueue<Probe> getProbeDRQ()
{
return m_Probe_DRQ;
}
public IDecRefQueue<Solver> getSolverDRQ()
{
return m_Solver_DRQ;
}
public IDecRefQueue<Statistics> getStatisticsDRQ()
{
return m_Statistics_DRQ;
}
public IDecRefQueue<Tactic> getTacticDRQ()
{
return m_Tactic_DRQ;
}
public IDecRefQueue<Simplifier> getSimplifierDRQ()
{
return m_Simplifier_DRQ;
}
public IDecRefQueue<Fixedpoint> getFixedpointDRQ()
{
return m_Fixedpoint_DRQ;
}
public IDecRefQueue<Optimize> getOptimizeDRQ()
{
return m_Optimize_DRQ;
}
Z3ReferenceQueue getReferenceQueue() { return m_RefQueue; }
/**
* Disposes of the context.
@ -4439,27 +4329,16 @@ public class Context implements AutoCloseable {
@Override
public void close()
{
m_AST_DRQ.forceClear(this);
m_ASTMap_DRQ.forceClear(this);
m_ASTVector_DRQ.forceClear(this);
m_ApplyResult_DRQ.forceClear(this);
m_FuncEntry_DRQ.forceClear(this);
m_FuncInterp_DRQ.forceClear(this);
m_Goal_DRQ.forceClear(this);
m_Model_DRQ.forceClear(this);
m_Params_DRQ.forceClear(this);
m_Probe_DRQ.forceClear(this);
m_Solver_DRQ.forceClear(this);
m_Optimize_DRQ.forceClear(this);
m_Statistics_DRQ.forceClear(this);
m_Tactic_DRQ.forceClear(this);
m_Simplifier_DRQ.forceClear(this);
m_Fixedpoint_DRQ.forceClear(this);
if (m_ctx == 0)
return;
m_RefQueue.forceClear();
m_boolSort = null;
m_intSort = null;
m_realSort = null;
m_stringSort = null;
m_RefQueue = null;
synchronized (creation_lock) {
Native.delContext(m_ctx);

View file

@ -19,6 +19,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_lbool;
import java.lang.ref.ReferenceQueue;
/**
* Object for managing fixedpoints
**/
@ -327,9 +329,18 @@ public class Fixedpoint extends Z3Object
@Override
void addToReferenceQueue() {
getContext().getFixedpointDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, FixedpointRef::new);
}
@Override
void checkNativeObject(long obj) { }
private static class FixedpointRef extends Z3ReferenceQueue.Reference<Fixedpoint> {
private FixedpointRef(Fixedpoint referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.fixedpointDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
FixedpointDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class FixedpointDecRefQueue extends IDecRefQueue<Fixedpoint> {
public FixedpointDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj)
{
Native.fixedpointDecRef(ctx.nCtx(), obj);
}
};

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* A function interpretation is represented as a finite map and an 'else' value.
* Each entry in the finite map represents the value of a function given a set
@ -93,7 +95,19 @@ public class FuncInterp<R extends Sort> extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getFuncEntryDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, FuncEntryRef::new);
}
private static class FuncEntryRef extends Z3ReferenceQueue.Reference<Entry<?>> {
private FuncEntryRef(Entry<?> referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.funcEntryDecRef(ctx.nCtx(), z3Obj);
}
}
}
@ -186,6 +200,18 @@ public class FuncInterp<R extends Sort> extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getFuncInterpDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, FuncInterpRef::new);
}
private static class FuncInterpRef extends Z3ReferenceQueue.Reference<FuncInterp<?>> {
private FuncInterpRef(FuncInterp<?> referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.funcInterpDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
FuncInterpDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class FuncInterpDecRefQueue extends IDecRefQueue<FuncInterp<?>>
{
public FuncInterpDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.funcInterpDecRef(ctx.nCtx(), obj);
}
};

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
FuncInterpEntryDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class FuncInterpEntryDecRefQueue extends IDecRefQueue<FuncInterp.Entry<?>> {
public FuncInterpEntryDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.funcEntryDecRef(ctx.nCtx(), obj);
}
}

View file

@ -19,6 +19,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_goal_prec;
import java.lang.ref.ReferenceQueue;
/**
* A goal (aka problem). A goal is essentially a set of formulas, that can be
* solved and/or transformed using tactics and solvers.
@ -262,6 +264,18 @@ public class Goal extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getGoalDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, GoalRef::new);
}
private static class GoalRef extends Z3ReferenceQueue.Reference<Goal> {
private GoalRef(Goal referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.goalDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
GoalDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class GoalDecRefQueue extends IDecRefQueue<Goal> {
public GoalDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.goalDecRef(ctx.nCtx(), obj);
}
}

View file

@ -1,83 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
IDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
import java.lang.ref.PhantomReference;
import java.lang.ref.Reference;
import java.lang.ref.ReferenceQueue;
import java.util.IdentityHashMap;
import java.util.Map;
/**
* A queue to handle management of native memory.
*
* <p><b>Mechanics: </b>once an object is created, a metadata is stored for it in
* {@code referenceMap}, and a {@link PhantomReference} is created with a
* reference to {@code referenceQueue}.
* Once the object becomes strongly unreachable, the phantom reference gets
* added by JVM to the {@code referenceQueue}.
* After each object creation, we iterate through the available objects in
* {@code referenceQueue} and decrement references for them.
*
* @param <T> Type of object stored in queue.
*/
public abstract class IDecRefQueue<T extends Z3Object> {
private final ReferenceQueue<T> referenceQueue = new ReferenceQueue<>();
private final Map<PhantomReference<T>, Long> referenceMap =
new IdentityHashMap<>();
protected IDecRefQueue() {}
/**
* An implementation of this method should decrement the reference on a
* given native object.
* This function should always be called on the {@code ctx} thread.
*
* @param ctx Z3 context.
* @param obj Pointer to a Z3 object.
*/
protected abstract void decRef(Context ctx, long obj);
public void storeReference(Context ctx, T obj) {
PhantomReference<T> ref = new PhantomReference<>(obj, referenceQueue);
referenceMap.put(ref, obj.getNativeObject());
clear(ctx);
}
/**
* Clean all references currently in {@code referenceQueue}.
*/
protected void clear(Context ctx)
{
Reference<? extends T> ref;
while ((ref = referenceQueue.poll()) != null) {
long z3ast = referenceMap.remove(ref);
decRef(ctx, z3ast);
}
}
/**
* Clean all references stored in {@code referenceMap},
* <b>regardless</b> of whether they are in {@code referenceMap} or not.
*/
public void forceClear(Context ctx) {
for (long ref : referenceMap.values()) {
decRef(ctx, ref);
}
}
}

View file

@ -19,6 +19,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_sort_kind;
import java.lang.ref.ReferenceQueue;
/**
* A Model contains interpretations (assignments) of constants and functions.
**/
@ -296,6 +298,18 @@ public class Model extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getModelDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ModelRef::new);
}
private static class ModelRef extends Z3ReferenceQueue.Reference<Model> {
private ModelRef(Model referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.modelDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ModelDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ModelDecRefQueue extends IDecRefQueue<Model> {
public ModelDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.modelDecRef(ctx.nCtx(), obj);
}
}

View file

@ -150,7 +150,7 @@ static void final_eh(void* _p, Z3_solver_callback cb) {
static void decide_eh(void* _p, Z3_solver_callback cb, Z3_ast _val, unsigned bit, bool is_pos) {
JavaInfo *info = static_cast<JavaInfo*>(_p);
ScopedCB scoped(info, cb);
info->jenv->CallVoidMethod(info->jobj, info->decide, (jlong)_val);
info->jenv->CallVoidMethod(info->jobj, info->decide, (jlong)_val, bit, is_pos);
}
DLL_VIS JNIEXPORT jlong JNICALL Java_com_microsoft_z3_Native_propagateInit(JNIEnv *jenv, jclass cls, jobject jobj, jlong ctx, jlong solver) {
@ -166,7 +166,7 @@ DLL_VIS JNIEXPORT jlong JNICALL Java_com_microsoft_z3_Native_propagateInit(JNIEn
info->fixed = jenv->GetMethodID(jcls, "fixedWrapper", "(JJ)V");
info->eq = jenv->GetMethodID(jcls, "eqWrapper", "(JJ)V");
info->final = jenv->GetMethodID(jcls, "finWrapper", "()V");
info->decide = jenv->GetMethodID(jcls, "decideWrapper", "(JII)V");
info->decide = jenv->GetMethodID(jcls, "decideWrapper", "(JIZ)V");
if (!info->push || !info->pop || !info->fresh || !info->created || !info->fixed || !info->eq || !info->final || !info->decide) {
assert(false);
@ -203,15 +203,16 @@ DLL_VIS JNIEXPORT void JNICALL Java_com_microsoft_z3_Native_propagateRegisterDec
Z3_solver_propagate_decide((Z3_context)ctx, (Z3_solver)solver, decide_eh);
}
DLL_VIS JNIEXPORT void JNICALL Java_com_microsoft_z3_Native_propagateConflict(JNIEnv * jenv, jclass cls, jobject jobj, jlong ctx, jlong solver, jlong javainfo, long num_fixed, jlongArray fixed, long num_eqs, jlongArray eq_lhs, jlongArray eq_rhs, jlong conseq) {
DLL_VIS JNIEXPORT jboolean JNICALL Java_com_microsoft_z3_Native_propagateConsequence(JNIEnv * jenv, jclass cls, jobject jobj, jlong ctx, jlong solver, jlong javainfo, long num_fixed, jlongArray fixed, long num_eqs, jlongArray eq_lhs, jlongArray eq_rhs, jlong conseq) {
JavaInfo *info = (JavaInfo*)javainfo;
GETLONGAELEMS(Z3_ast, fixed, _fixed);
GETLONGAELEMS(Z3_ast, eq_lhs, _eq_lhs);
GETLONGAELEMS(Z3_ast, eq_rhs, _eq_rhs);
Z3_solver_propagate_consequence((Z3_context)ctx, info->cb, num_fixed, _fixed, num_eqs, _eq_lhs, _eq_rhs, (Z3_ast)conseq);
bool retval = Z3_solver_propagate_consequence((Z3_context)ctx, info->cb, num_fixed, _fixed, num_eqs, _eq_lhs, _eq_rhs, (Z3_ast)conseq);
RELEASELONGAELEMS(fixed, _fixed);
RELEASELONGAELEMS(eq_lhs, _eq_lhs);
RELEASELONGAELEMS(eq_rhs, _eq_rhs);
return (jboolean) retval;
}
DLL_VIS JNIEXPORT void JNICALL Java_com_microsoft_z3_Native_propagateAdd(JNIEnv * jenv, jclass cls, jobject jobj, jlong ctx, jlong solver, jlong javainfo, jlong e) {
@ -227,8 +228,8 @@ DLL_VIS JNIEXPORT void JNICALL Java_com_microsoft_z3_Native_propagateAdd(JNIEnv
}
DLL_VIS JNIEXPORT bool JNICALL Java_com_microsoft_z3_Native_propagateNextSplit(JNIEnv * jenv, jclass cls, jobject jobj, jlong ctx, jlong solver, jlong javainfo, jlong e, long idx, int phase) {
DLL_VIS JNIEXPORT jboolean JNICALL Java_com_microsoft_z3_Native_propagateNextSplit(JNIEnv * jenv, jclass cls, jobject jobj, jlong ctx, jlong solver, jlong javainfo, jlong e, long idx, int phase) {
JavaInfo *info = (JavaInfo*)javainfo;
Z3_solver_callback cb = info->cb;
return Z3_solver_next_split((Z3_context)ctx, cb, (Z3_ast)e, idx, Z3_lbool(phase));
return (jboolean) Z3_solver_next_split((Z3_context)ctx, cb, (Z3_ast)e, idx, Z3_lbool(phase));
}

View file

@ -20,6 +20,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_lbool;
import java.lang.ref.ReferenceQueue;
/**
* Object for managing optimization context
@ -421,6 +423,18 @@ public class Optimize extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getOptimizeDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, OptimizeRef::new);
}
private static class OptimizeRef extends Z3ReferenceQueue.Reference<Optimize> {
private OptimizeRef(Optimize referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.optimizeDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2015 Microsoft Corporation
Module Name:
OptimizeDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class OptimizeDecRefQueue extends IDecRefQueue<Optimize> {
public OptimizeDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.optimizeDecRef(ctx.nCtx(), obj);
}
};

View file

@ -19,6 +19,8 @@ package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_param_kind;
import java.lang.ref.ReferenceQueue;
/**
* A ParamDescrs describes a set of parameters.
**/
@ -97,6 +99,18 @@ public class ParamDescrs extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getParamDescrsDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ParamDescrsRef::new);
}
private static class ParamDescrsRef extends Z3ReferenceQueue.Reference<ParamDescrs> {
private ParamDescrsRef(ParamDescrs referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.paramDescrsDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ParamDescrsDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ParamDescrsDecRefQueue extends IDecRefQueue<ParamDescrs> {
public ParamDescrsDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj)
{
Native.paramDescrsDecRef(ctx.nCtx(), obj);
}
}

View file

@ -18,6 +18,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* A ParameterSet represents a configuration in the form of Symbol/value pairs.
**/
@ -130,6 +132,18 @@ public class Params extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getParamsDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ParamsRef::new);
}
private static class ParamsRef extends Z3ReferenceQueue.Reference<Params> {
private ParamsRef(Params referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.paramsDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ParamDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ParamsDecRefQueue extends IDecRefQueue<Params> {
public ParamsDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.paramsDecRef(ctx.nCtx(), obj);
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Probes are used to inspect a goal (aka problem) and collect information that
* may be used to decide which solver and/or preprocessing step will be used.
@ -56,6 +58,18 @@ public class Probe extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getProbeDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, ProbeRef::new);
}
private static class ProbeRef extends Z3ReferenceQueue.Reference<Probe> {
private ProbeRef(Probe referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.probeDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,32 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
ProbeDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class ProbeDecRefQueue extends IDecRefQueue<Probe>
{
public ProbeDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj)
{
Native.probeDecRef(ctx.nCtx(), obj);
}
};

View file

@ -18,6 +18,8 @@ Author:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
public class Simplifier extends Z3Object {
/*
* A string containing a description of parameters accepted by the simplifier.
@ -32,7 +34,7 @@ public class Simplifier extends Z3Object {
* Retrieves parameter descriptions for Simplifiers.
*/
public ParamDescrs getParameterDescriptions() {
return new ParamDescrs(getContext(), Native.simplifierGetParamDescrs(getContext().nCtx(), getNativeObject()));
return new ParamDescrs(getContext(), Native.simplifierGetParamDescrs(getContext().nCtx(), getNativeObject()));
}
Simplifier(Context ctx, long obj)
@ -53,6 +55,18 @@ public class Simplifier extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getSimplifierDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, SimplifierRef::new);
}
}
private static class SimplifierRef extends Z3ReferenceQueue.Reference<Simplifier> {
private SimplifierRef(Simplifier referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.simplifierDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
SimplifierDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class SimplifierDecRefQueue extends IDecRefQueue<Simplifier> {
public SimplifierDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj)
{
Native.simplifierDecRef(ctx.nCtx(), obj);
}
}

View file

@ -19,6 +19,8 @@ Notes:
package com.microsoft.z3;
import com.microsoft.z3.enumerations.Z3_lbool;
import java.lang.ref.ReferenceQueue;
import java.util.*;
/**
@ -403,6 +405,18 @@ public class Solver extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getSolverDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, SolverRef::new);
}
private static class SolverRef extends Z3ReferenceQueue.Reference<Solver> {
private SolverRef(Solver referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.solverDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,27 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
SolverDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class SolverDecRefQueue extends IDecRefQueue<Solver> {
public SolverDecRefQueue() { super(); }
@Override
protected void decRef(Context ctx, long obj) {
Native.solverDecRef(ctx.nCtx(), obj);
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Objects of this class track statistical information about solvers.
**/
@ -25,7 +27,7 @@ public class Statistics extends Z3Object {
* Statistical data is organized into pairs of [Key, Entry], where every
* Entry is either a {@code DoubleEntry} or a {@code UIntEntry}
**/
public class Entry
public static class Entry
{
/**
* The key of the entry.
@ -191,11 +193,23 @@ public class Statistics extends Z3Object {
@Override
void incRef() {
getContext().getStatisticsDRQ().storeReference(getContext(), this);
Native.statsIncRef(getContext().nCtx(), getNativeObject());
}
@Override
void addToReferenceQueue() {
Native.statsIncRef(getContext().nCtx(), getNativeObject());
getContext().getReferenceQueue().storeReference(this, StatisticsRef::new);
}
private static class StatisticsRef extends Z3ReferenceQueue.Reference<Statistics> {
private StatisticsRef(Statistics referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.statsDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,30 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
StatisticsDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class StatisticsDecRefQueue extends IDecRefQueue<Statistics> {
public StatisticsDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj) {
Native.statsDecRef(ctx.nCtx(), obj);
}
}

View file

@ -17,6 +17,8 @@ Notes:
package com.microsoft.z3;
import java.lang.ref.ReferenceQueue;
/**
* Tactics are the basic building block for creating custom solvers for specific
* problem domains. The complete list of tactics may be obtained using
@ -98,6 +100,19 @@ public class Tactic extends Z3Object {
@Override
void addToReferenceQueue() {
getContext().getTacticDRQ().storeReference(getContext(), this);
//getContext().getTacticDRQ().storeReference(getContext(), this);
getContext().getReferenceQueue().storeReference(this, TacticRef::new);
}
private static class TacticRef extends Z3ReferenceQueue.Reference<Tactic> {
private TacticRef(Tactic referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
}
@Override
void decRef(Context ctx, long z3Obj) {
Native.tacticDecRef(ctx.nCtx(), z3Obj);
}
}
}

View file

@ -1,31 +0,0 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
TacticDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
class TacticDecRefQueue extends IDecRefQueue<Tactic> {
public TacticDecRefQueue()
{
super();
}
@Override
protected void decRef(Context ctx, long obj)
{
Native.tacticDecRef(ctx.nCtx(), obj);
}
}

View file

@ -60,36 +60,47 @@ public abstract class UserPropagatorBase extends Native.UserPropagatorBase {
fixed(var, value);
}
@Override
protected final void decideWrapper(long lvar, int bit, boolean is_pos) {
Expr var = new Expr(ctx, lvar);
decide(var, bit, is_pos);
}
public abstract void push();
public abstract void pop(int number);
public abstract UserPropagatorBase fresh(Context ctx);
public <R extends Sort> void created(Expr<R> ast) {}
public void created(Expr<?> ast) {}
public <R extends Sort> void fixed(Expr<R> var, Expr<R> value) {}
public void fixed(Expr<?> var, Expr<?> value) {}
public <R extends Sort> void eq(Expr<R> x, Expr<R> y) {}
public void eq(Expr<?> x, Expr<?> y) {}
public void decide(Expr<?> var, int bit, boolean is_pos) {}
public void fin() {}
public final <R extends Sort> void add(Expr<R> expr) {
public final void add(Expr<?> expr) {
Native.propagateAdd(this, ctx.nCtx(), solver.getNativeObject(), javainfo, expr.getNativeObject());
}
public final <R extends Sort> void conflict(Expr<R>[] fixed) {
conflict(fixed, new Expr[0], new Expr[0]);
public final boolean conflict(Expr<?>[] fixed) {
return conflict(fixed, new Expr[0], new Expr[0]);
}
public final <R extends Sort> void conflict(Expr<R>[] fixed, Expr<R>[] lhs, Expr<R>[] rhs) {
AST conseq = ctx.mkBool(false);
Native.propagateConflict(
public final boolean conflict(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs) {
return consequence(fixed, lhs, rhs, ctx.mkBool(false));
}
public final boolean consequence(Expr<?>[] fixed, Expr<?>[] lhs, Expr<?>[] rhs, Expr<?> conseq) {
return Native.propagateConsequence(
this, ctx.nCtx(), solver.getNativeObject(), javainfo,
fixed.length, AST.arrayToNative(fixed), lhs.length, AST.arrayToNative(lhs), AST.arrayToNative(rhs), conseq.getNativeObject());
}
public final <R extends Sort> boolean nextSplit(Expr<R> e, long idx, Z3_lbool phase) {
public final boolean nextSplit(Expr<?> e, long idx, Z3_lbool phase) {
return Native.propagateNextSplit(
this, ctx.nCtx(), solver.getNativeObject(), javainfo,
e.getNativeObject(), idx, phase.toInt());

View file

@ -0,0 +1,144 @@
/**
Copyright (c) 2012-2014 Microsoft Corporation
Module Name:
IDecRefQueue.java
Abstract:
Author:
@author Christoph Wintersteiger (cwinter) 2012-03-15
Notes:
**/
package com.microsoft.z3;
import java.lang.ref.PhantomReference;
import java.lang.ref.ReferenceQueue;
/**
* A queue to handle management of native memory.
*
* <p><b>Mechanics: </b>When an object is created, a so-called {@link PhantomReference}
* is constructed that is associated with the created object and the reference queue {@code referenceQueue}.
* Once the object becomes strongly unreachable, the phantom reference gets
* added by JVM to the {@code referenceQueue}.
* After each object creation, we iterate through the available objects in
* {@code referenceQueue} and decrement references for them.
* <p>
* In order for this to work, we need to (i) associate to each phantom reference the underlying
* native object (and its type) that it references and (ii) keep the phantom references themselves alive, so they are not
* garbage collected before the object they reference.
* We use a doubly-linked list of custom phantom references, subclasses of {@link Reference}, to achieve this.
*
*/
class Z3ReferenceQueue {
private final Context ctx;
private final ReferenceQueue<Z3Object> referenceQueue = new ReferenceQueue<>();
private final Reference<?> referenceList = emptyList();
Z3ReferenceQueue(Context ctx) {
this.ctx = ctx;
}
/**
* Create and store a new phantom reference.
*/
<T extends Z3Object> void storeReference(T z3Object, ReferenceConstructor<T> refConstructor) {
referenceList.insert(refConstructor.construct(z3Object, referenceQueue));
clear();
}
/**
* Clean all references currently in {@code referenceQueue}.
*/
private void clear() {
Reference<?> ref;
while ((ref = (Reference<?>)referenceQueue.poll()) != null) {
ref.cleanup(ctx);
}
}
/**
* Clean all references stored in {@code referenceList},
* <b>regardless</b> of whether they are in {@code referenceQueue} or not.
*/
@SuppressWarnings("StatementWithEmptyBody")
public void forceClear() {
// Decrement all reference counters
Reference<?> cur = referenceList.next;
while (cur.next != null) {
cur.decRef(ctx, cur.nativePtr);
cur = cur.next;
}
// Bulk-delete the reference list's entries
referenceList.next = cur;
cur.prev = referenceList;
// Empty the reference queue so that there are no living phantom references anymore.
// This makes sure that all stored phantom references can be GC'd now.
while (referenceQueue.poll() != null) {}
}
private static Reference<?> emptyList() {
Reference<?> head = new DummyReference();
Reference<?> tail = new DummyReference();
head.next = tail;
tail.prev = head;
return head;
}
// ================================================================================================================
@FunctionalInterface
interface ReferenceConstructor<T extends Z3Object> {
Reference<T> construct(T reference, ReferenceQueue<Z3Object> queue);
}
abstract static class Reference<T extends Z3Object> extends PhantomReference<T> {
private Reference<?> prev;
private Reference<?> next;
private final long nativePtr;
Reference(T referent, ReferenceQueue<Z3Object> q) {
super(referent, q);
this.nativePtr = referent != null ? referent.getNativeObject() : 0;
}
private void cleanup(Context ctx) {
decRef(ctx, nativePtr);
assert (prev != null && next != null);
prev.next = next;
next.prev = prev;
}
private void insert(Reference<?> ref) {
assert next != null;
ref.prev = this;
ref.next = this.next;
ref.next.prev = ref;
next = ref;
}
abstract void decRef(Context ctx, long z3Obj);
}
private static class DummyReference extends Reference<Z3Object> {
public DummyReference() {
super(null, null);
}
@Override
void decRef(Context ctx, long z3Obj) {
// Should never be called.
assert false;
}
}
}

View file

@ -14,7 +14,10 @@ make
## Julia part
The Z3 binaries are provided to [Z3.jl](https://github.com/ahumenberger/Z3.jl) via [z3_jll.jl](https://github.com/JuliaBinaryWrappers/z3_jll.jl). That is, in order to release a new Z3 version one has to update the corresponding [build script](https://github.com/JuliaPackaging/Yggdrasil/tree/master/Z/z3) which triggers a new version of z3_jll.jl.
The Z3 binaries are provided to [Z3.jl](https://github.com/ahumenberger/Z3.jl) via [z3_jll.jl](https://github.com/JuliaBinaryWrappers/z3_jll.jl).
That is, in order to propagate any C++ changes to the Julia side, one has to:
1. Release a new version of Z3.
2. Update the corresponding [build script](https://github.com/JuliaPackaging/Yggdrasil/tree/master/Z/z3) to use the new Z3 release.
### Using the compiled version of Z3

View file

@ -303,6 +303,8 @@ JLCXX_MODULE define_julia_module(jlcxx::Module &m)
m.method("xnor", &xnor);
m.method("min", &min);
m.method("max", &max);
m.method("exists", static_cast<expr (*)(expr_vector const &, expr const &)>(&exists));
m.method("forall", static_cast<expr (*)(expr_vector const &, expr const &)>(&forall));
m.method("abs", static_cast<expr (*)(expr const &)>(&abs));
m.method("sqrt", static_cast<expr (*)(expr const &, expr const &)>(&sqrt));
m.method("fma", static_cast<expr (*)(expr const &, expr const &, expr const &, expr const &)>(&fma));

View file

@ -1832,6 +1832,9 @@ struct
let get (x:statistics) (key:string) =
try Some(List.find (fun c -> Entry.get_key c = key) (get_entries x)) with
| Not_found -> None
let get_estimated_alloc_size =
Z3native.get_estimated_alloc_size
end

View file

@ -3224,6 +3224,9 @@ sig
(** The value of a particular statistical counter. *)
val get : statistics -> string -> Entry.statistics_entry option
(** The estimated allocated memory in bytes. *)
val get_estimated_alloc_size : unit -> int64
end
(** Solvers *)

View file

@ -340,7 +340,7 @@ setup(
license='MIT License',
keywords=['z3', 'smt', 'sat', 'prover', 'theorem'],
packages=['z3'],
install_requires = ['importlib-resources'],
install_requires = ["importlib-resources; python_version < '3.9'"],
include_package_data=True,
package_data={
'z3': [os.path.join('lib', '*'), os.path.join('include', '*.h'), os.path.join('include', 'c++', '*.h')]

View file

@ -8984,7 +8984,7 @@ def substitute_funs(t, *m):
m = m1
if z3_debug():
_z3_assert(is_expr(t), "Z3 expression expected")
_z3_assert(all([isinstance(p, tuple) and is_func_decl(p[0]) and is_expr(p[1]) for p in m]), "Z3 invalid substitution, funcion pairs expected.")
_z3_assert(all([isinstance(p, tuple) and is_func_decl(p[0]) and is_expr(p[1]) for p in m]), "Z3 invalid substitution, function pairs expected.")
num = len(m)
_from = (FuncDecl * num)()
_to = (Ast * num)()
@ -9069,7 +9069,7 @@ def AtMost(*args):
def AtLeast(*args):
"""Create an at-most Pseudo-Boolean k constraint.
"""Create an at-least Pseudo-Boolean k constraint.
>>> a, b, c = Bools('a b c')
>>> f = AtLeast(a, b, c, 2)
@ -10969,10 +10969,10 @@ def CharVal(ch, ctx=None):
raise Z3Exception("character value should be an ordinal")
return _to_expr_ref(Z3_mk_char(ctx.ref(), ch), ctx)
def CharFromBv(ch, ctx=None):
if not is_expr(ch):
raise Z3Expression("Bit-vector expression needed")
return _to_expr_ref(Z3_mk_char_from_bv(ch.ctx_ref(), ch.as_ast()), ch.ctx)
def CharFromBv(bv):
if not is_expr(bv):
raise Z3Exception("Bit-vector expression needed")
return _to_expr_ref(Z3_mk_char_from_bv(bv.ctx_ref(), bv.as_ast()), bv.ctx)
def CharToBv(ch, ctx=None):
ch = _coerce_char(ch, ctx)
@ -11570,47 +11570,54 @@ def user_prop_fresh(ctx, _new_ctx):
def user_prop_fixed(ctx, cb, id, value):
prop = _prop_closures.get(ctx)
prop.cb = cb
old_cb = prop.cb
prop.cb = cb
id = _to_expr_ref(to_Ast(id), prop.ctx())
value = _to_expr_ref(to_Ast(value), prop.ctx())
prop.fixed(id, value)
prop.cb = None
prop.cb = old_cb
def user_prop_created(ctx, cb, id):
prop = _prop_closures.get(ctx)
old_cb = prop.cb
prop.cb = cb
id = _to_expr_ref(to_Ast(id), prop.ctx())
prop.created(id)
prop.cb = None
prop.cb = old_cb
def user_prop_final(ctx, cb):
prop = _prop_closures.get(ctx)
old_cb = prop.cb
prop.cb = cb
prop.final()
prop.cb = None
prop.cb = old_cb
def user_prop_eq(ctx, cb, x, y):
prop = _prop_closures.get(ctx)
old_cb = prop.cb
prop.cb = cb
x = _to_expr_ref(to_Ast(x), prop.ctx())
y = _to_expr_ref(to_Ast(y), prop.ctx())
prop.eq(x, y)
prop.cb = None
prop.cb = old_cb
def user_prop_diseq(ctx, cb, x, y):
prop = _prop_closures.get(ctx)
old_cb = prop.cb
prop.cb = cb
x = _to_expr_ref(to_Ast(x), prop.ctx())
y = _to_expr_ref(to_Ast(y), prop.ctx())
prop.diseq(x, y)
prop.cb = None
prop.cb = old_cb
def user_prop_decide(ctx, cb, t, idx, phase):
prop = _prop_closures.get(ctx)
old_cb = prop.cb
prop.cb = cb
t = _to_expr_ref(to_Ast(t_ref), prop.ctx())
prop.decide(t, idx, phase)
prop.cb = None
prop.cb = old_cb
_user_prop_push = Z3_push_eh(user_prop_push)
@ -11651,7 +11658,7 @@ class UserPropagateBase:
#
# Either solver is set or ctx is set.
# Propagators that are created throuh callbacks
# Propagators that are created through callbacks
# to "fresh" inherit the context of that is supplied
# as argument to the callback.
# This context should not be deleted. It is owned by the solver.

View file

@ -99,6 +99,7 @@ _z3_op_to_str = {
Z3_OP_ARRAY_EXT: "Ext",
Z3_OP_PB_AT_MOST: "AtMost",
Z3_OP_PB_AT_LEAST: "AtLeast",
Z3_OP_PB_LE: "PbLe",
Z3_OP_PB_GE: "PbGe",
Z3_OP_PB_EQ: "PbEq",
@ -252,11 +253,11 @@ def _is_html_left_assoc(k):
def _is_add(k):
return k == Z3_OP_ADD or k == Z3_OP_BADD
return k == Z3_OP_ADD or k == Z3_OP_BADD or k == Z3_OP_FPA_ADD
def _is_sub(k):
return k == Z3_OP_SUB or k == Z3_OP_BSUB
return k == Z3_OP_SUB or k == Z3_OP_BSUB or k == Z3_OP_FPA_SUB
if sys.version_info.major < 3:
@ -890,9 +891,21 @@ class Formatter:
if self.is_infix(k) and n >= 3:
rm = a.arg(0)
if z3.is_fprm_value(rm) and z3.get_default_rounding_mode(a.ctx).eq(rm):
arg1 = to_format(self.pp_expr(a.arg(1), d + 1, xs))
arg2 = to_format(self.pp_expr(a.arg(2), d + 1, xs))
p = self.get_precedence(k)
r = []
x = a.arg(1)
y = a.arg(2)
arg1 = to_format(self.pp_expr(x, d + 1, xs))
arg2 = to_format(self.pp_expr(y, d + 1, xs))
if z3.is_app(x):
child_k = x.decl().kind()
if child_k != k and self.is_infix(child_k) and self.get_precedence(child_k) > p:
arg1 = self.add_paren(arg1)
if z3.is_app(y):
child_k = y.decl().kind()
if child_k != k and self.is_infix(child_k) and self.get_precedence(child_k) > p:
arg2 = self.add_paren(arg2)
r.append(arg1)
r.append(to_format(" "))
r.append(to_format(op))
@ -1099,6 +1112,10 @@ class Formatter:
k = Z3_get_decl_int_parameter(a.ctx_ref(), a.decl().ast, 0)
return seq1(self.pp_name(a), [seq3([self.pp_expr(ch, d + 1, xs) for ch in a.children()]), to_format(k)])
def pp_atleast(self, a, d, f, xs):
k = Z3_get_decl_int_parameter(a.ctx_ref(), a.decl().ast, 0)
return seq1(self.pp_name(a), [seq3([self.pp_expr(ch, d + 1, xs) for ch in a.children()]), to_format(k)])
def pp_pbcmp(self, a, d, f, xs):
chs = a.children()
rchs = range(len(chs))
@ -1151,6 +1168,8 @@ class Formatter:
return self.pp_K(a, d, xs)
elif k == Z3_OP_PB_AT_MOST:
return self.pp_atmost(a, d, f, xs)
elif k == Z3_OP_PB_AT_LEAST:
return self.pp_atleast(a, d, f, xs)
elif k == Z3_OP_PB_LE:
return self.pp_pbcmp(a, d, f, xs)
elif k == Z3_OP_PB_GE:

View file

@ -1363,7 +1363,7 @@ typedef enum {
- Z3_NO_PARSER: Parser output is not available, that is, user didn't invoke #Z3_parse_smtlib2_string or #Z3_parse_smtlib2_file.
- Z3_INVALID_PATTERN: Invalid pattern was used to build a quantifier.
- Z3_MEMOUT_FAIL: A memory allocation failure was encountered.
- Z3_FILE_ACCESS_ERRROR: A file could not be accessed.
- Z3_FILE_ACCESS_ERROR: A file could not be accessed.
- Z3_INVALID_USAGE: API call is invalid in the current state.
- Z3_INTERNAL_FATAL: An error internal to Z3 occurred.
- Z3_DEC_REF_ERROR: Trying to decrement the reference counter of an AST that was deleted or the reference counter was not initialized with #Z3_inc_ref.
@ -7184,15 +7184,25 @@ extern "C" {
void Z3_API Z3_solver_propagate_register_cb(Z3_context c, Z3_solver_callback cb, Z3_ast e);
/**
\brief propagate a consequence based on fixed values.
This is a callback a client may invoke during the fixed_eh callback.
The callback adds a propagation consequence based on the fixed values of the
\c ids.
\brief propagate a consequence based on fixed values and equalities.
A client may invoke it during the \c propagate_fixed, \c propagate_eq, \c propagate_diseq, and \c propagate_final callbacks.
The callback adds a propagation consequence based on the fixed values passed \c ids and equalities \c eqs based on parameters \c lhs, \c rhs.
The solver might discard the propagation in case it is true in the current state.
The function returns false in this case; otw. the function returns true.
At least one propagation in the final callback has to return true in order to
prevent the solver from finishing.
Assume the callback has the signature: \c propagate_consequence_eh(context, solver_cb, num_ids, ids, num_eqs, lhs, rhs, consequence).
\param c - context
\param solver_cb - solver callback
\param num_ids - number of fixed terms used as premise to propagation
\param ids - array of length \c num_ids containing terms that are fixed in the current scope
\param num_eqs - number of equalities used as premise to propagation
\param lhs - left side of equalities
\param rhs - right side of equalities
\param consequence - consequence to propagate. It is typically an atomic formula, but it can be an arbitrary formula.
def_API('Z3_solver_propagate_consequence', BOOL, (_in(CONTEXT), _in(SOLVER_CALLBACK), _in(UINT), _in_array(2, AST), _in(UINT), _in_array(4, AST), _in_array(4, AST), _in(AST)))
*/

View file

@ -984,7 +984,8 @@ bool arith_util::is_extended_numeral(expr* term, rational& r) const {
return true;
}
return false;
} while (false);
}
while (true);
return false;
}

View file

@ -49,7 +49,7 @@ sort * array_decl_plugin::mk_sort(decl_kind k, unsigned num_parameters, paramete
m_manager->raise_exception("invalid array sort definition, invalid number of parameters");
return nullptr;
}
parameter params[2] = { parameters[0], parameter(m_manager->mk_bool_sort()) };
parameter params[2] = { parameter(parameters[0]), parameter(m_manager->mk_bool_sort()) };
return mk_sort(ARRAY_SORT, 2, params);
}
SASSERT(k == ARRAY_SORT);

View file

@ -48,21 +48,13 @@ parameter::~parameter() {
}
}
parameter& parameter::operator=(parameter const& other) {
if (this == &other) {
return *this;
}
this->~parameter();
m_val = other.m_val;
parameter::parameter(parameter const& other) : m_val(other.m_val) {
if (auto p = std::get_if<rational*>(&m_val)) {
m_val = alloc(rational, **p);
}
if (auto p = std::get_if<zstring*>(&m_val)) {
m_val = alloc(zstring, **p);
}
return *this;
}
void parameter::init_eh(ast_manager & m) {
@ -319,26 +311,6 @@ func_decl::func_decl(symbol const & name, unsigned arity, sort * const * domain,
//
// -----------------------------------
static app_flags mk_const_flags() {
app_flags r;
r.m_depth = 1;
r.m_ground = true;
r.m_has_quantifiers = false;
r.m_has_labels = false;
return r;
}
static app_flags mk_default_app_flags() {
app_flags r;
r.m_depth = 1;
r.m_ground = true;
r.m_has_quantifiers = false;
r.m_has_labels = false;
return r;
}
app_flags app::g_constant_flags = mk_const_flags();
app::app(func_decl * decl, unsigned num_args, expr * const * args):
expr(AST_APP),
m_decl(decl),
@ -1762,8 +1734,7 @@ ast * ast_manager::register_node_core(ast * n) {
inc_ref(t->get_decl());
unsigned num_args = t->get_num_args();
if (num_args > 0) {
app_flags * f = t->flags();
*f = mk_default_app_flags();
app_flags * f = &t->m_flags;
SASSERT(t->is_ground());
SASSERT(!t->has_quantifiers());
SASSERT(!t->has_labels());
@ -1776,13 +1747,13 @@ ast * ast_manager::register_node_core(ast * n) {
unsigned arg_depth = 0;
switch (arg->get_kind()) {
case AST_APP: {
app_flags * arg_flags = to_app(arg)->flags();
arg_depth = arg_flags->m_depth;
if (arg_flags->m_has_quantifiers)
app *app = to_app(arg);
arg_depth = app->get_depth();
if (app->has_quantifiers())
f->m_has_quantifiers = true;
if (arg_flags->m_has_labels)
if (app->has_labels())
f->m_has_labels = true;
if (!arg_flags->m_ground)
if (!app->is_ground())
f->m_ground = false;
break;
}

View file

@ -142,7 +142,7 @@ public:
explicit parameter(const char *s): m_val(symbol(s)) {}
explicit parameter(const std::string &s): m_val(symbol(s)) {}
explicit parameter(unsigned ext_id, bool): m_val(ext_id) {}
parameter(parameter const& other) { *this = other; }
explicit parameter(parameter const& other);
parameter(parameter && other) noexcept : m_val(std::move(other.m_val)) {
other.m_val = 0;
@ -150,7 +150,10 @@ public:
~parameter();
parameter& operator=(parameter const& other);
parameter& operator=(parameter && other) {
std::swap(other.m_val, m_val);
return *this;
}
kind_t get_kind() const { return static_cast<kind_t>(m_val.index()); }
bool is_int() const { return get_kind() == PARAM_INT; }
@ -704,6 +707,7 @@ struct app_flags {
unsigned m_ground:1; // application does not have free variables or nested quantifiers.
unsigned m_has_quantifiers:1; // application has nested quantifiers.
unsigned m_has_labels:1; // application has nested labels.
app_flags() : m_depth(1), m_ground(1), m_has_quantifiers(0), m_has_labels(0) {}
};
class app : public expr {
@ -711,19 +715,15 @@ class app : public expr {
func_decl * m_decl;
unsigned m_num_args;
app_flags m_flags;
expr * m_args[0];
static app_flags g_constant_flags;
// remark: store term depth in the end of the app. the depth is only stored if the num_args > 0
static unsigned get_obj_size(unsigned num_args) {
return num_args == 0 ? sizeof(app) : sizeof(app) + num_args * sizeof(expr *) + sizeof(app_flags);
return sizeof(app) + num_args * sizeof(expr *);
}
friend class tmp_app;
app_flags * flags() const { return m_num_args == 0 ? &g_constant_flags : reinterpret_cast<app_flags*>(const_cast<expr**>(m_args + m_num_args)); }
app(func_decl * decl, unsigned num_args, expr * const * args);
public:
func_decl * get_decl() const { return m_decl; }
@ -744,10 +744,10 @@ public:
expr * const * end() const { return m_args + m_num_args; }
sort * _get_sort() const { return get_decl()->get_range(); }
unsigned get_depth() const { return flags()->m_depth; }
bool is_ground() const { return flags()->m_ground; }
bool has_quantifiers() const { return flags()->m_has_quantifiers; }
bool has_labels() const { return flags()->m_has_labels; }
unsigned get_depth() const { return m_flags.m_depth; }
bool is_ground() const { return m_flags.m_ground; }
bool has_quantifiers() const { return m_flags.m_has_quantifiers; }
bool has_labels() const { return m_flags.m_has_labels; }
};
// -----------------------------------
@ -1102,7 +1102,7 @@ public:
// Event handlers for deleting/translating PARAM_EXTERNAL
virtual void del(parameter const & p) {}
virtual parameter translate(parameter const & p, decl_plugin & target) { UNREACHABLE(); return p; }
virtual parameter translate(parameter const & p, decl_plugin & target) { UNREACHABLE(); return {}; }
virtual bool is_considered_uninterpreted(func_decl * f) { return false; }
};

View file

@ -68,8 +68,8 @@ bool lt(ast * n1, ast * n2) {
num = to_sort(n1)->get_num_parameters();
SASSERT(num > 0);
for (unsigned i = 0; i < num; i++) {
parameter p1 = to_sort(n1)->get_parameter(i);
parameter p2 = to_sort(n2)->get_parameter(i);
const parameter &p1 = to_sort(n1)->get_parameter(i);
const parameter &p2 = to_sort(n2)->get_parameter(i);
check_parameter(p1, p2);
}
UNREACHABLE();
@ -80,8 +80,8 @@ bool lt(ast * n1, ast * n2) {
check_value(to_func_decl(n1)->get_num_parameters(), to_func_decl(n2)->get_num_parameters());
num = to_func_decl(n1)->get_num_parameters();
for (unsigned i = 0; i < num; i++) {
parameter p1 = to_func_decl(n1)->get_parameter(i);
parameter p2 = to_func_decl(n2)->get_parameter(i);
const parameter &p1 = to_func_decl(n1)->get_parameter(i);
const parameter &p2 = to_func_decl(n2)->get_parameter(i);
check_parameter(p1, p2);
}
num = to_func_decl(n1)->get_arity();

View file

@ -58,13 +58,13 @@ inline std::ostream& operator<<(std::ostream & out, mk_pp_vec const & pp) {
inline std::string operator+(char const* s, mk_pp const& pp) {
std::ostringstream strm;
strm << s << pp;
return strm.str();
return std::move(strm).str();
}
inline std::string operator+(std::string const& s, mk_pp const& pp) {
std::ostringstream strm;
strm << s << pp;
return strm.str();
return std::move(strm).str();
}
inline std::string& operator+=(std::string& s, mk_pp const& pp) {

View file

@ -454,9 +454,8 @@ func_decl * bv_decl_plugin::mk_num_decl(unsigned num_parameters, parameter const
// This cannot be enforced now, since some Z3 modules try to generate these invalid numerals.
// After SMT-COMP, I should find all offending modules.
// For now, I will just simplify the numeral here.
rational v = parameters[0].get_rational();
parameter p0(mod2k(v, bv_size));
parameter ps[2] = { std::move(p0), parameters[1] };
const rational &v = parameters[0].get_rational();
parameter ps[2] = { parameter(mod2k(v, bv_size)), parameter(parameters[1]) };
sort * bv = get_bv_sort(bv_size);
return m_manager->mk_const_decl(m_bv_sym, bv, func_decl_info(m_family_id, OP_BV_NUM, num_parameters, ps));
}
@ -913,13 +912,9 @@ app * bv_util::mk_numeral(rational const & val, unsigned bv_size) const {
if (m_plugin->log_constant_meaning_prelude(r)) {
if (bv_size % 4 == 0) {
m_manager.trace_stream() << "#x";
val.display_hex(m_manager.trace_stream(), bv_size);
m_manager.trace_stream() << "\n";
m_manager.trace_stream() << "#x" << val.as_hex(bv_size) << "\n";
} else {
m_manager.trace_stream() << "#b";
val.display_bin(m_manager.trace_stream(), bv_size);
m_manager.trace_stream() << "\n";
m_manager.trace_stream() << "#b" << val.as_bin(bv_size) << "\n";
}
}

View file

@ -400,6 +400,7 @@ class bv_expr_inverter : public iexpr_inverter {
}
bool process_concat(func_decl* f, unsigned num, expr* const* args, expr_ref& r) {
// return false;
if (num == 0)
return false;
if (!uncnstr(num, args))

View file

@ -43,6 +43,7 @@ void generic_model_converter::operator()(model_ref & md) {
expr_ref val(m);
unsigned arity;
bool reset_ev = false;
obj_map<sort, ptr_vector<expr>> uninterpreted;
for (unsigned i = m_entries.size(); i-- > 0; ) {
entry const& e = m_entries[i];
switch (e.m_instruction) {
@ -63,6 +64,13 @@ void generic_model_converter::operator()(model_ref & md) {
reset_ev = old_val != nullptr;
md->register_decl(e.m_f, val);
}
// corner case when uninterpreted constants are eliminated
sort* s = e.m_f->get_range();
if (m.is_uninterp(s) && !md->has_uninterpreted_sort(s)) {
uninterpreted.insert_if_not_there(s, {});
if (!uninterpreted[s].contains(val))
uninterpreted[s].push_back(val);
}
}
else {
func_interp * old_val = md->get_func_interp(e.m_f);
@ -84,6 +92,9 @@ void generic_model_converter::operator()(model_ref & md) {
break;
}
}
for (auto const& [s, u] : uninterpreted) {
md->register_usort(s, u.size(), u.data());
}
TRACE("model_converter", tout << "after generic_model_converter\n"; model_v2_pp(tout, *md););
}

View file

@ -68,6 +68,8 @@ public:
void get_units(obj_map<expr, bool>& units) override;
vector<entry> const& entries() const { return m_entries; }
void reset() { m_entries.reset(); }
};
typedef ref<generic_model_converter> generic_model_converter_ref;

View file

@ -59,9 +59,9 @@ TODOs:
- The shared terms hash table is not incremental.
It could be made incremental by updating it on every merge similar to how the egraph handles it.
- V2 using multiplicities instead of repeated values in monomials.
- Squash trail updates when equations or monomials are modified within the same epoque.
- by an epoque counter that can be updated by the egraph class whenever there is a push/pop.
- store the epoque as a tick on equations and possibly when updating monomials on equations.
- Squash trail updates when equations or monomials are modified within the same epoch.
- by an epoch counter that can be updated by the egraph class whenever there is a push/pop.
- store the epoch as a tick on equations and possibly when updating monomials on equations.
--*/
@ -80,7 +80,7 @@ namespace euf {
}
ac_plugin::ac_plugin(egraph& g, func_decl* f) :
plugin(g), m_fid(f->get_family_id()), m_decl(f),
plugin(g), m_fid(f->get_family_id()), m_decl(f),
m_dep_manager(get_region()),
m_hash(*this), m_eq(*this), m_monomial_table(m_hash, m_eq)
{

View file

@ -40,7 +40,7 @@ namespace euf {
struct node {
enode* n; // associated enode
node* root; // path compressed root
node* next; // next in equaivalence class
node* next; // next in equivalence class
justification j; // justification for equality
node* target = nullptr; // justified next
unsigned_vector shared; // shared occurrences

View file

@ -7,7 +7,7 @@ Module Name:
Abstract:
plugin structure for arithetic
plugin structure for arithmetic
Author:

View file

@ -7,7 +7,7 @@ Module Name:
Abstract:
plugin structure for arithetic
plugin structure for arithmetic
Author:
Nikolaj Bjorner (nbjorner) 2023-11-11

View file

@ -319,7 +319,7 @@ func_interp * bv2fpa_converter::convert_func_interp(model_core * mc, func_decl *
if (m_fpa_util.is_to_sbv(f) || m_fpa_util.is_to_ubv(f)) {
auto k = m_fpa_util.is_to_sbv(f) ? OP_FPA_TO_SBV_I : OP_FPA_TO_UBV_I;
parameter param = f->get_parameter(0);
const parameter &param = f->get_parameter(0);
func_decl_ref to_bv_i(m.mk_func_decl(fid, k, 1, &param, dom.size(), dom.data()), m);
expr_ref else_value(m.mk_app(to_bv_i, dom.size(), dom.data()), m);
result->set_else(else_value);

View file

@ -208,8 +208,7 @@ sort * fpa_decl_plugin::mk_float_sort(unsigned ebits, unsigned sbits) {
if (ebits > 63)
m_manager->raise_exception("maximum number of exponent bits is 63");
parameter p1(ebits), p2(sbits);
parameter ps[2] = { p1, p2 };
parameter ps[2] = { parameter(ebits), parameter(sbits) };
sort_size sz;
sz = sort_size::mk_very_big(); // TODO: refine
return m_manager->mk_sort(symbol("FloatingPoint"), sort_info(m_family_id, FLOATING_POINT_SORT, sz, 2, ps));

View file

@ -40,7 +40,7 @@ namespace polymorphism {
unsigned n = s->get_num_parameters();
vector<parameter> ps;
for (unsigned i = 0; i < n; ++i) {
auto p = s->get_parameter(i);
auto &p = s->get_parameter(i);
if (p.is_ast() && is_sort(p.get_ast())) {
sort_ref s = (*this)(to_sort(p.get_ast()));
ps.push_back(parameter(s.get()));
@ -167,8 +167,8 @@ namespace polymorphism {
if (s1->get_num_parameters() != s2->get_num_parameters())
return false;
for (unsigned i = s1->get_num_parameters(); i-- > 0;) {
auto p1 = s1->get_parameter(i);
auto p2 = s2->get_parameter(i);
auto &p1 = s1->get_parameter(i);
auto &p2 = s2->get_parameter(i);
if (p1.is_ast() && is_sort(p1.get_ast())) {
if (!p2.is_ast())
return false;
@ -204,8 +204,8 @@ namespace polymorphism {
if (s1->get_num_parameters() != s2->get_num_parameters())
return false;
for (unsigned i = s1->get_num_parameters(); i-- > 0;) {
auto p1 = s1->get_parameter(i);
auto p2 = s2->get_parameter(i);
auto &p1 = s1->get_parameter(i);
auto &p2 = s2->get_parameter(i);
if (p1.is_ast() && is_sort(p1.get_ast())) {
if (!p2.is_ast())
return false;
@ -282,7 +282,7 @@ namespace polymorphism {
}
vector<parameter> params;
for (unsigned i = 0; i < s->get_num_parameters(); ++i) {
parameter p = s->get_parameter(i);
const parameter &p = s->get_parameter(i);
if (p.is_ast() && is_sort(p.get_ast())) {
sort_ref fs = fresh(to_sort(p.get_ast()));
params.push_back(parameter(fs.get()));

View file

@ -1235,7 +1235,7 @@ static rational symmod(rational const& a, rational const& b) {
if (2*r > b) r -= b;
return r;
}
br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & result) {
set_curr_sort(arg1->get_sort());
numeral v1, v2;
@ -1297,9 +1297,9 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul
}
expr* x, *y;
if (is_num2 && v2.is_pos() && m_util.is_mul(arg1, x, y) && m_util.is_numeral(x, v1, is_int) && divides(v1, v2)) {
result = m_util.mk_mul(x, m_util.mk_mod(y, m_util.mk_int(v2/v1)));
return BR_REWRITE2;
if (is_num2 && v2.is_pos() && m_util.is_mul(arg1, x, y) && m_util.is_numeral(x, v1, is_int) && v1 > 0 && divides(v1, v2)) {
result = m_util.mk_mul(m_util.mk_int(v1), m_util.mk_mod(y, m_util.mk_int(v2/v1)));
return BR_REWRITE1;
}
if (is_num2 && v2 == 2 && m_util.is_mul(arg1, x, y)) {
@ -1310,6 +1310,27 @@ br_status arith_rewriter::mk_mod_core(expr * arg1, expr * arg2, expr_ref & resul
return BR_FAILED;
}
bool arith_rewriter::get_range(expr* e, rational& lo, rational& hi) {
expr* x, *y;
rational r;
if (m_util.is_idiv(e, x, y) && m_util.is_numeral(y, r) && get_range(x, lo, hi) && 0 <= lo && r > 0) {
lo = div(lo, r);
hi = div(hi, r);
return true;
}
if (m_util.is_mod(e, x, y) && m_util.is_numeral(y, r) && r > 0) {
lo = 0;
hi = r - 1;
return true;
}
if (m_util.is_numeral(e, r)) {
lo = hi = r;
return true;
}
return false;
}
br_status arith_rewriter::mk_rem_core(expr * arg1, expr * arg2, expr_ref & result) {
set_curr_sort(arg1->get_sort());
numeral v1, v2;
@ -1454,7 +1475,7 @@ br_status arith_rewriter::mk_lshr_core(unsigned sz, expr* arg1, expr* arg2, expr
}
if (is_num_x && is_num_y) {
if (y >= sz)
result = m_util.mk_int(N-1);
result = m_util.mk_int(0);
else {
rational d = div(x, rational::power_of_two(y.get_unsigned()));
result = m_util.mk_int(d);

View file

@ -63,6 +63,7 @@ class arith_rewriter : public poly_rewriter<arith_rewriter_core> {
bool m_eq2ineq;
unsigned m_max_degree;
bool get_range(expr* e, rational& lo, rational& hi);
void get_coeffs_gcd(expr * t, numeral & g, bool & first, unsigned & num_consts);
enum const_treatment { CT_FLOOR, CT_CEIL, CT_FALSE };
bool div_polynomial(expr * t, numeral const & g, const_treatment ct, expr_ref & result);

View file

@ -206,7 +206,9 @@ br_status array_rewriter::mk_store_core(unsigned num_args, expr * const * args,
bool array_rewriter::squash_store(unsigned n, expr* const* args, expr_ref& result) {
ptr_buffer<expr> parents, sargs;
expr* a = args[0];
while (m_util.is_store(a)) {
unsigned rounds = 0;
while (m_util.is_store(a) && rounds < 10) {
++rounds;
lbool r = compare_args(n - 2, args + 1, to_app(a)->get_args() + 1);
switch (r) {
case l_undef:

View file

@ -615,6 +615,8 @@ MK_PARAMETRIC_UNARY_REDUCE(reduce_sign_extend, mk_sign_extend);
if (m_blast_quant) {
if (m_bindings.empty())
return false;
if (!butil().is_bv(t))
return false;
unsigned shift = m_shifts.back();
if (t->get_idx() >= m_bindings.size()) {
if (shift == 0)

View file

@ -545,16 +545,9 @@ bool bool_rewriter::local_ctx_simp(unsigned num_args, expr * const * args, expr_
bool simp = false;
bool modified = false;
bool forward = true;
unsigned rounds = 0;
expr* narg;
while (true) {
rounds++;
#if 0
if (rounds > 10)
verbose_stream() << "rounds: " << rounds << "\n";
#endif
#define PROCESS_ARG() \
{ \
@ -699,6 +692,22 @@ app* bool_rewriter::mk_eq(expr* lhs, expr* rhs) {
return m().mk_eq(lhs, rhs);
}
bool bool_rewriter::try_ite_eq(expr* lhs, expr* rhs, expr_ref& r) {
expr* c, *t, *e;
if (!m().is_ite(lhs, c, t, e))
return false;
if (m().are_equal(t, rhs) && m().are_distinct(e, rhs)) {
r = c;
return true;
}
if (m().are_equal(e, rhs) && m().are_distinct(t, rhs)) {
r = m().mk_not(c);
return true;
}
return false;
}
br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
if (m().are_equal(lhs, rhs)) {
result = m().mk_true();
@ -713,6 +722,12 @@ br_status bool_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
br_status r = BR_FAILED;
if (try_ite_eq(lhs, rhs, result))
return BR_REWRITE1;
if (try_ite_eq(rhs, lhs, result))
return BR_REWRITE1;
if (m_ite_extra_rules) {
if (m().is_ite(lhs) && m().is_value(rhs)) {
r = try_ite_value(to_app(lhs), to_app(rhs), result);

View file

@ -71,6 +71,8 @@ class bool_rewriter {
void mk_and_as_or(unsigned num_args, expr * const * args, expr_ref & result);
bool try_ite_eq(expr* lhs, expr* rhs, expr_ref& r);
expr * mk_or_app(unsigned num_args, expr * const * args);
bool simp_nested_not_or(unsigned num_args, expr * const * args, expr_fast_mark1 & neg_lits, expr_fast_mark2 & pos_lits, expr_ref & result);
expr * simp_arg(expr * arg, expr_fast_mark1 & neg_lits, expr_fast_mark2 & pos_lits, bool & modified);

View file

@ -20,8 +20,9 @@ Notes:
#include "ast/rewriter/bv_rewriter.h"
#include "ast/rewriter/poly_rewriter_def.h"
#include "ast/rewriter/bool_rewriter.h"
#include "ast/ast_smt2_pp.h"
#include "ast/ast_lt.h"
#include "ast/ast_pp.h"
void bv_rewriter::updt_local_params(params_ref const & _p) {
@ -54,45 +55,58 @@ void bv_rewriter::get_param_descrs(param_descrs & r) {
br_status bv_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * const * args, expr_ref & result) {
SASSERT(f->get_family_id() == get_fid());
br_status st = BR_FAILED;
switch(f->get_decl_kind()) {
case OP_BIT0: SASSERT(num_args == 0); result = mk_zero(1); return BR_DONE;
case OP_BIT1: SASSERT(num_args == 0); result = mk_one(1); return BR_DONE;
case OP_ULEQ:
SASSERT(num_args == 2);
return mk_ule(args[0], args[1], result);
st = mk_ule(args[0], args[1], result);
break;
case OP_UGEQ:
SASSERT(num_args == 2);
return mk_uge(args[0], args[1], result);
st = mk_uge(args[0], args[1], result);
break;
case OP_ULT:
SASSERT(num_args == 2);
return mk_ult(args[0], args[1], result);
st = mk_ult(args[0], args[1], result);
break;
case OP_UGT:
SASSERT(num_args == 2);
return mk_ult(args[1], args[0], result);
st = mk_ult(args[1], args[0], result);
break;
case OP_SLEQ:
SASSERT(num_args == 2);
return mk_sle(args[0], args[1], result);
st = mk_sle(args[0], args[1], result);
break;
case OP_SGEQ:
SASSERT(num_args == 2);
return mk_sge(args[0], args[1], result);
st = mk_sge(args[0], args[1], result);
break;
case OP_SLT:
SASSERT(num_args == 2);
return mk_slt(args[0], args[1], result);
st = mk_slt(args[0], args[1], result);
break;
case OP_SGT:
SASSERT(num_args == 2);
return mk_slt(args[1], args[0], result);
st = mk_slt(args[1], args[0], result);
break;
case OP_BADD:
SASSERT(num_args > 0);
return mk_bv_add(num_args, args, result);
st = mk_bv_add(num_args, args, result);
break;
case OP_BMUL:
SASSERT(num_args > 0);
return mk_bv_mul(num_args, args, result);
st = mk_bv_mul(num_args, args, result);
break;
case OP_BSUB:
SASSERT(num_args > 0);
return mk_sub(num_args, args, result);
st = mk_sub(num_args, args, result);
break;
case OP_BNEG:
SASSERT(num_args == 1);
return mk_uminus(args[0], result);
st = mk_uminus(args[0], result);
break;
case OP_BNEG_OVFL:
SASSERT(num_args == 1);
return mk_bvneg_overflow(args[0], result);
@ -220,6 +234,13 @@ br_status bv_rewriter::mk_app_core(func_decl * f, unsigned num_args, expr * cons
default:
return BR_FAILED;
}
CTRACE("bv", st != BR_FAILED, tout << mk_pp(f, m) << "\n";
for (unsigned i = 0; i < num_args; ++i)
tout << " " << mk_bounded_pp(args[i], m) << "\n";
tout << mk_bounded_pp(result, m, 3) << "\n");
return st;
}
br_status bv_rewriter::mk_ule(expr * a, expr * b, expr_ref & result) {
@ -541,7 +562,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref
const br_status cst = rw_leq_concats(is_signed, a, b, result);
if (cst != BR_FAILED) {
TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
<< mk_ismt2_pp(a, m, 2) << "\n" << mk_ismt2_pp(b, m, 2) << "\n--->\n"<< mk_ismt2_pp(result, m, 2) << "\n";);
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
return cst;
}
}
@ -550,7 +571,7 @@ br_status bv_rewriter::mk_leq_core(bool is_signed, expr * a, expr * b, expr_ref
const br_status cst = rw_leq_overflow(is_signed, a, b, result);
if (cst != BR_FAILED) {
TRACE("le_extra", tout << (is_signed ? "bv_sle\n" : "bv_ule\n")
<< mk_ismt2_pp(a, m, 2) << "\n" << mk_ismt2_pp(b, m, 2) << "\n--->\n"<< mk_ismt2_pp(result, m, 2) << "\n";);
<< mk_pp(a, m, 2) << "\n" << mk_pp(b, m, 2) << "\n--->\n"<< mk_pp(result, m, 2) << "\n";);
return cst;
}
}
@ -802,8 +823,8 @@ br_status bv_rewriter::mk_extract(unsigned high, unsigned low, expr * arg, expr_
const unsigned ep_rm = propagate_extract(high, arg, ep_res);
if (ep_rm != 0) {
result = m_mk_extract(high, low, ep_res);
TRACE("extract_prop", tout << mk_ismt2_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n"
<< mk_ismt2_pp(result.get(), m) << "\n";);
TRACE("extract_prop", tout << mk_pp(arg, m) << "\n[" << high <<"," << low << "]\n" << ep_rm << "---->\n"
<< mk_pp(result.get(), m) << "\n";);
return BR_REWRITE2;
}
}
@ -1132,7 +1153,7 @@ br_status bv_rewriter::mk_bv_udiv_core(expr * arg1, expr * arg2, bool hi_div0, e
m_util.mk_bv_udiv0(arg1),
m_util.mk_bv_udiv_i(arg1, arg2));
TRACE("bv_udiv", tout << mk_ismt2_pp(arg1, m) << "\n" << mk_ismt2_pp(arg2, m) << "\n---->\n" << mk_ismt2_pp(result, m) << "\n";);
TRACE("bv_udiv", tout << mk_pp(arg1, m) << "\n" << mk_pp(arg2, m) << "\n---->\n" << mk_pp(result, m) << "\n";);
return BR_REWRITE2;
}
@ -1792,8 +1813,8 @@ br_status bv_rewriter::mk_bv_or(unsigned num, expr * const * args, expr_ref & re
std::reverse(exs.begin(), exs.end());
result = m_util.mk_concat(exs.size(), exs.data());
TRACE("mask_bug",
tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_ismt2_pp(t, m) << ")\n";
tout << mk_ismt2_pp(result, m) << "))\n";);
tout << "(assert (distinct (bvor (_ bv" << old_v1 << " " << sz << ")\n" << mk_pp(t, m) << ")\n";
tout << mk_pp(result, m) << "))\n";);
return BR_REWRITE2;
}
@ -2463,7 +2484,7 @@ br_status bv_rewriter::mk_blast_eq_value(expr * lhs, expr * rhs, expr_ref & resu
unsigned sz = get_bv_size(lhs);
if (sz == 1)
return BR_FAILED;
TRACE("blast_eq_value", tout << "sz: " << sz << "\n" << mk_ismt2_pp(lhs, m) << "\n";);
TRACE("blast_eq_value", tout << "sz: " << sz << "\n" << mk_pp(lhs, m) << "\n";);
if (is_numeral(lhs))
std::swap(lhs, rhs);
@ -2573,7 +2594,6 @@ void bv_rewriter::mk_t1_add_t2_eq_c(expr * t1, expr * t2, expr * c, expr_ref & r
result = m.mk_eq(t1, m_util.mk_bv_sub(c, t2));
}
#include "ast/ast_pp.h"
bool bv_rewriter::isolate_term(expr* lhs, expr* rhs, expr_ref& result) {
if (!m_util.is_numeral(lhs) || !is_add(rhs)) {
@ -2730,13 +2750,13 @@ br_status bv_rewriter::mk_eq_core(expr * lhs, expr * rhs, expr_ref & result) {
st = mk_mul_eq(lhs, rhs, result);
if (st != BR_FAILED) {
TRACE("mk_mul_eq", tout << mk_ismt2_pp(lhs, m) << "\n=\n" << mk_ismt2_pp(rhs, m) << "\n----->\n" << mk_ismt2_pp(result,m) << "\n";);
TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
return st;
}
st = mk_mul_eq(rhs, lhs, result);
if (st != BR_FAILED) {
TRACE("mk_mul_eq", tout << mk_ismt2_pp(lhs, m) << "\n=\n" << mk_ismt2_pp(rhs, m) << "\n----->\n" << mk_ismt2_pp(result,m) << "\n";);
TRACE("mk_mul_eq", tout << mk_pp(lhs, m) << "\n=\n" << mk_pp(rhs, m) << "\n----->\n" << mk_pp(result,m) << "\n";);
return st;
}
@ -2851,8 +2871,8 @@ bool bv_rewriter::is_eq_bit(expr * t, expr * & x, unsigned & val) {
br_status bv_rewriter::mk_ite_core(expr * c, expr * t, expr * e, expr_ref & result) {
TRACE("bv_ite", tout << "mk_ite_core:\n" << mk_ismt2_pp(c, m) << "?\n"
<< mk_ismt2_pp(t, m) << "\n:" << mk_ismt2_pp(e, m) << "\n";);
TRACE("bv_ite", tout << "mk_ite_core:\n" << mk_pp(c, m) << "?\n"
<< mk_pp(t, m) << "\n:" << mk_pp(e, m) << "\n";);
if (m.are_equal(t, e)) {
result = e;
return BR_REWRITE1;

View file

@ -157,9 +157,7 @@ expr_ref pb_rewriter::mk_validate_rewrite(app_ref& e1, app_ref& e2) {
continue;
}
std::ostringstream strm;
strm << 'x' << i;
name = symbol(strm.str());
name = symbol('x' + std::to_string(i));
trail.push_back(m.mk_const(name, a.mk_int()));
expr* x = trail.back();
m.is_not(e,e);
@ -188,9 +186,7 @@ void pb_rewriter::validate_rewrite(func_decl* f, unsigned sz, expr*const* args,
}
void pb_rewriter::dump_pb_rewrite(expr* fml) {
std::ostringstream strm;
strm << "pb_rewrite_" << (s_lemma++) << ".smt2";
std::ofstream out(strm.str());
std::ofstream out("pb_rewrite_" + std::to_string(s_lemma++) + ".smt2");
ast_smt_pp pp(m());
pp.display_smt2(out, fml);
out.close();

View file

@ -3478,7 +3478,7 @@ expr_ref seq_rewriter::mk_antimirov_deriv_union(expr* d1, expr* d2) {
//
// restrict(d, false) = []
//
// it is already assumed that the restriction takes place witin a branch
// it is already assumed that the restriction takes place within a branch
// so the condition is not added explicitly but propagated down in order to eliminate
// infeasible cases
expr_ref seq_rewriter::mk_antimirov_deriv_restrict(expr* e, expr* d, expr* cond) {
@ -3717,7 +3717,7 @@ expr_ref seq_rewriter::mk_regex_concat(expr* r, expr* s) {
result = re().mk_plus(re().mk_full_char(ele_sort));
else if (re().is_concat(r, r1, r2))
// create the resulting concatenation in right-associative form except for the following case
// TODO: maintain the followig invariant for A ++ B{m,n} + C
// TODO: maintain the following invariant for A ++ B{m,n} + C
// concat(concat(A, B{m,n}), C) (if A != () and C != ())
// concat(B{m,n}, C) (if A == () and C != ())
// where A, B, C are regexes
@ -3725,11 +3725,11 @@ expr_ref seq_rewriter::mk_regex_concat(expr* r, expr* s) {
// In other words, do not make A ++ B{m,n} into right-assoc form, but keep B{m,n} at the top
// This will help to identify this situation in the merge routine:
// concat(concat(A, B{0,m}), C) | concat(concat(A, B{0,n}), C)
// simplies to
// simplifies to
// concat(concat(A, B{0,max(m,n)}), C)
// analogously:
// concat(concat(A, B{0,m}), C) & concat(concat(A, B{0,n}), C)
// simplies to
// simplifies to
// concat(concat(A, B{0,min(m,n)}), C)
result = mk_regex_concat(r1, mk_regex_concat(r2, s));
else {
@ -3850,12 +3850,12 @@ bool seq_rewriter::pred_implies(expr* a, expr* b) {
Utility function to decide if two BDDs (nested if-then-else terms)
have exactly the same structure and conditions.
*/
bool seq_rewriter::ite_bdds_compatabile(expr* a, expr* b) {
bool seq_rewriter::ite_bdds_compatible(expr* a, expr* b) {
expr* ca = nullptr, *a1 = nullptr, *a2 = nullptr;
expr* cb = nullptr, *b1 = nullptr, *b2 = nullptr;
if (m().is_ite(a, ca, a1, a2) && m().is_ite(b, cb, b1, b2)) {
return (ca == cb) && ite_bdds_compatabile(a1, b1)
&& ite_bdds_compatabile(a2, b2);
return (ca == cb) && ite_bdds_compatible(a1, b1)
&& ite_bdds_compatible(a2, b2);
}
else if (m().is_ite(a) || m().is_ite(b)) {
return false;
@ -3915,7 +3915,7 @@ expr_ref seq_rewriter::mk_der_op_rec(decl_kind k, expr* a, expr* b) {
// sophisticated: in an antimirov union of n terms, we really
// want to check if any pair of them is compatible.
else if (m().is_ite(a) && m().is_ite(b) &&
!ite_bdds_compatabile(a, b)) {
!ite_bdds_compatible(a, b)) {
k = _OP_RE_ANTIMIROV_UNION;
}
#endif
@ -4269,7 +4269,7 @@ expr_ref seq_rewriter::mk_derivative_rec(expr* ele, expr* r) {
}
else if (re().is_reverse(r, r1)) {
if (re().is_to_re(r1, r2)) {
// First try to exctract hd and tl such that r = hd ++ tl and |tl|=1
// First try to extract hd and tl such that r = hd ++ tl and |tl|=1
expr_ref hd(m()), tl(m());
if (get_head_tail_reversed(r2, hd, tl)) {
// Use mk_der_cond to normalize

View file

@ -201,7 +201,7 @@ class seq_rewriter {
expr_ref mk_der_compl(expr* a);
expr_ref mk_der_cond(expr* cond, expr* ele, sort* seq_sort);
expr_ref mk_der_antimirov_union(expr* r1, expr* r2);
bool ite_bdds_compatabile(expr* a, expr* b);
bool ite_bdds_compatible(expr* a, expr* b);
/* if r has the form deriv(en..deriv(e1,to_re(s))..) returns 's = [e1..en]' else returns '() in r'*/
expr_ref is_nullable_symbolic_regex(expr* r, sort* seq_sort);
#ifdef Z3DEBUG

View file

@ -8,7 +8,7 @@ Module Name:
Abstract:
Skolem function support for sequences.
Skolem functions are auxiliary funcions useful for axiomatizing sequence
Skolem functions are auxiliary functions useful for axiomatizing sequence
operations.
Author:

View file

@ -66,7 +66,6 @@ bool elim_unconstrained::is_var_lt(int v1, int v2) const {
}
void elim_unconstrained::eliminate() {
while (!m_heap.empty()) {
expr_ref r(m);
int v = m_heap.erase_min();
@ -86,7 +85,12 @@ void elim_unconstrained::eliminate() {
n.m_refcount = 0;
continue;
}
if (m_heap.contains(root(e))) {
IF_VERBOSE(11, verbose_stream() << "already in heap " << mk_bounded_pp(e, m) << "\n");
continue;
}
app* t = to_app(e);
TRACE("elim_unconstrained", tout << "eliminating " << mk_pp(t, m) << "\n";);
unsigned sz = m_args.size();
for (expr* arg : *to_app(t))
m_args.push_back(reconstruct_term(get_node(arg)));
@ -99,14 +103,17 @@ void elim_unconstrained::eliminate() {
proof * pr = m.mk_apply_def(s, r, pr1);
m_trail.push_back(pr);
}
expr_ref rr(m.mk_app(t->get_decl(), t->get_num_args(), m_args.data() + sz), m);
n.m_refcount = 0;
m_args.shrink(sz);
if (!inverted) {
IF_VERBOSE(11, verbose_stream() << "not inverted " << mk_bounded_pp(e, m) << "\n");
continue;
}
IF_VERBOSE(11, verbose_stream() << "replace " << mk_pp(t, m) << " / " << rr << " -> " << r << "\n");
TRACE("elim_unconstrained", tout << mk_pp(t, m) << " -> " << r << "\n");
TRACE("elim_unconstrained", tout << mk_pp(t, m) << " / " << rr << " -> " << r << "\n");
SASSERT(r->get_sort() == t->get_sort());
m_stats.m_num_eliminated++;
m_trail.push_back(r);
@ -119,7 +126,8 @@ void elim_unconstrained::eliminate() {
get_node(e).m_term = r;
get_node(e).m_proof = pr;
get_node(e).m_refcount++;
IF_VERBOSE(11, verbose_stream() << mk_bounded_pp(e, m) << "\n");
get_node(e).m_dirty = false;
IF_VERBOSE(11, verbose_stream() << "set " << &get_node(e) << " " << root(e) << " " << mk_bounded_pp(e, m) << " := " << mk_bounded_pp(r, m) << "\n");
SASSERT(!m_heap.contains(root(e)));
if (is_uninterp_const(r))
m_heap.insert(root(e));
@ -263,12 +271,18 @@ void elim_unconstrained::gc(expr* t) {
while (!todo.empty()) {
t = todo.back();
todo.pop_back();
node& n = get_node(t);
if (n.m_refcount == 0)
continue;
if (n.m_term && !is_node(n.m_term))
continue;
dec_ref(t);
if (n.m_refcount != 0)
continue;
if (n.m_term)
t = n.m_term;
if (is_app(t)) {
for (expr* arg : *to_app(t))
todo.push_back(arg);
@ -283,13 +297,22 @@ expr_ref elim_unconstrained::reconstruct_term(node& n0) {
expr* t = n0.m_term;
if (!n0.m_dirty)
return expr_ref(t, m);
if (!is_node(t))
return expr_ref(t, m);
ptr_vector<expr> todo;
todo.push_back(t);
while (!todo.empty()) {
t = todo.back();
if (!is_node(t)) {
UNREACHABLE();
}
node& n = get_node(t);
unsigned sz0 = todo.size();
if (is_app(t)) {
if (is_app(t)) {
if (n.m_term != t) {
todo.pop_back();
continue;
}
for (expr* arg : *to_app(t))
if (get_node(arg).m_dirty || !get_node(arg).m_term)
todo.push_back(arg);
@ -300,7 +323,6 @@ expr_ref elim_unconstrained::reconstruct_term(node& n0) {
for (expr* arg : *to_app(t))
m_args.push_back(get_node(arg).m_term);
n.m_term = m.mk_app(to_app(t)->get_decl(), to_app(t)->get_num_args(), m_args.data() + sz);
m_args.shrink(sz);
}
else if (is_quantifier(t)) {
@ -418,6 +440,6 @@ void elim_unconstrained::reduce() {
vector<dependent_expr> old_fmls;
assert_normalized(old_fmls);
update_model_trail(*mc, old_fmls);
mc->reset();
}
}

View file

@ -182,11 +182,11 @@ std::ostream& model_reconstruction_trail::display(std::ostream& out) const {
out << "hide " << t->m_decl->get_name() << "\n";
else if (t->is_def()) {
for (auto const& [f, def, dep] : t->m_defs)
out << f->get_name() << " <- " << mk_pp(def, m) << "\n";
out << "def: " << f->get_name() << " <- " << mk_pp(def, m) << "\n";
}
else {
for (auto const& [v, def] : t->m_subst->sub())
out << mk_pp(v, m) << " <- " << mk_pp(def, m) << "\n";
out << "sub: " << mk_pp(v, m) << " -> " << mk_pp(def, m) << "\n";
}
for (auto const& d : t->m_removed)
out << "rm: " << d << "\n";

View file

@ -0,0 +1,9 @@
z3_add_component(ast_sls
SOURCES
bvsls_opt_engine.cpp
sls_engine.cpp
COMPONENT_DEPENDENCIES
ast
converters
normal_forms
)

View file

@ -17,7 +17,7 @@ Notes:
--*/
#include "ast/normal_forms/nnf.h"
#include "tactic/sls/bvsls_opt_engine.h"
#include "ast/sls/bvsls_opt_engine.h"
bvsls_opt_engine::bvsls_opt_engine(ast_manager & m, params_ref const & p) :
sls_engine(m, p),
@ -68,7 +68,8 @@ bvsls_opt_engine::optimization_result bvsls_opt_engine::optimize(
if (is_sat != l_true) {
do {
checkpoint();
if (!m_manager.inc())
return res;
IF_VERBOSE(1, verbose_stream() << "Satisfying... restarts left:" << (m_max_restarts - m_stats.m_restarts) << std::endl;);
is_sat = search();
@ -136,7 +137,8 @@ expr_ref bvsls_opt_engine::maximize()
while (m_mpz_manager.lt(score, max_score) && check_restart(m_stats.m_moves))
{
checkpoint();
if (!m_manager.inc())
goto bailout;
m_stats.m_moves++;
m_mpz_manager.set(old_score, score);
new_const = (unsigned)-1;

View file

@ -18,7 +18,7 @@ Notes:
--*/
#pragma once
#include "tactic/sls/sls_engine.h"
#include "ast/sls/sls_engine.h"
class bvsls_opt_engine : public sls_engine {
sls_tracker & m_hard_tracker;

View file

@ -23,11 +23,10 @@ Notes:
#include "ast/ast_pp.h"
#include "ast/rewriter/var_subst.h"
#include "model/model_pp.h"
#include "tactic/tactic.h"
#include "util/luby.h"
#include "tactic/sls/sls_params.hpp"
#include "tactic/sls/sls_engine.h"
#include "params/sls_params.hpp"
#include "ast/sls/sls_engine.h"
sls_engine::sls_engine(ast_manager & m, params_ref const & p) :
@ -52,7 +51,6 @@ sls_engine::~sls_engine() {
void sls_engine::updt_params(params_ref const & _p) {
sls_params p(_p);
m_produce_models = _p.get_bool("model", false);
m_max_restarts = p.max_restarts();
m_tracker.set_random_seed(p.random_seed());
m_walksat = p.walksat();
@ -92,14 +90,12 @@ void sls_engine::collect_statistics(statistics& st) const {
st.update("sls moves/sec", m_stats.m_moves / seconds);
}
void sls_engine::checkpoint() {
tactic::checkpoint(m_manager);
}
bool sls_engine::full_eval(model & mdl) {
model::scoped_model_completion _scm(mdl, true);
for (expr* a : m_assertions) {
checkpoint();
if (!m_manager.inc())
return false;
if (!mdl.is_true(a)) {
TRACE("sls", tout << "Evaluation: false\n";);
return false;
@ -423,7 +419,8 @@ lbool sls_engine::search() {
unsigned sz = m_assertions.size();
while (check_restart(m_stats.m_moves)) {
checkpoint();
if (!m_manager.inc())
return l_undef;
m_stats.m_moves++;
// Andreas: Every base restart interval ...
@ -523,38 +520,6 @@ bailout:
return res;
}
void sls_engine::operator()(goal_ref const & g, model_converter_ref & mc) {
if (g->inconsistent()) {
mc = nullptr;
return;
}
m_produce_models = g->models_enabled();
for (unsigned i = 0; i < g->size(); i++)
assert_expr(g->form(i));
lbool res = operator()();
if (res == l_true) {
report_tactic_progress("Number of flips:", m_stats.m_moves);
for (unsigned i = 0; i < g->size(); i++)
if (!m_mpz_manager.is_one(m_tracker.get_value(g->form(i))))
{
verbose_stream() << "Terminated before all assertions were SAT!" << std::endl;
NOT_IMPLEMENTED_YET();
}
if (m_produce_models) {
model_ref mdl = m_tracker.get_model();
mc = model2model_converter(mdl.get());
TRACE("sls_model", mc->display(tout););
}
g->reset();
}
else
mc = nullptr;
}
lbool sls_engine::operator()() {
m_tracker.initialize(m_assertions);
@ -565,9 +530,10 @@ lbool sls_engine::operator()() {
lbool res = l_undef;
do {
checkpoint();
if (!m_manager.inc())
return l_undef;
report_tactic_progress("Searching... restarts left:", m_max_restarts - m_stats.m_restarts);
// report_tactic_progress("Searching... restarts left:", m_max_restarts - m_stats.m_restarts);
res = search();
if (res == l_undef)

View file

@ -21,10 +21,9 @@ Notes:
#include "util/stopwatch.h"
#include "util/lbool.h"
#include "ast/converters/model_converter.h"
#include "tactic/goal.h"
#include "tactic/sls/sls_tracker.h"
#include "tactic/sls/sls_evaluator.h"
#include "ast/sls/sls_tracker.h"
#include "ast/sls/sls_evaluator.h"
#include "util/statistics.h"
class sls_engine {
@ -62,7 +61,6 @@ protected:
unsynch_mpz_manager m_mpz_manager;
powers m_powers;
mpz m_zero, m_one, m_two;
bool m_produce_models;
bv_util m_bv_util;
sls_tracker m_tracker;
sls_evaluator m_evaluator;
@ -96,7 +94,7 @@ public:
void assert_expr(expr * e) { m_assertions.push_back(e); }
// stats const & get_stats(void) { return m_stats; }
stats const & get_stats(void) { return m_stats; }
void collect_statistics(statistics & st) const;
void reset_statistics() { m_stats.reset(); }
@ -111,10 +109,14 @@ public:
lbool search();
lbool operator()();
void operator()(goal_ref const & g, model_converter_ref & mc);
mpz & get_value(expr * n) { return m_tracker.get_value(n); }
model_ref get_model() { return m_tracker.get_model(); }
unsynch_mpz_manager& get_mpz_manager() { return m_mpz_manager; }
protected:
void checkpoint();
bool what_if(func_decl * fd, const unsigned & fd_inx, const mpz & temp,
double & best_score, unsigned & best_const, mpz & best_value);
@ -135,5 +137,7 @@ protected:
//double get_restart_armin(unsigned cnt_restarts);
unsigned check_restart(unsigned curr_value);
};

View file

@ -21,8 +21,8 @@ Notes:
#include "model/model_evaluator.h"
#include "tactic/sls/sls_powers.h"
#include "tactic/sls/sls_tracker.h"
#include "ast/sls/sls_powers.h"
#include "ast/sls/sls_tracker.h"
class sls_evaluator {
ast_manager & m_manager;

View file

@ -25,8 +25,8 @@ Notes:
#include "ast/bv_decl_plugin.h"
#include "model/model.h"
#include "tactic/sls/sls_params.hpp"
#include "tactic/sls/sls_powers.h"
#include "params/sls_params.hpp"
#include "ast/sls/sls_powers.h"
class sls_tracker {
ast_manager & m_manager;

View file

@ -70,8 +70,7 @@ struct well_sorted_proc {
strm << "Expected sort: " << mk_pp(expected_sort, m_manager) << '\n';
strm << "Actual sort: " << mk_pp(actual_sort, m_manager) << '\n';
strm << "Function sort: " << mk_pp(decl, m_manager) << '.';
auto str = strm.str();
warning_msg("%s", str.c_str());
warning_msg("%s", std::move(strm).str().c_str());
m_error = true;
return;
}

Some files were not shown because too many files have changed in this diff Show more