Branch data Line data Source code
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-2025 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 : : * The solver for find-synth queries. 14 : : */ 15 : : 16 : : #include "cvc5_private.h" 17 : : 18 : : #ifndef CVC5__SMT__FIND_SYNTH_SOLVER_H 19 : : #define CVC5__SMT__FIND_SYNTH_SOLVER_H 20 : : 21 : : #include "smt/env_obj.h" 22 : : #include "theory/quantifiers/sygus/synth_finder.h" 23 : : 24 : : namespace cvc5::internal { 25 : : namespace smt { 26 : : 27 : : /** 28 : : * Find synthesis solver, which is responsible for implementing find-synth. 29 : : * It initializes (possibly mulitiple) sygus enumerators and runs them in 30 : : * an interleaved fashion until one returns a solution. 31 : : */ 32 : : class FindSynthSolver : protected EnvObj 33 : : { 34 : : public: 35 : : FindSynthSolver(Env& env); 36 : 116 : ~FindSynthSolver() {} 37 : : /** 38 : : * Find synth for the given target and (possibly multiple) grammars. Returns 39 : : * the result of the find-synth query. 40 : : */ 41 : : Node findSynth(modes::FindSynthTarget fst, const std::vector<TypeNode>& gtns); 42 : : /** 43 : : * Find synth next, which gets the next solution after a successful call to 44 : : * findSynth above. 45 : : */ 46 : : Node findSynthNext(); 47 : : 48 : : private: 49 : : /** 50 : : * The synthesis finder utilities that are active. These are initialized 51 : : * for each type node in gtns called by findSynth above. 52 : : */ 53 : : std::vector<std::unique_ptr<theory::quantifiers::SynthFinder>> d_sfinders; 54 : : /** finished indices */ 55 : : std::unordered_set<size_t> d_finished; 56 : : /** Current index in d_sfinders we are looking at.*/ 57 : : size_t d_currIndex; 58 : : /** The current target we are given as input */ 59 : : modes::FindSynthTarget d_fst; 60 : : }; 61 : : 62 : : } // namespace smt 63 : : } // namespace cvc5::internal 64 : : 65 : : #endif /* CVC5__SMT__FIND_SYNTH_SOLVER_H */