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 : : * Representation of unsat cores. 11 : : */ 12 : : 13 : : #include "cvc5_private.h" 14 : : 15 : : #ifndef CVC5__UNSAT_CORE_H 16 : : #define CVC5__UNSAT_CORE_H 17 : : 18 : : #include <cvc5/cvc5_export.h> 19 : : 20 : : #include <iosfwd> 21 : : #include <string> 22 : : #include <vector> 23 : : 24 : : #include "expr/node.h" 25 : : 26 : : namespace cvc5::internal { 27 : : 28 : : /** 29 : : * An unsat core, which can optionally be initialized as a list of names 30 : : * or as a list of formulas. 31 : : */ 32 : : class CVC5_EXPORT UnsatCore 33 : : { 34 : : public: 35 : : UnsatCore() {} 36 : : /** Initialize using assertions */ 37 : : UnsatCore(const std::vector<Node>& core); 38 : : /** Initialize using assertion names */ 39 : : UnsatCore(std::vector<std::string>& names); 40 : 3513 : ~UnsatCore() {} 41 : : 42 : : /** Whether we are using names for this unsat core */ 43 : 51 : bool useNames() const { return d_useNames; } 44 : : /** Get the assertions in the unsat core */ 45 : : const std::vector<Node>& getCore() const; 46 : : /** Get their names */ 47 : : const std::vector<std::string>& getCoreNames() const; 48 : : 49 : : typedef std::vector<Node>::const_iterator iterator; 50 : : typedef std::vector<Node>::const_iterator const_iterator; 51 : : 52 : : const_iterator begin() const; 53 : : const_iterator end() const; 54 : : 55 : : /** 56 : : * prints this UnsatCore object to the stream out. 57 : : */ 58 : : void toStream(std::ostream& out) const; 59 : : 60 : : private: 61 : : /** Whether we are using names for this unsat core */ 62 : : bool d_useNames; 63 : : /** The unsat core */ 64 : : std::vector<Node> d_core; 65 : : /** The names of assertions in the above core */ 66 : : std::vector<std::string> d_names; 67 : : }; /* class UnsatCore */ 68 : : 69 : : /** Print the unsat core to stream out */ 70 : : std::ostream& operator<<(std::ostream& out, const UnsatCore& core); 71 : : 72 : : } // namespace cvc5::internal 73 : : 74 : : #endif /* CVC5__UNSAT_CORE_H */