1 /********************* */
4 ** Top contributors (to current version):
5 ** Liana Hadarean, Haniel Barbosa, Tim King
6 ** This file is part of the CVC4 project.
7 ** Copyright (c) 2009-2020 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
12 ** \brief A manager for CnfProofs.
14 ** A manager for CnfProofs.
19 #include "cvc4_private.h"
21 #ifndef CVC4__CNF_PROOF_H
22 #define CVC4__CNF_PROOF_H
24 #include <unordered_map>
25 #include <unordered_set>
27 #include "context/cdhashmap.h"
28 #include "proof/clause_id.h"
29 #include "proof/proof_manager.h"
34 }/* CVC4::prop namespace */
38 typedef std::unordered_map
<prop::SatVariable
, Expr
> SatVarToExpr
;
39 typedef std::unordered_map
<Node
, Node
, NodeHashFunction
> NodeToNode
;
40 typedef std::unordered_set
<ClauseId
> ClauseIdSet
;
42 typedef context::CDHashMap
<ClauseId
, Node
> ClauseIdToNode
;
43 typedef std::pair
<Node
, Node
> NodePair
;
44 typedef std::set
<NodePair
> NodePairSet
;
46 typedef std::unordered_set
<Node
, NodeHashFunction
> NodeSet
;
50 CVC4::prop::CnfStream
* d_cnfStream
;
52 /** Map from ClauseId to the assertion that lead to adding this clause **/
53 ClauseIdToNode d_clauseToAssertion
;
55 /** Top of stack is assertion currently being converted to CNF. Also saves
56 * whether it is input (rather than a lemma). **/
57 std::vector
<std::pair
<Node
, bool>> d_currentAssertionStack
;
59 /** Map from top-level fact to facts/assertion that it follows from **/
62 ClauseIdSet d_explanations
;
64 // The clause ID of the unit clause defining the true SAT literal.
65 ClauseId d_trueUnitClause
;
66 // The clause ID of the unit clause defining the false SAT literal.
67 ClauseId d_falseUnitClause
;
71 CnfProof(CVC4::prop::CnfStream
* cnfStream
,
72 context::Context
* ctx
,
73 const std::string
& name
);
76 /** Methods for logging what the CnfStream does **/
77 // map the clause back to the current assertion where it came from
78 void registerConvertedClause(ClauseId clause
);
80 /** Clause is one of the clauses defining top-level assertion node*/
81 void setClauseAssertion(ClauseId clause
, Node node
);
83 /** Current assertion being converted and whether it is an input (rather than
85 void pushCurrentAssertion(Node assertion
, bool isInput
= false);
86 void popCurrentAssertion();
87 Node
getCurrentAssertion();
88 bool getCurrentAssertionKind();
91 * Checks whether the assertion stack is empty.
93 bool isAssertionStackEmpty() const { return d_currentAssertionStack
.empty(); }
95 // accessors for the leaf assertions that are being converted to CNF
96 Node
getAssertionForClause(ClauseId clause
);
97 };/* class CnfProof */
99 } /* CVC4 namespace */
101 #endif /* CVC4__CNF_PROOF_H */