[API Coherence] API Coherence Report - January 12, 2026 (Run 9: Memory, Printing, Conversions, Overflow, PB-SAT) #8165
Closed
Replies: 0 comments
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.
-
Progress: 36/40 API families analyzed (90% complete)
Summary
Run 9 analyzed 26 functions across 5 API families:
Key Findings
✅ Excellent coherence (100%) in 4 out of 5 families:
Issues Found (3 new)
🔴 High Priority (1 new)
Missing
set_ast_print_mode()in Python, C#, TypeScript🟡 Medium Priority (1 new)
Missing
benchmark_to_smtlib_string()in all languages⚪ Low Priority (1 new)
Missing
pattern_to_string()wrappersDetailed Analysis
1. Memory Management APIs ✅ 100% Coherent
Assessment: Each language uses appropriate automatic memory management. Manual reference counting (Z3_inc_ref/Z3_dec_ref) is correctly NOT exposed to users.
Language-specific implementations:
Verdict: Exemplary design. No changes needed.
2. Pretty Printing APIs⚠️ 75% Coherent
Core printing (toString/str) - ✅ Complete:
All languages provide string conversion for ASTs, sorts, and function declarations via
toString()/__str__()methods.Print mode control - ❌ Gaps:
Context.setAstPrintMode()- can switch between formatsZ3_set_ast_print_modeZ3_set_ast_print_modeZ3_set_ast_print_modeBenchmark export - ❌ Missing everywhere:
Z3_benchmark_to_smtlib_stringnot exposed in any language binding.Recommendation:
3. Type Conversion APIs ✅ 100% Coherent
All languages provide complete support for:
Int2Real/Real2Int- Integer ↔ Real conversionInt2BV/BV2Int- Integer ↔ Bit-vector conversionIntToStr- Integer → String conversionEach language uses appropriate idioms (global functions, context methods, or automatic coercion).
Verdict: Perfect coherence across all 5 languages.
4. Overflow/Underflow Predicates ✅ 100% Coherent
All 7 overflow/underflow predicates present in all languages:
bvadd_no_overflow/bvadd_no_underflowbvsub_no_overflow/bvsub_no_underflowbvmul_no_overflow/bvmul_no_underflowbvneg_no_overflowTypeScript stands out with the most ergonomic API - these are methods on BitVec objects (e.g.,
bv.addNoOverflow(other, isSigned)) rather than global functions.Verdict: Exemplary API consistency.
5. Pseudo-Boolean Constraint APIs ✅ 100% Coherent
All 5 PB-SAT functions present in all languages:
AtMost/AtLeast- Cardinality constraintsPbLe/PbGe/PbEq- Weighted pseudo-boolean constraintsEach language uses appropriate parameter types:
Verdict: Perfect coherence with language-appropriate syntax.
Cumulative Progress (Runs 1-9)
Language Rankings (36/40 families analyzed)
Java: 34/36 APIs (94.4%) ⭐⭐⭐ Excellent
C++: 34/36 APIs (94.4%) ⭐⭐⭐ Excellent
Python: 33/36 APIs (91.7%) ⭐⭐⭐ Excellent
C#: 33/36 APIs (91.7%) ⭐⭐ Very Good
TypeScript: 21/36 APIs (58.3%)⚠️ ⚠️ Major Gaps
Julia: 0/36 (0%) ❌ External package
Total Issues Tracked: 30
Next Run: Final Sprint to 100%
Remaining API families (4):
Run 10 will achieve 100% API coverage.
Recommendations
Immediate Actions (High Priority)
Add print mode control to Python, C#, TypeScript:
Python:
C#:
TypeScript:
Benefit: Better debugging, format control for compatibility
Effort: Low (simple wrapper functions)
Consider (Medium Priority)
Add benchmark export functionality:
Solver.to_smtlib2()/ToSmtlib2String()/toSmtlib2()methodsPositive Highlights
🎉 Memory management is exemplary - Each language uses best practices appropriate to its runtime
🎉 Type conversions are perfect - All conversions consistently available
🎉 Overflow predicates are outstanding - Complete coverage with TypeScript showing best-practice object methods
🎉 PB-SAT constraints are complete - All pseudo-boolean functions properly exposed with type-appropriate syntax
Files for Reference
Python:
src/api/python/z3/z3.pyJava:
src/api/java/Context.javaC#:
src/api/dotnet/Context.cs,src/api/dotnet/AST.csC++:
src/api/c++/z3++.hTypeScript:
src/api/js/src/high-level/high-level.ts,src/api/js/src/high-level/types.tsBeta Was this translation helpful? Give feedback.
All reactions