@@ -218,7 +218,7 @@ void smt2_convt::write_footer()
218218 if (solver!=solvert::BOOLECTOR)
219219 {
220220 for (const auto &id : smt2_identifiers)
221- out << " (get-value (| " << id << " | ))"
221+ out << " (get-value (" << id << " ))"
222222 << " \n " ;
223223 }
224224
@@ -260,7 +260,7 @@ void smt2_convt::define_object_size(
260260 << " ((_ extract " << h << " " << l << " ) " ;
261261 convert_expr (ptr);
262262 out << " ) (_ bv" << number << " " << config.bv_encoding .object_bits << " ))"
263- << " (= | " << id << " | (_ bv" << *object_size << " " << size_width
263+ << " (= " << id << " (_ bv" << *object_size << " " << size_width
264264 << " ))))\n " ;
265265
266266 ++number;
@@ -837,16 +837,17 @@ literalt smt2_convt::convert(const exprt &expr)
837837 out << " () Bool)\n " ;
838838 out << " (assert (= " ;
839839 convert_literal (l);
840+ out << ' ' ;
840841 convert_expr (prepared_expr);
841842 out << " ))\n " ;
842843 }
843844 else
844845 {
845- defined_expressions[expr] =
846- std::string{" | B" } + std::to_string (l.var_no ()) + " | " ;
847- out << " (define-fun " ;
848- convert_literal (l );
849- out << " () Bool " ;
846+ auto identifier =
847+ convert_identifier ( std::string{" B" } + std::to_string (l.var_no ())) ;
848+ defined_expressions[expr] = identifier ;
849+ smt2_identifiers. insert (identifier );
850+ out << " (define-fun " << identifier << " () Bool " ;
850851 convert_expr (prepared_expr);
851852 out << " )\n " ;
852853 }
@@ -874,12 +875,15 @@ void smt2_convt::convert_literal(const literalt l)
874875 if (l.sign ())
875876 out << " (not " ;
876877
877- out << " |B" << l.var_no () << " |" ;
878+ const auto identifier =
879+ convert_identifier (" B" + std::to_string (l.var_no ()));
880+
881+ out << identifier;
878882
879883 if (l.sign ())
880884 out << " )" ;
881885
882- smt2_identifiers.insert (" B " + std::to_string (l. var_no ()) );
886+ smt2_identifiers.insert (identifier );
883887 }
884888}
885889
@@ -906,7 +910,7 @@ std::string smt2_convt::convert_identifier(const irep_idt &identifier)
906910 // Otherwise, for Common Lisp compatibility they would have to be treated
907911 // as escaping symbols.
908912
909- std::string result;
913+ std::string result = " | " ;
910914
911915 for (std::size_t i=0 ; i<identifier.size (); i++)
912916 {
@@ -928,6 +932,8 @@ std::string smt2_convt::convert_identifier(const irep_idt &identifier)
928932 }
929933 }
930934
935+ result += ' |' ;
936+
931937 return result;
932938}
933939
@@ -989,7 +995,7 @@ void smt2_convt::convert_floatbv(const exprt &expr)
989995 if (expr.id ()==ID_symbol)
990996 {
991997 const irep_idt &id = to_symbol_expr (expr).get_identifier ();
992- out << ' | ' << convert_identifier (id) << ' | ' ;
998+ out << convert_identifier (id);
993999 return ;
9941000 }
9951001
@@ -1003,9 +1009,9 @@ void smt2_convt::convert_floatbv(const exprt &expr)
10031009 INVARIANT (
10041010 !expr.operands ().empty (), " non-symbol expressions shall have operands" );
10051011
1006- out << " (|float_bv. " << expr. id ()
1007- << floatbv_suffix (expr)
1008- << ' | ' ;
1012+ out << ' ( '
1013+ << convert_identifier (
1014+ " float_bv. " + expr. id_string () + floatbv_suffix (expr)) ;
10091015
10101016 forall_operands (it, expr)
10111017 {
@@ -1023,13 +1029,13 @@ void smt2_convt::convert_expr(const exprt &expr)
10231029 {
10241030 const irep_idt &id = to_symbol_expr (expr).get_identifier ();
10251031 DATA_INVARIANT (!id.empty (), " symbol must have identifier" );
1026- out << ' | ' << convert_identifier (id) << ' | ' ;
1032+ out << convert_identifier (id);
10271033 }
10281034 else if (expr.id ()==ID_nondet_symbol)
10291035 {
10301036 const irep_idt &id = to_nondet_symbol_expr (expr).get_identifier ();
10311037 DATA_INVARIANT (!id.empty (), " nondet symbol must have identifier" );
1032- out << ' | ' << convert_identifier (" nondet_" + id2string (id)) << ' | ' ;
1038+ out << convert_identifier (" nondet_" + id2string (id));
10331039 }
10341040 else if (expr.id ()==ID_smt2_symbol)
10351041 {
@@ -2149,7 +2155,7 @@ void smt2_convt::convert_expr(const exprt &expr)
21492155 else if (
21502156 const auto object_size = expr_try_dynamic_cast<object_size_exprt>(expr))
21512157 {
2152- out << " | " << object_sizes[*object_size] << " | " ;
2158+ out << object_sizes[*object_size];
21532159 }
21542160 else if (expr.id ()==ID_let)
21552161 {
@@ -4619,7 +4625,7 @@ void smt2_convt::set_to(const exprt &expr, bool value)
46194625 smt2_identifiers.insert (smt2_identifier);
46204626
46214627 out << " ; set_to true (equal)\n " ;
4622- out << " (define-fun | " << smt2_identifier << ' | ' ;
4628+ out << " (define-fun " << smt2_identifier;
46234629
46244630 if (equal_expr.lhs ().type ().id () == ID_mathematical_function)
46254631 {
@@ -4803,7 +4809,7 @@ void smt2_convt::find_symbols(const exprt &expr)
48034809 smt2_identifiers.insert (smt2_identifier);
48044810
48054811 out << " ; find_symbols\n " ;
4806- out << " (declare-fun | " << smt2_identifier << ' | ' ;
4812+ out << " (declare-fun " << smt2_identifier;
48074813
48084814 if (expr.type ().id () == ID_mathematical_function)
48094815 {
@@ -4982,8 +4988,9 @@ void smt2_convt::find_symbols(const exprt &expr)
49824988 {
49834989 if (object_sizes.find (*object_size) == object_sizes.end ())
49844990 {
4985- const irep_idt id = " object_size." + std::to_string (object_sizes.size ());
4986- out << " (declare-fun |" << id << " | () " ;
4991+ const irep_idt id = convert_identifier (
4992+ " object_size." + std::to_string (object_sizes.size ()));
4993+ out << " (declare-fun " << id << " () " ;
49874994 convert_type (object_size->type ());
49884995 out << " )"
49894996 << " \n " ;
@@ -5016,8 +5023,8 @@ void smt2_convt::find_symbols(const exprt &expr)
50165023 to_multi_ary_expr (expr).op0 ().type ().id () == ID_floatbv)))
50175024 // clang-format on
50185025 {
5019- irep_idt function=
5020- " | float_bv." + expr.id_string ()+ floatbv_suffix (expr)+ " | " ;
5026+ irep_idt function =
5027+ convert_identifier ( " float_bv." + expr.id_string () + floatbv_suffix (expr)) ;
50215028
50225029 if (bvfp_set.insert (function).second )
50235030 {
0 commit comments