Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Utility for inferring templates for invariant problems. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__THEORY__QUANTIFIERS__SYGUS__TEMPLATE_INFER_H 16 : : #define CVC5__THEORY__QUANTIFIERS__SYGUS__TEMPLATE_INFER_H 17 : : 18 : : #include <map> 19 : : 20 : : #include "expr/node.h" 21 : : #include "smt/env_obj.h" 22 : : #include "theory/quantifiers/sygus/transition_inference.h" 23 : : 24 : : namespace cvc5::internal { 25 : : namespace theory { 26 : : namespace quantifiers { 27 : : 28 : : /** 29 : : * This class infers templates for an invariant-to-synthesize based on the 30 : : * template mode. It uses the transition inference to choose a template. 31 : : */ 32 : : class SygusTemplateInfer : protected EnvObj 33 : : { 34 : : public: 35 : : SygusTemplateInfer(Env& env); 36 : 12348 : ~SygusTemplateInfer() {} 37 : : /** 38 : : * Initialize this class for synthesis conjecture q. If applicable, the 39 : : * templates for functions-to-synthesize for q are accessible by the 40 : : * calls below afterwards. 41 : : */ 42 : : void initialize(Node q); 43 : : /** 44 : : * Get template for program prog. This returns a term of the form t[x] where 45 : : * x is the template argument (see below) 46 : : */ 47 : : Node getTemplate(Node prog) const; 48 : : /** 49 : : * Get the template argument for program prog. This is a variable which 50 : : * indicates the position of the function/predicate to synthesize. 51 : : */ 52 : : Node getTemplateArg(Node prog) const; 53 : : 54 : : private: 55 : : /** The quantified formula we initialized with */ 56 : : Node d_quant; 57 : : /** transition relation pre and post version per function to synthesize */ 58 : : std::map<Node, Node> d_trans_pre; 59 : : std::map<Node, Node> d_trans_post; 60 : : /** the template for each function to synthesize */ 61 : : std::map<Node, Node> d_templ; 62 : : /** 63 : : * The template argument for each function to synthesize (occurs in exactly 64 : : * one position of its template) 65 : : */ 66 : : std::map<Node, Node> d_templ_arg; 67 : : /** transition inference module */ 68 : : TransitionInference d_ti; 69 : : }; 70 : : 71 : : } // namespace quantifiers 72 : : } // namespace theory 73 : : } // namespace cvc5::internal 74 : : 75 : : #endif