Skip to content

Commit

Permalink
Weaken invariant for nil exprt as model of array
Browse files Browse the repository at this point in the history
nil_exprt happens when the underlying solver has no formula talking
about the array
  • Loading branch information
romainbrenguier committed Apr 23, 2018
1 parent 56e7b37 commit ff25fe2
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/solvers/refinement/string_refinement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1123,9 +1123,6 @@ static exprt substitute_array_access(
const bool left_propagate)
{
const exprt &array = index_expr.array();

if(array.id() == ID_symbol)
return index_expr;
if(auto array_of = expr_try_dynamic_cast<array_of_exprt>(array))
return array_of->op();
if(auto array_with = expr_try_dynamic_cast<with_exprt>(array))
Expand All @@ -1138,7 +1135,12 @@ static exprt substitute_array_access(
return substitute_array_access(
*if_expr, index_expr.index(), symbol_generator, left_propagate);

UNREACHABLE;
INVARIANT(
array.is_nil() || array.id() == ID_symbol,
std::string(
"in case the array is unknown, it should be a symbol or nil, id: ")
+ id2string(array.id()));
return index_expr;
}

/// Auxiliary function for substitute_array_access
Expand Down Expand Up @@ -2121,9 +2123,11 @@ exprt string_refinementt::get(const exprt &expr) const
}

INVARIANT(
array.id() == ID_symbol,
"apart from symbols, array valuations can be interpreted as sparse "
"arrays");
array.is_nil() || array.id() == ID_symbol,
std::string(
"apart from symbols, array valuations can be interpreted as "
"sparse arrays, id: ") +
id2string(array.id()));
return index_exprt(array, index);
}

Expand Down

0 comments on commit ff25fe2

Please sign in to comment.