1. Arlen Cox
  2. z3

Commits

Leonardo de Moura  committed cadd35b

checkpoint

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>

  • Participants
  • Parent commits adb6d05
  • Branches master

Comments (0)

Files changed (40)

File src/api/api_context.cpp

View file
  • Ignore whitespace
     //
     // ------------------------
 
-    smt::solver & context::get_solver() {
+    smt::kernel & context::get_smt_kernel() {
         if (!m_solver) {
-            m_solver = alloc(smt::solver, m_manager, m_params);
+            m_solver = alloc(smt::kernel, m_manager, m_params);
         }
         return *m_solver;
     }
         
     void context::assert_cnstr(expr * a) {
-        get_solver().assert_expr(a);
+        get_smt_kernel().assert_expr(a);
     }
     
     lbool context::check(model_ref & m) {
         flet<bool> searching(m_searching, true);
         lbool r;
-        r = get_solver().check();
+        r = get_smt_kernel().check();
         if (r != l_false)
-            get_solver().get_model(m);
+            get_smt_kernel().get_model(m);
         return r;
     }
     
     void context::push() {
-        get_solver().push();
+        get_smt_kernel().push();
         if (!m_user_ref_count) {
             m_ast_lim.push_back(m_ast_trail.size());
             m_replay_stack.push_back(0);
                 }
             }
         }
-        get_solver().pop(num_scopes);
+        get_smt_kernel().pop(num_scopes);
     }
 
     // ------------------------
         Z3_TRY;
         LOG_Z3_set_logic(c, logic);
         RESET_ERROR_CODE();
-        return mk_c(c)->get_solver().set_logic(symbol(logic));
+        return mk_c(c)->get_smt_kernel().set_logic(symbol(logic));
         Z3_CATCH_RETURN(Z3_FALSE);
     }
 

File src/api/api_context.h

View file
  • Ignore whitespace
 #include"bv_decl_plugin.h"
 #include"datatype_decl_plugin.h"
 #include"dl_decl_plugin.h"
-#include"smt_solver.h"
+#include"smt_kernel.h"
 #include"front_end_params.h"
 #include"event_handler.h"
 #include"tactic_manager.h"
         bv_util                    m_bv_util;
         datalog::dl_decl_util      m_datalog_util;
 
-        smt::solver *              m_solver;     // General purpose solver for backward compatibility
+        smt::kernel *              m_solver;     // General purpose solver for backward compatibility
         
         ast_ref_vector             m_last_result; //!< used when m_user_ref_count == true
         ast_ref_vector             m_ast_trail;   //!< used when m_user_ref_count == false
         // ------------------------
         
         bool has_solver() const { return m_solver != 0; }
-        smt::solver & get_solver();
+        smt::kernel & get_smt_kernel();
         void assert_cnstr(expr * a);
         lbool check(model_ref & m);
         void push();

File src/api/api_datalog.h

View file
  • Ignore whitespace
 #include"front_end_params.h"
 #include"dl_external_relation.h"
 #include"dl_decl_plugin.h"
-#include"smt_solver.h"
+#include"smt_kernel.h"
 #include"api_util.h"
 #include"dl_context.h"
 

File src/api/api_parsers.cpp

View file
  • Ignore whitespace
 
     class z3_context_solver : public solver {
         api::context & m_ctx;
-        smt::solver & ctx() const { return m_ctx.get_solver(); }
+        smt::kernel & ctx() const { return m_ctx.get_smt_kernel(); }
     public:
         virtual ~z3_context_solver() {}
         z3_context_solver(api::context& c) : m_ctx(c) {}

File src/api/api_solver_old.cpp

View file
  • Ignore whitespace
         LOG_Z3_pop(c, num_scopes);
         RESET_ERROR_CODE();
         CHECK_SEARCHING(c);
-        if (num_scopes > mk_c(c)->get_solver().get_scope_level()) {
+        if (num_scopes > mk_c(c)->get_smt_kernel().get_scope_level()) {
             SET_ERROR_CODE(Z3_IOB);
             return;
         }
         LOG_Z3_check_and_get_model(c, m);
         RESET_ERROR_CODE();
         CHECK_SEARCHING(c);
-        cancel_eh<smt::solver> eh(mk_c(c)->get_solver());
+        cancel_eh<smt::kernel> eh(mk_c(c)->get_smt_kernel());
         api::context::set_interruptable(*(mk_c(c)), eh);
         flet<bool> _model(mk_c(c)->fparams().m_model, true);
         lbool result;
         LOG_Z3_get_implied_equalities(c, num_terms, terms, class_ids);
         RESET_ERROR_CODE();
         CHECK_SEARCHING(c);
-        lbool result = smt::implied_equalities(mk_c(c)->get_solver(), num_terms, to_exprs(terms), class_ids);
+        lbool result = smt::implied_equalities(mk_c(c)->get_smt_kernel(), num_terms, to_exprs(terms), class_ids);
         return static_cast<Z3_lbool>(result); 
         Z3_CATCH_RETURN(Z3_L_UNDEF);
     }
         CHECK_SEARCHING(c);
         expr * const* _assumptions = to_exprs(assumptions);
         flet<bool> _model(mk_c(c)->fparams().m_model, true);
-        cancel_eh<smt::solver> eh(mk_c(c)->get_solver());
+        cancel_eh<smt::kernel> eh(mk_c(c)->get_smt_kernel());
         api::context::set_interruptable(*(mk_c(c)), eh);
         lbool result;
-        result = mk_c(c)->get_solver().check(num_assumptions, _assumptions);
+        result = mk_c(c)->get_smt_kernel().check(num_assumptions, _assumptions);
         if (result != l_false && m) {
             model_ref _m;
-            mk_c(c)->get_solver().get_model(_m);
+            mk_c(c)->get_smt_kernel().get_model(_m);
             if (_m) {
                 Z3_model_ref * m_ref = alloc(Z3_model_ref); 
                 m_ref->m_model = _m;
             }
         }
         if (result == l_false && core_size) {
-            *core_size = mk_c(c)->get_solver().get_unsat_core_size();
+            *core_size = mk_c(c)->get_smt_kernel().get_unsat_core_size();
             if (*core_size > num_assumptions) {
                 SET_ERROR_CODE(Z3_INVALID_ARG);
             }
             for (unsigned i = 0; i < *core_size; ++i) {
-                core[i] = of_ast(mk_c(c)->get_solver().get_unsat_core_expr(i));
+                core[i] = of_ast(mk_c(c)->get_smt_kernel().get_unsat_core_expr(i));
             }
         }
         else if (core_size) {
             *core_size = 0;
         }
         if (result == l_false && proof) {
-            *proof = of_ast(mk_c(c)->get_solver().get_proof());
+            *proof = of_ast(mk_c(c)->get_smt_kernel().get_proof());
         }
         else if (proof) {
             *proof = 0; // breaks abstraction.
         LOG_Z3_get_search_failure(c);
         RESET_ERROR_CODE();
         CHECK_SEARCHING(c);
-        smt::failure f = mk_c(c)->get_solver().last_failure();
+        smt::failure f = mk_c(c)->get_smt_kernel().last_failure();
         return api::mk_Z3_search_failure(f);
         Z3_CATCH_RETURN(Z3_UNKNOWN);
     }
         buffer<symbol> labl_syms;
         ast_manager& m = mk_c(c)->m();
         expr_ref_vector lits(m);
-        mk_c(c)->get_solver().get_relevant_labels(0, labl_syms);
-        mk_c(c)->get_solver().get_relevant_labeled_literals(mk_c(c)->fparams().m_at_labels_cex, lits);        
+        mk_c(c)->get_smt_kernel().get_relevant_labels(0, labl_syms);
+        mk_c(c)->get_smt_kernel().get_relevant_labeled_literals(mk_c(c)->fparams().m_at_labels_cex, lits);        
         labels* lbls = alloc(labels);
         SASSERT(labl_syms.size() == lits.size());
         for (unsigned i = 0; i < lits.size(); ++i) {
         RESET_ERROR_CODE();
         ast_manager& m = mk_c(c)->m();
         expr_ref_vector lits(m);
-        mk_c(c)->get_solver().get_relevant_literals(lits);        
+        mk_c(c)->get_smt_kernel().get_relevant_literals(lits);        
         labels* lbls = alloc(labels);
         for (unsigned i = 0; i < lits.size(); ++i) {
             lbls->push_back(labeled_literal(m,lits[i].get()));
         RESET_ERROR_CODE();
         ast_manager& m = mk_c(c)->m();
         expr_ref_vector lits(m);
-        mk_c(c)->get_solver().get_guessed_literals(lits);        
+        mk_c(c)->get_smt_kernel().get_guessed_literals(lits);        
         labels* lbls = alloc(labels);
         for (unsigned i = 0; i < lits.size(); ++i) {
             lbls->push_back(labeled_literal(m,lits[i].get()));
         LOG_Z3_context_to_string(c);
         RESET_ERROR_CODE();
         std::ostringstream buffer;
-        mk_c(c)->get_solver().display(buffer);
+        mk_c(c)->get_smt_kernel().display(buffer);
         return mk_c(c)->mk_external_string(buffer.str());
         Z3_CATCH_RETURN(0);
     }
         ast_manager& m = mk_c(c)->m();
         expr_ref result(m);
         expr_ref_vector assignment(m);
-        mk_c(c)->get_solver().get_assignments(assignment);
+        mk_c(c)->get_smt_kernel().get_assignments(assignment);
         result = mk_c(c)->mk_and(assignment.size(), assignment.c_ptr());
         RETURN_Z3(of_ast(result.get()));
         Z3_CATCH_RETURN(0);
         LOG_Z3_statistics_to_string(c);
         RESET_ERROR_CODE();
         std::ostringstream buffer;
-        mk_c(c)->get_solver().display_statistics(buffer);
+        mk_c(c)->get_smt_kernel().display_statistics(buffer);
         memory::display_max_usage(buffer);
         return mk_c(c)->mk_external_string(buffer.str());
         Z3_CATCH_RETURN(0);
 };
 
 void Z3_display_statistics(Z3_context c, std::ostream& s) {
-    mk_c(c)->get_solver().display_statistics(s);
+    mk_c(c)->get_smt_kernel().display_statistics(s);
 }
 
 void Z3_display_istatistics(Z3_context c, std::ostream& s) {
-    mk_c(c)->get_solver().display_istatistics(s);
+    mk_c(c)->get_smt_kernel().display_istatistics(s);
 }
     

File src/api/api_user_theory.cpp

View file
  • Ignore whitespace
     Z3_theory Z3_mk_theory(Z3_context c, Z3_string th_name, void * ext_data) {
         Z3_TRY;
         RESET_ERROR_CODE();
-        if (mk_c(c)->get_solver().get_scope_level() > 0) {
+        if (mk_c(c)->get_smt_kernel().get_scope_level() > 0) {
             SET_ERROR_CODE(Z3_INVALID_USAGE);
             return 0;
         }
-        return reinterpret_cast<Z3_theory>(mk_user_theory(mk_c(c)->get_solver(), c, ext_data, th_name));
+        return reinterpret_cast<Z3_theory>(mk_user_theory(mk_c(c)->get_smt_kernel(), c, ext_data, th_name));
         Z3_CATCH_RETURN(0);
     }
 

File src/muz_qe/dl_bmc_engine.cpp

View file
  • Ignore whitespace
 #include "dl_rule_transformer.h"
 #include "dl_bmc_engine.h"
 #include "dl_mk_slice.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "datatype_decl_plugin.h"
 #include "dl_mk_rule_inliner.h"
 #include "dl_decl_plugin.h"

File src/muz_qe/dl_bmc_engine.h

View file
  • Ignore whitespace
 
 #include "params.h"
 #include "statistics.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "bv_decl_plugin.h"
 
 
         context&         m_ctx;
         ast_manager&     m;
         front_end_params m_fparams;
-        smt::solver      m_solver;
+        smt::kernel      m_solver;
         obj_map<func_decl, sort*> m_pred2sort;
         obj_map<sort, func_decl*> m_sort2pred;
         obj_map<func_decl, func_decl*> m_pred2newpred;

File src/muz_qe/dl_smt_relation.cpp

View file
  • Ignore whitespace
 #include "dl_context.h"
 #include "dl_smt_relation.h"
 #include "expr_abstract.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "th_rewriter.h"
 #include "qe.h"
 #include "datatype_decl_plugin.h"
 
         front_end_params& params = get_plugin().get_fparams();
         flet<bool> flet2(params.m_der, true);
-        smt::solver ctx(m, params);
+        smt::kernel ctx(m, params);
         expr_ref tmp(m); 
         instantiate(r, tmp);
         ctx.assert_expr(tmp);
         flet<bool> flet0(params.m_quant_elim, true);
         flet<bool> flet1(params.m_nnf_cnf, false);
         flet<bool> flet2(params.m_der, true);
-        smt::solver ctx(m, params);
+        smt::kernel ctx(m, params);
         ctx.assert_expr(fml_inst);
         lbool result = ctx.check();
         TRACE("smt_relation",
         eqs.resize(num_vars);
         instantiate(r, tmp);
         flet<bool> flet4(params.m_model, true);
-        smt::solver ctx(m, params);
+        smt::kernel ctx(m, params);
         ctx.assert_expr(tmp);
         
         while (true) {

File src/muz_qe/pdr_context.cpp

View file
  • Ignore whitespace
     }
 
     bool context::check_invariant(unsigned lvl, func_decl* fn) {
-        smt::solver ctx(m, m_fparams);
+        smt::kernel ctx(m, m_fparams);
         pred_transformer& pt = *m_rels.find(fn);
         expr_ref_vector conj(m);
         expr_ref inv = pt.get_formulas(next_level(lvl), false);

File src/muz_qe/pdr_farkas_learner.cpp

View file
  • Ignore whitespace
           o2p(outer_mgr, m_pr)
     {
         reg_decl_plugins(m_pr);
-        m_ctx = alloc(smt::solver, m_pr, m_proof_params);
+        m_ctx = alloc(smt::kernel, m_pr, m_proof_params);
     }
 
     front_end_params farkas_learner::get_proof_params(front_end_params& orig_params) {
 
 
         if (!m_ctx) {
-            m_ctx = alloc(smt::solver, m_pr, m_proof_params);
+            m_ctx = alloc(smt::kernel, m_pr, m_proof_params);
         }
 
         m_ctx->push();

File src/muz_qe/pdr_farkas_learner.h

View file
  • Ignore whitespace
 #include "arith_decl_plugin.h"
 #include "ast_translation.h"
 #include "bv_decl_plugin.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "bool_rewriter.h"
 #include "pdr_util.h"
 #include "front_end_params.h"
 
     front_end_params         m_proof_params;
     ast_manager              m_pr;
-    scoped_ptr<smt::solver>  m_ctx;
+    scoped_ptr<smt::kernel>  m_ctx;
 
 
     static front_end_params get_proof_params(front_end_params& orig_params);

File src/muz_qe/pdr_generalizers.cpp

View file
  • Ignore whitespace
         imp imp(m_ctx);
         ast_manager& m = core.get_manager();
         expr_ref goal = imp.mk_induction_goal(p->pt(), p->level(), depth);
-        smt::solver ctx(m, m_ctx.get_fparams(), m_ctx.get_params());
+        smt::kernel ctx(m, m_ctx.get_fparams(), m_ctx.get_params());
         ctx.assert_expr(goal);
         lbool r = ctx.check();
         TRACE("pdr", tout << r << "\n";

File src/muz_qe/pdr_manager.cpp

View file
  • Ignore whitespace
     
     
     bool manager::implication_surely_holds(expr * lhs, expr * rhs, expr * bg) {
-        smt::solver sctx(m, get_fparams());
+        smt::kernel sctx(m, get_fparams());
         if(bg) {
             sctx.assert_expr(bg);
         }

File src/muz_qe/pdr_manager.h

View file
  • Ignore whitespace
 #include "expr_substitution.h"
 #include "map.h"
 #include "ref_vector.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "pdr_util.h"
 #include "pdr_sym_mux.h"
 #include "pdr_farkas_learner.h"

File src/muz_qe/pdr_prop_solver.h

View file
  • Ignore whitespace
 #include <utility>
 #include "ast.h"
 #include "obj_hashtable.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "util.h"
 #include "vector.h"
 #include "pdr_manager.h"

File src/muz_qe/pdr_quantifiers.cpp

View file
  • Ignore whitespace
         bool found_instance = false;
         expr_ref C(m);
         front_end_params fparams;
-        smt::solver solver(m, fparams);
+        smt::kernel solver(m, fparams);
         solver.assert_expr(m_A);
         for (unsigned i = 0; i < m_Bs.size(); ++i) {
             expr_ref_vector fresh_vars(m);
               for (unsigned i = 0; i < fmls.size(); ++i) {
                   tout << mk_pp(fmls[i].get(), mp) << "\n";
               });
-        smt::solver solver(mp, fparams);
+        smt::kernel solver(mp, fparams);
         for (unsigned i = 0; i < fmls.size(); ++i) {
             solver.assert_expr(fmls[i].get());
         }

File src/muz_qe/pdr_smt_context_manager.cpp

View file
  • Ignore whitespace
     }
 
 
-    _smt_context::_smt_context(smt::solver & ctx, smt_context_manager& p, app* pred):
+    _smt_context::_smt_context(smt::kernel & ctx, smt_context_manager& p, app* pred):
         smt_context(p, ctx.m(), pred),
         m_context(ctx)
     {}
     
     smt_context_manager::~smt_context_manager() {
         TRACE("pdr",tout << "\n";);
-        std::for_each(m_contexts.begin(), m_contexts.end(), delete_proc<smt::solver>());
+        std::for_each(m_contexts.begin(), m_contexts.end(), delete_proc<smt::kernel>());
     }
 
     smt_context* smt_context_manager::mk_fresh() {        
         ++m_num_contexts;
         app_ref pred(m);
-        smt::solver * ctx = 0;
+        smt::kernel * ctx = 0;
         if (m_max_num_contexts == 0) {
-            m_contexts.push_back(alloc(smt::solver, m, m_fparams));
+            m_contexts.push_back(alloc(smt::kernel, m, m_fparams));
             pred = m.mk_true();
             ctx = m_contexts[m_num_contexts-1];
         }
         else {
             if (m_contexts.size() < m_max_num_contexts) {
-                m_contexts.push_back(alloc(smt::solver, m, m_fparams));
+                m_contexts.push_back(alloc(smt::kernel, m, m_fparams));
             }
             std::stringstream name;
             name << "#context" << m_num_contexts;

File src/muz_qe/pdr_smt_context_manager.h

View file
  • Ignore whitespace
 #ifndef _PDR_SMT_CONTEXT_MANAGER_H_
 #define _PDR_SMT_CONTEXT_MANAGER_H_
 
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "sat_solver.h"
 #include "func_decl_dependencies.h"
 
     };
 
     class _smt_context : public smt_context {
-        smt::solver & m_context;
+        smt::kernel & m_context;
     public:
-        _smt_context(smt::solver & ctx, smt_context_manager& p, app* pred); 
+        _smt_context(smt::kernel & ctx, smt_context_manager& p, app* pred); 
         virtual ~_smt_context() {}
         virtual void assert_expr(expr* e);
         virtual lbool check(expr_ref_vector& assumptions);
     class sat_context : public smt_context {
         sat::solver m_solver;
     public:
-        sat_context(smt::solver & ctx, smt_context_manager& p, app* pred); 
+        sat_context(smt::kernel & ctx, smt_context_manager& p, app* pred); 
         virtual ~sat_context() {}
         virtual void assert_expr(expr* e);
         virtual lbool check(expr_ref_vector& assumptions);
         front_end_params&        m_fparams;
         ast_manager&             m;
         unsigned                 m_max_num_contexts;
-        ptr_vector<smt::solver>  m_contexts;
+        ptr_vector<smt::kernel>  m_contexts;
         unsigned                 m_num_contexts;
         app_ref_vector           m_predicate_list;
         func_decl_set            m_predicate_set;        

File src/muz_qe/qe.cpp

View file
  • Ignore whitespace
 #include "bool_rewriter.h"
 #include "dl_util.h"
 #include "th_rewriter.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "model_evaluator.h"
 #include "has_free_vars.h"
 #include "rewriter_def.h"
         ast_manager&                m;
         quant_elim&                 m_qe;
         th_rewriter                 m_rewriter;
-        smt::solver                 m_solver;
+        smt::kernel                 m_solver;
         bv_util                     m_bv;
         expr_ref_vector             m_literals;
 

File src/muz_qe/qe_sat_tactic.cpp

View file
  • Ignore whitespace
 #include "qe_sat_tactic.h"
 #include "quant_hoist.h"
 #include "ast_pp.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "qe.h"
 #include "cooperate.h"
 #include "model_v2_pp.h"
         bool                    m_strong_context_simplify_param;
         bool                    m_ctx_simplify_local_param;
         vector<app_ref_vector>  m_vars;
-        ptr_vector<smt::solver> m_solvers;
-        smt::solver             m_solver;
+        ptr_vector<smt::kernel> m_solvers;
+        smt::kernel             m_solver;
         expr_ref                m_fml;
         expr_ref_vector         m_Ms;
         expr_ref_vector         m_assignments;
  
             ast_manager&   m;
             sat_tactic&    m_super;
-            smt::solver&   m_solver;
+            smt::kernel&   m_solver;
             atom_set       m_pos;
             atom_set       m_neg;
             app_ref_vector m_vars;
         void init_Ms() {
             for (unsigned i = 0; i < num_alternations(); ++i) {
                 m_Ms.push_back(m.mk_true());
-                m_solvers.push_back(alloc(smt::solver, m, m_fparams, m_params));
+                m_solvers.push_back(alloc(smt::kernel, m, m_fparams, m_params));
             }
             m_Ms.push_back(m_fml);
-            m_solvers.push_back(alloc(smt::solver, m, m_fparams, m_params));   
+            m_solvers.push_back(alloc(smt::kernel, m, m_fparams, m_params));   
             m_solvers.back()->assert_expr(m_fml);
         }
 
 
         app_ref_vector const& vars(unsigned i) { return m_vars[i]; }
 
-        smt::solver& solver(unsigned i) { return *m_solvers[i]; }
+        smt::kernel& solver(unsigned i) { return *m_solvers[i]; }
 
         void reset() {
             m_fml = 0;
             remove_duplicates(pos, neg);
 
             // Assumption: B is already asserted in solver[i].
-            smt::solver& solver = *m_solvers[i];
+            smt::kernel& solver = *m_solvers[i];
             solver.push();
             solver.assert_expr(A);
             nnf_strengthen(solver, pos, m.mk_false(), sub);
             return Bnnf;
         }
       
-        void nnf_strengthen(smt::solver& solver, atom_set& atoms, expr* value, expr_substitution& sub) {
+        void nnf_strengthen(smt::kernel& solver, atom_set& atoms, expr* value, expr_substitution& sub) {
             atom_set::iterator it = atoms.begin(), end = atoms.end();
             for (; it != end; ++it) {
                 solver.push();
             return Bnnf;
         }
 
-        void nnf_weaken(smt::solver& solver, expr_ref& B, atom_set& atoms, expr* value, expr_substitution& sub) {
+        void nnf_weaken(smt::kernel& solver, expr_ref& B, atom_set& atoms, expr* value, expr_substitution& sub) {
             atom_set::iterator it = atoms.begin(), end = atoms.end();
             for (; it != end; ++it) {
                 solver.push();
         }
 
         bool is_sat(unsigned i, expr* ctx, model_ref& model) {
-            smt::solver& solver = *m_solvers[i];
+            smt::kernel& solver = *m_solvers[i];
             solver.push();
             solver.assert_expr(ctx);
             lbool r = solver.check();

File src/smt/default_solver.cpp

View file
  • Ignore whitespace
 
 Abstract:
 
-    Wrapps smt::solver as a solver for cmd_context
+    Wrapps smt::kernel as a solver for cmd_context
 
 Author:
 
 
 --*/
 #include"solver.h"
-#include"smt_solver.h"
+#include"smt_kernel.h"
 #include"reg_decl_plugins.h"
 #include"front_end_params.h"
 
 class default_solver : public solver {
     front_end_params * m_params;
-    smt::solver *     m_context;
+    smt::kernel *     m_context;
 public:
     default_solver():m_params(0), m_context(0) {}
 
             ast_manager m;
             reg_decl_plugins(m);
             front_end_params p;
-            smt::solver s(m, p);
+            smt::kernel s(m, p);
             s.collect_param_descrs(r);
         }
         else {
         reset();
         #pragma omp critical (solver)
         {
-            m_context = alloc(smt::solver, m, *m_params);
+            m_context = alloc(smt::kernel, m, *m_params);
         }
         if (logic != symbol::null)
             m_context->set_logic(logic);

File src/smt/default_solver.h

View file
  • Ignore whitespace
 
 Abstract:
 
-    Wrapps smt::solver as a solver for cmd_context
+    Wrapps smt::kernel as a solver for cmd_context and external API
 
 Author:
 

File src/smt/expr_context_simplifier.cpp

View file
  • Ignore whitespace
 #include "expr_context_simplifier.h"
 #include "ast_pp.h"
 #include "obj_hashtable.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "for_each_expr.h"
 
 // table lookup before/after simplification.

File src/smt/expr_context_simplifier.h

View file
  • Ignore whitespace
 #include "obj_hashtable.h"
 #include "basic_simplifier_plugin.h"
 #include "front_end_params.h"
-#include "smt_solver.h"
+#include "smt_kernel.h"
 #include "arith_decl_plugin.h"
 
 class expr_context_simplifier {
     arith_util    m_arith;
     unsigned      m_id;
     func_decl_ref m_fn;
-    smt::solver   m_solver;
+    smt::kernel   m_solver;
     
     void simplify(expr* e, expr_ref& result) { simplify_model_based(e, result); }
     void simplify_basic(expr* fml, expr_ref& result);

File src/smt/ni_solver.cpp

View file
  • Ignore whitespace
     ni_solver.cpp
 
 Abstract:
-    Wrappers for smt::solver that are non-incremental & (quasi-incremental).
+    Wrappers for smt::kernel that are non-incremental & (quasi-incremental).
 
 Author:
 
 
 --*/
 #include"ni_solver.h"
-#include"smt_solver.h"
+#include"smt_kernel.h"
 #include"cmd_context.h"
 
 class ni_smt_solver : public solver {
 protected:
     cmd_context &       m_cmd_ctx;
-    smt::solver *       m_context;
+    smt::kernel *       m_context;
     progress_callback * m_callback;
 public:
     ni_smt_solver(cmd_context & ctx):m_cmd_ctx(ctx), m_context(0), m_callback(0) {}
         reset();
         #pragma omp critical (ni_solver)
         {
-            m_context = alloc(smt::solver, m_cmd_ctx.m(), m_cmd_ctx.params());
+            m_context = alloc(smt::kernel, m_cmd_ctx.m(), m_cmd_ctx.params());
         }
         if (m_cmd_ctx.has_logic())
             m_context->set_logic(m_cmd_ctx.get_logic());
 
 
     virtual void collect_param_descrs(param_descrs & r) {
-        smt::solver::collect_param_descrs(r);
+        smt::kernel::collect_param_descrs(r);
     }
 
 };

File src/smt/smt_implied_equalities.cpp

View file
  • Ignore whitespace
     class get_implied_equalities_impl {
         
         ast_manager&                       m;
-        smt::solver&                       m_solver;
+        smt::kernel&                       m_solver;
         union_find_default_ctx             m_df;
         union_find<union_find_default_ctx> m_uf;
         array_util                         m_array_util;
 
     public:
         
-        get_implied_equalities_impl(smt::solver& s) : m(s.m()), m_solver(s), m_uf(m_df), m_array_util(m), m_stats_calls(0) {}
+        get_implied_equalities_impl(smt::kernel& s) : m(s.m()), m_solver(s), m_uf(m_df), m_array_util(m), m_stats_calls(0) {}
         
         lbool operator()(unsigned num_terms, expr* const* terms, unsigned* class_ids) {
             params_ref p;
     stopwatch get_implied_equalities_impl::s_timer;
     stopwatch get_implied_equalities_impl::s_stats_val_eq_timer;
 
-    lbool implied_equalities(smt::solver& solver, unsigned num_terms, expr* const* terms, unsigned* class_ids) {        
+    lbool implied_equalities(smt::kernel& solver, unsigned num_terms, expr* const* terms, unsigned* class_ids) {        
         get_implied_equalities_impl gi(solver);
         return gi(num_terms, terms, class_ids);
     }

File src/smt/smt_implied_equalities.h

View file
  • Ignore whitespace
 #ifndef __SMT_IMPLIED_EQUALITIES_H__
 #define __SMT_IMPLIED_EQUALITIES_H__
 
-#include"smt_solver.h"
+#include"smt_kernel.h"
 
 
 namespace smt {
         
     lbool implied_equalities(
-        solver& solver,
+        kernel & solver,
         unsigned num_terms, expr* const* terms, 
         unsigned* class_ids);            
 

File src/smt/smt_kernel.cpp

View file
  • Ignore whitespace
+/*++
+Copyright (c) 2012 Microsoft Corporation
+
+Module Name:
+
+    smt_kernel.cpp
+
+Abstract:
+
+    New frontend for smt::context.
+    
+Author:
+
+    Leonardo de Moura (leonardo) 2012-02-09.
+
+Revision History:
+
+--*/
+#include"smt_kernel.h"
+#include"smt_context.h" 
+#include"ast_smt2_pp.h"
+#include"params2front_end_params.h"
+
+namespace smt {
+
+    struct kernel::imp {
+        smt::context m_kernel;
+        params_ref   m_params;
+        
+        imp(ast_manager & m, front_end_params & fp, params_ref const & p):
+            m_kernel(m, fp, p),
+            m_params(p) {
+        }
+
+        front_end_params & fparams() {
+            return m_kernel.get_fparams();
+        }
+
+        params_ref const & params() {
+            return m_params;
+        }
+     
+        ast_manager & m() const {
+            return m_kernel.get_manager();
+        }
+
+        bool set_logic(symbol logic) {
+            return m_kernel.set_logic(logic);
+        }
+        
+        void set_progress_callback(progress_callback * callback) {
+            return m_kernel.set_progress_callback(callback);
+        }
+        
+        void assert_expr(expr * e) {
+            TRACE("smt_kernel", tout << "assert:\n" << mk_ismt2_pp(e, m()) << "\n";);
+            m_kernel.assert_expr(e);
+        }
+        
+        void assert_expr(expr * e, proof * pr) {
+            m_kernel.assert_expr(e, pr);
+        }
+
+        unsigned size() const {
+            return m_kernel.get_num_asserted_formulas();
+        }
+        
+        expr * const * get_formulas() const {
+            return m_kernel.get_asserted_formulas();
+        }
+        
+        bool reduce() {
+            return m_kernel.reduce_assertions();
+        }
+        
+        void push() {
+            TRACE("smt_kernel", tout << "push()\n";);
+            m_kernel.push();
+        }
+
+        void pop(unsigned num_scopes) {
+            TRACE("smt_kernel", tout << "pop()\n";);
+            m_kernel.pop(num_scopes);
+        }
+        
+        unsigned get_scope_level() const {
+            return m_kernel.get_scope_level();
+        }
+
+        lbool setup_and_check() {
+            return m_kernel.setup_and_check();
+        }
+
+        bool inconsistent() {
+            return m_kernel.inconsistent();
+        }
+        
+        lbool check(unsigned num_assumptions, expr * const * assumptions) {
+            return m_kernel.check(num_assumptions, assumptions);
+        }
+        
+        void get_model(model_ref & m) const {
+            m_kernel.get_model(m);
+        }
+
+        proof * get_proof() {
+            return m_kernel.get_proof();
+        }
+
+        unsigned get_unsat_core_size() const {
+            return m_kernel.get_unsat_core_size();
+        }
+        
+        expr * get_unsat_core_expr(unsigned idx) const {
+            return m_kernel.get_unsat_core_expr(idx);
+        }
+        
+        failure last_failure() const {
+            return m_kernel.get_last_search_failure();
+        }
+        
+        std::string last_failure_as_string() const {
+            return m_kernel.last_failure_as_string();
+        }
+
+        void get_assignments(expr_ref_vector & result) {
+            m_kernel.get_assignments(result);
+        }
+        
+        void get_relevant_labels(expr * cnstr, buffer<symbol> & result) {
+            m_kernel.get_relevant_labels(cnstr, result);
+        }
+        
+        void get_relevant_labeled_literals(bool at_lbls, expr_ref_vector & result) {
+            m_kernel.get_relevant_labeled_literals(at_lbls, result);
+        }
+
+        void get_relevant_literals(expr_ref_vector & result) {
+            m_kernel.get_relevant_literals(result);
+        }
+        
+        void get_guessed_literals(expr_ref_vector & result) {
+            m_kernel.get_guessed_literals(result);
+        }
+
+        void display(std::ostream & out) const {
+            // m_kernel.display(out); <<< for external users it is just junk
+            // TODO: it will be replaced with assertion_stack.display
+            unsigned num = m_kernel.get_num_asserted_formulas();
+            expr * const * fms = m_kernel.get_asserted_formulas();
+            out << "(kernel";
+            for (unsigned i = 0; i < num; i++) {
+                out << "\n  " << mk_ismt2_pp(fms[i], m(), 2);
+            }
+            out << ")";
+        }
+        
+        void collect_statistics(::statistics & st) const {
+            m_kernel.collect_statistics(st);
+        }
+        
+        void reset_statistics() {
+        }
+
+        void display_statistics(std::ostream & out) const {
+            m_kernel.display_statistics(out);
+        }
+        
+        void display_istatistics(std::ostream & out) const {
+            m_kernel.display_istatistics(out);
+        }
+
+        void set_cancel(bool f) {
+            m_kernel.set_cancel_flag(f);
+        }
+        
+        bool canceled() {
+            return m_kernel.get_cancel_flag();
+        }
+
+        void updt_params(params_ref const & p) {
+            params2front_end_params(p, fparams());
+        }
+    };
+
+    kernel::kernel(ast_manager & m, front_end_params & fp, params_ref const & p) {
+        m_imp = alloc(imp, m, fp, p);
+    }
+
+    kernel::~kernel() {
+        dealloc(m_imp);
+    }
+
+    ast_manager & kernel::m() const {
+        return m_imp->m();
+    }
+
+    bool kernel::set_logic(symbol logic) {
+        return m_imp->set_logic(logic);
+    }
+
+    void kernel::set_progress_callback(progress_callback * callback) {
+        m_imp->set_progress_callback(callback);
+    }
+
+    void kernel::assert_expr(expr * e) {
+        m_imp->assert_expr(e);
+    }
+
+    void kernel::assert_expr(expr * e, proof * pr) {
+        m_imp->assert_expr(e, pr);
+    }
+
+    unsigned kernel::size() const {
+        return m_imp->size();
+    }
+    
+    expr * const * kernel::get_formulas() const {
+        return m_imp->get_formulas();
+    }
+
+    bool kernel::reduce() {
+        return m_imp->reduce();
+    }
+
+    void kernel::push() {
+        m_imp->push();
+    }
+
+    void kernel::pop(unsigned num_scopes) {
+        m_imp->pop(num_scopes);
+    }
+
+    unsigned kernel::get_scope_level() const {
+        return m_imp->get_scope_level();
+    }
+
+    void kernel::reset() {
+        ast_manager & _m       = m();
+        front_end_params & fps = m_imp->fparams();
+        params_ref ps          = m_imp->params();
+        #pragma omp critical (smt_kernel)
+        {
+            dealloc(m_imp);
+            m_imp = alloc(imp, _m, fps, ps);
+        }
+    }
+
+    bool kernel::inconsistent() {
+        return m_imp->inconsistent();
+    }
+
+    lbool kernel::setup_and_check() {
+        set_cancel(false);
+        return m_imp->setup_and_check();
+    }
+
+    lbool kernel::check(unsigned num_assumptions, expr * const * assumptions) {
+        set_cancel(false);
+        lbool r = m_imp->check(num_assumptions, assumptions);
+        TRACE("smt_kernel", tout << "check result: " << r << "\n";);
+        return r;
+    }
+
+    void kernel::get_model(model_ref & m) const {
+        m_imp->get_model(m);
+    }
+
+    proof * kernel::get_proof() {
+        return m_imp->get_proof();
+    }
+
+    unsigned kernel::get_unsat_core_size() const {
+        return m_imp->get_unsat_core_size();
+    }
+        
+    expr * kernel::get_unsat_core_expr(unsigned idx) const {
+        return m_imp->get_unsat_core_expr(idx);
+    }
+
+    failure kernel::last_failure() const {
+        return m_imp->last_failure();
+    }
+
+    std::string kernel::last_failure_as_string() const {
+        return m_imp->last_failure_as_string();
+    }
+
+    void kernel::get_assignments(expr_ref_vector & result) {
+        m_imp->get_assignments(result);
+    }
+        
+    void kernel::get_relevant_labels(expr * cnstr, buffer<symbol> & result) {
+        m_imp->get_relevant_labels(cnstr, result);
+    }
+    
+    void kernel::get_relevant_labeled_literals(bool at_lbls, expr_ref_vector & result) {
+        m_imp->get_relevant_labeled_literals(at_lbls, result);
+    }
+
+    void kernel::get_relevant_literals(expr_ref_vector & result) {
+        m_imp->get_relevant_literals(result);
+    }
+
+    void kernel::get_guessed_literals(expr_ref_vector & result) {
+        m_imp->get_guessed_literals(result);
+    }
+
+    void kernel::display(std::ostream & out) const {
+        m_imp->display(out);
+    }
+
+    void kernel::collect_statistics(::statistics & st) const {
+        m_imp->collect_statistics(st);
+    }
+        
+    void kernel::reset_statistics() {
+        m_imp->reset_statistics();
+    }
+
+    void kernel::display_statistics(std::ostream & out) const {
+        m_imp->display_statistics(out);
+    }
+
+    void kernel::display_istatistics(std::ostream & out) const {
+        m_imp->display_istatistics(out);
+    }
+
+    void kernel::set_cancel(bool f) {
+        #pragma omp critical (smt_kernel)
+        {
+            if (m_imp)
+                m_imp->set_cancel(f);
+        }
+    }
+
+    bool kernel::canceled() const {
+        return m_imp->canceled();
+    }
+
+    void kernel::updt_params(params_ref const & p) {
+        return m_imp->updt_params(p);
+    }
+
+    void kernel::collect_param_descrs(param_descrs & d) {
+        solver_front_end_params_descrs(d);
+    }
+
+    context & kernel::get_context() {
+        return m_imp->m_kernel;
+    }
+
+};

File src/smt/smt_kernel.h

View file
  • Ignore whitespace
+/*++
+Copyright (c) 2012 Microsoft Corporation
+
+Module Name:
+
+    smt_kernel.h
+
+Abstract:
+
+    New frontend for smt::context.
+    The "kernel" tries to hide details of the smt::context object.
+    From now on, clients (code outside of the smt module) should be use smt::kernel instead of smt::context.
+    
+Author:
+
+    Leonardo de Moura (leonardo) 2012-02-09.
+
+Revision History:
+
+    I initially called it smt::solver. This was confusing to others since we have the abstract solver API,
+    and smt::kernel is not a subclass of ::solver.
+    To increase the confusion I had a class default_solver that implemented the solver API on top of smt::context.
+    To avoid this problem I renamed them in the following way:
+        smt::solver     ---> smt::kernel
+        default_solver  ---> smt::solver
+--*/
+#ifndef _SMT_KERNEL_H_
+#define _SMT_KERNEL_H_
+
+#include"ast.h"
+#include"params.h"
+#include"model.h"
+#include"lbool.h"
+#include"statistics.h"
+#include"smt_failure.h"
+
+struct front_end_params;
+class progress_callback;
+
+namespace smt {
+
+    class enode;
+    class context;
+    
+    class kernel {
+        struct imp;
+        imp *  m_imp;
+    public:
+        kernel(ast_manager & m, front_end_params & fp, params_ref const & p = params_ref());
+
+        ~kernel();
+
+        ast_manager & m() const;
+        
+        /**
+           \brief Set logic. It must be invoked before any assertions.
+           Return true if succeeded.
+        */
+        bool set_logic(symbol logic);
+
+        /**
+           brief Set progress meter. Kernel will invoke the callback from time to time.
+        */
+        void set_progress_callback(progress_callback * callback);
+
+        /**
+           \brief Assert the given assetion into the logical context.
+           This method uses the "asserted" proof as a justification for e.
+        */
+        void assert_expr(expr * e);
+        
+        /**
+           \brief Assert the given assertion with the given proof as a justification.
+        */
+        void assert_expr(expr * e, proof * pr);
+
+        /**
+           \brief Return the number of asserted formulas in the kernel.
+        */
+        unsigned size() const;
+        
+        /**
+           \brief Return the array of asserted formulas.
+        */
+        expr * const * get_formulas() const;
+        
+        /**
+           \brief Reduce the set of asserted formulas using preprocessors.
+           Return true if an inconsistency is detected.
+           
+           \remark This is mainly used by dl_smt_relation. This method 
+           seens to be misplaced. This is not the right place.
+        */
+        bool reduce();
+
+        /**
+           \brief Create a backtracking point (aka scope level).
+        */
+        void push();
+
+        /**
+           \brief Backtrack the given number of scope levels.
+        */
+        void pop(unsigned num_scopes);
+
+        /**
+           \brief Return the number of backtracking points.
+        */
+        unsigned get_scope_level() const;
+
+        /**
+           \brief Reset the kernel.
+           All assertions are erased.
+        */
+        void reset();
+
+        /**
+           \brief Return true if the set of asserted formulas is known to be inconsistent.
+        */
+        bool inconsistent();
+
+        /**
+           \brief Setup the logical context and invoke check.
+        */
+        lbool setup_and_check();
+        
+        /**
+           \brief Satisfiability check.
+        */
+        lbool check(unsigned num_assumptions = 0, expr * const * assumptions = 0);
+
+        /**
+           \brief Return the model associated with the last check command.
+        */
+        void get_model(model_ref & m) const;
+
+        /**
+           \brief Return the proof of unsatisfiability associated with the last check command.
+        */
+        proof * get_proof();
+
+        /**
+           \brief Return the size of the unsat core associated with the last check command.
+        */
+        unsigned get_unsat_core_size() const;
+        
+        /**
+           \brief Return the i-th expression in the unsat core associated with the last check command.
+
+           \pre i < get_unsat_core_size()
+        */
+        expr * get_unsat_core_expr(unsigned i) const;
+
+        /**
+           \brief Return the reason for failure for the last check command.
+           Failure means, it returned l_undef
+        */
+        failure last_failure() const;
+
+        /**
+           \brief Return a string describing the failure.
+        */
+        std::string last_failure_as_string() const;
+
+        /**
+           \brief Return the set of formulas assigned by the kernel.
+        */
+        void get_assignments(expr_ref_vector & result);
+        
+        /**
+           \brief Return the set of relevant labels in the last check command.
+        */
+        void get_relevant_labels(expr * cnstr, buffer<symbol> & result);
+
+        /**
+           \brief Return the relevant labeled_literals in the last check command.
+        */
+        void get_relevant_labeled_literals(bool at_lbls, expr_ref_vector & result);
+
+        /**
+           \brief Return the relevant literals in the last check command.
+        */
+        void get_relevant_literals(expr_ref_vector & result);
+
+        /**
+           \brief Return the set of guessed literals (decisions) performed in the last check command.
+        */
+        void get_guessed_literals(expr_ref_vector & result);
+
+        /**
+           \brief (For debubbing purposes) Prints the state of the kernel
+        */
+        void display(std::ostream & out) const;
+
+        /**
+           \brief Collect runtime statistics.
+         */
+        void collect_statistics(::statistics & st) const;
+        
+        /**
+           \brief Reset kernel statistics.
+        */
+        void reset_statistics();
+
+        /**
+           \brief Display statistics.
+        */
+        void display_statistics(std::ostream & out) const;
+
+        /**
+           \brief Display statistics in low level format.
+        */
+        void display_istatistics(std::ostream & out) const;
+        
+        /**
+           \brief Interrupt the kernel. 
+        */
+        void set_cancel(bool f = true);
+        void cancel() { set_cancel(true); }
+
+        /**
+           \brief Reset interruption.
+        */
+        void reset_cancel() { set_cancel(false); }
+        
+        /**
+           \brief Return true if the kernel was interrupted.
+        */
+        bool canceled() const;
+        
+        /**
+           \brief Update configuration parameters.
+        */
+        void updt_params(params_ref const & p);
+
+        /**
+           \brief Collect a description of the configuration parameters.
+        */
+        static void collect_param_descrs(param_descrs & d);
+
+        /**
+           \brief Return a reference to smt::context.
+           This is a temporary hack to support user theories.
+           TODO: remove this hack.
+           We need to revamp user theories too.
+
+           This method breaks the abstraction barrier.
+
+           \warning We should not use this method
+        */
+        context & get_context();
+    };
+};
+
+#endif

File src/smt/smt_model_checker.cpp

View file
  • Ignore whitespace
         SASSERT(m_qm == 0); 
         SASSERT(m_context == 0); 
         m_qm = &qm;
-        m_context = &(m_qm->kernel());
+        m_context = &(m_qm->get_context());
     }
 
     /**

File src/smt/smt_quantifier.cpp

View file
  • Ignore whitespace
         dealloc(m_imp);
     }
         
-    context & quantifier_manager::kernel() const {
+    context & quantifier_manager::get_context() const {
         return m_imp->m_context;
     }
 
         virtual void set_manager(quantifier_manager & qm) {
             SASSERT(m_qm == 0);
             m_qm            = &qm;
-            m_context       = &(qm.kernel());
+            m_context       = &(qm.get_context());
             m_fparams       = &(m_context->get_fparams());
             ast_manager & m = m_context->get_manager();
 

File src/smt/smt_quantifier.h

View file
  • Ignore whitespace
         quantifier_manager(context & ctx, front_end_params & fp, params_ref const & p);
         ~quantifier_manager();
         
-        context & kernel() const;
+        context & get_context() const;
 
         void set_plugin(quantifier_manager_plugin * plugin);
 

File src/smt/smt_solver.cpp

  • Ignore whitespace
-/*++
-Copyright (c) 2012 Microsoft Corporation
-
-Module Name:
-
-    smt_solver.h
-
-Abstract:
-
-    New frontend for the incremental solver.
-    
-Author:
-
-    Leonardo de Moura (leonardo) 2012-02-09.
-
-Revision History:
-
---*/
-#include"smt_solver.h"
-#include"smt_context.h" 
-#include"ast_smt2_pp.h"
-#include"params2front_end_params.h"
-
-namespace smt {
-
-    struct solver::imp {
-        smt::context m_kernel;
-        params_ref   m_params;
-        
-        imp(ast_manager & m, front_end_params & fp, params_ref const & p):
-            m_kernel(m, fp, p),
-            m_params(p) {
-        }
-
-        front_end_params & fparams() {
-            return m_kernel.get_fparams();
-        }
-
-        params_ref const & params() {
-            return m_params;
-        }
-     
-        ast_manager & m() const {
-            return m_kernel.get_manager();
-        }
-
-        bool set_logic(symbol logic) {
-            return m_kernel.set_logic(logic);
-        }
-        
-        void set_progress_callback(progress_callback * callback) {
-            return m_kernel.set_progress_callback(callback);
-        }
-        
-        void assert_expr(expr * e) {
-            TRACE("smt_solver", tout << "assert:\n" << mk_ismt2_pp(e, m()) << "\n";);
-            m_kernel.assert_expr(e);
-        }
-        
-        void assert_expr(expr * e, proof * pr) {
-            m_kernel.assert_expr(e, pr);
-        }
-
-        unsigned size() const {
-            return m_kernel.get_num_asserted_formulas();
-        }
-        
-        expr * const * get_formulas() const {
-            return m_kernel.get_asserted_formulas();
-        }
-        
-        bool reduce() {
-            return m_kernel.reduce_assertions();
-        }
-        
-        void push() {
-            TRACE("smt_solver", tout << "push()\n";);
-            m_kernel.push();
-        }
-
-        void pop(unsigned num_scopes) {
-            TRACE("smt_solver", tout << "pop()\n";);
-            m_kernel.pop(num_scopes);
-        }
-        
-        unsigned get_scope_level() const {
-            return m_kernel.get_scope_level();
-        }
-
-        lbool setup_and_check() {
-            return m_kernel.setup_and_check();
-        }
-
-        bool inconsistent() {
-            return m_kernel.inconsistent();
-        }
-        
-        lbool check(unsigned num_assumptions, expr * const * assumptions) {
-            return m_kernel.check(num_assumptions, assumptions);
-        }
-        
-        void get_model(model_ref & m) const {
-            m_kernel.get_model(m);
-        }
-
-        proof * get_proof() {
-            return m_kernel.get_proof();
-        }
-
-        unsigned get_unsat_core_size() const {
-            return m_kernel.get_unsat_core_size();
-        }
-        
-        expr * get_unsat_core_expr(unsigned idx) const {
-            return m_kernel.get_unsat_core_expr(idx);
-        }
-        
-        failure last_failure() const {
-            return m_kernel.get_last_search_failure();
-        }
-        
-        std::string last_failure_as_string() const {
-            return m_kernel.last_failure_as_string();
-        }
-
-        void get_assignments(expr_ref_vector & result) {
-            m_kernel.get_assignments(result);
-        }
-        
-        void get_relevant_labels(expr * cnstr, buffer<symbol> & result) {
-            m_kernel.get_relevant_labels(cnstr, result);
-        }
-        
-        void get_relevant_labeled_literals(bool at_lbls, expr_ref_vector & result) {
-            m_kernel.get_relevant_labeled_literals(at_lbls, result);
-        }
-
-        void get_relevant_literals(expr_ref_vector & result) {
-            m_kernel.get_relevant_literals(result);
-        }
-        
-        void get_guessed_literals(expr_ref_vector & result) {
-            m_kernel.get_guessed_literals(result);
-        }
-
-        void display(std::ostream & out) const {
-            // m_kernel.display(out); <<< for external users it is just junk
-            // TODO: it will be replaced with assertion_stack.display
-            unsigned num = m_kernel.get_num_asserted_formulas();
-            expr * const * fms = m_kernel.get_asserted_formulas();
-            out << "(solver";
-            for (unsigned i = 0; i < num; i++) {
-                out << "\n  " << mk_ismt2_pp(fms[i], m(), 2);
-            }
-            out << ")";
-        }
-        
-        void collect_statistics(::statistics & st) const {
-            m_kernel.collect_statistics(st);
-        }
-        
-        void reset_statistics() {
-        }
-
-        void display_statistics(std::ostream & out) const {
-            m_kernel.display_statistics(out);
-        }
-        
-        void display_istatistics(std::ostream & out) const {
-            m_kernel.display_istatistics(out);
-        }
-
-        void set_cancel(bool f) {
-            m_kernel.set_cancel_flag(f);
-        }
-        
-        bool canceled() {
-            return m_kernel.get_cancel_flag();
-        }
-
-        void updt_params(params_ref const & p) {
-            params2front_end_params(p, fparams());
-        }
-    };
-
-    solver::solver(ast_manager & m, front_end_params & fp, params_ref const & p) {
-        m_imp = alloc(imp, m, fp, p);
-    }
-
-    solver::~solver() {
-        dealloc(m_imp);
-    }
-
-    ast_manager & solver::m() const {
-        return m_imp->m();
-    }
-
-    bool solver::set_logic(symbol logic) {
-        return m_imp->set_logic(logic);
-    }
-
-    void solver::set_progress_callback(progress_callback * callback) {
-        m_imp->set_progress_callback(callback);
-    }
-
-    void solver::assert_expr(expr * e) {
-        m_imp->assert_expr(e);
-    }
-
-    void solver::assert_expr(expr * e, proof * pr) {
-        m_imp->assert_expr(e, pr);
-    }
-
-    unsigned solver::size() const {
-        return m_imp->size();
-    }
-    
-    expr * const * solver::get_formulas() const {
-        return m_imp->get_formulas();
-    }
-
-    bool solver::reduce() {
-        return m_imp->reduce();
-    }
-
-    void solver::push() {
-        m_imp->push();
-    }
-
-    void solver::pop(unsigned num_scopes) {
-        m_imp->pop(num_scopes);
-    }
-
-    unsigned solver::get_scope_level() const {
-        return m_imp->get_scope_level();
-    }
-
-    void solver::reset() {
-        ast_manager & _m       = m();
-        front_end_params & fps = m_imp->fparams();
-        params_ref ps          = m_imp->params();
-        #pragma omp critical (smt_solver)
-        {
-            dealloc(m_imp);
-            m_imp = alloc(imp, _m, fps, ps);
-        }
-    }
-
-    bool solver::inconsistent() {
-        return m_imp->inconsistent();
-    }
-
-    lbool solver::setup_and_check() {
-        set_cancel(false);
-        return m_imp->setup_and_check();
-    }
-
-    lbool solver::check(unsigned num_assumptions, expr * const * assumptions) {
-        set_cancel(false);
-        lbool r = m_imp->check(num_assumptions, assumptions);
-        TRACE("smt_solver", tout << "check result: " << r << "\n";);
-        return r;
-    }
-
-    void solver::get_model(model_ref & m) const {
-        m_imp->get_model(m);
-    }
-
-    proof * solver::get_proof() {
-        return m_imp->get_proof();
-    }
-
-    unsigned solver::get_unsat_core_size() const {
-        return m_imp->get_unsat_core_size();
-    }
-        
-    expr * solver::get_unsat_core_expr(unsigned idx) const {
-        return m_imp->get_unsat_core_expr(idx);
-    }
-
-    failure solver::last_failure() const {
-        return m_imp->last_failure();
-    }
-
-    std::string solver::last_failure_as_string() const {
-        return m_imp->last_failure_as_string();
-    }
-
-    void solver::get_assignments(expr_ref_vector & result) {
-        m_imp->get_assignments(result);
-    }
-        
-    void solver::get_relevant_labels(expr * cnstr, buffer<symbol> & result) {
-        m_imp->get_relevant_labels(cnstr, result);
-    }
-    
-    void solver::get_relevant_labeled_literals(bool at_lbls, expr_ref_vector & result) {
-        m_imp->get_relevant_labeled_literals(at_lbls, result);
-    }
-
-    void solver::get_relevant_literals(expr_ref_vector & result) {
-        m_imp->get_relevant_literals(result);
-    }
-
-    void solver::get_guessed_literals(expr_ref_vector & result) {
-        m_imp->get_guessed_literals(result);
-    }
-
-    void solver::display(std::ostream & out) const {
-        m_imp->display(out);
-    }
-
-    void solver::collect_statistics(::statistics & st) const {
-        m_imp->collect_statistics(st);
-    }
-        
-    void solver::reset_statistics() {
-        m_imp->reset_statistics();
-    }
-
-    void solver::display_statistics(std::ostream & out) const {
-        m_imp->display_statistics(out);
-    }
-
-    void solver::display_istatistics(std::ostream & out) const {
-        m_imp->display_istatistics(out);
-    }
-
-    void solver::set_cancel(bool f) {
-        #pragma omp critical (smt_solver)
-        {
-            if (m_imp)
-                m_imp->set_cancel(f);
-        }
-    }
-
-    bool solver::canceled() const {
-        return m_imp->canceled();
-    }
-
-    void solver::updt_params(params_ref const & p) {
-        return m_imp->updt_params(p);
-    }
-
-    void solver::collect_param_descrs(param_descrs & d) {
-        solver_front_end_params_descrs(d);
-    }
-
-    context & solver::kernel() {
-        return m_imp->m_kernel;
-    }
-
-};

File src/smt/smt_solver.h

  • Ignore whitespace
-/*++
-Copyright (c) 2012 Microsoft Corporation
-
-Module Name:
-
-    smt_solver.h
-
-Abstract:
-
-    New frontend for the incremental solver.
-    
-Author:
-
-    Leonardo de Moura (leonardo) 2012-02-09.
-
-Revision History:
-
---*/
-#ifndef _SMT_SOLVER_H_
-#define _SMT_SOLVER_H_
-
-#include"ast.h"
-#include"params.h"
-#include"model.h"
-#include"lbool.h"
-#include"statistics.h"
-#include"smt_failure.h"
-
-struct front_end_params;
-class progress_callback;
-
-namespace smt {
-
-    class enode;
-    class context;
-    
-    class solver {
-        struct imp;
-        imp *  m_imp;
-    public:
-        solver(ast_manager & m, front_end_params & fp, params_ref const & p = params_ref());
-
-        ~solver();
-
-        ast_manager & m() const;
-        
-        /**
-           \brief Set logic. It must be invoked before any assertions.
-           Return true if succeeded.
-        */
-        bool set_logic(symbol logic);
-
-        /**
-           brief Set progress meter. Solver will invoke the callback from time to time.
-        */
-        void set_progress_callback(progress_callback * callback);
-
-        /**
-           \brief Assert the given assetion into the logical context.
-           This method uses the "asserted" proof as a justification for e.
-        */
-        void assert_expr(expr * e);
-        
-        /**
-           \brief Assert the given assertion with the given proof as a justification.
-        */
-        void assert_expr(expr * e, proof * pr);
-
-        /**
-           \brief Return the number of asserted formulas in the solver.
-        */
-        unsigned size() const;
-        
-        /**
-           \brief Return the array of asserted formulas.
-        */
-        expr * const * get_formulas() const;
-        
-        /**
-           \brief Reduce the set of asserted formulas using preprocessors.
-           Return true if an inconsistency is detected.
-           
-           \remark This is mainly used by dl_smt_relation. This method 
-           seens to be misplaced. This is not the right place.
-        */
-        bool reduce();
-
-        /**
-           \brief Create a backtracking point (aka scope level).
-        */
-        void push();
-
-        /**
-           \brief Backtrack the given number of scope levels.
-        */