/********************* */ /*! \file proof_manager.h ** \verbatim ** Top contributors (to current version): ** Liana Hadarean, Haniel Barbosa, Andrew Reynolds ** This file is part of the CVC4 project. ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS ** in the top-level source directory and their institutional affiliations. ** All rights reserved. See the file COPYING in the top-level source ** directory for licensing information.\endverbatim ** ** \brief A manager for Proofs ** ** A manager for Proofs. **/ #include "cvc4_private.h" #ifndef CVC4__PROOF_MANAGER_H #define CVC4__PROOF_MANAGER_H #include #include #include #include "context/cdhashmap.h" #include "context/cdhashset.h" #include "expr/node.h" #include "proof/clause_id.h" namespace cvc5 { // forward declarations namespace Minisat { class Solver; }/* Minisat namespace */ namespace prop { class CnfStream; } // namespace prop class SmtEngine; template class TSatProof; typedef TSatProof CoreSatProof; class CnfProof; typedef TSatProof CoreSatProof; namespace prop { typedef uint64_t SatVariable; class SatLiteral; typedef std::vector SatClause; } // namespace prop typedef std::unordered_map IdToSatClause; typedef context::CDHashSet CDNodeSet; typedef context::CDHashMap, NodeHashFunction> CDNodeToNodes; typedef std::unordered_set IdHashSet; class ProofManager { context::Context* d_context; std::unique_ptr d_satProof; std::unique_ptr d_cnfProof; // information that will need to be shared across proofs CDNodeSet d_inputCoreFormulas; CDNodeSet d_outputCoreFormulas; int d_nextId; CDNodeToNodes d_deps; public: ProofManager(context::Context* context); ~ProofManager(); static ProofManager* currentPM(); // initialization void initSatProof(Minisat::Solver* solver); void initCnfProof(cvc5::prop::CnfStream* cnfStream, context::Context* ctx); // getting various proofs static CoreSatProof* getSatProof(); static CnfProof* getCnfProof(); /** Public unsat core methods **/ void addCoreAssertion(Node formula); void addDependence(TNode n, TNode dep); void addUnsatCore(Node formula); // trace dependences back to unsat core void traceDeps(TNode n, CDNodeSet* coreAssertions); void traceUnsatCore(); typedef CDNodeSet::const_iterator output_core_iterator; output_core_iterator begin_unsat_core() const { return d_outputCoreFormulas.begin(); } output_core_iterator end_unsat_core() const { return d_outputCoreFormulas.end(); } size_t size_unsat_core() const { return d_outputCoreFormulas.size(); } std::vector extractUnsatCore(); bool unsatCoreAvailable() const; void getLemmasInUnsatCore(std::vector& lemmas); int nextId() { return d_nextId++; } private: void constructSatProof(); };/* class ProofManager */ } // namespace cvc5 #endif /* CVC4__PROOF_MANAGER_H */