diff options
Diffstat (limited to 'src/theory/theory.h')
-rw-r--r-- | src/theory/theory.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/theory/theory.h b/src/theory/theory.h index a5234cf25..0cea604bf 100644 --- a/src/theory/theory.h +++ b/src/theory/theory.h @@ -43,12 +43,14 @@ #include "theory/output_channel.h" #include "theory/theory_id.h" #include "theory/theory_rewriter.h" +#include "theory/trust_node.h" #include "theory/valuation.h" #include "util/statistics_registry.h" namespace CVC4 { class TheoryEngine; +class ProofNodeManager; namespace theory { @@ -105,6 +107,9 @@ class Theory { /** Information about the logic we're operating within. */ const LogicInfo& d_logicInfo; + /** Pointer to proof node manager */ + ProofNodeManager* d_pnm; + /** * The assertFact() queue. * @@ -199,6 +204,7 @@ class Theory { OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo, + ProofNodeManager* pnm, std::string instance = ""); // taking : No default. /** @@ -440,6 +446,19 @@ class Theory { virtual void finishInit() { } /** + * Expand definitions in the term node. This returns a term that is + * equivalent to node. It wraps this term in a TrustNode of kind + * TrustNodeKind::REWRITE. If node is unchanged by this method, the + * null TrustNode may be returned. This is an optimization to avoid + * constructing the trivial equality (= node node) internally within + * TrustNode. + * + * The purpose of this method is typically to eliminate the operators in node + * that are syntax sugar that cannot otherwise be eliminated during rewriting. + * For example, division relies on the introduction of an uninterpreted + * function for the divide-by-zero case, which we do not introduce with + * the rewriter, since this function may be cached in a non-global fashion. + * * Some theories have kinds that are effectively definitions and should be * expanded before they are handled. Definitions allow a much wider range of * actions than the normal forms given by the rewriter. However no @@ -453,10 +472,10 @@ class Theory { * a theory wants to be notified about a term before preprocessing * and simplification but doesn't necessarily want to rewrite it. */ - virtual Node expandDefinition(Node node) + virtual TrustNode expandDefinition(Node node) { // by default, do nothing - return node; + return TrustNode::null(); } /** @@ -534,7 +553,8 @@ class Theory { * Return an explanation for the literal represented by parameter n * (which was previously propagated by this theory). */ - virtual Node explain(TNode n) { + virtual TrustNode explain(TNode n) + { Unimplemented() << "Theory " << identify() << " propagated a node but doesn't implement the " "Theory::explain() interface!"; @@ -579,9 +599,12 @@ class Theory { * Given an atom of the theory coming from the input formula, this * method can be overridden in a theory implementation to rewrite * the atom into an equivalent form. This is only called just - * before an input atom to the engine. + * before an input atom to the engine. This method returns a TrustNode of + * kind TrustNodeKind::REWRITE, which carries information about the proof + * generator for the rewrite. Similarly to expandDefinition, this method may + * return the null TrustNode if atom is unchanged. */ - virtual Node ppRewrite(TNode atom) { return atom; } + virtual TrustNode ppRewrite(TNode atom) { return TrustNode::null(); } /** * Notify preprocessed assertions. Called on new assertions after |