1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mudathir Mohamed, Aina Niemetz |
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 bags term registry object. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "theory/bags/term_registry.h" |
17 |
|
|
18 |
|
#include "expr/emptyset.h" |
19 |
|
#include "theory/bags/inference_manager.h" |
20 |
|
#include "theory/bags/solver_state.h" |
21 |
|
|
22 |
|
using namespace std; |
23 |
|
using namespace cvc5::kind; |
24 |
|
|
25 |
|
namespace cvc5 { |
26 |
|
namespace theory { |
27 |
|
namespace bags { |
28 |
|
|
29 |
9926 |
TermRegistry::TermRegistry(SolverState& state, InferenceManager& im) |
30 |
|
: d_im(im), |
31 |
9926 |
d_proxy(state.getUserContext()), |
32 |
19852 |
d_proxy_to_term(state.getUserContext()) |
33 |
|
{ |
34 |
9926 |
} |
35 |
|
|
36 |
|
Node TermRegistry::getEmptyBag(TypeNode tn) |
37 |
|
{ |
38 |
|
std::map<TypeNode, Node>::iterator it = d_emptybag.find(tn); |
39 |
|
if (it != d_emptybag.end()) |
40 |
|
{ |
41 |
|
return it->second; |
42 |
|
} |
43 |
|
Node n = NodeManager::currentNM()->mkConst(EmptySet(tn)); |
44 |
|
d_emptybag[tn] = n; |
45 |
|
return n; |
46 |
|
} |
47 |
|
|
48 |
|
} // namespace bags |
49 |
|
} // namespace theory |
50 |
29502 |
} // namespace cvc5 |