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 |
|
* Type rules for the builtin theory. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "theory/builtin/theory_builtin_type_rules.h" |
17 |
|
|
18 |
|
#include "expr/attribute.h" |
19 |
|
#include "expr/skolem_manager.h" |
20 |
|
|
21 |
|
namespace cvc5 { |
22 |
|
namespace theory { |
23 |
|
namespace builtin { |
24 |
|
|
25 |
|
/** |
26 |
|
* Attribute for caching the ground term for each type. Maps TypeNode to the |
27 |
|
* skolem to return for mkGroundTerm. |
28 |
|
*/ |
29 |
|
struct GroundTermAttributeId |
30 |
|
{ |
31 |
|
}; |
32 |
|
typedef expr::Attribute<GroundTermAttributeId, Node> GroundTermAttribute; |
33 |
|
|
34 |
338 |
Node SortProperties::mkGroundTerm(TypeNode type) |
35 |
|
{ |
36 |
338 |
Assert(type.getKind() == kind::SORT_TYPE); |
37 |
|
GroundTermAttribute gta; |
38 |
338 |
if (type.hasAttribute(gta)) |
39 |
|
{ |
40 |
311 |
return type.getAttribute(gta); |
41 |
|
} |
42 |
27 |
SkolemManager* sm = NodeManager::currentNM()->getSkolemManager(); |
43 |
|
Node k = sm->mkDummySkolem( |
44 |
54 |
"groundTerm", type, "a ground term created for type " + type.toString()); |
45 |
27 |
type.setAttribute(gta, k); |
46 |
27 |
return k; |
47 |
|
} |
48 |
|
|
49 |
|
} // namespace builtin |
50 |
|
} // namespace theory |
51 |
28191 |
} // namespace cvc5 |