docs.rs failed to build cvc5-rs-0.1.0
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build:
cvc5-rs-0.3.2
cvc5-rs
Safe, high-level Rust bindings for the cvc5 SMT solver.
cvc5 is an open-source automatic theorem prover for Satisfiability Modulo Theories (SMT) problems. It supports a wide range of theories including integers, reals, bit-vectors, strings, sequences, bags, sets, floating-point arithmetic, algebraic datatypes, and more.
Crate Structure
| Crate | Description |
|---|---|
cvc5-rs |
Safe, idiomatic Rust API (this crate) |
cvc5-sys |
Raw FFI bindings generated by bindgen |
Prerequisites
- Rust 2024 edition (1.85+)
- cvc5 1.3.1 source (included as a git submodule in
cvc5-sys/cvc5; built automatically bycvc5-sysif needed) - A C/C++ compiler, CMake ≥ 3.16, and libclang (for bindgen)
- Git (for automatic source download when installed from crates.io)
Quick Start
# Build everything (cvc5 is compiled automatically on first run)
Usage
Add to your Cargo.toml:
[]
= "0.1"
An application can set CVC5_DIR in its .cargo/config.toml to point to a local cvc5 checkout
so that cvc5-sys can build against it:
[]
= { = "cvc5", = true }
Example: Linear Integer Arithmetic
use ;
let tm = new;
let mut solver = new;
solver.set_logic;
solver.set_option;
let int_sort = tm.integer_sort;
let x = tm.mk_const;
let zero = tm.mk_integer;
let gt = tm.mk_term;
solver.assert_formula;
let result = solver.check_sat;
assert!;
let x_val = solver.get_value;
println!;
API Overview
Core Types
TermManager— creates sorts, terms, and operators. Owns the underlying memory.Solver— the main solver interface. Tied to aTermManagerlifetime.Sort— represents a type (Boolean, Integer, Real, BitVector, Array, Datatype, etc.).Term— represents an expression or formula.Result— the outcome of acheck_sat()call (sat / unsat / unknown).
Additional Types
Op— parameterized operator (e.g., bit-vector extract with indices).Datatype,DatatypeDecl,DatatypeConstructor,DatatypeConstructorDecl,DatatypeSelector— algebraic datatype support.Grammar— for SyGuS (syntax-guided synthesis) problems.SynthResult— result of a synthesis query.Proof— proof objects when proof production is enabled.Statistics— solver statistics.
Re-exported Enums
The following enums from cvc5-sys are re-exported for convenience:
Kind— term kinds (e.g.,AND,OR,GT,PLUS, …)SortKind— sort kinds (e.g.,BOOLEAN_SORT,INTEGER_SORT, …)RoundingMode— floating-point rounding modesProofRule,ProofRewriteRule— proof rulesSkolemId— Skolem function identifiersUnknownExplanation— reasons for unknown results
Configuration
The solver is configured through set_logic() and set_option():
solver.set_logic; // quantifier-free bit-vectors
solver.set_option;
solver.set_option;
See the cvc5 documentation for the full list of supported logics and options.
License
BSD-3-Clause — see LICENSE.