Skip to content

Commit f281bc3

Browse files
Daniel Kroeningsvorenova
Daniel Kroening
authored and
svorenova
committed
remove dependency on string_refinement_invariantt
The refinement solver a part of the string solver, but can live on its own, and thus, shouldn't use its exception class.
1 parent 2746997 commit f281bc3

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

src/solvers/refinement/refine_arithmetic.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Author: Daniel Kroening, [email protected]
1313
#include <util/expr_util.h>
1414
#include <util/arith_tools.h>
1515

16-
#include <solvers/refinement/string_refinement_invariant.h>
1716
#include <solvers/floatbv/float_utils.h>
1817

1918
// Parameters
@@ -167,10 +166,7 @@ void bv_refinementt::check_SAT(approximationt &a)
167166

168167
if(type.id()==ID_floatbv)
169168
{
170-
// these are all ternary
171-
INVARIANT(
172-
a.expr.operands().size()==3,
173-
string_refinement_invariantt("all floatbv typed exprs are ternary"));
169+
const auto &float_op = to_ieee_float_op_expr(a.expr);
174170

175171
if(a.over_state==MAX_STATE)
176172
return;
@@ -182,7 +178,7 @@ void bv_refinementt::check_SAT(approximationt &a)
182178
o1.unpack(a.op1_value);
183179

184180
// get actual rounding mode
185-
exprt rounding_mode_expr = get(a.expr.op2());
181+
exprt rounding_mode_expr = get(float_op.rounding_mode());
186182
const std::size_t rounding_mode_int =
187183
numeric_cast_v<std::size_t>(rounding_mode_expr);
188184
ieee_floatt::rounding_modet rounding_mode =
@@ -279,8 +275,7 @@ void bv_refinementt::check_SAT(approximationt &a)
279275
{
280276
// these are all binary
281277
INVARIANT(
282-
a.expr.operands().size()==2,
283-
string_refinement_invariantt("all (un)signedbv typed exprs are binary"));
278+
a.expr.operands().size() == 2, "all (un)signedbv typed exprs are binary");
284279

285280
// already full interpretation?
286281
if(a.over_state>0)

src/solvers/refinement/refine_arrays.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515
#include <util/std_expr.h>
1616
#include <util/find_symbols.h>
1717

18-
#include <solvers/refinement/string_refinement_invariant.h>
1918
#include <solvers/sat/satcheck.h>
2019

2120
/// generate array constraints
@@ -55,9 +54,6 @@ void bv_refinementt::arrays_overapproximated()
5554
if(current.id()==ID_implies)
5655
{
5756
implies_exprt imp=to_implies_expr(current);
58-
DATA_INVARIANT(
59-
imp.operands().size()==2,
60-
string_refinement_invariantt("implies must have two operands"));
6157
exprt implies_simplified=get(imp.op0());
6258
if(implies_simplified==false_exprt())
6359
{
@@ -70,8 +66,7 @@ void bv_refinementt::arrays_overapproximated()
7066
{
7167
or_exprt orexp=to_or_expr(current);
7268
INVARIANT(
73-
orexp.operands().size()==2,
74-
string_refinement_invariantt("only treats the case of a binary or"));
69+
orexp.operands().size() == 2, "only treats the case of a binary or");
7570
exprt o1=get(orexp.op0());
7671
exprt o2=get(orexp.op1());
7772
if(o1==true_exprt() || o2 == true_exprt())
@@ -95,10 +90,7 @@ void bv_refinementt::arrays_overapproximated()
9590
lazy_array_constraints.erase(it++);
9691
break;
9792
default:
98-
INVARIANT(
99-
false,
100-
string_refinement_invariantt("error in array over approximation "
101-
"check"));
93+
INVARIANT(false, "error in array over approximation check");
10294
}
10395
}
10496

0 commit comments

Comments
 (0)