API reference
API reference¶
This reference covers the base API of cvc5's Python bindings as CVC5 Mojo
mirrors it, for the pinned cvc5 release. Every page is generated from the
snapshot api/cvc5-api.json, the record of cvc5's API that the generator
works from:
- class and method descriptions are cvc5's own docstrings, converted from reStructuredText;
- each method shows the C API function that implements it.
Classes¶
| Class | Page |
|---|---|
TermManager |
TermManager |
Solver |
Solver |
Term, Op |
Term and Op |
Sort |
Sort |
Result, SynthResult |
Results |
DatatypeDecl, DatatypeConstructorDecl, Datatype, DatatypeConstructor, DatatypeSelector |
Datatypes |
Grammar, Proof |
Grammars and proofs |
Statistics |
Statistics |
SymbolManager, InputParser, Command |
Parser |
Plugin |
Plugin |
Kind, SortKind, and the other enums |
Enums |
Import names from the package root, for example
from cvc5_mojo import TermManager, Solver, Kind.
Reading an entry¶
- Signature. A generated method shows its Mojo signatures, one per overload, exactly as generated, followed by the labeled upstream Python signature. A method that is not generated shows the Python signature and explains why it is unavailable.
- Description. The text is cvc5's Python documentation, so it speaks of
Python types. Read
intasInt,strasString, a list as aList, and a returned tuple as a MojoTuple. - Mojo column. The Mojo column of each summary table shows ✓ when the package has the method. A method without it says why it is not generated; the coverage report lists them all.
- Binding line. The Binding line names the C functions behind a method and how the generator found them. The statuses are explained in mapping Python to C.
- Not mirrored. Methods that are not mirrored, because cvc5 deprecates them or they have no Mojo counterpart, are listed collapsed at the end of each class.
Common contracts¶
- Ownership and errors. Every value owns one cvc5 reference, and a call
that cvc5 rejects raises
Error("cvc5: …"); see ownership and errors. - Enum arguments. A method that takes a kind takes a
Kindvalue, such asKind.ADD. - Integers. Integer parameters are
Int, checked against the C type. A value that does not fit raisesError("cvc5_mojo: … is out of range for uint32_t").uint64_tvalues areUInt64. - Numbers of any size. Where Python returns or takes an
intof any size or aFraction, the bindings use apn_mojo'sIntegerandRational:getIntegerValuereturns anInteger, andmkIntegeralso takes one. See big numbers. - Lists. Python lists are Mojo
Listvalues, such asList[Term]. A method that takes Python's*argsalso takes aList, because Mojo cannot pass a list as*args:tm.mkTerm(Kind.AND, a, b)andtm.mkTerm(Kind.AND, terms)both work. - Optional names. Where Python's default is
None, the parameter isOptional:tm.mkConst(sort)makes an unnamed constant. - Several results come back as a
Tuple, as in Python:t.getCardinalityConstraint()[1]. - Copies are implicit, as Python shares objects. Copying a value of a
handle class, such as
TermorSort, takes a cvc5 reference; moving it with^does not. See ownership and errors.
Configure a solver¶
The option catalog combines defaults from the pinned binary with descriptions from its source. Start with the configuration guide for models, incremental queries, and resource limits. The Python migration guide compares complete programs in both languages.