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 : : * Oracle caller 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__EXPR__ORACLE_CALLER_H 16 : : #define CVC5__EXPR__ORACLE_CALLER_H 17 : : 18 : : #include "expr/node.h" 19 : : #include "expr/oracle.h" 20 : : 21 : : namespace cvc5::internal { 22 : : 23 : : /** 24 : : * This class manages the calls to an (externally implemented) oracle for a 25 : : * single oracle function symbol or oracle interface quantified formula. 26 : : */ 27 : : class OracleCaller 28 : : { 29 : : public: 30 : : /** 31 : : * @param n The oracle function or oracle interface quantified formula. 32 : : */ 33 : : OracleCaller(const Node& n); 34 : : 35 : 974 : ~OracleCaller() {} 36 : : 37 : : /** 38 : : * Call an oracle with a set of arguments given as children of the application 39 : : * fapp. Store in result res. 40 : : * 41 : : * Return true if the call was made, and false if it was already cached. 42 : : */ 43 : : bool callOracle(const Node& fapp, std::vector<Node>& res); 44 : : 45 : : /** Get cached results for this oracle caller */ 46 : : const std::map<Node, std::vector<Node>>& getCachedResults() const; 47 : : 48 : : /** is f an oracle function? */ 49 : : static bool isOracleFunction(Node f); 50 : : /** is n an oracle function application? */ 51 : : static bool isOracleFunctionApp(Node n); 52 : : 53 : : /** 54 : : * Get oracle from an oracle function, or an oracle interface quantified 55 : : * formula. Returns a node of kind ORACLE if the associated oracle exists, 56 : : * or null otherwise. 57 : : */ 58 : : static Node getOracleFor(const Node& n); 59 : : 60 : : private: 61 : : /** The oracle node */ 62 : : Node d_oracleNode; 63 : : /** The oracle */ 64 : : const Oracle& d_oracle; 65 : : /** 66 : : * The cached results, mapping (APPLY_UF) applications of the oracle 67 : : * function to the parsed output of the binary. 68 : : */ 69 : : std::map<Node, std::vector<Node>> d_cachedResults; 70 : : }; 71 : : 72 : : } // namespace cvc5::internal 73 : : 74 : : #endif /*CVC5__UTIL__ORACLE_CALLER_H*/