diff options
Diffstat (limited to 'src/theory/rewriter.h')
-rw-r--r-- | src/theory/rewriter.h | 65 |
1 files changed, 10 insertions, 55 deletions
diff --git a/src/theory/rewriter.h b/src/theory/rewriter.h index 23a9914bd..63628b0af 100644 --- a/src/theory/rewriter.h +++ b/src/theory/rewriter.h @@ -18,6 +18,7 @@ #pragma once #include "expr/node.h" +#include "proof/method_id.h" #include "theory/theory_rewriter.h" namespace cvc5 { @@ -105,46 +106,19 @@ class Rewriter { */ void registerTheoryRewriter(theory::TheoryId tid, TheoryRewriter* trew); - /** - * Register a prerewrite for a given kind. - * - * @param k The kind to register a rewrite for. - * @param fn The function that performs the rewrite. - */ - void registerPreRewrite( - Kind k, std::function<RewriteResponse(RewriteEnvironment*, TNode)> fn); - - /** - * Register a postrewrite for a given kind. - * - * @param k The kind to register a rewrite for. - * @param fn The function that performs the rewrite. - */ - void registerPostRewrite( - Kind k, std::function<RewriteResponse(RewriteEnvironment*, TNode)> fn); - - /** - * Register a prerewrite for equalities belonging to a given theory. - * - * @param tid The theory to register a rewrite for. - * @param fn The function that performs the rewrite. - */ - void registerPreRewriteEqual( - theory::TheoryId tid, - std::function<RewriteResponse(RewriteEnvironment*, TNode)> fn); + /** Get the theory rewriter for the given id */ + TheoryRewriter* getTheoryRewriter(theory::TheoryId theoryId); /** - * Register a postrewrite for equalities belonging to a given theory. + * Apply rewrite on n via the rewrite method identifier idr (see method_id.h). + * This encapsulates the exact behavior of a REWRITE step in a proof. * - * @param tid The theory to register a rewrite for. - * @param fn The function that performs the rewrite. + * @param n The node to rewrite, + * @param idr The method identifier of the rewriter, by default RW_REWRITE + * specifying a call to rewrite. + * @return The rewritten form of n. */ - void registerPostRewriteEqual( - theory::TheoryId tid, - std::function<RewriteResponse(RewriteEnvironment*, TNode)> fn); - - /** Get the theory rewriter for the given id */ - TheoryRewriter* getTheoryRewriter(theory::TheoryId theoryId); + Node rewriteViaMethod(TNode n, MethodId idr = MethodId::RW_REWRITE); private: /** @@ -200,25 +174,6 @@ class Rewriter { /** Theory rewriters used by this rewriter instance */ TheoryRewriter* d_theoryRewriters[theory::THEORY_LAST]; - /** Rewriter table for prewrites. Maps kinds to rewriter function. */ - std::function<RewriteResponse(RewriteEnvironment*, TNode)> - d_preRewriters[kind::LAST_KIND]; - /** Rewriter table for postrewrites. Maps kinds to rewriter function. */ - std::function<RewriteResponse(RewriteEnvironment*, TNode)> - d_postRewriters[kind::LAST_KIND]; - /** - * Rewriter table for prerewrites of equalities. Maps theory to rewriter - * function. - */ - std::function<RewriteResponse(RewriteEnvironment*, TNode)> - d_preRewritersEqual[theory::THEORY_LAST]; - /** - * Rewriter table for postrewrites of equalities. Maps theory to rewriter - * function. - */ - std::function<RewriteResponse(RewriteEnvironment*, TNode)> - d_postRewritersEqual[theory::THEORY_LAST]; - RewriteEnvironment d_re; /** The proof generator */ |