Skip to content

Commit a7eec38

Browse files
author
Daniel Kroening
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 56ca42a commit a7eec38

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
@@ -15,7 +15,6 @@ Author: Daniel Kroening, [email protected]
1515

1616
#include <langapi/language_util.h>
1717

18-
#include <solvers/refinement/string_refinement_invariant.h>
1918
#include <solvers/floatbv/float_utils.h>
2019

2120
// Parameters
@@ -170,10 +169,7 @@ void bv_refinementt::check_SAT(approximationt &a)
170169

171170
if(type.id()==ID_floatbv)
172171
{
173-
// these are all ternary
174-
INVARIANT(
175-
a.expr.operands().size()==3,
176-
string_refinement_invariantt("all floatbv typed exprs are ternary"));
172+
const auto &float_op = to_ieee_float_op_expr(a.expr);
177173

178174
if(a.over_state==MAX_STATE)
179175
return;
@@ -185,7 +181,7 @@ void bv_refinementt::check_SAT(approximationt &a)
185181
o1.unpack(a.op1_value);
186182

187183
// get actual rounding mode
188-
exprt rounding_mode_expr = get(a.expr.op2());
184+
exprt rounding_mode_expr = get(float_op.rounding_mode());
189185
const std::size_t rounding_mode_int =
190186
numeric_cast_v<std::size_t>(rounding_mode_expr);
191187
ieee_floatt::rounding_modet rounding_mode =
@@ -282,8 +278,7 @@ void bv_refinementt::check_SAT(approximationt &a)
282278
{
283279
// these are all binary
284280
INVARIANT(
285-
a.expr.operands().size()==2,
286-
string_refinement_invariantt("all (un)signedbv typed exprs are binary"));
281+
a.expr.operands().size() == 2, "all (un)signedbv typed exprs are binary");
287282

288283
// already full interpretation?
289284
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)