Skip to content

Commit d747faa

Browse files
committed
Add remainder (modulus) arithmetic operator bvurem.
Along with tests of its conversion and the function application factory integrity.
1 parent 71222f4 commit d747faa

File tree

4 files changed

+4
-50
lines changed

4 files changed

+4
-50
lines changed

src/solvers/smt2_incremental/smt_bit_vector_theory.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,3 @@ void smt_bit_vector_theoryt::remaindert::validate(
172172
const smt_function_application_termt::factoryt<
173173
smt_bit_vector_theoryt::remaindert>
174174
smt_bit_vector_theoryt::remainder{};
175-
176-
const char *smt_bit_vector_theoryt::negationt::identifier()
177-
{
178-
return "bvneg";
179-
}
180-
181-
smt_sortt
182-
smt_bit_vector_theoryt::negationt::return_sort(const smt_termt &operand)
183-
{
184-
return operand.get_sort();
185-
}
186-
187-
void smt_bit_vector_theoryt::negationt::validate(const smt_termt &operand)
188-
{
189-
}
190-
191-
const smt_function_application_termt::factoryt<
192-
smt_bit_vector_theoryt::negationt>
193-
smt_bit_vector_theoryt::negation{};

src/solvers/smt2_incremental/smt_bit_vector_theory.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ class smt_bit_vector_theoryt
6363
};
6464
static const smt_function_application_termt::factoryt<remaindert> remainder;
6565

66-
struct negationt final
66+
struct remaindert final
6767
{
6868
static const char *identifier();
69-
static smt_sortt return_sort(const smt_termt &operand);
70-
static void validate(const smt_termt &operand);
69+
static smt_sortt return_sort(const smt_termt &lhs, const smt_termt &rhs);
70+
static void validate(const smt_termt &lhs, const smt_termt &rhs);
7171
};
72-
static const smt_function_application_termt::factoryt<negationt> negation;
72+
static const smt_function_application_termt::factoryt<remaindert> remainder;
7373
};
7474

7575
#endif // CPROVER_SOLVERS_SMT2_INCREMENTAL_SMT_BIT_VECTOR_THEORY_H

unit/solvers/smt2_incremental/convert_expr_to_smt.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -366,20 +366,4 @@ TEST_CASE(
366366
const cbmc_invariants_should_throwt invariants_throw;
367367
REQUIRE_THROWS(convert_expr_to_smt(mod_exprt{one_bvint, false_exprt{}}));
368368
}
369-
370-
SECTION("Unary minus of constant size bit-vector")
371-
{
372-
const auto constructed_term =
373-
convert_expr_to_smt(unary_minus_exprt{one_bvint});
374-
const auto expected_term = smt_bit_vector_theoryt::negation(smt_term_one);
375-
CHECK(constructed_term == expected_term);
376-
}
377-
378-
SECTION(
379-
"Ensure that unary minus node conversion fails if the operand is not a "
380-
"bit-vector")
381-
{
382-
const cbmc_invariants_should_throwt invariants_throw;
383-
REQUIRE_THROWS(convert_expr_to_smt(unary_minus_exprt{true_exprt{}}));
384-
}
385369
}

unit/solvers/smt2_incremental/smt_bit_vector_theory.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,15 +238,4 @@ TEST_CASE(
238238
REQUIRE(function_application.arguments()[0].get() == two);
239239
REQUIRE(function_application.arguments()[1].get() == three);
240240
}
241-
242-
SECTION("Unary Minus")
243-
{
244-
const auto function_application = smt_bit_vector_theoryt::negation(two);
245-
REQUIRE(
246-
function_application.function_identifier() ==
247-
smt_identifier_termt("bvneg", smt_bit_vector_sortt{8}));
248-
REQUIRE(function_application.get_sort() == smt_bit_vector_sortt{8});
249-
REQUIRE(function_application.arguments().size() == 1);
250-
REQUIRE(function_application.arguments()[0].get() == two);
251-
}
252241
}

0 commit comments

Comments
 (0)