|
24 | 24 | #include <solvers/refinement/bv_refinement.h>
|
25 | 25 | #include <solvers/refinement/string_refinement_invariant.h>
|
26 | 26 | #include <util/refined_string_type.h>
|
| 27 | +#include <langapi/language_util.h> |
| 28 | + |
| 29 | +/*! \brief Universally quantified string constraint |
| 30 | +
|
| 31 | + This represents a universally quantified string constraint as laid out in |
| 32 | + DOI: 10.1007/978-3-319-03077-7. The paper seems to specify a universal |
| 33 | + constraint as follows. |
| 34 | +
|
| 35 | + A universal constraint is of the form \f$\forall n. L(n) \rightarrow |
| 36 | + P(n, s_0,\ldots, s_k)\f$ where |
| 37 | +
|
| 38 | + 1. \f$L(n)\f$ does not contain string indices [possibly not required, but |
| 39 | + implied by examples] |
| 40 | + 2. \f$\forall n. L(n) \rightarrow P'\left(s_0[f_0(n)],\ldots, s_k[f_k(n)] |
| 41 | + \right)\f$, i.e. when focusing on one specific string, all indices are |
| 42 | + the same [stated in a roundabout manner] |
| 43 | + 3. Each \f$f\f$ is linear and therefore has an inverse [explicitly stated] |
| 44 | + 4. \f$L(n)\f$ and \f$P(n, s_0,\ldots, s_k)\f$ may contain other (free) |
| 45 | + variables, but in \f$P\f$, \f$n\f$ can only occur as an argument to an |
| 46 | + \f$f\f$ [explicitly stated, implied] |
| 47 | +
|
| 48 | + We extend this slightly by restricting n to be in a specific range, but this |
| 49 | + is another implication which can be pushed in to \f$L(n)\f$. |
| 50 | +*/ |
27 | 51 |
|
28 | 52 | class string_constraintt: public exprt
|
29 | 53 | {
|
@@ -114,6 +138,15 @@ extern inline string_constraintt &to_string_constraint(exprt &expr)
|
114 | 138 | return static_cast<string_constraintt &>(expr);
|
115 | 139 | }
|
116 | 140 |
|
| 141 | +inline static std::string from_expr( |
| 142 | + const namespacet &ns, |
| 143 | + const irep_idt &identifier, |
| 144 | + const string_constraintt &expr) |
| 145 | +{ |
| 146 | + return from_expr(ns, identifier, expr.premise())+" => "+ |
| 147 | + from_expr(ns, identifier, expr.body()); |
| 148 | +} |
| 149 | + |
117 | 150 | class string_not_contains_constraintt: public exprt
|
118 | 151 | {
|
119 | 152 | public:
|
|
0 commit comments