Copyright | (c) Galois Inc 2014-2020 |
---|---|
License | BSD3 |
Maintainer | Joe Hendrix <jhendrix@galois.com> |
Stability | provisional |
Safe Haskell | None |
Language | Haskell2010 |
This module exports the types used in solver expressions.
These types are largely used as indexes to various GADTs and type families as a way to let the GHC typechecker help us keep expressions used by solvers apart.
In addition, we provide a value-level reification of the type
indices that can be examined by pattern matching, called BaseTypeRepr
.
Synopsis
- data BaseType
- type BaseBoolType = BaseBoolType
- type BaseIntegerType = BaseIntegerType
- type BaseNatType = BaseNatType
- type BaseRealType = BaseRealType
- type BaseStringType = BaseStringType
- type BaseBVType = BaseBVType
- type BaseFloatType = BaseFloatType
- type BaseComplexType = BaseComplexType
- type BaseStructType = BaseStructType
- type BaseArrayType = BaseArrayType
- data StringInfo
- type Char8 = Char8
- type Char16 = Char16
- type Unicode = Unicode
- data FloatPrecision
- type family FloatPrecisionBits (fpp :: FloatPrecision) :: Nat where ...
- type FloatingPointPrecision = FloatingPointPrecision
- type Prec16 = FloatingPointPrecision 5 11
- type Prec32 = FloatingPointPrecision 8 24
- type Prec64 = FloatingPointPrecision 11 53
- type Prec80 = FloatingPointPrecision 15 65
- type Prec128 = FloatingPointPrecision 15 113
- data BaseTypeRepr (bt :: BaseType) :: Type where
- BaseBoolRepr :: BaseTypeRepr BaseBoolType
- BaseBVRepr :: 1 <= w => !(NatRepr w) -> BaseTypeRepr (BaseBVType w)
- BaseNatRepr :: BaseTypeRepr BaseNatType
- BaseIntegerRepr :: BaseTypeRepr BaseIntegerType
- BaseRealRepr :: BaseTypeRepr BaseRealType
- BaseFloatRepr :: !(FloatPrecisionRepr fpp) -> BaseTypeRepr (BaseFloatType fpp)
- BaseStringRepr :: StringInfoRepr si -> BaseTypeRepr (BaseStringType si)
- BaseComplexRepr :: BaseTypeRepr BaseComplexType
- BaseStructRepr :: !(Assignment BaseTypeRepr ctx) -> BaseTypeRepr (BaseStructType ctx)
- BaseArrayRepr :: !(Assignment BaseTypeRepr (idx ::> tp)) -> !(BaseTypeRepr xs) -> BaseTypeRepr (BaseArrayType (idx ::> tp) xs)
- data FloatPrecisionRepr (fpp :: FloatPrecision) where
- FloatingPointPrecisionRepr :: (2 <= eb, 2 <= sb) => !(NatRepr eb) -> !(NatRepr sb) -> FloatPrecisionRepr (FloatingPointPrecision eb sb)
- data StringInfoRepr (si :: StringInfo) where
- arrayTypeIndices :: BaseTypeRepr (BaseArrayType idx tp) -> Assignment BaseTypeRepr idx
- arrayTypeResult :: BaseTypeRepr (BaseArrayType idx tp) -> BaseTypeRepr tp
- floatPrecisionToBVType :: FloatPrecisionRepr (FloatingPointPrecision eb sb) -> BaseTypeRepr (BaseBVType (eb + sb))
- lemmaFloatPrecisionIsPos :: forall eb' sb'. FloatPrecisionRepr (FloatingPointPrecision eb' sb') -> LeqProof 1 (eb' + sb')
- module Data.Parameterized.NatRepr
- class KnownRepr (f :: k -> Type) (ctx :: k) where
- knownRepr :: f ctx
- type KnownCtx f = KnownRepr (Assignment f)
BaseType data kind
This data kind enumerates the Crucible solver interface types, which are types that may be represented symbolically.
Instances
Constructors for kind BaseType
type BaseBoolType Source #
= BaseBoolType |
|
type BaseIntegerType Source #
= BaseIntegerType |
|
type BaseNatType Source #
= BaseNatType |
|
type BaseRealType Source #
= BaseRealType |
|
type BaseStringType Source #
= BaseStringType |
|
type BaseBVType Source #
type BaseFloatType Source #
= BaseFloatType |
|
type BaseComplexType Source #
= BaseComplexType |
|
StringInfo data kind
data StringInfo Source #
Instances
Constructors for StringInfo
= Char8 |
|
= Char16 |
|
= Unicode |
|
FloatPrecision data kind
data FloatPrecision Source #
This data kind describes the types of floating-point formats. This consist of the standard IEEE 754-2008 binary floating point formats.
Instances
type family FloatPrecisionBits (fpp :: FloatPrecision) :: Nat where ... Source #
This computes the number of bits occupied by a floating-point format.
FloatPrecisionBits (FloatingPointPrecision eb sb) = eb + sb |
Constructors for kind FloatPrecision
type FloatingPointPrecision Source #
= FloatingPointPrecision |
|
FloatingPointPrecision aliases
type Prec16 = FloatingPointPrecision 5 11 Source #
Floating-point precision aliases
type Prec32 = FloatingPointPrecision 8 24 Source #
type Prec64 = FloatingPointPrecision 11 53 Source #
type Prec80 = FloatingPointPrecision 15 65 Source #
type Prec128 = FloatingPointPrecision 15 113 Source #
Representations of base types
data BaseTypeRepr (bt :: BaseType) :: Type where Source #
A runtime representation of a solver interface type. Parameter bt
has kind BaseType
.
BaseBoolRepr :: BaseTypeRepr BaseBoolType | |
BaseBVRepr :: 1 <= w => !(NatRepr w) -> BaseTypeRepr (BaseBVType w) | |
BaseNatRepr :: BaseTypeRepr BaseNatType | |
BaseIntegerRepr :: BaseTypeRepr BaseIntegerType | |
BaseRealRepr :: BaseTypeRepr BaseRealType | |
BaseFloatRepr :: !(FloatPrecisionRepr fpp) -> BaseTypeRepr (BaseFloatType fpp) | |
BaseStringRepr :: StringInfoRepr si -> BaseTypeRepr (BaseStringType si) | |
BaseComplexRepr :: BaseTypeRepr BaseComplexType | |
BaseStructRepr :: !(Assignment BaseTypeRepr ctx) -> BaseTypeRepr (BaseStructType ctx) | |
BaseArrayRepr :: !(Assignment BaseTypeRepr (idx ::> tp)) -> !(BaseTypeRepr xs) -> BaseTypeRepr (BaseArrayType (idx ::> tp) xs) |
Instances
data FloatPrecisionRepr (fpp :: FloatPrecision) where Source #
FloatingPointPrecisionRepr :: (2 <= eb, 2 <= sb) => !(NatRepr eb) -> !(NatRepr sb) -> FloatPrecisionRepr (FloatingPointPrecision eb sb) |
Instances
data StringInfoRepr (si :: StringInfo) where Source #
Char8Repr :: StringInfoRepr Char8 | |
Char16Repr :: StringInfoRepr Char16 | |
UnicodeRepr :: StringInfoRepr Unicode |
Instances
arrayTypeIndices :: BaseTypeRepr (BaseArrayType idx tp) -> Assignment BaseTypeRepr idx Source #
Return the type of the indices for an array type.
arrayTypeResult :: BaseTypeRepr (BaseArrayType idx tp) -> BaseTypeRepr tp Source #
Return the result type of an array type.
floatPrecisionToBVType :: FloatPrecisionRepr (FloatingPointPrecision eb sb) -> BaseTypeRepr (BaseBVType (eb + sb)) Source #
lemmaFloatPrecisionIsPos :: forall eb' sb'. FloatPrecisionRepr (FloatingPointPrecision eb' sb') -> LeqProof 1 (eb' + sb') Source #
module Data.Parameterized.NatRepr
KnownRepr
class KnownRepr (f :: k -> Type) (ctx :: k) where #
This class is parameterized by a kind k
(typically a data
kind), a type constructor f
of kind k -> *
(typically a GADT of
singleton types indexed by k
), and an index parameter ctx
of
kind k
.