[API Coherence] Report for 2026-03-12 - BitVector, Array, and Floating-Point APIs #8970
Closed
Replies: 1 comment
-
|
This discussion has been marked as outdated by API Coherence Checker. A newer discussion is available at Discussion #9021. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
✅ Resolution Updates — 8 Cached Issues Now Resolved
Since the last run (2026-02-24), the following gaps have been closed:
getLower()/getUpper()src/api/js/src/high-level/high-level.tsfromFile(),unsatCore(),objectives(),reasonUnknown()high-level.tsZ3_solver_to_dimacs_stringmissing in Java, TypeScript, GoSolver.java,high-level.ts,solver.go)Z3_solver_translatemissing in TypeScript, Go, Rustsolver.translate(), Go has it, Rust implements theTranslatetraitZ3_solver_get_proofmissing in TypeScript, GoZ3_solver_add_simplifiermissing in JavaSolver.addSimplifier()now inSolver.javaZ3_solver_register_on_clausemissing in TypeScript, Java, OCaml, GoZ3_optimize_translatemissing in OCaml, Goz3.mland Gooptimize.goboth expose it📊 Progress
🔴 High Priority Issues
1. Java (and Go) Missing BV Reduction Operations:
bvredand/bvredorWhat:
Z3_mk_bvredandandZ3_mk_bvredorreduce a bit-vector to a single-bit result by AND-ing or OR-ing all bits. These are useful for checking if all/any bits are set.Available in: Python (
z3.py), C++ (z3++.h—bvredand()/bvredor()), .NET (Context.cs), OCaml (z3.ml—mk_redand/mk_redor), TypeScript (high-level.ts—redAnd()/redOr()), Rust (bv.rsmacro —bvredand/bvredor)Missing in: Java, Go
Suggested fix:
mkBVREDAND(BitVecExpr t)andmkBVREDOR(BitVecExpr t)tosrc/api/java/Context.javacallingNative.mkBvredand/Native.mkBvredorMkBVRedAnd(t *Expr) *ExprandMkBVRedOr(t *Expr) *Exprtosrc/api/go/bitvec.gocallingC.Z3_mk_bvredand/C.Z3_mk_bvredor2. Go FPA Missing Rounding Mode Constants
What: To use any FP arithmetic in Go with explicit rounding (e.g.,
MkFPAdd(rm, lhs, rhs)), callers must pass a rounding mode expression. However, Go provides no way to create rounding mode values —Z3_mk_fpa_rne,Z3_mk_fpa_rna,Z3_mk_fpa_rtp,Z3_mk_fpa_rtn,Z3_mk_fpa_rtz(and their verbose aliases) are all absent. This makes the FP operations that require rounding mode (MkFPAdd,MkFPSub,MkFPMul,MkFPDiv,MkFPSqrt) effectively unusable unless users build the expression themselves via the C API.Available in: All other languages — Python (
fpRNE(),fpRTZ(), etc.), Java (mkFPRoundNearestTiesToEven()), .NET (MkFPRNE()), C++ (fpa_rne()inz3++.h), OCaml, TypeScript, RustMissing in: Go (
src/api/go/fp.go)Suggested fix: Add rounding mode constructor functions to
src/api/go/fp.go:3. Go FPA Missing Type Conversion Functions
What: Go's
fp.gohas no way to convert between floating-point representations or to/from BV types. The following C API functions are entirely absent:Z3_mk_fpa_to_fp_bvZ3_mk_fpa_to_fp_floatZ3_mk_fpa_to_fp_realZ3_mk_fpa_to_fp_signedZ3_mk_fpa_to_fp_unsignedZ3_mk_fpa_to_sbvZ3_mk_fpa_to_ubvZ3_mk_fpa_fpAvailable in: Python, Java, .NET, C++, OCaml, TypeScript, Rust
Missing in: Go
Suggested fix: Add the above wrappers to
src/api/go/fp.go. Example:🟡 Medium Priority Issues
4. C++ and Go Missing Variable-Width BV Rotation (
ext_rotate_left/ext_rotate_right)What:
Z3_mk_ext_rotate_left(ctx, t, i)andZ3_mk_ext_rotate_right(ctx, t, i)rotate a bit-vector by an amount given as a bit-vector expression (symbolic amount), as opposed to the fixed-integer versionsZ3_mk_rotate_left/right. The fixed versions are available everywhere; the variable-width versions are missing in C++ and Go.Available in: Java (
mkExtRotateLeft), .NET (MkBVRotateLeftwith two BV args), Python (RotateLeft(a, b)— dispatches toext_rotatewhenbis symbolic), OCaml (mk_ext_rotate_left), TypeScript (rotateLeft(count: BitVec)), Rust (bvrotl/bvrotrviaZ3_mk_ext_rotate_left)Missing in: C++ (
z3++.honly hasrotate_left(unsigned i)), Go (bitvec.goonly hasMkBVRotateLeft(i uint, t))Suggested fix:
z3++.hinsideexpr:expr ext_rotate_left(expr const& i) const { ... Z3_mk_ext_rotate_left(ctx(), *this, i) ... }src/api/go/bitvec.go:func (c *Context) MkBVExtRotateLeft(t, i *Expr) *Expr { ... C.Z3_mk_ext_rotate_left(...) }5. Go Missing Array Map Function (
Z3_mk_map)What:
Z3_mk_map(ctx, f, args...)applies a function to the element-wise values of one or more arrays, producing a new array. This is a core higher-order array operation.Available in: Python (
ArrayMap(f, a, b)), Java (Context.mkMap()), .NET (Context.MkArrayMap()), C++ (array_map()), OCaml (mk_map)Missing in: Go (
src/api/go/array.go)Suggested fix: Add to
src/api/go/array.go:6. Go FPA Missing
FMA,Rem,Min,Max,RoundToIntegralWhat: Five standard floating-point operations are absent from Go's
fp.go:Z3_mk_fpa_fma— Fused multiply-add:(a * b) + cwith single roundingZ3_mk_fpa_rem— IEEE 754 remainderZ3_mk_fpa_min/Z3_mk_fpa_max— IEEE 754 min/maxZ3_mk_fpa_round_to_integral— Round to integer value in FP representationAvailable in: Python, Java, .NET, C++, OCaml, TypeScript, Rust
Missing in: Go
7. Go FPA Missing Numeral Constructors from Native Values
What: Go can only construct FP numerals from a string (
MkFPNumeral(value string, sort *Sort)). The C API offers constructors from native float/double/int values which are more convenient:Z3_mk_fpa_numeral_float— from CfloatZ3_mk_fpa_numeral_double— from CdoubleZ3_mk_fpa_numeral_int— from integerZ3_mk_fpa_numeral_int64_uint64— from (sign, exponent, mantissa) tripleAvailable in: Python, Java, .NET, C++, TypeScript, Rust
Missing in: Go
🔵 Low Priority Issues
8. Rust BV Missing
repeatOperationWhat:
Z3_mk_repeat(ctx, i, t)repeats a bit-vectortexactlyitimes, producing a wider BV. All other bindings expose this. Rust'sBVtype hassign_ext,zero_ext, andextractbut notrepeat.Available in: Python, Java, .NET, C++, OCaml, TypeScript, Go
Missing in: Rust (
/z3/src/ast/bv.rs)Suggested fix: Add to
bv.rs:9. Rust Solver/Optimize Missing Many Newer C API Functions (Ongoing)
Status: Still open from previous run. Rust's
z3crate lacks wrappers for:Z3_solver_to_dimacs_string(noto_dimacs())Z3_solver_add_simplifier(noadd_simplifier())Z3_solver_get_trail(noget_trail())Z3_solver_register_on_clause(no clause learning callbacks)Z3_solver_interrupt(nointerrupt())Z3_solver_get_cube(noget_cube())Z3_solver_solve_for(nosolve_for())Z3_optimize_translate(notranslate()for Optimize)Z3_optimize_get_lower/Z3_optimize_get_upper(no objective bounds)Additionally,
z3-sysis missing the low-level FFI bindings for most of these, which must be added first.File:
/tmp/z3.rs/z3/src/solver.rs,/tmp/z3.rs/z3/src/optimize.rs,/tmp/z3.rs/z3-sys/src/generated.rsNext Run — APIs to Analyze
Z3_mk_forall,Z3_mk_exists,Z3_mk_lambda,Z3_mk_pattern,Z3_mk_bound,Z3_mk_quantifier_const_ex)Z3_mk_add,Z3_mk_mul,Z3_mk_div,Z3_mk_power,Z3_mk_mod,Z3_mk_is_int,Z3_mk_int2real,Z3_mk_real2int, Arith overflow predicates)Z3_fixedpoint_*)Z3_mk_goal,Z3_goal_*,Z3_tactic_*)Z3_mk_seq_*,Z3_mk_re_*,Z3_mk_string)Beta Was this translation helpful? Give feedback.
All reactions