From d662d3321a46aac61973f7a90341ea870c0b1171 Mon Sep 17 00:00:00 2001 From: Aina Niemetz Date: Sat, 3 Oct 2020 13:18:45 -0700 Subject: [PATCH] sygus-inst: Add more special BV values. (#5191) --- src/theory/quantifiers/sygus_inst.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/theory/quantifiers/sygus_inst.cpp b/src/theory/quantifiers/sygus_inst.cpp index 4192ca746..e2aeee1b6 100644 --- a/src/theory/quantifiers/sygus_inst.cpp +++ b/src/theory/quantifiers/sygus_inst.cpp @@ -18,6 +18,7 @@ #include #include "expr/node_algorithm.h" +#include "theory/bv/theory_bv_utils.h" #include "theory/datatypes/sygus_datatype_utils.h" #include "theory/quantifiers/sygus/sygus_enumerator.h" #include "theory/quantifiers/sygus/sygus_grammar_cons.h" @@ -157,6 +158,26 @@ void getMinGroundTerms( } while (!visit.empty()); } +/* + * Add special values for a given type. + * + * @param tn: The type node. + * @param extra_cons: A map of TypeNode to constants, which are added in + * addition to the default grammar. + */ +void addSpecialValues( + const TypeNode& tn, + std::map>& extra_cons) +{ + if (tn.isBitVector()) + { + uint32_t size = tn.getBitVectorSize(); + extra_cons[tn].insert(bv::utils::mkOnes(size)); + extra_cons[tn].insert(bv::utils::mkMinSigned(size)); + extra_cons[tn].insert(bv::utils::mkMaxSigned(size)); + } +} + } // namespace SygusInst::SygusInst(QuantifiersEngine* qe) @@ -361,6 +382,7 @@ void SygusInst::registerQuantifier(Node q) std::vector types; for (const Node& var : q[0]) { + addSpecialValues(var.getType(), extra_cons); TypeNode tn = CegGrammarConstructor::mkSygusDefaultType(var.getType(), Node(), var.toString(), -- 2.30.2