Copyright | (c) Galois Inc 2019-2020 |
---|---|
License | BSD3 |
Maintainer | huffman@galois.com |
Safe Haskell | None |
Language | Haskell2010 |
Provides an implementation of bitvector abstract domains optimized for performing XOR operations.
Synopsis
- data Domain (w :: Nat) = BVDXor !Integer !Integer !Integer
- proper :: NatRepr w -> Domain w -> Bool
- bvdMask :: Domain w -> Integer
- member :: Domain w -> Integer -> Bool
- pmember :: NatRepr n -> Domain n -> Integer -> Bool
- range :: NatRepr w -> Integer -> Integer -> Domain w
- interval :: Integer -> Integer -> Integer -> Domain w
- bitbounds :: Domain w -> (Integer, Integer)
- asSingleton :: Domain w -> Maybe Integer
- singleton :: NatRepr w -> Integer -> Domain w
- xor :: Domain w -> Domain w -> Domain w
- and :: Domain w -> Domain w -> Domain w
- and_scalar :: Integer -> Domain w -> Domain w
- genDomain :: NatRepr w -> Gen (Domain w)
- genElement :: Domain w -> Gen Integer
- genPair :: NatRepr w -> Gen (Domain w, Integer)
- correct_singleton :: 1 <= n => NatRepr n -> Integer -> Integer -> Property
- correct_xor :: 1 <= n => NatRepr n -> (Domain n, Integer) -> (Domain n, Integer) -> Property
- correct_and :: 1 <= n => NatRepr n -> (Domain n, Integer) -> (Domain n, Integer) -> Property
- correct_and_scalar :: 1 <= n => NatRepr n -> Integer -> (Domain n, Integer) -> Property
- correct_bitbounds :: Domain n -> Integer -> Property
XOR Domains
data Domain (w :: Nat) Source #
A value of type
represents a set of bitvectors of
width BVDomain
ww
. This is an alternate representation of the bitwise
domain values, optimized to compute XOR operations.
member :: Domain w -> Integer -> Bool Source #
Test if the given integer value is a member of the abstract domain
pmember :: NatRepr n -> Domain n -> Integer -> Bool Source #
Check that a domain is proper, and that the given value is a member
range :: NatRepr w -> Integer -> Integer -> Domain w Source #
Construct a domain from bitwise lower and upper bounds
asSingleton :: Domain w -> Maybe Integer Source #
Test if this domain contains a single value, and return it if so
Operations
singleton :: NatRepr w -> Integer -> Domain w Source #
Return a domain containing just the given value
Correctness properties
genDomain :: NatRepr w -> Gen (Domain w) Source #
Random generator for domain values. We always generate nonempty domain values.
genPair :: NatRepr w -> Gen (Domain w, Integer) Source #
Generate a random nonempty domain and an element contained in that domain.
correct_xor :: 1 <= n => NatRepr n -> (Domain n, Integer) -> (Domain n, Integer) -> Property Source #