diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2020-04-03 14:52:45 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-03 14:52:45 -0700 |
commit | aeede74491d1db9c5bac771e78b79934ca4ab552 (patch) | |
tree | a3c05a53702514520b9625b30995e7d789c39982 /src/theory/fp | |
parent | badc9cb00c9086b9303fab1b494e9c5eb88265ec (diff) |
Update theory rewriter ownership, add stats to strings (#4202)
This commit adds statistics for string rewrites. This is work towards proof
support in the string solver. At a high level, this commit adds a pointer to a
`SequenceStatistics` in the rewriters and modifies
`SequencesRewriter::returnRewrite()` to count the rewrites done. In practice,
to make this work requires a couple of changes, some of them temporary:
- We can't have a single `Rewriter` instance shared between different
`SmtEngine` instances anymore. Thus the `Rewriter` is now owned by the
`SmtEngine` and calling the rewriter retrieves the rewriter associated with
the current `SmtEngine`. This is a temporary workaround before we get rid of
singletons.
- Methods in the `SequencesRewriter` and the `StringsRewriter` are made
non-`static` because they need access to the statistics instance.
- `StringsEntail` now has non-`static` methods because it needs a reference to
the sequences rewriter that it can call.
- The interaction between the `StringsRewriter` and the `SequencesRewriter`
changed: the `StringsRewriter` is now a proper `TheoryRewriter` that inherits
from `SequencesRewriter` and calls its `postRewrite()` before applying its
own rewrites (this is essentially a reversal of roles from before: the
`SequencesRewriter` used to call `static` methods in the `StringsRewriter`).
- The theory rewriters are now owned by the individual theories. This design
mirrors the `EqualityEngine`s owned by the individual theories.
Diffstat (limited to 'src/theory/fp')
-rw-r--r-- | src/theory/fp/theory_fp.cpp | 6 | ||||
-rw-r--r-- | src/theory/fp/theory_fp.h | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/src/theory/fp/theory_fp.cpp b/src/theory/fp/theory_fp.cpp index 5ab285766..b028184cd 100644 --- a/src/theory/fp/theory_fp.cpp +++ b/src/theory/fp/theory_fp.cpp @@ -174,14 +174,8 @@ TheoryFp::TheoryFp(context::Context *c, d_equalityEngine.addFunctionKind(kind::FLOATINGPOINT_COMPONENT_EXPONENT); d_equalityEngine.addFunctionKind(kind::FLOATINGPOINT_COMPONENT_SIGNIFICAND); d_equalityEngine.addFunctionKind(kind::ROUNDINGMODE_BITBLAST); - } /* TheoryFp::TheoryFp() */ -std::unique_ptr<TheoryRewriter> TheoryFp::mkTheoryRewriter() -{ - return std::unique_ptr<TheoryRewriter>(new TheoryFpRewriter()); -} - Node TheoryFp::minUF(Node node) { Assert(node.getKind() == kind::FLOATINGPOINT_MIN); TypeNode t(node.getType()); diff --git a/src/theory/fp/theory_fp.h b/src/theory/fp/theory_fp.h index 802a70435..ae4a2a1cb 100644 --- a/src/theory/fp/theory_fp.h +++ b/src/theory/fp/theory_fp.h @@ -25,6 +25,7 @@ #include "context/cdo.h" #include "theory/fp/fp_converter.h" +#include "theory/fp/theory_fp_rewriter.h" #include "theory/theory.h" #include "theory/uf/equality_engine.h" @@ -38,7 +39,7 @@ class TheoryFp : public Theory { TheoryFp(context::Context* c, context::UserContext* u, OutputChannel& out, Valuation valuation, const LogicInfo& logicInfo); - std::unique_ptr<TheoryRewriter> mkTheoryRewriter() override; + TheoryRewriter* getTheoryRewriter() override { return &d_rewriter; } Node expandDefinition(LogicRequest& lr, Node node) override; @@ -144,6 +145,8 @@ class TheoryFp : public Theory { bool refineAbstraction(TheoryModel* m, TNode abstract, TNode concrete); + /** The theory rewriter for this theory. */ + TheoryFpRewriter d_rewriter; }; /* class TheoryFp */ } // namespace fp |