API reference

Coverage report

This page shows how completely the bindings cover the pinned cvc5 release. It is rendered from the snapshot api/cvc5-api.json when the site is built. The binding statuses are explained in mapping Python to C.

  • C API functions: 476. The C compiler checks every signature. 381 implement Python methods, 43 manage lifetimes and errors, and 53 have no Python counterpart; the raw layer binds those too.
  • Python methods: 458. 392 have a binding, 1 are skipped, 65 are deprecated, and 0 are unresolved.
  • Automatic join: 89.6% of the non-deprecated methods, operators such as __eq__ aside, are matched to C functions automatically. The gate requires 75%.
  • Enums: 14, with 1,158 values.
  • Base API: 392 of the 392 mirrored methods are generated, in 19 classes. 13 of them use hand-written code from bindgen/manual/. The others are listed below.
Class auto overloaded rule alias override manual skip deprecated unresolved
SymbolManager 5
Command 5 1
InputParser 7 2
Datatype 13 1 2
DatatypeConstructor 8 1 2
DatatypeConstructorDecl 5 1
DatatypeDecl 6 1
DatatypeSelector 6 1
Op 5 4 1
Grammar 5 2
Result 7 2
SynthResult 6 2
TermManager 60 5 2 1
Plugin 4
Solver 58 6 2 1 2 65
Sort 61 1 7 1
Statistics 3
Term 48 1 8 9 3 1
Proof 5 3
Total 310 13 34 2 20 13 1 65 0

Unresolved

Python methods without a binding. The gate fails while this list is not empty.

None.

Redundant overrides

Entries in bindgen/overrides.toml that the extracted data now resolves on its own. Delete them.

  • TermManager.mkReal
  • TermManager.mkBitVector

Overloaded

The join found several C functions for each of these methods, and each function becomes a Mojo overload. Review this list after a bump: a candidate that does not belong adds a wrong overload.

  • TermManager.mkTerm: cvc5_mk_term, cvc5_mk_term_from_op
  • TermManager.mkOp: cvc5_mk_op, cvc5_mk_op_from_str
  • TermManager.mkInteger: cvc5_mk_integer, cvc5_mk_integer_int64
  • TermManager.mkFloatingPoint: cvc5_mk_fp, cvc5_mk_fp_from_ieee
  • TermManager.mkDatatypeDecl: cvc5_mk_dt_decl, cvc5_mk_dt_decl_with_params
  • Solver.synthFun: cvc5_synth_fun, cvc5_synth_fun_with_grammar
  • Solver.findSynth: cvc5_find_synth, cvc5_find_synth_with_grammar
  • Solver.defineFunRec: cvc5_define_fun_rec, cvc5_define_fun_rec_from_const
  • Solver.getValue: cvc5_get_value, cvc5_get_values
  • Solver.getInterpolant: cvc5_get_interpolant, cvc5_get_interpolant_with_grammar
  • Solver.getAbduct: cvc5_get_abduct, cvc5_get_abduct_with_grammar
  • Sort.substitute: cvc5_sort_substitute, cvc5_sort_substitute_sorts
  • Term.substitute: cvc5_term_substitute_term, cvc5_term_substitute_terms

C-only functions

No Python method uses these functions. The raw layer binds them. Most are typed variants of Python methods, such as cvc5_term_get_int64_value.

  • Cvc5Result: cvc5_result_hash
  • Cvc5SynthResult: cvc5_synth_result_hash
  • Cvc5Sort: cvc5_sort_is_disequal
  • Cvc5Term: cvc5_term_is_int32_value, cvc5_term_get_int32_value, cvc5_term_is_uint32_value, cvc5_term_get_uint32_value, cvc5_term_get_string_value, cvc5_term_is_real32_value, cvc5_term_get_real32_value
  • Cvc5DatatypeConstructorDecl: cvc5_dt_cons_decl_is_equal, cvc5_dt_cons_decl_hash
  • Cvc5DatatypeDecl: cvc5_dt_decl_is_equal, cvc5_dt_decl_is_resolved, cvc5_dt_decl_hash
  • Cvc5DatatypeSelector: cvc5_dt_sel_is_equal, cvc5_dt_sel_hash
  • Cvc5DatatypeConstructor: cvc5_dt_cons_is_equal, cvc5_dt_cons_hash
  • Cvc5Datatype: cvc5_dt_is_equal, cvc5_dt_hash
  • Cvc5Grammar: cvc5_grammar_is_equal, cvc5_grammar_is_disequal
  • Cvc5TermManager: cvc5_term_manager_print_stats_safe, cvc5_mk_string_from_wchar, cvc5_mk_string_from_char32
  • Cvc5OptionInfo: cvc5_option_info_to_string
  • Cvc5Stat: cvc5_stat_to_string
  • Cvc5Statistics: cvc5_stats_to_string
  • Cvc5: cvc5_declare_oracle_fun, cvc5_print_stats_safe, cvc5_is_output_on, cvc5_get_output, cvc5_close_output
  • Enums: cvc5_kind_to_string, cvc5_kind_hash, cvc5_sort_kind_to_string, cvc5_sort_kind_hash, cvc5_unknown_explanation_to_string, cvc5_rm_to_string, cvc5_modes_block_models_mode_to_string, cvc5_modes_learned_lit_type_to_string, cvc5_modes_proof_component_to_string, cvc5_modes_proof_format_to_string, cvc5_modes_find_synth_target_to_string, cvc5_modes_option_category_to_string, cvc5_modes_input_language_to_string, cvc5_proof_rule_to_string, cvc5_proof_rule_hash, cvc5_proof_rewrite_rule_to_string, cvc5_proof_rewrite_rule_hash, cvc5_skolem_id_to_string, cvc5_skolem_id_hash

Base API

Mirrored Python methods that bindgen.gen_api does not generate, and why.

None.

Raw layer

The generated raw layer binds 476 of the 476 C functions. The others use C types that it does not represent:

None.

cvc5's unit tests

bindgen.translate translates cvc5's Python unit tests and examples to Mojo, into tests/cvc5/, and pixi run --locked cvc5-tests runs them. This section is rendered from tests/cvc5/translation.json. See verification.

  • Tests: 377 in the 17 files of cvc5's test/unit/api/python. 366 are translated by bindgen.translate and pass in Mojo, 1 are translated but left out, and 10 are not translated.
File Run Left out Not translated
test_command.py 3
test_datatype_api.py 10
test_finite_field.py 1 2
test_grammar.py 6
test_input_parser.py 12
test_lifetime.py 9
test_op.py 7
test_parser_lifetime.py 4
test_proof.py 7
test_result.py 5
test_solver.py 128
test_sort.py 58
test_symbol_manager.py 4 1
test_synth_result.py 5
test_term.py 37
test_term_manager.py 69
test_to_python_obj.py 1 8
Total 366 1 10

Left out

These translated tests cannot pass in Mojo. They are listed in [tests] of bindgen/overrides.toml, with the reason. pixi run --locked cvc5-tests builds each one on its own and requires the documented failure phase and diagnostic. Passing exclusions, unrelated failures, crashes, and timeouts fail the run.

  • test_symbol_manager.py test_constructor: the deprecated SymbolManager(Solver) is not mirrored

Not translated

These tests use Python that the translator does not handle. Each line names the first such construct.

  • test_finite_field.py test_basic_finite_field: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_finite_field.py test_basic_finite_field_base: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetBool: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetInt: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetReal: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetBV: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetArray: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetString: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetValueInt: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).
  • test_to_python_obj.py testGetValueReal: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).

Argument rejection

9 generated compile-fail fixtures check argument errors that Mojo rejects before execution. Each must fail at its marked call. Where Python evaluates an inner call before a statically invalid outer call, its runtime rejection is also retained.

Examples

cvc5's examples/api/python has 23 examples. 21 are translated and print exactly what the Python example prints under the official bindings, as bindgen.oracle records it: bags.py, bitvectors.py, bitvectors_and_arrays.py, combination.py, datatypes.py, exceptions.py, extract.py, helloworld.py, id.py, linear_arith.py, parser.py, parser_sym_manager.py, quickstart.py, relations.py, sequences.py, sets.py, strings.py, sygus-fun.py, sygus-inv.py, transcendentals.py, uf.py.

Model checks: floating_point.py. The translated example evaluates each assertion in every SAT model and checks each printed model value's sort and equality to its term in that model. Only those value fields may differ from Python; solver results, explanatory text, line order and exit status must match.

22 examples run in total. The others:

  • finite_field.py: not translated: toPythonObj is not mirrored: Converts to Python objects; Mojo has typed getters (getIntegerValue, getRealValue, ...).

C functions the tests reach

This section shows which C functions cvc5's translated unit tests and examples call. pixi run --locked cvc5-tests builds every program with -D CVC5_MOJO_TRACE=<file>, which makes the raw layer write the name of each C function that it calls. The run saves the result in tests/cvc5/calls.json. Without the define, the recording compiles away.

  • C functions: the translated tests and examples call 402 of the 476. That is 376 of the 381 that implement Python methods, 27 of the 43 that manage lifetimes and errors, and 0 of the 53 with no Python counterpart.
  • Generated methods: 378 generated methods call C functions. In a test or an example, 373 of them call at least one; the others are listed below. 14 more methods call no C function, because check, getName, isNull, notifySatClause, notifyTheoryLemma checks for a NULL handle in Mojo, so they are not counted.
Class Generated methods Reached
SymbolManager 5 5
Command 5 5
InputParser 9 9
Datatype 15 15
DatatypeConstructor 10 10
DatatypeConstructorDecl 5 5
DatatypeDecl 6 6
DatatypeSelector 6 6
Op 9 9
Grammar 6 5
Result 9 9
SynthResult 8 8
TermManager 68 68
Solver 69 69
Sort 69 67
Statistics 3 3
Term 68 66
Proof 8 8

Methods no test or example reaches

  • Grammar: __hash__
  • Sort: isFiniteField, getFiniteFieldSize
  • Term: isFiniteFieldValue, getFiniteFieldValue

C functions of reached methods that are not called

No test or example takes these overloads or variants.

None.

cvc5_mojo v1.4.1.1 for Mojo 1.2 and cvc5 1.4.1 · Apache License 2.0 with LLVM Exceptions · Source on GitHub