|
20 | 20 | #ifndef CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H
|
21 | 21 | #define CPROVER_SOLVERS_REFINEMENT_STRING_CONSTRAINT_H
|
22 | 22 |
|
23 |
| -#include <solvers/refinement/bv_refinement.h> |
24 |
| -#include <solvers/refinement/string_refinement_invariant.h> |
| 23 | +#include "bv_refinement.h" |
| 24 | +#include "string_refinement_invariant.h" |
| 25 | + |
| 26 | +#include <util/format_expr.h> |
| 27 | +#include <util/format_type.h> |
25 | 28 | #include <util/refined_string_type.h>
|
26 | 29 | #include <util/string_expr.h>
|
27 |
| -#include <langapi/language_util.h> |
28 | 30 |
|
29 | 31 | /// ### Universally quantified string constraint
|
30 | 32 | ///
|
@@ -147,15 +149,14 @@ extern inline string_constraintt &to_string_constraint(exprt &expr)
|
147 | 149 | /// \param [in] expr: constraint to render
|
148 | 150 | /// \return rendered string
|
149 | 151 | inline std::string from_expr(
|
150 |
| - const namespacet &ns, |
151 | 152 | const irep_idt &identifier,
|
152 | 153 | const string_constraintt &expr)
|
153 | 154 | {
|
154 |
| - return "forall "+from_expr(ns, identifier, expr.univ_var())+" in ["+ |
155 |
| - from_expr(ns, identifier, expr.lower_bound())+", "+ |
156 |
| - from_expr(ns, identifier, expr.upper_bound())+"). "+ |
157 |
| - from_expr(ns, identifier, expr.premise())+" => "+ |
158 |
| - from_expr(ns, identifier, expr.body()); |
| 155 | + std::ostringstream out; |
| 156 | + out << "forall " << format(expr.univ_var()) << " in [" |
| 157 | + << format(expr.lower_bound()) << ", " << format(expr.upper_bound()) |
| 158 | + << "). " << format(expr.premise()) << " => " << format(expr.body()); |
| 159 | + return out.str(); |
159 | 160 | }
|
160 | 161 |
|
161 | 162 | /// Constraints to encode non containement of strings.
|
@@ -222,18 +223,17 @@ class string_not_contains_constraintt: public exprt
|
222 | 223 | /// \param [in] expr: constraint to render
|
223 | 224 | /// \return rendered string
|
224 | 225 | inline std::string from_expr(
|
225 |
| - const namespacet &ns, |
226 | 226 | const irep_idt &identifier,
|
227 | 227 | const string_not_contains_constraintt &expr)
|
228 | 228 | {
|
229 |
| - return "forall x in ["+ |
230 |
| - from_expr(ns, identifier, expr.univ_lower_bound())+", "+ |
231 |
| - from_expr(ns, identifier, expr.univ_upper_bound())+"). "+ |
232 |
| - from_expr(ns, identifier, expr.premise())+" => ("+ |
233 |
| - "exists y in ["+from_expr(ns, identifier, expr.exists_lower_bound())+", "+ |
234 |
| - from_expr(ns, identifier, expr.exists_upper_bound())+"). "+ |
235 |
| - from_expr(ns, identifier, expr.s0())+"[x+y] != "+ |
236 |
| - from_expr(ns, identifier, expr.s1())+"[y])"; |
| 229 | + std::ostringstream out; |
| 230 | + out << "forall x in [" << format(expr.univ_lower_bound()) << ", " |
| 231 | + << format(expr.univ_upper_bound()) << "). " << format(expr.premise()) |
| 232 | + << " => (" |
| 233 | + << "exists y in [" << format(expr.exists_lower_bound()) << ", " |
| 234 | + << format(expr.exists_upper_bound()) << "). " << format(expr.s0()) |
| 235 | + << "[x+y] != " << format(expr.s1()) << "[y])"; |
| 236 | + return out.str(); |
237 | 237 | }
|
238 | 238 |
|
239 | 239 | inline const string_not_contains_constraintt
|
|
0 commit comments