grisette-0.1.0.0: src/Grisette/Backend/SBV/Data/SMT/Solving.hs-boot
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
module Grisette.Backend.SBV.Data.SMT.Solving
( GrisetteSMTConfig (..),
TermTy,
)
where
import Data.Kind
import qualified Data.SBV as SBV
import GHC.TypeNats
import Grisette.IR.SymPrim.Data.BV
import Grisette.IR.SymPrim.Data.Prim.InternedTerm.Term
import Grisette.IR.SymPrim.Data.TabularFun
type Aux :: Bool -> Nat -> Type
type family Aux o n where
Aux 'True n = SBV.SInteger
Aux 'False n = SBV.SInt n
type IsZero :: Nat -> Bool
type family IsZero n where
IsZero 0 = 'True
IsZero _ = 'False
type TermTy :: Nat -> Type -> Type
type family TermTy bitWidth b where
TermTy _ Bool = SBV.SBool
TermTy n Integer = Aux (IsZero n) n
TermTy n (IntN x) = SBV.SBV (SBV.IntN x)
TermTy n (WordN x) = SBV.SBV (SBV.WordN x)
TermTy n (a =-> b) = TermTy n a -> TermTy n b
TermTy n (a --> b) = TermTy n a -> TermTy n b
TermTy _ v = v
data GrisetteSMTConfig (integerBitWidth :: Nat) where
UnboundedReasoning :: SBV.SMTConfig -> GrisetteSMTConfig 0
BoundedReasoning ::
(KnownNat integerBitWidth, IsZero integerBitWidth ~ 'False, SBV.BVIsNonZero integerBitWidth) =>
SBV.SMTConfig ->
GrisetteSMTConfig integerBitWidth