3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-05-23 10:29:38 +00:00

Complete theory_finite_set.h header and implement finite set theory solver (#7976)

* Initial plan

* Implement theory_finite_set header and implementation

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Add theory registration to smt_setup

Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>

* Update theory_finite_set.cpp

* Refactor membership_atoms and add elements list

Renamed membership_atoms to membership_elements and added elements list.

* Change membership elements to use enode type

* Update theory_finite_set.cpp

* Fix typo in internalize_atom function

* Update theory_finite_set.cpp

* Refactor final_check_eh by removing comments

Removed redundant comments and cleaned up code.

* Add m_lemmas member to theory_finite_set class

* Improve clause management and instantiation logic

Refactor clause handling and instantiate logic in finite set theory.

* Add friend class declaration for testing

* Add placeholder methods for lemma instantiation

Added placeholder methods for lemma instantiation.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: NikolajBjorner <3085284+NikolajBjorner@users.noreply.github.com>
Co-authored-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Copilot 2025-10-15 14:55:08 +02:00 committed by GitHub
parent 7446112fbe
commit b4d41ffe81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 248 additions and 2 deletions

View file

@ -86,13 +86,42 @@ theory_finite_set.cpp.
#include "ast/ast.h"
#include "ast/ast_pp.h"
#include "ast/finite_set_decl_plugin.h"
#include "ast/rewriter/finite_set_axioms.h"
#include "smt/smt_theory.h"
namespace smt {
class theory_finite_set : public theory {
friend class theory_finite_set_test;
finite_set_util u;
finite_set_axioms m_axioms;
obj_hashtable<enode> m_elements; // set of all 'x' where there is an 'x in S' atom
vector<expr_ref_vector> m_lemmas;
protected:
// Override relevant methods from smt::theory
bool internalize_atom(app * atom, bool gate_ctx) override;
bool internalize_term(app * term) override;
void new_eq_eh(theory_var v1, theory_var v2) override;
void new_diseq_eh(theory_var v1, theory_var v2) override;
final_check_status final_check_eh() override;
theory * mk_fresh(context * new_ctx) override;
char const * get_name() const override { return "finite_set"; }
void display(std::ostream & out) const override;
void init_model(model_generator & mg) override;
model_value_proc * mk_value(enode * n, model_generator & mg) override;
// Helper methods for axiom instantiation
void instantiate_axioms(expr* elem, expr* set);
void add_clause(expr_ref_vector const& clause);
void instantiate_false_lemma();
void instantiate_unit_propagation();
void instantiate_free_lemma();
public:
theory_finite_set(ast_manager & m);
theory_finite_set(context& ctx);
~theory_finite_set() override {}
};
} // namespace smt
} // namespace smt