summaryrefslogtreecommitdiff
path: root/src/theory/quantifiers/sygus_sampler.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2018-04-10 16:44:02 -0500
committerGitHub <noreply@github.com>2018-04-10 16:44:02 -0500
commitf1d4d477d7cbfb6c8ba79232986a4135c5647e4a (patch)
tree9ec138c6b901172e809fd5fb89e67e4a92ad2239 /src/theory/quantifiers/sygus_sampler.cpp
parent817fe6d90c25dbdfe62c658add02efd51e2e29eb (diff)
Improve accuracy of stats for sygus sampler (#1755)
Diffstat (limited to 'src/theory/quantifiers/sygus_sampler.cpp')
-rw-r--r--src/theory/quantifiers/sygus_sampler.cpp69
1 files changed, 48 insertions, 21 deletions
diff --git a/src/theory/quantifiers/sygus_sampler.cpp b/src/theory/quantifiers/sygus_sampler.cpp
index f9ae0b553..f15c1199c 100644
--- a/src/theory/quantifiers/sygus_sampler.cpp
+++ b/src/theory/quantifiers/sygus_sampler.cpp
@@ -14,7 +14,9 @@
#include "theory/quantifiers/sygus_sampler.h"
+#include "options/base_options.h"
#include "options/quantifiers_options.h"
+#include "printer/printer.h"
#include "util/bitvector.h"
#include "util/random.h"
@@ -700,13 +702,13 @@ void SygusSamplerExt::initializeSygusExt(QuantifiersEngine* qe,
Node SygusSamplerExt::registerTerm(Node n, bool forceKeep)
{
Node eq_n = SygusSampler::registerTerm(n, forceKeep);
- Trace("sygus-synth-rr") << "sygusSampleExt : " << n << "..." << eq_n
- << std::endl;
if (eq_n == n)
{
// this is a unique term
return n;
}
+ Trace("sygus-synth-rr") << "sygusSampleExt : " << n << "..." << eq_n
+ << std::endl;
Node bn = n;
Node beq_n = eq_n;
if (d_use_sygus_type)
@@ -727,7 +729,7 @@ Node SygusSamplerExt::registerTerm(Node n, bool forceKeep)
if (!d_match_trie.getMatches(bn, &d_ssenm))
{
keep = false;
- Trace("sygus-synth-rr-debug") << "...redundant (matchable)" << std::endl;
+ Trace("sygus-synth-rr") << "...redundant (matchable)" << std::endl;
}
}
@@ -735,39 +737,64 @@ Node SygusSamplerExt::registerTerm(Node n, bool forceKeep)
if (d_drewrite != nullptr)
{
Trace("sygus-synth-rr-debug") << "Add rewrite pair..." << std::endl;
- if (!d_drewrite->addRewrite(bn, beq_n))
+ if (d_drewrite->areEqual(bn, beq_n))
{
// must be unique according to the dynamic rewriter
+ Trace("sygus-synth-rr") << "...redundant (rewritable)" << std::endl;
keep = false;
- Trace("sygus-synth-rr-debug") << "...redundant (rewritable)" << std::endl;
}
}
if (keep)
{
- // add to match information
- for (unsigned r = 0; r < 2; r++)
- {
- Node t = r == 0 ? bn : beq_n;
- Node to = r == 0 ? beq_n : bn;
- // insert in match trie if first time
- if (d_pairs.find(t) == d_pairs.end())
- {
- Trace("sse-match") << "SSE add term : " << t << std::endl;
- d_match_trie.addTerm(t);
- }
- d_pairs[t].insert(to);
- }
return eq_n;
}
- else if (Trace.isOn("sygus-synth-rr"))
+ Trace("sygus-synth-rr") << "Redundant pair : " << eq_n << " " << n;
+ Trace("sygus-synth-rr") << std::endl;
+ if (Trace.isOn("sygus-rr-filter"))
{
- Trace("sygus-synth-rr") << "Redundant pair : " << eq_n << " " << n;
- Trace("sygus-synth-rr") << std::endl;
+ Printer* p = Printer::getPrinter(options::outputLanguage());
+ std::stringstream ss;
+ ss << "(redundant-rewrite ";
+ p->toStreamSygus(ss, n);
+ ss << " ";
+ p->toStreamSygus(ss, eq_n);
+ Trace("sygus-rr-filter") << ss.str() << std::endl;
}
return Node::null();
}
+void SygusSamplerExt::registerRelevantPair(Node n, Node eq_n)
+{
+ Node bn = n;
+ Node beq_n = eq_n;
+ if (d_use_sygus_type)
+ {
+ bn = d_tds->sygusToBuiltin(n);
+ beq_n = d_tds->sygusToBuiltin(eq_n);
+ }
+ // ----- check rewriting redundancy
+ if (d_drewrite != nullptr)
+ {
+ Trace("sygus-synth-rr-debug") << "Add rewrite pair..." << std::endl;
+ Assert(!d_drewrite->areEqual(bn, beq_n));
+ d_drewrite->addRewrite(bn, beq_n);
+ }
+ // add to match information
+ for (unsigned r = 0; r < 2; r++)
+ {
+ Node t = r == 0 ? bn : beq_n;
+ Node to = r == 0 ? beq_n : bn;
+ // insert in match trie if first time
+ if (d_pairs.find(t) == d_pairs.end())
+ {
+ Trace("sse-match") << "SSE add term : " << t << std::endl;
+ d_match_trie.addTerm(t);
+ }
+ d_pairs[t].insert(to);
+ }
+}
+
bool SygusSamplerExt::notify(Node s,
Node n,
std::vector<Node>& vars,
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback