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