Eager, bit-blasting toy SMT solver for quantifier free bit vectors. Input language is a simplified version of QF_BV and similar theories from SMT-LIB, as described below and seen in /examples. Mostly made for fun / learning purposes, hence the silly language. Uses Kissat as the underlying SAT solver, through the rustsat crate.
Dependencies outside of Cargo:
- Libclang, for bindgen
- For all of these, assume
AandBare generic bit-vectors, andboolis a bit-vector of size 1 that can be made withto-bv - Implicitly runs a satisfiability check after all assertions, and prints a model if a formula is satisfiable
Declare uninterpreted functions (or constants)
declare-bv-fun(identifierint+, returnsunit)
Assert that a statement is true
assert(bool, returnsunit)
Size manipulation
zero-extend(A,int, returnsbv, size: int)extract(A,int (uppermost bit),int (lowermost bit)returnsbv, size: uppermost - lowermost + 1)concat(A,B, returnsbv, size: A.size + B.size)
If-then-else
ite(boolAA, returnsA)
Equality and comparisons, a U prefix stands for unsigned
eq(boolbool, returnsbool)ne(boolbool, returnsbool)ult(AA, returnsbool)ugt(AA, returnsbool)ule(AA, returnsbool)uge(AA, returnsbool)
Boolean functions
and(boolbool, returnsbool)or(boolbool, returnsbool)xor(boolbool, returnsbool)not(boolbool, returnsbool)implies(boolbool, returnsbool)
Boolean functions, on bit-vectors
bv-and(AA, returnsA)bv-or(AA, returnsA)bv-xor(AA, returnsA)bv-not(AA, returnsA)bv-nand(AA, returnsA)bv-nor(AA, returnsA)bv-xnor(AA, returnsA)
Arithmetic
bv-add(AA, returnsA)bv-sub(AA, returnsA)bv-mul(AA, returnsA)bv-udiv(AA, returnsA)
Shifts
bv-shl(AA, returnsA)bv-shr(AA, returnsA)