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