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 |
18412 |
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(Env& env, |
47 |
|
QuantifiersState& qs, |
48 |
|
QuantifiersInferenceManager& qim, |
49 |
|
QuantifiersRegistry& qr, |
50 |
|
TermRegistry& tr); |
51 |
|
/** finish init, which sets the model object */ |
52 |
|
virtual void finishInit(); |
53 |
|
//do exhaustive instantiation |
54 |
|
// 0 : failed, but resorting to true exhaustive instantiation may work |
55 |
|
// >0 : success |
56 |
|
// <0 : failed |
57 |
171 |
virtual int doExhaustiveInstantiation( FirstOrderModel * fm, Node f, int effort ) { return false; } |
58 |
|
//whether to construct model |
59 |
|
virtual bool optUseModel(); |
60 |
|
//debug model |
61 |
|
void debugModel(TheoryModel* m) override; |
62 |
|
//statistics |
63 |
23252 |
unsigned getNumAddedLemmas() { return d_addedLemmas; } |
64 |
23252 |
unsigned getNumTriedLemmas() { return d_triedLemmas; } |
65 |
|
/** get the model we are using */ |
66 |
|
FirstOrderModel* getModel(); |
67 |
|
|
68 |
|
protected: |
69 |
|
/** The quantifiers state object */ |
70 |
|
QuantifiersState& d_qstate; |
71 |
|
/** The quantifiers inference manager */ |
72 |
|
QuantifiersInferenceManager& d_qim; |
73 |
|
/** Reference to the quantifiers registry */ |
74 |
|
QuantifiersRegistry& d_qreg; |
75 |
|
/** Term registry */ |
76 |
|
TermRegistry& d_treg; |
77 |
|
/** Pointer to the model object we are using */ |
78 |
|
FirstOrderModel* d_model; |
79 |
|
/** The model object we have allocated */ |
80 |
|
std::unique_ptr<FirstOrderModel> d_modelAloc; |
81 |
|
}; |
82 |
|
|
83 |
|
} // namespace quantifiers |
84 |
|
} // namespace theory |
85 |
|
} // namespace cvc5 |
86 |
|
|
87 |
|
#endif /* CVC5__THEORY__QUANTIFIERS__MODEL_BUILDER_H */ |