This PR generates a failure in int-to-bv in case a real argument is detected as a child of an arithmetic operation.
fixes cvc5/cvc5-projects#348 .
Co-authored-by: Andrew Reynolds andrew.j.reynolds@gmail.com
for (TNode current : NodeDfsIterable(n_binary, VisitOrder::POSTORDER,
[&cache](TNode nn) { return cache.count(nn) > 0; }))
{
+ TypeNode tn = current.getType();
+ if (tn.isReal() && !tn.isInteger())
+ {
+ throw TypeCheckingExceptionPrivate(
+ current, string("Cannot translate to BV: ") + current.toString());
+ }
if (current.getNumChildren() > 0)
{
// Not a leaf
regress0/nl/pow2-native-3.smt2
regress0/nl/pow2-pow.smt2
regress0/nl/pow2-pow-isabelle.smt2
+ regress0/nl/proj-issue-348.smt2
regress0/nl/real-as-int.smt2
regress0/nl/real-div-ufnra.smt2
regress0/nl/sin-cos-346-b-chunk-0169.smt2
--- /dev/null
+; EXIT: 1
+; EXPECT: Cannot translate to BV
+; SCRUBBER: sed -n "s/.*\(Cannot translate to BV\).*/\1/p"
+(set-logic ALL)
+(set-option :solve-int-as-bv 1)
+(declare-const x Real)
+(assert (>= 0.0 x))
+(check-sat)