{"id":16661964,"url":"https://github.com/leventerkok/sbv","last_synced_at":"2025-05-15T00:08:52.455Z","repository":{"id":389639,"uuid":"1228870","full_name":"LeventErkok/sbv","owner":"LeventErkok","description":"SMT Based Verification in Haskell. Express properties about Haskell programs  and automatically prove them using SMT solvers. ","archived":false,"fork":false,"pushed_at":"2025-05-13T15:09:48.000Z","size":18005,"stargazers_count":254,"open_issues_count":1,"forks_count":36,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-13T15:55:03.600Z","etag":null,"topics":["haskell","smt","verification"],"latest_commit_sha":null,"homepage":"https://github.com/LeventErkok/sbv","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeventErkok.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2011-01-07T07:26:47.000Z","updated_at":"2025-05-12T13:33:56.000Z","dependencies_parsed_at":"2024-02-25T00:31:08.428Z","dependency_job_id":"1b8aa160-2e8e-4661-941d-dffccdc82538","html_url":"https://github.com/LeventErkok/sbv","commit_stats":{"total_commits":6379,"total_committers":46,"mean_commits":"138.67391304347825","dds":"0.11396770653707478","last_synced_commit":"c1d251ff4ed409499e3641f25d98059dfe1a2a46"},"previous_names":[],"tags_count":78,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeventErkok%2Fsbv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeventErkok%2Fsbv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeventErkok%2Fsbv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeventErkok%2Fsbv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeventErkok","download_url":"https://codeload.github.com/LeventErkok/sbv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249204,"owners_count":22039029,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","smt","verification"],"created_at":"2024-10-12T10:36:33.399Z","updated_at":"2025-05-15T00:08:47.444Z","avatar_url":"https://github.com/LeventErkok.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SBV: SMT Based Verification in Haskell\n\n[![Build Status](https://github.com/LeventErkok/sbv/actions/workflows/haskell-ci.yml/badge.svg)](https://github.com/LeventErkok/sbv/actions/workflows/haskell-ci.yml)\n\nOn Hackage: http://hackage.haskell.org/package/sbv\n\nExpress properties about Haskell programs and automatically prove them using SMT solvers.\n\n```haskell\n$ ghci\nghci\u003e :m Data.SBV\nghci\u003e prove $ \\x -\u003e x `shiftL` 2 .== 4 * (x::SWord8)\nQ.E.D.\nghci\u003e prove $ \\x -\u003e x `shiftL` 2 .== 2 * (x::SWord8)\nFalsifiable. Counter-example:\n  s0 = 32 :: Word8\n```\n\nThe function `prove` establishes theorem-hood, while `sat` finds a satisfying model if it exists.\nAll satisfying models can be computed using `allSat`.\nSBV can also perform static assertion checks, such as absence of division-by-0, and other user given properties.\nFurthermore, SBV can perform optimization, minimizing/maximizing arithmetic goals for their optimal values.\n\nSBV also allows for an incremental mode: Users are given a handle to the SMT solver as their programs execute, and they can issue SMTLib commands programmatically, query values, and direct the interaction using a high-level typed API. The incremental mode also allows for creation of constraints based on the current model, and access to internals of SMT solvers for advanced users. See the `runSMT` and `query` commands for details.\n\n## Overview\n\n - [Hackage](http://hackage.haskell.org/package/sbv)\n - [Release Notes](http://github.com/LeventErkok/sbv/tree/master/CHANGES.md)\n   \nSBV library provides support for dealing with symbolic values in Haskell. It introduces the types:\n\n - `SBool`: Symbolic Booleans (bits).\n - `SWord8`, `SWord16`, `SWord32`, `SWord64`: Symbolic Words (unsigned).\n - `SInt8`, `SInt16`, `SInt32`, `SInt64`: Symbolic Ints (signed).\n - `SWord N`, `SInt N`, for `N \u003e 0`: Arbitrary sized unsigned/signed bit-vectors, parameterized by the bitsize. (Using DataKinds extension.)\n - `SInteger`: Symbolic unbounded integers (signed).\n - `SReal`: Symbolic infinite precision algebraic reals (signed).\n - `SRational`: Symbolic rationals, ratio of two symbolic integers. (`Rational`.)\n - `SFloat`: IEEE-754 single precision floating point number. (`Float`.)\n - `SDouble`: IEEE-754 double precision floating point number. (`Double`.)\n - `SFloatingPoint`: IEEE-754 floating point number with user specified exponent and significand sizes. (`FloatingPoint`)\n - `SChar`: Symbolic characters, supporting unicode.\n - `SString`: Symbolic strings.\n - `SList`: Symbolic lists. (Which can be nested, i.e., lists of lists.)\n - `STuple`: Symbolic tuples (upto 8-tuples, can be nested)\n - `SEither`: Symbolic sums\n - `SMaybe`: Symbolic optional values\n - `SSet`: Symbolic sets\n - Arrays of symbolic values.\n - Symbolic enumerations, for arbitrary user-defined enumerated types.\n - Symbolic polynomials over GF(2^n ), polynomial arithmetic, and CRCs.\n - Uninterpreted constants and functions over symbolic values, with user defined axioms.\n - Uninterpreted sorts, and proofs over such sorts, potentially with axioms.\n - Ability to define SMTLib functions, generated directly from Haskell versions, including support for recursive and mutually recursive functions.\n - Reasoning with universal and existential quantifiers, including alternating quantifiers.\n   \nThe user can construct ordinary Haskell programs using these types, which behave like ordinary Haskell values when used concretely. However, when used with symbolic arguments, functions built out of these types can also be:\n\n - proven correct via an external SMT solver (the `prove` function),\n - checked for satisfiability (the `sat`, and `allSat` functions),\n - checked for assertion violations (the `safe` function with `sAssert` calls),\n - checked for delta-satisfiability (the `dsat` and `dprove` functions),\n - used in synthesis (the `sat`function with existentials),\n - checked for machine-arithmetic overflow/underflow conditions,\n - optimized with respect to cost functions (the `optimize`, `maximize`, and `minimize` functions),\n - quick-checked,\n - used for generating Haskell and C test vectors (the `genTest` function),\n - compiled down to C, rendered as straight-line programs or libraries (`compileToC` and `compileToCLib` functions).\n   \n## Picking the SMT solver to use\n\nThe SBV library uses third-party SMT solvers via the standard SMT-Lib interface. The following solvers are supported:\n\n - [ABC](http://www.eecs.berkeley.edu/~alanmi/abc) from University of Berkeley\n - [Boolector](https://boolector.github.io/) from Johannes Kepler University\n - [Bitwuzla](https://bitwuzla.github.io/) from Stanford University\n - [CVC4](http://cvc4.github.io/) from Stanford University and the University of Iowa\n - [CVC5](http://cvc5.github.io/) from Stanford University and the University of Iowa\n - [DReal](https://dreal.github.io/) from CMU\n - [MathSAT](http://mathsat.fbk.eu/) from FBK and DISI-University of Trento\n - [OpenSMT](https://verify.inf.usi.ch/opensmt) from Università della Svizzera italiana\n - [Yices](http://yices.csl.sri.com/) from SRI\n - [Z3](http://github.com/Z3Prover/z3/wiki) from Microsoft\n   \nMost functions have two variants: For instance `prove`/`proveWith`. The former uses the default solver, which is currently Z3. The latter expects you to pass it a configuration that picks the solver.\nThe valid values are `abc`, `boolector`, `bitwuzla`, `cvc4`, `cvc5`, `dReal`, `mathSAT`, `openSMT`, `yices`, and `z3`.\n\nSee [versions](http://github.com/LeventErkok/sbv/blob/master/SMTSolverVersions.md) for a listing of the versions of these tools SBV has been tested with. Please report if you see any discrepancies!\n\nOther SMT solvers can be used with SBV as well, with a relatively easy hook-up mechanism. Please do get in touch if you plan to use SBV with any other solver.\n\n## Using multiple solvers, simultaneously\n\nSBV also allows for running multiple solvers at the same time, either picking the result of the first to complete, or getting results from all.\nSee `proveWithAny`/`proveWithAll` and `satWithAny`/`satWithAll` functions. The function `sbvAvailableSolvers` can be used to query the available solvers at run-time.\n\n### Semi-automated theorem proving\n\nWhile SMT solvers are quite powerful, there is a certain class of problems that they are just not well suited for. In particular, SMT\nsolvers are not good at proofs that require induction, or those that require complex chains of reasoning. Induction is necessary to reason about\nany recursive algorithm, and most such proofs require carefully constructed equational steps. SBV allows for a\nstyle of semi-automated theorem proving, called KnuckleDragger, that can be used to construct such proofs.\nThe documentation includes example proofs for many list functions, and even inductive proofs for the familiar insertion\nand merge-sort algorithms, along with a proof that the square-root of 2 is irrational. While a proper theorem prover (such as Lean, Isabelle\netc.) is a more appropriate choice for such proofs, with some guidance (and acceptance of a much larger trusted code base!), SBV can\nbe used to establish correctness of various mathematical claims and algorithms that are usually beyond the scope of SMT\nsolvers alone. See the documentation under the `Documentation.SBV.Examples.KnuckleDragger` directory.\n\n## Copyright, License\n\nThe SBV library is distributed with the BSD3 license. See [COPYRIGHT](http://github.com/LeventErkok/sbv/tree/master/COPYRIGHT) for details.\nThe [LICENSE](http://github.com/LeventErkok/sbv/tree/master/LICENSE) file contains the [BSD3](http://en.wikipedia.org/wiki/BSD_licenses) verbiage.\n\n## Thanks\n\nThe following people made major contributions to SBV, by developing new features and contributing to the design in significant ways: Joel Burget, Brian Huffman, Brian Schroeder, and Jeffrey Young.\n\nThe following people reported bugs, provided comments/feedback, or contributed to the development of SBV in various ways:\nAndreas Abel,\nAra Adkins,\nAndrew Anderson,\nKanishka Azimi,\nMarkus Barenhoff,\nReid Barton,\nBen Blaxill,\nIan Blumenfeld,\nGuillaume Bouchard,\nMartin Brain,\nIan Calvert,\nOliver Charles,\nChristian Conkle,\nMatthew Danish,\nIavor Diatchki,\nAlex Dixon,\nRobert Dockins,\nThomas DuBuisson,\nTrevor Elliott,\nGergő Érdi,\nJohn Erickson,\nRichard Fergie,\nAdam Foltzer,\nJoshua Gancher,\nRemy Goldschmidt,\nBrad Hardy,\nTom Hawkins,\nGreg Horn,\nJan Hrcek,\nGeorges-Axel Jaloyan,\nAnders Kaseorg,\nTom Sydney Kerckhove,\nLars Kuhtz,\nPiërre van de Laar,\nPablo Lamela,\nKen Friis Larsen,\nAndrew Lelechenko,\nJoe Leslie-Hurd,\nNick Lewchenko,\nBrett Letner,\nSirui Lu,\nGeorgy Lukyanov,\nMartin Lundfall,\nDaniel Matichuk,\nJohn Matthews,\nCurran McConnell,\nPhilipp Meyer,\nFabian Mitterwallner,\nJoshua Moerman,\nMatt Parker,\nJan Path,\nMatt Peddie,\nLucas Peña,\nMatthew Pickering,\nLee Pike,\nGleb Popov,\nRohit Ramesh,\nGeoffrey Ramseyer,\nBlake C. Rawlings,\nJaro Reinders,\nStephan Renatus,\nDan Rosén,\nRyan Scott,\nEric Seidel,\nAustin Seipp,\nAndrés Sicard-Ramírez,\nDon Stewart,\nGreg Sullivan,\nJosef Svenningsson,\nGeorge Thomas,\nMay Torrence,\nDaniel Wagner,\nSean Weaver,\nNis Wegmann,\nJared Ziegler,\nand Marco Zocca.\n\nThanks!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleventerkok%2Fsbv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleventerkok%2Fsbv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleventerkok%2Fsbv/lists"}