The sbv package

[Tags: bsd3, library, program]

Express properties about Haskell programs and automatically prove them using SMT (Satisfiability Modulo Theories) solvers. Automatically generate C programs from Haskell functions. The SBV library adds support for symbolic bit vectors and other symbolic types, allowing formal models of Haskell programs to be created.

   $ ghci -XScopedTypeVariables
   Prelude> :m Data.SBV
   Prelude Data.SBV> prove $ \(x::SWord8) -> x `shiftL` 2 .== 4*x
   Prelude Data.SBV> prove $ forAll ["x"] $ \(x::SWord8) -> x `shiftL` 2 .== x
   Falsifiable. Counter-example:
     x = 128 :: SWord8

The SBV library uses Microsoft's Z3 SMT solver ( as the default underlying solver. It is also possible to use SRI's Yices SMT solver with SBV as well (, although the Z3 binding is much more richer.

SBV introduces the following types and concepts:

Functions built out of these types can be:

Predicates can have both existential and universal variables. Use of alternating quantifiers provides considerable expressive power. Furthermore, existential variables allow synthesis via model generation.

The SBV library can also compile Haskell functions that manipulate symbolic values directly to C, rendering them as straight-line C programs.

In addition to the library, the installation will create the executable SBVUnitTests. You should run it once the installation is complete, to make sure the unit tests are run and all is well.

SBV is hosted at GitHub: Comments, bug reports, and patches are always welcome.

The following people reported bugs, provided comments/feedback, or contributed to the development of SBV in various ways: Ian Blumenfeld, Ian Calvert, Iavor Diatchki, John Erickson, Tom Hawkins, Lee Pike, Austin Seipp, Don Stewart, Josef Svenningsson, and Nis Wegmann.

Release notes can be seen at:


Versions0.9, 0.9.1, 0.9.2, 0.9.3, 0.9.4, 0.9.5, 0.9.6, 0.9.7, 0.9.8, 0.9.9, 0.9.10, 0.9.11, 0.9.12, 0.9.13, 0.9.14, 0.9.15, 0.9.16, 0.9.17, 0.9.18, 0.9.19, 0.9.20, 0.9.21, 0.9.22, 0.9.23, 0.9.24, 1.0, 1.1, 1.2, 1.3, 1.4, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9, 2.10, 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 4.0, 4.1, 4.2, 4.3, 4.4
Change logNone available
Dependenciesarray, base (==4.*), containers, deepseq, directory, filepath, HUnit, mtl, old-time, pretty, process, QuickCheck, random, sbv, syb
CopyrightLevent Erkok, 2010-2012
AuthorLevent Erkok
MaintainerLevent Erkok (
CategoryFormal Methods, Theorem Provers, Bit vectors, Symbolic Computation, Math, SMT
Home page
Bug tracker
Source repositoryhead: git clone git://
UploadedThu Nov 29 03:31:32 UTC 2012 by LeventErkok
DistributionsLTSHaskell:4.2, NixOS:4.4, Stackage:4.4
Downloads7050 total (437 in last 30 days)
StatusDocs uploaded by user
Build status unknown [no reports yet]




Maintainers' corner

For package maintainers and hackage trustees