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 |
|
* Base class for sygus enumerators |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__QUANTIFIERS__SYGUS__ENUM_VAL_GENERATOR_H |
19 |
|
#define CVC5__THEORY__QUANTIFIERS__SYGUS__ENUM_VAL_GENERATOR_H |
20 |
|
|
21 |
|
#include "expr/node.h" |
22 |
|
|
23 |
|
namespace cvc5 { |
24 |
|
namespace theory { |
25 |
|
namespace quantifiers { |
26 |
|
|
27 |
|
/** |
28 |
|
* A base class for generating values for actively-generated enumerators. |
29 |
|
* At a high level, the job of this class is to accept a stream of "abstract |
30 |
|
* values" a1, ..., an, ..., and generate a (possibly larger) stream of |
31 |
|
* "concrete values" c11, ..., c1{m_1}, ..., cn1, ... cn{m_n}, .... |
32 |
|
*/ |
33 |
167 |
class EnumValGenerator |
34 |
|
{ |
35 |
|
public: |
36 |
167 |
virtual ~EnumValGenerator() {} |
37 |
|
/** initialize this class with enumerator e */ |
38 |
|
virtual void initialize(Node e) = 0; |
39 |
|
/** Inform this generator that abstract value v was enumerated. */ |
40 |
|
virtual void addValue(Node v) = 0; |
41 |
|
/** |
42 |
|
* Increment this value generator. If this returns false, then we are out of |
43 |
|
* values. If this returns true, getCurrent(), if non-null, returns the |
44 |
|
* current term. |
45 |
|
* |
46 |
|
* Notice that increment() may return true and afterwards it may be the case |
47 |
|
* getCurrent() is null. We do this so that increment() does not take too |
48 |
|
* much time per call, which can be the case for grammars where it is |
49 |
|
* difficult to find the next (non-redundant) term. Returning true with |
50 |
|
* a null current term gives the caller the chance to interleave other |
51 |
|
* reasoning. |
52 |
|
*/ |
53 |
|
virtual bool increment() = 0; |
54 |
|
/** Get the current concrete value generated by this class. */ |
55 |
|
virtual Node getCurrent() = 0; |
56 |
|
}; |
57 |
|
|
58 |
|
} // namespace quantifiers |
59 |
|
} // namespace theory |
60 |
|
} // namespace cvc5 |
61 |
|
|
62 |
|
#endif |