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 : : * Model Builder class. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__QUANTIFIERS__MODEL_BUILDER_H 16 : : #define CVC5__THEORY__QUANTIFIERS__MODEL_BUILDER_H 17 : : 18 : : #include "expr/node.h" 19 : : #include "theory/quantifiers/inst_match.h" 20 : : #include "theory/theory_model_builder.h" 21 : : 22 : : namespace cvc5::internal { 23 : : namespace theory { 24 : : namespace quantifiers { 25 : : 26 : : class FirstOrderModel; 27 : : class QuantifiersState; 28 : : class QuantifiersRegistry; 29 : : class QuantifiersInferenceManager; 30 : : class TermRegistry; 31 : : 32 : : class QModelBuilder : public TheoryEngineModelBuilder 33 : : { 34 : : protected: 35 : : // must call preProcessBuildModelStd 36 : : bool preProcessBuildModel(TheoryModel* m) override; 37 : : bool preProcessBuildModelStd(TheoryModel* m); 38 : : /** number of lemmas generated while building model */ 39 : : unsigned d_addedLemmas; 40 : : unsigned d_triedLemmas; 41 : : 42 : : public: 43 : : QModelBuilder(Env& env, 44 : : QuantifiersState& qs, 45 : : QuantifiersInferenceManager& qim, 46 : : QuantifiersRegistry& qr, 47 : : TermRegistry& tr); 48 : : /** finish init, which sets the model object */ 49 : : virtual void finishInit(); 50 : : //do exhaustive instantiation 51 : : // 0 : failed, but resorting to true exhaustive instantiation may work 52 : : // >0 : success 53 : : // <0 : failed 54 : 16 : virtual int doExhaustiveInstantiation(CVC5_UNUSED FirstOrderModel* fm, 55 : : CVC5_UNUSED Node f, 56 : : CVC5_UNUSED int effort) 57 : : { 58 : 16 : return false; 59 : : } 60 : : //whether to construct model 61 : : virtual bool optUseModel(); 62 : : //debug model 63 : : void debugModel(TheoryModel* m) override; 64 : : //statistics 65 : 28128 : unsigned getNumAddedLemmas() { return d_addedLemmas; } 66 : 28128 : unsigned getNumTriedLemmas() { return d_triedLemmas; } 67 : : /** get the model we are using */ 68 : : FirstOrderModel* getModel(); 69 : : 70 : : protected: 71 : : /** The quantifiers state object */ 72 : : QuantifiersState& d_qstate; 73 : : /** The quantifiers inference manager */ 74 : : QuantifiersInferenceManager& d_qim; 75 : : /** Reference to the quantifiers registry */ 76 : : QuantifiersRegistry& d_qreg; 77 : : /** Term registry */ 78 : : TermRegistry& d_treg; 79 : : /** Pointer to the model object we are using */ 80 : : FirstOrderModel* d_model; 81 : : /** The model object we have allocated */ 82 : : std::unique_ptr<FirstOrderModel> d_modelAloc; 83 : : }; 84 : : 85 : : } // namespace quantifiers 86 : : } // namespace theory 87 : : } // namespace cvc5::internal 88 : : 89 : : #endif /* CVC5__THEORY__QUANTIFIERS__MODEL_BUILDER_H */