Expand description
Low-level FFI bindings to the Vampire theorem prover.
This crate provides unsafe, raw bindings to the Vampire C API. It is intended
as an implementation detail of the vampire crate and is not meant to be used
directly.
§Usage
You probably want the vampire-prover crate instead.
The vampire crate provides a safe, ergonomic Rust API on top of these raw
bindings. This crate (vampire-sys) only provides the low-level unsafe
functions and types needed to interface with the Vampire C++ library.
§Building
This crate automatically builds the Vampire library from source using CMake during compilation. You need:
- CMake 3.10 or later
- A C++ compiler (GCC, Clang, or MSVC)
- Standard C++ library
§Thread Safety
The underlying Vampire library is not thread-safe. The vampire crate
handles this by protecting all calls with a global mutex. If you use this
crate directly, you must implement your own synchronization.
§Platform Support
This crate supports:
- Linux (links against libstdc++)
- macOS (links against libc++)
- Other platforms may work but are untested
§License
This FFI crate is dual-licensed under MIT OR Apache-2.0 (your choice).
The Vampire theorem prover library that this crate links to is licensed under the BSD 3-Clause License. Applications using this crate must comply with both the Rust bindings license and the Vampire BSD 3-Clause license.
Structs§
- max_
align_ t - vampire_
clause_ t - vampire_
formula_ t - vampire_
literal_ t - vampire_
problem_ t - vampire_
proof_ step_ t - A single step in a proof
- vampire_
term_ t - vampire_
unit_ t
Constants§
- __
bool_ true_ false_ are_ defined - false_
- true_
- vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ CLAUSIFY - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ EQUALITY_ FACTORING - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ EQUALITY_ RESOLUTION - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ FACTORING - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ INPUT - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ OTHER - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ RESOLUTION - vampire_
inference_ rule_ t_ VAMPIRE_ RULE_ SUPERPOSITION - vampire_
input_ type_ t_ VAMPIRE_ AXIOM - vampire_
input_ type_ t_ VAMPIRE_ CONJECTURE - vampire_
input_ type_ t_ VAMPIRE_ NEGATED_ CONJECTURE - vampire_
proof_ result_ t_ VAMPIRE_ INCOMPLETE - vampire_
proof_ result_ t_ VAMPIRE_ MEMORY_ LIMIT - vampire_
proof_ result_ t_ VAMPIRE_ PROOF - vampire_
proof_ result_ t_ VAMPIRE_ SATISFIABLE - vampire_
proof_ result_ t_ VAMPIRE_ TIMEOUT - vampire_
proof_ result_ t_ VAMPIRE_ UNKNOWN
Functions§
- vampire_
add_ ⚠function - Register a function symbol with the given name and arity. For constants, use arity 0. @param name Symbol name (null-terminated string) @param arity Number of arguments @return functor index for use in term construction
- vampire_
add_ ⚠predicate - Register a predicate symbol with the given name and arity. @param name Symbol name (null-terminated string) @param arity Number of arguments @return predicate index for use in literal construction
- vampire_
and ⚠ - Create a conjunction (f1 AND f2 AND …). @param formulas Array of formulas @param count Number of formulas @return Formula handle
- vampire_
atom ⚠ - Create an atomic formula from a literal. @param l The literal @return Formula handle
- vampire_
axiom_ ⚠clause - Create an axiom clause (disjunction of literals). @param literals Array of literals @param count Number of literals @return Clause handle
- vampire_
axiom_ ⚠formula - Create an axiom formula unit. @param f The formula @return Unit handle
- vampire_
clause ⚠ - Create a clause with specified input type. @param literals Array of literals @param count Number of literals @param input_type The type of input @return Clause handle
- vampire_
clause_ ⚠is_ empty - Check if a clause is empty (represents false). @param clause The clause @return true if empty, false otherwise
- vampire_
clause_ ⚠to_ string - Convert a clause to a string representation. @param clause The clause @return Allocated string (must be freed with vampire_free_string), or NULL on error
- vampire_
conjecture_ ⚠clause - Create a conjecture clause (to be refuted). @param literals Array of literals @param count Number of literals @return Clause handle
- vampire_
conjecture_ ⚠formula - Create a conjecture formula unit (to be proven). The formula is automatically negated for refutation-based proving. @param f The formula to prove @return Unit handle
- vampire_
constant ⚠ - Create a constant term (0-arity function application). @param functor Function symbol index from vampire_add_function @return Term handle
- vampire_
eq ⚠ - Create an equality literal (s = t or s != t). @param positive true for equality, false for disequality @param lhs Left-hand side term @param rhs Right-hand side term @return Literal handle
- vampire_
exists ⚠ - Create an existentially quantified formula (exists x. f). @param var_index The variable index to bind @param f The body formula @return Formula handle
- vampire_
extract_ ⚠proof - Extract the proof as a sequence of steps. Steps are returned in topological order (premises before conclusions). The last step is the empty clause (refutation).
- vampire_
forall ⚠ - Create a universally quantified formula (forall x. f). @param var_index The variable index to bind @param f The body formula @return Formula handle
- vampire_
formula_ ⚠to_ string - Convert a formula to a string representation. @param formula The formula @return Allocated string (must be freed with vampire_free_string), or NULL on error
- vampire_
free_ ⚠literals - Free the literals array returned by vampire_get_literals(). @param literals The array to free
- vampire_
free_ ⚠proof_ steps - Free the proof steps array returned by vampire_extract_proof(). @param steps The array to free @param count Number of steps
- vampire_
free_ ⚠string - Free a string allocated by vampire_*_to_string functions. @param str The string to free
- vampire_
get_ ⚠literals - Get the literals of a clause as an array. @param clause The clause @param out_literals Pointer to receive the array of literals @param out_count Pointer to receive the number of literals @return 0 on success, -1 on error
- vampire_
get_ ⚠refutation - Get the refutation (proof) after a successful vampire_prove() call. @return The empty clause with inference chain, or NULL if no proof
- vampire_
iff ⚠ - Create an equivalence (f1 <=> f2). @param lhs Left-hand side @param rhs Right-hand side @return Formula handle
- vampire_
imp ⚠ - Create an implication (f1 => f2). @param lhs The antecedent @param rhs The consequent @return Formula handle
- vampire_
input_ ⚠type_ name - Get the name of an input type. @param input_type The input type @return String name (static, do not free)
- vampire_
lit ⚠ - Create a predicate literal. @param pred Predicate symbol index from vampire_add_predicate @param positive true for positive literal, false for negated @param args Array of argument terms @param arg_count Number of arguments @return Literal handle
- vampire_
literal_ ⚠to_ string - Convert a literal to a string representation. @param literal The literal @return Allocated string (must be freed with vampire_free_string), or NULL on error
- vampire_
neg ⚠ - Get the complementary (negated) literal. @param l The literal to negate @return Literal handle
- vampire_
not ⚠ - Create a negated formula (NOT f). @param f The formula to negate @return Formula handle
- vampire_
or ⚠ - Create a disjunction (f1 OR f2 OR …). @param formulas Array of formulas @param count Number of formulas @return Formula handle
- vampire_
prepare_ ⚠for_ next_ proof - Prepare for running another proof (light reset). Call this between independent proving attempts to reset the global ordering and other per-proof state.
- vampire_
print_ ⚠proof - Print the proof to stdout. @param refutation The refutation from vampire_get_refutation()
- vampire_
print_ ⚠proof_ to_ file - Print the proof to a file. @param filename Path to output file (null-terminated string) @param refutation The refutation from vampire_get_refutation() @return 0 on success, -1 on error
- vampire_
problem_ ⚠from_ clauses - Create a problem from an array of clauses. @param clauses Array of clause handles @param count Number of clauses @return Problem handle
- vampire_
problem_ ⚠from_ units - Create a problem from an array of units (clauses or formulas). Formulas will be clausified during preprocessing. @param units Array of unit handles @param count Number of units @return Problem handle
- vampire_
prove ⚠ - Run the prover on a problem. @param problem The problem to solve @return The proof result
- vampire_
reset ⚠ - Fully reset the Vampire state for a fresh start. This resets all static caches, clears the signature, and reinitializes the environment. After calling this, the state is as if Vampire was just started.
- vampire_
rule_ ⚠name - Get the name of an inference rule. @param rule The inference rule @return String name (static, do not free)
- vampire_
set_ ⚠saturation_ algorithm - Set saturation algorithm. @param algorithm Name of algorithm (e.g., “lrs”, “discount”, “otter”)
- vampire_
set_ ⚠show_ proof - Enable or disable proof output.
- vampire_
set_ ⚠time_ limit - Set a time limit in seconds (0 = no limit).
- vampire_
set_ ⚠time_ limit_ deciseconds - Set a time limit in deciseconds (10 = 1 second, 0 = no limit).
- vampire_
term ⚠ - Create a function application term. @param functor Function symbol index from vampire_add_function @param args Array of argument terms @param arg_count Number of arguments @return Term handle
- vampire_
term_ ⚠to_ string - Convert a term to a string representation. @param term The term @return Allocated string (must be freed with vampire_free_string), or NULL on error
- vampire_
unit_ ⚠as_ clause - Get the clause from a unit (if the unit is a clause). @param unit The unit @return Clause handle, or NULL if unit is not a clause
- vampire_
var ⚠ - Create a variable term. @param index Variable index (0, 1, 2, …) @return Term handle
Type Aliases§
- vampire_
inference_ rule_ t - Inference rules (subset of commonly used rules)
- vampire_
input_ type_ t - Input type for units
- vampire_
proof_ result_ t - Result of a proving attempt
- wchar_t