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

Copyright (c) Brian Huffman BSD3 erkokl@gmail.com experimental None Haskell2010

Data.SBV.Examples.Misc.Word4

Description

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

Synopsis

# Documentation

newtype Word4 Source #

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

Constructors

 Word4 Word8

Instances

 Source # Bounded instance; from 0 to 255 Methods Source # Enum instance, trivial definitions. Methodssucc :: Word4 -> Word4 #pred :: Word4 -> Word4 #toEnum :: Int -> Word4 #enumFrom :: Word4 -> [Word4] #enumFromThen :: Word4 -> Word4 -> [Word4] #enumFromTo :: Word4 -> Word4 -> [Word4] #enumFromThenTo :: Word4 -> Word4 -> Word4 -> [Word4] # Source # Methods(==) :: Word4 -> Word4 -> Bool #(/=) :: Word4 -> Word4 -> Bool # 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. Methodsquot :: 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) # Source # Methodsgfoldl :: (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 #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 # Source # Num instance, merely lifts underlying 8-bit operation and casts back Methods(+) :: Word4 -> Word4 -> Word4 #(-) :: Word4 -> Word4 -> Word4 #(*) :: Word4 -> Word4 -> Word4 #abs :: Word4 -> Word4 # Source # Methods(<) :: Word4 -> Word4 -> Bool #(<=) :: Word4 -> Word4 -> Bool #(>) :: Word4 -> Word4 -> Bool #(>=) :: Word4 -> Word4 -> Bool #max :: Word4 -> Word4 -> Word4 #min :: Word4 -> Word4 -> Word4 # Source # Read instance. We read as an 8-bit word, and coerce Methods Source # Real instance simply uses the Word8 instance Methods Source # Show instance MethodsshowsPrec :: Int -> Word4 -> ShowS #show :: Word4 -> String #showList :: [Word4] -> ShowS # Source # Bits instance Methods(.&.) :: Word4 -> Word4 -> Word4 #(.|.) :: Word4 -> Word4 -> Word4 #xor :: Word4 -> Word4 -> Word4 #shift :: Word4 -> Int -> Word4 #rotate :: Word4 -> Int -> Word4 #bit :: Int -> Word4 #setBit :: Word4 -> Int -> Word4 #clearBit :: Word4 -> Int -> Word4 #testBit :: Word4 -> Int -> Bool #bitSize :: Word4 -> Int #shiftL :: Word4 -> Int -> Word4 #shiftR :: Word4 -> Int -> Word4 #rotateL :: Word4 -> Int -> Word4 #rotateR :: Word4 -> Int -> Word4 # Random Word4 Source # Random instance, used in quick-check MethodsrandomR :: 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 Source # HasKind instance; simply returning the underlying kind for the type Methods Source # SymWord instance, allowing this type to be used in proofs/sat etc. Methodssymbolics :: [String] -> Symbolic [SBV Word4] Source #isConcretely :: SBV Word4 -> (Word4 -> Bool) -> Bool Source # Source # SatModel instance, merely uses the generic parsing method. MethodsparseCWs :: [CW] -> Maybe (Word4, [CW]) Source #cvtModel :: (Word4 -> Maybe b) -> Maybe (Word4, [CW]) -> Maybe (b, [CW]) Source # Source # SDvisible instance, using default methods MethodssQuotRem :: SWord4 -> SWord4 -> (SWord4, SWord4) Source #sDivMod :: SWord4 -> SWord4 -> (SWord4, SWord4) Source # Source # SDvisible instance, using 0-extension MethodssQuotRem :: Word4 -> Word4 -> (Word4, Word4) Source #sDivMod :: Word4 -> Word4 -> (Word4, Word4) Source # Source # SIntegral instance, using default methods Source # Conversion from bits MethodsfromBitsLE :: [SBool] -> SWord4 Source #fromBitsBE :: [SBool] -> SWord4 Source # Source # Joiningsplitting tofrom Word8 Methodssplit :: Word8 -> (Word4, Word4) Source #

Smart constructor; simplifies conversion from Word8

SWord4 type synonym