1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Morgan Deters, Tim King |
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 |
|
* Implementation of Model class. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "smt/model.h" |
17 |
|
|
18 |
|
#include "expr/expr_iomanip.h" |
19 |
|
#include "options/base_options.h" |
20 |
|
#include "printer/printer.h" |
21 |
|
#include "smt/dump_manager.h" |
22 |
|
#include "smt/node_command.h" |
23 |
|
#include "smt/smt_engine.h" |
24 |
|
#include "smt/smt_engine_scope.h" |
25 |
|
#include "theory/theory_model.h" |
26 |
|
|
27 |
|
namespace cvc5 { |
28 |
|
namespace smt { |
29 |
|
|
30 |
9459 |
Model::Model(theory::TheoryModel* tm) : d_isKnownSat(false), d_tmodel(tm) |
31 |
|
{ |
32 |
9459 |
Assert(d_tmodel != nullptr); |
33 |
9459 |
} |
34 |
|
|
35 |
25 |
std::ostream& operator<<(std::ostream& out, const Model& m) { |
36 |
50 |
expr::ExprDag::Scope scope(out, false); |
37 |
25 |
Printer::getPrinter(options::outputLanguage())->toStream(out, m); |
38 |
50 |
return out; |
39 |
|
} |
40 |
|
|
41 |
36 |
theory::TheoryModel* Model::getTheoryModel() { return d_tmodel; } |
42 |
|
|
43 |
59 |
const theory::TheoryModel* Model::getTheoryModel() const { return d_tmodel; } |
44 |
|
|
45 |
30 |
bool Model::isModelCoreSymbol(TNode sym) const |
46 |
|
{ |
47 |
30 |
return d_tmodel->isModelCoreSymbol(sym); |
48 |
|
} |
49 |
23604 |
Node Model::getValue(TNode n) const { return d_tmodel->getValue(n); } |
50 |
|
|
51 |
4128 |
bool Model::hasApproximations() const { return d_tmodel->hasApproximations(); } |
52 |
|
|
53 |
25 |
void Model::clearModelDeclarations() |
54 |
|
{ |
55 |
25 |
d_declareTerms.clear(); |
56 |
25 |
d_declareSorts.clear(); |
57 |
25 |
} |
58 |
|
|
59 |
4 |
void Model::addDeclarationSort(TypeNode tn) { d_declareSorts.push_back(tn); } |
60 |
|
|
61 |
30 |
void Model::addDeclarationTerm(Node n) { d_declareTerms.push_back(n); } |
62 |
25 |
const std::vector<TypeNode>& Model::getDeclaredSorts() const |
63 |
|
{ |
64 |
25 |
return d_declareSorts; |
65 |
|
} |
66 |
25 |
const std::vector<Node>& Model::getDeclaredTerms() const |
67 |
|
{ |
68 |
25 |
return d_declareTerms; |
69 |
|
} |
70 |
|
|
71 |
|
} // namespace smt |
72 |
28191 |
} // namespace cvc5 |