sbv-5.14: 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

Data.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
Methods minBound :: Word4 # maxBound :: Word4 #
Enum Word4 Source # | Enum instance, trivial definitions.
Methods succ :: Word4 -> Word4 # pred :: Word4 -> Word4 # toEnum :: Int -> Word4 # fromEnum :: Word4 -> Int # enumFrom :: Word4 -> [Word4] # enumFromThen :: Word4 -> Word4 -> [Word4] # enumFromTo :: Word4 -> Word4 -> [Word4] # enumFromThenTo :: Word4 -> Word4 -> Word4 -> [Word4] #
Eq Word4 Source # |
Methods (==) :: Word4 -> Word4 -> Bool # (/=) :: Word4 -> Word4 -> Bool #
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.
Methods quot :: Word4 -> Word4 -> Word4 # rem :: Word4 -> Word4 -> Word4 # div :: Word4 -> Word4 -> Word4 # mod :: Word4 -> Word4 -> Word4 # quotRem :: Word4 -> Word4 -> (Word4, Word4) # divMod :: Word4 -> Word4 -> (Word4, Word4) # toInteger :: Word4 -> Integer #
Data Word4 Source # |

Methods

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

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

toConstr :: Word4 -> Constr #

dataTypeOf :: Word4 -> DataType #

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

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

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

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

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

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

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

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

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

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

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

Methods

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

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

xor :: Word4 -> Word4 -> Word4 #

complement :: Word4 -> Word4 #

shift :: Word4 -> Int -> Word4 #

rotate :: Word4 -> Int -> Word4 #

zeroBits :: Word4 #

bit :: Int -> Word4 #

setBit :: Word4 -> Int -> Word4 #

clearBit :: Word4 -> Int -> Word4 #

complementBit :: Word4 -> Int -> Word4 #

testBit :: Word4 -> Int -> Bool #

bitSizeMaybe :: Word4 -> Maybe Int #

bitSize :: Word4 -> Int #

isSigned :: Word4 -> Bool #

shiftL :: Word4 -> Int -> Word4 #

unsafeShiftL :: Word4 -> Int -> Word4 #

shiftR :: Word4 -> Int -> Word4 #

unsafeShiftR :: Word4 -> Int -> Word4 #

rotateL :: Word4 -> Int -> Word4 #

rotateR :: Word4 -> Int -> Word4 #

popCount :: Word4 -> Int #

Random Word4 Source # | Random instance, used in quick-check
Methods randomR :: RandomGen g => (Word4, Word4) -> g -> (Word4, g) # random :: RandomGen g => g -> (Word4, g) # randomRs :: RandomGen g => (Word4, Word4) -> g -> [Word4] # randoms :: RandomGen g => g -> [Word4] # randomRIO :: (Word4, Word4) -> IO Word4 # randomIO :: IO Word4 #
HasKind Word4 Source # | HasKind instance; simply returning the underlying kind for the type
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 # showType :: Word4 -> String Source #
SymWord Word4 Source # | SymWord instance, allowing this type to be used in proofs/sat etc.

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.
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
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
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
FromBits SWord4 Source # | Conversion from bits
Methods fromBitsLE :: [SBool] -> SWord4 Source # fromBitsBE :: [SBool] -> SWord4 Source #
Splittable Word8 Word4 Source # | Joiningsplitting tofrom Word8
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