grisette-0.11.0.0: Symbolic evaluation as a library
Copyright(c) Sirui Lu 2024
LicenseBSD-3-Clause (see the LICENSE file)
Maintainersiruilu@cs.washington.edu
StabilityExperimental
PortabilityGHC only
Safe HaskellNone
LanguageHaskell2010

Grisette.Internal.Core.Data.Class.BitCast

Description

 
Synopsis

Documentation

class BitCast from to where Source #

Type class for bit-casting between types.

Special Considerations for Floating-Point Types:

Typically, bit-casting a value from type a to type b and then back to type a should result in the original value. However, this is not always true for floating-point values. In SMT-LIB2, there is only one NaN value with multiple bit representations.

Given this, we do not provide BitCast for the FP type, instead, we use the bitCastOrCanonical function to use a canonical representation for the NaN values.

If your application requires distinguishing between different NaN values, it is recommended to define your own floating-point type using bit-vectors. This allows you to check for NaN values and perform operations by bitcasting back to the provided floating-point types when they are not NaN values.

Methods

bitCast :: from -> to Source #

Instances

Instances details
BitCast Int16 FP16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Int16 -> FP16 Source #

BitCast Int32 Word32 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Int32 -> Word32 Source #

BitCast Int32 FP32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Int32 -> FP32 Source #

BitCast Int32 Float Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Int32 -> Float Source #

BitCast Int64 Word64 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Int64 -> Word64 Source #

BitCast Int64 FP64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Int64 -> FP64 Source #

BitCast Int64 Double Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Int64 -> Double Source #

BitCast Word16 FP16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Word16 -> FP16 Source #

BitCast Word32 Int32 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Word32 -> Int32 Source #

BitCast Word32 FP32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Word32 -> FP32 Source #

BitCast Word32 Float Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Word32 -> Float Source #

BitCast Word64 Int64 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Word64 -> Int64 Source #

BitCast Word64 FP64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Word64 -> FP64 Source #

BitCast Word64 Double Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

BitCast IntN32 Float Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN32 -> Float Source #

BitCast IntN64 Double Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast WordN32 Float Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast WordN64 Double Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast Double Int64 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Double -> Int64 Source #

BitCast Double Word64 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

BitCast Double IntN64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast Double WordN64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast Double FP64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Double -> FP64 Source #

BitCast Float Int32 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Float -> Int32 Source #

BitCast Float Word32 Source # 
Instance details

Defined in Grisette.Internal.Core.Data.Class.BitCast

Methods

bitCast :: Float -> Word32 Source #

BitCast Float IntN32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Float -> IntN32 Source #

BitCast Float WordN32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

BitCast Float FP32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: Float -> FP32 Source #

BitCast Int16 (IntN 16) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int16 -> IntN 16 Source #

BitCast Int16 (WordN 16) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int16 -> WordN 16 Source #

BitCast Int32 (IntN 32) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int32 -> IntN 32 Source #

BitCast Int32 (WordN 32) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int32 -> WordN 32 Source #

BitCast Int64 (IntN 64) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int64 -> IntN 64 Source #

BitCast Int64 (WordN 64) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int64 -> WordN 64 Source #

BitCast Int8 (IntN 8) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int8 -> IntN 8 Source #

BitCast Int8 (WordN 8) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Int8 -> WordN 8 Source #

BitCast Word16 (IntN 16) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word16 -> IntN 16 Source #

BitCast Word16 (WordN 16) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word16 -> WordN 16 Source #

BitCast Word32 (IntN 32) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word32 -> IntN 32 Source #

BitCast Word32 (WordN 32) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word32 -> WordN 32 Source #

BitCast Word64 (IntN 64) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word64 -> IntN 64 Source #

BitCast Word64 (WordN 64) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word64 -> WordN 64 Source #

BitCast Word8 (IntN 8) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word8 -> IntN 8 Source #

BitCast Word8 (WordN 8) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Word8 -> WordN 8 Source #

BitCast SymBool (SymIntN 1) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

Methods

bitCast :: SymBool -> SymIntN 1 Source #

BitCast SymBool (SymWordN 1) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

BitCast Bool (IntN 1) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Bool -> IntN 1 Source #

BitCast Bool (WordN 1) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: Bool -> WordN 1 Source #

BitCast (IntN 1) Bool Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 1 -> Bool Source #

BitCast (IntN 8) Int8 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 8 -> Int8 Source #

BitCast (IntN 8) Word8 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 8 -> Word8 Source #

BitCast (IntN 16) Int16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 16 -> Int16 Source #

BitCast (IntN 16) Word16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 16 -> Word16 Source #

BitCast (IntN 32) Int32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 32 -> Int32 Source #

BitCast (IntN 32) Word32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 32 -> Word32 Source #

BitCast (IntN 64) Int64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 64 -> Int64 Source #

BitCast (IntN 64) Word64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN 64 -> Word64 Source #

BitCast (WordN 1) Bool Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 1 -> Bool Source #

BitCast (WordN 8) Int8 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 8 -> Int8 Source #

BitCast (WordN 8) Word8 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 8 -> Word8 Source #

BitCast (WordN 16) Int16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 16 -> Int16 Source #

BitCast (WordN 16) Word16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 16 -> Word16 Source #

BitCast (WordN 32) Int32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 32 -> Int32 Source #

BitCast (WordN 32) Word32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 32 -> Word32 Source #

BitCast (WordN 64) Int64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 64 -> Int64 Source #

BitCast (WordN 64) Word64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN 64 -> Word64 Source #

BitCast (SymIntN 1) SymBool Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

Methods

bitCast :: SymIntN 1 -> SymBool Source #

BitCast (SymWordN 1) SymBool Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

(KnownNat n, 1 <= n) => BitCast (IntN n) (WordN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: IntN n -> WordN n Source #

(KnownNat n, 1 <= n) => BitCast (WordN n) (IntN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.BV

Methods

bitCast :: WordN n -> IntN n Source #

(KnownNat n, 1 <= n) => BitCast (SymIntN n) (SymWordN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

Methods

bitCast :: SymIntN n -> SymWordN n Source #

(KnownNat n, 1 <= n) => BitCast (SymWordN n) (SymIntN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymBV

Methods

bitCast :: SymWordN n -> SymIntN n Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCast (IntN r) (FP eb sb) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: IntN r -> FP eb sb Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCast (WordN r) (FP eb sb) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCast :: WordN r -> FP eb sb Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCast (SymIntN r) (SymFP eb sb) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCast :: SymIntN r -> SymFP eb sb Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCast (SymWordN r) (SymFP eb sb) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCast :: SymWordN r -> SymFP eb sb Source #

class BitCastCanonical from to where Source #

The canonical value when the bitcast cannot be precisely performed.

For example, with SMT-LIB2, there is only one NaN for floating point numbers, with multiple bit representations. Our underlying FP type also follows this convention. This means that we cannot precisely bitcast a FP to other types. So instead, we bitcast the NaN value to a canonical representation, defined with this type class.

Methods

bitCastCanonicalValue :: proxy from -> to Source #

Instances

Instances details
BitCastCanonical FP16 Int16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP16 Word16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP32 Int32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP32 Word32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP32 Float Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP64 Int64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP64 Word64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastCanonical FP64 Double Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

(ValidFP eb sb, n ~ (eb + sb)) => BitCastCanonical (FP eb sb) (IntN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastCanonicalValue :: proxy (FP eb sb) -> IntN n Source #

(ValidFP eb sb, n ~ (eb + sb)) => BitCastCanonical (FP eb sb) (WordN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastCanonicalValue :: proxy (FP eb sb) -> WordN n Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCastCanonical (SymFP eb sb) (SymIntN r) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCastCanonicalValue :: proxy (SymFP eb sb) -> SymIntN r Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCastCanonical (SymFP eb sb) (SymWordN r) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCastCanonicalValue :: proxy (SymFP eb sb) -> SymWordN r Source #

class BitCastOr from to where Source #

Bitcasting a value. If the value cannot be precisely bitcast, use the default value.

Methods

bitCastOr :: to -> from -> to Source #

Instances

Instances details
BitCastOr FP16 Int16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: Int16 -> FP16 -> Int16 Source #

BitCastOr FP16 Word16 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastOr FP32 Int32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: Int32 -> FP32 -> Int32 Source #

BitCastOr FP32 Word32 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastOr FP32 Float Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: Float -> FP32 -> Float Source #

BitCastOr FP64 Int64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: Int64 -> FP64 -> Int64 Source #

BitCastOr FP64 Word64 Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

BitCastOr FP64 Double Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

(ValidFP eb sb, n ~ (eb + sb)) => BitCastOr (FP eb sb) (IntN n) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: IntN n -> FP eb sb -> IntN n Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCastOr (FP eb sb) (WordN r) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.FP

Methods

bitCastOr :: WordN r -> FP eb sb -> WordN r Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCastOr (SymFP eb sb) (SymIntN r) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCastOr :: SymIntN r -> SymFP eb sb -> SymIntN r Source #

(ValidFP eb sb, r ~ (eb + sb)) => BitCastOr (SymFP eb sb) (SymWordN r) Source # 
Instance details

Defined in Grisette.Internal.SymPrim.SymFP

Methods

bitCastOr :: SymWordN r -> SymFP eb sb -> SymWordN r Source #

bitCastOrCanonical :: BitCastOrCanonical from to => from -> to Source #

Bitcasting a value and when the value cannot be precisely bitcast, use the canonical value.

type BitCastOrCanonical a b = (BitCastCanonical a b, BitCastOr a b) Source #

Constraint for bitcasting a value and when the value cannot be precisely bitcast, use the canonical value.