summaryrefslogtreecommitdiff
path: root/src/theory/strings/skolem_cache.cpp
diff options
context:
space:
mode:
authorAndrew Reynolds <andrew.j.reynolds@gmail.com>2020-12-08 00:38:14 -0600
committerGitHub <noreply@github.com>2020-12-08 00:38:14 -0600
commit0309ef4aa7462c6fa2a65c1ef408dc9063bb1f21 (patch)
tree6a5165e43890811a91d01bce0ff7cb3893a4257c /src/theory/strings/skolem_cache.cpp
parent3223d3c765b87db9d87a7ca65c4b7cf5dc9a7885 (diff)
Proper implementation of expand definitions for sequences (#5616)
Expand definitions for sequences was wrong in two ways: (1) we replaced str.from_code with a witness term. This led to it being unevaluatable in models. (2) we did not handle seq.nth, meaning its model value was unevaluatable if it was out of bounds. Now it evaluates the value of the uninterpreted function we replace with. This corrects both issues and adds a regression to demonstrate both kinds of terms evaluate correctly. To do this, I added a helper function to skolem cache as well as a new (internal-only) kind SEQ_NTH_TOTAL. Notice applications of this kind should only be used for model evaluation. Notice this fixes several check-model warnings in the regressions. It still does not fix others since other things must be corrected for model evaluation (e.g. expandDefinitions must be applied on theory assertions for --debug-check-models). This will be done in later PRs.
Diffstat (limited to 'src/theory/strings/skolem_cache.cpp')
-rw-r--r--src/theory/strings/skolem_cache.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/theory/strings/skolem_cache.cpp b/src/theory/strings/skolem_cache.cpp
index a1e04071b..f5f2dfd35 100644
--- a/src/theory/strings/skolem_cache.cpp
+++ b/src/theory/strings/skolem_cache.cpp
@@ -130,6 +130,19 @@ Node SkolemCache::mkTypedSkolemCached(TypeNode tn,
return mkTypedSkolemCached(tn, a, Node::null(), id, c);
}
+Node SkolemCache::mkSkolemSeqNth(TypeNode seqType, const char* c)
+{
+ Assert(seqType.isSequence());
+ NodeManager* nm = NodeManager::currentNM();
+ std::vector<TypeNode> argTypes;
+ argTypes.push_back(seqType);
+ argTypes.push_back(nm->integerType());
+ TypeNode elemType = seqType.getSequenceElementType();
+ TypeNode ufType = nm->mkFunctionType(argTypes, elemType);
+ return mkTypedSkolemCached(
+ ufType, Node::null(), Node::null(), SkolemCache::SK_NTH, c);
+}
+
Node SkolemCache::mkSkolem(const char* c)
{
// TODO: eliminate this
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback