Skip to content

SAT solver performance problem with floating point equalities #4337

Open
@peterschrammel

Description

@peterschrammel

Tests in #4338.

void main() {
  double a, b, c;
  __CPROVER_assume(a + b > c);
  assert(!(c > a + b) );
}

has equation

file Float-equality1/main.c line 10 function main
assertion !(c > a + b)
...
{-12} floatbv_plus(main::1::a!0@1#1, main::1::b!0@1#1, 0) > main::1::c!0@1#1
├──────────────────────────
{1} ¬(main::1::c!0@1#1 > floatbv_plus(main::1::a!0@1#1, main::1::b!0@1#1, 0))

and solves quickly,

whereas

void main() {
  double a, b, c;
  __CPROVER_assume(a + b > c);
  double x = a, y = b, z = c;
  assert(!(z > x + y) );
}

with the equation

file Float-equality1/main.c line 10 function main
assertion !(c > a + b)
...
{-12} floatbv_plus(main::1::a!0@1#1, main::1::b!0@1#1, 0) > main::1::c!0@1#1
{-13} main::1::x!0@1#2 = main::1::a!0@1#1
{-14} main::1::y!0@1#2 = main::1::b!0@1#1
{-15} main::1::z!0@1#2 = main::1::c!0@1#1
├──────────────────────────
{1} ¬(main::1::c!0@1#1 > floatbv_plus(main::1::a!0@1#1, main::1::b!0@1#1, 0))

takes forever to solve.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions