3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-04 14:25:46 +00:00

add fd solver for finite domain queries

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2016-10-18 22:34:34 -04:00
parent 948a1e600e
commit d060359f01
16 changed files with 676 additions and 204 deletions

View file

@ -21,8 +21,10 @@ Revision History:
#include"array_decl_plugin.h"
#include"bv_decl_plugin.h"
#include"seq_decl_plugin.h"
#include"datatype_decl_plugin.h"
#include"ast_pp.h"
#include"for_each_expr.h"
#include<strstream>
struct check_logic::imp {
ast_manager & m;
@ -31,6 +33,7 @@ struct check_logic::imp {
bv_util m_bv_util;
array_util m_ar_util;
seq_util m_seq_util;
datatype_util m_dt_util;
bool m_uf; // true if the logic supports uninterpreted functions
bool m_arrays; // true if the logic supports arbitrary arrays
bool m_bv_arrays; // true if the logic supports only bv arrays
@ -42,7 +45,7 @@ struct check_logic::imp {
bool m_quantifiers; // true if the logic supports quantifiers
bool m_unknown_logic;
imp(ast_manager & _m):m(_m), m_a_util(m), m_bv_util(m), m_ar_util(m), m_seq_util(m) {
imp(ast_manager & _m):m(_m), m_a_util(m), m_bv_util(m), m_ar_util(m), m_seq_util(m), m_dt_util(m) {
reset();
}
@ -178,6 +181,11 @@ struct check_logic::imp {
m_reals = true;
m_quantifiers = false;
}
else if (logic == "QF_FD") {
m_bvs = true;
m_uf = true;
m_ints = true;
}
else {
m_unknown_logic = true;
}
@ -432,8 +440,13 @@ struct check_logic::imp {
else if (fid == m_seq_util.get_family_id()) {
// nothing to check
}
else if (fid == m_dt_util.get_family_id() && m_logic == "QF_FD") {
// nothing to check
}
else {
fail("logic does not support theory");
std::stringstream strm;
strm << "logic does not support theory " << m.get_family_name(fid);
fail(strm.str().c_str());
}
}

View file

@ -568,6 +568,7 @@ bool cmd_context::logic_has_bv_core(symbol const & s) const {
s == "QF_FPBV" ||
s == "QF_BVFP" ||
s == "ALL" ||
s == "QF_FD" ||
s == "HORN";
}
@ -622,7 +623,7 @@ bool cmd_context::logic_has_array() const {
}
bool cmd_context::logic_has_datatype() const {
return !has_logic();
return !has_logic() || m_logic == "QF_FD";
}
void cmd_context::init_manager_core(bool new_manager) {
@ -705,7 +706,7 @@ void cmd_context::init_external_manager() {
}
bool cmd_context::supported_logic(symbol const & s) const {
return s == "QF_UF" || s == "UF" || s == "ALL" ||
return s == "QF_UF" || s == "UF" || s == "ALL" || s == "QF_FD" ||
logic_has_arith_core(s) || logic_has_bv_core(s) ||
logic_has_array_core(s) || logic_has_seq_core(s) ||
logic_has_horn(s) || logic_has_fpa_core(s);