This ensures that we always cache regular expressions in a user-dependent manner. Previously, we were erroneously caching in a SAT-dependent way for very rare cases when non-constant regular expressions were used. Since we never dependent on current assertions for the unfolding, there is no need to cache in the SAT context.
This fixes the second benchmark from #6203.
This PR also improves our traces for checking models in strings.
if (d_reduced.find(n)!=d_reduced.end())
{
// already sent a reduction lemma
- Trace("strings-extf-debug") << "...skip due to reduced" << std::endl;
+ Trace("strings-extf-debug") << "...skip due to reduced" << std::endl;
return false;
}
// determine the effort level to process the extf at
}
if (effort != r_effort)
{
-
- Trace("strings-extf-debug") << "...skip due to effort" << std::endl;
+ Trace("strings-extf-debug") << "...skip due to effort" << std::endl;
// not the right effort level to reduce
return false;
}
return true;
}
+std::string ExtfSolver::debugPrintModel()
+{
+ std::stringstream ss;
+ std::vector<Node> extf;
+ d_extt.getTerms(extf);
+ // each extended function should have at least one annotation below
+ for (const Node& n : extf)
+ {
+ ss << "- " << n;
+ if (!d_extt.isActive(n))
+ {
+ ss << " :extt-inactive";
+ }
+ if (!d_extfInfoTmp[n].d_modelActive)
+ {
+ ss << " :model-inactive";
+ }
+ if (d_reduced.find(n) != d_reduced.end())
+ {
+ ss << " :reduced";
+ }
+ ss << std::endl;
+ }
+ return ss.str();
+}
+
} // namespace strings
} // namespace theory
} // namespace cvc5
*/
std::vector<Node> getActive(Kind k) const;
//---------------------------------- end information about ExtTheory
+ /**
+ * Print the relevant information regarding why we have a model, return as a
+ * string.
+ */
+ std::string debugPrintModel();
+
private:
/** do reduction
*
bool addedLemma = false;
bool changed = false;
std::vector<Node> processed;
- std::vector<Node> cprocessed;
Trace("regexp-process") << "Checking Memberships ... " << std::endl;
for (const std::pair<const Node, std::vector<Node> >& mr : mems)
polarity ? InferenceId::STRINGS_RE_UNFOLD_POS : InferenceId::STRINGS_RE_UNFOLD_NEG;
d_im.sendInference(iexp, noExplain, conc, inf);
addedLemma = true;
- if (changed)
- {
- cprocessed.push_back(assertion);
- }
- else
- {
- processed.push_back(assertion);
- }
+ processed.push_back(assertion);
if (e == 0)
{
// Remember that we have unfolded a membership for x
<< "...add " << processed[i] << " to u-cache." << std::endl;
d_regexp_ucached.insert(processed[i]);
}
- for (unsigned i = 0; i < cprocessed.size(); i++)
- {
- Trace("strings-regexp")
- << "...add " << cprocessed[i] << " to c-cache." << std::endl;
- d_regexp_ccached.insert(cprocessed[i]);
- }
}
}
}
bool TheoryStrings::collectModelValues(TheoryModel* m,
const std::set<Node>& termSet)
{
- if (Trace.isOn("strings-model"))
+ if (Trace.isOn("strings-debug-model"))
{
- Trace("strings-model") << "TheoryStrings : Collect model values"
- << std::endl;
- Trace("strings-model") << "Equivalence classes are:" << std::endl;
- Trace("strings-model") << debugPrintStringsEqc() << std::endl;
+ Trace("strings-debug-model")
+ << "TheoryStrings::collectModelValues" << std::endl;
+ Trace("strings-debug-model") << "Equivalence classes are:" << std::endl;
+ Trace("strings-debug-model") << debugPrintStringsEqc() << std::endl;
+ Trace("strings-debug-model") << "Extended functions are:" << std::endl;
+ Trace("strings-debug-model") << d_esolver.debugPrintModel() << std::endl;
}
+ Trace("strings-model") << "TheoryStrings::collectModelValues" << std::endl;
std::map<TypeNode, std::unordered_set<Node, NodeHashFunction> > repSet;
// Generate model
// get the relevant string equivalence classes
regress1/strings/issue6132-non-unique-skolem.smt2
regress1/strings/issue6142-repl-inv-rew.smt2
regress1/strings/issue6191-replace-all.smt2
+ regress1/strings/issue6203-2-re-ccache.smt2
regress1/strings/kaluza-fl.smt2
regress1/strings/loop002.smt2
regress1/strings/loop003.smt2
--- /dev/null
+; COMMAND-LINE: --strings-exp
+; EXPECT: sat
+(set-logic ALL)
+(declare-fun a () String)
+(assert
+ (xor (str.in_re a (re.++ (re.* re.allchar) (str.to_re "A") re.allchar (re.* re.allchar)))
+ (str.in_re a (re.++ (re.* (str.to_re a)) (str.to_re "A") re.allchar))))
+(check-sat)