1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, 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 sygus basic enumerator. |
14 |
|
*/ |
15 |
|
#include "theory/quantifiers/sygus/sygus_enumerator_basic.h" |
16 |
|
|
17 |
|
#include "options/datatypes_options.h" |
18 |
|
|
19 |
|
using namespace cvc5::kind; |
20 |
|
using namespace std; |
21 |
|
|
22 |
|
namespace cvc5 { |
23 |
|
namespace theory { |
24 |
|
namespace quantifiers { |
25 |
|
|
26 |
|
EnumValGeneratorBasic::EnumValGeneratorBasic(TermDbSygus* tds, TypeNode tn) |
27 |
|
: d_tds(tds), d_te(tn) |
28 |
|
{ |
29 |
|
} |
30 |
|
|
31 |
|
bool EnumValGeneratorBasic::increment() |
32 |
|
{ |
33 |
|
++d_te; |
34 |
|
if (d_te.isFinished()) |
35 |
|
{ |
36 |
|
d_currTerm = Node::null(); |
37 |
|
return false; |
38 |
|
} |
39 |
|
d_currTerm = *d_te; |
40 |
|
if (options::sygusSymBreakDynamic()) |
41 |
|
{ |
42 |
|
Node nextb = d_tds->sygusToBuiltin(d_currTerm); |
43 |
|
nextb = d_tds->getExtRewriter()->extendedRewrite(nextb); |
44 |
|
if (d_cache.find(nextb) == d_cache.end()) |
45 |
|
{ |
46 |
|
d_cache.insert(nextb); |
47 |
|
// only return the current term if not unique |
48 |
|
} |
49 |
|
else |
50 |
|
{ |
51 |
|
d_currTerm = Node::null(); |
52 |
|
} |
53 |
|
} |
54 |
|
return true; |
55 |
|
} |
56 |
|
|
57 |
|
} // namespace quantifiers |
58 |
|
} // namespace theory |
59 |
28191 |
} // namespace cvc5 |