TNode a = d_equalityEngine.getRepresentative(node[0]);
- d_mayEqualEqualityEngine.assertEquality(node.eqNode(a), true, d_true);
+ if (node.isConst()) {
+ // Can't use d_mayEqualEqualityEngine to merge node with a because they are both constants,
+ // so just set the default value manually for node.
+ Assert(a == node[0]);
+ d_mayEqualEqualityEngine.addTerm(node);
+ Assert(d_mayEqualEqualityEngine.getRepresentative(node) == node);
+ Assert(d_mayEqualEqualityEngine.getRepresentative(a) == a);
+ DefValMap::iterator it = d_defValues.find(a);
+ Assert(it != d_defValues.end());
+ d_defValues[node] = (*it).second;
+ }
+ else {
+ d_mayEqualEqualityEngine.assertEquality(node.eqNode(a), true, d_true);
+ Assert(d_mayEqualEqualityEngine.consistent());
+ }
if (!options::arraysLazyRIntro1()) {
TNode i = node[1];
rep = nm->mkNode(kind::STORE, rep, reads[j][1], reads[j]);
}
m->assertEquality(n, rep, true);
- m->assertRepresentative(rep);
+ if (!n.isConst()) {
+ m->assertRepresentative(rep);
+ }
}
}
defValue = (*it2).second;
}
d_mayEqualEqualityEngine.assertEquality(a.eqNode(b), true, d_true);
+ Assert(d_mayEqualEqualityEngine.consistent());
if (!defValue.isNull()) {
mayRepA = d_mayEqualEqualityEngine.getRepresentative(a);
d_defValues[mayRepA] = defValue;
--- /dev/null
+(set-logic QF_ALL_SUPPORTED)
+(set-option :strings-exp true)
+(set-option :produce-models true)
+(set-info :status sat)
+
+(declare-fun text () String)
+(declare-fun output () String)
+
+; html_escape_table = {
+; "&": "&",
+; '"': """,
+; "'": "'",
+; ">": ">",
+; "<": "<",
+; }
+(declare-fun html_escape_table () (Array String String))
+(assert (= html_escape_table
+ (store (store (store (store (store ((as const (Array String String)) "A")
+ "&" "&")
+ "\"" """)
+ "'" "'")
+ ">" ">")
+ "<" "<")))
+(declare-fun html_escape_table_keys () (Array Int String))
+(assert (= html_escape_table_keys
+ (store (store (store (store (store ((as const (Array Int String)) "B")
+ 0 "&")
+ 1 "\"")
+ 2 "'")
+ 3 ">")
+ 4 "<")))
+
+; charlst = [c for c in text]
+(declare-fun charlst () (Array Int String))
+(declare-fun charlstlen () Int)
+(assert (= charlstlen (str.len text)))
+(assert (forall ((i Int))
+ (= (select charlst i) (str.at text i))
+))
+
+; charlst2 = [html_escape_table.get(c, c) for c in charlst]
+(declare-fun charlst2 () (Array Int String))
+(declare-fun charlstlen2 () Int)
+(assert (= charlstlen2 charlstlen))
+(assert (forall ((i Int))
+ (or (or (< i 0) (>= i charlstlen2))
+ (and (exists ((j Int))
+ (= (select html_escape_table_keys j) (select charlst i))
+ )
+ (= (select charlst2 i) (select html_escape_table (select charlst i)))
+ )
+ (and (not (exists ((j Int))
+ (= (select html_escape_table_keys j) (select charlst i))
+ ))
+ (= (select charlst2 i) (select charlst i))
+ )
+ )
+))
+(check-sat)
+(get-value (charlst2))