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 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)
- 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
TestEquality BaseTypeRepr Source # | |
Defined in What4.BaseTypes testEquality :: forall (a :: k) (b :: k). BaseTypeRepr a -> BaseTypeRepr b -> Maybe (a :~: b) # | |
TestEquality IndexLit Source # | |
Defined in What4.IndexLit | |
TestEquality OnlyIntRepr Source # | |
Defined in What4.Utils.OnlyIntRepr testEquality :: forall (a :: k) (b :: k). OnlyIntRepr a -> OnlyIntRepr b -> Maybe (a :~: b) # | |
TestEquality ConcreteVal Source # | |
Defined in What4.Concrete testEquality :: forall (a :: k) (b :: k). ConcreteVal a -> ConcreteVal b -> Maybe (a :~: b) # | |
TestEquality TypeMap Source # | |
Defined in What4.Protocol.SMTWriter | |
OrdF BaseTypeRepr Source # | |
Defined in What4.BaseTypes compareF :: forall (x :: k) (y :: k). BaseTypeRepr x -> BaseTypeRepr y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). BaseTypeRepr x -> BaseTypeRepr y -> Bool # ltF :: forall (x :: k) (y :: k). BaseTypeRepr x -> BaseTypeRepr y -> Bool # geqF :: forall (x :: k) (y :: k). BaseTypeRepr x -> BaseTypeRepr y -> Bool # gtF :: forall (x :: k) (y :: k). BaseTypeRepr x -> BaseTypeRepr y -> Bool # | |
OrdF IndexLit Source # | |
Defined in What4.IndexLit compareF :: forall (x :: k) (y :: k). IndexLit x -> IndexLit y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). IndexLit x -> IndexLit y -> Bool # ltF :: forall (x :: k) (y :: k). IndexLit x -> IndexLit y -> Bool # geqF :: forall (x :: k) (y :: k). IndexLit x -> IndexLit y -> Bool # gtF :: forall (x :: k) (y :: k). IndexLit x -> IndexLit y -> Bool # | |
OrdF ConcreteVal Source # | |
Defined in What4.Concrete compareF :: forall (x :: k) (y :: k). ConcreteVal x -> ConcreteVal y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). ConcreteVal x -> ConcreteVal y -> Bool # ltF :: forall (x :: k) (y :: k). ConcreteVal x -> ConcreteVal y -> Bool # geqF :: forall (x :: k) (y :: k). ConcreteVal x -> ConcreteVal y -> Bool # gtF :: forall (x :: k) (y :: k). ConcreteVal x -> ConcreteVal y -> Bool # | |
ShowF BaseTypeRepr Source # | |
Defined in What4.BaseTypes withShow :: forall p q (tp :: k) a. p BaseTypeRepr -> q tp -> (Show (BaseTypeRepr tp) => a) -> a # showF :: forall (tp :: k). BaseTypeRepr tp -> String # showsPrecF :: forall (tp :: k). Int -> BaseTypeRepr tp -> String -> String # | |
ShowF IndexLit Source # | |
ShowF ConcreteVal Source # | |
Defined in What4.Concrete withShow :: forall p q (tp :: k) a. p ConcreteVal -> q tp -> (Show (ConcreteVal tp) => a) -> a # showF :: forall (tp :: k). ConcreteVal tp -> String # showsPrecF :: forall (tp :: k). Int -> ConcreteVal tp -> String -> String # | |
ShowF TypeMap Source # | |
HashableF BaseTypeRepr Source # | |
Defined in What4.BaseTypes hashWithSaltF :: forall (tp :: k). Int -> BaseTypeRepr tp -> Int # hashF :: forall (tp :: k). BaseTypeRepr tp -> Int # | |
HashableF IndexLit Source # | |
Defined in What4.IndexLit | |
HashableF OnlyIntRepr Source # | |
Defined in What4.Utils.OnlyIntRepr hashWithSaltF :: forall (tp :: k). Int -> OnlyIntRepr tp -> Int # hashF :: forall (tp :: k). OnlyIntRepr tp -> Int # | |
FoldableFC App Source # | |
Defined in What4.Expr.App foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). App f x -> m # foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> App f x -> b # foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> App f x -> b # foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> App f x -> b # foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> App f x -> b # toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). App f x -> [a] # | |
KnownRepr BaseTypeRepr BaseComplexType Source # | |
Defined in What4.BaseTypes | |
KnownRepr BaseTypeRepr BaseRealType Source # | |
Defined in What4.BaseTypes | |
KnownRepr BaseTypeRepr BaseIntegerType Source # | |
Defined in What4.BaseTypes | |
KnownRepr BaseTypeRepr BaseBoolType Source # | |
Defined in What4.BaseTypes | |
FunctorFC (NonceApp t :: (BaseType -> Type) -> BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
FoldableFC (NonceApp t :: (BaseType -> Type) -> BaseType -> Type) Source # | |
Defined in What4.Expr.App foldMapFC :: forall f m. Monoid m => (forall (x :: k). f x -> m) -> forall (x :: l). NonceApp t f x -> m # foldrFC :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> NonceApp t f x -> b # foldlFC :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> NonceApp t f x -> b # foldrFC' :: (forall (x :: k). f x -> b -> b) -> forall (x :: l). b -> NonceApp t f x -> b # foldlFC' :: forall f b. (forall (x :: k). b -> f x -> b) -> forall (x :: l). b -> NonceApp t f x -> b # toListFC :: (forall (x :: k). f x -> a) -> forall (x :: l). NonceApp t f x -> [a] # | |
TraversableFC (NonceApp t :: (BaseType -> Type) -> BaseType -> Type) Source # | |
Defined in What4.Expr.App traverseFC :: forall f g m. Applicative m => (forall (x :: k). f x -> m (g x)) -> forall (x :: l). NonceApp t f x -> m (NonceApp t g x) # | |
KnownRepr (Assignment BaseTypeRepr) ctx => KnownRepr BaseTypeRepr (BaseStructType ctx :: BaseType) Source # | |
Defined in What4.BaseTypes knownRepr :: BaseTypeRepr (BaseStructType ctx) # | |
KnownRepr StringInfoRepr si => KnownRepr BaseTypeRepr (BaseStringType si :: BaseType) Source # | |
Defined in What4.BaseTypes knownRepr :: BaseTypeRepr (BaseStringType si) # | |
KnownRepr FloatPrecisionRepr fpp => KnownRepr BaseTypeRepr (BaseFloatType fpp :: BaseType) Source # | |
Defined in What4.BaseTypes knownRepr :: BaseTypeRepr (BaseFloatType fpp) # | |
(1 <= w, KnownNat w) => KnownRepr BaseTypeRepr (BaseBVType w :: BaseType) Source # | |
Defined in What4.BaseTypes knownRepr :: BaseTypeRepr (BaseBVType w) # | |
(KnownRepr (Assignment BaseTypeRepr) idx, KnownRepr BaseTypeRepr tp, KnownRepr BaseTypeRepr t) => KnownRepr BaseTypeRepr (BaseArrayType (idx ::> tp) t :: BaseType) Source # | |
Defined in What4.BaseTypes knownRepr :: BaseTypeRepr (BaseArrayType (idx ::> tp) t) # | |
(Eq (e BaseBoolType), Eq (e BaseRealType), HashableF e, HasAbsValue e, OrdF e) => TestEquality (App e :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
TestEquality (ExprBoundVar t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App testEquality :: forall (a :: k) (b :: k). ExprBoundVar t a -> ExprBoundVar t b -> Maybe (a :~: b) # | |
TestEquality (Expr t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
TestEquality (NonceAppExpr t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App testEquality :: forall (a :: k) (b :: k). NonceAppExpr t a -> NonceAppExpr t b -> Maybe (a :~: b) # | |
OrdF (ExprBoundVar t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App compareF :: forall (x :: k) (y :: k). ExprBoundVar t x -> ExprBoundVar t y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). ExprBoundVar t x -> ExprBoundVar t y -> Bool # ltF :: forall (x :: k) (y :: k). ExprBoundVar t x -> ExprBoundVar t y -> Bool # geqF :: forall (x :: k) (y :: k). ExprBoundVar t x -> ExprBoundVar t y -> Bool # gtF :: forall (x :: k) (y :: k). ExprBoundVar t x -> ExprBoundVar t y -> Bool # | |
OrdF (Expr t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App compareF :: forall (x :: k) (y :: k). Expr t x -> Expr t y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). Expr t x -> Expr t y -> Bool # ltF :: forall (x :: k) (y :: k). Expr t x -> Expr t y -> Bool # geqF :: forall (x :: k) (y :: k). Expr t x -> Expr t y -> Bool # gtF :: forall (x :: k) (y :: k). Expr t x -> Expr t y -> Bool # | |
OrdF (NonceAppExpr t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App compareF :: forall (x :: k) (y :: k). NonceAppExpr t x -> NonceAppExpr t y -> OrderingF x y # leqF :: forall (x :: k) (y :: k). NonceAppExpr t x -> NonceAppExpr t y -> Bool # ltF :: forall (x :: k) (y :: k). NonceAppExpr t x -> NonceAppExpr t y -> Bool # geqF :: forall (x :: k) (y :: k). NonceAppExpr t x -> NonceAppExpr t y -> Bool # gtF :: forall (x :: k) (y :: k). NonceAppExpr t x -> NonceAppExpr t y -> Bool # | |
ShowF (ExprBoundVar t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App withShow :: forall p q (tp :: k) a. p (ExprBoundVar t) -> q tp -> (Show (ExprBoundVar t tp) => a) -> a # showF :: forall (tp :: k). ExprBoundVar t tp -> String # showsPrecF :: forall (tp :: k). Int -> ExprBoundVar t tp -> String -> String # | |
ShowF (Expr t :: BaseType -> Type) Source # | |
(OrdF e, HashableF e, HasAbsValue e, Hashable (e BaseBoolType), Hashable (e BaseRealType)) => HashableF (App e :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
HashableF (ExprBoundVar t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App hashWithSaltF :: forall (tp :: k). Int -> ExprBoundVar t tp -> Int # hashF :: forall (tp :: k). ExprBoundVar t tp -> Int # | |
HashableF (Expr t :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
TestEquality f => TestEquality (ArrayResultWrapper f idx :: BaseType -> Type) Source # | |
Defined in What4.Interface testEquality :: forall (a :: k) (b :: k). ArrayResultWrapper f idx a -> ArrayResultWrapper f idx b -> Maybe (a :~: b) # | |
TestEquality e => TestEquality (NonceApp t e :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
HashableF e => HashableF (ArrayResultWrapper e idx :: BaseType -> Type) Source # | |
Defined in What4.Interface hashWithSaltF :: forall (tp :: k). Int -> ArrayResultWrapper e idx tp -> Int # hashF :: forall (tp :: k). ArrayResultWrapper e idx tp -> Int # | |
HashableF e => HashableF (NonceApp t e :: BaseType -> Type) Source # | |
Defined in What4.Expr.App | |
HasAbsValue (Dummy :: BaseType -> Type) Source # | |
Defined in What4.Expr.App getAbsValue :: forall (tp :: BaseType). Dummy tp -> AbstractValue tp Source # |
Constructors for kind BaseType
type BaseBoolType Source #
= 'BaseBoolType |
|
type BaseIntegerType Source #
= 'BaseIntegerType |
|
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) | |
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
.