Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Virtual class for theory engine modules 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__THEORY_ENGINE_MODULE_H 16 : : #define CVC5__THEORY__THEORY_ENGINE_MODULE_H 17 : : 18 : : #include "expr/node.h" 19 : : #include "prop/sat_solver_types.h" 20 : : #include "theory/output_channel.h" 21 : : #include "theory/theory.h" 22 : : 23 : : namespace cvc5::internal { 24 : : 25 : : class TheoryEngine; 26 : : 27 : : namespace theory { 28 : : 29 : : class TheoryModel; 30 : : 31 : : /** 32 : : * A theory engine module shares some functionality with a theory solver 33 : : * but is not associated with a theory. 34 : : * 35 : : * A theory engine module is allowed to send lemmas or conflicts via its 36 : : * output channel (d_out) during check and postCheck. 37 : : */ 38 : : class TheoryEngineModule : protected EnvObj 39 : : { 40 : : public: 41 : : /** 42 : : * @param env The environment 43 : : * @param engine The parent theory engine 44 : : */ 45 : : TheoryEngineModule(Env& env, TheoryEngine* engine, const std::string& name); 46 : 57 : virtual ~TheoryEngineModule() {} 47 : : /** 48 : : * presolve, called at the beginning of each check-sat. 49 : : */ 50 : : virtual void presolve(); 51 : : /** 52 : : * postsolve, called at the end of each check-sat. 53 : : */ 54 : : virtual void postsolve(prop::SatValue result); 55 : : /** 56 : : * check, called at the beginning of a check in TheoryEngine. 57 : : */ 58 : : virtual void check(Theory::Effort effort); 59 : : /** 60 : : * postCheck, called at the end of a check in TheoryEngine. 61 : : */ 62 : : virtual void postCheck(Theory::Effort effort); 63 : : /** 64 : : * Notify that a lemma was sent 65 : : * 66 : : * @param n The lemma, which has been theory preprocessed 67 : : * @param id The inference identifier of the lemma 68 : : * @param p The property of the lemma 69 : : * @param skAsserts The skolem assertions for the given lemma 70 : : * @param sks The skolems for each assertion in skAsserts. 71 : : */ 72 : : virtual void notifyLemma(TNode n, 73 : : InferenceId id, 74 : : LemmaProperty p, 75 : : const std::vector<Node>& skAsserts, 76 : : const std::vector<Node>& sks); 77 : : /** Needs candidate model, return true if the method below requires calling */ 78 : : virtual bool needsCandidateModel(); 79 : : /** Notify that m is a (candidate) model */ 80 : : virtual void notifyCandidateModel(TheoryModel* m); 81 : : /** Get the theory identifier */ 82 : : TheoryId getId() const; 83 : : 84 : : protected: 85 : : /** The output channel, for sending lemmas */ 86 : : OutputChannel d_out; 87 : : /** The name */ 88 : : std::string d_name; 89 : : 90 : : private: 91 : : /** Static allocator of theory module identifiers */ 92 : : static size_t d_idCounter; 93 : : }; 94 : : 95 : : } // namespace theory 96 : : } // namespace cvc5::internal 97 : : 98 : : #endif /* CVC5__THEORY__RELEVANCE_MANAGER__H */