1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Morgan Deters, Andrew Reynolds, Clark Barrett |
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 "proof/unsat_core.h" |
17 |
|
|
18 |
|
#include "base/check.h" |
19 |
|
#include "expr/expr_iomanip.h" |
20 |
|
#include "options/base_options.h" |
21 |
|
#include "printer/printer.h" |
22 |
|
#include "smt/smt_engine_scope.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
|
26 |
64 |
UnsatCore::UnsatCore(const std::vector<Node>& core) |
27 |
64 |
: d_useNames(false), d_core(core), d_names() |
28 |
|
{ |
29 |
64 |
Debug("core") << "UnsatCore size " << d_core.size() << std::endl; |
30 |
64 |
} |
31 |
|
|
32 |
4 |
UnsatCore::UnsatCore(std::vector<std::string>& names) |
33 |
4 |
: d_useNames(true), d_core(), d_names(names) |
34 |
|
{ |
35 |
4 |
Debug("core") << "UnsatCore (names) size " << d_names.size() << std::endl; |
36 |
4 |
} |
37 |
|
|
38 |
|
const std::vector<Node>& UnsatCore::getCore() const { return d_core; } |
39 |
4 |
const std::vector<std::string>& UnsatCore::getCoreNames() const |
40 |
|
{ |
41 |
4 |
return d_names; |
42 |
|
} |
43 |
|
|
44 |
69 |
UnsatCore::const_iterator UnsatCore::begin() const { |
45 |
69 |
return d_core.begin(); |
46 |
|
} |
47 |
|
|
48 |
246 |
UnsatCore::const_iterator UnsatCore::end() const { |
49 |
246 |
return d_core.end(); |
50 |
|
} |
51 |
|
|
52 |
5 |
void UnsatCore::toStream(std::ostream& out) const { |
53 |
10 |
expr::ExprDag::Scope scope(out, false); |
54 |
5 |
Printer::getPrinter(options::outputLanguage())->toStream(out, *this); |
55 |
5 |
} |
56 |
|
|
57 |
|
std::ostream& operator<<(std::ostream& out, const UnsatCore& core) { |
58 |
|
core.toStream(out); |
59 |
|
return out; |
60 |
|
} |
61 |
|
|
62 |
22755 |
} // namespace cvc5 |