3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-13 12:28:44 +00:00

add parameter to enable splitting guided by length constraints

This commit is contained in:
Thai Trinh 2018-06-27 18:10:40 +08:00
parent 69f92a309f
commit 1892d31794
7 changed files with 73 additions and 6 deletions

View file

@ -26,6 +26,7 @@ Revision History:
#include "smt/params/theory_array_params.h"
#include "smt/params/theory_bv_params.h"
#include "smt/params/theory_str_params.h"
#include "smt/params/theory_seq_params.h"
#include "smt/params/theory_pb_params.h"
#include "smt/params/theory_datatype_params.h"
#include "smt/params/preprocessor_params.h"
@ -79,6 +80,7 @@ struct smt_params : public preprocessor_params,
public theory_array_params,
public theory_bv_params,
public theory_str_params,
public theory_seq_params,
public theory_pb_params,
public theory_datatype_params {
bool m_display_proof;

View file

@ -71,6 +71,7 @@ def_module_params(module_name='smt',
('theory_case_split', BOOL, False, 'Allow the context to use heuristics involving theory case splits, which are a set of literals of which exactly one can be assigned True. If this option is false, the context will generate extra axioms to enforce this instead.'),
('string_solver', SYMBOL, 'seq', 'solver for string/sequence theories. options are: \'z3str3\' (specialized string solver), \'seq\' (sequence solver), \'auto\' (use static features to choose best solver)'),
('core.validate', BOOL, False, 'validate unsat core produced by SMT context'),
('seq.split_w_len', BOOL, True, 'enable splitting guided by length constraints'),
('str.strong_arrangements', BOOL, True, 'assert equivalences instead of implications when generating string arrangement axioms'),
('str.aggressive_length_testing', BOOL, False, 'prioritize testing concrete length values over generating more options'),
('str.aggressive_value_testing', BOOL, False, 'prioritize testing concrete string constant values over generating more options'),

View file

@ -0,0 +1,23 @@
/*++
Copyright (c) 2018 Microsoft Corporation
Module Name:
theory_seq_params.cpp
Abstract:
Parameters for sequence theory plugin
Revision History:
--*/
#include "smt/params/theory_seq_params.h"
#include "smt/params/smt_params_helper.hpp"
void theory_seq_params::updt_params(params_ref const & _p) {
smt_params_helper p(_p);
m_split_w_len = p.seq_split_w_len();
}

View file

@ -0,0 +1,38 @@
/*++
Copyright (c) 2018 Microsoft Corporation
Module Name:
theory_seq_params.h
Abstract:
Parameters for sequence theory plugin
Revision History:
--*/
#ifndef THEORY_SEQ_PARAMS_H
#define THEORY_SEQ_PARAMS_H
#include "util/params.h"
struct theory_seq_params {
/*
* Enable splitting guided by length constraints
*/
bool m_split_w_len;
theory_seq_params(params_ref const & p = params_ref()):
m_split_w_len(true)
{
updt_params(p);
}
void updt_params(params_ref const & p);
};
#endif /* THEORY_SEQ_PARAMS_H */

View file

@ -222,7 +222,7 @@ namespace smt {
void setup::setup_QF_BVRE() {
setup_QF_BV();
setup_QF_LIA();
m_context.register_plugin(alloc(theory_seq, m_manager));
m_context.register_plugin(alloc(theory_seq, m_manager, m_params));
}
void setup::setup_QF_UF(static_features const & st) {
@ -895,7 +895,7 @@ namespace smt {
}
void setup::setup_seq() {
m_context.register_plugin(alloc(smt::theory_seq, m_manager));
m_context.register_plugin(alloc(smt::theory_seq, m_manager, m_params));
}
void setup::setup_unknown() {

View file

@ -191,9 +191,10 @@ void theory_seq::exclusion_table::display(std::ostream& out) const {
}
theory_seq::theory_seq(ast_manager& m):
theory_seq::theory_seq(ast_manager& m, theory_seq_params const & params):
theory(m.mk_family_id("seq")),
m(m),
m_params(params),
m_rep(m, m_dm),
m_reset_cache(false),
m_eq_id(0),
@ -273,7 +274,7 @@ final_check_status theory_seq::final_check_eh() {
TRACE("seq", tout << ">>zero_length\n";);
return FC_CONTINUE;
}
if (len_based_split()) {
if (m_params.m_split_w_len && len_based_split()) {
++m_stats.m_branch_variable;
TRACE("seq", tout << ">>split_based_on_length\n";);
return FC_CONTINUE;

View file

@ -49,6 +49,8 @@ namespace smt {
typedef union_find<theory_seq> th_union_find;
class seq_value_proc;
theory_seq_params const & m_params;
// cache to track evaluations under equalities
class eval_cache {
@ -361,7 +363,7 @@ namespace smt {
void pop_scope_eh(unsigned num_scopes) override;
void restart_eh() override;
void relevant_eh(app* n) override;
theory* mk_fresh(context* new_ctx) override { return alloc(theory_seq, new_ctx->get_manager()); }
theory* mk_fresh(context* new_ctx) override { return alloc(theory_seq, new_ctx->get_manager(), m_params); }
char const * get_name() const override { return "seq"; }
theory_var mk_var(enode* n) override;
void apply_sort_cnstr(enode* n, sort* s) override;
@ -621,7 +623,7 @@ namespace smt {
void display_deps(std::ostream& out, literal_vector const& lits, enode_pair_vector const& eqs) const;
void display_nc(std::ostream& out, nc const& nc) const;
public:
theory_seq(ast_manager& m);
theory_seq(ast_manager& m, theory_seq_params const & params);
~theory_seq() override;
// model building