1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Andrew Reynolds, Morgan Deters, Mathias Preiner |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 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 <iosfwd> |
22 |
|
#include <vector> |
23 |
|
|
24 |
|
#include "expr/node.h" |
25 |
|
|
26 |
|
namespace cvc5 { |
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 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 |
3869 |
~UnsatCore() {} |
41 |
|
|
42 |
|
/** Whether we are using names for this unsat core */ |
43 |
12 |
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 |
73 |
|
|
74 |
|
#endif /* CVC5__UNSAT_CORE_H */ |