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