Skip to content

Use FloatingPoint theory when using --cprover-smt2 #6132

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 20, 2021
Merged

Conversation

kroening
Copy link
Member

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

@kroening kroening force-pushed the smt2_solver_FPA branch 3 times, most recently from a8a325f to 3b2a021 Compare May 20, 2021 09:05
@kroening kroening marked this pull request as ready for review May 20, 2021 09:38
Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thanks for the clearly broken out commits.

@codecov
Copy link

codecov bot commented May 20, 2021

Codecov Report

Merging #6132 (cd9dff8) into develop (fb9a3c0) will decrease coverage by 0.15%.
The diff coverage is 79.85%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #6132      +/-   ##
===========================================
- Coverage    75.42%   75.26%   -0.16%     
===========================================
  Files         1447     1447              
  Lines       158094   158181      +87     
===========================================
- Hits        119249   119062     -187     
- Misses       38845    39119     +274     
Impacted Files Coverage Δ
src/analyses/guard_expr.cpp 97.82% <ø> (-0.14%) ⬇️
src/goto-checker/solver_factory.h 100.00% <ø> (ø)
src/goto-instrument/interrupt.cpp 0.00% <ø> (ø)
src/jsil/jsil_entry_point.cpp 0.00% <0.00%> (ø)
src/util/symbol_table.h 91.11% <ø> (ø)
src/ansi-c/c_typecast.cpp 75.61% <33.33%> (-3.39%) ⬇️
src/ansi-c/c_typecheck_typecast.cpp 70.00% <63.15%> (-6.20%) ⬇️
src/solvers/smt2/smt2_conv.cpp 65.94% <75.00%> (+5.30%) ⬆️
src/solvers/smt2/smt2_parser.cpp 77.46% <81.25%> (+4.07%) ⬆️
src/solvers/smt2/smt2_format.cpp 81.60% <93.33%> (+4.89%) ⬆️
... and 51 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60abd1e...cd9dff8. Read the comment docs.

}
else
{
// remove the '.', if any
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ", if any" in the comment seems strange, because we know that there is a '.' in the else case.

Comment on lines 768 to 771
for(auto ch : real_number)
if(ch != '.')
significand_str += ch;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Is the intended behaviour really such that the '.' is the only character not being copied over?
  2. Nit pick: Braces around the body of the for-loop would be nice.
  3. Perhaps just use erase instead:
std::string significand_str = real_number;
significand_str.erase(significand_str.begin() + dot_pos);
  1. As further alternative, create significand_str by concatenating two substrings, which perhaps is more efficient in some future version of C++ with string views.

@tautschnig tautschnig assigned kroening and unassigned tautschnig May 20, 2021
kroening added 7 commits May 20, 2021 11:12
This commit adds the obvious mapping from fp.abs to our abs_exprt.
This adds support for floating-point literals to the SMT2 expression
formatter.
SMT-LIB to_fp has a number of variants, and this commit adds two of them to
enable the use of cprover_smt2 with CBMC.
This adds support for three floating-point constants to the SMT2 parser, to
enable the use of cprover_smt2 with CBMC.
This fixes an off-by-one bug in the SMT2 backend when parsing +oo, -oo and
NaN expressions.
This enables the use of the FloatingPoint theory when using cprover_smt2.
The resulting SMT-LIB files are much smaller, and easier to read.

The commit also enables existing tests that now pass with --cprover-smt2.
@kroening kroening requested a review from smowton as a code owner May 20, 2021 10:17
@kroening kroening merged commit 1c1fb76 into develop May 20, 2021
@kroening kroening deleted the smt2_solver_FPA branch May 20, 2021 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants