sbv-7.13: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.

Copyright | (c) Brian Huffman
License | BSD3
Maintainer | erkokl@gmail.com
Stability | experimental
Safe Haskell | None
Language | Haskell2010

Documentation.SBV.Examples.Misc.Word4

Description

Demonstrates how new sizes of word/int types can be defined and used with SBV.

Synopsis

- newtype Word4 = Word4 Word8
- word4 :: Word8 -> Word4
- type SWord4 = SBV Word4

# Documentation

newtype Word4 Source #

Word4 as a newtype. Invariant: `Word4 x` should satisfy `x < 16`.

Constructors

Word4 Word8 |

Instances

Bounded Word4 Source # | Bounded instance; from 0 to 255
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods minBound :: Word4 Source # maxBound :: Word4 Source #
Enum Word4 Source # | Enum instance, trivial definitions.

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

succ :: Word4 -> Word4 Source #

pred :: Word4 -> Word4 Source #

toEnum :: Int -> Word4 Source #

fromEnum :: Word4 -> Int Source #

enumFrom :: Word4 -> [Word4] Source #

enumFromThen :: Word4 -> Word4 -> [Word4] Source #

enumFromTo :: Word4 -> Word4 -> [Word4] Source #

enumFromThenTo :: Word4 -> Word4 -> Word4 -> [Word4] Source #

Eq Word4 Source # |
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods (==) :: Word4 -> Word4 -> Bool Source # (/=) :: Word4 -> Word4 -> Bool Source #
Integral Word4 Source # | Integral instance, again using Word8 instance and casting. NB. we do not need to use the smart constructor here as neither the quotient nor the remainder can overflow a Word4.
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods quot :: Word4 -> Word4 -> Word4 Source # rem :: Word4 -> Word4 -> Word4 Source # div :: Word4 -> Word4 -> Word4 Source # mod :: Word4 -> Word4 -> Word4 Source # quotRem :: Word4 -> Word4 -> (Word4, Word4) Source # divMod :: Word4 -> Word4 -> (Word4, Word4) Source # toInteger :: Word4 -> Integer Source #
Data Word4 Source # |

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Word4 -> c Word4 Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Word4 Source #

toConstr :: Word4 -> Constr Source #

dataTypeOf :: Word4 -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Word4) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Word4) Source #

gmapT :: (forall b. Data b => b -> b) -> Word4 -> Word4 Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Word4 -> r Source #

gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Word4 -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> Word4 -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Word4 -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Word4 -> m Word4 Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Word4 -> m Word4 Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Word4 -> m Word4 Source #

Num Word4 Source # | Num instance, merely lifts underlying 8-bit operation and casts back
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods (+) :: Word4 -> Word4 -> Word4 Source # (-) :: Word4 -> Word4 -> Word4 Source # (*) :: Word4 -> Word4 -> Word4 Source # negate :: Word4 -> Word4 Source # abs :: Word4 -> Word4 Source # signum :: Word4 -> Word4 Source # fromInteger :: Integer -> Word4 Source #
Ord Word4 Source # |
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods compare :: Word4 -> Word4 -> Ordering Source # (<) :: Word4 -> Word4 -> Bool Source # (<=) :: Word4 -> Word4 -> Bool Source # (>) :: Word4 -> Word4 -> Bool Source # (>=) :: Word4 -> Word4 -> Bool Source # max :: Word4 -> Word4 -> Word4 Source # min :: Word4 -> Word4 -> Word4 Source #
Read Word4 Source # | Read instance. We read as an 8-bit word, and coerce
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods readsPrec :: Int -> ReadS Word4 Source # readList :: ReadS [Word4] Source # readPrec :: ReadPrec Word4 Source # readListPrec :: ReadPrec [Word4] Source #
Real Word4 Source # | Real instance simply uses the Word8 instance
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods toRational :: Word4 -> Rational Source #
Show Word4 Source # | Show instance
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods showsPrec :: Int -> Word4 -> ShowS Source # show :: Word4 -> String Source # showList :: [Word4] -> ShowS Source #
Bits Word4 Source # | Bits instance

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

(.&.) :: Word4 -> Word4 -> Word4 Source #

(.|.) :: Word4 -> Word4 -> Word4 Source #

xor :: Word4 -> Word4 -> Word4 Source #

complement :: Word4 -> Word4 Source #

shift :: Word4 -> Int -> Word4 Source #

rotate :: Word4 -> Int -> Word4 Source #

zeroBits :: Word4 Source #

bit :: Int -> Word4 Source #

setBit :: Word4 -> Int -> Word4 Source #

clearBit :: Word4 -> Int -> Word4 Source #

complementBit :: Word4 -> Int -> Word4 Source #

testBit :: Word4 -> Int -> Bool Source #

bitSizeMaybe :: Word4 -> Maybe Int Source #

bitSize :: Word4 -> Int Source #

isSigned :: Word4 -> Bool Source #

shiftL :: Word4 -> Int -> Word4 Source #

unsafeShiftL :: Word4 -> Int -> Word4 Source #

shiftR :: Word4 -> Int -> Word4 Source #

unsafeShiftR :: Word4 -> Int -> Word4 Source #

rotateL :: Word4 -> Int -> Word4 Source #

rotateR :: Word4 -> Int -> Word4 Source #

popCount :: Word4 -> Int Source #

Random Word4 Source # | Random instance, used in quick-check
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods randomR :: RandomGen g => (Word4, Word4) -> g -> (Word4, g) Source # random :: RandomGen g => g -> (Word4, g) Source # randomRs :: RandomGen g => (Word4, Word4) -> g -> [Word4] Source # randoms :: RandomGen g => g -> [Word4] Source # randomRIO :: (Word4, Word4) -> IO Word4 Source # randomIO :: IO Word4 Source #
HasKind Word4 Source # | HasKind instance; simply returning the underlying kind for the type

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

kindOf :: Word4 -> Kind Source #

hasSign :: Word4 -> Bool Source #

intSizeOf :: Word4 -> Int Source #

isBoolean :: Word4 -> Bool Source #

isBounded :: Word4 -> Bool Source #

isReal :: Word4 -> Bool Source #

isFloat :: Word4 -> Bool Source #

isDouble :: Word4 -> Bool Source #

isInteger :: Word4 -> Bool Source #

isUninterpreted :: Word4 -> Bool Source #

isChar :: Word4 -> Bool Source #

isString :: Word4 -> Bool Source #

isList :: Word4 -> Bool Source #

showType :: Word4 -> String Source #

SymWord Word4 Source # | SymWord instance, allowing this type to be used in proofs/sat etc.

Instance details

Defined in Documentation.SBV.Examples.Misc.Word4

Methods

forall :: String -> Symbolic (SBV Word4) Source #

forall_ :: Symbolic (SBV Word4) Source #

mkForallVars :: Int -> Symbolic [SBV Word4] Source #

exists :: String -> Symbolic (SBV Word4) Source #

exists_ :: Symbolic (SBV Word4) Source #

mkExistVars :: Int -> Symbolic [SBV Word4] Source #

free :: String -> Symbolic (SBV Word4) Source #

free_ :: Symbolic (SBV Word4) Source #

mkFreeVars :: Int -> Symbolic [SBV Word4] Source #

symbolic :: String -> Symbolic (SBV Word4) Source #

symbolics :: [String] -> Symbolic [SBV Word4] Source #

literal :: Word4 -> SBV Word4 Source #

unliteral :: SBV Word4 -> Maybe Word4 Source #

fromCW :: CW -> Word4 Source #

isConcrete :: SBV Word4 -> Bool Source #

isSymbolic :: SBV Word4 -> Bool Source #

isConcretely :: SBV Word4 -> (Word4 -> Bool) -> Bool Source #

mkSymWord :: Maybe Quantifier -> Maybe String -> Symbolic (SBV Word4) Source #

SatModel Word4 Source # | SatModel instance, merely uses the generic parsing method.
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods parseCWs :: [CW] -> Maybe (Word4, [CW]) Source # cvtModel :: (Word4 -> Maybe b) -> Maybe (Word4, [CW]) -> Maybe (b, [CW]) Source #
SDivisible SWord4 Source # | SDvisible instance, using default methods
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods sQuotRem :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sDivMod :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # sQuot :: SWord4 -> SWord4 -> SWord4 Source # sRem :: SWord4 -> SWord4 -> SWord4 Source # sDiv :: SWord4 -> SWord4 -> SWord4 Source # sMod :: SWord4 -> SWord4 -> SWord4 Source #
SDivisible Word4 Source # | SDvisible instance, using 0-extension
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods sQuotRem :: Word4 -> Word4 -> (Word4, Word4) Source # sDivMod :: Word4 -> Word4 -> (Word4, Word4) Source # sQuot :: Word4 -> Word4 -> Word4 Source # sRem :: Word4 -> Word4 -> Word4 Source # sDiv :: Word4 -> Word4 -> Word4 Source # sMod :: Word4 -> Word4 -> Word4 Source #
SIntegral Word4 Source # | SIntegral instance, using default methods
Instance details Defined in Documentation.SBV.Examples.Misc.Word4
Splittable Word8 Word4 Source # | Joiningsplitting tofrom Word8
Instance details Defined in Documentation.SBV.Examples.Misc.Word4 Methods split :: Word8 -> (Word4, Word4) Source # (#) :: Word4 -> Word4 -> Word8 Source # extend :: Word4 -> Word8 Source #

word4 :: Word8 -> Word4 Source #

Smart constructor; simplifies conversion from Word8

type SWord4 = SBV Word4 Source #

SWord4 type synonym