mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-30 19:22:28 +00:00 
			
		
		
		
	reorganizing the code
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
		
							parent
							
								
									61bd5a69ec
								
							
						
					
					
						commit
						12a255e36b
					
				
					 195 changed files with 11 additions and 526 deletions
				
			
		|  | @ -13,7 +13,6 @@ parse_options() | ||||||
| add_lib('util', []) | add_lib('util', []) | ||||||
| add_lib('polynomial', ['util'], 'math/polynomial') | add_lib('polynomial', ['util'], 'math/polynomial') | ||||||
| add_lib('sat', ['util']) | add_lib('sat', ['util']) | ||||||
| # nlsat only reuses the file sat_types.h from sat |  | ||||||
| add_lib('nlsat', ['polynomial', 'sat']) | add_lib('nlsat', ['polynomial', 'sat']) | ||||||
| add_lib('subpaving', ['util'], 'math/subpaving') | add_lib('subpaving', ['util'], 'math/subpaving') | ||||||
| add_lib('ast', ['util', 'polynomial']) | add_lib('ast', ['util', 'polynomial']) | ||||||
|  | @ -32,15 +31,14 @@ add_lib('tactic', ['ast', 'model']) | ||||||
| add_lib('old_params', ['model', 'simplifier']) | add_lib('old_params', ['model', 'simplifier']) | ||||||
| add_lib('cmd_context', ['tactic', 'rewriter', 'model', 'old_params', 'simplifier']) | add_lib('cmd_context', ['tactic', 'rewriter', 'model', 'old_params', 'simplifier']) | ||||||
| add_lib('substitution', ['ast'], 'ast/substitution') | add_lib('substitution', ['ast'], 'ast/substitution') | ||||||
| add_lib('normal_forms', ['tactic', 'old_params']) | add_lib('normal_forms', ['rewriter', 'old_params'], 'ast/normal_forms') | ||||||
| add_lib('pattern', ['normal_forms'], 'ast/pattern') | add_lib('pattern', ['normal_forms'], 'ast/pattern') | ||||||
| add_lib('spc', ['simplifier', 'substitution', 'old_params', 'pattern']) |  | ||||||
| add_lib('parser_util', ['ast']) | add_lib('parser_util', ['ast']) | ||||||
| add_lib('smt2parser', ['cmd_context', 'parser_util']) | add_lib('smt2parser', ['cmd_context', 'parser_util']) | ||||||
| add_lib('macros', ['simplifier', 'old_params'], 'ast/macros') | add_lib('macros', ['simplifier', 'old_params'], 'ast/macros') | ||||||
| add_lib('grobner', ['ast'], 'math/grobner') | add_lib('grobner', ['ast'], 'math/grobner') | ||||||
| add_lib('euclid', ['util'], 'math/euclid') | add_lib('euclid', ['util'], 'math/euclid') | ||||||
| add_lib('proof_checker', ['rewriter', 'spc'], 'ast/proof_checker') | add_lib('proof_checker', ['rewriter', 'old_params'], 'ast/proof_checker') | ||||||
| add_lib('bit_blaster', ['rewriter', 'simplifier', 'old_params', 'tactic'], 'tactic/bit_blaster') | add_lib('bit_blaster', ['rewriter', 'simplifier', 'old_params', 'tactic'], 'tactic/bit_blaster') | ||||||
| add_lib('smt', ['bit_blaster', 'macros', 'normal_forms', 'cmd_context',  | add_lib('smt', ['bit_blaster', 'macros', 'normal_forms', 'cmd_context',  | ||||||
|                 'substitution', 'grobner', 'euclid', 'proof_checker', 'pattern', 'parser_util']) |                 'substitution', 'grobner', 'euclid', 'proof_checker', 'pattern', 'parser_util']) | ||||||
|  | @ -60,7 +58,6 @@ add_lib('aig', ['tactic'], 'tactic/aig') | ||||||
| # TODO: split muz_qe into muz, qe. Perhaps, we should also consider breaking muz into muz and pdr. | # TODO: split muz_qe into muz, qe. Perhaps, we should also consider breaking muz into muz and pdr. | ||||||
| add_lib('muz_qe', ['smt', 'sat', 'smt2parser']) | add_lib('muz_qe', ['smt', 'sat', 'smt2parser']) | ||||||
| add_lib('smtlogic_tactics', ['arith_tactics', 'bv_tactics', 'nlsat_tactic', 'smt_tactic', 'aig', 'muz_qe'], 'tactic/smtlogic_tactics') | add_lib('smtlogic_tactics', ['arith_tactics', 'bv_tactics', 'nlsat_tactic', 'smt_tactic', 'aig', 'muz_qe'], 'tactic/smtlogic_tactics') | ||||||
| # TODO: rewrite ufbv_strategy as a tactic and move to smtlogic_tactics. |  | ||||||
| add_lib('ufbv_tactic', ['normal_forms', 'core_tactics', 'macros', 'smt_tactic', 'rewriter'], 'tactic/ufbv_tactic') | add_lib('ufbv_tactic', ['normal_forms', 'core_tactics', 'macros', 'smt_tactic', 'rewriter'], 'tactic/ufbv_tactic') | ||||||
| add_lib('portfolio', ['smtlogic_tactics', 'ufbv_tactic', 'fpa', 'aig', 'muz_qe', 'sls_tactic', 'subpaving_tactic'], 'tactic/portfolio') | add_lib('portfolio', ['smtlogic_tactics', 'ufbv_tactic', 'fpa', 'aig', 'muz_qe', 'sls_tactic', 'subpaving_tactic'], 'tactic/portfolio') | ||||||
| # TODO: delete SMT 1.0 frontend | # TODO: delete SMT 1.0 frontend | ||||||
|  |  | ||||||
|  | @ -23,7 +23,6 @@ Revision History: | ||||||
| #include"ast_pp.h" | #include"ast_pp.h" | ||||||
| #include"ast_ll_pp.h" | #include"ast_ll_pp.h" | ||||||
| #include"well_sorted.h" | #include"well_sorted.h" | ||||||
| #include"spc_prover.h" |  | ||||||
| #include"model.h" | #include"model.h" | ||||||
| #include"model_v2_pp.h" | #include"model_v2_pp.h" | ||||||
| #include"solver.h" | #include"solver.h" | ||||||
|  |  | ||||||
|  | @ -37,9 +37,6 @@ Revision History: | ||||||
| #include"error_codes.h" | #include"error_codes.h" | ||||||
| #include"pattern_validation.h" | #include"pattern_validation.h" | ||||||
| #include"unifier.h" | #include"unifier.h" | ||||||
| #include"kbo.h" |  | ||||||
| #include"lpo.h" |  | ||||||
| #include"substitution_tree.h" |  | ||||||
| #include"timeit.h" | #include"timeit.h" | ||||||
| #include"var_subst.h" | #include"var_subst.h" | ||||||
| #include"well_sorted.h" | #include"well_sorted.h" | ||||||
|  | @ -2261,23 +2258,6 @@ private: | ||||||
|         symbol datatypes("datatypes"); |         symbol datatypes("datatypes"); | ||||||
|         symbol unify("unify"); |         symbol unify("unify"); | ||||||
|         symbol unify_fail("unify-fail"); |         symbol unify_fail("unify-fail"); | ||||||
| #if    !defined(SMTCOMP) && !defined(_EXTERNAL_RELEASE) |  | ||||||
|         symbol kbo_lt("kbo_lt"); |  | ||||||
|         symbol kbo_gt("kbo_gt"); |  | ||||||
|         symbol kbo_eq("kbo_eq"); |  | ||||||
|         symbol kbo_un("kbo_un"); |  | ||||||
|         symbol lpo_lt("lpo_lt"); |  | ||||||
|         symbol lpo_gt("lpo_gt"); |  | ||||||
|         symbol lpo_eq("lpo_eq"); |  | ||||||
|         symbol lpo_un("lpo_un"); |  | ||||||
|         symbol st_insert("st_insert"); |  | ||||||
|         symbol st_erase("st_erase"); |  | ||||||
|         symbol st_reset("st_reset"); |  | ||||||
|         symbol st_unify("st_unify"); |  | ||||||
|         symbol st_inst("st_inst"); |  | ||||||
|         symbol st_gen("st_gen"); |  | ||||||
|         symbol st_display("st_display"); |  | ||||||
| #endif |  | ||||||
|         symbol assumption("assumption"); |         symbol assumption("assumption"); | ||||||
|         symbol assumption_core("assumption-core"); |         symbol assumption_core("assumption-core"); | ||||||
|         symbol define_sorts_sym("define_sorts"); |         symbol define_sorts_sym("define_sorts"); | ||||||
|  | @ -2427,46 +2407,6 @@ private: | ||||||
|                 ++proto_exprs; |                 ++proto_exprs; | ||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
| #if    !defined(SMTCOMP) && !defined(_EXTERNAL_RELEASE) |  | ||||||
|             if ((kbo_lt == e->string() || kbo_gt == e->string() || kbo_eq == e->string() || kbo_un == e->string()) && e1) { |  | ||||||
|                 if (!test_kbo(e1, e->string())) { |  | ||||||
|                     return false; |  | ||||||
|                 } |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|             if ((lpo_lt == e->string() || lpo_gt == e->string() || lpo_eq == e->string() || lpo_un == e->string()) && e1) { |  | ||||||
|                 if (!test_lpo(e1, e->string())) { |  | ||||||
|                     return false; |  | ||||||
|                 } |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|             if ((st_insert == e->string() || st_erase == e->string()) && e1) { |  | ||||||
|                 if (!test_st(e1, e->string())) { |  | ||||||
|                     return false; |  | ||||||
|                 } |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|             if ((st_unify == e->string() || st_inst == e->string() || st_gen == e->string()) && e1) { |  | ||||||
|                 if (!test_st_visit(e1, e->string())) { |  | ||||||
|                     return false; |  | ||||||
|                 } |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|             if (st_reset == e->string()) { |  | ||||||
|                 m_st.reset(); |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
|             if (st_display == e->string()) { |  | ||||||
|                 m_st.display(std::cout); |  | ||||||
|                 ++proto_exprs; |  | ||||||
|                 continue; |  | ||||||
|             } |  | ||||||
| #endif |  | ||||||
|             if (m_notes == e->string() && e1) { |             if (m_notes == e->string() && e1) { | ||||||
|                 ++proto_exprs; |                 ++proto_exprs; | ||||||
|                 continue; |                 continue; | ||||||
|  | @ -4607,120 +4547,6 @@ private: | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
| #if    !defined(SMTCOMP) && !defined(_EXTERNAL_RELEASE) |  | ||||||
|     bool test_order(proto_expr * e, order & ord, symbol expected) { |  | ||||||
|         proto_expr* const * children = e->children(); |  | ||||||
|         if (!children || !children[0] || !children[1]) { |  | ||||||
|             set_error("invalid unification problem", e); |  | ||||||
|         } |  | ||||||
|          |  | ||||||
|         expr_ref f1(m_manager), f2(m_manager); |  | ||||||
|         if (!make_expression(children[0], f1) || !make_expression(children[1], f2)) |  | ||||||
|             return false; |  | ||||||
|         unsigned num_vars1 = 0; |  | ||||||
|         unsigned num_vars2 = 0; |  | ||||||
|         if (is_forall(f1)) { |  | ||||||
|             num_vars1 = to_quantifier(f1)->get_num_decls(); |  | ||||||
|             f1 = to_quantifier(f1)->get_expr(); |  | ||||||
|         } |  | ||||||
|         if (is_forall(f2)) { |  | ||||||
|             num_vars2 = to_quantifier(f2)->get_num_decls(); |  | ||||||
|             f2 = to_quantifier(f2)->get_expr(); |  | ||||||
|         } |  | ||||||
|         ord.reserve(1, std::max(num_vars1, num_vars2)); |  | ||||||
|         order::result r = ord.compare(f1.get(), f2.get()); |  | ||||||
|         if ((r == order::UNCOMPARABLE && expected != symbol("kbo_un") && expected != symbol("lpo_un")) || |  | ||||||
|             (r == order::LESSER && expected != symbol("kbo_lt") && expected != symbol("lpo_lt")) || |  | ||||||
|             (r == order::GREATER && expected != symbol("kbo_gt") && expected != symbol("lpo_gt")) ||             |  | ||||||
|             (r == order::EQUAL && expected != symbol("kbo_eq") && expected != symbol("lpo_eq")) || |  | ||||||
|             r == order::UNKNOWN) { |  | ||||||
|             get_err() << "WRONG ANSWER\n"; |  | ||||||
|             UNREACHABLE(); |  | ||||||
|         } |  | ||||||
|         else  |  | ||||||
|             std::cout << "order: succeeded\n"; |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     bool test_kbo(proto_expr * e, symbol expected) { |  | ||||||
|         precedence * p = alloc(arbitrary_precedence); |  | ||||||
|         kbo k(m_manager, p); |  | ||||||
|         return test_order(e, k, expected); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     bool test_lpo(proto_expr * e, symbol expected) { |  | ||||||
|         precedence * ps[2] = { alloc(arity_precedence), alloc(arbitrary_precedence) }; |  | ||||||
|         precedence * p  = alloc(lex_precedence, 2, ps); |  | ||||||
|         lpo l(m_manager, p); |  | ||||||
|         return test_order(e, l, expected); |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     bool test_st(proto_expr * e, symbol op) { |  | ||||||
|         expr_ref f(m_manager); |  | ||||||
|         if (!make_expression(e, f)) |  | ||||||
|             return false; |  | ||||||
|          |  | ||||||
|         if (is_forall(f)) |  | ||||||
|             f = to_quantifier(f)->get_expr(); |  | ||||||
| 
 |  | ||||||
|         if (!is_app(f)) |  | ||||||
|             set_error("invalid st operation", e); |  | ||||||
| 
 |  | ||||||
|         if (op == symbol("st_insert")) |  | ||||||
|             m_st.insert(to_app(f)); |  | ||||||
|         else |  | ||||||
|             m_st.erase(to_app(f)); |  | ||||||
| 
 |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|    |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|     class simple_st_visitor : public st_visitor { |  | ||||||
|         unsigned m_delta; |  | ||||||
|     public: |  | ||||||
|         simple_st_visitor(substitution & s, unsigned d):st_visitor(s), m_delta(d) {} |  | ||||||
|         virtual bool operator()(expr * e) {  |  | ||||||
|             std::cout << "found:\n" << mk_pp(e, m_subst.get_manager()) << "\n"; |  | ||||||
|             unsigned deltas[2] = { 0, m_delta }; |  | ||||||
|             std::cout << "substitution:\n"; |  | ||||||
|             // m_subst.display(std::cout); std::cout << "\n";
 |  | ||||||
|             m_subst.display(std::cout, 2, deltas); |  | ||||||
|             std::cout << "\n"; |  | ||||||
|             return true; |  | ||||||
|         } |  | ||||||
|     }; |  | ||||||
| 
 |  | ||||||
|     bool test_st_visit(proto_expr * e, symbol op) { |  | ||||||
|         expr_ref f(m_manager); |  | ||||||
|         if (!make_expression(e, f)) |  | ||||||
|             return false; |  | ||||||
| 
 |  | ||||||
|         unsigned num_vars = 0; |  | ||||||
|         if (is_forall(f)) { |  | ||||||
|             num_vars = to_quantifier(f)->get_num_decls(); |  | ||||||
|             f = to_quantifier(f)->get_expr(); |  | ||||||
|         } |  | ||||||
|         if (!is_app(f)) |  | ||||||
|             set_error("invalid st operation", e); |  | ||||||
|         substitution s(m_manager); |  | ||||||
|         s.reserve(3, std::max(num_vars, m_st.get_approx_num_regs())); |  | ||||||
|          |  | ||||||
|         simple_st_visitor v(s, num_vars); |  | ||||||
|          |  | ||||||
|         std::cout << "searching for " << op << ":\n" << mk_pp(f, m_manager) << "\n\n"; |  | ||||||
|         if (op == symbol("st_unify")) |  | ||||||
|             m_st.unify(to_app(f), v); |  | ||||||
|         else if (op == symbol("st_inst")) |  | ||||||
|             m_st.inst(to_app(f), v); |  | ||||||
|         else  |  | ||||||
|             m_st.gen(to_app(f), v); |  | ||||||
|         std::cout << "done.\n"; |  | ||||||
|         return true; |  | ||||||
|     } |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
|     bool declare_axioms(proto_expr * e) { |     bool declare_axioms(proto_expr * e) { | ||||||
|         proto_expr* const * children = e->children(); |         proto_expr* const * children = e->children(); | ||||||
|         while (children && *children) { |         while (children && *children) { | ||||||
|  |  | ||||||
|  | @ -29,8 +29,6 @@ Notes: | ||||||
| 
 | 
 | ||||||
| #include"ast_smt2_pp.h" | #include"ast_smt2_pp.h" | ||||||
| 
 | 
 | ||||||
| #include"tactical.h" |  | ||||||
| 
 |  | ||||||
| class skolemizer { | class skolemizer { | ||||||
|     typedef act_cache cache; |     typedef act_cache cache; | ||||||
| 
 | 
 | ||||||
|  | @ -51,10 +51,4 @@ public: | ||||||
|     void reset_cache(); |     void reset_cache(); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class tactic; |  | ||||||
| // Skolem Normal Form
 |  | ||||||
| tactic * mk_snf_tactic(ast_manager & m, params_ref const & p = params_ref()); |  | ||||||
| // Negation Normal Form
 |  | ||||||
| tactic * mk_nnf_tactic(ast_manager & m, params_ref const & p = params_ref()); |  | ||||||
| 
 |  | ||||||
| #endif /* _NNF_H_ */ | #endif /* _NNF_H_ */ | ||||||
|  | @ -1,7 +1,7 @@ | ||||||
| #include "proof_checker.h" | #include "proof_checker.h" | ||||||
| #include "ast_ll_pp.h" | #include "ast_ll_pp.h" | ||||||
| #include "ast_pp.h" | #include "ast_pp.h" | ||||||
| #include "spc_decl_plugin.h" | // include "spc_decl_plugin.h"
 | ||||||
| #include "ast_smt_pp.h" | #include "ast_smt_pp.h" | ||||||
| #include "arith_decl_plugin.h" | #include "arith_decl_plugin.h" | ||||||
| #include "front_end_params.h" | #include "front_end_params.h" | ||||||
|  | @ -86,7 +86,7 @@ proof_checker::proof_checker(ast_manager& m) : m_manager(m), m_todo(m), m_marked | ||||||
|         m.register_plugin(fam_name, alloc(hyp_decl_plugin)); |         m.register_plugin(fam_name, alloc(hyp_decl_plugin)); | ||||||
|     } |     } | ||||||
|     m_hyp_fid = m.get_family_id(fam_name); |     m_hyp_fid = m.get_family_id(fam_name); | ||||||
|     m_spc_fid = m.get_family_id("spc"); |     // m_spc_fid = m.get_family_id("spc");
 | ||||||
|     m_nil = m_manager.mk_const(m_hyp_fid, OP_NIL); |     m_nil = m_manager.mk_const(m_hyp_fid, OP_NIL); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -117,13 +117,16 @@ bool proof_checker::check1(proof* p, expr_ref_vector& side_conditions) { | ||||||
|     if (p->get_family_id() == m_manager.get_basic_family_id()) { |     if (p->get_family_id() == m_manager.get_basic_family_id()) { | ||||||
|         return check1_basic(p, side_conditions); |         return check1_basic(p, side_conditions); | ||||||
|     } |     } | ||||||
|  | #if 0 | ||||||
|     if (p->get_family_id() == m_spc_fid) { |     if (p->get_family_id() == m_spc_fid) { | ||||||
|         return check1_spc(p, side_conditions); |         return check1_spc(p, side_conditions); | ||||||
|     } |     } | ||||||
|  | #endif | ||||||
|     return false; |     return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool proof_checker::check1_spc(proof* p, expr_ref_vector& side_conditions) { | bool proof_checker::check1_spc(proof* p, expr_ref_vector& side_conditions) { | ||||||
|  | #if 0 | ||||||
|     decl_kind k = p->get_decl_kind(); |     decl_kind k = p->get_decl_kind(); | ||||||
|     bool is_univ = false; |     bool is_univ = false; | ||||||
|     expr_ref fact(m_manager), fml(m_manager); |     expr_ref fact(m_manager), fml(m_manager); | ||||||
|  | @ -174,6 +177,9 @@ bool proof_checker::check1_spc(proof* p, expr_ref_vector& side_conditions) { | ||||||
|         UNREACHABLE(); |         UNREACHABLE(); | ||||||
|     } |     } | ||||||
|     return false; |     return false; | ||||||
|  | #else | ||||||
|  |     return true; | ||||||
|  | #endif | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { | bool proof_checker::check1_basic(proof* p, expr_ref_vector& side_conditions) { | ||||||
|  |  | ||||||
|  | @ -29,7 +29,7 @@ class proof_checker { | ||||||
|     expr_ref_vector  m_pinned; |     expr_ref_vector  m_pinned; | ||||||
|     obj_map<expr, expr*> m_hypotheses; |     obj_map<expr, expr*> m_hypotheses; | ||||||
|     family_id        m_hyp_fid; |     family_id        m_hyp_fid; | ||||||
|     family_id        m_spc_fid; |     // family_id        m_spc_fid;
 | ||||||
|     app_ref          m_nil; |     app_ref          m_nil; | ||||||
|     bool             m_dump_lemmas; |     bool             m_dump_lemmas; | ||||||
|     std::string      m_logic;  |     std::string      m_logic;  | ||||||
|  |  | ||||||
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