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