summaryrefslogtreecommitdiff
path: root/src/theory/theory.h
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-07-10 19:03:24 -0500
committerGitHub <noreply@github.com>2020-07-10 19:03:24 -0500
commitc5a6aa2e03b05a5db6150563a4d5994abf5b24e9 (patch)
treec15020e9c60baafd1fa285be3d7488b06ea688be /src/theory/theory.h
parent88da95573d600f2af8538c3c5a29459a1146127c (diff)
(proof-new) Update Theory interface for proof-new (#4648)
This includes 4 changes: Theory constructor takes a ProofNodeManager, Theory::explain returns a TrustNode (of kind PROP_EXP), Theory::expandDefinitions returns a TrustNode (of kind REWRITE), Theory::ppRewrite returns a TrustNode (of kind REWRITE). These are all currently planned updates to the interface of Theory. This PR also connects some of the existing proof rule checkers into the proof checker, if one is provided to the constructor. It updates TheoryEngine and other places to process TrustNode in trivial ways (converting them into Node). These calls will later be updated as needed for proof support. This PR is also contingent on the performance tests for proof-new on SMT-LIB.
Diffstat (limited to 'src/theory/theory.h')
-rw-r--r--src/theory/theory.h33
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
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback