mirror of
https://github.com/Z3Prover/z3
synced 2025-08-15 23:35:26 +00:00
merge with master branch
Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
commit
651587ce01
1602 changed files with 40496 additions and 27837 deletions
|
@ -16,10 +16,10 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"aig.h"
|
||||
#include"goal.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"cooperate.h"
|
||||
#include "tactic/aig/aig.h"
|
||||
#include "tactic/goal.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "util/cooperate.h"
|
||||
|
||||
#define USE_TWO_LEVEL_RULES
|
||||
#define FIRST_NODE_ID (UINT_MAX/2)
|
||||
|
|
|
@ -19,8 +19,8 @@ Notes:
|
|||
#ifndef AIG_H_
|
||||
#define AIG_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"tactic_exception.h"
|
||||
#include "ast/ast.h"
|
||||
#include "tactic/tactic_exception.h"
|
||||
|
||||
class goal;
|
||||
class aig_lit;
|
||||
|
|
|
@ -16,8 +16,8 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"aig.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/aig/aig.h"
|
||||
|
||||
class aig_manager;
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef AIG_TACTIC_H_
|
||||
#define AIG_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class tactic;
|
||||
|
||||
tactic * mk_aig_tactic(params_ref const & p = params_ref());
|
||||
|
|
|
@ -16,10 +16,10 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"bound_manager.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
|
||||
struct is_unbounded_proc {
|
||||
struct found {};
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef ADD_BOUNDS_H_
|
||||
#define ADD_BOUNDS_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
|
||||
class ast_manager;
|
||||
class goal;
|
||||
|
|
|
@ -6,8 +6,8 @@ Copyright (c) 2015 Microsoft Corporation
|
|||
|
||||
|
||||
|
||||
#include"arith_bounds_tactic.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include "tactic/arith/arith_bounds_tactic.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
struct arith_bounds_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ Notes:
|
|||
--*/
|
||||
#ifndef ARITH_BOUNDS_TACTIC_H_
|
||||
#define ARITH_BOUNDS_TACTIC_H_
|
||||
#include "tactic.h"
|
||||
#include "tactic/tactic.h"
|
||||
|
||||
tactic * mk_arith_bounds_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"bound_manager.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"goal.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "tactic/goal.h"
|
||||
|
||||
bound_manager::bound_manager(ast_manager & m):
|
||||
m_util(m) {
|
||||
|
|
|
@ -19,8 +19,8 @@ Notes:
|
|||
#ifndef BOUND_MANAGER_H_
|
||||
#define BOUND_MANAGER_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
class goal;
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"bound_propagator.h"
|
||||
#include "tactic/arith/bound_propagator.h"
|
||||
#include<cmath>
|
||||
|
||||
// -------------------------------
|
||||
|
|
|
@ -20,12 +20,12 @@ Revision History:
|
|||
#ifndef BOUND_PROPAGATOR_H_
|
||||
#define BOUND_PROPAGATOR_H_
|
||||
|
||||
#include"mpq.h"
|
||||
#include"vector.h"
|
||||
#include"params.h"
|
||||
#include"statistics.h"
|
||||
#include"numeral_buffer.h"
|
||||
#include"linear_equation.h"
|
||||
#include "util/mpq.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/params.h"
|
||||
#include "util/statistics.h"
|
||||
#include "util/numeral_buffer.h"
|
||||
#include "tactic/arith/linear_equation.h"
|
||||
|
||||
class bound_propagator {
|
||||
public:
|
||||
|
|
|
@ -16,10 +16,10 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include "bv2int_rewriter.h"
|
||||
#include "rewriter_def.h"
|
||||
#include "ast_pp.h"
|
||||
#include "ast_util.h"
|
||||
#include "tactic/arith/bv2int_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/ast_util.h"
|
||||
|
||||
void bv2int_rewriter_ctx::update_params(params_ref const& p) {
|
||||
m_max_size = p.get_uint("max_bv_size", UINT_MAX);
|
||||
|
|
|
@ -19,12 +19,12 @@ Notes:
|
|||
#ifndef BV2INT_REWRITER_H_
|
||||
#define BV2INT_REWRITER_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"rewriter.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"params.h"
|
||||
#include"goal.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "util/params.h"
|
||||
#include "tactic/goal.h"
|
||||
|
||||
class bv2int_rewriter_ctx {
|
||||
unsigned m_max_size;
|
||||
|
|
|
@ -16,10 +16,10 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"bv2real_rewriter.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"ast_pp.h"
|
||||
#include"for_each_expr.h"
|
||||
#include "tactic/arith/bv2real_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
|
||||
|
||||
bv2real_util::bv2real_util(ast_manager& m, rational const& default_root, rational const& default_divisor, unsigned max_num_bits) :
|
||||
|
|
|
@ -19,10 +19,10 @@ Notes:
|
|||
#ifndef BV2REAL_REWRITER_H_
|
||||
#define BV2REAL_REWRITER_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"rewriter.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
|
||||
//
|
||||
// bv2real[d,r](n,m) has interpretation:
|
||||
|
|
|
@ -16,14 +16,14 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cooperate.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"card2bv_tactic.h"
|
||||
#include"pb2bv_rewriter.h"
|
||||
#include"ast_util.h"
|
||||
#include"ast_pp.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "tactic/arith/card2bv_tactic.h"
|
||||
#include "ast/rewriter/pb2bv_rewriter.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
|
||||
class card2bv_tactic : public tactic {
|
||||
ast_manager & m;
|
||||
|
|
|
@ -19,12 +19,12 @@ Notes:
|
|||
#ifndef CARD2BV_TACTIC_H_
|
||||
#define CARD2BV_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include"pb_decl_plugin.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"rewriter.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/pb_decl_plugin.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include<typeinfo>
|
||||
#include"sorting_network.h"
|
||||
#include "util/sorting_network.h"
|
||||
|
||||
|
||||
class ast_manager;
|
||||
|
|
|
@ -19,14 +19,14 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"cooperate.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"rewriter_def.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
|
||||
class degree_shift_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -22,7 +22,7 @@ Revision History:
|
|||
#ifndef DEGREE_SHIFT_TACTIC_H_
|
||||
#define DEGREE_SHIFT_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -20,10 +20,10 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"model.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "model/model.h"
|
||||
|
||||
class diff_neq_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -23,7 +23,7 @@ Revision History:
|
|||
#ifndef DIFF_NEQ_TACTIC_H_
|
||||
#define DIFF_NEQ_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cooperate.h"
|
||||
#include"bound_manager.h"
|
||||
#include"ast_pp.h"
|
||||
#include"expr_safe_replace.h" // NB: should use proof-producing expr_substitute in polished version.
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"elim01_tactic.h"
|
||||
#include"model_smt2_pp.h"
|
||||
#include"th_rewriter.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/rewriter/expr_safe_replace.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/arith/elim01_tactic.h"
|
||||
#include "model/model_smt2_pp.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
|
||||
class bool2int_model_converter : public model_converter {
|
||||
ast_manager& m;
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef ELIM01_TACTIC_H_
|
||||
#define ELIM01_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -17,15 +17,15 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cooperate.h"
|
||||
#include"bound_manager.h"
|
||||
#include"ast_pp.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"ast_util.h"
|
||||
#include"ast_pp_util.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp_util.h"
|
||||
|
||||
class eq2bv_tactic : public tactic {
|
||||
struct eq_rewriter_cfg : public default_rewriter_cfg {
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef EQ2BV_TACTIC_H_
|
||||
#define EQ2BV_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"expr2polynomial.h"
|
||||
#include"rewriter_def.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/expr2polynomial.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
|
||||
class factor_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef FACTOR_TACTIC_H_
|
||||
#define FACTOR_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"expr_substitution.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class fix_dl_var_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ Notes:
|
|||
#ifndef FIX_DL_VAR_TACTIC_H_
|
||||
#define FIX_DL_VAR_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -21,17 +21,17 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"fm_tactic.h"
|
||||
#include"tactical.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"cooperate.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ast_pp.h"
|
||||
#include"id_gen.h"
|
||||
#include"model_evaluator.h"
|
||||
#include"model_v2_pp.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include "tactic/arith/fm_tactic.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "util/id_gen.h"
|
||||
#include "model/model_evaluator.h"
|
||||
#include "model/model_v2_pp.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
|
||||
class fm_tactic : public tactic {
|
||||
typedef ptr_vector<app> clauses;
|
||||
|
|
|
@ -24,7 +24,7 @@ Revision History:
|
|||
#ifndef FM_TACTIC_H_
|
||||
#define FM_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -34,15 +34,15 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cooperate.h"
|
||||
#include"bound_manager.h"
|
||||
#include"ast_pp.h"
|
||||
#include"pb_decl_plugin.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"ast_util.h"
|
||||
#include"ast_pp_util.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "ast/pb_decl_plugin.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp_util.h"
|
||||
|
||||
class lia2card_tactic : public tactic {
|
||||
struct lia_rewriter_cfg : public default_rewriter_cfg {
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef LIA2CARD_TACTIC_H_
|
||||
#define LIA2CARD_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bound_manager.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"expr_substitution.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class lia2pb_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef LIA2PB_TACTIC_H_
|
||||
#define LIA2PB_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"linear_equation.h"
|
||||
#include "tactic/arith/linear_equation.h"
|
||||
|
||||
/**
|
||||
\brief Return the position of variable x_i in the linear equation.
|
||||
|
|
|
@ -21,10 +21,10 @@ Revision History:
|
|||
#ifndef LINEAR_EQUATION_H_
|
||||
#define LINEAR_EQUATION_H_
|
||||
|
||||
#include"mpq.h"
|
||||
#include"small_object_allocator.h"
|
||||
#include"numeral_buffer.h"
|
||||
#include"double_manager.h"
|
||||
#include "util/mpq.h"
|
||||
#include "util/small_object_allocator.h"
|
||||
#include "util/numeral_buffer.h"
|
||||
#include "util/double_manager.h"
|
||||
|
||||
class linear_equation {
|
||||
public:
|
||||
|
|
|
@ -18,19 +18,19 @@ Notes:
|
|||
The original file was called qfnla2bv.cpp
|
||||
|
||||
--*/
|
||||
#include "tactical.h"
|
||||
#include "arith_decl_plugin.h"
|
||||
#include "bv_decl_plugin.h"
|
||||
#include "for_each_expr.h"
|
||||
#include "expr_replacer.h"
|
||||
#include "optional.h"
|
||||
#include "bv2int_rewriter.h"
|
||||
#include "bv2real_rewriter.h"
|
||||
#include "extension_model_converter.h"
|
||||
#include "filter_model_converter.h"
|
||||
#include "bound_manager.h"
|
||||
#include "obj_pair_hashtable.h"
|
||||
#include "ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/rewriter/expr_replacer.h"
|
||||
#include "util/optional.h"
|
||||
#include "tactic/arith/bv2int_rewriter.h"
|
||||
#include "tactic/arith/bv2real_rewriter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "util/obj_pair_hashtable.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
//
|
||||
//
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef NLA2BV_TACTIC_H_
|
||||
#define NLA2BV_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bound_manager.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"expr_substitution.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class normalize_bounds_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -21,7 +21,7 @@ Revision History:
|
|||
#ifndef NORMALIZE_BOUNDS_TACTIC_H_
|
||||
#define NORMALIZE_BOUNDS_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"trace.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"model_v2_pp.h"
|
||||
#include"pb2bv_model_converter.h"
|
||||
#include "util/trace.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "model/model_v2_pp.h"
|
||||
#include "tactic/arith/pb2bv_model_converter.h"
|
||||
|
||||
pb2bv_model_converter::pb2bv_model_converter(ast_manager & _m) : m(_m) {
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ Notes:
|
|||
#ifndef PB2BV_MODEL_CONVERTER_H_
|
||||
#define PB2BV_MODEL_CONVERTER_H_
|
||||
|
||||
#include"model_converter.h"
|
||||
#include"bound_manager.h"
|
||||
#include "tactic/model_converter.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
|
||||
class pb2bv_model_converter : public model_converter {
|
||||
typedef std::pair<func_decl *, func_decl *> func_decl_pair;
|
||||
|
|
|
@ -16,20 +16,20 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cooperate.h"
|
||||
#include"bound_manager.h"
|
||||
#include"bool_rewriter.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"ref_util.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"trace.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"expr_substitution.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"pb2bv_model_converter.h"
|
||||
#include"pb2bv_tactic.h"
|
||||
#include"ast_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "tactic/arith/bound_manager.h"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "util/ref_util.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "util/trace.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/arith/pb2bv_model_converter.h"
|
||||
#include "tactic/arith/pb2bv_tactic.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
class pb2bv_tactic : public tactic {
|
||||
public:
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef PB2BV_TACTIC_H_
|
||||
#define PB2BV_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"probe.h"
|
||||
#include"expr2polynomial.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"goal_util.h"
|
||||
#include "tactic/probe.h"
|
||||
#include "ast/expr2polynomial.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/goal_util.h"
|
||||
|
||||
class arith_degree_probe : public probe {
|
||||
struct proc {
|
||||
|
|
|
@ -30,11 +30,11 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bound_propagator.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/arith/bound_propagator.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class propagate_ineqs_tactic : public tactic {
|
||||
struct imp;
|
||||
|
|
|
@ -33,7 +33,7 @@ Notes:
|
|||
#ifndef PROPAGATE_INEQS_TACTIC_H_
|
||||
#define PROPAGATE_INEQS_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -20,17 +20,17 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"algebraic_numbers.h"
|
||||
#include"nnf_tactic.h"
|
||||
#include"simplify_tactic.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"expr_replacer.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "math/polynomial/algebraic_numbers.h"
|
||||
#include "tactic/core/nnf_tactic.h"
|
||||
#include "tactic/core/simplify_tactic.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/rewriter/expr_replacer.h"
|
||||
|
||||
/*
|
||||
----
|
||||
|
@ -297,11 +297,11 @@ struct purify_arith_proc {
|
|||
push_cnstr(OR(EQ(y, mk_real_zero()),
|
||||
EQ(u().mk_mul(y, k), x)));
|
||||
push_cnstr_pr(result_pr);
|
||||
|
||||
if (complete()) {
|
||||
rational r;
|
||||
if (complete() && (!u().is_numeral(y, r) || r.is_zero())) {
|
||||
// y != 0 \/ k = div-0(x)
|
||||
push_cnstr(OR(NOT(EQ(y, mk_real_zero())),
|
||||
EQ(k, u().mk_div0(x))));
|
||||
EQ(k, u().mk_div(x, mk_real_zero()))));
|
||||
push_cnstr_pr(result_pr);
|
||||
}
|
||||
}
|
||||
|
@ -348,11 +348,12 @@ struct purify_arith_proc {
|
|||
push_cnstr(OR(u().mk_ge(y, zero), u().mk_lt(k2, u().mk_mul(u().mk_numeral(rational(-1), true), y))));
|
||||
push_cnstr_pr(mod_pr);
|
||||
|
||||
if (complete()) {
|
||||
push_cnstr(OR(NOT(EQ(y, zero)), EQ(k1, u().mk_idiv0(x))));
|
||||
rational r;
|
||||
if (complete() && (!u().is_numeral(y, r) || r.is_zero())) {
|
||||
push_cnstr(OR(NOT(EQ(y, zero)), EQ(k1, u().mk_idiv(x, zero))));
|
||||
push_cnstr_pr(result_pr);
|
||||
|
||||
push_cnstr(OR(NOT(EQ(y, zero)), EQ(k2, u().mk_mod0(x))));
|
||||
push_cnstr(OR(NOT(EQ(y, zero)), EQ(k2, u().mk_mod(x, zero))));
|
||||
push_cnstr_pr(mod_pr);
|
||||
}
|
||||
}
|
||||
|
@ -414,7 +415,7 @@ struct purify_arith_proc {
|
|||
// (^ x 0) --> k | x != 0 implies k = 1, x = 0 implies k = 0^0
|
||||
push_cnstr(OR(EQ(x, zero), EQ(k, one)));
|
||||
push_cnstr_pr(result_pr);
|
||||
push_cnstr(OR(NOT(EQ(x, zero)), EQ(k, is_int ? u().mk_0_pw_0_int() : u().mk_0_pw_0_real())));
|
||||
push_cnstr(OR(NOT(EQ(x, zero)), EQ(k, u().mk_power(zero, zero))));
|
||||
push_cnstr_pr(result_pr);
|
||||
}
|
||||
else if (!is_int) {
|
||||
|
|
|
@ -48,7 +48,7 @@ Revision History:
|
|||
#ifndef PURIFY_ARITH_TACTIC_H_
|
||||
#define PURIFY_ARITH_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"th_rewriter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"expr_substitution.h"
|
||||
#include"dec_ref_util.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class recover_01_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -33,7 +33,7 @@ Revision History:
|
|||
#ifndef RECOVER_01_TACTIC_H_
|
||||
#define RECOVER_01_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"model.h"
|
||||
#include"model_pp.h"
|
||||
#include"model_converter.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "model/model.h"
|
||||
#include "model/model_pp.h"
|
||||
#include "tactic/model_converter.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
/**
|
||||
If TO_BOOL == true, then bit-vectors of size n were blasted into n-tuples of Booleans.
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef BIT_BLASTER_MODEL_CONVERTER_H_
|
||||
#define BIT_BLASTER_MODEL_CONVERTER_H_
|
||||
|
||||
#include"model_converter.h"
|
||||
#include "tactic/model_converter.h"
|
||||
|
||||
model_converter * mk_bit_blaster_model_converter(ast_manager & m, obj_map<func_decl, expr*> const & const2bits);
|
||||
model_converter * mk_bv1_blaster_model_converter(ast_manager & m, obj_map<func_decl, expr*> const & const2bits);
|
||||
|
|
|
@ -16,12 +16,12 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bit_blaster_model_converter.h"
|
||||
#include"bit_blaster_rewriter.h"
|
||||
#include"ast_pp.h"
|
||||
#include"model_pp.h"
|
||||
#include"rewriter_types.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/bv/bit_blaster_model_converter.h"
|
||||
#include "ast/rewriter/bit_blaster/bit_blaster_rewriter.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "model/model_pp.h"
|
||||
#include "ast/rewriter/rewriter_types.h"
|
||||
|
||||
class bit_blaster_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@ Copyright (c) 2011 Microsoft Corporation
|
|||
#ifndef BIT_BLASTER_TACTIC_H_
|
||||
#define BIT_BLASTER_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include"bit_blaster_rewriter.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/rewriter/bit_blaster/bit_blaster_rewriter.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -22,13 +22,13 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bit_blaster_model_converter.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"cooperate.h"
|
||||
#include"bv_rewriter.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/bv/bit_blaster_model_converter.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/rewriter/bv_rewriter.h"
|
||||
|
||||
class bv1_blaster_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ Notes:
|
|||
#ifndef BV1_BLASTER_TACTIC_H_
|
||||
#define BV1_BLASTER_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
|
||||
Revision History:
|
||||
--*/
|
||||
#include"bv_bound_chk_tactic.h"
|
||||
#include"ast.h"
|
||||
#include"rewriter.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"bv_bounds.h"
|
||||
#include"rewriter_params.hpp"
|
||||
#include"bool_rewriter.h"
|
||||
#include"cooperate.h"
|
||||
#include "tactic/bv/bv_bound_chk_tactic.h"
|
||||
#include "ast/ast.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/rewriter/bv_bounds.h"
|
||||
#include "ast/rewriter/rewriter_params.hpp"
|
||||
#include "ast/rewriter/bool_rewriter.h"
|
||||
#include "util/cooperate.h"
|
||||
|
||||
struct bv_bound_chk_stats {
|
||||
unsigned m_unsats;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
#ifndef BV_BOUND_CHK_TACTIC_H_
|
||||
#define BV_BOUND_CHK_TACTIC_H_
|
||||
|
||||
#include"tactical.h"
|
||||
#include"params.h"
|
||||
#include"ast.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/ast.h"
|
||||
|
||||
tactic* mk_bv_bound_chk_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
|
|
|
@ -16,10 +16,10 @@ Author:
|
|||
|
||||
--*/
|
||||
|
||||
#include "bv_bounds_tactic.h"
|
||||
#include "ctx_simplify_tactic.h"
|
||||
#include "bv_decl_plugin.h"
|
||||
#include "ast_pp.h"
|
||||
#include "tactic/bv/bv_bounds_tactic.h"
|
||||
#include "tactic/core/ctx_simplify_tactic.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include <climits>
|
||||
|
||||
static uint64 uMaxInt(unsigned sz) {
|
||||
|
|
|
@ -17,7 +17,7 @@ Author:
|
|||
--*/
|
||||
#ifndef BV_BOUNDS_TACTIC_H_
|
||||
#define BV_BOUNDS_TACTIC_H_
|
||||
#include "tactic.h"
|
||||
#include "tactic/tactic.h"
|
||||
|
||||
tactic * mk_bv_bounds_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
|
|
|
@ -21,12 +21,12 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"expr_replacer.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/expr_replacer.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
class bv_size_reduction_tactic : public tactic {
|
||||
struct imp;
|
||||
|
|
|
@ -24,7 +24,7 @@ Notes:
|
|||
#ifndef BV_SIZE_REDUCTION_TACTIC_H_
|
||||
#define BV_SIZE_REDUCTION_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -18,14 +18,14 @@ Notes:
|
|||
|
||||
--*/
|
||||
|
||||
#include"cooperate.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"params.h"
|
||||
#include"ast_pp.h"
|
||||
#include"bvarray2uf_rewriter.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"ref_util.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "tactic/bv/bvarray2uf_rewriter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "util/ref_util.h"
|
||||
|
||||
// [1] C. M. Wintersteiger, Y. Hamadi, and L. de Moura: Efficiently Solving
|
||||
// Quantified Bit-Vector Formulas, in Formal Methods in System Design,
|
||||
|
|
|
@ -20,9 +20,9 @@ Notes:
|
|||
#ifndef BVARRAY2UF_REWRITER_H_
|
||||
#define BVARRAY2UF_REWRITER_H_
|
||||
|
||||
#include"rewriter.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include "ast/rewriter/rewriter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
|
||||
class bvarray2uf_rewriter_cfg : public default_rewriter_cfg {
|
||||
ast_manager & m_manager;
|
||||
|
|
|
@ -17,15 +17,15 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"expr_replacer.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/expr_replacer.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
|
||||
#include"bvarray2uf_tactic.h"
|
||||
#include"bvarray2uf_rewriter.h"
|
||||
#include "tactic/bv/bvarray2uf_tactic.h"
|
||||
#include "tactic/bv/bvarray2uf_rewriter.h"
|
||||
|
||||
class bvarray2uf_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef BV_ARRAY2UF_TACTIC_H_
|
||||
#define BV_ARRAY2UF_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -19,18 +19,18 @@ Revision History:
|
|||
|
||||
--*/
|
||||
|
||||
#include "dt2bv_tactic.h"
|
||||
#include "tactical.h"
|
||||
#include "filter_model_converter.h"
|
||||
#include "datatype_decl_plugin.h"
|
||||
#include "bv_decl_plugin.h"
|
||||
#include "rewriter_def.h"
|
||||
#include "filter_model_converter.h"
|
||||
#include "extension_model_converter.h"
|
||||
#include "var_subst.h"
|
||||
#include "ast_util.h"
|
||||
#include "enum2bv_rewriter.h"
|
||||
#include "ast_pp.h"
|
||||
#include "tactic/bv/dt2bv_tactic.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "ast/rewriter/var_subst.h"
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/rewriter/enum2bv_rewriter.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
|
||||
class dt2bv_tactic : public tactic {
|
||||
|
|
|
@ -19,8 +19,8 @@ Revision History:
|
|||
#ifndef DT2BV_TACTIC_H_
|
||||
#define DT2BV_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include"obj_hashtable.h"
|
||||
#include "util/params.h"
|
||||
#include "util/obj_hashtable.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,19 +16,17 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"cooperate.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"used_vars.h"
|
||||
#include"well_sorted.h"
|
||||
#include"var_subst.h"
|
||||
#include"simplifier.h"
|
||||
#include"basic_simplifier_plugin.h"
|
||||
#include"bv_simplifier_plugin.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/used_vars.h"
|
||||
#include "ast/well_sorted.h"
|
||||
#include "ast/rewriter/var_subst.h"
|
||||
#include "ast/rewriter/th_rewriter.h"
|
||||
|
||||
#include"elim_small_bv_tactic.h"
|
||||
#include "tactic/bv/elim_small_bv_tactic.h"
|
||||
|
||||
class elim_small_bv_tactic : public tactic {
|
||||
|
||||
|
@ -36,7 +34,7 @@ class elim_small_bv_tactic : public tactic {
|
|||
ast_manager & m;
|
||||
params_ref m_params;
|
||||
bv_util m_util;
|
||||
simplifier m_simp;
|
||||
th_rewriter m_simp;
|
||||
ref<filter_model_converter> m_mc;
|
||||
goal * m_goal;
|
||||
unsigned m_max_bits;
|
||||
|
@ -56,14 +54,6 @@ class elim_small_bv_tactic : public tactic {
|
|||
updt_params(p);
|
||||
m_goal = 0;
|
||||
m_max_steps = UINT_MAX;
|
||||
|
||||
basic_simplifier_plugin * bsimp = alloc(basic_simplifier_plugin, m);
|
||||
// bsimp->set_eliminate_and(true);
|
||||
m_simp.register_plugin(bsimp);
|
||||
|
||||
bv_simplifier_params bv_params;
|
||||
bv_simplifier_plugin * bvsimp = alloc(bv_simplifier_plugin, m, *bsimp, bv_params);
|
||||
m_simp.register_plugin(bvsimp);
|
||||
}
|
||||
|
||||
bool max_steps_exceeded(unsigned long long num_steps) const {
|
||||
|
@ -307,9 +297,8 @@ public:
|
|||
|
||||
virtual void cleanup() {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
m_imp->~imp();
|
||||
m_imp = new (m_imp) imp(m, m_params);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -19,7 +19,7 @@ Revision History:
|
|||
#ifndef ELIM_SMALL_BV_H_
|
||||
#define ELIM_SMALL_BV_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"obj_pair_hashtable.h"
|
||||
#include"ast_lt.h"
|
||||
#include"cooperate.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "util/obj_pair_hashtable.h"
|
||||
#include "ast/ast_lt.h"
|
||||
#include "util/cooperate.h"
|
||||
|
||||
class max_bv_sharing_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ Revision History:
|
|||
#ifndef MAX_BV_SHARING_TACTIC_H_
|
||||
#define MAX_BV_SHARING_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@ Notes:
|
|||
#ifndef CONVERTER_H_
|
||||
#define CONVERTER_H_
|
||||
|
||||
#include"vector.h"
|
||||
#include"ref.h"
|
||||
#include"ast_translation.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/ref.h"
|
||||
#include "ast/ast_translation.h"
|
||||
|
||||
class converter {
|
||||
unsigned m_ref_count;
|
||||
|
|
|
@ -9,6 +9,7 @@ z3_add_component(core_tactics
|
|||
distribute_forall_tactic.cpp
|
||||
elim_term_ite_tactic.cpp
|
||||
elim_uncnstr_tactic.cpp
|
||||
injectivity_tactic.cpp
|
||||
nnf_tactic.cpp
|
||||
occf_tactic.cpp
|
||||
pb_preprocess_tactic.cpp
|
||||
|
@ -22,6 +23,7 @@ z3_add_component(core_tactics
|
|||
collect_occs.cpp
|
||||
COMPONENT_DEPENDENCIES
|
||||
normal_forms
|
||||
rewriter
|
||||
tactic
|
||||
TACTIC_HEADERS
|
||||
blast_term_ite_tactic.h
|
||||
|
@ -32,6 +34,7 @@ z3_add_component(core_tactics
|
|||
distribute_forall_tactic.h
|
||||
elim_term_ite_tactic.h
|
||||
elim_uncnstr_tactic.h
|
||||
injectivity_tactic.h
|
||||
nnf_tactic.h
|
||||
occf_tactic.h
|
||||
pb_preprocess_tactic.h
|
||||
|
|
|
@ -16,12 +16,12 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"defined_names.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"cooperate.h"
|
||||
#include"scoped_proof.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/normal_forms/defined_names.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/scoped_proof.h"
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ Notes:
|
|||
#ifndef BLAST_TERM_ITE_TACTIC_H_
|
||||
#define BLAST_TERM_ITE_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,14 +16,14 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"cofactor_elim_term_ite.h"
|
||||
#include"mk_simplified_app.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"cooperate.h"
|
||||
#include"for_each_expr.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"tactic.h"
|
||||
#include "tactic/core/cofactor_elim_term_ite.h"
|
||||
#include "ast/rewriter/mk_simplified_app.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/for_each_expr.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "tactic/tactic.h"
|
||||
|
||||
struct cofactor_elim_term_ite::imp {
|
||||
ast_manager & m;
|
||||
|
|
|
@ -19,8 +19,8 @@ Revision History:
|
|||
#ifndef COFACTOR_ELIM_TERM_ITE_H_
|
||||
#define COFACTOR_ELIM_TERM_ITE_H_
|
||||
|
||||
#include"ast.h"
|
||||
#include"params.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/params.h"
|
||||
|
||||
class cofactor_elim_term_ite {
|
||||
struct imp;
|
||||
|
|
|
@ -17,8 +17,8 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"cofactor_elim_term_ite.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/core/cofactor_elim_term_ite.h"
|
||||
|
||||
/**
|
||||
\brief Wrapper for applying cofactor_elim_term_ite in an assertion set.
|
||||
|
|
|
@ -20,7 +20,7 @@ Revision History:
|
|||
#ifndef COFACTOR_TERM_ITE_TACTIC_H_
|
||||
#define COFACTOR_TERM_ITE_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -17,10 +17,10 @@ Notes:
|
|||
|
||||
--*/
|
||||
|
||||
#include "ast.h"
|
||||
#include "goal.h"
|
||||
#include "hashtable.h"
|
||||
#include "collect_occs.h"
|
||||
#include "ast/ast.h"
|
||||
#include "tactic/goal.h"
|
||||
#include "util/hashtable.h"
|
||||
#include "tactic/core/collect_occs.h"
|
||||
|
||||
bool collect_occs::visit(expr * t) {
|
||||
if (m_visited.is_marked(t)) {
|
||||
|
|
|
@ -20,17 +20,17 @@ Notes:
|
|||
#include<string>
|
||||
#include<map>
|
||||
|
||||
#include"ast.h"
|
||||
#include"params.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"fpa_decl_plugin.h"
|
||||
#include"tactical.h"
|
||||
#include"stats.h"
|
||||
#include "ast/ast.h"
|
||||
#include "util/params.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "ast/fpa_decl_plugin.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "util/stats.h"
|
||||
|
||||
#include"collect_statistics_tactic.h"
|
||||
#include "tactic/core/collect_statistics_tactic.h"
|
||||
|
||||
class collect_statistics_tactic : public tactic {
|
||||
ast_manager & m;
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef COLLECT_STATISTICS_H_
|
||||
#define COLLECT_STATISTICS_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"ctx_simplify_tactic.h"
|
||||
#include"mk_simplified_app.h"
|
||||
#include"cooperate.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include"ast_pp.h"
|
||||
#include "tactic/core/ctx_simplify_tactic.h"
|
||||
#include "ast/rewriter/mk_simplified_app.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
#include "ast/ast_pp.h"
|
||||
|
||||
|
||||
class ctx_propagate_assertions : public ctx_simplify_tactic::simplifier {
|
||||
|
|
|
@ -19,8 +19,8 @@ Notes:
|
|||
#ifndef CTX_SIMPLIFY_TACTIC_H_
|
||||
#define CTX_SIMPLIFY_TACTIC_H_
|
||||
|
||||
#include"tactical.h"
|
||||
#include"goal_num_occurs.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/goal_num_occurs.h"
|
||||
|
||||
class ctx_simplify_tactic : public tactic {
|
||||
public:
|
||||
|
|
|
@ -14,8 +14,8 @@ Author:
|
|||
Leonardo de Moura (leonardo) 2012-10-20
|
||||
|
||||
--*/
|
||||
#include"der.h"
|
||||
#include"tactical.h"
|
||||
#include "ast/rewriter/der.h"
|
||||
#include "tactic/tactical.h"
|
||||
|
||||
class der_tactic : public tactic {
|
||||
struct imp {
|
||||
|
|
|
@ -14,9 +14,9 @@ Author:
|
|||
Leonardo de Moura (leonardo) 2012-02-18.
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"var_subst.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/rewriter/var_subst.h"
|
||||
|
||||
class distribute_forall_tactic : public tactic {
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ Author:
|
|||
#ifndef DISTRIBUTE_FORALL_TACTIC_H_
|
||||
#define DISTRIBUTE_FORALL_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
442
src/tactic/core/dom_simplify_tactic.cpp
Normal file
442
src/tactic/core/dom_simplify_tactic.cpp
Normal file
|
@ -0,0 +1,442 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
dom_simplify_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Dominator-based context simplifer.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj and Nuno
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
|
||||
#include "ast/ast_util.h"
|
||||
#include "ast/ast_pp.h"
|
||||
#include "tactic/core/dom_simplify_tactic.h"
|
||||
|
||||
|
||||
/**
|
||||
\brief compute a post-order traversal for e.
|
||||
Also populate the set of parents
|
||||
*/
|
||||
void expr_dominators::compute_post_order() {
|
||||
unsigned post_num = 0;
|
||||
SASSERT(m_post2expr.empty());
|
||||
SASSERT(m_expr2post.empty());
|
||||
ast_mark mark;
|
||||
ptr_vector<expr> todo;
|
||||
todo.push_back(m_root);
|
||||
while (!todo.empty()) {
|
||||
expr* e = todo.back();
|
||||
if (mark.is_marked(e)) {
|
||||
todo.pop_back();
|
||||
continue;
|
||||
}
|
||||
if (is_app(e)) {
|
||||
app* a = to_app(e);
|
||||
bool done = true;
|
||||
for (expr* arg : *a) {
|
||||
if (!mark.is_marked(arg)) {
|
||||
todo.push_back(arg);
|
||||
done = false;
|
||||
}
|
||||
}
|
||||
if (done) {
|
||||
mark.mark(e, true);
|
||||
m_expr2post.insert(e, post_num++);
|
||||
m_post2expr.push_back(e);
|
||||
todo.pop_back();
|
||||
for (expr* arg : *a) {
|
||||
add_edge(m_parents, arg, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
mark.mark(e, true);
|
||||
todo.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expr* expr_dominators::intersect(expr* x, expr * y) {
|
||||
unsigned n1 = m_expr2post[x];
|
||||
unsigned n2 = m_expr2post[y];
|
||||
while (n1 != n2) {
|
||||
if (n1 < n2) {
|
||||
x = m_doms[x];
|
||||
n1 = m_expr2post[x];
|
||||
}
|
||||
else if (n1 > n2) {
|
||||
y = m_doms[y];
|
||||
n2 = m_expr2post[y];
|
||||
}
|
||||
}
|
||||
SASSERT(x == y);
|
||||
return x;
|
||||
}
|
||||
|
||||
void expr_dominators::compute_dominators() {
|
||||
expr * e = m_root;
|
||||
SASSERT(m_doms.empty());
|
||||
m_doms.insert(e, e);
|
||||
bool change = true;
|
||||
while (change) {
|
||||
change = false;
|
||||
SASSERT(m_post2expr.back() == e);
|
||||
for (unsigned i = 0; i < m_post2expr.size() - 1; ++i) {
|
||||
expr * child = m_post2expr[i];
|
||||
ptr_vector<expr> const& p = m_parents[child];
|
||||
SASSERT(!p.empty());
|
||||
expr * new_idom = p[0], * idom2 = 0;
|
||||
for (unsigned j = 1; j < p.size(); ++j) {
|
||||
if (m_doms.find(p[j], idom2)) {
|
||||
new_idom = intersect(new_idom, idom2);
|
||||
}
|
||||
}
|
||||
if (!m_doms.find(child, idom2) || idom2 != new_idom) {
|
||||
m_doms.insert(child, new_idom);
|
||||
change = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void expr_dominators::extract_tree() {
|
||||
for (auto const& kv : m_doms) {
|
||||
add_edge(m_tree, kv.m_value, kv.m_key);
|
||||
}
|
||||
}
|
||||
|
||||
void expr_dominators::compile(expr * e) {
|
||||
reset();
|
||||
m_root = e;
|
||||
compute_post_order();
|
||||
compute_dominators();
|
||||
extract_tree();
|
||||
}
|
||||
|
||||
void expr_dominators::compile(unsigned sz, expr * const* es) {
|
||||
expr_ref e(m.mk_and(sz, es), m);
|
||||
compile(e);
|
||||
}
|
||||
|
||||
void expr_dominators::reset() {
|
||||
m_expr2post.reset();
|
||||
m_post2expr.reset();
|
||||
m_parents.reset();
|
||||
m_doms.reset();
|
||||
m_tree.reset();
|
||||
m_root.reset();
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------
|
||||
// dom_simplify_tactic
|
||||
|
||||
tactic * dom_simplify_tactic::translate(ast_manager & m) {
|
||||
return alloc(dom_simplify_tactic, m, m_simplifier->translate(m), m_params);
|
||||
}
|
||||
|
||||
void dom_simplify_tactic::operator()(
|
||||
goal_ref const & in,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
mc = 0; pc = 0; core = 0;
|
||||
|
||||
tactic_report report("dom-simplify", *in.get());
|
||||
simplify_goal(*(in.get()));
|
||||
in->inc_depth();
|
||||
result.push_back(in.get());
|
||||
|
||||
}
|
||||
|
||||
void dom_simplify_tactic::cleanup() {
|
||||
m_trail.reset();
|
||||
m_args.reset();
|
||||
m_args2.reset();
|
||||
m_result.reset();
|
||||
m_dominators.reset();
|
||||
}
|
||||
|
||||
expr_ref dom_simplify_tactic::simplify_ite(app * ite) {
|
||||
expr_ref r(m);
|
||||
expr * c = 0, * t = 0, * e = 0;
|
||||
VERIFY(m.is_ite(ite, c, t, e));
|
||||
unsigned old_lvl = scope_level();
|
||||
expr_ref new_c = simplify(c);
|
||||
if (m.is_true(new_c)) {
|
||||
r = simplify(t);
|
||||
}
|
||||
else if (m.is_false(new_c) || !assert_expr(new_c, false)) {
|
||||
r = simplify(e);
|
||||
}
|
||||
else {
|
||||
expr_ref new_t = simplify(t);
|
||||
pop(scope_level() - old_lvl);
|
||||
if (!assert_expr(new_c, true)) {
|
||||
return new_t;
|
||||
}
|
||||
expr_ref new_e = simplify(e);
|
||||
pop(scope_level() - old_lvl);
|
||||
if (c == new_c && t == new_t && e == new_e) {
|
||||
r = ite;
|
||||
}
|
||||
else if (new_t == new_e) {
|
||||
r = new_t;
|
||||
}
|
||||
else {
|
||||
TRACE("tactic", tout << new_c << "\n" << new_t << "\n" << new_e << "\n";);
|
||||
r = m.mk_ite(new_c, new_t, new_c);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
expr_ref dom_simplify_tactic::simplify(expr * e0) {
|
||||
expr_ref r(m);
|
||||
expr* e = 0;
|
||||
if (!m_result.find(e0, e)) {
|
||||
e = e0;
|
||||
}
|
||||
|
||||
++m_depth;
|
||||
if (m_depth > m_max_depth) {
|
||||
r = e;
|
||||
}
|
||||
else if (m.is_ite(e)) {
|
||||
r = simplify_ite(to_app(e));
|
||||
}
|
||||
else if (m.is_and(e)) {
|
||||
r = simplify_and(to_app(e));
|
||||
}
|
||||
else if (m.is_or(e)) {
|
||||
r = simplify_or(to_app(e));
|
||||
}
|
||||
else {
|
||||
expr_dominators::tree_t const& t = m_dominators.get_tree();
|
||||
if (t.contains(e)) {
|
||||
ptr_vector<expr> const& children = t[e];
|
||||
for (expr * child : children) {
|
||||
simplify(child);
|
||||
}
|
||||
}
|
||||
if (is_app(e)) {
|
||||
m_args.reset();
|
||||
for (expr* arg : *to_app(e)) {
|
||||
m_args.push_back(get_cached(arg)); // TBD is cache really applied to all sub-terms?
|
||||
}
|
||||
r = m.mk_app(to_app(e)->get_decl(), m_args.size(), m_args.c_ptr());
|
||||
}
|
||||
else {
|
||||
r = e;
|
||||
}
|
||||
}
|
||||
(*m_simplifier)(r);
|
||||
cache(e0, r);
|
||||
TRACE("simplify", tout << "depth: " << m_depth << " " << mk_pp(e0, m) << " -> " << r << "\n";);
|
||||
--m_depth;
|
||||
return r;
|
||||
}
|
||||
|
||||
expr_ref dom_simplify_tactic::simplify_and_or(bool is_and, app * e) {
|
||||
expr_ref r(m);
|
||||
unsigned old_lvl = scope_level();
|
||||
m_args.reset();
|
||||
for (expr * arg : *e) {
|
||||
r = simplify(arg);
|
||||
if (!assert_expr(r, !is_and)) {
|
||||
r = is_and ? m.mk_false() : m.mk_true();
|
||||
}
|
||||
m_args.push_back(r);
|
||||
}
|
||||
pop(scope_level() - old_lvl);
|
||||
m_args.reverse();
|
||||
m_args2.reset();
|
||||
for (expr * arg : m_args) {
|
||||
r = simplify(arg);
|
||||
if (!assert_expr(r, !is_and)) {
|
||||
r = is_and ? m.mk_false() : m.mk_true();
|
||||
}
|
||||
m_args2.push_back(r);
|
||||
}
|
||||
pop(scope_level() - old_lvl);
|
||||
m_args2.reverse();
|
||||
r = is_and ? mk_and(m_args2) : mk_or(m_args2);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
||||
void dom_simplify_tactic::init(goal& g) {
|
||||
expr_ref_vector args(m);
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; i < sz; ++i) args.push_back(g.form(i));
|
||||
expr_ref fml = mk_and(args);
|
||||
m_result.reset();
|
||||
m_trail.reset();
|
||||
m_dominators.compile(fml);
|
||||
}
|
||||
|
||||
void dom_simplify_tactic::simplify_goal(goal& g) {
|
||||
|
||||
SASSERT(scope_level() == 0);
|
||||
bool change = true;
|
||||
m_depth = 0;
|
||||
while (change) {
|
||||
change = false;
|
||||
|
||||
// go forwards
|
||||
init(g);
|
||||
unsigned sz = g.size();
|
||||
for (unsigned i = 0; !g.inconsistent() && i < sz; ++i) {
|
||||
expr_ref r = simplify(g.form(i));
|
||||
if (i < sz - 1 && !m.is_true(r) && !m.is_false(r) && !g.dep(i) && !g.proofs_enabled() && !assert_expr(r, false)) {
|
||||
r = m.mk_false();
|
||||
}
|
||||
change |= r != g.form(i);
|
||||
proof* new_pr = 0;
|
||||
if (g.proofs_enabled()) {
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite_star(g.form(i), r, 0, 0));
|
||||
}
|
||||
g.update(i, r, new_pr, g.dep(i));
|
||||
}
|
||||
pop(scope_level());
|
||||
|
||||
// go backwards
|
||||
init(g);
|
||||
sz = g.size();
|
||||
for (unsigned i = sz; !g.inconsistent() && i > 0; ) {
|
||||
--i;
|
||||
expr_ref r = simplify(g.form(i));
|
||||
if (i > 0 && !m.is_true(r) && !m.is_false(r) && !g.dep(i) && !g.proofs_enabled() && !assert_expr(r, false)) {
|
||||
r = m.mk_false();
|
||||
}
|
||||
change |= r != g.form(i);
|
||||
proof* new_pr = 0;
|
||||
if (g.proofs_enabled()) {
|
||||
new_pr = m.mk_modus_ponens(g.pr(i), m.mk_rewrite_star(g.form(i), r, 0, 0));
|
||||
}
|
||||
g.update(i, r, new_pr, g.dep(i));
|
||||
}
|
||||
pop(scope_level());
|
||||
}
|
||||
SASSERT(scope_level() == 0);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------
|
||||
// expr_substitution_simplifier
|
||||
|
||||
bool expr_substitution_simplifier::assert_expr(expr * t, bool sign) {
|
||||
expr* tt;
|
||||
if (!sign) {
|
||||
update_substitution(t, 0);
|
||||
}
|
||||
else if (m.is_not(t, tt)) {
|
||||
update_substitution(tt, 0);
|
||||
}
|
||||
else {
|
||||
expr_ref nt(m.mk_not(t), m);
|
||||
update_substitution(nt, 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool expr_substitution_simplifier::is_gt(expr* lhs, expr* rhs) {
|
||||
if (lhs == rhs) {
|
||||
return false;
|
||||
}
|
||||
if (m.is_value(rhs)) {
|
||||
return true;
|
||||
}
|
||||
SASSERT(is_ground(lhs) && is_ground(rhs));
|
||||
if (depth(lhs) > depth(rhs)) {
|
||||
return true;
|
||||
}
|
||||
if (depth(lhs) == depth(rhs) && is_app(lhs) && is_app(rhs)) {
|
||||
app* l = to_app(lhs);
|
||||
app* r = to_app(rhs);
|
||||
if (l->get_decl()->get_id() != r->get_decl()->get_id()) {
|
||||
return l->get_decl()->get_id() > r->get_decl()->get_id();
|
||||
}
|
||||
if (l->get_num_args() != r->get_num_args()) {
|
||||
return l->get_num_args() > r->get_num_args();
|
||||
}
|
||||
for (unsigned i = 0; i < l->get_num_args(); ++i) {
|
||||
if (l->get_arg(i) != r->get_arg(i)) {
|
||||
return is_gt(l->get_arg(i), r->get_arg(i));
|
||||
}
|
||||
}
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void expr_substitution_simplifier::update_substitution(expr* n, proof* pr) {
|
||||
expr* lhs, *rhs, *n1;
|
||||
if (is_ground(n) && (m.is_eq(n, lhs, rhs) || m.is_iff(n, lhs, rhs))) {
|
||||
compute_depth(lhs);
|
||||
compute_depth(rhs);
|
||||
if (is_gt(lhs, rhs)) {
|
||||
TRACE("propagate_values", tout << "insert " << mk_pp(lhs, m) << " -> " << mk_pp(rhs, m) << "\n";);
|
||||
m_scoped_substitution.insert(lhs, rhs, pr);
|
||||
return;
|
||||
}
|
||||
if (is_gt(rhs, lhs)) {
|
||||
TRACE("propagate_values", tout << "insert " << mk_pp(rhs, m) << " -> " << mk_pp(lhs, m) << "\n";);
|
||||
m_scoped_substitution.insert(rhs, lhs, m.mk_symmetry(pr));
|
||||
return;
|
||||
}
|
||||
TRACE("propagate_values", tout << "incompatible " << mk_pp(n, m) << "\n";);
|
||||
}
|
||||
if (m.is_not(n, n1)) {
|
||||
m_scoped_substitution.insert(n1, m.mk_false(), m.mk_iff_false(pr));
|
||||
}
|
||||
else {
|
||||
m_scoped_substitution.insert(n, m.mk_true(), m.mk_iff_true(pr));
|
||||
}
|
||||
}
|
||||
|
||||
void expr_substitution_simplifier::compute_depth(expr* e) {
|
||||
ptr_vector<expr> todo;
|
||||
todo.push_back(e);
|
||||
while (!todo.empty()) {
|
||||
e = todo.back();
|
||||
unsigned d = 0;
|
||||
if (m_expr2depth.contains(e)) {
|
||||
todo.pop_back();
|
||||
continue;
|
||||
}
|
||||
if (is_app(e)) {
|
||||
app* a = to_app(e);
|
||||
bool visited = true;
|
||||
for (expr* arg : *a) {
|
||||
unsigned d1 = 0;
|
||||
if (m_expr2depth.find(arg, d1)) {
|
||||
d = std::max(d, d1);
|
||||
}
|
||||
else {
|
||||
visited = false;
|
||||
todo.push_back(arg);
|
||||
}
|
||||
}
|
||||
if (!visited) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
todo.pop_back();
|
||||
m_expr2depth.insert(e, d + 1);
|
||||
}
|
||||
}
|
163
src/tactic/core/dom_simplify_tactic.h
Normal file
163
src/tactic/core/dom_simplify_tactic.h
Normal file
|
@ -0,0 +1,163 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
dom_simplify_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Dominator-based context simplifer.
|
||||
|
||||
Author:
|
||||
|
||||
Nikolaj and Nuno
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef DOM_SIMPLIFY_TACTIC_H_
|
||||
#define DOM_SIMPLIFY_TACTIC_H_
|
||||
|
||||
#include "ast/ast.h"
|
||||
#include "ast/expr_substitution.h"
|
||||
#include "tactic/tactic.h"
|
||||
|
||||
|
||||
class expr_dominators {
|
||||
public:
|
||||
typedef obj_map<expr, ptr_vector<expr>> tree_t;
|
||||
private:
|
||||
ast_manager& m;
|
||||
expr_ref m_root;
|
||||
obj_map<expr, unsigned> m_expr2post; // reverse post-order number
|
||||
ptr_vector<expr> m_post2expr;
|
||||
tree_t m_parents;
|
||||
obj_map<expr, expr*> m_doms;
|
||||
tree_t m_tree;
|
||||
|
||||
void add_edge(tree_t& tree, expr * src, expr* dst) {
|
||||
tree.insert_if_not_there2(src, ptr_vector<expr>())->get_data().m_value.push_back(dst);
|
||||
}
|
||||
|
||||
void compute_post_order();
|
||||
expr* intersect(expr* x, expr * y);
|
||||
void compute_dominators();
|
||||
void extract_tree();
|
||||
|
||||
public:
|
||||
expr_dominators(ast_manager& m): m(m), m_root(m) {}
|
||||
|
||||
void compile(expr * e);
|
||||
void compile(unsigned sz, expr * const* es);
|
||||
tree_t const& get_tree() { return m_tree; }
|
||||
void reset();
|
||||
|
||||
};
|
||||
|
||||
class dom_simplify_tactic : public tactic {
|
||||
public:
|
||||
class simplifier {
|
||||
public:
|
||||
virtual ~simplifier() {}
|
||||
/**
|
||||
\brief assert_expr performs an implicit push
|
||||
*/
|
||||
virtual bool assert_expr(expr * t, bool sign) = 0;
|
||||
|
||||
/**
|
||||
\brief apply simplification.
|
||||
*/
|
||||
virtual void operator()(expr_ref& r) = 0;
|
||||
|
||||
/**
|
||||
\brief pop scopes accumulated from assertions.
|
||||
*/
|
||||
virtual void pop(unsigned num_scopes) = 0;
|
||||
|
||||
virtual simplifier * translate(ast_manager & m);
|
||||
|
||||
};
|
||||
private:
|
||||
ast_manager& m;
|
||||
simplifier* m_simplifier;
|
||||
params_ref m_params;
|
||||
expr_ref_vector m_trail, m_args, m_args2;
|
||||
obj_map<expr, expr*> m_result;
|
||||
expr_dominators m_dominators;
|
||||
unsigned m_scope_level;
|
||||
unsigned m_depth;
|
||||
unsigned m_max_depth;
|
||||
|
||||
expr_ref simplify(expr* t);
|
||||
expr_ref simplify_ite(app * ite);
|
||||
expr_ref simplify_and(app * ite) { return simplify_and_or(true, ite); }
|
||||
expr_ref simplify_or(app * ite) { return simplify_and_or(false, ite); }
|
||||
expr_ref simplify_and_or(bool is_and, app * ite);
|
||||
void simplify_goal(goal& g);
|
||||
|
||||
expr_ref get_cached(expr* t) { expr* r = 0; if (!m_result.find(r, r)) r = t; return expr_ref(r, m); }
|
||||
void cache(expr *t, expr* r) { m_result.insert(t, r); m_trail.push_back(r); }
|
||||
|
||||
unsigned scope_level() { return m_scope_level; }
|
||||
void pop(unsigned n) { SASSERT(n <= m_scope_level); m_scope_level -= n; m_simplifier->pop(n); }
|
||||
bool assert_expr(expr* f, bool sign) { m_scope_level++; return m_simplifier->assert_expr(f, sign); }
|
||||
|
||||
void init(goal& g);
|
||||
|
||||
public:
|
||||
dom_simplify_tactic(ast_manager & m, simplifier* s, params_ref const & p = params_ref()):
|
||||
m(m), m_simplifier(s), m_params(p),
|
||||
m_trail(m), m_args(m), m_args2(m),
|
||||
m_dominators(m),
|
||||
m_scope_level(0), m_depth(0), m_max_depth(1024) {}
|
||||
|
||||
|
||||
virtual ~dom_simplify_tactic() {}
|
||||
|
||||
virtual tactic * translate(ast_manager & m);
|
||||
virtual void updt_params(params_ref const & p) {}
|
||||
static void get_param_descrs(param_descrs & r) {}
|
||||
virtual void collect_param_descrs(param_descrs & r) { get_param_descrs(r); }
|
||||
|
||||
virtual void operator()(goal_ref const & in,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core);
|
||||
|
||||
virtual void cleanup();
|
||||
};
|
||||
|
||||
class expr_substitution_simplifier : public dom_simplify_tactic::simplifier {
|
||||
ast_manager& m;
|
||||
expr_substitution m_subst;
|
||||
scoped_expr_substitution m_scoped_substitution;
|
||||
obj_map<expr, unsigned> m_expr2depth;
|
||||
|
||||
// move from asserted_formulas to here..
|
||||
void compute_depth(expr* e);
|
||||
bool is_gt(expr* lhs, expr* rhs);
|
||||
unsigned depth(expr* e) { return m_expr2depth[e]; }
|
||||
|
||||
public:
|
||||
expr_substitution_simplifier(ast_manager& m): m(m), m_subst(m), m_scoped_substitution(m_subst) {}
|
||||
virtual ~expr_substitution_simplifier() {}
|
||||
virtual bool assert_expr(expr * t, bool sign);
|
||||
|
||||
void update_substitution(expr* n, proof* pr);
|
||||
|
||||
virtual void operator()(expr_ref& r) { r = m_scoped_substitution.find(r); }
|
||||
|
||||
virtual void pop(unsigned num_scopes) { m_scoped_substitution.pop(num_scopes); }
|
||||
|
||||
virtual simplifier * translate(ast_manager & m) {
|
||||
SASSERT(m_subst.empty());
|
||||
return alloc(expr_substitution_simplifier, m);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -17,11 +17,11 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"defined_names.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"cooperate.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/normal_forms/defined_names.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "util/cooperate.h"
|
||||
|
||||
class elim_term_ite_tactic : public tactic {
|
||||
|
||||
|
@ -171,9 +171,8 @@ public:
|
|||
|
||||
virtual void cleanup() {
|
||||
ast_manager & m = m_imp->m;
|
||||
imp * d = alloc(imp, m, m_params);
|
||||
std::swap(d, m_imp);
|
||||
dealloc(d);
|
||||
m_imp->~imp();
|
||||
m_imp = new (m_imp) imp(m, m_params);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -20,7 +20,7 @@ Notes:
|
|||
#ifndef ELIM_TERM_ITE_TACTIC_H_
|
||||
#define ELIM_TERM_ITE_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
|
|
|
@ -16,18 +16,18 @@ Author:
|
|||
Notes:
|
||||
|
||||
--*/
|
||||
#include"tactical.h"
|
||||
#include"extension_model_converter.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include"rewriter_def.h"
|
||||
#include"arith_decl_plugin.h"
|
||||
#include"bv_decl_plugin.h"
|
||||
#include"array_decl_plugin.h"
|
||||
#include"datatype_decl_plugin.h"
|
||||
#include"collect_occs.h"
|
||||
#include"cooperate.h"
|
||||
#include"ast_smt2_pp.h"
|
||||
#include"ast_ll_pp.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/extension_model_converter.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "ast/arith_decl_plugin.h"
|
||||
#include "ast/bv_decl_plugin.h"
|
||||
#include "ast/array_decl_plugin.h"
|
||||
#include "ast/datatype_decl_plugin.h"
|
||||
#include "tactic/core/collect_occs.h"
|
||||
#include "util/cooperate.h"
|
||||
#include "ast/ast_smt2_pp.h"
|
||||
#include "ast/ast_ll_pp.h"
|
||||
|
||||
class elim_uncnstr_tactic : public tactic {
|
||||
|
||||
|
@ -174,11 +174,8 @@ class elim_uncnstr_tactic : public tactic {
|
|||
if (fid == m_dt_util.get_family_id()) {
|
||||
// In the current implementation, I only handle the case where
|
||||
// the datatype has a recursive constructor.
|
||||
ptr_vector<func_decl> const * constructors = m_dt_util.get_datatype_constructors(s);
|
||||
ptr_vector<func_decl>::const_iterator it = constructors->begin();
|
||||
ptr_vector<func_decl>::const_iterator end = constructors->end();
|
||||
for (; it != end; ++it) {
|
||||
func_decl * constructor = *it;
|
||||
ptr_vector<func_decl> const & constructors = *m_dt_util.get_datatype_constructors(s);
|
||||
for (func_decl * constructor : constructors) {
|
||||
unsigned num = constructor->get_arity();
|
||||
unsigned target = UINT_MAX;
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
|
@ -707,10 +704,10 @@ class elim_uncnstr_tactic : public tactic {
|
|||
app * u;
|
||||
if (!mk_fresh_uncnstr_var_for(f, num, args, u))
|
||||
return u;
|
||||
ptr_vector<func_decl> const * accs = m_dt_util.get_constructor_accessors(c);
|
||||
ptr_vector<func_decl> const & accs = *m_dt_util.get_constructor_accessors(c);
|
||||
ptr_buffer<expr> new_args;
|
||||
for (unsigned i = 0; i < accs->size(); i++) {
|
||||
if (accs->get(i) == f)
|
||||
for (unsigned i = 0; i < accs.size(); i++) {
|
||||
if (accs[i] == f)
|
||||
new_args.push_back(u);
|
||||
else
|
||||
new_args.push_back(m().get_some_value(c->get_domain(i)));
|
||||
|
@ -726,9 +723,9 @@ class elim_uncnstr_tactic : public tactic {
|
|||
return u;
|
||||
if (!m_mc)
|
||||
return u;
|
||||
ptr_vector<func_decl> const * accs = m_dt_util.get_constructor_accessors(f);
|
||||
ptr_vector<func_decl> const & accs = *m_dt_util.get_constructor_accessors(f);
|
||||
for (unsigned i = 0; i < num; i++) {
|
||||
add_def(args[i], m().mk_app(accs->get(i), u));
|
||||
add_def(args[i], m().mk_app(accs[i], u));
|
||||
}
|
||||
return u;
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ Notes:
|
|||
#ifndef ELIM_UNCNSTR_TACTIC_H_
|
||||
#define ELIM_UNCNSTR_TACTIC_H_
|
||||
|
||||
#include"params.h"
|
||||
#include "util/params.h"
|
||||
|
||||
class tactic;
|
||||
class ast_manager;
|
||||
|
|
303
src/tactic/core/injectivity_tactic.cpp
Normal file
303
src/tactic/core/injectivity_tactic.cpp
Normal file
|
@ -0,0 +1,303 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
injectivity_tactic.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Injectivity tactics
|
||||
- Discover axioms of the form `forall x. (= (g (f x)) x`
|
||||
Mark `f` as injective
|
||||
- Rewrite (sub)terms of the form `(= (f x) (f y))` to `(= x y)` whenever `f` is injective.
|
||||
|
||||
Author:
|
||||
|
||||
Nicolas Braud-Santoni (t-nibrau) 2017-08-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include "tactic/tactical.h"
|
||||
#include "ast/rewriter/rewriter_def.h"
|
||||
#include "tactic/core/injectivity_tactic.h"
|
||||
#include "util/dec_ref_util.h"
|
||||
|
||||
|
||||
class injectivity_tactic : public tactic {
|
||||
|
||||
struct InjHelper : public obj_map<func_decl, obj_hashtable<func_decl>*> {
|
||||
ast_manager & m_manager;
|
||||
|
||||
void insert(func_decl* const f, func_decl* const g) {
|
||||
obj_hashtable<func_decl> *m;
|
||||
if (! obj_map::find(f, m)) {
|
||||
m_manager.inc_ref(f);
|
||||
m = alloc(obj_hashtable<func_decl>); // TODO: Check we don't leak memory
|
||||
obj_map::insert(f, m);
|
||||
}
|
||||
if (!m->contains(g)) {
|
||||
m_manager.inc_ref(g);
|
||||
m->insert(g);
|
||||
}
|
||||
}
|
||||
|
||||
bool find(func_decl* const f, func_decl* const g) const {
|
||||
obj_hashtable<func_decl> *m;
|
||||
if(! obj_map::find(f, m))
|
||||
return false;
|
||||
|
||||
return m->contains(g);
|
||||
}
|
||||
|
||||
InjHelper(ast_manager& m) : obj_map<func_decl, obj_hashtable<func_decl>*>(), m_manager(m) {}
|
||||
~InjHelper() {
|
||||
for(auto m : *this) {
|
||||
for (func_decl* f : *m.get_value())
|
||||
m_manager.dec_ref(f);
|
||||
|
||||
m_manager.dec_ref(m.m_key);
|
||||
dealloc(m.m_value);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct finder {
|
||||
ast_manager & m_manager;
|
||||
InjHelper & inj_map;
|
||||
|
||||
finder(ast_manager & m, InjHelper & map, params_ref const & p) :
|
||||
m_manager(m),
|
||||
inj_map(map) {
|
||||
updt_params(p);
|
||||
}
|
||||
|
||||
ast_manager & m() const { return m_manager; }
|
||||
|
||||
bool is_axiom(expr* n, func_decl* &f, func_decl* &g) {
|
||||
if (!is_quantifier(n))
|
||||
return false;
|
||||
|
||||
quantifier* const q = to_quantifier(n);
|
||||
if (!q->is_forall() || q->get_num_decls() != 1)
|
||||
return false;
|
||||
|
||||
const expr * const body = q->get_expr();
|
||||
|
||||
// n ~= forall x. body
|
||||
|
||||
if (!m().is_eq(body))
|
||||
return false;
|
||||
|
||||
const app * const body_a = to_app(body);
|
||||
if (body_a->get_num_args() != 2)
|
||||
return false;
|
||||
|
||||
const expr* a = body_a->get_arg(0);
|
||||
const expr* b = body_a->get_arg(1);
|
||||
|
||||
// n ~= forall x. (= a b)
|
||||
|
||||
if (is_app(a) && is_var(b)) {
|
||||
// Do nothing
|
||||
}
|
||||
else if (is_app(b) && is_var(a)) {
|
||||
std::swap(a, b);
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
const app* const a_app = to_app(a);
|
||||
const var* const b_var = to_var(b);
|
||||
|
||||
if (b_var->get_idx() != 0) // idx is the De Bruijn's index
|
||||
return false;
|
||||
|
||||
if (a_app->get_num_args() != 1)
|
||||
return false;
|
||||
|
||||
g = a_app->get_decl();
|
||||
const expr* const a_body = a_app->get_arg(0);
|
||||
|
||||
// n ~= forall x. (= (g a_body) x)
|
||||
|
||||
if (!is_app(a_body))
|
||||
return false;
|
||||
const app* const a_body_app = to_app(a_body);
|
||||
if (a_body_app->get_num_args() != 1) // Maybe TODO: support multi-argument functions
|
||||
return false;
|
||||
|
||||
f = a_body_app->get_decl();
|
||||
const expr* const a_body_body = a_body_app->get_arg(0);
|
||||
|
||||
// n ~= forall x. (= (g (f a_body_body)) x)
|
||||
if (a_body_body != b_var)
|
||||
return false;
|
||||
|
||||
// n ~= forall x. (= (g (f x)) x)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void operator()(goal_ref const & goal,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
SASSERT(goal->is_well_sorted());
|
||||
mc = 0; pc = 0; core = 0;
|
||||
tactic_report report("injectivity", *goal);
|
||||
fail_if_unsat_core_generation("injectivity", goal); // TODO: Support UNSAT cores
|
||||
fail_if_proof_generation("injectivity", goal);
|
||||
|
||||
for (unsigned i = 0; i < goal->size(); ++i) {
|
||||
func_decl *f, *g;
|
||||
if (!is_axiom(goal->form(i), f, g)) continue;
|
||||
TRACE("injectivity", tout << "Marking " << f->get_name() << " as injective" << std::endl;);
|
||||
inj_map.insert(f, g);
|
||||
// TODO: Record that g is f's pseudoinverse
|
||||
}
|
||||
}
|
||||
|
||||
void updt_params(params_ref const & p) {}
|
||||
};
|
||||
|
||||
struct rewriter_eq_cfg : public default_rewriter_cfg {
|
||||
ast_manager & m_manager;
|
||||
InjHelper & inj_map;
|
||||
// expr_ref_vector m_out;
|
||||
// sort_ref_vector m_bindings;
|
||||
|
||||
ast_manager & m() const { return m_manager; }
|
||||
|
||||
rewriter_eq_cfg(ast_manager & m, InjHelper & map, params_ref const & p) : m_manager(m), inj_map(map) {
|
||||
}
|
||||
|
||||
~rewriter_eq_cfg() {
|
||||
}
|
||||
|
||||
void cleanup_buffers() {
|
||||
// m_out.finalize();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
}
|
||||
|
||||
br_status reduce_app(func_decl * f, unsigned num, expr * const * args, expr_ref & result, proof_ref & result_pr) {
|
||||
if(num != 2)
|
||||
return BR_FAILED;
|
||||
|
||||
if (!m().is_eq(f))
|
||||
return BR_FAILED;
|
||||
|
||||
// We are rewriting (= a b)
|
||||
if (!is_app(args[0]) || !is_app(args[1]))
|
||||
return BR_FAILED;
|
||||
|
||||
const app* const a = to_app(args[0]);
|
||||
const app* const b = to_app(args[1]);
|
||||
|
||||
// a and b are applications of the same function
|
||||
if (a->get_decl() != b->get_decl())
|
||||
return BR_FAILED;
|
||||
|
||||
// Maybe TODO: Generalize to multi-parameter functions ?
|
||||
if (a->get_num_args() != 1 || b->get_num_args() != 1)
|
||||
return BR_FAILED;
|
||||
|
||||
if (!inj_map.contains(a->get_decl()))
|
||||
return BR_FAILED;
|
||||
|
||||
SASSERT(m().get_sort(a->get_arg(0)) == m().get_sort(b->get_arg(0)));
|
||||
TRACE("injectivity", tout << "Rewriting (= " << mk_ismt2_pp(args[0], m()) <<
|
||||
" " << mk_ismt2_pp(args[1], m()) << ")" << std::endl;);
|
||||
result = m().mk_eq(a->get_arg(0), b->get_arg(0));
|
||||
result_pr = nullptr;
|
||||
return BR_DONE;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct rewriter_eq : public rewriter_tpl<rewriter_eq_cfg> {
|
||||
rewriter_eq_cfg m_cfg;
|
||||
rewriter_eq(ast_manager & m, InjHelper & map, params_ref const & p) :
|
||||
rewriter_tpl<rewriter_eq_cfg>(m, m.proofs_enabled(), m_cfg),
|
||||
m_cfg(m, map, p) {
|
||||
}
|
||||
};
|
||||
|
||||
struct rewriter_inverse { };
|
||||
|
||||
finder * m_finder;
|
||||
rewriter_eq * m_eq;
|
||||
InjHelper * m_map;
|
||||
// rewriter_inverse * m_inverse;
|
||||
|
||||
params_ref m_params;
|
||||
ast_manager & m_manager;
|
||||
|
||||
public:
|
||||
injectivity_tactic(ast_manager & m, params_ref const & p):
|
||||
m_params(p),
|
||||
m_manager(m) {
|
||||
TRACE("injectivity", tout << "constructed new tactic" << std::endl;);
|
||||
m_map = alloc(InjHelper, m);
|
||||
m_finder = alloc(finder, m, *m_map, p);
|
||||
m_eq = alloc(rewriter_eq, m, *m_map, p);
|
||||
}
|
||||
|
||||
virtual tactic * translate(ast_manager & m) {
|
||||
return alloc(injectivity_tactic, m, m_params);
|
||||
}
|
||||
|
||||
virtual ~injectivity_tactic() {
|
||||
dealloc(m_finder);
|
||||
dealloc(m_eq);
|
||||
dealloc(m_map);
|
||||
}
|
||||
|
||||
virtual void updt_params(params_ref const & p) {
|
||||
m_params = p;
|
||||
m_finder->updt_params(p);
|
||||
}
|
||||
|
||||
virtual void collect_param_descrs(param_descrs & r) {
|
||||
insert_max_memory(r);
|
||||
insert_produce_models(r);
|
||||
}
|
||||
|
||||
virtual void operator()(goal_ref const & g,
|
||||
goal_ref_buffer & result,
|
||||
model_converter_ref & mc,
|
||||
proof_converter_ref & pc,
|
||||
expr_dependency_ref & core) {
|
||||
(*m_finder)(g, result, mc, pc, core);
|
||||
|
||||
for (unsigned i = 0; i < g->size(); ++i) {
|
||||
expr* curr = g->form(i);
|
||||
expr_ref rw(m_manager);
|
||||
proof_ref pr(m_manager);
|
||||
(*m_eq)(curr, rw, pr);
|
||||
g->update(i, rw, pr, g->dep(i));
|
||||
}
|
||||
result.push_back(g.get());
|
||||
}
|
||||
|
||||
virtual void cleanup() {
|
||||
InjHelper * m = alloc(InjHelper, m_manager);
|
||||
finder * f = alloc(finder, m_manager, *m, m_params);
|
||||
rewriter_eq * r = alloc(rewriter_eq, m_manager, *m, m_params);
|
||||
std::swap(m, m_map), std::swap(f, m_finder), std::swap(r, m_eq);
|
||||
dealloc(m), dealloc(f), dealloc(r);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
tactic * mk_injectivity_tactic(ast_manager & m, params_ref const & p) {
|
||||
return alloc(injectivity_tactic, m, p);
|
||||
}
|
32
src/tactic/core/injectivity_tactic.h
Normal file
32
src/tactic/core/injectivity_tactic.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
injectivity_tactic.h
|
||||
|
||||
Abstract:
|
||||
|
||||
Injectivity tactics
|
||||
|
||||
Author:
|
||||
|
||||
Nicolas Braud-Santoni (t-nibrau) 2017-08-10
|
||||
|
||||
Notes:
|
||||
|
||||
--*/
|
||||
#ifndef INJECTIVITY_TACTIC_H_
|
||||
#define INJECTIVITY_TACTIC_H_
|
||||
|
||||
#include "util/params.h"
|
||||
class ast_manager;
|
||||
class tactic;
|
||||
|
||||
tactic * mk_injectivity_tactic(ast_manager & m, params_ref const & p = params_ref());
|
||||
|
||||
/*
|
||||
ADD_TACTIC("injectivity", "Identifies and applies injectivity axioms.", "mk_injectivity_tactic(m, p)")
|
||||
*/
|
||||
|
||||
#endif
|
|
@ -16,9 +16,9 @@ Author:
|
|||
Revision History:
|
||||
|
||||
--*/
|
||||
#include"nnf.h"
|
||||
#include"tactical.h"
|
||||
#include"filter_model_converter.h"
|
||||
#include "ast/normal_forms/nnf.h"
|
||||
#include "tactic/tactical.h"
|
||||
#include "tactic/filter_model_converter.h"
|
||||
|
||||
class nnf_tactic : public tactic {
|
||||
params_ref m_params;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue