summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers/sygus/sygus_enumerator_basic.cpp
blob: e9f41c916c6ef452c6d5e8e4d7998d997dec187c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*********************                                                        */
/*! \file sygus_enumerator_basic.cpp
 ** \verbatim
 ** Top contributors (to current version):
 **   Andrew Reynolds
 ** This file is part of the CVC4 project.
 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 ** in the top-level source directory and their institutional affiliations.
 ** All rights reserved.  See the file COPYING in the top-level source
 ** directory for licensing information.\endverbatim
 **
 ** \brief Implementation of sygus basic enumerator
 **/
#include "theory/quantifiers/sygus/sygus_enumerator_basic.h"

#include "options/datatypes_options.h"

using namespace cvc5::kind;
using namespace std;

namespace cvc5 {
namespace theory {
namespace quantifiers {

EnumValGeneratorBasic::EnumValGeneratorBasic(TermDbSygus* tds, TypeNode tn)
    : d_tds(tds), d_te(tn)
{
}

bool EnumValGeneratorBasic::increment()
{
  ++d_te;
  if (d_te.isFinished())
  {
    d_currTerm = Node::null();
    return false;
  }
  d_currTerm = *d_te;
  if (options::sygusSymBreakDynamic())
  {
    Node nextb = d_tds->sygusToBuiltin(d_currTerm);
    nextb = d_tds->getExtRewriter()->extendedRewrite(nextb);
    if (d_cache.find(nextb) == d_cache.end())
    {
      d_cache.insert(nextb);
      // only return the current term if not unique
    }
    else
    {
      d_currTerm = Node::null();
    }
  }
  return true;
}

}  // namespace quantifiers
}  // namespace theory
}  // namespace cvc5
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback