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 |
|
* Basic sygus enumerator class. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__QUANTIFIERS__SYGUS_ENUMERATOR_BASIC_H |
19 |
|
#define CVC5__THEORY__QUANTIFIERS__SYGUS_ENUMERATOR_BASIC_H |
20 |
|
|
21 |
|
#include <map> |
22 |
|
#include <unordered_set> |
23 |
|
#include "expr/node.h" |
24 |
|
#include "expr/type_node.h" |
25 |
|
#include "theory/quantifiers/sygus/enum_val_generator.h" |
26 |
|
#include "theory/quantifiers/sygus/term_database_sygus.h" |
27 |
|
#include "theory/type_enumerator.h" |
28 |
|
|
29 |
|
namespace cvc5 { |
30 |
|
namespace theory { |
31 |
|
namespace quantifiers { |
32 |
|
|
33 |
|
/** A basic sygus value generator |
34 |
|
* |
35 |
|
* This class is a "naive" term generator for sygus conjectures, which invokes |
36 |
|
* the type enumerator to generate a stream of (all) sygus terms of a given |
37 |
|
* type. |
38 |
|
*/ |
39 |
|
class EnumValGeneratorBasic : public EnumValGenerator |
40 |
|
{ |
41 |
|
public: |
42 |
|
EnumValGeneratorBasic(TermDbSygus* tds, TypeNode tn); |
43 |
|
~EnumValGeneratorBasic() {} |
44 |
|
/** initialize (do nothing) */ |
45 |
|
void initialize(Node e) override {} |
46 |
|
/** initialize (do nothing) */ |
47 |
|
void addValue(Node v) override { d_currTerm = *d_te; } |
48 |
|
/** |
49 |
|
* Get next returns the next (T-rewriter-unique) value based on the type |
50 |
|
* enumerator. |
51 |
|
*/ |
52 |
|
bool increment() override; |
53 |
|
/** get the current term */ |
54 |
|
Node getCurrent() override { return d_currTerm; } |
55 |
|
|
56 |
|
private: |
57 |
|
/** pointer to term database sygus */ |
58 |
|
TermDbSygus* d_tds; |
59 |
|
/** the type enumerator */ |
60 |
|
TypeEnumerator d_te; |
61 |
|
/** the current term */ |
62 |
|
Node d_currTerm; |
63 |
|
/** cache of (enumerated) builtin values we have enumerated so far */ |
64 |
|
std::unordered_set<Node> d_cache; |
65 |
|
}; |
66 |
|
|
67 |
|
} // namespace quantifiers |
68 |
|
} // namespace theory |
69 |
|
} // namespace cvc5 |
70 |
|
|
71 |
|
#endif /* CVC5__THEORY__QUANTIFIERS__SYGUS_ENUMERATOR_BASIC_H */ |