From: Andrew Reynolds Date: Fri, 2 Aug 2019 17:01:27 +0000 (-0500) Subject: Throw option exception when track inst lemmas is not used (#3145) X-Git-Tag: cvc5-1.0.0~4053 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=daeab65ac6c6715a3e0c2f6fc0e61b1a7925b932;p=cvc5.git Throw option exception when track inst lemmas is not used (#3145) --- diff --git a/src/theory/quantifiers/instantiate.cpp b/src/theory/quantifiers/instantiate.cpp index 8bd39c241..7ecf9866a 100644 --- a/src/theory/quantifiers/instantiate.cpp +++ b/src/theory/quantifiers/instantiate.cpp @@ -644,42 +644,46 @@ void Instantiate::getExplanationForInstLemmas( std::map& quant, std::map >& tvec) { - if (options::trackInstLemmas()) + if (!options::trackInstLemmas()) { - if (options::incrementalSolving()) + std::stringstream msg; + msg << "Cannot get explanation for instantiations when --track-inst-lemmas " + "is false."; + throw OptionException(msg.str()); + } + if (options::incrementalSolving()) + { + for (std::pair& t : d_c_inst_match_trie) { - for (std::pair& t : - d_c_inst_match_trie) - { - t.second->getExplanationForInstLemmas(t.first, lems, quant, tvec); - } + t.second->getExplanationForInstLemmas(t.first, lems, quant, tvec); } - else + } + else + { + for (std::pair& t : d_inst_match_trie) { - for (std::pair& t : d_inst_match_trie) - { - t.second.getExplanationForInstLemmas(t.first, lems, quant, tvec); - } + t.second.getExplanationForInstLemmas(t.first, lems, quant, tvec); } + } #ifdef CVC4_ASSERTIONS - for (unsigned j = 0; j < lems.size(); j++) - { - Assert(quant.find(lems[j]) != quant.end()); - Assert(tvec.find(lems[j]) != tvec.end()); - } -#endif + for (unsigned j = 0; j < lems.size(); j++) + { + Assert(quant.find(lems[j]) != quant.end()); + Assert(tvec.find(lems[j]) != tvec.end()); } - Assert(false); +#endif } void Instantiate::getInstantiations(std::map >& insts) { - bool useUnsatCore = false; - std::vector active_lemmas; - if (options::trackInstLemmas() && getUnsatCoreLemmas(active_lemmas)) + if (!options::trackInstLemmas()) { - useUnsatCore = true; + std::stringstream msg; + msg << "Cannot get instantiations when --track-inst-lemmas is false."; + throw OptionException(msg.str()); } + std::vector active_lemmas; + bool useUnsatCore = getUnsatCoreLemmas(active_lemmas); if (options::incrementalSolving()) {