Commit
64a7db86206aa0993f75446a3e7f77f3c0c023c6 introduced a caching
mechanism in `TheoryEngine::getExplanation()`. However, there seem to be
issues related to the timestamps of the explanations. This commit fixes
the issue by making the timestamp part of the cache. The change ensures
that explanations for a certain node never rely on other explanations
for that node with a later timestamp.
}
});
// cache of nodes we have already explained by some theory
- std::unordered_set<Node, NodeHashFunction> cache;
+ std::unordered_map<Node, size_t, NodeHashFunction> cache;
while (i < explanationVector.size()) {
// Get the current literal to explain
<< toExplain.d_timestamp << "] " << toExplain.d_node << " sent from "
<< toExplain.d_theory << endl;
+ if (cache.find(toExplain.d_node) != cache.end()
+ && cache[toExplain.d_node] < toExplain.d_timestamp)
+ {
+ ++i;
+ continue;
+ }
+ cache[toExplain.d_node] = toExplain.d_timestamp;
+
// If a true constant or a negation of a false constant we can ignore it
if (toExplain.d_node.isConst() && toExplain.d_node.getConst<bool>())
{
continue;
}
}
- // We must cache after checking the timestamp in the block of code above.
- // Afterwards, we can ignore this timestamp, as well as caching the Node,
- // since any theory's explanation will suffice.
- if (cache.find(toExplain.d_node) != cache.end())
- {
- ++i;
- continue;
- }
- cache.insert(toExplain.d_node);
- // It was produced by the theory, so ask for an explanation
+
Node explanation;
if (toExplain.d_theory == THEORY_BUILTIN)
{
regress1/strings/issue3657-unexpectedUnsatCVC4.smt2
regress1/strings/issue4379.smt2
regress1/strings/issue4608-re-derive.smt2
+ regress1/strings/issue4735.smt2
+ regress1/strings/issue4735_2.smt2
regress1/strings/kaluza-fl.smt2
regress1/strings/loop002.smt2
regress1/strings/loop003.smt2
-; COMMAND-LINE: --no-check-models
+; COMMAND-LINE: --no-check-models --nl-ext-tplanes
; EXPECT: sat
(set-info :smt-lib-version 2.6)
(set-logic QF_NRA)
--- /dev/null
+; COMMAND-LINE: --strings-fmf
+; EXPECT: sat
+(set-logic QF_S)
+(declare-fun a () String)
+(declare-fun b () Int)
+(declare-fun c () String)
+(declare-fun d () String)
+(declare-fun e () String)
+(declare-fun f () String)
+(declare-fun g () String)
+(declare-fun h () String)
+(declare-fun i () Bool)
+(declare-fun j () String)
+(declare-fun k () String)
+(assert (= e "0000000000"))
+(assert (distinct a d))
+(assert
+ (ite (distinct b 0)
+ (and (= (str.++ d e) (str.++ c j))
+ (= (str.len c) 2)
+ (= j (str.++ f k))
+ (= f (str.++ g h))
+ (str.in_re g (str.to_re "A")))
+ (str.in_re j (str.to_re ""))))
+(assert (distinct i (= b 0)))
+(assert i)
+(check-sat)
--- /dev/null
+; COMMAND-LINE: --strings-fmf
+; EXPECT: sat
+(set-logic QF_S)
+(declare-fun a () String)
+(declare-fun b () String)
+(assert (distinct b (str.++ a a)))
+(assert (str.in_re (str.++ b "\x2f" b) (re.++ (re.opt re.allchar) (str.to_re "\x2f\x65") re.all)))
+(check-sat)