Skip to content

Commit 5bbb238

Browse files
committed
SMT2 back-end: make declare-datatypes standards compatible
The standards-compatible syntax is understood by both Z3 (which also accepted the previous one) as well as CVC5 (which only accepts the new one).
1 parent bc1012b commit 5bbb238

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5277,8 +5277,8 @@ void smt2_convt::find_symbols_rec(
52775277
"complex." + std::to_string(datatype_map.size());
52785278
datatype_map[type] = smt_typename;
52795279

5280-
out << "(declare-datatypes () ((" << smt_typename << " "
5281-
<< "(mk-" << smt_typename;
5280+
out << "(declare-datatypes ((" << smt_typename << " 0)) "
5281+
<< "(((mk-" << smt_typename;
52825282

52835283
out << " (" << smt_typename << ".imag ";
52845284
convert_type(to_complex_type(type).subtype());
@@ -5306,8 +5306,8 @@ void smt2_convt::find_symbols_rec(
53065306
"vector." + std::to_string(datatype_map.size());
53075307
datatype_map[type] = smt_typename;
53085308

5309-
out << "(declare-datatypes () ((" << smt_typename << " "
5310-
<< "(mk-" << smt_typename;
5309+
out << "(declare-datatypes ((" << smt_typename << " 0)) "
5310+
<< "(((mk-" << smt_typename;
53115311

53125312
for(mp_integer i=0; i!=size; ++i)
53135313
{
@@ -5348,12 +5348,12 @@ void smt2_convt::find_symbols_rec(
53485348
// argument for each member of the struct. The declaration that
53495349
// creates this type looks like:
53505350
//
5351-
// (declare-datatypes () ((struct.0 (mk-struct.0
5351+
// (declare-datatypes ((struct.0 0)) (((mk-struct.0
53525352
// (struct.0.component1 type1)
53535353
// ...
53545354
// (struct.0.componentN typeN)))))
5355-
out << "(declare-datatypes () ((" << smt_typename << " "
5356-
<< "(mk-" << smt_typename << " ";
5355+
out << "(declare-datatypes ((" << smt_typename << " 0)) "
5356+
<< "(((mk-" << smt_typename << " ";
53575357

53585358
for(const auto &component : components)
53595359
{

0 commit comments

Comments
 (0)