node = NodeManager::currentNM()->mkNode( kind::ITE, cond, totalf, uf );
break;
}
- case kind::STRING_STOI: {
- if(d_ufS2I.isNull()) {
- std::vector< TypeNode > argTypes;
- argTypes.push_back(NodeManager::currentNM()->stringType());
- d_ufS2I = NodeManager::currentNM()->mkSkolem("__ufS2I",
- NodeManager::currentNM()->mkFunctionType(
- argTypes, NodeManager::currentNM()->integerType()),
- "uf str2int",
- NodeManager::SKOLEM_EXACT_NAME);
- }
- Node cond;
- if(n[0].isConst()) {
- CVC4::String s = n[0].getConst<String>();
- if(s.isNumber()) {
- cond = NodeManager::currentNM()->mkConst( false );
- } else {
- cond = NodeManager::currentNM()->mkConst( true );
- }
- } else {
- Node cc1 = n[0].eqNode(nm->mkConst(::CVC4::String("")));
- Node zero = NodeManager::currentNM()->mkConst( ::CVC4::Rational(0) );
- Node one = NodeManager::currentNM()->mkConst( ::CVC4::Rational(1) );
- Node b1 = NodeManager::currentNM()->mkBoundVar("x", NodeManager::currentNM()->integerType());
- Node z1 = NodeManager::currentNM()->mkBoundVar("z1", NodeManager::currentNM()->stringType());
- Node z2 = NodeManager::currentNM()->mkBoundVar("z2", NodeManager::currentNM()->stringType());
- Node z3 = NodeManager::currentNM()->mkBoundVar("z3", NodeManager::currentNM()->stringType());
- Node b1v = NodeManager::currentNM()->mkNode(kind::BOUND_VAR_LIST, b1, z1, z2, z3);
- std::vector< Node > vec_n;
- Node g = NodeManager::currentNM()->mkNode(kind::GEQ, b1, zero);
- vec_n.push_back(g);
- g = NodeManager::currentNM()->mkNode(kind::GT, NodeManager::currentNM()->mkNode(kind::STRING_LENGTH, n[0]), b1);
- vec_n.push_back(g);
- g = b1.eqNode( NodeManager::currentNM()->mkNode(kind::STRING_LENGTH, z1) );
- vec_n.push_back(g);
- g = one.eqNode( NodeManager::currentNM()->mkNode(kind::STRING_LENGTH, z2) );
- vec_n.push_back(g);
- g = n[0].eqNode( NodeManager::currentNM()->mkNode(kind::STRING_CONCAT, z1, z2, z3) );
- vec_n.push_back(g);
- for(unsigned i=0; i<=9; i++) {
- char ch[2];
- ch[0] = i + '0'; ch[1] = '\0';
- std::string stmp(ch);
- g = z2.eqNode( nm->mkConst(::CVC4::String(stmp)) ).negate();
- vec_n.push_back(g);
- }
- Node cc2 = Rewriter::rewrite(NodeManager::currentNM()->mkNode(kind::AND, vec_n));
- cc2 = NodeManager::currentNM()->mkNode(kind::EXISTS, b1v, cc2);
- cond = Rewriter::rewrite(NodeManager::currentNM()->mkNode(kind::OR, cc1, cc2));
- }
- Node totalf = NodeManager::currentNM()->mkNode(kind::STRING_STOI_TOTAL, n[0]);
- Node uf = NodeManager::currentNM()->mkNode(kind::APPLY_UF, d_ufS2I, n[0]);
- node = NodeManager::currentNM()->mkNode( kind::ITE, cond, uf, totalf );
-
- break;
- }
case kind::DIVISION: {
// partial function: division
if(d_divByZero.isNull()) {
operator STRING_PREFIX 2 "string prefixof"
operator STRING_SUFFIX 2 "string suffixof"
operator STRING_ITOS 1 "integer to string"
-operator STRING_STOI 1 "string to integer (user symbol)"
-operator STRING_STOI_TOTAL 1 "string to integer (internal symbol)"
+operator STRING_STOI 1 "string to integer (total function)"
#sort CHAR_TYPE \
# Cardinality::INTEGERS \
typerule STRING_SUFFIX ::CVC4::theory::strings::StringSuffixOfTypeRule
typerule STRING_ITOS ::CVC4::theory::strings::StringIntToStrTypeRule
typerule STRING_STOI ::CVC4::theory::strings::StringStrToIntTypeRule
-typerule STRING_STOI_TOTAL ::CVC4::theory::strings::StringStrToIntTypeRule
typerule STRING_IN_REGEXP ::CVC4::theory::strings::StringInRegExpTypeRule
d_equalityEngine.addFunctionKind(kind::STRING_STRCTN);
d_equalityEngine.addFunctionKind(kind::STRING_SUBSTR_TOTAL);
d_equalityEngine.addFunctionKind(kind::STRING_ITOS);
- d_equalityEngine.addFunctionKind(kind::STRING_STOI_TOTAL);
+ d_equalityEngine.addFunctionKind(kind::STRING_STOI);
d_zero = NodeManager::currentNM()->mkConst( Rational( 0 ) );
d_one = NodeManager::currentNM()->mkConst( Rational( 1 ) );
case kind::STRING_CONCAT:
case kind::STRING_SUBSTR_TOTAL:
case kind::STRING_ITOS:
- case kind::STRING_STOI_TOTAL:
+ case kind::STRING_STOI:
d_equalityEngine.addTerm(n);
break;
//case kind::STRING_ITOS:
} else {
throw LogicException("string int.to.str not supported in this release");
}
- } else if( t.getKind() == kind::STRING_STOI_TOTAL ) {
+ } else if( t.getKind() == kind::STRING_STOI ) {
if(options::stringExp()) {
Node one = NodeManager::currentNM()->mkConst( ::CVC4::Rational(1) );
Node nine = NodeManager::currentNM()->mkConst( ::CVC4::Rational(9) );
vec_n.push_back(g);
g = t[0].eqNode( NodeManager::currentNM()->mkNode(kind::STRING_CONCAT, z1, z2, z3) );
vec_n.push_back(g);
+ char ch[2];
+ ch[1] = '\0';
for(unsigned i=0; i<=9; i++) {
- char ch[2];
- ch[0] = i + '0'; ch[1] = '\0';
+ ch[0] = i + '0';
std::string stmp(ch);
g = z2.eqNode( NodeManager::currentNM()->mkConst(::CVC4::String(stmp)) ).negate();
vec_n.push_back(g);