Open
Conversation
kroening
reviewed
Mar 24, 2026
kroening
reviewed
Mar 24, 2026
There was a problem hiding this comment.
Pull request overview
Adds SMT-LIB fp.min / fp.max support to the SMT2 parser by lowering them into compound expressions with IEEE-754-style NaN handling, ordered comparison, and signed-zero tie-breaking.
Changes:
- Implement parsing for
fp.minandfp.maxinsmt2_parser.cppusing conditional expressions. - Add regression tests for signed-zero tie-breaking and basic
min/maxbehavior (including NaN handling).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
src/solvers/smt2/smt2_parser.cpp |
Adds fp.min / fp.max expression constructors with NaN + tie-breaking logic. |
regression/smt2_solver/fp-issues/z3-4880-min-neg-zero.smt2 |
Adds a focused regression for fp.min(-0, +0) sign behavior. |
regression/smt2_solver/fp-issues/z3-4880-min-neg-zero.desc |
Registers the new regression and expected outcome (unsat). |
regression/smt2_solver/fp-issues/fp-min-max.smt2 |
Adds broader tests for fp.min / fp.max including NaN and signed zeros. |
regression/smt2_solver/fp-issues/fp-min-max.desc |
Registers the new fp.min/max regression and expected outcome (sat). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Implement the three missing FP predicates in the SMT2 parser: - fp.isSubnormal: not NaN, not infinite, not zero, and not normal - fp.isNegative: sign bit is 1 and not NaN - fp.isPositive: sign bit is 0 and not NaN These are expressed as compound expressions using existing predicates, requiring no back-end changes. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Extract a shared fp_unary_operand helper lambda that parses and validates the single FloatingPoint operand common to all fp.is* predicate handlers. This removes the duplicated arity and type checks from fp.isNaN, fp.isInfinite, fp.isNormal, fp.isZero, fp.isSubnormal, fp.isNegative, and fp.isPositive. Also uses typed expression classes (isnan_exprt, isinf_exprt) consistently in the pre-existing handlers. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Implement fp.min and fp.max in the SMT2 parser as compound expressions: - NaN handling: if either operand is NaN, return the other - Comparison: use fp.lt/fp.gt for normal ordering - Zero tie-breaking: fp.min prefers negative sign, fp.max prefers positive Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8888 +/- ##
========================================
Coverage 80.47% 80.47%
========================================
Files 1704 1704
Lines 188694 188728 +34
Branches 73 73
========================================
+ Hits 151843 151881 +38
+ Misses 36851 36847 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kroening
reviewed
Apr 3, 2026
| auto y_nan = isnan_exprt(op[1]); | ||
| auto x_cmp_y = binary_relation_exprt(op[0], relation_id, op[1]); | ||
| const auto &type = to_floatbv_type(op[0].type()); | ||
| // Reinterpret float bits as bitvector to extract the sign bit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement fp.min and fp.max in the SMT2 parser as compound expressions: