1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds |
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 |
|
* Management of a care graph based approach for theory combination. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "theory/combination_engine.h" |
17 |
|
|
18 |
|
#include "expr/node_visitor.h" |
19 |
|
#include "theory/care_graph.h" |
20 |
|
#include "theory/eager_proof_generator.h" |
21 |
|
#include "theory/ee_manager_distributed.h" |
22 |
|
#include "theory/model_manager.h" |
23 |
|
#include "theory/model_manager_distributed.h" |
24 |
|
#include "theory/shared_solver.h" |
25 |
|
#include "theory/shared_solver_distributed.h" |
26 |
|
#include "theory/theory_engine.h" |
27 |
|
|
28 |
|
namespace cvc5 { |
29 |
|
namespace theory { |
30 |
|
|
31 |
9459 |
CombinationEngine::CombinationEngine(TheoryEngine& te, |
32 |
|
Env& env, |
33 |
|
const std::vector<Theory*>& paraTheories, |
34 |
9459 |
ProofNodeManager* pnm) |
35 |
|
: d_te(te), |
36 |
|
d_env(env), |
37 |
|
d_valuation(&te), |
38 |
|
d_pnm(pnm), |
39 |
9459 |
d_logicInfo(te.getLogicInfo()), |
40 |
|
d_paraTheories(paraTheories), |
41 |
|
d_eemanager(nullptr), |
42 |
|
d_mmanager(nullptr), |
43 |
|
d_sharedSolver(nullptr), |
44 |
2384 |
d_cmbsPg(pnm ? new EagerProofGenerator(pnm, te.getUserContext()) |
45 |
21302 |
: nullptr) |
46 |
|
{ |
47 |
|
// create the equality engine, model manager, and shared solver |
48 |
18918 |
if (options::eeMode() == options::EqEngineMode::DISTRIBUTED) |
49 |
|
{ |
50 |
|
// use the distributed shared solver |
51 |
9459 |
d_sharedSolver.reset(new SharedSolverDistributed(d_te, d_pnm)); |
52 |
|
// make the distributed equality engine manager |
53 |
18918 |
d_eemanager.reset( |
54 |
9459 |
new EqEngineManagerDistributed(d_te, *d_sharedSolver.get())); |
55 |
|
// make the distributed model manager |
56 |
18918 |
d_mmanager.reset( |
57 |
9459 |
new ModelManagerDistributed(d_te, d_env, *d_eemanager.get())); |
58 |
|
} |
59 |
|
else |
60 |
|
{ |
61 |
|
Unhandled() << "CombinationEngine::finishInit: equality engine mode " |
62 |
|
<< options::eeMode() << " not supported"; |
63 |
|
} |
64 |
9459 |
} |
65 |
|
|
66 |
9459 |
CombinationEngine::~CombinationEngine() {} |
67 |
|
|
68 |
9459 |
void CombinationEngine::finishInit() |
69 |
|
{ |
70 |
9459 |
Assert(d_eemanager != nullptr); |
71 |
|
|
72 |
|
// initialize equality engines in all theories, including quantifiers engine |
73 |
|
// and the (provided) shared solver |
74 |
9459 |
d_eemanager->initializeTheories(); |
75 |
|
|
76 |
9459 |
Assert(d_mmanager != nullptr); |
77 |
|
// initialize the model manager, based on the notify object of this class |
78 |
9459 |
eq::EqualityEngineNotify* meen = getModelEqualityEngineNotify(); |
79 |
9459 |
d_mmanager->finishInit(meen); |
80 |
9459 |
} |
81 |
|
|
82 |
122967 |
const EeTheoryInfo* CombinationEngine::getEeTheoryInfo(TheoryId tid) const |
83 |
|
{ |
84 |
122967 |
return d_eemanager->getEeTheoryInfo(tid); |
85 |
|
} |
86 |
|
|
87 |
19608 |
void CombinationEngine::resetModel() { d_mmanager->resetModel(); } |
88 |
|
|
89 |
6994 |
void CombinationEngine::postProcessModel(bool incomplete) |
90 |
|
{ |
91 |
6994 |
d_eemanager->notifyModel(incomplete); |
92 |
|
// postprocess with the model |
93 |
6994 |
d_mmanager->postProcessModel(incomplete); |
94 |
6994 |
} |
95 |
|
|
96 |
267923 |
theory::TheoryModel* CombinationEngine::getModel() |
97 |
|
{ |
98 |
267923 |
return d_mmanager->getModel(); |
99 |
|
} |
100 |
|
|
101 |
9459 |
SharedSolver* CombinationEngine::getSharedSolver() |
102 |
|
{ |
103 |
9459 |
return d_sharedSolver.get(); |
104 |
|
} |
105 |
29369 |
bool CombinationEngine::isProofEnabled() const { return d_cmbsPg != nullptr; } |
106 |
|
|
107 |
9459 |
eq::EqualityEngineNotify* CombinationEngine::getModelEqualityEngineNotify() |
108 |
|
{ |
109 |
|
// by default, no notifications from model's equality engine |
110 |
9459 |
return nullptr; |
111 |
|
} |
112 |
|
|
113 |
29369 |
void CombinationEngine::sendLemma(TrustNode trn, TheoryId atomsTo) |
114 |
|
{ |
115 |
29369 |
d_te.lemma(trn, LemmaProperty::NONE, atomsTo); |
116 |
29369 |
} |
117 |
|
|
118 |
61722 |
void CombinationEngine::resetRound() |
119 |
|
{ |
120 |
|
// compute the relevant terms? |
121 |
61722 |
} |
122 |
|
|
123 |
|
} // namespace theory |
124 |
28191 |
} // namespace cvc5 |