GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/proof/proof_manager.h Lines: 5 5 100.0 %
Date: 2021-03-23 Branches: 0 0 0.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file proof_manager.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Liana Hadarean, Haniel Barbosa, Andrew Reynolds
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief A manager for Proofs
13
 **
14
 ** A manager for Proofs.
15
 **/
16
17
#include "cvc4_private.h"
18
19
#ifndef CVC4__PROOF_MANAGER_H
20
#define CVC4__PROOF_MANAGER_H
21
22
#include <memory>
23
#include <unordered_map>
24
#include <unordered_set>
25
26
#include "context/cdhashmap.h"
27
#include "context/cdhashset.h"
28
#include "expr/node.h"
29
#include "proof/clause_id.h"
30
31
namespace CVC4 {
32
33
// forward declarations
34
namespace Minisat {
35
  class Solver;
36
}/* Minisat namespace */
37
38
namespace prop {
39
  class CnfStream;
40
}/* CVC4::prop namespace */
41
42
class SmtEngine;
43
44
template <class Solver> class TSatProof;
45
typedef TSatProof< CVC4::Minisat::Solver> CoreSatProof;
46
47
class CnfProof;
48
49
typedef TSatProof<CVC4::Minisat::Solver> CoreSatProof;
50
51
namespace prop {
52
  typedef uint64_t SatVariable;
53
  class SatLiteral;
54
  typedef std::vector<SatLiteral> SatClause;
55
}/* CVC4::prop namespace */
56
57
typedef std::unordered_map<ClauseId, prop::SatClause*> IdToSatClause;
58
typedef context::CDHashSet<Node, NodeHashFunction> CDNodeSet;
59
typedef context::CDHashMap<Node, std::vector<Node>, NodeHashFunction> CDNodeToNodes;
60
typedef std::unordered_set<ClauseId> IdHashSet;
61
62
class ProofManager {
63
  context::Context* d_context;
64
65
  std::unique_ptr<CoreSatProof> d_satProof;
66
  std::unique_ptr<CnfProof> d_cnfProof;
67
68
  // information that will need to be shared across proofs
69
  CDNodeSet d_inputCoreFormulas;
70
  CDNodeSet d_outputCoreFormulas;
71
72
  int d_nextId;
73
74
  CDNodeToNodes d_deps;
75
76
public:
77
 ProofManager(context::Context* context);
78
 ~ProofManager();
79
80
 static ProofManager* currentPM();
81
82
 // initialization
83
 void initSatProof(Minisat::Solver* solver);
84
 void initCnfProof(CVC4::prop::CnfStream* cnfStream, context::Context* ctx);
85
86
 // getting various proofs
87
 static CoreSatProof* getSatProof();
88
 static CnfProof* getCnfProof();
89
90
 /** Public unsat core methods **/
91
 void addCoreAssertion(Node formula);
92
93
 void addDependence(TNode n, TNode dep);
94
 void addUnsatCore(Node formula);
95
96
 // trace dependences back to unsat core
97
 void traceDeps(TNode n, CDNodeSet* coreAssertions);
98
 void traceUnsatCore();
99
100
 typedef CDNodeSet::const_iterator output_core_iterator;
101
102
908
 output_core_iterator begin_unsat_core() const
103
 {
104
908
   return d_outputCoreFormulas.begin();
105
 }
106
908
 output_core_iterator end_unsat_core() const
107
 {
108
908
   return d_outputCoreFormulas.end();
109
 }
110
 size_t size_unsat_core() const { return d_outputCoreFormulas.size(); }
111
 std::vector<Node> extractUnsatCore();
112
113
 bool unsatCoreAvailable() const;
114
 void getLemmasInUnsatCore(std::vector<Node>& lemmas);
115
116
564245
 int nextId() { return d_nextId++; }
117
118
private:
119
 void constructSatProof();
120
121
};/* class ProofManager */
122
123
}/* CVC4 namespace */
124
125
126
127
#endif /* CVC4__PROOF_MANAGER_H */