From f0d1016c0c9b5335a4c2f564ac1a115fe0a74329 Mon Sep 17 00:00:00 2001 From: Andrew Reynolds Date: Sun, 4 Nov 2018 18:06:29 -0600 Subject: Implement option to turn off symmetry breaking for basic enumerators (#2686) Improves the existing implementation for sygus-active-gen=basic. --- src/theory/quantifiers/sygus/sygus_enumerator.cpp | 43 ++++++++++++----------- src/theory/quantifiers/sygus/synth_conjecture.cpp | 12 +++---- 2 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/theory/quantifiers/sygus/sygus_enumerator.cpp b/src/theory/quantifiers/sygus/sygus_enumerator.cpp index 61ab9007a..a39c9e958 100644 --- a/src/theory/quantifiers/sygus/sygus_enumerator.cpp +++ b/src/theory/quantifiers/sygus/sygus_enumerator.cpp @@ -241,33 +241,36 @@ bool SygusEnumerator::TermCache::addTerm(Node n) d_terms.push_back(n); return true; } - Node bn = d_tds->sygusToBuiltin(n); - Node bnr = d_tds->getExtRewriter()->extendedRewrite(bn); - // must be unique up to rewriting - if (d_bterms.find(bnr) != d_bterms.end()) + if (options::sygusSymBreakDynamic()) { - Trace("sygus-enum-exc") << "Exclude: " << bn << std::endl; - return false; - } - // if we are doing PBE symmetry breaking - if (d_pbe != nullptr) - { - // Is it equivalent under examples? - Node bne = d_pbe->addSearchVal(d_tn, d_enum, bnr); - if (!bne.isNull()) + Node bn = d_tds->sygusToBuiltin(n); + Node bnr = d_tds->getExtRewriter()->extendedRewrite(bn); + // must be unique up to rewriting + if (d_bterms.find(bnr) != d_bterms.end()) + { + Trace("sygus-enum-exc") << "Exclude: " << bn << std::endl; + return false; + } + // if we are doing PBE symmetry breaking + if (d_pbe != nullptr) { - if (bnr != bne) + // Is it equivalent under examples? + Node bne = d_pbe->addSearchVal(d_tn, d_enum, bnr); + if (!bne.isNull()) { - Trace("sygus-enum-exc") << "Exclude (by examples): " << bn - << ", since we already have " << bne - << "!=" << bnr << std::endl; - return false; + if (bnr != bne) + { + Trace("sygus-enum-exc") << "Exclude (by examples): " << bn + << ", since we already have " << bne + << "!=" << bnr << std::endl; + return false; + } } } + Trace("sygus-enum-terms") << "tc(" << d_tn << "): term " << bn << std::endl; + d_bterms.insert(bnr); } - Trace("sygus-enum-terms") << "tc(" << d_tn << "): term " << bn << std::endl; d_terms.push_back(n); - d_bterms.insert(bnr); return true; } void SygusEnumerator::TermCache::pushEnumSizeIndex() diff --git a/src/theory/quantifiers/sygus/synth_conjecture.cpp b/src/theory/quantifiers/sygus/synth_conjecture.cpp index 21079aedc..e668b2206 100644 --- a/src/theory/quantifiers/sygus/synth_conjecture.cpp +++ b/src/theory/quantifiers/sygus/synth_conjecture.cpp @@ -705,17 +705,17 @@ class EnumValGeneratorBasic : public EnumValGenerator } Node next = *d_te; ++d_te; - Node nextb = d_tds->sygusToBuiltin(next); if (options::sygusSymBreakDynamic()) { + Node nextb = d_tds->sygusToBuiltin(next); nextb = d_tds->getExtRewriter()->extendedRewrite(nextb); - } - if (d_cache.find(nextb) == d_cache.end()) - { + if (d_cache.find(nextb) != d_cache.end()) + { + return getNext(); + } d_cache.insert(nextb); - return next; } - return getNext(); + return next; } private: -- cgit v1.2.3