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 |
|
* Utility for inferring templates for invariant problems. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "cvc5_private.h" |
17 |
|
|
18 |
|
#ifndef CVC5__THEORY__QUANTIFIERS__SYGUS__TEMPLATE_INFER_H |
19 |
|
#define CVC5__THEORY__QUANTIFIERS__SYGUS__TEMPLATE_INFER_H |
20 |
|
|
21 |
|
#include <map> |
22 |
|
|
23 |
|
#include "expr/node.h" |
24 |
|
#include "theory/quantifiers/sygus/transition_inference.h" |
25 |
|
|
26 |
|
namespace cvc5 { |
27 |
|
namespace theory { |
28 |
|
namespace quantifiers { |
29 |
|
|
30 |
|
/** |
31 |
|
* This class infers templates for an invariant-to-synthesize based on the |
32 |
|
* template mode. It uses the transition inference to choose a template. |
33 |
|
*/ |
34 |
|
class SygusTemplateInfer |
35 |
|
{ |
36 |
|
public: |
37 |
1199 |
SygusTemplateInfer() {} |
38 |
1197 |
~SygusTemplateInfer() {} |
39 |
|
/** |
40 |
|
* Initialize this class for synthesis conjecture q. If applicable, the |
41 |
|
* templates for functions-to-synthesize for q are accessible by the |
42 |
|
* calls below afterwards. |
43 |
|
*/ |
44 |
|
void initialize(Node q); |
45 |
|
/** |
46 |
|
* Get template for program prog. This returns a term of the form t[x] where |
47 |
|
* x is the template argument (see below) |
48 |
|
*/ |
49 |
|
Node getTemplate(Node prog) const; |
50 |
|
/** |
51 |
|
* Get the template argument for program prog. This is a variable which |
52 |
|
* indicates the position of the function/predicate to synthesize. |
53 |
|
*/ |
54 |
|
Node getTemplateArg(Node prog) const; |
55 |
|
|
56 |
|
private: |
57 |
|
/** The quantified formula we initialized with */ |
58 |
|
Node d_quant; |
59 |
|
/** transition relation pre and post version per function to synthesize */ |
60 |
|
std::map<Node, Node> d_trans_pre; |
61 |
|
std::map<Node, Node> d_trans_post; |
62 |
|
/** the template for each function to synthesize */ |
63 |
|
std::map<Node, Node> d_templ; |
64 |
|
/** |
65 |
|
* The template argument for each function to synthesize (occurs in exactly |
66 |
|
* one position of its template) |
67 |
|
*/ |
68 |
|
std::map<Node, Node> d_templ_arg; |
69 |
|
/** transition inference module */ |
70 |
|
TransitionInference d_ti; |
71 |
|
}; |
72 |
|
|
73 |
|
} // namespace quantifiers |
74 |
|
} // namespace theory |
75 |
|
} // namespace cvc5 |
76 |
|
|
77 |
|
#endif |