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