sbvPlugin-9.8.2: Formally prove properties of Haskell programs using SBV/SMT
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Data.SBV.Plugin.Examples.BitTricks

Description

Checks the correctness of a few tricks from the large collection found in: https://graphics.stanford.edu/~seander/bithacks.html

Synopsis

Documentation

elem :: Word32 -> [Word32] -> Bool Source #

SBVPlugin can only see definitions in the current module. So we define elem ourselves. Also, it has to be monomoprhized, as the plugin isn't smart enough to deal with polymorphic functions out-of-the-box.

oneIf :: Num a => Bool -> a Source #

Returns 1 if bool is True