{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE CPP #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DeriveLift #-}
{-# HLINT ignore "Eta reduce" #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE InstanceSigs #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE Strict #-}
{-# LANGUAGE TemplateHaskellQuotes #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}

-- |
-- Module      :   Grisette.Internal.SymPrim.Prim.Internal.Term
-- Copyright   :   (c) Sirui Lu 2021-2024
-- License     :   BSD-3-Clause (see the LICENSE file)
--
-- Maintainer  :   siruilu@cs.washington.edu
-- Stability   :   Experimental
-- Portability :   GHC only
module Grisette.Internal.SymPrim.Prim.Internal.Term
  ( -- * Supported primitive types
    SupportedPrimConstraint (..),
    SupportedPrim (..),
    withSupportedPrimTypeable,
    SymRep (..),
    ConRep (..),
    LinkedRep (..),

    -- * Partial evaluation for the terms
    PEvalApplyTerm (..),
    PEvalBitwiseTerm (..),
    PEvalShiftTerm (..),
    PEvalRotateTerm (..),
    PEvalNumTerm (..),
    pevalSubNumTerm,
    PEvalOrdTerm (..),
    pevalGtOrdTerm,
    pevalGeOrdTerm,
    pevalNEqTerm,
    PEvalDivModIntegralTerm (..),
    PEvalBitCastTerm (..),
    PEvalBitCastOrTerm (..),
    PEvalBVTerm (..),
    PEvalFractionalTerm (..),
    PEvalFloatingTerm (..),
    PEvalFromIntegralTerm (..),
    PEvalIEEEFPConvertibleTerm (..),

    -- * Typed symbols
    SymbolKind (..),
    TypedSymbol (TypedSymbol, unTypedSymbol),
    typedConstantSymbol,
    typedAnySymbol,
    TypedConstantSymbol,
    TypedAnySymbol,
    SomeTypedSymbol (..),
    SomeTypedConstantSymbol,
    SomeTypedAnySymbol,
    IsSymbolKind (..),
    showUntyped,
    withSymbolSupported,
    withConstantSymbolSupported,
    someTypedSymbol,
    eqHeteroSymbol,
    castSomeTypedSymbol,
    withSymbolKind,

    -- * Terms
    FPTrait (..),
    FPUnaryOp (..),
    FPBinaryOp (..),
    FPRoundingUnaryOp (..),
    FPRoundingBinaryOp (..),
    FloatingUnaryOp (..),
    Term (..),
    defaultValueDynamic,
    pattern DynTerm,
    toCurThread,
    termId,
    termIdent,
    typeHashId,
    introSupportedPrimConstraint,
    pformatTerm,
    ModelValue (..),
    toModelValue,
    unsafeFromModelValue,

    -- * Interning
    UTerm (..),
    prettyPrintTerm,
    forallTerm,
    existsTerm,
    conTerm,
    symTerm,
    ssymTerm,
    isymTerm,
    notTerm,
    orTerm,
    andTerm,
    eqTerm,
    distinctTerm,
    iteTerm,
    addNumTerm,
    negNumTerm,
    mulNumTerm,
    absNumTerm,
    signumNumTerm,
    ltOrdTerm,
    leOrdTerm,
    andBitsTerm,
    orBitsTerm,
    xorBitsTerm,
    complementBitsTerm,
    shiftLeftTerm,
    shiftRightTerm,
    rotateLeftTerm,
    rotateRightTerm,
    bitCastTerm,
    bitCastOrTerm,
    bvConcatTerm,
    bvSelectTerm,
    bvExtendTerm,
    bvsignExtendTerm,
    bvzeroExtendTerm,
    applyTerm,
    divIntegralTerm,
    modIntegralTerm,
    quotIntegralTerm,
    remIntegralTerm,
    fpTraitTerm,
    fdivTerm,
    recipTerm,
    floatingUnaryTerm,
    powerTerm,
    fpUnaryTerm,
    fpBinaryTerm,
    fpRoundingUnaryTerm,
    fpRoundingBinaryTerm,
    fpFMATerm,
    fromIntegralTerm,
    fromFPOrTerm,
    toFPTerm,

    -- * Support for boolean type
    trueTerm,
    falseTerm,
    pattern BoolConTerm,
    pattern TrueTerm,
    pattern FalseTerm,
    pattern BoolTerm,
    pevalNotTerm,
    pevalOrTerm,
    pevalAndTerm,
    pevalImplyTerm,
    pevalXorTerm,
    pevalITEBasic,
    pevalITEBasicTerm,
    pevalDefaultEqTerm,
    NonFuncPrimConstraint,
    NonFuncSBVRep (..),
    SupportedNonFuncPrim (..),
    SBVRep (..),
    SBVFreshMonad (..),
    translateTypeError,
    parseSMTModelResultError,
    partitionCVArg,
    parseScalarSMTModelResult,
  )
where

#if MIN_VERSION_prettyprinter(1,7,0)
import Prettyprinter
  ( column,
    pageWidth,
    Doc,
    PageWidth(Unbounded, AvailablePerLine),
    Pretty(pretty),
  )
#else
import Data.Text.Prettyprint.Doc
  ( column,
    pageWidth,
    Doc,
    PageWidth(Unbounded, AvailablePerLine),
    Pretty(pretty),
  )
#endif

#if !MIN_VERSION_sbv(10, 0, 0)
#define SMTDefinable Uninterpreted
#endif

#if MIN_VERSION_sbv(11,0,0)
import qualified Data.SBV as SBVTC
#endif

import Control.DeepSeq (NFData (rnf))
import Control.Monad (msum)
import Control.Monad.IO.Class (MonadIO)
import qualified Control.Monad.RWS.Lazy as Lazy
import qualified Control.Monad.RWS.Strict as Strict
import Control.Monad.Reader (MonadTrans (lift), ReaderT)
import qualified Control.Monad.State.Lazy as Lazy
import qualified Control.Monad.State.Strict as Strict
import qualified Control.Monad.Writer.Lazy as Lazy
import qualified Control.Monad.Writer.Strict as Strict
import Data.Atomics (atomicModifyIORefCAS_)
import qualified Data.Binary as Binary
import Data.Bits (Bits)
import Data.Bytes.Serial (Serial (deserialize, serialize))
import qualified Data.HashMap.Strict as HM
import Data.Hashable (Hashable (hashWithSalt))
import Data.IORef (IORef, newIORef, readIORef)
import Data.Kind (Constraint, Type)
import Data.List.NonEmpty (NonEmpty ((:|)), toList)
import Data.Maybe (fromMaybe)
import qualified Data.SBV as SBV
import qualified Data.SBV.Dynamic as SBVD
import qualified Data.SBV.Trans as SBVT
import qualified Data.SBV.Trans.Control as SBVTC
import qualified Data.Serialize as Cereal
import Data.String (IsString (fromString))
import Data.Typeable (Proxy (Proxy), cast, typeRepFingerprint)
import GHC.Exts (Any, sortWith)
import GHC.Fingerprint (Fingerprint)
import GHC.Generics (Generic)
import GHC.IO (unsafePerformIO)
import GHC.Stack (HasCallStack)
import GHC.TypeNats (KnownNat, Nat, type (+), type (<=))
import Grisette.Internal.Core.Data.Class.BitCast (BitCast, BitCastOr)
import Grisette.Internal.Core.Data.Class.BitVector
  ( SizedBV,
  )
import Grisette.Internal.Core.Data.Symbol
  ( Identifier,
    Symbol (IndexedSymbol, SimpleSymbol),
  )
import Grisette.Internal.SymPrim.FP (FP, FPRoundingMode, ValidFP)
import Grisette.Internal.SymPrim.Prim.Internal.Caches
  ( Digest,
    Id,
    Ident,
    Interned
      ( Description,
        Uninterned,
        describe,
        descriptionDigest,
        identify,
        threadId
      ),
    intern,
  )
import Grisette.Internal.SymPrim.Prim.Internal.Utils
  ( WeakThreadId,
    myWeakThreadId,
  )
import Language.Haskell.TH.Syntax (Lift (liftTyped))
import Type.Reflection
  ( SomeTypeRep (SomeTypeRep),
    TypeRep,
    Typeable,
    eqTypeRep,
    someTypeRep,
    typeRep,
    withTypeable,
    type (:~~:) (HRefl),
  )
import Unsafe.Coerce (unsafeCoerce)

-- $setup
-- >>> import Grisette.Core
-- >>> import Grisette.SymPrim

-- | Monads that supports generating sbv fresh variables.
class (MonadIO m) => SBVFreshMonad m where
  sbvFresh :: (SBV.SymVal a) => String -> m (SBV.SBV a)

instance (MonadIO m) => SBVFreshMonad (SBVT.SymbolicT m) where
  sbvFresh :: forall a. SymVal a => String -> SymbolicT m (SBV a)
sbvFresh = String -> SymbolicT m (SBV a)
forall a (m :: * -> *).
(SymVal a, MonadSymbolic m) =>
String -> m (SBV a)
forall (m :: * -> *). MonadSymbolic m => String -> m (SBV a)
SBVT.free
  {-# INLINE sbvFresh #-}

instance (MonadIO m) => SBVFreshMonad (SBVTC.QueryT m) where
  sbvFresh :: forall a. SymVal a => String -> QueryT m (SBV a)
sbvFresh = String -> QueryT m (SBV a)
forall a (m :: * -> *).
(MonadIO m, MonadQuery m, SymVal a) =>
String -> m (SBV a)
SBVTC.freshVar
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m) => SBVFreshMonad (ReaderT r m) where
  sbvFresh :: forall a. SymVal a => String -> ReaderT r m (SBV a)
sbvFresh = m (SBV a) -> ReaderT r m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> ReaderT r m (SBV a))
-> (String -> m (SBV a)) -> String -> ReaderT r m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Lazy.WriterT w m) where
  sbvFresh :: forall a. SymVal a => String -> WriterT w m (SBV a)
sbvFresh = m (SBV a) -> WriterT w m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> WriterT w m (SBV a))
-> (String -> m (SBV a)) -> String -> WriterT w m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Lazy.RWST r w s m) where
  sbvFresh :: forall a. SymVal a => String -> RWST r w s m (SBV a)
sbvFresh = m (SBV a) -> RWST r w s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> RWST r w s m (SBV a))
-> (String -> m (SBV a)) -> String -> RWST r w s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m) => SBVFreshMonad (Lazy.StateT s m) where
  sbvFresh :: forall a. SymVal a => String -> StateT s m (SBV a)
sbvFresh = m (SBV a) -> StateT s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> StateT s m (SBV a))
-> (String -> m (SBV a)) -> String -> StateT s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Strict.WriterT w m) where
  sbvFresh :: forall a. SymVal a => String -> WriterT w m (SBV a)
sbvFresh = m (SBV a) -> WriterT w m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> WriterT w m (SBV a))
-> (String -> m (SBV a)) -> String -> WriterT w m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m, Monoid w) => SBVFreshMonad (Strict.RWST r w s m) where
  sbvFresh :: forall a. SymVal a => String -> RWST r w s m (SBV a)
sbvFresh = m (SBV a) -> RWST r w s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> RWST r w s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> RWST r w s m (SBV a))
-> (String -> m (SBV a)) -> String -> RWST r w s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

instance (SBVFreshMonad m) => SBVFreshMonad (Strict.StateT s m) where
  sbvFresh :: forall a. SymVal a => String -> StateT s m (SBV a)
sbvFresh = m (SBV a) -> StateT s m (SBV a)
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift (m (SBV a) -> StateT s m (SBV a))
-> (String -> m (SBV a)) -> String -> StateT s m (SBV a)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> m (SBV a)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  {-# INLINE sbvFresh #-}

-- | Error message for unsupported types.
translateTypeError :: (HasCallStack) => Maybe String -> TypeRep a -> b
translateTypeError :: forall a b. HasCallStack => Maybe String -> TypeRep a -> b
translateTypeError Maybe String
Nothing TypeRep a
ta =
  String -> b
forall a. HasCallStack => String -> a
error (String -> b) -> String -> b
forall a b. (a -> b) -> a -> b
$
    String
"Don't know how to translate the type " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ta String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" to SMT"
translateTypeError (Just String
reason) TypeRep a
ta =
  String -> b
forall a. HasCallStack => String -> a
error (String -> b) -> String -> b
forall a b. (a -> b) -> a -> b
$
    String
"Don't know how to translate the type " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ta String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" to SMT: " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
reason

-- | Type class for resolving the base type for the SBV type for the primitive
-- type.
class (SupportedPrim a, Ord a) => NonFuncSBVRep a where
  type NonFuncSBVBaseType a

-- | Type class for resolving the constraint for a supported non-function
-- primitive type.
type NonFuncPrimConstraint a =
  ( SBV.SymVal (NonFuncSBVBaseType a),
    SBV.EqSymbolic (SBVType a),
    SBV.Mergeable (SBVType a),
    SBV.SMTDefinable (SBVType a),
    SBV.Mergeable (SBVType a),
    SBVType a ~ SBV.SBV (NonFuncSBVBaseType a),
    PrimConstraint a
  )

-- | Indicates that a type is supported, can be represented as a symbolic term,
-- is not a function type, and can be lowered to an SBV term.
class (NonFuncSBVRep a) => SupportedNonFuncPrim a where
  conNonFuncSBVTerm :: a -> SBV.SBV (NonFuncSBVBaseType a)
  symNonFuncSBVTerm ::
    (SBVFreshMonad m) => String -> m (SBV.SBV (NonFuncSBVBaseType a))
  withNonFuncPrim :: ((NonFuncPrimConstraint a) => r) -> r

-- | Partition the list of CVs for models for functions.
partitionCVArg ::
  forall a.
  (SupportedNonFuncPrim a) =>
  [([SBVD.CV], SBVD.CV)] ->
  [(a, [([SBVD.CV], SBVD.CV)])]
partitionCVArg :: forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
partitionCVArg [([CV], CV)]
cv =
  [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall a.
SupportedNonFuncPrim a =>
[(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
partitionOrdCVArg ([(a, [([CV], CV)])] -> [(a, [([CV], CV)])])
-> [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall a b. (a -> b) -> a -> b
$
    [([CV], CV)] -> [(a, [([CV], CV)])]
forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
parseFirstCVArg [([CV], CV)]
cv
  where
    parseFirstCVArg ::
      forall a.
      (SupportedNonFuncPrim a) =>
      [([SBVD.CV], SBVD.CV)] ->
      [(a, [([SBVD.CV], SBVD.CV)])]
    parseFirstCVArg :: forall a.
SupportedNonFuncPrim a =>
[([CV], CV)] -> [(a, [([CV], CV)])]
parseFirstCVArg =
      (([CV], CV) -> (a, [([CV], CV)]))
-> [([CV], CV)] -> [(a, [([CV], CV)])]
forall a b. (a -> b) -> [a] -> [b]
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap
        ( \case
            (CV
x : [CV]
xs, CV
v) ->
              (Int -> ([([CV], CV)], CV) -> a
forall t. SupportedPrim t => Int -> ([([CV], CV)], CV) -> t
parseSMTModelResult Int
0 ([], CV
x), [([CV]
xs, CV
v)])
            ([CV], CV)
_ -> String -> (a, [([CV], CV)])
forall a. HasCallStack => String -> a
error String
"impossible"
        )
    partitionOrdCVArg ::
      forall a.
      (SupportedNonFuncPrim a) =>
      [(a, [([SBVD.CV], SBVD.CV)])] ->
      [(a, [([SBVD.CV], SBVD.CV)])]
    partitionOrdCVArg :: forall a.
SupportedNonFuncPrim a =>
[(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
partitionOrdCVArg [(a, [([CV], CV)])]
v = [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall {a} {a}. Eq a => [(a, [a])] -> [(a, [a])]
go [(a, [([CV], CV)])]
sorted
      where
        sorted :: [(a, [([CV], CV)])]
sorted = ((a, [([CV], CV)]) -> a)
-> [(a, [([CV], CV)])] -> [(a, [([CV], CV)])]
forall b a. Ord b => (a -> b) -> [a] -> [a]
sortWith (a, [([CV], CV)]) -> a
forall a b. (a, b) -> a
fst [(a, [([CV], CV)])]
v :: [(a, [([SBVD.CV], SBVD.CV)])]
        go :: [(a, [a])] -> [(a, [a])]
go ((a, [a])
x : (a, [a])
x1 : [(a, [a])]
xs) =
          if (a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x a -> a -> Bool
forall a. Eq a => a -> a -> Bool
== (a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x1
            then [(a, [a])] -> [(a, [a])]
go ([(a, [a])] -> [(a, [a])]) -> [(a, [a])] -> [(a, [a])]
forall a b. (a -> b) -> a -> b
$ ((a, [a]) -> a
forall a b. (a, b) -> a
fst (a, [a])
x, (a, [a]) -> [a]
forall a b. (a, b) -> b
snd (a, [a])
x [a] -> [a] -> [a]
forall a. [a] -> [a] -> [a]
++ (a, [a]) -> [a]
forall a b. (a, b) -> b
snd (a, [a])
x1) (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])]
xs
            else (a, [a])
x (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])] -> [(a, [a])]
go ((a, [a])
x1 (a, [a]) -> [(a, [a])] -> [(a, [a])]
forall a. a -> [a] -> [a]
: [(a, [a])]
xs)
        go [(a, [a])]
x = [(a, [a])]
x

-- | Parse the scalar model result.
parseScalarSMTModelResult ::
  forall v r.
  (SBV.SatModel r, Typeable v) =>
  (r -> v) ->
  ([([SBVD.CV], SBVD.CV)], SBVD.CV) ->
  v
parseScalarSMTModelResult :: forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult r -> v
convert cvs :: ([([CV], CV)], CV)
cvs@([], CV
v) = case [CV] -> Maybe (r, [CV])
forall a. SatModel a => [CV] -> Maybe (a, [CV])
SBV.parseCVs [CV
v] of
  Just (r
x, [CV]
_) -> r -> v
convert r
x
  Maybe (r, [CV])
Nothing -> TypeRep v -> ([([CV], CV)], CV) -> v
forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @v) ([([CV], CV)], CV)
cvs
parseScalarSMTModelResult r -> v
_ ([([CV], CV)], CV)
cv = TypeRep v -> ([([CV], CV)], CV) -> v
forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @v) ([([CV], CV)], CV)
cv

-- | Type class for resolving the SBV type for the primitive type.
class SBVRep t where
  type SBVType t

-- | Type class for resolving the constraint for a supported primitive type.
class SupportedPrimConstraint t where
  type PrimConstraint t :: Constraint
  type PrimConstraint _ = ()

-- | Indicates that a type is supported, can be represented as a symbolic term,
-- and can be lowered to an SBV term.
class
  ( Lift t,
    NFData t,
    SupportedPrimConstraint t,
    SBVRep t
  ) =>
  SupportedPrim t
  where
  primTypeRep :: TypeRep t
  default primTypeRep :: (Typeable t) => TypeRep t
  primTypeRep = TypeRep t
forall {k} (a :: k). Typeable a => TypeRep a
typeRep
  sameCon :: t -> t -> Bool
  default sameCon :: (Eq t) => t -> t -> Bool
  sameCon = t -> t -> Bool
forall a. Eq a => a -> a -> Bool
(==)
  hashConWithSalt :: Int -> t -> Int
  default hashConWithSalt :: (Hashable t) => Int -> t -> Int
  hashConWithSalt = Int -> t -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt
  pformatCon :: t -> String
  default pformatCon :: (Show t) => t -> String
  pformatCon = t -> String
forall a. Show a => a -> String
show
  defaultValue :: t
  pevalITETerm :: Term Bool -> Term t -> Term t -> Term t
  pevalEqTerm :: Term t -> Term t -> Term Bool
  pevalDistinctTerm :: NonEmpty (Term t) -> Term Bool
  conSBVTerm :: t -> SBVType t
  symSBVName :: TypedSymbol 'AnyKind t -> Int -> String
  symSBVTerm :: (SBVFreshMonad m) => String -> m (SBVType t)
  default withPrim ::
    ( PrimConstraint t,
      SBV.SMTDefinable (SBVType t),
      SBV.Mergeable (SBVType t),
      Typeable (SBVType t)
    ) =>
    ( ( PrimConstraint t,
        SBV.SMTDefinable (SBVType t),
        SBV.Mergeable (SBVType t),
        Typeable (SBVType t)
      ) =>
      a
    ) ->
    a
  withPrim ::
    ( ( PrimConstraint t,
        SBV.SMTDefinable (SBVType t),
        SBV.Mergeable (SBVType t),
        Typeable (SBVType t)
      ) =>
      a
    ) ->
    a
  withPrim (PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
 Typeable (SBVType t)) =>
a
i = a
(PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
 Typeable (SBVType t)) =>
a
i
  {-# INLINE withPrim #-}
  sbvIte :: SBV.SBV Bool -> SBVType t -> SBVType t -> SBVType t
  sbvIte = forall t a.
SupportedPrim t =>
((PrimConstraint t, SMTDefinable (SBVType t),
  Mergeable (SBVType t), Typeable (SBVType t)) =>
 a)
-> a
withPrim @t SBV Bool -> SBVType t -> SBVType t -> SBVType t
(PrimConstraint t, SMTDefinable (SBVType t), Mergeable (SBVType t),
 Typeable (SBVType t)) =>
SBV Bool -> SBVType t -> SBVType t -> SBVType t
forall a. Mergeable a => SBV Bool -> a -> a -> a
SBV.ite
  sbvEq :: SBVType t -> SBVType t -> SBV.SBV Bool
  default sbvEq ::
    (SBVT.EqSymbolic (SBVType t)) => SBVType t -> SBVType t -> SBV.SBV Bool
  sbvEq = SBVType t -> SBVType t -> SBV Bool
forall a. EqSymbolic a => a -> a -> SBV Bool
(SBV..==)
  sbvDistinct :: NonEmpty (SBVType t) -> SBV.SBV Bool
  default sbvDistinct ::
    (SBVT.EqSymbolic (SBVType t)) => NonEmpty (SBVType t) -> SBV.SBV Bool
  sbvDistinct = [SBVType t] -> SBV Bool
forall a. EqSymbolic a => [a] -> SBV Bool
SBV.distinct ([SBVType t] -> SBV Bool)
-> (NonEmpty (SBVType t) -> [SBVType t])
-> NonEmpty (SBVType t)
-> SBV Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty (SBVType t) -> [SBVType t]
forall a. NonEmpty a -> [a]
toList
  parseSMTModelResult :: Int -> ([([SBVD.CV], SBVD.CV)], SBVD.CV) -> t
  castTypedSymbol ::
    (IsSymbolKind knd') => TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
  funcDummyConstraint :: SBVType t -> SBV.SBV Bool

-- | The default value in a dynamic t'ModelValue'.
defaultValueDynamic ::
  forall t proxy. (SupportedPrim t) => proxy t -> ModelValue
defaultValueDynamic :: forall t (proxy :: * -> *).
SupportedPrim t =>
proxy t -> ModelValue
defaultValueDynamic proxy t
_ = t -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
toModelValue (forall t. SupportedPrim t => t
defaultValue @t)

-- | A value with its type information.
data ModelValue where
  ModelValue :: forall v. (SupportedPrim v) => v -> ModelValue

instance NFData ModelValue where
  rnf :: ModelValue -> ()
rnf (ModelValue v
v) = v -> ()
forall a. NFData a => a -> ()
rnf v
v

instance Lift ModelValue where
  liftTyped :: forall (m :: * -> *). Quote m => ModelValue -> Code m ModelValue
liftTyped (ModelValue v
v) = [||v -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
ModelValue v
v||]

instance Show ModelValue where
  show :: ModelValue -> String
show (ModelValue (v
v :: v)) = v -> String
forall t. SupportedPrim t => t -> String
pformatCon v
v String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" :: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep v -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)

instance Eq ModelValue where
  (ModelValue (v
v1 :: v1)) == :: ModelValue -> ModelValue -> Bool
== (ModelValue (v
v2 :: v2)) =
    case TypeRep v -> TypeRep v -> Maybe (v :~~: v)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @v1) (forall t. SupportedPrim t => TypeRep t
primTypeRep @v2) of
      Just v :~~: v
HRefl -> v -> v -> Bool
forall t. SupportedPrim t => t -> t -> Bool
sameCon v
v1 v
v
v2
      Maybe (v :~~: v)
_ -> Bool
False

instance Hashable ModelValue where
  Int
s hashWithSalt :: Int -> ModelValue -> Int
`hashWithSalt` (ModelValue (v
v :: v)) =
    (Int
s Int -> TypeRep v -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)) Int -> v -> Int
forall t. SupportedPrim t => Int -> t -> Int
`hashConWithSalt` v
v

-- | Convert from a model value. Crashes if the types does not match.
unsafeFromModelValue :: forall a. (Typeable a) => ModelValue -> a
unsafeFromModelValue :: forall a. Typeable a => ModelValue -> a
unsafeFromModelValue (ModelValue (v
v :: v)) =
  case TypeRep v -> TypeRep a -> Maybe (v :~~: a)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @v) (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @a) of
    Just v :~~: a
HRefl -> a
v
v
    Maybe (v :~~: a)
_ ->
      String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$
        String
"Bad model value type, expected type: "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep a -> String
forall a. Show a => a -> String
show (forall a. Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @a)
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", but got: "
          String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep v -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @v)

-- | Convert to a model value.
toModelValue :: forall a. (SupportedPrim a) => a -> ModelValue
toModelValue :: forall a. SupportedPrim a => a -> ModelValue
toModelValue = a -> ModelValue
forall a. SupportedPrim a => a -> ModelValue
ModelValue

-- | Cast a typed symbol to a different kind. Check if the kind is compatible.
castSomeTypedSymbol ::
  (IsSymbolKind knd') => SomeTypedSymbol knd -> Maybe (SomeTypedSymbol knd')
castSomeTypedSymbol :: forall (knd' :: SymbolKind) (knd :: SymbolKind).
IsSymbolKind knd' =>
SomeTypedSymbol knd -> Maybe (SomeTypedSymbol knd')
castSomeTypedSymbol (SomeTypedSymbol s :: TypedSymbol knd t
s@TypedSymbol {}) =
  TypedSymbol knd' t -> SomeTypedSymbol knd'
forall (knd :: SymbolKind) a.
TypedSymbol knd a -> SomeTypedSymbol knd
SomeTypedSymbol (TypedSymbol knd' t -> SomeTypedSymbol knd')
-> Maybe (TypedSymbol knd' t) -> Maybe (SomeTypedSymbol knd')
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
forall t (knd' :: SymbolKind) (knd :: SymbolKind).
(SupportedPrim t, IsSymbolKind knd') =>
TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
forall (knd' :: SymbolKind) (knd :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd t -> Maybe (TypedSymbol knd' t)
castTypedSymbol TypedSymbol knd t
s
{-# INLINE castSomeTypedSymbol #-}

-- | Error message for failure to parse the SBV model result.
parseSMTModelResultError ::
  (HasCallStack) => TypeRep a -> ([([SBVD.CV], SBVD.CV)], SBVD.CV) -> a
parseSMTModelResultError :: forall a. HasCallStack => TypeRep a -> ([([CV], CV)], CV) -> a
parseSMTModelResultError TypeRep a
ty ([([CV], CV)], CV)
cv =
  String -> a
forall a. HasCallStack => String -> a
error (String -> a) -> String -> a
forall a b. (a -> b) -> a -> b
$
    String
"BUG: cannot parse SBV model value \""
      String -> String -> String
forall a. Semigroup a => a -> a -> a
<> ([([CV], CV)], CV) -> String
forall a. Show a => a -> String
show ([([CV], CV)], CV)
cv
      String -> String -> String
forall a. Semigroup a => a -> a -> a
<> String
"\" to Grisette model value with the type "
      String -> String -> String
forall a. Semigroup a => a -> a -> a
<> TypeRep a -> String
forall a. Show a => a -> String
show TypeRep a
ty

-- | Partial evaluation for inequality terms.
pevalNEqTerm :: (SupportedPrim a) => Term a -> Term a -> Term Bool
pevalNEqTerm :: forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalNEqTerm Term a
l Term a
r = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term a
l Term a
r
{-# INLINE pevalNEqTerm #-}

-- | Type family to resolve the concrete type associated with a symbolic type.
class ConRep sym where
  type ConType sym

-- | Type family to resolve the symbolic type associated with a concrete type.
class (SupportedPrim con) => SymRep con where
  type SymType con

-- | One-to-one mapping between symbolic types and concrete types.
class
  (ConRep sym, SymRep con, sym ~ SymType con, con ~ ConType sym) =>
  LinkedRep con sym
    | con -> sym,
      sym -> con
  where
  underlyingTerm :: sym -> Term con
  wrapTerm :: Term con -> sym

-- | Partial evaluation and lowering for function application terms.
class PEvalApplyTerm f a b | f -> a b where
  pevalApplyTerm :: Term f -> Term a -> Term b
  sbvApplyTerm :: SBVType f -> SBVType a -> SBVType b

-- | Partial evaluation and lowering for bitwise operation terms.
class PEvalBitwiseTerm t where
  pevalAndBitsTerm :: Term t -> Term t -> Term t
  pevalOrBitsTerm :: Term t -> Term t -> Term t
  pevalXorBitsTerm :: Term t -> Term t -> Term t
  pevalComplementBitsTerm :: Term t -> Term t
  withSbvBitwiseTermConstraint :: (((Bits (SBVType t)) => r)) -> r
  sbvAndBitsTerm :: SBVType t -> SBVType t -> SBVType t
  sbvAndBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
(SBV..&.)
  sbvOrBitsTerm :: SBVType t -> SBVType t -> SBVType t
  sbvOrBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
(SBV..|.)
  sbvXorBitsTerm :: SBVType t -> SBVType t -> SBVType t
  sbvXorBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Bits a => a -> a -> a
SBV.xor
  sbvComplementBitsTerm :: SBVType t -> SBVType t
  sbvComplementBitsTerm = forall t r. PEvalBitwiseTerm t => (Bits (SBVType t) => r) -> r
withSbvBitwiseTermConstraint @t Bits (SBVType t) => SBVType t -> SBVType t
SBVType t -> SBVType t
forall a. Bits a => a -> a
SBV.complement

-- | Partial evaluation and lowering for symbolic shifting terms.
class PEvalShiftTerm t where
  pevalShiftLeftTerm :: Term t -> Term t -> Term t
  pevalShiftRightTerm :: Term t -> Term t -> Term t
  withSbvShiftTermConstraint ::
    (((SBV.SIntegral (NonFuncSBVBaseType t)) => r)) -> r
  sbvShiftLeftTerm :: SBVType t -> SBVType t -> SBVType t
  default sbvShiftLeftTerm ::
    (SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
  sbvShiftLeftTerm SBVType t
l SBVType t
r =
    forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalShiftTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvShiftTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sShiftLeft SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
  default sbvShiftRightTerm ::
    (SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
  sbvShiftRightTerm :: SBVType t -> SBVType t -> SBVType t
  sbvShiftRightTerm SBVType t
l SBVType t
r =
    forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalShiftTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvShiftTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sShiftRight SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r

-- | Partial evaluation and lowering for symbolic rotate terms.
class PEvalRotateTerm t where
  pevalRotateLeftTerm :: Term t -> Term t -> Term t
  pevalRotateRightTerm :: Term t -> Term t -> Term t
  withSbvRotateTermConstraint ::
    (((SBV.SIntegral (NonFuncSBVBaseType t)) => r)) -> r
  sbvRotateLeftTerm :: SBVType t -> SBVType t -> SBVType t
  default sbvRotateLeftTerm ::
    (SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
  sbvRotateLeftTerm SBVType t
l SBVType t
r =
    forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalRotateTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvRotateTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sRotateLeft SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r
  sbvRotateRightTerm :: SBVType t -> SBVType t -> SBVType t
  default sbvRotateRightTerm ::
    (SupportedNonFuncPrim t) => SBVType t -> SBVType t -> SBVType t
  sbvRotateRightTerm SBVType t
l SBVType t
r =
    forall a r.
SupportedNonFuncPrim a =>
(NonFuncPrimConstraint a => r) -> r
withNonFuncPrim @t ((NonFuncPrimConstraint t => SBVType t) -> SBVType t)
-> (NonFuncPrimConstraint t => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ forall t r.
PEvalRotateTerm t =>
(SIntegral (NonFuncSBVBaseType t) => r) -> r
withSbvRotateTermConstraint @t ((SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t)
-> (SIntegral (NonFuncSBVBaseType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBV (NonFuncSBVBaseType t)
-> SBV (NonFuncSBVBaseType t) -> SBV (NonFuncSBVBaseType t)
forall a b. (SIntegral a, SIntegral b) => SBV a -> SBV b -> SBV a
SBV.sRotateRight SBV (NonFuncSBVBaseType t)
SBVType t
l SBV (NonFuncSBVBaseType t)
SBVType t
r

-- | Partial evaluation and lowering for number terms.
class (Num t) => PEvalNumTerm t where
  pevalAddNumTerm :: Term t -> Term t -> Term t
  pevalNegNumTerm :: Term t -> Term t
  pevalMulNumTerm :: Term t -> Term t -> Term t
  pevalAbsNumTerm :: Term t -> Term t
  pevalSignumNumTerm :: Term t -> Term t
  withSbvNumTermConstraint :: (((Num (SBVType t)) => r)) -> r
  sbvAddNumTerm ::
    SBVType t ->
    SBVType t ->
    SBVType t
  sbvAddNumTerm SBVType t
l SBVType t
r = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Num a => a -> a -> a
+ SBVType t
r
  sbvNegNumTerm ::
    SBVType t ->
    SBVType t
  sbvNegNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ -SBVType t
l
  sbvMulNumTerm ::
    SBVType t ->
    SBVType t ->
    SBVType t
  sbvMulNumTerm SBVType t
l SBVType t
r = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Num a => a -> a -> a
* SBVType t
r
  sbvAbsNumTerm ::
    SBVType t ->
    SBVType t
  sbvAbsNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Num a => a -> a
abs SBVType t
l
  sbvSignumNumTerm ::
    SBVType t ->
    SBVType t
  sbvSignumNumTerm SBVType t
l = forall t r. PEvalNumTerm t => (Num (SBVType t) => r) -> r
withSbvNumTermConstraint @t ((Num (SBVType t) => SBVType t) -> SBVType t)
-> (Num (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Num a => a -> a
signum SBVType t
l

-- | Partial evaluation for subtraction terms.
pevalSubNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
pevalSubNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalSubNumTerm Term a
l Term a
r = Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
pevalAddNumTerm Term a
l (Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
pevalNegNumTerm Term a
r)

-- | Partial evaluation and lowering for comparison terms.
class PEvalOrdTerm t where
  pevalLtOrdTerm :: Term t -> Term t -> Term Bool
  pevalLeOrdTerm :: Term t -> Term t -> Term Bool
  withSbvOrdTermConstraint :: (((SBV.OrdSymbolic (SBVType t)) => r)) -> r
  sbvLtOrdTerm ::
    SBVType t ->
    SBVType t ->
    SBV.SBV Bool
  sbvLtOrdTerm SBVType t
l SBVType t
r = forall t r. PEvalOrdTerm t => (OrdSymbolic (SBVType t) => r) -> r
withSbvOrdTermConstraint @t ((OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool)
-> (OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBV Bool
forall a. OrdSymbolic a => a -> a -> SBV Bool
SBV..< SBVType t
r
  sbvLeOrdTerm :: SBVType t -> SBVType t -> SBV.SBV Bool
  sbvLeOrdTerm SBVType t
l SBVType t
r = forall t r. PEvalOrdTerm t => (OrdSymbolic (SBVType t) => r) -> r
withSbvOrdTermConstraint @t ((OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool)
-> (OrdSymbolic (SBVType t) => SBV Bool) -> SBV Bool
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBV Bool
forall a. OrdSymbolic a => a -> a -> SBV Bool
SBV..<= SBVType t
r

-- | Partial evaluation for greater than terms.
pevalGtOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
pevalGtOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalGtOrdTerm = (Term a -> Term a -> Term Bool) -> Term a -> Term a -> Term Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLtOrdTerm
{-# INLINE pevalGtOrdTerm #-}

-- | Partial evaluation for greater than or equal to terms.
pevalGeOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
pevalGeOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalGeOrdTerm = (Term a -> Term a -> Term Bool) -> Term a -> Term a -> Term Bool
forall a b c. (a -> b -> c) -> b -> a -> c
flip Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
pevalLeOrdTerm
{-# INLINE pevalGeOrdTerm #-}

-- | Partial evaluation and lowering for integer division and modulo terms.
class PEvalDivModIntegralTerm t where
  pevalDivIntegralTerm :: Term t -> Term t -> Term t
  pevalModIntegralTerm :: Term t -> Term t -> Term t
  pevalQuotIntegralTerm :: Term t -> Term t -> Term t
  pevalRemIntegralTerm :: Term t -> Term t -> Term t
  withSbvDivModIntegralTermConstraint ::
    (((SBV.SDivisible (SBVType t)) => r)) -> r
  sbvDivIntegralTerm :: SBVType t -> SBVType t -> SBVType t
  sbvDivIntegralTerm SBVType t
l SBVType t
r =
    forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sDiv` SBVType t
r
  sbvModIntegralTerm :: SBVType t -> SBVType t -> SBVType t
  sbvModIntegralTerm SBVType t
l SBVType t
r =
    forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sMod` SBVType t
r
  sbvQuotIntegralTerm :: SBVType t -> SBVType t -> SBVType t
  sbvQuotIntegralTerm SBVType t
l SBVType t
r =
    forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sQuot` SBVType t
r
  sbvRemIntegralTerm :: SBVType t -> SBVType t -> SBVType t
  sbvRemIntegralTerm SBVType t
l SBVType t
r =
    forall t r.
PEvalDivModIntegralTerm t =>
(SDivisible (SBVType t) => r) -> r
withSbvDivModIntegralTermConstraint @t ((SDivisible (SBVType t) => SBVType t) -> SBVType t)
-> (SDivisible (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. SDivisible a => a -> a -> a
`SBV.sRem` SBVType t
r

-- | Partial evaluation and lowering for bitcast terms.
class (BitCast a b) => PEvalBitCastTerm a b where
  pevalBitCastTerm :: Term a -> Term b
  sbvBitCast :: SBVType a -> SBVType b

-- | Partial evaluation and lowering for bitcast or default value terms.
class
  (BitCastOr a b) =>
  PEvalBitCastOrTerm a b
  where
  pevalBitCastOrTerm :: Term b -> Term a -> Term b
  sbvBitCastOr :: SBVType b -> SBVType a -> SBVType b

-- | Partial evaluation and lowering for bit-vector terms.
class (SizedBV bv) => PEvalBVTerm bv where
  pevalBVConcatTerm ::
    (KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
    Term (bv l) ->
    Term (bv r) ->
    Term (bv (l + r))
  pevalBVExtendTerm ::
    (KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
    Bool ->
    proxy r ->
    Term (bv l) ->
    Term (bv r)
  pevalBVSelectTerm ::
    (KnownNat n, KnownNat ix, KnownNat w, 1 <= n, 1 <= w, ix + w <= n) =>
    p ix ->
    q w ->
    Term (bv n) ->
    Term (bv w)
  sbvBVConcatTerm ::
    (KnownNat l, KnownNat r, 1 <= l, 1 <= r) =>
    p1 l ->
    p2 r ->
    SBVType (bv l) ->
    SBVType (bv r) ->
    SBVType (bv (l + r))
  sbvBVExtendTerm ::
    (KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
    p1 l ->
    p2 r ->
    Bool ->
    SBVType (bv l) ->
    SBVType (bv r)
  sbvBVSelectTerm ::
    ( KnownNat ix,
      KnownNat w,
      KnownNat n,
      1 <= n,
      1 <= w,
      ix + w <= n
    ) =>
    p1 ix ->
    p2 w ->
    p3 n ->
    SBVType (bv n) ->
    SBVType (bv w)

-- | Partial evaluation and lowering for fractional terms.
class (Fractional t) => PEvalFractionalTerm t where
  pevalFdivTerm :: Term t -> Term t -> Term t
  pevalRecipTerm :: Term t -> Term t
  withSbvFractionalTermConstraint ::
    (((Fractional (SBVType t)) => r)) ->
    r
  sbvFdivTerm ::
    SBVType t ->
    SBVType t ->
    SBVType t
  sbvFdivTerm SBVType t
l SBVType t
r = forall t r.
PEvalFractionalTerm t =>
(Fractional (SBVType t) => r) -> r
withSbvFractionalTermConstraint @t ((Fractional (SBVType t) => SBVType t) -> SBVType t)
-> (Fractional (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t
l SBVType t -> SBVType t -> SBVType t
forall a. Fractional a => a -> a -> a
/ SBVType t
r
  sbvRecipTerm ::
    SBVType t ->
    SBVType t
  sbvRecipTerm SBVType t
l = forall t r.
PEvalFractionalTerm t =>
(Fractional (SBVType t) => r) -> r
withSbvFractionalTermConstraint @t ((Fractional (SBVType t) => SBVType t) -> SBVType t)
-> (Fractional (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$ SBVType t -> SBVType t
forall a. Fractional a => a -> a
recip SBVType t
l

-- | Unary floating point operations.
data FloatingUnaryOp
  = FloatingExp
  | FloatingLog
  | FloatingSqrt
  | FloatingSin
  | FloatingCos
  | FloatingTan
  | FloatingAsin
  | FloatingAcos
  | FloatingAtan
  | FloatingSinh
  | FloatingCosh
  | FloatingTanh
  | FloatingAsinh
  | FloatingAcosh
  | FloatingAtanh
  deriving (FloatingUnaryOp -> FloatingUnaryOp -> Bool
(FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> Eq FloatingUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
== :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c/= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
/= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
Eq, Eq FloatingUnaryOp
Eq FloatingUnaryOp =>
(FloatingUnaryOp -> FloatingUnaryOp -> Ordering)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> Bool)
-> (FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp)
-> (FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp)
-> Ord FloatingUnaryOp
FloatingUnaryOp -> FloatingUnaryOp -> Bool
FloatingUnaryOp -> FloatingUnaryOp -> Ordering
FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FloatingUnaryOp -> FloatingUnaryOp -> Ordering
compare :: FloatingUnaryOp -> FloatingUnaryOp -> Ordering
$c< :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
< :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c<= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
<= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c> :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
> :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$c>= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
>= :: FloatingUnaryOp -> FloatingUnaryOp -> Bool
$cmax :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
max :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
$cmin :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
min :: FloatingUnaryOp -> FloatingUnaryOp -> FloatingUnaryOp
Ord, (forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x)
-> (forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp)
-> Generic FloatingUnaryOp
forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
from :: forall x. FloatingUnaryOp -> Rep FloatingUnaryOp x
$cto :: forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
to :: forall x. Rep FloatingUnaryOp x -> FloatingUnaryOp
Generic, Eq FloatingUnaryOp
Eq FloatingUnaryOp =>
(Int -> FloatingUnaryOp -> Int)
-> (FloatingUnaryOp -> Int) -> Hashable FloatingUnaryOp
Int -> FloatingUnaryOp -> Int
FloatingUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FloatingUnaryOp -> Int
hashWithSalt :: Int -> FloatingUnaryOp -> Int
$chash :: FloatingUnaryOp -> Int
hash :: FloatingUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    FloatingUnaryOp -> Code m FloatingUnaryOp)
-> Lift FloatingUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
$clift :: forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FloatingUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FloatingUnaryOp -> Code m FloatingUnaryOp
Lift, FloatingUnaryOp -> ()
(FloatingUnaryOp -> ()) -> NFData FloatingUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FloatingUnaryOp -> ()
rnf :: FloatingUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FloatingUnaryOp)
-> Serial FloatingUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
Serial)

instance Cereal.Serialize FloatingUnaryOp where
  put :: Putter FloatingUnaryOp
put = Putter FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize
  get :: Get FloatingUnaryOp
get = Get FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize

instance Binary.Binary FloatingUnaryOp where
  put :: FloatingUnaryOp -> Put
put = FloatingUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FloatingUnaryOp -> m ()
serialize
  get :: Get FloatingUnaryOp
get = Get FloatingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FloatingUnaryOp
deserialize

instance Show FloatingUnaryOp where
  show :: FloatingUnaryOp -> String
show FloatingUnaryOp
FloatingExp = String
"exp"
  show FloatingUnaryOp
FloatingLog = String
"log"
  show FloatingUnaryOp
FloatingSqrt = String
"sqrt"
  show FloatingUnaryOp
FloatingSin = String
"sin"
  show FloatingUnaryOp
FloatingCos = String
"cos"
  show FloatingUnaryOp
FloatingTan = String
"tan"
  show FloatingUnaryOp
FloatingAsin = String
"asin"
  show FloatingUnaryOp
FloatingAcos = String
"acos"
  show FloatingUnaryOp
FloatingAtan = String
"atan"
  show FloatingUnaryOp
FloatingSinh = String
"sinh"
  show FloatingUnaryOp
FloatingCosh = String
"cosh"
  show FloatingUnaryOp
FloatingTanh = String
"tanh"
  show FloatingUnaryOp
FloatingAsinh = String
"asinh"
  show FloatingUnaryOp
FloatingAcosh = String
"acosh"
  show FloatingUnaryOp
FloatingAtanh = String
"atanh"

-- | Partial evaluation and lowering for floating point terms.
class PEvalFloatingTerm t where
  pevalFloatingUnaryTerm :: FloatingUnaryOp -> Term t -> Term t
  pevalPowerTerm :: Term t -> Term t -> Term t
  withSbvFloatingTermConstraint ::
    (((Floating (SBVType t)) => r)) ->
    r
  sbvPowerTerm ::
    SBVType t ->
    SBVType t ->
    SBVType t
  sbvPowerTerm = forall t r. PEvalFloatingTerm t => (Floating (SBVType t) => r) -> r
withSbvFloatingTermConstraint @t Floating (SBVType t) => SBVType t -> SBVType t -> SBVType t
SBVType t -> SBVType t -> SBVType t
forall a. Floating a => a -> a -> a
(**)
  sbvFloatingUnaryTerm ::
    FloatingUnaryOp ->
    SBVType t ->
    SBVType t
  sbvFloatingUnaryTerm FloatingUnaryOp
op SBVType t
l =
    forall t r. PEvalFloatingTerm t => (Floating (SBVType t) => r) -> r
withSbvFloatingTermConstraint @t ((Floating (SBVType t) => SBVType t) -> SBVType t)
-> (Floating (SBVType t) => SBVType t) -> SBVType t
forall a b. (a -> b) -> a -> b
$
      case FloatingUnaryOp
op of
        FloatingUnaryOp
FloatingExp -> SBVType t -> SBVType t
forall a. Floating a => a -> a
exp SBVType t
l
        FloatingUnaryOp
FloatingLog -> SBVType t -> SBVType t
forall a. Floating a => a -> a
log SBVType t
l
        FloatingUnaryOp
FloatingSqrt -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sqrt SBVType t
l
        FloatingUnaryOp
FloatingSin -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sin SBVType t
l
        FloatingUnaryOp
FloatingCos -> SBVType t -> SBVType t
forall a. Floating a => a -> a
cos SBVType t
l
        FloatingUnaryOp
FloatingTan -> SBVType t -> SBVType t
forall a. Floating a => a -> a
tan SBVType t
l
        FloatingUnaryOp
FloatingAsin -> SBVType t -> SBVType t
forall a. Floating a => a -> a
asin SBVType t
l
        FloatingUnaryOp
FloatingAcos -> SBVType t -> SBVType t
forall a. Floating a => a -> a
acos SBVType t
l
        FloatingUnaryOp
FloatingAtan -> SBVType t -> SBVType t
forall a. Floating a => a -> a
atan SBVType t
l
        FloatingUnaryOp
FloatingSinh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
sinh SBVType t
l
        FloatingUnaryOp
FloatingCosh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
cosh SBVType t
l
        FloatingUnaryOp
FloatingTanh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
tanh SBVType t
l
        FloatingUnaryOp
FloatingAsinh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
asinh SBVType t
l
        FloatingUnaryOp
FloatingAcosh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
acosh SBVType t
l
        FloatingUnaryOp
FloatingAtanh -> SBVType t -> SBVType t
forall a. Floating a => a -> a
atanh SBVType t
l

-- | Partial evaluation and lowering for integral terms.
class (Integral a, Num b) => PEvalFromIntegralTerm a b where
  pevalFromIntegralTerm :: Term a -> Term b
  sbvFromIntegralTerm :: SBVType a -> SBVType b

-- | Partial evaluation and lowering for converting from and to IEEE floating
-- point terms.
class PEvalIEEEFPConvertibleTerm a where
  pevalFromFPOrTerm ::
    (ValidFP eb sb) =>
    Term a ->
    Term FPRoundingMode ->
    Term (FP eb sb) ->
    Term a
  pevalToFPTerm ::
    (ValidFP eb sb) => Term FPRoundingMode -> Term a -> Term (FP eb sb)
  sbvFromFPOrTerm ::
    (ValidFP eb sb) =>
    SBVType a ->
    SBVType FPRoundingMode ->
    SBVType (FP eb sb) ->
    SBVType a
  sbvToFPTerm ::
    (ValidFP eb sb) =>
    SBVType FPRoundingMode ->
    SBVType a ->
    SBVType (FP eb sb)

-- Typed Symbols

-- | The kind of a symbol.
--
-- All symbols are 'AnyKind', and all symbols other than general/tabular
-- functions are 'ConstantKind'.
data SymbolKind = ConstantKind | AnyKind

-- | Decision procedure for symbol kinds.
class IsSymbolKind (ty :: SymbolKind) where
  type SymbolKindConstraint ty :: Type -> Constraint
  decideSymbolKind :: Either (ty :~~: 'ConstantKind) (ty :~~: 'AnyKind)

instance IsSymbolKind 'ConstantKind where
  type SymbolKindConstraint 'ConstantKind = SupportedNonFuncPrim
  decideSymbolKind :: Either
  ('ConstantKind :~~: 'ConstantKind) ('ConstantKind :~~: 'AnyKind)
decideSymbolKind = ('ConstantKind :~~: 'ConstantKind)
-> Either
     ('ConstantKind :~~: 'ConstantKind) ('ConstantKind :~~: 'AnyKind)
forall a b. a -> Either a b
Left 'ConstantKind :~~: 'ConstantKind
forall {k1} (a :: k1). a :~~: a
HRefl

instance IsSymbolKind 'AnyKind where
  type SymbolKindConstraint 'AnyKind = SupportedPrim
  decideSymbolKind :: Either ('AnyKind :~~: 'ConstantKind) ('AnyKind :~~: 'AnyKind)
decideSymbolKind = ('AnyKind :~~: 'AnyKind)
-> Either ('AnyKind :~~: 'ConstantKind) ('AnyKind :~~: 'AnyKind)
forall a b. b -> Either a b
Right 'AnyKind :~~: 'AnyKind
forall {k1} (a :: k1). a :~~: a
HRefl

-- | A typed symbol is a symbol that is associated with a type. Note that the
-- same symbol bodies with different types are considered different symbols
-- and can coexist in a term.
--
-- Simple symbols can be created with the @OverloadedStrings@ extension:
--
-- >>> "a" :: TypedSymbol 'AnyKind Bool
-- a :: Bool
data TypedSymbol (knd :: SymbolKind) t where
  TypedSymbol ::
    ( SupportedPrim t,
      SymbolKindConstraint knd t,
      IsSymbolKind knd
    ) =>
    {forall t (knd :: SymbolKind). TypedSymbol knd t -> Symbol
unTypedSymbol :: Symbol} ->
    TypedSymbol knd t

-- | Create a typed symbol with constant kinds.
typedConstantSymbol ::
  forall t. (SupportedNonFuncPrim t) => Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol :: forall t.
SupportedNonFuncPrim t =>
Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol = PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
forall t.
PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' PhantomNonFuncDict t
forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
getPhantomNonFuncDict
{-# INLINE typedConstantSymbol #-}

{-# NOINLINE typedConstantSymbol' #-}
typedConstantSymbol' ::
  forall t. PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' :: forall t.
PhantomNonFuncDict t -> Symbol -> TypedSymbol 'ConstantKind t
typedConstantSymbol' PhantomNonFuncDict t
PhantomNonFuncDict Symbol
symbol = Symbol -> TypedSymbol 'ConstantKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
symbol

-- | Create a typed symbol with any kinds.
typedAnySymbol ::
  forall t. (SupportedPrim t) => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol :: forall t. SupportedPrim t => Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol = PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict
{-# INLINE typedAnySymbol #-}

{-# NOINLINE typedAnySymbol' #-}
typedAnySymbol' ::
  forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' :: forall t. PhantomDict t -> Symbol -> TypedSymbol 'AnyKind t
typedAnySymbol' PhantomDict t
PhantomDict Symbol
symbol = Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
symbol

-- | Constant symbol
type TypedConstantSymbol = TypedSymbol 'ConstantKind

-- | Any symbol
type TypedAnySymbol = TypedSymbol 'AnyKind

instance Eq (TypedSymbol knd t) where
  TypedSymbol Symbol
x == :: TypedSymbol knd t -> TypedSymbol knd t -> Bool
== TypedSymbol Symbol
y = Symbol
x Symbol -> Symbol -> Bool
forall a. Eq a => a -> a -> Bool
== Symbol
y

instance Ord (TypedSymbol knd t) where
  TypedSymbol Symbol
x <= :: TypedSymbol knd t -> TypedSymbol knd t -> Bool
<= TypedSymbol Symbol
y = Symbol
x Symbol -> Symbol -> Bool
forall a. Ord a => a -> a -> Bool
<= Symbol
y

instance Lift (TypedSymbol knd t) where
  liftTyped :: forall (m :: * -> *).
Quote m =>
TypedSymbol knd t -> Code m (TypedSymbol knd t)
liftTyped (TypedSymbol Symbol
x) = [||Symbol -> TypedSymbol knd t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
x||]

instance Show (TypedSymbol knd t) where
  show :: TypedSymbol knd t -> String
show (TypedSymbol Symbol
symbol) = Symbol -> String
forall a. Show a => a -> String
show Symbol
symbol String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" :: " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep t -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @t)

-- | Show a typed symbol without the type information.
showUntyped :: TypedSymbol knd t -> String
showUntyped :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> String
showUntyped (TypedSymbol Symbol
symbol) = Symbol -> String
forall a. Show a => a -> String
show Symbol
symbol

instance Hashable (TypedSymbol knd t) where
  Int
s hashWithSalt :: Int -> TypedSymbol knd t -> Int
`hashWithSalt` TypedSymbol Symbol
x = Int
s Int -> Symbol -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Symbol
x

instance NFData (TypedSymbol knd t) where
  rnf :: TypedSymbol knd t -> ()
rnf (TypedSymbol Symbol
str) = Symbol -> ()
forall a. NFData a => a -> ()
rnf Symbol
str

instance
  ( SupportedPrim t,
    SymbolKindConstraint knd t,
    IsSymbolKind knd
  ) =>
  IsString (TypedSymbol knd t)
  where
  fromString :: String -> TypedSymbol knd t
fromString = Symbol -> TypedSymbol knd t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol knd t)
-> (String -> Symbol) -> String -> TypedSymbol knd t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> Symbol
forall a. IsString a => String -> a
fromString

-- | Introduce the 'SupportedPrim' constraint from the t'TypedSymbol'.
withSymbolSupported ::
  forall knd t a.
  TypedSymbol knd t ->
  ((SupportedPrim t, Typeable t) => a) ->
  a
withSymbolSupported :: forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported (TypedSymbol Symbol
_) (SupportedPrim t, Typeable t) => a
a =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @t ((Typeable t => a) -> a) -> (Typeable t => a) -> a
forall a b. (a -> b) -> a -> b
$ a
Typeable t => a
(SupportedPrim t, Typeable t) => a
a
{-# INLINE withSymbolSupported #-}

-- | Introduce the 'SupportedPrim' constraint from the t'TypedSymbol'.
withConstantSymbolSupported ::
  forall t a.
  TypedSymbol 'ConstantKind t ->
  ((SupportedNonFuncPrim t, Typeable t) => a) ->
  a
withConstantSymbolSupported :: forall t a.
TypedSymbol 'ConstantKind t
-> ((SupportedNonFuncPrim t, Typeable t) => a) -> a
withConstantSymbolSupported (TypedSymbol Symbol
_) (SupportedNonFuncPrim t, Typeable t) => a
a =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @t ((Typeable t => a) -> a) -> (Typeable t => a) -> a
forall a b. (a -> b) -> a -> b
$ a
Typeable t => a
(SupportedNonFuncPrim t, Typeable t) => a
a
{-# INLINE withConstantSymbolSupported #-}

-- | Introduce the 'IsSymbolKind' constraint from the t'TypedSymbol'.
withSymbolKind :: TypedSymbol knd t -> ((IsSymbolKind knd) => a) -> a
withSymbolKind :: forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> (IsSymbolKind knd => a) -> a
withSymbolKind (TypedSymbol Symbol
_) IsSymbolKind knd => a
a = a
IsSymbolKind knd => a
a
{-# INLINE withSymbolKind #-}

-- | A non-indexed symbol. Type information are checked at runtime.
data SomeTypedSymbol knd where
  SomeTypedSymbol ::
    forall knd t.
    TypedSymbol knd t ->
    SomeTypedSymbol knd

-- | Non-indexed constant symbol
type SomeTypedConstantSymbol = SomeTypedSymbol 'ConstantKind

-- | Non-indexed any symbol
type SomeTypedAnySymbol = SomeTypedSymbol 'AnyKind

instance NFData (SomeTypedSymbol knd) where
  rnf :: SomeTypedSymbol knd -> ()
rnf (SomeTypedSymbol TypedSymbol knd t
s) = TypedSymbol knd t -> ()
forall a. NFData a => a -> ()
rnf TypedSymbol knd t
s
  {-# INLINE rnf #-}

instance Lift (SomeTypedSymbol knd) where
  liftTyped :: forall (m :: * -> *).
Quote m =>
SomeTypedSymbol knd -> Code m (SomeTypedSymbol knd)
liftTyped (SomeTypedSymbol TypedSymbol knd t
s) = [||TypedSymbol knd t -> SomeTypedSymbol knd
forall (knd :: SymbolKind) a.
TypedSymbol knd a -> SomeTypedSymbol knd
SomeTypedSymbol TypedSymbol knd t
s||]

instance Eq (SomeTypedSymbol knd) where
  (SomeTypedSymbol (TypedSymbol knd t
s1 :: TypedSymbol knd a))
    == :: SomeTypedSymbol knd -> SomeTypedSymbol knd -> Bool
== (SomeTypedSymbol (TypedSymbol knd t
s2 :: TypedSymbol knd b)) =
      TypedSymbol knd t
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported TypedSymbol knd t
s1 (((SupportedPrim t, Typeable t) => Bool) -> Bool)
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
        TypedSymbol knd t
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported TypedSymbol knd t
s2 (((SupportedPrim t, Typeable t) => Bool) -> Bool)
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
          case TypeRep t -> TypeRep t -> Maybe (t :~~: t)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @a) (forall t. SupportedPrim t => TypeRep t
primTypeRep @b) of
            Just t :~~: t
HRefl -> TypedSymbol knd t
s1 TypedSymbol knd t -> TypedSymbol knd t -> Bool
forall a. Eq a => a -> a -> Bool
== TypedSymbol knd t
TypedSymbol knd t
s2
            Maybe (t :~~: t)
_ -> Bool
False
  {-# INLINE (==) #-}

instance Ord (SomeTypedSymbol knd) where
  (SomeTypedSymbol (TypedSymbol knd t
s1 :: TypedSymbol knd a))
    <= :: SomeTypedSymbol knd -> SomeTypedSymbol knd -> Bool
<= (SomeTypedSymbol (TypedSymbol knd t
s2 :: TypedSymbol knd b)) =
      TypedSymbol knd t
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported TypedSymbol knd t
s1 (((SupportedPrim t, Typeable t) => Bool) -> Bool)
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
        TypedSymbol knd t
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported TypedSymbol knd t
s2 (((SupportedPrim t, Typeable t) => Bool) -> Bool)
-> ((SupportedPrim t, Typeable t) => Bool) -> Bool
forall a b. (a -> b) -> a -> b
$
          let t1 :: TypeRep t
t1 = forall t. SupportedPrim t => TypeRep t
primTypeRep @a
              t2 :: TypeRep t
t2 = forall t. SupportedPrim t => TypeRep t
primTypeRep @b
           in TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep TypeRep t
t1 SomeTypeRep -> SomeTypeRep -> Bool
forall a. Ord a => a -> a -> Bool
< TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep TypeRep t
t2
                Bool -> Bool -> Bool
|| ( case TypeRep t -> TypeRep t -> Maybe (t :~~: t)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep TypeRep t
t1 TypeRep t
t2 of
                       Just t :~~: t
HRefl -> TypedSymbol knd t
s1 TypedSymbol knd t -> TypedSymbol knd t -> Bool
forall a. Ord a => a -> a -> Bool
<= TypedSymbol knd t
TypedSymbol knd t
s2
                       Maybe (t :~~: t)
_ -> Bool
False
                   )

instance Hashable (SomeTypedSymbol knd) where
  hashWithSalt :: Int -> SomeTypedSymbol knd -> Int
hashWithSalt Int
s (SomeTypedSymbol TypedSymbol knd t
s1) = Int
s Int -> TypedSymbol knd t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol knd t
s1
  {-# INLINE hashWithSalt #-}

instance Show (SomeTypedSymbol knd) where
  show :: SomeTypedSymbol knd -> String
show (SomeTypedSymbol TypedSymbol knd t
s) = TypedSymbol knd t -> String
forall a. Show a => a -> String
show TypedSymbol knd t
s

-- | Construct a t'SomeTypedSymbol' from a t'TypedSymbol'.
someTypedSymbol :: forall knd t. TypedSymbol knd t -> SomeTypedSymbol knd
someTypedSymbol :: forall (knd :: SymbolKind) a.
TypedSymbol knd a -> SomeTypedSymbol knd
someTypedSymbol s :: TypedSymbol knd t
s@(TypedSymbol Symbol
_) = TypedSymbol knd t -> SomeTypedSymbol knd
forall (knd :: SymbolKind) a.
TypedSymbol knd a -> SomeTypedSymbol knd
SomeTypedSymbol TypedSymbol knd t
s
{-# INLINE someTypedSymbol #-}

-- Terms

-- | Traits for IEEE floating point numbers.
data FPTrait
  = FPIsNaN
  | FPIsPositive
  | FPIsNegative
  | FPIsPositiveInfinite
  | FPIsNegativeInfinite
  | FPIsInfinite
  | FPIsPositiveZero
  | FPIsNegativeZero
  | FPIsZero
  | FPIsNormal
  | FPIsSubnormal
  | FPIsPoint
  deriving (FPTrait -> FPTrait -> Bool
(FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool) -> Eq FPTrait
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPTrait -> FPTrait -> Bool
== :: FPTrait -> FPTrait -> Bool
$c/= :: FPTrait -> FPTrait -> Bool
/= :: FPTrait -> FPTrait -> Bool
Eq, Eq FPTrait
Eq FPTrait =>
(FPTrait -> FPTrait -> Ordering)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> Bool)
-> (FPTrait -> FPTrait -> FPTrait)
-> (FPTrait -> FPTrait -> FPTrait)
-> Ord FPTrait
FPTrait -> FPTrait -> Bool
FPTrait -> FPTrait -> Ordering
FPTrait -> FPTrait -> FPTrait
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPTrait -> FPTrait -> Ordering
compare :: FPTrait -> FPTrait -> Ordering
$c< :: FPTrait -> FPTrait -> Bool
< :: FPTrait -> FPTrait -> Bool
$c<= :: FPTrait -> FPTrait -> Bool
<= :: FPTrait -> FPTrait -> Bool
$c> :: FPTrait -> FPTrait -> Bool
> :: FPTrait -> FPTrait -> Bool
$c>= :: FPTrait -> FPTrait -> Bool
>= :: FPTrait -> FPTrait -> Bool
$cmax :: FPTrait -> FPTrait -> FPTrait
max :: FPTrait -> FPTrait -> FPTrait
$cmin :: FPTrait -> FPTrait -> FPTrait
min :: FPTrait -> FPTrait -> FPTrait
Ord, (forall x. FPTrait -> Rep FPTrait x)
-> (forall x. Rep FPTrait x -> FPTrait) -> Generic FPTrait
forall x. Rep FPTrait x -> FPTrait
forall x. FPTrait -> Rep FPTrait x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPTrait -> Rep FPTrait x
from :: forall x. FPTrait -> Rep FPTrait x
$cto :: forall x. Rep FPTrait x -> FPTrait
to :: forall x. Rep FPTrait x -> FPTrait
Generic, Eq FPTrait
Eq FPTrait =>
(Int -> FPTrait -> Int) -> (FPTrait -> Int) -> Hashable FPTrait
Int -> FPTrait -> Int
FPTrait -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPTrait -> Int
hashWithSalt :: Int -> FPTrait -> Int
$chash :: FPTrait -> Int
hash :: FPTrait -> Int
Hashable, (forall (m :: * -> *). Quote m => FPTrait -> m Exp)
-> (forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait)
-> Lift FPTrait
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPTrait -> m Exp
forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
$clift :: forall (m :: * -> *). Quote m => FPTrait -> m Exp
lift :: forall (m :: * -> *). Quote m => FPTrait -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
liftTyped :: forall (m :: * -> *). Quote m => FPTrait -> Code m FPTrait
Lift, FPTrait -> ()
(FPTrait -> ()) -> NFData FPTrait
forall a. (a -> ()) -> NFData a
$crnf :: FPTrait -> ()
rnf :: FPTrait -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPTrait -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPTrait)
-> Serial FPTrait
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPTrait
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPTrait -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPTrait
deserialize :: forall (m :: * -> *). MonadGet m => m FPTrait
Serial)

instance Cereal.Serialize FPTrait where
  put :: Putter FPTrait
put = Putter FPTrait
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize
  get :: Get FPTrait
get = Get FPTrait
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPTrait
deserialize

instance Binary.Binary FPTrait where
  put :: FPTrait -> Put
put = FPTrait -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPTrait -> m ()
serialize
  get :: Get FPTrait
get = Get FPTrait
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPTrait
deserialize

instance Show FPTrait where
  show :: FPTrait -> String
show FPTrait
FPIsNaN = String
"is_nan"
  show FPTrait
FPIsPositive = String
"is_pos"
  show FPTrait
FPIsNegative = String
"is_neg"
  show FPTrait
FPIsPositiveInfinite = String
"is_pos_inf"
  show FPTrait
FPIsNegativeInfinite = String
"is_neg_inf"
  show FPTrait
FPIsInfinite = String
"is_inf"
  show FPTrait
FPIsPositiveZero = String
"is_pos_zero"
  show FPTrait
FPIsNegativeZero = String
"is_neg_zero"
  show FPTrait
FPIsZero = String
"is_zero"
  show FPTrait
FPIsNormal = String
"is_normal"
  show FPTrait
FPIsSubnormal = String
"is_subnormal"
  show FPTrait
FPIsPoint = String
"is_point"

-- | Unary floating point operations.
data FPUnaryOp = FPAbs | FPNeg
  deriving (FPUnaryOp -> FPUnaryOp -> Bool
(FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool) -> Eq FPUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPUnaryOp -> FPUnaryOp -> Bool
== :: FPUnaryOp -> FPUnaryOp -> Bool
$c/= :: FPUnaryOp -> FPUnaryOp -> Bool
/= :: FPUnaryOp -> FPUnaryOp -> Bool
Eq, Eq FPUnaryOp
Eq FPUnaryOp =>
(FPUnaryOp -> FPUnaryOp -> Ordering)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> Bool)
-> (FPUnaryOp -> FPUnaryOp -> FPUnaryOp)
-> (FPUnaryOp -> FPUnaryOp -> FPUnaryOp)
-> Ord FPUnaryOp
FPUnaryOp -> FPUnaryOp -> Bool
FPUnaryOp -> FPUnaryOp -> Ordering
FPUnaryOp -> FPUnaryOp -> FPUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPUnaryOp -> FPUnaryOp -> Ordering
compare :: FPUnaryOp -> FPUnaryOp -> Ordering
$c< :: FPUnaryOp -> FPUnaryOp -> Bool
< :: FPUnaryOp -> FPUnaryOp -> Bool
$c<= :: FPUnaryOp -> FPUnaryOp -> Bool
<= :: FPUnaryOp -> FPUnaryOp -> Bool
$c> :: FPUnaryOp -> FPUnaryOp -> Bool
> :: FPUnaryOp -> FPUnaryOp -> Bool
$c>= :: FPUnaryOp -> FPUnaryOp -> Bool
>= :: FPUnaryOp -> FPUnaryOp -> Bool
$cmax :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
max :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
$cmin :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
min :: FPUnaryOp -> FPUnaryOp -> FPUnaryOp
Ord, (forall x. FPUnaryOp -> Rep FPUnaryOp x)
-> (forall x. Rep FPUnaryOp x -> FPUnaryOp) -> Generic FPUnaryOp
forall x. Rep FPUnaryOp x -> FPUnaryOp
forall x. FPUnaryOp -> Rep FPUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPUnaryOp -> Rep FPUnaryOp x
from :: forall x. FPUnaryOp -> Rep FPUnaryOp x
$cto :: forall x. Rep FPUnaryOp x -> FPUnaryOp
to :: forall x. Rep FPUnaryOp x -> FPUnaryOp
Generic, Eq FPUnaryOp
Eq FPUnaryOp =>
(Int -> FPUnaryOp -> Int)
-> (FPUnaryOp -> Int) -> Hashable FPUnaryOp
Int -> FPUnaryOp -> Int
FPUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPUnaryOp -> Int
hashWithSalt :: Int -> FPUnaryOp -> Int
$chash :: FPUnaryOp -> Int
hash :: FPUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp)
-> (forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp)
-> Lift FPUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
$clift :: forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
liftTyped :: forall (m :: * -> *). Quote m => FPUnaryOp -> Code m FPUnaryOp
Lift, FPUnaryOp -> ()
(FPUnaryOp -> ()) -> NFData FPUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPUnaryOp -> ()
rnf :: FPUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPUnaryOp)
-> Serial FPUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPUnaryOp
Serial)

instance Cereal.Serialize FPUnaryOp where
  put :: Putter FPUnaryOp
put = Putter FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize
  get :: Get FPUnaryOp
get = Get FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize

instance Binary.Binary FPUnaryOp where
  put :: FPUnaryOp -> Put
put = FPUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPUnaryOp -> m ()
serialize
  get :: Get FPUnaryOp
get = Get FPUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPUnaryOp
deserialize

instance Show FPUnaryOp where
  show :: FPUnaryOp -> String
show FPUnaryOp
FPAbs = String
"fp.abs"
  show FPUnaryOp
FPNeg = String
"fp.neg"

-- | Binary floating point operations.
data FPBinaryOp
  = FPRem
  | FPMinimum
  | FPMinimumNumber
  | FPMaximum
  | FPMaximumNumber
  deriving (FPBinaryOp -> FPBinaryOp -> Bool
(FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool) -> Eq FPBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPBinaryOp -> FPBinaryOp -> Bool
== :: FPBinaryOp -> FPBinaryOp -> Bool
$c/= :: FPBinaryOp -> FPBinaryOp -> Bool
/= :: FPBinaryOp -> FPBinaryOp -> Bool
Eq, Eq FPBinaryOp
Eq FPBinaryOp =>
(FPBinaryOp -> FPBinaryOp -> Ordering)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> Bool)
-> (FPBinaryOp -> FPBinaryOp -> FPBinaryOp)
-> (FPBinaryOp -> FPBinaryOp -> FPBinaryOp)
-> Ord FPBinaryOp
FPBinaryOp -> FPBinaryOp -> Bool
FPBinaryOp -> FPBinaryOp -> Ordering
FPBinaryOp -> FPBinaryOp -> FPBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPBinaryOp -> FPBinaryOp -> Ordering
compare :: FPBinaryOp -> FPBinaryOp -> Ordering
$c< :: FPBinaryOp -> FPBinaryOp -> Bool
< :: FPBinaryOp -> FPBinaryOp -> Bool
$c<= :: FPBinaryOp -> FPBinaryOp -> Bool
<= :: FPBinaryOp -> FPBinaryOp -> Bool
$c> :: FPBinaryOp -> FPBinaryOp -> Bool
> :: FPBinaryOp -> FPBinaryOp -> Bool
$c>= :: FPBinaryOp -> FPBinaryOp -> Bool
>= :: FPBinaryOp -> FPBinaryOp -> Bool
$cmax :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
max :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
$cmin :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
min :: FPBinaryOp -> FPBinaryOp -> FPBinaryOp
Ord, (forall x. FPBinaryOp -> Rep FPBinaryOp x)
-> (forall x. Rep FPBinaryOp x -> FPBinaryOp) -> Generic FPBinaryOp
forall x. Rep FPBinaryOp x -> FPBinaryOp
forall x. FPBinaryOp -> Rep FPBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPBinaryOp -> Rep FPBinaryOp x
from :: forall x. FPBinaryOp -> Rep FPBinaryOp x
$cto :: forall x. Rep FPBinaryOp x -> FPBinaryOp
to :: forall x. Rep FPBinaryOp x -> FPBinaryOp
Generic, Eq FPBinaryOp
Eq FPBinaryOp =>
(Int -> FPBinaryOp -> Int)
-> (FPBinaryOp -> Int) -> Hashable FPBinaryOp
Int -> FPBinaryOp -> Int
FPBinaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPBinaryOp -> Int
hashWithSalt :: Int -> FPBinaryOp -> Int
$chash :: FPBinaryOp -> Int
hash :: FPBinaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    FPBinaryOp -> Code m FPBinaryOp)
-> Lift FPBinaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
$clift :: forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPBinaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
liftTyped :: forall (m :: * -> *). Quote m => FPBinaryOp -> Code m FPBinaryOp
Lift, FPBinaryOp -> ()
(FPBinaryOp -> ()) -> NFData FPBinaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPBinaryOp -> ()
rnf :: FPBinaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPBinaryOp)
-> Serial FPBinaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPBinaryOp
Serial)

instance Cereal.Serialize FPBinaryOp where
  put :: Putter FPBinaryOp
put = Putter FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize
  get :: Get FPBinaryOp
get = Get FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize

instance Binary.Binary FPBinaryOp where
  put :: FPBinaryOp -> Put
put = FPBinaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPBinaryOp -> m ()
serialize
  get :: Get FPBinaryOp
get = Get FPBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPBinaryOp
deserialize

instance Show FPBinaryOp where
  show :: FPBinaryOp -> String
show FPBinaryOp
FPRem = String
"fp.rem"
  show FPBinaryOp
FPMinimum = String
"fp.minimum"
  show FPBinaryOp
FPMinimumNumber = String
"fp.minimumNumber"
  show FPBinaryOp
FPMaximum = String
"fp.maximum"
  show FPBinaryOp
FPMaximumNumber = String
"fp.maximumNumber"

-- | Unary floating point operations with rounding modes.
data FPRoundingUnaryOp = FPSqrt | FPRoundToIntegral
  deriving (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
(FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> Eq FPRoundingUnaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
== :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c/= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
/= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
Eq, Eq FPRoundingUnaryOp
Eq FPRoundingUnaryOp =>
(FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp)
-> (FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp)
-> Ord FPRoundingUnaryOp
FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
compare :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Ordering
$c< :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
< :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c<= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
<= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c> :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
> :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$c>= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
>= :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
$cmax :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
max :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
$cmin :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
min :: FPRoundingUnaryOp -> FPRoundingUnaryOp -> FPRoundingUnaryOp
Ord, (forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x)
-> (forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp)
-> Generic FPRoundingUnaryOp
forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
from :: forall x. FPRoundingUnaryOp -> Rep FPRoundingUnaryOp x
$cto :: forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
to :: forall x. Rep FPRoundingUnaryOp x -> FPRoundingUnaryOp
Generic, Eq FPRoundingUnaryOp
Eq FPRoundingUnaryOp =>
(Int -> FPRoundingUnaryOp -> Int)
-> (FPRoundingUnaryOp -> Int) -> Hashable FPRoundingUnaryOp
Int -> FPRoundingUnaryOp -> Int
FPRoundingUnaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPRoundingUnaryOp -> Int
hashWithSalt :: Int -> FPRoundingUnaryOp -> Int
$chash :: FPRoundingUnaryOp -> Int
hash :: FPRoundingUnaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    FPRoundingUnaryOp -> Code m FPRoundingUnaryOp)
-> Lift FPRoundingUnaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
$clift :: forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPRoundingUnaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingUnaryOp -> Code m FPRoundingUnaryOp
Lift, FPRoundingUnaryOp -> ()
(FPRoundingUnaryOp -> ()) -> NFData FPRoundingUnaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPRoundingUnaryOp -> ()
rnf :: FPRoundingUnaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp)
-> Serial FPRoundingUnaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
Serial)

instance Cereal.Serialize FPRoundingUnaryOp where
  put :: Putter FPRoundingUnaryOp
put = Putter FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize
  get :: Get FPRoundingUnaryOp
get = Get FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize

instance Binary.Binary FPRoundingUnaryOp where
  put :: FPRoundingUnaryOp -> Put
put = FPRoundingUnaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingUnaryOp -> m ()
serialize
  get :: Get FPRoundingUnaryOp
get = Get FPRoundingUnaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingUnaryOp
deserialize

instance Show FPRoundingUnaryOp where
  show :: FPRoundingUnaryOp -> String
show FPRoundingUnaryOp
FPSqrt = String
"fp.sqrt"
  show FPRoundingUnaryOp
FPRoundToIntegral = String
"fp.roundToIntegral"

-- | Binary floating point operations with rounding modes.
data FPRoundingBinaryOp = FPAdd | FPSub | FPMul | FPDiv
  deriving (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
(FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> Eq FPRoundingBinaryOp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
== :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c/= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
/= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
Eq, Eq FPRoundingBinaryOp
Eq FPRoundingBinaryOp =>
(FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp)
-> (FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp)
-> Ord FPRoundingBinaryOp
FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
forall a.
Eq a =>
(a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
compare :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Ordering
$c< :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
< :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c<= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
<= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c> :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
> :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$c>= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
>= :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
$cmax :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
max :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
$cmin :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
min :: FPRoundingBinaryOp -> FPRoundingBinaryOp -> FPRoundingBinaryOp
Ord, (forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x)
-> (forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp)
-> Generic FPRoundingBinaryOp
forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
from :: forall x. FPRoundingBinaryOp -> Rep FPRoundingBinaryOp x
$cto :: forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
to :: forall x. Rep FPRoundingBinaryOp x -> FPRoundingBinaryOp
Generic, Eq FPRoundingBinaryOp
Eq FPRoundingBinaryOp =>
(Int -> FPRoundingBinaryOp -> Int)
-> (FPRoundingBinaryOp -> Int) -> Hashable FPRoundingBinaryOp
Int -> FPRoundingBinaryOp -> Int
FPRoundingBinaryOp -> Int
forall a. Eq a => (Int -> a -> Int) -> (a -> Int) -> Hashable a
$chashWithSalt :: Int -> FPRoundingBinaryOp -> Int
hashWithSalt :: Int -> FPRoundingBinaryOp -> Int
$chash :: FPRoundingBinaryOp -> Int
hash :: FPRoundingBinaryOp -> Int
Hashable, (forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp)
-> (forall (m :: * -> *).
    Quote m =>
    FPRoundingBinaryOp -> Code m FPRoundingBinaryOp)
-> Lift FPRoundingBinaryOp
forall t.
(forall (m :: * -> *). Quote m => t -> m Exp)
-> (forall (m :: * -> *). Quote m => t -> Code m t) -> Lift t
forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
$clift :: forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
lift :: forall (m :: * -> *). Quote m => FPRoundingBinaryOp -> m Exp
$cliftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
liftTyped :: forall (m :: * -> *).
Quote m =>
FPRoundingBinaryOp -> Code m FPRoundingBinaryOp
Lift, FPRoundingBinaryOp -> ()
(FPRoundingBinaryOp -> ()) -> NFData FPRoundingBinaryOp
forall a. (a -> ()) -> NFData a
$crnf :: FPRoundingBinaryOp -> ()
rnf :: FPRoundingBinaryOp -> ()
NFData, (forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ())
-> (forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp)
-> Serial FPRoundingBinaryOp
forall a.
(forall (m :: * -> *). MonadPut m => a -> m ())
-> (forall (m :: * -> *). MonadGet m => m a) -> Serial a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
$cserialize :: forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize :: forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
$cdeserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize :: forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
Serial)

instance Cereal.Serialize FPRoundingBinaryOp where
  put :: Putter FPRoundingBinaryOp
put = Putter FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize
  get :: Get FPRoundingBinaryOp
get = Get FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize

instance Binary.Binary FPRoundingBinaryOp where
  put :: FPRoundingBinaryOp -> Put
put = FPRoundingBinaryOp -> Put
forall a (m :: * -> *). (Serial a, MonadPut m) => a -> m ()
forall (m :: * -> *). MonadPut m => FPRoundingBinaryOp -> m ()
serialize
  get :: Get FPRoundingBinaryOp
get = Get FPRoundingBinaryOp
forall a (m :: * -> *). (Serial a, MonadGet m) => m a
forall (m :: * -> *). MonadGet m => m FPRoundingBinaryOp
deserialize

instance Show FPRoundingBinaryOp where
  show :: FPRoundingBinaryOp -> String
show FPRoundingBinaryOp
FPAdd = String
"fp.add"
  show FPRoundingBinaryOp
FPSub = String
"fp.sub"
  show FPRoundingBinaryOp
FPMul = String
"fp.mul"
  show FPRoundingBinaryOp
FPDiv = String
"fp.div"

-- | Internal representation for Grisette symbolic terms.
data Term t where
  ConTerm ::
    (SupportedPrim t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !t ->
    Term t
  SymTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(TypedSymbol 'AnyKind t) ->
    Term t
  ForallTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(TypedSymbol 'ConstantKind t) ->
    !(Term Bool) ->
    Term Bool
  ExistsTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(TypedSymbol 'ConstantKind t) ->
    !(Term Bool) ->
    Term Bool
  NotTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term Bool) ->
    Term Bool
  OrTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term Bool) ->
    !(Term Bool) ->
    Term Bool
  AndTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term Bool) ->
    !(Term Bool) ->
    Term Bool
  EqTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term Bool
  DistinctTerm ::
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(NonEmpty (Term t)) ->
    Term Bool
  ITETerm ::
    (SupportedPrim t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term Bool) ->
    !(Term t) ->
    !(Term t) ->
    Term t
  AddNumTerm ::
    (SupportedPrim t, PEvalNumTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  NegNumTerm ::
    (SupportedPrim t, PEvalNumTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    Term t
  MulNumTerm ::
    (SupportedPrim t, PEvalNumTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  AbsNumTerm ::
    (SupportedPrim t, PEvalNumTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    Term t
  SignumNumTerm ::
    (SupportedPrim t, PEvalNumTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    Term t
  LtOrdTerm ::
    (SupportedPrim t, PEvalOrdTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term Bool
  LeOrdTerm ::
    (SupportedPrim t, PEvalOrdTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term Bool
  AndBitsTerm ::
    (SupportedPrim t, PEvalBitwiseTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  OrBitsTerm ::
    (SupportedPrim t, PEvalBitwiseTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  XorBitsTerm ::
    (SupportedPrim t, PEvalBitwiseTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  ComplementBitsTerm ::
    (SupportedPrim t, PEvalBitwiseTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    Term t
  ShiftLeftTerm ::
    (SupportedPrim t, PEvalShiftTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  ShiftRightTerm ::
    (SupportedPrim t, PEvalShiftTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  RotateLeftTerm ::
    (SupportedPrim t, PEvalRotateTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  RotateRightTerm ::
    (SupportedPrim t, PEvalRotateTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  BitCastTerm ::
    (SupportedPrim b, PEvalBitCastTerm a b) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term a) ->
    Term b
  BitCastOrTerm ::
    (SupportedPrim b, PEvalBitCastOrTerm a b) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term b) ->
    !(Term a) ->
    Term b
  BVConcatTerm ::
    ( PEvalBVTerm bv,
      KnownNat l,
      KnownNat r,
      KnownNat (l + r),
      1 <= l,
      1 <= r,
      1 <= l + r,
      SupportedPrim (bv (l + r))
    ) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term (bv l)) ->
    !(Term (bv r)) ->
    Term (bv (l + r))
  BVSelectTerm ::
    ( PEvalBVTerm bv,
      KnownNat n,
      KnownNat ix,
      KnownNat w,
      1 <= n,
      1 <= w,
      ix + w <= n,
      SupportedPrim (bv w)
    ) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Proxy ix) ->
    !(Proxy w) ->
    !(Term (bv n)) ->
    Term (bv w)
  BVExtendTerm ::
    ( PEvalBVTerm bv,
      KnownNat l,
      KnownNat r,
      1 <= l,
      1 <= r,
      l <= r,
      SupportedPrim (bv r)
    ) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !Bool ->
    !(Proxy r) ->
    !(Term (bv l)) ->
    Term (bv r)
  ApplyTerm ::
    (PEvalApplyTerm f a b, SupportedPrim b) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term f) ->
    !(Term a) ->
    Term b
  DivIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  ModIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  QuotIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  RemIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  FPTraitTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FPTrait ->
    !(Term (FP eb sb)) ->
    Term Bool
  FdivTerm ::
    (SupportedPrim t, PEvalFractionalTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  RecipTerm ::
    (SupportedPrim t, PEvalFractionalTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    Term t
  FloatingUnaryTerm ::
    (SupportedPrim t, PEvalFloatingTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FloatingUnaryOp ->
    !(Term t) ->
    Term t
  PowerTerm ::
    (SupportedPrim t, PEvalFloatingTerm t) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term t) ->
    !(Term t) ->
    Term t
  FPUnaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FPUnaryOp ->
    !(Term (FP eb sb)) ->
    Term (FP eb sb)
  FPBinaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FPBinaryOp ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    Term (FP eb sb)
  FPRoundingUnaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FPRoundingUnaryOp ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    Term (FP eb sb)
  FPRoundingBinaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !FPRoundingBinaryOp ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    Term (FP eb sb)
  FPFMATerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    Term (FP eb sb)
  FromIntegralTerm ::
    (PEvalFromIntegralTerm a b, SupportedPrim b) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term a) ->
    Term b
  FromFPOrTerm ::
    ( PEvalIEEEFPConvertibleTerm a,
      ValidFP eb sb,
      SupportedPrim a
    ) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term a) ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    Term a
  ToFPTerm ::
    ( PEvalIEEEFPConvertibleTerm a,
      ValidFP eb sb,
      SupportedPrim (FP eb sb)
    ) =>
    WeakThreadId ->
    {-# UNPACK #-} !Digest ->
    Id ->
    Ident ->
    !(Term FPRoundingMode) ->
    !(Term a) ->
    Proxy eb ->
    Proxy sb ->
    Term (FP eb sb)

-- | Pattern for term with dynamic typing.
pattern DynTerm :: forall a b. (SupportedPrim a) => Term a -> Term b
pattern $mDynTerm :: forall {r} {a} {b}.
SupportedPrim a =>
Term b -> (Term a -> r) -> ((# #) -> r) -> r
DynTerm x <-
  ( ( \Term b
v ->
        Term b
-> ((SupportedPrim b, Typeable b) => Maybe (Term a))
-> Maybe (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term b
v (((SupportedPrim b, Typeable b) => Maybe (Term a))
 -> Maybe (Term a))
-> ((SupportedPrim b, Typeable b) => Maybe (Term a))
-> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$
          forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @a ((Typeable a => Maybe (Term a)) -> Maybe (Term a))
-> (Typeable a => Maybe (Term a)) -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$
            Term b -> Maybe (Term a)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast Term b
v
    ) ->
      Just x
    )

-- | The identity of the term.
termIdent :: Term t -> Ident
termIdent :: forall t. Term t -> Ident
termIdent (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i t
_) = Ident
i
termIdent (SymTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i TypedSymbol 'AnyKind t
_) = Ident
i
termIdent (ForallTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i TypedSymbol 'ConstantKind t
_ Term Bool
_) = Ident
i
termIdent (ExistsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i TypedSymbol 'ConstantKind t
_ Term Bool
_) = Ident
i
termIdent (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term Bool
_) = Ident
i
termIdent (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term Bool
_ Term Bool
_) = Ident
i
termIdent (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term Bool
_ Term Bool
_) = Ident
i
termIdent (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i NonEmpty (Term t)
_) = Ident
i
termIdent (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term Bool
_ Term t
_ Term t
_) = Ident
i
termIdent (AddNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (NegNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_) = Ident
i
termIdent (MulNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (AbsNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_) = Ident
i
termIdent (SignumNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_) = Ident
i
termIdent (LtOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (LeOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (AndBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (OrBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (XorBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (ComplementBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_) = Ident
i
termIdent (ShiftLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (ShiftRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (RotateLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (RotateRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (BitCastTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term a
_) = Ident
i
termIdent (BitCastOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term a
_) = Ident
i
termIdent (BVConcatTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term (bv l)
_ Term (bv r)
_) = Ident
i
termIdent (BVSelectTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Proxy ix
_ Proxy w
_ Term (bv n)
_) = Ident
i
termIdent (BVExtendTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Bool
_ Proxy r
_ Term (bv l)
_) = Ident
i
termIdent (ApplyTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term f
_ Term a
_) = Ident
i
termIdent (DivIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (ModIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (QuotIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (RemIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (FPTraitTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FPTrait
_ Term (FP eb sb)
_) = Ident
i
termIdent (FdivTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (RecipTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_) = Ident
i
termIdent (FloatingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FloatingUnaryOp
_ Term t
_) = Ident
i
termIdent (PowerTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term t
_) = Ident
i
termIdent (FPUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FPUnaryOp
_ Term (FP eb sb)
_) = Ident
i
termIdent (FPBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FPBinaryOp
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Ident
i
termIdent (FPRoundingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FPRoundingUnaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = Ident
i
termIdent (FPRoundingBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i FPRoundingBinaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Ident
i
termIdent (FPFMATerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Ident
i
termIdent (FromIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term a
_) = Ident
i
termIdent (FromFPOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term t
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = Ident
i
termIdent (ToFPTerm WeakThreadId
_ Digest
_ Digest
_ Ident
i Term FPRoundingMode
_ Term a
_ Proxy eb
_ Proxy sb
_) = Ident
i
{-# INLINE termIdent #-}

-- | Return the ID of a term.
termId :: Term t -> Id
termId :: forall t. Term t -> Digest
termId Term t
t = case Term t -> HashId
forall t. Term t -> HashId
hashId Term t
t of
  HashId Digest
_ Digest
i -> Digest
i
{-# INLINE termId #-}

baseHash :: Term t -> Digest
baseHash :: forall t. Term t -> Digest
baseHash Term t
t = case Term t -> HashId
forall t. Term t -> HashId
hashId Term t
t of
  HashId Digest
h Digest
_ -> Digest
h
{-# INLINE baseHash #-}

data HashId = HashId {-# UNPACK #-} !Digest Id deriving (Int -> HashId -> String -> String
[HashId] -> String -> String
HashId -> String
(Int -> HashId -> String -> String)
-> (HashId -> String)
-> ([HashId] -> String -> String)
-> Show HashId
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> HashId -> String -> String
showsPrec :: Int -> HashId -> String -> String
$cshow :: HashId -> String
show :: HashId -> String
$cshowList :: [HashId] -> String -> String
showList :: [HashId] -> String -> String
Show)

instance Eq HashId where
  HashId Digest
_ Digest
l == :: HashId -> HashId -> Bool
== HashId Digest
_ Digest
r = Digest
l Digest -> Digest -> Bool
forall a. Eq a => a -> a -> Bool
== Digest
r
  {-# INLINE (==) #-}

instance Hashable HashId where
  hashWithSalt :: Int -> HashId -> Int
hashWithSalt Int
s (HashId Digest
i Digest
_) = Int -> Digest -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s Digest
i
  {-# INLINE hashWithSalt #-}

eqHashId :: HashId -> HashId -> Bool
eqHashId :: HashId -> HashId -> Bool
eqHashId = HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
(==)
{-# INLINE eqHashId #-}

data TypeHashId = TypeHashId {-# UNPACK #-} !Fingerprint {-# UNPACK #-} !HashId
  deriving (Int -> TypeHashId -> String -> String
[TypeHashId] -> String -> String
TypeHashId -> String
(Int -> TypeHashId -> String -> String)
-> (TypeHashId -> String)
-> ([TypeHashId] -> String -> String)
-> Show TypeHashId
forall a.
(Int -> a -> String -> String)
-> (a -> String) -> ([a] -> String -> String) -> Show a
$cshowsPrec :: Int -> TypeHashId -> String -> String
showsPrec :: Int -> TypeHashId -> String -> String
$cshow :: TypeHashId -> String
show :: TypeHashId -> String
$cshowList :: [TypeHashId] -> String -> String
showList :: [TypeHashId] -> String -> String
Show)

instance Eq TypeHashId where
  TypeHashId Fingerprint
l HashId
li == :: TypeHashId -> TypeHashId -> Bool
== TypeHashId Fingerprint
r HashId
ri = Fingerprint
l Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
r Bool -> Bool -> Bool
&& HashId
li HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
== HashId
ri
  {-# INLINE (==) #-}

instance Hashable TypeHashId where
  hashWithSalt :: Int -> TypeHashId -> Int
hashWithSalt Int
s (TypeHashId Fingerprint
tp HashId
i) = Int
s Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
i
  {-# INLINE hashWithSalt #-}

hashId :: Term t -> HashId
hashId :: forall t. Term t -> HashId
hashId Term t
t = case Term t -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term t
t of
  TypeHashId Fingerprint
_ HashId
hi -> HashId
hi
{-# INLINE hashId #-}

typeFingerprint :: forall t. (SupportedPrim t) => Fingerprint
typeFingerprint :: forall t. SupportedPrim t => Fingerprint
typeFingerprint = SomeTypeRep -> Fingerprint
typeRepFingerprint (SomeTypeRep -> Fingerprint) -> SomeTypeRep -> Fingerprint
forall a b. (a -> b) -> a -> b
$ TypeRep t -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep t -> SomeTypeRep) -> TypeRep t -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @t
{-# INLINE typeFingerprint #-}

-- | Return the ID and the type representation of a term.
typeHashId :: forall t. Term t -> TypeHashId
typeHashId :: forall t. Term t -> TypeHashId
typeHashId (ConTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (SymTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ TypedSymbol {}) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ForallTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ TypedSymbol 'ConstantKind t
_ Term Bool
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ExistsTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ TypedSymbol 'ConstantKind t
_ Term Bool
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (NotTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term Bool
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (OrTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term Bool
_ Term Bool
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (AndTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term Bool
_ Term Bool
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (EqTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (DistinctTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ NonEmpty (Term t)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ITETerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term Bool
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (AddNumTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (NegNumTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (MulNumTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (AbsNumTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (SignumNumTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (LtOrdTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (LeOrdTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (AndBitsTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (OrBitsTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (XorBitsTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ComplementBitsTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ShiftLeftTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ShiftRightTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (RotateLeftTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (RotateRightTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (BitCastTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term a
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (BitCastOrTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term a
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (BVConcatTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term (bv l)
_ Term (bv r)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (BVSelectTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Proxy ix
_ Proxy w
_ Term (bv n)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (BVExtendTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Bool
_ Proxy r
_ Term (bv l)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ApplyTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term f
_ Term a
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (DivIntegralTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ModIntegralTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (QuotIntegralTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (RemIntegralTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPTraitTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FPTrait
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FdivTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (RecipTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FloatingUnaryTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FloatingUnaryOp
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (PowerTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term t
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPUnaryTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FPUnaryOp
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPBinaryTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FPBinaryOp
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPRoundingUnaryTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FPRoundingUnaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPRoundingBinaryTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ FPRoundingBinaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FPFMATerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FromIntegralTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term a
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (FromFPOrTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term t
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i
typeHashId (ToFPTerm WeakThreadId
_ Digest
ha Digest
i Ident
_ Term FPRoundingMode
_ Term a
_ Proxy eb
_ Proxy sb
_) = Fingerprint -> HashId -> TypeHashId
TypeHashId (forall t. SupportedPrim t => Fingerprint
typeFingerprint @t) (HashId -> TypeHashId) -> HashId -> TypeHashId
forall a b. (a -> b) -> a -> b
$ Digest -> Digest -> HashId
HashId Digest
ha Digest
i

-- {-# NOINLINE typeHashId #-}

introSupportedPrimConstraint0 :: forall t a. Term t -> ((SupportedPrim t) => a) -> a
introSupportedPrimConstraint0 :: forall t a. Term t -> (SupportedPrim t => a) -> a
introSupportedPrimConstraint0 ConTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 (SymTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'AnyKind t
t) SupportedPrim t => a
x = TypedSymbol 'AnyKind t -> ((SupportedPrim t, Typeable t) => a) -> a
forall (knd :: SymbolKind) t a.
TypedSymbol knd t -> ((SupportedPrim t, Typeable t) => a) -> a
withSymbolSupported TypedSymbol 'AnyKind t
t a
SupportedPrim t => a
(SupportedPrim t, Typeable t) => a
x
introSupportedPrimConstraint0 ForallTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ExistsTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 NotTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 OrTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AndTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 EqTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 DistinctTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ITETerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AddNumTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 NegNumTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 MulNumTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AbsNumTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 SignumNumTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 LtOrdTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 LeOrdTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 AndBitsTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 OrBitsTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 XorBitsTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ComplementBitsTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ShiftLeftTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RotateLeftTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ShiftRightTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RotateRightTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BitCastTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BitCastOrTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVConcatTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVSelectTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 BVExtendTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ApplyTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 DivIntegralTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ModIntegralTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 QuotIntegralTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RemIntegralTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPTraitTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FdivTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 RecipTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FloatingUnaryTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 PowerTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPUnaryTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPBinaryTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPRoundingUnaryTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPRoundingBinaryTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FPFMATerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FromIntegralTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 FromFPOrTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x
introSupportedPrimConstraint0 ToFPTerm {} SupportedPrim t => a
x = a
SupportedPrim t => a
x

-- | Introduce the 'SupportedPrim' constraint from a term.
introSupportedPrimConstraint ::
  forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint :: forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
t (SupportedPrim t, Typeable t) => a
a =
  Term t -> (SupportedPrim t => a) -> a
forall t a. Term t -> (SupportedPrim t => a) -> a
introSupportedPrimConstraint0 Term t
t ((SupportedPrim t => a) -> a) -> (SupportedPrim t => a) -> a
forall a b. (a -> b) -> a -> b
$ forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @t ((Typeable t => a) -> a) -> (Typeable t => a) -> a
forall a b. (a -> b) -> a -> b
$ a
Typeable t => a
(SupportedPrim t, Typeable t) => a
a
{-# INLINE introSupportedPrimConstraint #-}

-- | Introduce the 'Typeable' constraint from 'SupportedPrim'.
withSupportedPrimTypeable ::
  forall a b. (SupportedPrim a) => ((Typeable a) => b) -> b
withSupportedPrimTypeable :: forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable = TypeRep a -> (Typeable a => b) -> b
forall k (a :: k) r. TypeRep a -> (Typeable a => r) -> r
withTypeable (forall t. SupportedPrim t => TypeRep t
primTypeRep @a)
{-# INLINE withSupportedPrimTypeable #-}

-- {-# INLINE introSupportedPrimConstraint #-}

-- | Pretty-print a term.
pformatTerm :: forall t. Term t -> String
pformatTerm :: forall t. Term t -> String
pformatTerm (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ t
t) = t -> String
forall t. SupportedPrim t => t -> String
pformatCon t
t
pformatTerm (SymTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'AnyKind t
sym) = TypedSymbol 'AnyKind t -> String
forall (knd :: SymbolKind) t. TypedSymbol knd t -> String
showUntyped TypedSymbol 'AnyKind t
sym
pformatTerm (ForallTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) = String
"(forall " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ExistsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) = String
"(exists " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg) = String
"(! " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg1 Term Bool
arg2) = String
"(|| " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg1 Term Bool
arg2) = String
"(&& " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(= " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ NonEmpty (Term t)
args) = String
"(distinct " String -> String -> String
forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords ((Term t -> String) -> [Term t] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Term t -> String
forall t. Term t -> String
pformatTerm ([Term t] -> [String]) -> [Term t] -> [String]
forall a b. (a -> b) -> a -> b
$ NonEmpty (Term t) -> [Term t]
forall a. NonEmpty a -> [a]
toList NonEmpty (Term t)
args) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
cond Term t
arg1 Term t
arg2) = String
"(ite " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall t. Term t -> String
pformatTerm Term Bool
cond String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AddNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(+ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (NegNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) = String
"(- " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (MulNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(* " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AbsNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) = String
"(abs " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (SignumNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) = String
"(signum " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (LtOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(< " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (LeOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(<= " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (AndBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(& " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (OrBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(| " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (XorBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(^ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ComplementBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) = String
"(~ " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ShiftLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) = String
"(shl " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ShiftRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) = String
"(shr " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RotateLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) = String
"(rotl " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RotateRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) = String
"(rotr " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
n String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BitCastTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
arg) = String
"(bitcast " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BitCastOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
d Term a
arg) = String
"(bitcast_or " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
d String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVConcatTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term (bv l)
arg1 Term (bv r)
arg2) = String
"(bvconcat " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall t. Term t -> String
pformatTerm Term (bv l)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv r) -> String
forall t. Term t -> String
pformatTerm Term (bv r)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVSelectTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Proxy ix
_ :: Proxy ix) (Proxy w
_ :: Proxy w) Term (bv n)
arg) =
  String
"(bvselect " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep ix -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @ix) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep w -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @w) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv n) -> String
forall t. Term t -> String
pformatTerm Term (bv n)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (BVExtendTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
signed (Proxy r
_ :: Proxy n) Term (bv l)
arg) =
  (if Bool
signed then String
"(bvsext " else String
"(bvzext ") String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep r -> String
forall a. Show a => a -> String
show (forall (a :: Natural). Typeable a => TypeRep a
forall {k} (a :: k). Typeable a => TypeRep a
typeRep @n) String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall t. Term t -> String
pformatTerm Term (bv l)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ApplyTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term f
func Term a
arg) = String
"(apply " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term f -> String
forall t. Term t -> String
pformatTerm Term f
func String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (DivIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(div " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ModIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(mod " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (QuotIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(quot " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RemIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(rem " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPTraitTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPTrait
trait Term (FP eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPTrait -> String
forall a. Show a => a -> String
show FPTrait
trait String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FdivTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(fdiv " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (RecipTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) = String
"(recip " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FloatingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FloatingUnaryOp
op Term t
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FloatingUnaryOp -> String
forall a. Show a => a -> String
show FloatingUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (PowerTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) = String
"(** " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPUnaryOp
op Term (FP eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPUnaryOp -> String
forall a. Show a => a -> String
show FPUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPBinaryOp -> String
forall a. Show a => a -> String
show FPBinaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPRoundingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg) = String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingUnaryOp -> String
forall a. Show a => a -> String
show FPRoundingUnaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPRoundingBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
  String
"(" String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingBinaryOp -> String
forall a. Show a => a -> String
show FPRoundingBinaryOp
op String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FPFMATerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3) =
  String
"(fp.fma " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
mode String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg1 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg2 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg3 String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FromIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
arg) = String
"(from_integral " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (FromFPOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg) = String
"(from_fp_or " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall t. Term t -> String
pformatTerm Term t
d String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
r String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall t. Term t -> String
pformatTerm Term (FP eb sb)
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"
pformatTerm (ToFPTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
r Term a
arg Proxy eb
_ Proxy sb
_) = String
"(to_fp " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall t. Term t -> String
pformatTerm Term FPRoundingMode
r String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
" " String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall t. Term t -> String
pformatTerm Term a
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
")"

-- {-# INLINE pformatTerm #-}

instance NFData (Term a) where
  rnf :: Term a -> ()
rnf Term a
i = Digest -> ()
forall a. NFData a => a -> ()
rnf (Term a -> Digest
forall t. Term t -> Digest
termId Term a
i) () -> () -> ()
forall a b. a -> b -> b
`seq` Ident -> ()
forall a. NFData a => a -> ()
rnf (Term a -> Ident
forall t. Term t -> Ident
termIdent Term a
i)
  {-# INLINE rnf #-}

instance Lift (Term t) where
  liftTyped :: forall (m :: * -> *). Quote m => Term t -> Code m (Term t)
liftTyped (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ t
v) = [||t -> Term t
forall t. SupportedPrim t => t -> Term t
conTerm t
v||]
  liftTyped (SymTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'AnyKind t
t) = [||TypedSymbol knd t -> Term t
forall (knd :: SymbolKind) t. TypedSymbol knd t -> Term t
symTerm TypedSymbol 'AnyKind t
t||]
  liftTyped (ForallTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
t1 Term Bool
t2) = [||TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forallTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2||]
  liftTyped (ExistsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
t1 Term Bool
t2) = [||TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
existsTerm TypedSymbol 'ConstantKind t
t1 Term Bool
t2||]
  liftTyped (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t) = [||Term Bool -> Term Bool
notTerm Term Bool
t||]
  liftTyped (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t1 Term Bool
t2) = [||Term Bool -> Term Bool -> Term Bool
orTerm Term Bool
t1 Term Bool
t2||]
  liftTyped (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t1 Term Bool
t2) = [||Term Bool -> Term Bool -> Term Bool
andTerm Term Bool
t1 Term Bool
t2||]
  liftTyped (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term t
t1 Term t
t2||]
  liftTyped (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ NonEmpty (Term t)
t) = [||NonEmpty (Term a) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term t)
t||]
  liftTyped (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t1 Term t
t2 Term t
t3) = [||Term Bool -> Term a -> Term a -> Term a
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
t1 Term t
t2 Term t
t3||]
  liftTyped (AddNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm Term t
t1 Term t
t2||]
  liftTyped (NegNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
negNumTerm Term t
t||]
  liftTyped (MulNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm Term t
t1 Term t
t2||]
  liftTyped (AbsNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
absNumTerm Term t
t||]
  liftTyped (SignumNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t) = [||Term a -> Term a
forall t. PEvalNumTerm t => Term t -> Term t
signumNumTerm Term t
t||]
  liftTyped (LtOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
ltOrdTerm Term t
t1 Term t
t2||]
  liftTyped (LeOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term Bool
forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
leOrdTerm Term t
t1 Term t
t2||]
  liftTyped (AndBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
andBitsTerm Term t
t1 Term t
t2||]
  liftTyped (OrBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
orBitsTerm Term t
t1 Term t
t2||]
  liftTyped (XorBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
xorBitsTerm Term t
t1 Term t
t2||]
  liftTyped (ComplementBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t) = [||Term a -> Term a
forall a. PEvalBitwiseTerm a => Term a -> Term a
complementBitsTerm Term t
t||]
  liftTyped (ShiftLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalShiftTerm a => Term a -> Term a -> Term a
shiftLeftTerm Term t
t1 Term t
t2||]
  liftTyped (ShiftRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalShiftTerm a => Term a -> Term a -> Term a
shiftRightTerm Term t
t1 Term t
t2||]
  liftTyped (RotateLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalRotateTerm a => Term a -> Term a -> Term a
rotateLeftTerm Term t
t1 Term t
t2||]
  liftTyped (RotateRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalRotateTerm a => Term a -> Term a -> Term a
rotateRightTerm Term t
t1 Term t
t2||]
  liftTyped (BitCastTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
t) = [||Term a -> Term b
forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm Term a
t||]
  liftTyped (BitCastOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term a
t2) = [||Term b -> Term a -> Term b
forall a b. PEvalBitCastOrTerm a b => Term b -> Term a -> Term b
bitCastOrTerm Term t
t1 Term a
t2||]
  liftTyped (BVConcatTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term (bv l)
t1 Term (bv r)
t2) = [||Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm Term (bv l)
t1 Term (bv r)
t2||]
  liftTyped (BVSelectTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Proxy ix
_ :: p ix) (Proxy w
_ :: q w) Term (bv n)
t3) =
    [||p ix -> q w -> Term (bv n) -> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
bvSelectTerm (forall (t :: k). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: k). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) Term (bv n)
t3||]
  liftTyped (BVExtendTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
b (Proxy r
_ :: p r) Term (bv l)
t2) =
    [||Bool -> proxy r -> Term (bv l) -> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
b (forall (t :: k). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
t2||]
  liftTyped (ApplyTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term f
t1 Term a
t2) = [||Term f -> Term a -> Term b
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> Term b
applyTerm Term f
t1 Term a
t2||]
  liftTyped (DivIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
divIntegralTerm Term t
t1 Term t
t2||]
  liftTyped (ModIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
modIntegralTerm Term t
t1 Term t
t2||]
  liftTyped (QuotIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
quotIntegralTerm Term t
t1 Term t
t2||]
  liftTyped (RemIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
remIntegralTerm Term t
t1 Term t
t2||]
  liftTyped (FPTraitTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPTrait
t1 Term (FP eb sb)
t2) = [||FPTrait -> Term (FP eb sb) -> Term Bool
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPTrait -> Term (FP eb sb) -> Term Bool
fpTraitTerm FPTrait
t1 Term (FP eb sb)
t2||]
  liftTyped (FdivTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalFractionalTerm a => Term a -> Term a -> Term a
fdivTerm Term t
t1 Term t
t2||]
  liftTyped (RecipTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t) = [||Term a -> Term a
forall a. PEvalFractionalTerm a => Term a -> Term a
recipTerm Term t
t||]
  liftTyped (FloatingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FloatingUnaryOp
t1 Term t
t2) = [||FloatingUnaryOp -> Term a -> Term a
forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> Term a
floatingUnaryTerm FloatingUnaryOp
t1 Term t
t2||]
  liftTyped (PowerTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term t
t2) = [||Term a -> Term a -> Term a
forall a. PEvalFloatingTerm a => Term a -> Term a -> Term a
powerTerm Term t
t1 Term t
t2||]
  liftTyped (FPUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPUnaryOp
t1 Term (FP eb sb)
t2) = [||FPUnaryOp -> Term (FP eb sb) -> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPUnaryOp -> Term (FP eb sb) -> Term (FP eb sb)
fpUnaryTerm FPUnaryOp
t1 Term (FP eb sb)
t2||]
  liftTyped (FPBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPBinaryOp
t1 Term (FP eb sb)
t2 Term (FP eb sb)
t3) = [||FPBinaryOp -> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPBinaryOp -> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
fpBinaryTerm FPBinaryOp
t1 Term (FP eb sb)
t2 Term (FP eb sb)
t3||]
  liftTyped (FPRoundingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingUnaryOp
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3) =
    [||FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> Term (FP eb sb)
fpRoundingUnaryTerm FPRoundingUnaryOp
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3||]
  liftTyped (FPRoundingBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingBinaryOp
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3 Term (FP eb sb)
t4) =
    [||FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
fpRoundingBinaryTerm FPRoundingBinaryOp
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3 Term (FP eb sb)
t4||]
  liftTyped (FPFMATerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
t1 Term (FP eb sb)
t2 Term (FP eb sb)
t3 Term (FP eb sb)
t4) = [||Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
fpFMATerm Term FPRoundingMode
t1 Term (FP eb sb)
t2 Term (FP eb sb)
t3 Term (FP eb sb)
t4||]
  liftTyped (FromIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
t) = [||Term a -> Term b
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> Term b
fromIntegralTerm Term a
t||]
  liftTyped (FromFPOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3) = [||Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
fromFPOrTerm Term t
t1 Term FPRoundingMode
t2 Term (FP eb sb)
t3||]
  liftTyped (ToFPTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
t1 Term a
t2 Proxy eb
_ Proxy sb
_) =
    [||Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
toFPTerm Term FPRoundingMode
t1 Term a
t2||]

instance Show (Term ty) where
  show :: Term ty -> String
show (ConTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ ty
v) =
    String
"ConTerm{tid=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", v=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ ty -> String
forall t. SupportedPrim t => t -> String
pformatCon ty
v String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (SymTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ name :: TypedSymbol 'AnyKind ty
name@TypedSymbol {}) =
    String
"SymTerm{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", name="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'AnyKind ty -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind ty
name
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", type="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypeRep ty -> String
forall a. Show a => a -> String
show (forall t. SupportedPrim t => TypeRep t
primTypeRep @ty)
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ForallTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
    String
"Forall{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", sym="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ExistsTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
    String
"Exists{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", sym="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ TypedSymbol 'ConstantKind t -> String
forall a. Show a => a -> String
show TypedSymbol 'ConstantKind t
sym
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (NotTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term Bool
arg) =
    String
"Not{tid=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg=" String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (OrTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term Bool
arg1 Term Bool
arg2) =
    String
"Or{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (AndTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term Bool
arg1 Term Bool
arg2) =
    String
"And{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (EqTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term t
arg1 Term t
arg2) =
    String
"Eqv{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (DistinctTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ NonEmpty (Term t)
args) =
    String
"Distinct{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", args="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ NonEmpty (Term t) -> String
forall a. Show a => a -> String
show NonEmpty (Term t)
args
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ITETerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term Bool
cond Term ty
l Term ty
r) =
    String
"ITE{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", cond="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term Bool -> String
forall a. Show a => a -> String
show Term Bool
cond
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", then="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
l
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", else="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
r
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (AddNumTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"AddNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (NegNumTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg) =
    String
"NegNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (MulNumTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"MulNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (AbsNumTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg) =
    String
"AbsNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (SignumNumTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg) =
    String
"SignumNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (LtOrdTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term t
arg1 Term t
arg2) =
    String
"LTNum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (LeOrdTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term t
arg1 Term t
arg2) =
    String
"LENum{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term t -> String
forall a. Show a => a -> String
show Term t
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (AndBitsTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"AndBits{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (OrBitsTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"OrBits{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (XorBitsTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"XorBits{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ComplementBitsTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg) =
    String
"ComplementBits{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ShiftLeftTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg Term ty
n) =
    String
"ShiftLeft{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ShiftRightTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg Term ty
n) =
    String
"ShiftRight{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (RotateLeftTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg Term ty
n) =
    String
"RotateLeft{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (RotateRightTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg Term ty
n) =
    String
"RotateRight{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
n
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (BitCastTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term a
arg) =
    String
"BitCast{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (BitCastOrTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
d Term a
arg) =
    String
"BitCastOr{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", default="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
d
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (BVConcatTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term (bv l)
arg1 Term (bv r)
arg2) =
    String
"BVConcat{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall a. Show a => a -> String
show Term (bv l)
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv r) -> String
forall a. Show a => a -> String
show Term (bv r)
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (BVSelectTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Proxy ix
ix Proxy w
w Term (bv n)
arg) =
    String
"BVSelect{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", ix="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Proxy ix -> String
forall a. Show a => a -> String
show Proxy ix
ix
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", w="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Proxy w -> String
forall a. Show a => a -> String
show Proxy w
w
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv n) -> String
forall a. Show a => a -> String
show Term (bv n)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (BVExtendTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Bool
signed Proxy r
n Term (bv l)
arg) =
    String
"BVExtend{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", signed="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Bool -> String
forall a. Show a => a -> String
show Bool
signed
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", n="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Proxy r -> String
forall a. Show a => a -> String
show Proxy r
n
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (bv l) -> String
forall a. Show a => a -> String
show Term (bv l)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ApplyTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term f
f Term a
arg) =
    String
"Apply{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", f="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term f -> String
forall a. Show a => a -> String
show Term f
f
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (DivIntegralTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"DivIntegral{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ModIntegralTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"ModIntegral{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (QuotIntegralTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"QuotIntegral{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (RemIntegralTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"RemIntegral{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPTraitTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FPTrait
trait Term (FP eb sb)
arg) =
    String
"FPTrait{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", trait="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPTrait -> String
forall a. Show a => a -> String
show FPTrait
trait
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FdivTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"Fdiv{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (RecipTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg) =
    String
"Recip{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FloatingUnaryTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FloatingUnaryOp
op Term ty
arg) =
    String
"FloatingUnary{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FloatingUnaryOp -> String
forall a. Show a => a -> String
show FloatingUnaryOp
op
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (PowerTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
arg1 Term ty
arg2) =
    String
"Power{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPUnaryTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FPUnaryOp
op Term (FP eb sb)
arg) =
    String
"FPUnary{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPUnaryOp -> String
forall a. Show a => a -> String
show FPUnaryOp
op
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPBinaryTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
    String
"FPBinary{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPBinaryOp -> String
forall a. Show a => a -> String
show FPBinaryOp
op
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPRoundingUnaryTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg) =
    String
"FPRoundingUnary{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingUnaryOp -> String
forall a. Show a => a -> String
show FPRoundingUnaryOp
op
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPRoundingBinaryTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
    String
"FPRoundingBinary{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", op="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ FPRoundingBinaryOp -> String
forall a. Show a => a -> String
show FPRoundingBinaryOp
op
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FPFMATerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3) =
    String
"FPFMA{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg1="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg1
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg2="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg2
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg3="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg3
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FromIntegralTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term a
arg) =
    String
"FromIntegral{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (FromFPOrTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term ty
d Term FPRoundingMode
mode Term (FP eb sb)
arg) =
    String
"FromFPTerm{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", default="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term ty -> String
forall a. Show a => a -> String
show Term ty
d
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term (FP eb sb) -> String
forall a. Show a => a -> String
show Term (FP eb sb)
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"
  show (ToFPTerm WeakThreadId
tid Digest
_ Digest
i Ident
_ Term FPRoundingMode
mode Term a
arg Proxy eb
_ Proxy sb
_) =
    String
"ToFPTerm{tid="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ WeakThreadId -> String
forall a. Show a => a -> String
show WeakThreadId
tid
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", id="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Digest -> String
forall a. Show a => a -> String
show Digest
i
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", mode="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term FPRoundingMode -> String
forall a. Show a => a -> String
show Term FPRoundingMode
mode
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
", arg="
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ Term a -> String
forall a. Show a => a -> String
show Term a
arg
      String -> String -> String
forall a. [a] -> [a] -> [a]
++ String
"}"

-- {-# INLINE show #-}

-- | Pretty-print a term, possibly eliding parts of it.
prettyPrintTerm :: Term t -> Doc ann
prettyPrintTerm :: forall t ann. Term t -> Doc ann
prettyPrintTerm Term t
v =
  (Int -> Doc ann) -> Doc ann
forall ann. (Int -> Doc ann) -> Doc ann
column
    ( \Int
c ->
        (PageWidth -> Doc ann) -> Doc ann
forall ann. (PageWidth -> Doc ann) -> Doc ann
pageWidth ((PageWidth -> Doc ann) -> Doc ann)
-> (PageWidth -> Doc ann) -> Doc ann
forall a b. (a -> b) -> a -> b
$ \case
          AvailablePerLine Int
i Double
r ->
            if Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
c Int -> Int -> Int
forall a. Num a => a -> a -> a
+ Int
len) Double -> Double -> Bool
forall a. Ord a => a -> a -> Bool
> Int -> Double
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
i Double -> Double -> Double
forall a. Num a => a -> a -> a
* Double
r
              then Doc ann
"..."
              else String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
formatted
          PageWidth
Unbounded -> String -> Doc ann
forall ann. String -> Doc ann
forall a ann. Pretty a => a -> Doc ann
pretty String
formatted
    )
  where
    formatted :: String
formatted = Term t -> ((SupportedPrim t, Typeable t) => String) -> String
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
v (((SupportedPrim t, Typeable t) => String) -> String)
-> ((SupportedPrim t, Typeable t) => String) -> String
forall a b. (a -> b) -> a -> b
$ Term t -> String
forall t. Term t -> String
pformatTerm Term t
v
    len :: Int
len = String -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length String
formatted

instance (SupportedPrim t) => Eq (Term t) where
  Term t
a == :: Term t -> Term t -> Bool
== Term t
b =
    if Term t -> WeakThreadId
forall t. Interned t => t -> WeakThreadId
threadId Term t
a WeakThreadId -> WeakThreadId -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> WeakThreadId
forall t. Interned t => t -> WeakThreadId
threadId Term t
b
      then Term t -> Digest
forall t. Term t -> Digest
termId Term t
a Digest -> Digest -> Bool
forall a. Eq a => a -> a -> Bool
== Term t -> Digest
forall t. Term t -> Digest
termId Term t
b
      else IO Bool -> Bool
forall a. IO a -> a
unsafePerformIO (IO Bool -> Bool) -> IO Bool -> Bool
forall a b. (a -> b) -> a -> b
$ do
        WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
        Term t
a' <- WeakThreadId -> Term t -> IO (Term t)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term t
a
        Term t
b' <- WeakThreadId -> Term t -> IO (Term t)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term t
b
        Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> IO Bool) -> Bool -> IO Bool
forall a b. (a -> b) -> a -> b
$ Term t
a' Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
b'

instance (SupportedPrim t) => Hashable (Term t) where
  hashWithSalt :: Int -> Term t -> Int
hashWithSalt Int
s Term t
t = Int -> Digest -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (Digest -> Int) -> Digest -> Int
forall a b. (a -> b) -> a -> b
$ Term t -> Digest
forall t. Term t -> Digest
baseHash Term t
t
  {-# INLINE hashWithSalt #-}

-- | Term without identity (before internalizing).
data UTerm t where
  UConTerm :: (SupportedPrim t) => !t -> UTerm t
  USymTerm :: !(TypedSymbol 'AnyKind t) -> UTerm t
  UForallTerm ::
    !(TypedSymbol 'ConstantKind t) ->
    !(Term Bool) ->
    UTerm Bool
  UExistsTerm ::
    !(TypedSymbol 'ConstantKind t) ->
    !(Term Bool) ->
    UTerm Bool
  UNotTerm :: !(Term Bool) -> UTerm Bool
  UOrTerm :: !(Term Bool) -> !(Term Bool) -> UTerm Bool
  UAndTerm :: !(Term Bool) -> !(Term Bool) -> UTerm Bool
  UEqTerm :: !(Term t) -> !(Term t) -> UTerm Bool
  UDistinctTerm :: !(NonEmpty (Term t)) -> UTerm Bool
  UITETerm ::
    (SupportedPrim t) =>
    !(Term Bool) ->
    !(Term t) ->
    !(Term t) ->
    UTerm t
  UAddNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UNegNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
  UMulNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UAbsNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
  USignumNumTerm :: (SupportedPrim t, PEvalNumTerm t) => !(Term t) -> UTerm t
  ULtOrdTerm :: (SupportedPrim t, PEvalOrdTerm t) => !(Term t) -> !(Term t) -> UTerm Bool
  ULeOrdTerm :: (SupportedPrim t, PEvalOrdTerm t) => !(Term t) -> !(Term t) -> UTerm Bool
  UAndBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UOrBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UXorBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UComplementBitsTerm :: (SupportedPrim t, PEvalBitwiseTerm t) => !(Term t) -> UTerm t
  UShiftLeftTerm ::
    (SupportedPrim t, PEvalShiftTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UShiftRightTerm ::
    (SupportedPrim t, PEvalShiftTerm t) => !(Term t) -> !(Term t) -> UTerm t
  URotateLeftTerm ::
    (SupportedPrim t, PEvalRotateTerm t) => !(Term t) -> !(Term t) -> UTerm t
  URotateRightTerm ::
    (SupportedPrim t, PEvalRotateTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UBitCastTerm ::
    (SupportedPrim b, PEvalBitCastTerm a b) =>
    !(Term a) ->
    UTerm b
  UBitCastOrTerm ::
    (SupportedPrim b, PEvalBitCastOrTerm a b) =>
    !(Term b) ->
    !(Term a) ->
    UTerm b
  UBVConcatTerm ::
    ( PEvalBVTerm bv,
      KnownNat l,
      KnownNat r,
      KnownNat (l + r),
      1 <= l,
      1 <= r,
      1 <= l + r,
      SupportedPrim (bv (l + r))
    ) =>
    !(Term (bv l)) ->
    !(Term (bv r)) ->
    UTerm (bv (l + r))
  UBVSelectTerm ::
    ( PEvalBVTerm bv,
      KnownNat n,
      KnownNat ix,
      KnownNat w,
      1 <= n,
      1 <= w,
      ix + w <= n,
      SupportedPrim (bv w)
    ) =>
    !(Proxy ix) ->
    !(Proxy w) ->
    !(Term (bv n)) ->
    UTerm (bv w)
  UBVExtendTerm ::
    ( PEvalBVTerm bv,
      KnownNat l,
      KnownNat r,
      1 <= l,
      1 <= r,
      l <= r,
      SupportedPrim (bv r)
    ) =>
    !Bool ->
    !(Proxy r) ->
    !(Term (bv l)) ->
    UTerm (bv r)
  UApplyTerm ::
    (PEvalApplyTerm f a b, SupportedPrim b) =>
    Term f ->
    Term a ->
    UTerm b
  UDivIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    !(Term t) ->
    !(Term t) ->
    UTerm t
  UModIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    !(Term t) ->
    !(Term t) ->
    UTerm t
  UQuotIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    !(Term t) ->
    !(Term t) ->
    UTerm t
  URemIntegralTerm ::
    (SupportedPrim t, PEvalDivModIntegralTerm t) =>
    !(Term t) ->
    !(Term t) ->
    UTerm t
  UFPTraitTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !FPTrait ->
    !(Term (FP eb sb)) ->
    UTerm Bool
  UFdivTerm ::
    (SupportedPrim t, PEvalFractionalTerm t) =>
    !(Term t) ->
    !(Term t) ->
    UTerm t
  URecipTerm :: (SupportedPrim t, PEvalFractionalTerm t) => !(Term t) -> UTerm t
  UFloatingUnaryTerm ::
    (SupportedPrim t, PEvalFloatingTerm t) =>
    !FloatingUnaryOp ->
    !(Term t) ->
    UTerm t
  UPowerTerm ::
    (SupportedPrim t, PEvalFloatingTerm t) => !(Term t) -> !(Term t) -> UTerm t
  UFPUnaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !FPUnaryOp ->
    !(Term (FP eb sb)) ->
    UTerm (FP eb sb)
  UFPBinaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !FPBinaryOp ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    UTerm (FP eb sb)
  UFPRoundingUnaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !FPRoundingUnaryOp ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    UTerm (FP eb sb)
  UFPRoundingBinaryTerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !FPRoundingBinaryOp ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    UTerm (FP eb sb)
  UFPFMATerm ::
    (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    !(Term (FP eb sb)) ->
    UTerm (FP eb sb)
  UFromIntegralTerm ::
    (PEvalFromIntegralTerm a b, SupportedPrim b) =>
    !(Term a) ->
    UTerm b
  UFromFPOrTerm ::
    ( PEvalIEEEFPConvertibleTerm a,
      SupportedPrim a,
      ValidFP eb sb
    ) =>
    Term a ->
    !(Term FPRoundingMode) ->
    !(Term (FP eb sb)) ->
    UTerm a
  UToFPTerm ::
    ( PEvalIEEEFPConvertibleTerm a,
      ValidFP eb sb,
      SupportedPrim (FP eb sb)
    ) =>
    !(Term FPRoundingMode) ->
    !(Term a) ->
    Proxy eb ->
    Proxy sb ->
    UTerm (FP eb sb)

-- | Compare two t'TypedSymbol's for equality.
eqHeteroSymbol :: forall ta a tb b. TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol :: forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol (TypedSymbol Symbol
taga) (TypedSymbol Symbol
tagb) =
  case TypeRep a -> TypeRep b -> Maybe (a :~~: b)
forall k1 k2 (a :: k1) (b :: k2).
TypeRep a -> TypeRep b -> Maybe (a :~~: b)
eqTypeRep (forall t. SupportedPrim t => TypeRep t
primTypeRep @a) (forall t. SupportedPrim t => TypeRep t
primTypeRep @b) of
    Just a :~~: b
HRefl -> Symbol
taga Symbol -> Symbol -> Bool
forall a. Eq a => a -> a -> Bool
== Symbol
tagb
    Maybe (a :~~: b)
Nothing -> Bool
False
{-# INLINE eqHeteroSymbol #-}

preHashConDescription :: (SupportedPrim t) => t -> Digest
preHashConDescription :: forall t. SupportedPrim t => t -> Digest
preHashConDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (t -> Int) -> t -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> t -> Int
forall t. SupportedPrim t => Int -> t -> Int
hashConWithSalt Int
0
{-# INLINE preHashConDescription #-}

preHashSymDescription :: TypedSymbol 'AnyKind t -> Digest
preHashSymDescription :: forall t. TypedSymbol 'AnyKind t -> Digest
preHashSymDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest)
-> (TypedSymbol 'AnyKind t -> Int)
-> TypedSymbol 'AnyKind t
-> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypedSymbol 'AnyKind t -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
1
{-# INLINE preHashSymDescription #-}

preHashForallDescription ::
  TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription :: forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription TypedSymbol 'ConstantKind t
sym HashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
    ( Int
2
        Int -> TypedSymbol 'ConstantKind t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol 'ConstantKind t
sym
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h
    )
{-# INLINE preHashForallDescription #-}

preHashExistsDescription ::
  TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription :: forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription TypedSymbol 'ConstantKind t
sym HashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
    ( Int
3
        Int -> TypedSymbol 'ConstantKind t -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypedSymbol 'ConstantKind t
sym
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h
    )
{-# INLINE preHashExistsDescription #-}

preHashNotDescription :: HashId -> Digest
preHashNotDescription :: HashId -> Digest
preHashNotDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
7
{-# INLINE preHashNotDescription #-}

preHashOrDescription :: HashId -> HashId -> Digest
preHashOrDescription :: HashId -> HashId -> Digest
preHashOrDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
8 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashOrDescription #-}

preHashAndDescription :: HashId -> HashId -> Digest
preHashAndDescription :: HashId -> HashId -> Digest
preHashAndDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
9 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAndDescription #-}

preHashEqDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription Fingerprint
tp HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
10 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashEqDescription #-}

preHashDistinctDescription :: Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription :: Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription Fingerprint
tp NonEmpty HashId
hs =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
11 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> NonEmpty HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` NonEmpty HashId
hs)
{-# INLINE preHashDistinctDescription #-}

preHashITEDescription :: HashId -> HashId -> HashId -> Digest
preHashITEDescription :: HashId -> HashId -> HashId -> Digest
preHashITEDescription HashId
h1 HashId
h2 HashId
h3 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
12 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h3)
{-# INLINE preHashITEDescription #-}

preHashAddNumDescription :: HashId -> HashId -> Digest
preHashAddNumDescription :: HashId -> HashId -> Digest
preHashAddNumDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
13 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAddNumDescription #-}

preHashNegNumDescription :: HashId -> Digest
preHashNegNumDescription :: HashId -> Digest
preHashNegNumDescription =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
14
{-# INLINE preHashNegNumDescription #-}

preHashMulNumDescription :: HashId -> HashId -> Digest
preHashMulNumDescription :: HashId -> HashId -> Digest
preHashMulNumDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
15 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashMulNumDescription #-}

preHashAbsNumDescription :: HashId -> Digest
preHashAbsNumDescription :: HashId -> Digest
preHashAbsNumDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
16
{-# INLINE preHashAbsNumDescription #-}

preHashSignumNumDescription :: HashId -> Digest
preHashSignumNumDescription :: HashId -> Digest
preHashSignumNumDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
17
{-# INLINE preHashSignumNumDescription #-}

preHashLtOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription Fingerprint
tp HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
18 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashLtOrdDescription #-}

preHashLeOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription :: Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription Fingerprint
tp HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
19 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashLeOrdDescription #-}

preHashAndBitsDescription :: HashId -> HashId -> Digest
preHashAndBitsDescription :: HashId -> HashId -> Digest
preHashAndBitsDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
20 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashAndBitsDescription #-}

preHashOrBitsDescription :: HashId -> HashId -> Digest
preHashOrBitsDescription :: HashId -> HashId -> Digest
preHashOrBitsDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
21 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashOrBitsDescription #-}

preHashXorBitsDescription :: HashId -> HashId -> Digest
preHashXorBitsDescription :: HashId -> HashId -> Digest
preHashXorBitsDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
22 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashXorBitsDescription #-}

preHashComplementBitsDescription :: HashId -> Digest
preHashComplementBitsDescription :: HashId -> Digest
preHashComplementBitsDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
23
{-# INLINE preHashComplementBitsDescription #-}

preHashShiftLeftDescription :: HashId -> HashId -> Digest
preHashShiftLeftDescription :: HashId -> HashId -> Digest
preHashShiftLeftDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
24 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashShiftLeftDescription #-}

preHashShiftRightDescription :: HashId -> HashId -> Digest
preHashShiftRightDescription :: HashId -> HashId -> Digest
preHashShiftRightDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
25 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashShiftRightDescription #-}

preHashRotateLeftDescription :: HashId -> HashId -> Digest
preHashRotateLeftDescription :: HashId -> HashId -> Digest
preHashRotateLeftDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
26 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRotateLeftDescription #-}

preHashRotateRightDescription :: HashId -> HashId -> Digest
preHashRotateRightDescription :: HashId -> HashId -> Digest
preHashRotateRightDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
27 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRotateRightDescription #-}

preHashBVConcatDescription :: TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription :: TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription TypeHashId
h1 TypeHashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
    ( Int
28
        Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h1
        Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2
    )

preHashBVSelectDescription :: Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription :: Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription Fingerprint
tp TypeHashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
29 Int -> Fingerprint -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Fingerprint
tp Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)

preHashBVExtendDescription :: Bool -> TypeHashId -> Digest
preHashBVExtendDescription :: Bool -> TypeHashId -> Digest
preHashBVExtendDescription Bool
signed TypeHashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
30 Int -> Bool -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` Bool
signed Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)

preHashBitCastDescription :: TypeHashId -> Digest
preHashBitCastDescription :: TypeHashId -> Digest
preHashBitCastDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (TypeHashId -> Int) -> TypeHashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
31
{-# INLINE preHashBitCastDescription #-}

preHashBitCastOrDescription :: HashId -> TypeHashId -> Digest
preHashBitCastOrDescription :: HashId -> TypeHashId -> Digest
preHashBitCastOrDescription HashId
h1 TypeHashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
32 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashBitCastOrDescription #-}

preHashApplyDescription :: TypeHashId -> TypeHashId -> Digest
preHashApplyDescription :: TypeHashId -> TypeHashId -> Digest
preHashApplyDescription TypeHashId
h1 TypeHashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
33 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashApplyDescription #-}

preHashDivIntegralDescription :: HashId -> HashId -> Digest
preHashDivIntegralDescription :: HashId -> HashId -> Digest
preHashDivIntegralDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
34 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashDivIntegralDescription #-}

preHashModIntegralDescription :: HashId -> HashId -> Digest
preHashModIntegralDescription :: HashId -> HashId -> Digest
preHashModIntegralDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
35 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashModIntegralDescription #-}

preHashQuotIntegralDescription :: HashId -> HashId -> Digest
preHashQuotIntegralDescription :: HashId -> HashId -> Digest
preHashQuotIntegralDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
36 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashQuotIntegralDescription #-}

preHashRemIntegralDescription :: HashId -> HashId -> Digest
preHashRemIntegralDescription :: HashId -> HashId -> Digest
preHashRemIntegralDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
37 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashRemIntegralDescription #-}

preHashFPTraitDescription :: FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription :: FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription FPTrait
trait TypeHashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
38 Int -> FPTrait -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPTrait
trait Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h)
{-# INLINE preHashFPTraitDescription #-}

preHashFdivDescription :: HashId -> HashId -> Digest
preHashFdivDescription :: HashId -> HashId -> Digest
preHashFdivDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
39 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashFdivDescription #-}

preHashRecipDescription :: HashId -> Digest
preHashRecipDescription :: HashId -> Digest
preHashRecipDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (HashId -> Int) -> HashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
40
{-# INLINE preHashRecipDescription #-}

preHashFloatingUnaryDescription :: FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription :: FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription FloatingUnaryOp
op HashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
41 Int -> FloatingUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FloatingUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFloatingUnaryDescription #-}

preHashPowerDescription :: HashId -> HashId -> Digest
preHashPowerDescription :: HashId -> HashId -> Digest
preHashPowerDescription HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
42 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashPowerDescription #-}

preHashFPUnaryDescription :: FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription :: FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription FPUnaryOp
op HashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
43 Int -> FPUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFPUnaryDescription #-}

preHashFPBinaryDescription :: FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription :: FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription FPBinaryOp
op HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
44 Int -> FPBinaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPBinaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2)
{-# INLINE preHashFPBinaryDescription #-}

preHashFPRoundingUnaryDescription ::
  FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription :: FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription FPRoundingUnaryOp
op HashId
mode HashId
h =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
45 Int -> FPRoundingUnaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPRoundingUnaryOp
op Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h)
{-# INLINE preHashFPRoundingUnaryDescription #-}

preHashFPRoundingBinaryDescription ::
  FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription :: FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription FPRoundingBinaryOp
op HashId
mode HashId
h1 HashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
    ( Int
46
        Int -> FPRoundingBinaryOp -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` FPRoundingBinaryOp
op
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2
    )

preHashFPFMADescription ::
  HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription :: HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription HashId
mode HashId
h1 HashId
h2 HashId
h3 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral
    ( Int
47
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
mode
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2
        Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h3
    )
{-# INLINE preHashFPFMADescription #-}

preHashFromIntegralDescription :: TypeHashId -> Digest
preHashFromIntegralDescription :: TypeHashId -> Digest
preHashFromIntegralDescription = Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Digest) -> (TypeHashId -> Int) -> TypeHashId -> Digest
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
48
{-# INLINE preHashFromIntegralDescription #-}

preHashFromFPOrDescription ::
  HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription :: HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription HashId
h1 HashId
h2 TypeHashId
h3 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
49 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h2 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h3)
{-# INLINE preHashFromFPOrDescription #-}

preHashToFPTermDescription :: HashId -> TypeHashId -> Digest
preHashToFPTermDescription :: HashId -> TypeHashId -> Digest
preHashToFPTermDescription HashId
h1 TypeHashId
h2 =
  Int -> Digest
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int
50 Int -> HashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` HashId
h1 Int -> TypeHashId -> Int
forall a. Hashable a => Int -> a -> Int
`hashWithSalt` TypeHashId
h2)
{-# INLINE preHashToFPTermDescription #-}

instance Interned (Term t) where
  type Uninterned (Term t) = UTerm t
  data Description (Term t) where
    DConTerm ::
      (t -> t -> Bool) -> {-# UNPACK #-} !Digest -> t -> Description (Term t)
    DSymTerm ::
      {-# UNPACK #-} !Digest ->
      TypedSymbol 'AnyKind t ->
      Description (Term t)
    DForallTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !(TypedSymbol 'ConstantKind t) ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DExistsTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !(TypedSymbol 'ConstantKind t) ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DNotTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DOrTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DAndTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DEqTerm ::
      {-# UNPACK #-} !Digest ->
      Fingerprint ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DDistinctTerm ::
      {-# UNPACK #-} !Digest ->
      Fingerprint ->
      !(NonEmpty HashId) ->
      Description (Term Bool)
    DITETerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DAddNumTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DNegNumTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DMulNumTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DAbsNumTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DSignumNumTerm ::
      {-# UNPACK #-} !Digest -> {-# UNPACK #-} !HashId -> Description (Term t)
    DLtOrdTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !Fingerprint ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DLeOrdTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !Fingerprint ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term Bool)
    DAndBitsTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DOrBitsTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DXorBitsTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DComplementBitsTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DShiftLeftTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DShiftRightTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DRotateLeftTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DRotateRightTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term t)
    DBVConcatTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !TypeHashId ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term t)
    DBitCastTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term b)
    DBitCastOrTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term b)
    DBVSelectTerm ::
      forall bv (w :: Nat).
      {-# UNPACK #-} !Digest ->
      !Fingerprint ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term (bv w))
    DBVExtendTerm ::
      forall bv (r :: Nat).
      {-# UNPACK #-} !Digest ->
      !Bool ->
      !(Proxy r) ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term (bv r))
    DApplyTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !TypeHashId ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term b)
    DDivIntegralTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DModIntegralTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DQuotIntegralTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DRemIntegralTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DFPTraitTerm ::
      {-# UNPACK #-} !Digest ->
      FPTrait ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term Bool)
    DFdivTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DRecipTerm ::
      {-# UNPACK #-} !Digest -> {-# UNPACK #-} !HashId -> Description (Term a)
    DFloatingUnaryTerm ::
      {-# UNPACK #-} !Digest ->
      FloatingUnaryOp ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DPowerTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term a)
    DFPUnaryTerm ::
      {-# UNPACK #-} !Digest ->
      FPUnaryOp ->
      {-# UNPACK #-} !HashId ->
      Description (Term (FP eb sb))
    DFPBinaryTerm ::
      {-# UNPACK #-} !Digest ->
      FPBinaryOp ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term (FP eb sb))
    DFPRoundingUnaryTerm ::
      {-# UNPACK #-} !Digest ->
      FPRoundingUnaryOp ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term (FP eb sb))
    DFPRoundingBinaryTerm ::
      {-# UNPACK #-} !Digest ->
      FPRoundingBinaryOp ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term (FP eb sb))
    DFPFMATerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      Description (Term (FP eb sb))
    DFromIntegralTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term b)
    DFromFPOrTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term a)
    DToFPTerm ::
      {-# UNPACK #-} !Digest ->
      {-# UNPACK #-} !HashId ->
      {-# UNPACK #-} !TypeHashId ->
      Description (Term (FP eb sb))

  describe :: Uninterned (Term t) -> Description (Term t)
describe (UConTerm t
v) = (t -> t -> Bool) -> Digest -> t -> Description (Term t)
forall t. (t -> t -> Bool) -> Digest -> t -> Description (Term t)
DConTerm t -> t -> Bool
forall t. SupportedPrim t => t -> t -> Bool
sameCon (t -> Digest
forall t. SupportedPrim t => t -> Digest
preHashConDescription t
v) t
v
  describe ((USymTerm TypedSymbol 'AnyKind t
name) :: UTerm t) =
    forall t. Digest -> TypedSymbol 'AnyKind t -> Description (Term t)
DSymTerm @t (TypedSymbol 'AnyKind t -> Digest
forall t. TypedSymbol 'AnyKind t -> Digest
preHashSymDescription TypedSymbol 'AnyKind t
name) TypedSymbol 'AnyKind t
name
  describe (UForallTerm (TypedSymbol 'ConstantKind t
sym :: TypedSymbol 'ConstantKind arg) Term Bool
arg) =
    let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg
     in Digest
-> TypedSymbol 'ConstantKind t -> HashId -> Description (Term Bool)
forall a.
Digest
-> TypedSymbol 'ConstantKind a -> HashId -> Description (Term Bool)
DForallTerm (TypedSymbol 'ConstantKind t -> HashId -> Digest
forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashForallDescription TypedSymbol 'ConstantKind t
sym HashId
argHashId) TypedSymbol 'ConstantKind t
sym HashId
argHashId
  describe (UExistsTerm (TypedSymbol 'ConstantKind t
sym :: TypedSymbol 'ConstantKind arg) Term Bool
arg) =
    let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg
     in Digest
-> TypedSymbol 'ConstantKind t -> HashId -> Description (Term Bool)
forall a.
Digest
-> TypedSymbol 'ConstantKind a -> HashId -> Description (Term Bool)
DExistsTerm (TypedSymbol 'ConstantKind t -> HashId -> Digest
forall t. TypedSymbol 'ConstantKind t -> HashId -> Digest
preHashExistsDescription TypedSymbol 'ConstantKind t
sym HashId
argHashId) TypedSymbol 'ConstantKind t
sym HashId
argHashId
  describe (UNotTerm Term Bool
arg) =
    let argHashId :: HashId
argHashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg
     in Digest -> HashId -> Description (Term Bool)
DNotTerm (HashId -> Digest
preHashNotDescription HashId
argHashId) HashId
argHashId
  describe (UOrTerm Term Bool
arg1 Term Bool
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg1
        arg2HashId :: HashId
arg2HashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg2
     in Digest -> HashId -> HashId -> Description (Term Bool)
DOrTerm
          (HashId -> HashId -> Digest
preHashOrDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UAndTerm Term Bool
arg1 Term Bool
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg1
        arg2HashId :: HashId
arg2HashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
arg2
     in Digest -> HashId -> HashId -> Description (Term Bool)
DAndTerm
          (HashId -> HashId -> Digest
preHashAndDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UEqTerm (Term t
arg1 :: Term arg) Term t
arg2) = do
    let fingerprint :: Fingerprint
fingerprint =
          Term t
-> ((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
arg1 (((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint)
-> ((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
        arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DEqTerm
          (Fingerprint -> HashId -> HashId -> Digest
preHashEqDescription Fingerprint
fingerprint HashId
arg1HashId HashId
arg2HashId)
          Fingerprint
fingerprint
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UDistinctTerm args :: NonEmpty (Term t)
args@((Term t
arg1 :: Term arg) :| [Term t]
_)) =
    let fingerprint :: Fingerprint
fingerprint =
          Term t
-> ((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
arg1 (((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint)
-> ((SupportedPrim t, Typeable t) => Fingerprint) -> Fingerprint
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
        argsHashId :: NonEmpty HashId
argsHashId = Term t -> HashId
forall t. Term t -> HashId
hashId (Term t -> HashId) -> NonEmpty (Term t) -> NonEmpty HashId
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> NonEmpty (Term t)
args
     in Digest -> Fingerprint -> NonEmpty HashId -> Description (Term Bool)
DDistinctTerm
          (Fingerprint -> NonEmpty HashId -> Digest
preHashDistinctDescription Fingerprint
fingerprint NonEmpty HashId
argsHashId)
          Fingerprint
fingerprint
          NonEmpty HashId
argsHashId
  describe (UITETerm Term Bool
cond (Term t
l :: Term arg) Term t
r) =
    let condHashId :: HashId
condHashId = Term Bool -> HashId
forall t. Term t -> HashId
hashId Term Bool
cond
        lHashId :: HashId
lHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
l
        rHashId :: HashId
rHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
r
     in Digest -> HashId -> HashId -> HashId -> Description (Term t)
forall t.
Digest -> HashId -> HashId -> HashId -> Description (Term t)
DITETerm
          (HashId -> HashId -> HashId -> Digest
preHashITEDescription HashId
condHashId HashId
lHashId HashId
rHashId)
          HashId
condHashId
          HashId
lHashId
          HashId
rHashId
  describe (UAddNumTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DAddNumTerm
          (HashId -> HashId -> Digest
preHashAddNumDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UNegNumTerm Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DNegNumTerm (HashId -> Digest
preHashNegNumDescription HashId
argHashId) HashId
argHashId
  describe (UMulNumTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DMulNumTerm
          (HashId -> HashId -> Digest
preHashMulNumDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UAbsNumTerm Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DAbsNumTerm (HashId -> Digest
preHashAbsNumDescription HashId
argHashId) HashId
argHashId
  describe (USignumNumTerm Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DSignumNumTerm (HashId -> Digest
preHashSignumNumDescription HashId
argHashId) HashId
argHashId
  describe (ULtOrdTerm (Term t
arg1 :: Term arg) Term t
arg2) =
    let tr :: Fingerprint
tr = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
        arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DLtOrdTerm
          (Fingerprint -> HashId -> HashId -> Digest
preHashLtOrdDescription Fingerprint
tr HashId
arg1HashId HashId
arg2HashId)
          Fingerprint
tr
          HashId
arg1HashId
          HashId
arg2HashId
  describe (ULeOrdTerm (Term t
arg1 :: Term arg) Term t
arg2) =
    let tr :: Fingerprint
tr = forall t. SupportedPrim t => Fingerprint
typeFingerprint @arg
        arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest
-> Fingerprint -> HashId -> HashId -> Description (Term Bool)
DLeOrdTerm
          (Fingerprint -> HashId -> HashId -> Digest
preHashLeOrdDescription Fingerprint
tr HashId
arg1HashId HashId
arg2HashId)
          Fingerprint
tr
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UAndBitsTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DAndBitsTerm
          (HashId -> HashId -> Digest
preHashAndBitsDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UOrBitsTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DOrBitsTerm
          (HashId -> HashId -> Digest
preHashOrBitsDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UXorBitsTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DXorBitsTerm
          (HashId -> HashId -> Digest
preHashXorBitsDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UComplementBitsTerm Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DComplementBitsTerm
          (HashId -> Digest
preHashComplementBitsDescription HashId
argHashId)
          HashId
argHashId
  describe (UShiftLeftTerm Term t
arg Term t
n) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
        nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
n
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DShiftLeftTerm
          (HashId -> HashId -> Digest
preHashShiftLeftDescription HashId
argHashId HashId
nHashId)
          HashId
argHashId
          HashId
nHashId
  describe (UShiftRightTerm Term t
arg Term t
n) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
        nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
n
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DShiftRightTerm
          (HashId -> HashId -> Digest
preHashShiftRightDescription HashId
argHashId HashId
nHashId)
          HashId
argHashId
          HashId
nHashId
  describe (URotateLeftTerm Term t
arg Term t
n) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
        nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
n
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRotateLeftTerm
          (HashId -> HashId -> Digest
preHashRotateLeftDescription HashId
argHashId HashId
nHashId)
          HashId
argHashId
          HashId
nHashId
  describe (URotateRightTerm Term t
arg Term t
n) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
        nHashId :: HashId
nHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
n
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRotateRightTerm
          (HashId -> HashId -> Digest
preHashRotateRightDescription HashId
argHashId HashId
nHashId)
          HashId
argHashId
          HashId
nHashId
  describe (UBitCastTerm (Term a
arg :: Term a)) =
    let argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term a
arg
     in Digest -> TypeHashId -> Description (Term t)
forall b. Digest -> TypeHashId -> Description (Term b)
DBitCastTerm (TypeHashId -> Digest
preHashBitCastDescription TypeHashId
argHashId) TypeHashId
argHashId
  describe (UBitCastOrTerm Term t
d (Term a
arg :: Term a)) =
    let dHashId :: HashId
dHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
d
        argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term a
arg
     in Digest -> HashId -> TypeHashId -> Description (Term t)
forall b. Digest -> HashId -> TypeHashId -> Description (Term b)
DBitCastOrTerm
          (HashId -> TypeHashId -> Digest
preHashBitCastOrDescription HashId
dHashId TypeHashId
argHashId)
          HashId
dHashId
          TypeHashId
argHashId
  describe (UBVConcatTerm (Term (bv l)
arg1 :: Term bv1) (Term (bv r)
arg2 :: Term bv2)) =
    let arg1HashId :: TypeHashId
arg1HashId = Term (bv l) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (bv l)
arg1
        arg2HashId :: TypeHashId
arg2HashId = Term (bv r) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (bv r)
arg2
     in Digest -> TypeHashId -> TypeHashId -> Description (Term t)
forall t.
Digest -> TypeHashId -> TypeHashId -> Description (Term t)
DBVConcatTerm
          (TypeHashId -> TypeHashId -> Digest
preHashBVConcatDescription TypeHashId
arg1HashId TypeHashId
arg2HashId)
          TypeHashId
arg1HashId
          TypeHashId
arg2HashId
  describe (UBVSelectTerm (Proxy ix
ix :: Proxy ix) Proxy w
_ (Term (bv n)
arg :: Term arg)) =
    let ixFingerprint :: Fingerprint
ixFingerprint = SomeTypeRep -> Fingerprint
typeRepFingerprint (SomeTypeRep -> Fingerprint) -> SomeTypeRep -> Fingerprint
forall a b. (a -> b) -> a -> b
$ Proxy ix -> SomeTypeRep
forall {k} (proxy :: k -> *) (a :: k).
Typeable a =>
proxy a -> SomeTypeRep
someTypeRep Proxy ix
ix
        argHashId :: TypeHashId
argHashId = Term (bv n) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (bv n)
arg
     in Digest -> Fingerprint -> TypeHashId -> Description (Term (bv w))
forall (a :: Natural -> *) (eb :: Natural).
Digest -> Fingerprint -> TypeHashId -> Description (Term (a eb))
DBVSelectTerm
          (Fingerprint -> TypeHashId -> Digest
preHashBVSelectDescription Fingerprint
ixFingerprint TypeHashId
argHashId)
          Fingerprint
ixFingerprint
          TypeHashId
argHashId
  describe (UBVExtendTerm Bool
signed (Proxy r
n :: Proxy n) (Term (bv l)
arg :: Term arg)) =
    let argHashId :: TypeHashId
argHashId = Term (bv l) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (bv l)
arg
     in Digest
-> Bool -> Proxy r -> TypeHashId -> Description (Term (bv r))
forall (a :: Natural -> *) (eb :: Natural).
Digest
-> Bool -> Proxy eb -> TypeHashId -> Description (Term (a eb))
DBVExtendTerm
          (Bool -> TypeHashId -> Digest
preHashBVExtendDescription Bool
signed TypeHashId
argHashId)
          Bool
signed
          Proxy r
n
          TypeHashId
argHashId
  describe (UApplyTerm (Term f
f :: Term f) (Term a
arg :: Term a)) =
    let fHashId :: TypeHashId
fHashId = Term f -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term f
f
        argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term a
arg
     in Digest -> TypeHashId -> TypeHashId -> Description (Term t)
forall t.
Digest -> TypeHashId -> TypeHashId -> Description (Term t)
DApplyTerm
          (TypeHashId -> TypeHashId -> Digest
preHashApplyDescription TypeHashId
fHashId TypeHashId
argHashId)
          TypeHashId
fHashId
          TypeHashId
argHashId
  describe (UDivIntegralTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DDivIntegralTerm
          (HashId -> HashId -> Digest
preHashDivIntegralDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UModIntegralTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DModIntegralTerm
          (HashId -> HashId -> Digest
preHashModIntegralDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UQuotIntegralTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DQuotIntegralTerm
          (HashId -> HashId -> Digest
preHashQuotIntegralDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (URemIntegralTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DRemIntegralTerm
          (HashId -> HashId -> Digest
preHashRemIntegralDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UFPTraitTerm FPTrait
trait (Term (FP eb sb)
arg :: Term arg)) =
    let argHashId :: TypeHashId
argHashId = Term (FP eb sb) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (FP eb sb)
arg
     in Digest -> FPTrait -> TypeHashId -> Description (Term Bool)
DFPTraitTerm
          (FPTrait -> TypeHashId -> Digest
preHashFPTraitDescription FPTrait
trait TypeHashId
argHashId)
          FPTrait
trait
          TypeHashId
argHashId
  describe (UFdivTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DFdivTerm
          (HashId -> HashId -> Digest
preHashFdivDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (URecipTerm Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> HashId -> Description (Term t)
forall t. Digest -> HashId -> Description (Term t)
DRecipTerm (HashId -> Digest
preHashRecipDescription HashId
argHashId) HashId
argHashId
  describe (UFloatingUnaryTerm FloatingUnaryOp
op Term t
arg) =
    let argHashId :: HashId
argHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg
     in Digest -> FloatingUnaryOp -> HashId -> Description (Term t)
forall a.
Digest -> FloatingUnaryOp -> HashId -> Description (Term a)
DFloatingUnaryTerm
          (FloatingUnaryOp -> HashId -> Digest
preHashFloatingUnaryDescription FloatingUnaryOp
op HashId
argHashId)
          FloatingUnaryOp
op
          HashId
argHashId
  describe (UPowerTerm Term t
arg1 Term t
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg1
        arg2HashId :: HashId
arg2HashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
arg2
     in Digest -> HashId -> HashId -> Description (Term t)
forall t. Digest -> HashId -> HashId -> Description (Term t)
DPowerTerm
          (HashId -> HashId -> Digest
preHashPowerDescription HashId
arg1HashId HashId
arg2HashId)
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UFPUnaryTerm FPUnaryOp
op Term (FP eb sb)
arg) =
    let argHashId :: HashId
argHashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg
     in Digest -> FPUnaryOp -> HashId -> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest -> FPUnaryOp -> HashId -> Description (Term (FP a eb))
DFPUnaryTerm
          (FPUnaryOp -> HashId -> Digest
preHashFPUnaryDescription FPUnaryOp
op HashId
argHashId)
          FPUnaryOp
op
          HashId
argHashId
  describe (UFPBinaryTerm FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
    let arg1HashId :: HashId
arg1HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg1
        arg2HashId :: HashId
arg2HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg2
     in Digest
-> FPBinaryOp -> HashId -> HashId -> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest
-> FPBinaryOp -> HashId -> HashId -> Description (Term (FP a eb))
DFPBinaryTerm
          (FPBinaryOp -> HashId -> HashId -> Digest
preHashFPBinaryDescription FPBinaryOp
op HashId
arg1HashId HashId
arg2HashId)
          FPBinaryOp
op
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg) =
    let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
hashId Term FPRoundingMode
mode
        argHashId :: HashId
argHashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg
     in Digest
-> FPRoundingUnaryOp
-> HashId
-> HashId
-> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest
-> FPRoundingUnaryOp
-> HashId
-> HashId
-> Description (Term (FP a eb))
DFPRoundingUnaryTerm
          (FPRoundingUnaryOp -> HashId -> HashId -> Digest
preHashFPRoundingUnaryDescription FPRoundingUnaryOp
op HashId
modeHashId HashId
argHashId)
          FPRoundingUnaryOp
op
          HashId
modeHashId
          HashId
argHashId
  describe (UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
    let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
hashId Term FPRoundingMode
mode
        arg1HashId :: HashId
arg1HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg1
        arg2HashId :: HashId
arg2HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg2
     in Digest
-> FPRoundingBinaryOp
-> HashId
-> HashId
-> HashId
-> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest
-> FPRoundingBinaryOp
-> HashId
-> HashId
-> HashId
-> Description (Term (FP a eb))
DFPRoundingBinaryTerm
          ( FPRoundingBinaryOp -> HashId -> HashId -> HashId -> Digest
preHashFPRoundingBinaryDescription
              FPRoundingBinaryOp
op
              HashId
modeHashId
              HashId
arg1HashId
              HashId
arg2HashId
          )
          FPRoundingBinaryOp
op
          HashId
modeHashId
          HashId
arg1HashId
          HashId
arg2HashId
  describe (UFPFMATerm Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3) =
    let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
hashId Term FPRoundingMode
mode
        arg1HashId :: HashId
arg1HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg1
        arg2HashId :: HashId
arg2HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg2
        arg3HashId :: HashId
arg3HashId = Term (FP eb sb) -> HashId
forall t. Term t -> HashId
hashId Term (FP eb sb)
arg3
     in Digest
-> HashId
-> HashId
-> HashId
-> HashId
-> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest
-> HashId
-> HashId
-> HashId
-> HashId
-> Description (Term (FP a eb))
DFPFMATerm
          (HashId -> HashId -> HashId -> HashId -> Digest
preHashFPFMADescription HashId
modeHashId HashId
arg1HashId HashId
arg2HashId HashId
arg3HashId)
          HashId
modeHashId
          HashId
arg1HashId
          HashId
arg2HashId
          HashId
arg3HashId
  describe (UFromIntegralTerm (Term a
arg :: Term a)) =
    let argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term a
arg
     in Digest -> TypeHashId -> Description (Term t)
forall b. Digest -> TypeHashId -> Description (Term b)
DFromIntegralTerm (TypeHashId -> Digest
preHashFromIntegralDescription TypeHashId
argHashId) TypeHashId
argHashId
  describe (UFromFPOrTerm Term t
d Term FPRoundingMode
mode (Term (FP eb sb)
arg :: Term a)) =
    let dHashId :: HashId
dHashId = Term t -> HashId
forall t. Term t -> HashId
hashId Term t
d
        modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
hashId Term FPRoundingMode
mode
        argHashId :: TypeHashId
argHashId = Term (FP eb sb) -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term (FP eb sb)
arg
     in Digest -> HashId -> HashId -> TypeHashId -> Description (Term t)
forall a.
Digest -> HashId -> HashId -> TypeHashId -> Description (Term a)
DFromFPOrTerm
          (HashId -> HashId -> TypeHashId -> Digest
preHashFromFPOrDescription HashId
dHashId HashId
modeHashId TypeHashId
argHashId)
          HashId
dHashId
          HashId
modeHashId
          TypeHashId
argHashId
  describe (UToFPTerm Term FPRoundingMode
mode (Term a
arg :: Term a) Proxy eb
_ Proxy sb
_) =
    let modeHashId :: HashId
modeHashId = Term FPRoundingMode -> HashId
forall t. Term t -> HashId
hashId Term FPRoundingMode
mode
        argHashId :: TypeHashId
argHashId = Term a -> TypeHashId
forall t. Term t -> TypeHashId
typeHashId Term a
arg
     in Digest -> HashId -> TypeHashId -> Description (Term (FP eb sb))
forall (a :: Natural) (eb :: Natural).
Digest -> HashId -> TypeHashId -> Description (Term (FP a eb))
DToFPTerm
          (HashId -> TypeHashId -> Digest
preHashToFPTermDescription HashId
modeHashId TypeHashId
argHashId)
          HashId
modeHashId
          TypeHashId
argHashId

  -- {-# INLINE describe #-}

  identify :: WeakThreadId
-> Digest -> Digest -> Ident -> Uninterned (Term t) -> Term t
identify WeakThreadId
tid Digest
ha Digest
i Ident
ident = Uninterned (Term t) -> Term t
UTerm t -> Term t
go
    where
      go :: UTerm t -> Term t
go (UConTerm t
v) = WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> t -> Term t
forall t.
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> t -> Term t
goPhantomCon WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict t
v
      go (USymTerm TypedSymbol 'AnyKind t
v) = WeakThreadId
-> Digest -> Digest -> Ident -> TypedSymbol 'AnyKind t -> Term t
forall t.
WeakThreadId
-> Digest -> Digest -> Ident -> TypedSymbol 'AnyKind t -> Term t
SymTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident TypedSymbol 'AnyKind t
v
      go (UForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> TypedSymbol 'ConstantKind t
-> Term Bool
-> Term Bool
forall a.
WeakThreadId
-> Digest
-> Digest
-> Ident
-> TypedSymbol 'ConstantKind a
-> Term Bool
-> Term Bool
ForallTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident TypedSymbol 'ConstantKind t
sym Term Bool
arg
      go (UExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> TypedSymbol 'ConstantKind t
-> Term Bool
-> Term Bool
forall a.
WeakThreadId
-> Digest
-> Digest
-> Ident
-> TypedSymbol 'ConstantKind a
-> Term Bool
-> Term Bool
ExistsTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident TypedSymbol 'ConstantKind t
sym Term Bool
arg
      go (UNotTerm Term Bool
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term Bool -> Term Bool
NotTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term Bool
arg
      go (UOrTerm Term Bool
arg1 Term Bool
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term Bool -> Term Bool -> Term Bool
OrTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term Bool
arg1 Term Bool
arg2
      go (UAndTerm Term Bool
arg1 Term Bool
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term Bool -> Term Bool -> Term Bool
AndTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term Bool
arg1 Term Bool
arg2
      go (UEqTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term Bool
forall a.
WeakThreadId
-> Digest -> Digest -> Ident -> Term a -> Term a -> Term Bool
EqTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UDistinctTerm NonEmpty (Term t)
args) = WeakThreadId
-> Digest -> Digest -> Ident -> NonEmpty (Term t) -> Term Bool
forall a.
WeakThreadId
-> Digest -> Digest -> Ident -> NonEmpty (Term a) -> Term Bool
DistinctTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident NonEmpty (Term t)
args
      -- ITE is propagated
      go (UITETerm Term Bool
cond Term t
l Term t
r) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term Bool
-> Term t
-> Term t
-> Term t
forall t.
SupportedPrim t =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term Bool
-> Term t
-> Term t
-> Term t
ITETerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term Bool
cond Term t
l Term t
r
      go (UAddNumTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
AddNumTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UNegNumTerm Term t
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
NegNumTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg
      go (UMulNumTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
MulNumTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UAbsNumTerm Term t
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
AbsNumTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg
      go (USignumNumTerm Term t
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
SignumNumTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg
      go (ULtOrdTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term Bool
forall a.
(SupportedPrim a, PEvalOrdTerm a) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term a -> Term a -> Term Bool
LtOrdTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (ULeOrdTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term Bool
forall a.
(SupportedPrim a, PEvalOrdTerm a) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term a -> Term a -> Term Bool
LeOrdTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UAndBitsTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
AndBitsTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UOrBitsTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
OrBitsTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UXorBitsTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
XorBitsTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UComplementBitsTerm Term t
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
ComplementBitsTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg
      go (UShiftLeftTerm Term t
arg Term t
n) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
ShiftLeftTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg Term t
n
      go (UShiftRightTerm Term t
arg Term t
n) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
ShiftRightTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg Term t
n
      go (URotateLeftTerm Term t
arg Term t
n) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
RotateLeftTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg Term t
n
      go (URotateRightTerm Term t
arg Term t
n) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
RotateRightTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg Term t
n
      go (UBitCastTerm Term a
arg) = WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> Term a -> Term t
forall a t.
PEvalBitCastTerm a t =>
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> Term a -> Term t
goPhantomBitCast WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term a
arg
      go (UBitCastOrTerm Term t
d Term a
arg) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term a -> Term t
forall b a.
(SupportedPrim b, PEvalBitCastOrTerm a b) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term b -> Term a -> Term b
BitCastOrTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
d Term a
arg
      go (UBVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
goPhantomBVConcat WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv (l + r))
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term (bv l)
arg1 Term (bv r)
arg2
      go (UBVSelectTerm Proxy ix
ix Proxy w
w Term (bv n)
arg) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
goPhantomBVSelect WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv w)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Proxy ix
ix Proxy w
w Term (bv n)
arg
      go (UBVExtendTerm Bool
signed Proxy r
n Term (bv l)
arg) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
goPhantomBVExtend WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv r)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Bool
signed Proxy r
n Term (bv l)
arg
      go (UApplyTerm Term f
f Term a
arg) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict t
-> Term f
-> Term a
-> Term t
forall f a t.
PEvalApplyTerm f a t =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict t
-> Term f
-> Term a
-> Term t
goPhantomApply WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term f
f Term a
arg
      go (UDivIntegralTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
DivIntegralTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UModIntegralTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
ModIntegralTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UQuotIntegralTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
QuotIntegralTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (URemIntegralTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
RemIntegralTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UFPTraitTerm FPTrait
trait Term (FP eb sb)
arg) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPTrait
-> Term (FP eb sb)
-> Term Bool
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPTrait
-> Term (FP eb sb)
-> Term Bool
goPhantomFPTrait WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPTrait
trait Term (FP eb sb)
arg
      go (UFdivTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
FdivTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (URecipTerm Term t
arg) = WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term t -> Term t
RecipTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg
      go (UFloatingUnaryTerm FloatingUnaryOp
op Term t
arg) = WeakThreadId
-> Digest -> Digest -> Ident -> FloatingUnaryOp -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> FloatingUnaryOp -> Term t -> Term t
FloatingUnaryTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FloatingUnaryOp
op Term t
arg
      go (UPowerTerm Term t
arg1 Term t
arg2) = WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term t -> Term t -> Term t
PowerTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
arg1 Term t
arg2
      go (UFPUnaryTerm FPUnaryOp
op Term (FP eb sb)
arg) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPUnaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPUnaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPUnary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPUnaryOp
op Term (FP eb sb)
arg
      go (UFPBinaryTerm FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPBinaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPBinaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPBinary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2
      go (UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPRoundingUnary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg
      go (UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPRoundingBinary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2
      go (UFPFMATerm Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPFMA WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3
      go (UFromIntegralTerm Term a
arg) =
        WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> Term a -> Term t
forall a b.
PEvalFromIntegralTerm a b =>
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict b -> Term a -> Term b
goPhantomFromIntegral WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term a
arg
      go (UFromFPOrTerm Term t
d Term FPRoundingMode
mode Term (FP eb sb)
arg) = WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term t
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term t
forall a (a :: Natural) (eb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP a eb, SupportedPrim a) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term a
-> Term FPRoundingMode
-> Term (FP a eb)
-> Term a
FromFPOrTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term t
d Term FPRoundingMode
mode Term (FP eb sb)
arg
      go (UToFPTerm Term FPRoundingMode
mode Term a
arg Proxy eb
_ Proxy sb
_) =
        WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
goPhantomToFP WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
forall a. SupportedPrim a => PhantomDict a
getPhantomDict Term FPRoundingMode
mode Term a
arg
      {-# INLINE go #-}

  -- {-# INLINE identify #-}
  threadId :: Term t -> WeakThreadId
threadId = Term t -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId
  {-# INLINE threadId #-}

  descriptionDigest :: Description (Term t) -> Digest
descriptionDigest (DConTerm t -> t -> Bool
_ Digest
h t
_) = Digest
h
  descriptionDigest (DSymTerm Digest
h TypedSymbol 'AnyKind t
_) = Digest
h
  descriptionDigest (DForallTerm Digest
h TypedSymbol 'ConstantKind t
_ HashId
_) = Digest
h
  descriptionDigest (DExistsTerm Digest
h TypedSymbol 'ConstantKind t
_ HashId
_) = Digest
h
  descriptionDigest (DNotTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DOrTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DAndTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DEqTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DDistinctTerm Digest
h Fingerprint
_ NonEmpty HashId
_) = Digest
h
  descriptionDigest (DITETerm Digest
h HashId
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DAddNumTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DNegNumTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DMulNumTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DAbsNumTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DSignumNumTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DLtOrdTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DLeOrdTerm Digest
h Fingerprint
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DAndBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DOrBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DXorBitsTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DComplementBitsTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DShiftLeftTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DShiftRightTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DRotateLeftTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DRotateRightTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DBitCastTerm Digest
h TypeHashId
_) = Digest
h
  descriptionDigest (DBitCastOrTerm Digest
h HashId
_ TypeHashId
_) = Digest
h
  descriptionDigest (DBVConcatTerm Digest
h TypeHashId
_ TypeHashId
_) = Digest
h
  descriptionDigest (DBVSelectTerm Digest
h Fingerprint
_ TypeHashId
_) = Digest
h
  descriptionDigest (DBVExtendTerm Digest
h Bool
_ Proxy r
_ TypeHashId
_) = Digest
h
  descriptionDigest (DDivIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DModIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DQuotIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DRemIntegralTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DApplyTerm Digest
h TypeHashId
_ TypeHashId
_) = Digest
h
  descriptionDigest (DFPTraitTerm Digest
h FPTrait
_ TypeHashId
_) = Digest
h
  descriptionDigest (DFdivTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DRecipTerm Digest
h HashId
_) = Digest
h
  descriptionDigest (DFloatingUnaryTerm Digest
h FloatingUnaryOp
_ HashId
_) = Digest
h
  descriptionDigest (DPowerTerm Digest
h HashId
_ HashId
_) = Digest
h
  descriptionDigest (DFPUnaryTerm Digest
h FPUnaryOp
_ HashId
_) = Digest
h
  descriptionDigest (DFPBinaryTerm Digest
h FPBinaryOp
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DFPRoundingUnaryTerm Digest
h FPRoundingUnaryOp
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DFPRoundingBinaryTerm Digest
h FPRoundingBinaryOp
_ HashId
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DFPFMATerm Digest
h HashId
_ HashId
_ HashId
_ HashId
_) = Digest
h
  descriptionDigest (DFromIntegralTerm Digest
h TypeHashId
_) = Digest
h
  descriptionDigest (DFromFPOrTerm Digest
h HashId
_ HashId
_ TypeHashId
_) = Digest
h
  descriptionDigest (DToFPTerm Digest
h HashId
_ TypeHashId
_) = Digest
h

-- {-# INLINE descriptionDigest #-}
{-# NOINLINE goPhantomCon #-}
goPhantomCon ::
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict t ->
  t ->
  Term t
goPhantomCon :: forall t.
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> t -> Term t
goPhantomCon WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
PhantomDict t
v = WeakThreadId -> Digest -> Digest -> Ident -> t -> Term t
forall t.
SupportedPrim t =>
WeakThreadId -> Digest -> Digest -> Ident -> t -> Term t
ConTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident t
v

{-# NOINLINE goPhantomBitCast #-}
goPhantomBitCast ::
  (PEvalBitCastTerm a t) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict t ->
  Term a ->
  Term t
goPhantomBitCast :: forall a t.
PEvalBitCastTerm a t =>
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict t -> Term a -> Term t
goPhantomBitCast WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
PhantomDict Term a
arg = WeakThreadId -> Digest -> Digest -> Ident -> Term a -> Term t
forall b a.
(SupportedPrim b, PEvalBitCastTerm a b) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term a -> Term b
BitCastTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term a
arg

{-# NOINLINE goPhantomBVConcat #-}
goPhantomBVConcat ::
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    KnownNat (l + r),
    1 <= l,
    1 <= r,
    1 <= l + r
  ) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (bv (l + r)) ->
  Term (bv l) ->
  Term (bv r) ->
  Term (bv (l + r))
goPhantomBVConcat :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv (l + r))
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
goPhantomBVConcat WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv (l + r))
PhantomDict Term (bv l)
arg1 Term (bv r)
arg2 =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term (bv l)
-> Term (bv r)
-> Term (bv (l + r))
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, KnownNat (eb + sb),
 1 <= eb, 1 <= sb, 1 <= (eb + sb), SupportedPrim (a (eb + sb))) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term (a eb)
-> Term (a sb)
-> Term (a (eb + sb))
BVConcatTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term (bv l)
arg1 Term (bv r)
arg2

{-# NOINLINE goPhantomBVSelect #-}
goPhantomBVSelect ::
  ( PEvalBVTerm bv,
    KnownNat n,
    KnownNat ix,
    KnownNat w,
    1 <= n,
    1 <= w,
    ix + w <= n
  ) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (bv w) ->
  Proxy ix ->
  Proxy w ->
  Term (bv n) ->
  Term (bv w)
goPhantomBVSelect :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv w)
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
goPhantomBVSelect WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv w)
PhantomDict Proxy ix
ix Proxy w
w Term (bv n)
arg =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> Proxy ix
-> Proxy w
-> Term (bv n)
-> Term (bv w)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural)
       (w :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, KnownNat w, 1 <= eb,
 1 <= w, (sb + w) <= eb, SupportedPrim (a w)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Proxy sb
-> Proxy w
-> Term (a eb)
-> Term (a w)
BVSelectTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Proxy ix
ix Proxy w
w Term (bv n)
arg

{-# NOINLINE goPhantomBVExtend #-}
goPhantomBVExtend ::
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r
  ) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (bv r) ->
  Bool ->
  Proxy r ->
  Term (bv l) ->
  Term (bv r)
goPhantomBVExtend :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (bv r)
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
goPhantomBVExtend WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (bv r)
PhantomDict Bool
signed Proxy r
n Term (bv l)
arg =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> Bool
-> Proxy r
-> Term (bv l)
-> Term (bv r)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, 1 <= eb, 1 <= sb,
 eb <= sb, SupportedPrim (a sb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Bool
-> Proxy sb
-> Term (a eb)
-> Term (a sb)
BVExtendTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Bool
signed Proxy r
n Term (bv l)
arg

{-# NOINLINE goPhantomApply #-}
goPhantomApply ::
  (PEvalApplyTerm f a t) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict t ->
  Term f ->
  Term a ->
  Term t
goPhantomApply :: forall f a t.
PEvalApplyTerm f a t =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict t
-> Term f
-> Term a
-> Term t
goPhantomApply WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict t
PhantomDict Term f
f Term a
arg = WeakThreadId
-> Digest -> Digest -> Ident -> Term f -> Term a -> Term t
forall a eb b.
(PEvalApplyTerm a eb b, SupportedPrim b) =>
WeakThreadId
-> Digest -> Digest -> Ident -> Term a -> Term eb -> Term b
ApplyTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term f
f Term a
arg

{-# NOINLINE goPhantomFPTrait #-}
goPhantomFPTrait ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  FPTrait ->
  Term (FP eb sb) ->
  Term Bool
goPhantomFPTrait :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPTrait
-> Term (FP eb sb)
-> Term Bool
goPhantomFPTrait WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict FPTrait
trait Term (FP eb sb)
arg = WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPTrait
-> Term (FP eb sb)
-> Term Bool
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPTrait
-> Term (FP a eb)
-> Term Bool
FPTraitTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FPTrait
trait Term (FP eb sb)
arg

{-# NOINLINE goPhantomFPUnary #-}
goPhantomFPUnary ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  FPUnaryOp ->
  Term (FP eb sb) ->
  Term (FP eb sb)
goPhantomFPUnary :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPUnaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPUnary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict FPUnaryOp
op Term (FP eb sb)
arg = WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPUnaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPUnaryOp
-> Term (FP a eb)
-> Term (FP a eb)
FPUnaryTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FPUnaryOp
op Term (FP eb sb)
arg

{-# NOINLINE goPhantomFPBinary #-}
goPhantomFPBinary ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  FPBinaryOp ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
goPhantomFPBinary :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPBinaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPBinary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPBinaryOp
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPBinaryOp
-> Term (FP a eb)
-> Term (FP a eb)
-> Term (FP a eb)
FPBinaryTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2

{-# NOINLINE goPhantomFPRoundingUnary #-}
goPhantomFPRoundingUnary ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  FPRoundingUnaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb)
goPhantomFPRoundingUnary :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPRoundingUnary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPRoundingUnaryOp
-> Term FPRoundingMode
-> Term (FP a eb)
-> Term (FP a eb)
FPRoundingUnaryTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg

{-# NOINLINE goPhantomFPRoundingBinary #-}
goPhantomFPRoundingBinary ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  FPRoundingBinaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
goPhantomFPRoundingBinary :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPRoundingBinary WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP a eb)
-> Term (FP a eb)
-> Term (FP a eb)
FPRoundingBinaryTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2

{-# NOINLINE goPhantomFPFMA #-}
goPhantomFPFMA ::
  (ValidFP eb sb) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
goPhantomFPFMA :: forall (eb :: Natural) (sb :: Natural).
ValidFP eb sb =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
goPhantomFPFMA WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3 =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term FPRoundingMode
-> Term (FP a eb)
-> Term (FP a eb)
-> Term (FP a eb)
-> Term (FP a eb)
FPFMATerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3

{-# NOINLINE goPhantomFromIntegral #-}
goPhantomFromIntegral ::
  (PEvalFromIntegralTerm a b) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict b ->
  Term a ->
  Term b
goPhantomFromIntegral :: forall a b.
PEvalFromIntegralTerm a b =>
WeakThreadId
-> Digest -> Digest -> Ident -> PhantomDict b -> Term a -> Term b
goPhantomFromIntegral WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict b
PhantomDict Term a
arg = WeakThreadId -> Digest -> Digest -> Ident -> Term a -> Term b
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
WeakThreadId -> Digest -> Digest -> Ident -> Term a -> Term b
FromIntegralTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term a
arg

{-# NOINLINE goPhantomToFP #-}
goPhantomToFP ::
  forall a eb sb.
  (ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
  WeakThreadId ->
  Digest ->
  Id ->
  Ident ->
  PhantomDict (FP eb sb) ->
  Term FPRoundingMode ->
  Term a ->
  Term (FP eb sb)
goPhantomToFP :: forall a (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, PEvalIEEEFPConvertibleTerm a) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> PhantomDict (FP eb sb)
-> Term FPRoundingMode
-> Term a
-> Term (FP eb sb)
goPhantomToFP WeakThreadId
tid Digest
ha Digest
i Ident
ident PhantomDict (FP eb sb)
PhantomDict Term FPRoundingMode
mode Term a
arg =
  WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term FPRoundingMode
-> Term a
-> Proxy eb
-> Proxy sb
-> Term (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
WeakThreadId
-> Digest
-> Digest
-> Ident
-> Term FPRoundingMode
-> Term a
-> Proxy eb
-> Proxy sb
-> Term (FP eb sb)
ToFPTerm WeakThreadId
tid Digest
ha Digest
i Ident
ident Term FPRoundingMode
mode Term a
arg (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @eb) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @sb)

termThreadId :: Term t -> WeakThreadId
termThreadId :: forall t. Term t -> WeakThreadId
termThreadId (ConTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ t
_) = WeakThreadId
tid
termThreadId (SymTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ TypedSymbol 'AnyKind t
_) = WeakThreadId
tid
termThreadId (ForallTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
_ Term Bool
_) = WeakThreadId
tid
termThreadId (ExistsTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
_ Term Bool
_) = WeakThreadId
tid
termThreadId (NotTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term Bool
_) = WeakThreadId
tid
termThreadId (OrTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term Bool
_ Term Bool
_) = WeakThreadId
tid
termThreadId (AndTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term Bool
_ Term Bool
_) = WeakThreadId
tid
termThreadId (EqTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (DistinctTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ NonEmpty (Term t)
_) = WeakThreadId
tid
termThreadId (ITETerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term Bool
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (AddNumTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (NegNumTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_) = WeakThreadId
tid
termThreadId (MulNumTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (AbsNumTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_) = WeakThreadId
tid
termThreadId (SignumNumTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_) = WeakThreadId
tid
termThreadId (LtOrdTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (LeOrdTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (AndBitsTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (OrBitsTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (XorBitsTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (ComplementBitsTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_) = WeakThreadId
tid
termThreadId (ShiftLeftTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (ShiftRightTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (RotateLeftTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (RotateRightTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (BitCastTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term a
_) = WeakThreadId
tid
termThreadId (BitCastOrTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term a
_) = WeakThreadId
tid
termThreadId (BVConcatTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term (bv l)
_ Term (bv r)
_) = WeakThreadId
tid
termThreadId (BVSelectTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Proxy ix
_ Proxy w
_ Term (bv n)
_) = WeakThreadId
tid
termThreadId (BVExtendTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Bool
_ Proxy r
_ Term (bv l)
_) = WeakThreadId
tid
termThreadId (ApplyTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term f
_ Term a
_) = WeakThreadId
tid
termThreadId (DivIntegralTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (ModIntegralTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (QuotIntegralTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (RemIntegralTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (FPTraitTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FPTrait
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FdivTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (RecipTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_) = WeakThreadId
tid
termThreadId (FloatingUnaryTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FloatingUnaryOp
_ Term t
_) = WeakThreadId
tid
termThreadId (PowerTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term t
_) = WeakThreadId
tid
termThreadId (FPUnaryTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FPUnaryOp
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FPBinaryTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FPBinaryOp
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FPRoundingUnaryTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FPRoundingUnaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FPRoundingBinaryTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ FPRoundingBinaryOp
_ Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FPFMATerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term FPRoundingMode
_ Term (FP eb sb)
_ Term (FP eb sb)
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (FromIntegralTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term a
_) = WeakThreadId
tid
termThreadId (FromFPOrTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term t
_ Term FPRoundingMode
_ Term (FP eb sb)
_) = WeakThreadId
tid
termThreadId (ToFPTerm WeakThreadId
tid Digest
_ Digest
_ Ident
_ Term FPRoundingMode
_ Term a
_ Proxy eb
_ Proxy sb
_) = WeakThreadId
tid

-- {-# INLINE termThreadId #-}

instance Eq (Description (Term t)) where
  DConTerm t -> t -> Bool
eqFunc Digest
_ t
l == :: Description (Term t) -> Description (Term t) -> Bool
== DConTerm t -> t -> Bool
_ Digest
_ t
r =
    t -> t -> Bool
eqFunc t
l t
r
  DSymTerm Digest
_ TypedSymbol 'AnyKind t
ls == DSymTerm Digest
_ TypedSymbol 'AnyKind t
rs = TypedSymbol 'AnyKind t
ls TypedSymbol 'AnyKind t -> TypedSymbol 'AnyKind t -> Bool
forall a. Eq a => a -> a -> Bool
== TypedSymbol 'AnyKind t
rs
  DForallTerm Digest
_ TypedSymbol 'ConstantKind t
ls HashId
li == DForallTerm Digest
_ TypedSymbol 'ConstantKind t
rs HashId
ri =
    TypedSymbol 'ConstantKind t -> TypedSymbol 'ConstantKind t -> Bool
forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol TypedSymbol 'ConstantKind t
ls TypedSymbol 'ConstantKind t
rs Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DExistsTerm Digest
_ TypedSymbol 'ConstantKind t
ls HashId
li == DExistsTerm Digest
_ TypedSymbol 'ConstantKind t
rs HashId
ri =
    TypedSymbol 'ConstantKind t -> TypedSymbol 'ConstantKind t -> Bool
forall (ta :: SymbolKind) a (tb :: SymbolKind) b.
TypedSymbol ta a -> TypedSymbol tb b -> Bool
eqHeteroSymbol TypedSymbol 'ConstantKind t
ls TypedSymbol 'ConstantKind t
rs Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DNotTerm Digest
_ HashId
li == DNotTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DOrTerm Digest
_ HashId
li1 HashId
li2 == DOrTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DAndTerm Digest
_ HashId
li1 HashId
li2 == DAndTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DEqTerm Digest
_ Fingerprint
lfp HashId
li1 HashId
li2 == DEqTerm Digest
_ Fingerprint
rfp HashId
ri1 HashId
ri2 = Fingerprint
lfp Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rfp Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DDistinctTerm Digest
_ Fingerprint
lfp NonEmpty HashId
li == DDistinctTerm Digest
_ Fingerprint
rfp NonEmpty HashId
ri =
    Fingerprint
lfp Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rfp
      Bool -> Bool -> Bool
&& NonEmpty HashId -> Int
forall a. NonEmpty a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length NonEmpty HashId
li Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== NonEmpty HashId -> Int
forall a. NonEmpty a -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length NonEmpty HashId
ri
      Bool -> Bool -> Bool
&& [Bool] -> Bool
forall (t :: * -> *). Foldable t => t Bool -> Bool
and ((HashId -> HashId -> Bool) -> [HashId] -> [HashId] -> [Bool]
forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith HashId -> HashId -> Bool
eqHashId (NonEmpty HashId -> [HashId]
forall a. NonEmpty a -> [a]
toList NonEmpty HashId
li) (NonEmpty HashId -> [HashId]
forall a. NonEmpty a -> [a]
toList NonEmpty HashId
ri))
  DITETerm Digest
_ HashId
lc HashId
li1 HashId
li2 == DITETerm Digest
_ HashId
rc HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
lc HashId
rc Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DAddNumTerm Digest
_ HashId
li1 HashId
li2 == DAddNumTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DNegNumTerm Digest
_ HashId
li == DNegNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DMulNumTerm Digest
_ HashId
li1 HashId
li2 == DMulNumTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DAbsNumTerm Digest
_ HashId
li == DAbsNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DSignumNumTerm Digest
_ HashId
li == DSignumNumTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DLtOrdTerm Digest
_ Fingerprint
lrep HashId
li1 HashId
li2 == DLtOrdTerm Digest
_ Fingerprint
rrep HashId
ri1 HashId
ri2 = Fingerprint
lrep Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rrep Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DLeOrdTerm Digest
_ Fingerprint
lrep HashId
li1 HashId
li2 == DLeOrdTerm Digest
_ Fingerprint
rrep HashId
ri1 HashId
ri2 = Fingerprint
lrep Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rrep Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DAndBitsTerm Digest
_ HashId
li1 HashId
li2 == DAndBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DOrBitsTerm Digest
_ HashId
li1 HashId
li2 == DOrBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DXorBitsTerm Digest
_ HashId
li1 HashId
li2 == DXorBitsTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DComplementBitsTerm Digest
_ HashId
li == DComplementBitsTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DShiftLeftTerm Digest
_ HashId
li HashId
ln == DShiftLeftTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
  DShiftRightTerm Digest
_ HashId
li HashId
ln == DShiftRightTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
  DRotateLeftTerm Digest
_ HashId
li HashId
ln == DRotateLeftTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
  DRotateRightTerm Digest
_ HashId
li HashId
ln == DRotateRightTerm Digest
_ HashId
ri HashId
rn = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
ln HashId
rn
  DBitCastTerm Digest
_ TypeHashId
li == DBitCastTerm Digest
_ TypeHashId
ri = TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DBitCastOrTerm Digest
_ HashId
ld TypeHashId
li == DBitCastOrTerm Digest
_ HashId
rd TypeHashId
ri = HashId
ld HashId -> HashId -> Bool
forall a. Eq a => a -> a -> Bool
== HashId
rd Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DBVConcatTerm Digest
_ TypeHashId
li1 TypeHashId
li2 == DBVConcatTerm Digest
_ TypeHashId
ri1 TypeHashId
ri2 = TypeHashId
li1 TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri1 Bool -> Bool -> Bool
&& TypeHashId
li2 TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri2
  DBVSelectTerm Digest
_ Fingerprint
lix TypeHashId
li == DBVSelectTerm Digest
_ Fingerprint
rix TypeHashId
ri =
    Fingerprint
lix Fingerprint -> Fingerprint -> Bool
forall a. Eq a => a -> a -> Bool
== Fingerprint
rix Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DBVExtendTerm Digest
_ Bool
lIsSigned Proxy r
_ TypeHashId
li == DBVExtendTerm Digest
_ Bool
rIsSigned Proxy r
_ TypeHashId
ri =
    Bool
lIsSigned Bool -> Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Bool
rIsSigned
      Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DApplyTerm Digest
_ TypeHashId
lf TypeHashId
li == DApplyTerm Digest
_ TypeHashId
rf TypeHashId
ri = TypeHashId
lf TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rf Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DDivIntegralTerm Digest
_ HashId
li1 HashId
li2 == DDivIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DModIntegralTerm Digest
_ HashId
li1 HashId
li2 == DModIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DQuotIntegralTerm Digest
_ HashId
li1 HashId
li2 == DQuotIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DRemIntegralTerm Digest
_ HashId
li1 HashId
li2 == DRemIntegralTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DFPTraitTerm Digest
_ FPTrait
lt TypeHashId
li == DFPTraitTerm Digest
_ FPTrait
rt TypeHashId
ri = FPTrait
lt FPTrait -> FPTrait -> Bool
forall a. Eq a => a -> a -> Bool
== FPTrait
rt Bool -> Bool -> Bool
&& TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DFdivTerm Digest
_ HashId
li1 HashId
li2 == DFdivTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DRecipTerm Digest
_ HashId
li == DRecipTerm Digest
_ HashId
ri = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DFloatingUnaryTerm Digest
_ FloatingUnaryOp
lop HashId
li == DFloatingUnaryTerm Digest
_ FloatingUnaryOp
rop HashId
ri = FloatingUnaryOp
lop FloatingUnaryOp -> FloatingUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FloatingUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DPowerTerm Digest
_ HashId
li1 HashId
li2 == DPowerTerm Digest
_ HashId
ri1 HashId
ri2 = HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DFPUnaryTerm Digest
_ FPUnaryOp
lop HashId
li == DFPUnaryTerm Digest
_ FPUnaryOp
rop HashId
ri = FPUnaryOp
lop FPUnaryOp -> FPUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DFPBinaryTerm Digest
_ FPBinaryOp
lop HashId
li1 HashId
li2 == DFPBinaryTerm Digest
_ FPBinaryOp
rop HashId
ri1 HashId
ri2 = FPBinaryOp
lop FPBinaryOp -> FPBinaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPBinaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DFPRoundingUnaryTerm Digest
_ FPRoundingUnaryOp
lop HashId
lmode HashId
li == DFPRoundingUnaryTerm Digest
_ FPRoundingUnaryOp
rop HashId
rmode HashId
ri =
    FPRoundingUnaryOp
lop FPRoundingUnaryOp -> FPRoundingUnaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPRoundingUnaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri
  DFPRoundingBinaryTerm Digest
_ FPRoundingBinaryOp
lop HashId
lmode HashId
li1 HashId
li2 == DFPRoundingBinaryTerm Digest
_ FPRoundingBinaryOp
rop HashId
rmode HashId
ri1 HashId
ri2 =
    FPRoundingBinaryOp
lop FPRoundingBinaryOp -> FPRoundingBinaryOp -> Bool
forall a. Eq a => a -> a -> Bool
== FPRoundingBinaryOp
rop Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2
  DFPFMATerm Digest
_ HashId
lmode HashId
li1 HashId
li2 HashId
li3 == DFPFMATerm Digest
_ HashId
rmode HashId
ri1 HashId
ri2 HashId
ri3 =
    HashId -> HashId -> Bool
eqHashId HashId
lmode HashId
rmode Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li1 HashId
ri1 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li2 HashId
ri2 Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li3 HashId
ri3
  DFromIntegralTerm Digest
_ TypeHashId
li == DFromIntegralTerm Digest
_ TypeHashId
ri = TypeHashId
li TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
ri
  DFromFPOrTerm Digest
_ HashId
ld HashId
li TypeHashId
lai == DFromFPOrTerm Digest
_ HashId
rd HashId
ri TypeHashId
rai = HashId -> HashId -> Bool
eqHashId HashId
ld HashId
rd Bool -> Bool -> Bool
&& HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& TypeHashId
lai TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rai
  DToFPTerm Digest
_ HashId
li TypeHashId
lai == DToFPTerm Digest
_ HashId
ri TypeHashId
rai = HashId -> HashId -> Bool
eqHashId HashId
li HashId
ri Bool -> Bool -> Bool
&& TypeHashId
lai TypeHashId -> TypeHashId -> Bool
forall a. Eq a => a -> a -> Bool
== TypeHashId
rai
  Description (Term t)
_ == Description (Term t)
_ = Bool
False

-- {-# INLINE (==) #-}

instance Hashable (Description (Term t)) where
  hashWithSalt :: Int -> Description (Term t) -> Int
hashWithSalt Int
s = Int -> Digest -> Int
forall a. Hashable a => Int -> a -> Int
hashWithSalt Int
s (Digest -> Int)
-> (Description (Term t) -> Digest) -> Description (Term t) -> Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Description (Term t) -> Digest
forall t. Interned t => Description t -> Digest
descriptionDigest
  {-# INLINE hashWithSalt #-}

fullReconstructTerm1 ::
  forall a b.
  (Term a -> IO (Term b)) ->
  Term a ->
  IO (Term b)
fullReconstructTerm1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term b)
f Term a
x = Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x IO (Term a) -> (Term a -> IO (Term b)) -> IO (Term b)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Term a -> IO (Term b)
f
{-# INLINE fullReconstructTerm1 #-}

fullReconstructTerm2 ::
  forall a b c.
  (Term a -> Term b -> IO (Term c)) ->
  Term a ->
  Term b ->
  IO (Term c)
fullReconstructTerm2 :: forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term a -> Term b -> IO (Term c)
f Term a
x Term b
y = do
  Term a
rx <- Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x
  Term b
ry <- Term b -> IO (Term b)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term b
y
  Term a -> Term b -> IO (Term c)
f Term a
rx Term b
ry
{-# INLINE fullReconstructTerm2 #-}

fullReconstructTerm3 ::
  forall a b c d.
  (Term a -> Term b -> Term c -> IO (Term d)) ->
  Term a ->
  Term b ->
  Term c ->
  IO (Term d)
fullReconstructTerm3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
x Term b
y Term c
z = do
  Term a
rx <- Term a -> IO (Term a)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term a
x
  Term b
ry <- Term b -> IO (Term b)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term b
y
  Term c
rz <- Term c -> IO (Term c)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term c
z
  Term a -> Term b -> Term c -> IO (Term d)
f Term a
rx Term b
ry Term c
rz
{-# INLINE fullReconstructTerm3 #-}

fullReconstructTerm :: forall t. Term t -> IO (Term t)
fullReconstructTerm :: forall t. Term t -> IO (Term t)
fullReconstructTerm (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ t
i) = t -> IO (Term t)
forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm t
i
fullReconstructTerm (SymTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'AnyKind t
sym) = TypedSymbol 'AnyKind t -> IO (Term t)
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm TypedSymbol 'AnyKind t
sym
fullReconstructTerm (ForallTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
  (Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym) Term Bool
arg
fullReconstructTerm (ExistsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ TypedSymbol 'ConstantKind t
sym Term Bool
arg) =
  (Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym) Term Bool
arg
fullReconstructTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg) =
  (Term Bool -> IO (Term t)) -> Term Bool -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term Bool -> IO (Term t)
Term Bool -> IO (Term Bool)
curThreadNotTerm Term Bool
arg
fullReconstructTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg1 Term Bool
arg2) =
  (Term Bool -> Term Bool -> IO (Term t))
-> Term Bool -> Term Bool -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term Bool -> Term Bool -> IO (Term t)
Term Bool -> Term Bool -> IO (Term Bool)
curThreadOrTerm Term Bool
arg1 Term Bool
arg2
fullReconstructTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
arg1 Term Bool
arg2) =
  (Term Bool -> Term Bool -> IO (Term t))
-> Term Bool -> Term Bool -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term Bool -> Term Bool -> IO (Term t)
Term Bool -> Term Bool -> IO (Term Bool)
curThreadAndTerm Term Bool
arg1 Term Bool
arg2
fullReconstructTerm (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm Term t
arg1 Term t
arg2
fullReconstructTerm (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ NonEmpty (Term t)
args) =
  (Term t -> IO (Term t))
-> NonEmpty (Term t) -> IO (NonEmpty (Term t))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NonEmpty a -> f (NonEmpty b)
traverse Term t -> IO (Term t)
forall t. Term t -> IO (Term t)
fullReconstructTerm NonEmpty (Term t)
args IO (NonEmpty (Term t))
-> (NonEmpty (Term t) -> IO (Term t)) -> IO (Term t)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= NonEmpty (Term t) -> IO (Term t)
NonEmpty (Term t) -> IO (Term Bool)
forall a. NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm
fullReconstructTerm (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
cond Term t
arg1 Term t
arg2) =
  (Term Bool -> Term t -> Term t -> IO (Term t))
-> Term Bool -> Term t -> Term t -> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term Bool -> Term t -> Term t -> IO (Term t)
forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm Term Bool
cond Term t
arg1 Term t
arg2
fullReconstructTerm (AddNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm Term t
arg1 Term t
arg2
fullReconstructTerm (NegNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm Term t
arg
fullReconstructTerm (MulNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm Term t
arg1 Term t
arg2
fullReconstructTerm (AbsNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm Term t
arg
fullReconstructTerm (SignumNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm Term t
arg
fullReconstructTerm (LtOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm Term t
arg1 Term t
arg2
fullReconstructTerm (LeOrdTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
Term t -> Term t -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm Term t
arg1 Term t
arg2
fullReconstructTerm (AndBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (OrBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (XorBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm Term t
arg1 Term t
arg2
fullReconstructTerm (ComplementBitsTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm Term t
arg
fullReconstructTerm (ShiftLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm Term t
arg) Term t
n
fullReconstructTerm (ShiftRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm Term t
arg) Term t
n
fullReconstructTerm (RotateLeftTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm Term t
arg) Term t
n
fullReconstructTerm (RotateRightTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg Term t
n) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Term t -> Term t -> IO (Term t)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm Term t
arg) Term t
n
fullReconstructTerm (BitCastTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
v) =
  (Term a -> IO (Term t)) -> Term a -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term t)
forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm Term a
v
fullReconstructTerm (BitCastOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
d Term a
v) =
  (Term t -> Term a -> IO (Term t))
-> Term t -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term a -> IO (Term t)
forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm Term t
d Term a
v
fullReconstructTerm (BVConcatTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term (bv l)
arg1 Term (bv r)
arg2) =
  (Term (bv l) -> Term (bv r) -> IO (Term t))
-> Term (bv l) -> Term (bv r) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term (bv l) -> Term (bv r) -> IO (Term t)
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm Term (bv l)
arg1 Term (bv r)
arg2
fullReconstructTerm (BVSelectTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Proxy ix
_ :: Proxy ix) (Proxy w
_ :: Proxy w) Term (bv n)
arg) =
  (Term (bv n) -> IO (Term t)) -> Term (bv n) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Proxy ix -> Proxy w -> Term (bv n) -> IO (Term (bv w))
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w)) Term (bv n)
arg
fullReconstructTerm (BVExtendTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
signed Proxy r
p Term (bv l)
arg) =
  (Term (bv l) -> IO (Term t)) -> Term (bv l) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (Bool -> Proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed Proxy r
p) Term (bv l)
arg
fullReconstructTerm (ApplyTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term f
f Term a
arg) =
  (Term f -> Term a -> IO (Term t))
-> Term f -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term f -> Term a -> IO (Term t)
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm Term f
f Term a
arg
fullReconstructTerm (DivIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (ModIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (QuotIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (RemIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm Term t
arg1 Term t
arg2
fullReconstructTerm (FPTraitTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPTrait
trait Term (FP eb sb)
arg) =
  (Term (FP eb sb) -> IO (Term t)) -> Term (FP eb sb) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FPTrait -> Term (FP eb sb) -> IO (Term Bool)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPTrait -> Term (FP eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait) Term (FP eb sb)
arg
fullReconstructTerm (FdivTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm Term t
arg1 Term t
arg2
fullReconstructTerm (RecipTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term t -> IO (Term t)
forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm Term t
arg
fullReconstructTerm (FloatingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FloatingUnaryOp
op Term t
arg) =
  (Term t -> IO (Term t)) -> Term t -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FloatingUnaryOp -> Term t -> IO (Term t)
forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op) Term t
arg
fullReconstructTerm (PowerTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
arg1 Term t
arg2) =
  (Term t -> Term t -> IO (Term t))
-> Term t -> Term t -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term t -> Term t -> IO (Term t)
forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm Term t
arg1 Term t
arg2
fullReconstructTerm (FPUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPUnaryOp
op Term (FP eb sb)
arg) =
  (Term (FP eb sb) -> IO (Term t)) -> Term (FP eb sb) -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 (FPUnaryOp -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPUnaryOp -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpUnaryTerm FPUnaryOp
op) Term (FP eb sb)
arg
fullReconstructTerm (FPBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPBinaryOp
op Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
  (Term (FP eb sb) -> Term (FP eb sb) -> IO (Term t))
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 (FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpBinaryTerm FPBinaryOp
op) Term (FP eb sb)
arg1 Term (FP eb sb)
arg2
fullReconstructTerm (FPRoundingUnaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg) =
  Term FPRoundingMode
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term FPRoundingMode
mode (((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
  IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$
    (Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t))
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 (FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op) Term FPRoundingMode
mode Term (FP eb sb)
arg
fullReconstructTerm (FPRoundingBinaryTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2) =
  Term FPRoundingMode
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term FPRoundingMode
mode (((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
  IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$
    (Term FPRoundingMode
 -> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term t))
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 (FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op) Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2
fullReconstructTerm (FPFMATerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
mode Term (FP eb sb)
arg1 Term (FP eb sb)
arg2 Term (FP eb sb)
arg3) =
  Term FPRoundingMode
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term FPRoundingMode
mode (((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
  IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$ do
    Term FPRoundingMode
rmode <- Term FPRoundingMode -> IO (Term FPRoundingMode)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term FPRoundingMode
mode
    Term (FP eb sb)
rarg1 <- Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. Term t -> IO (Term t)
fullReconstructTerm Term (FP eb sb)
arg1
    Term (FP eb sb)
rarg2 <- Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. Term t -> IO (Term t)
fullReconstructTerm Term (FP eb sb)
arg2
    Term (FP eb sb)
rarg3 <- Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. Term t -> IO (Term t)
fullReconstructTerm Term (FP eb sb)
arg3
    Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpFMATerm Term FPRoundingMode
rmode Term (FP eb sb)
rarg1 Term (FP eb sb)
rarg2 Term (FP eb sb)
rarg3
fullReconstructTerm (FromIntegralTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term a
arg) =
  (Term a -> IO (Term t)) -> Term a -> IO (Term t)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
fullReconstructTerm1 Term a -> IO (Term t)
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm Term a
arg
fullReconstructTerm (FromFPOrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg) =
  Term FPRoundingMode
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term FPRoundingMode
r (((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
  IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$
    Term (FP eb sb)
-> ((SupportedPrim (FP eb sb), Typeable (FP eb sb)) => IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term (FP eb sb)
arg (((SupportedPrim (FP eb sb), Typeable (FP eb sb)) => IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim (FP eb sb), Typeable (FP eb sb)) => IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$
      (Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t))
-> Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
fullReconstructTerm3 Term t -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term t)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm Term t
d Term FPRoundingMode
r Term (FP eb sb)
arg
fullReconstructTerm (ToFPTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term FPRoundingMode
r Term a
arg Proxy eb
_ Proxy sb
_) =
  Term FPRoundingMode
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term FPRoundingMode
r (((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
  IO (Term t))
 -> IO (Term t))
-> ((SupportedPrim FPRoundingMode, Typeable FPRoundingMode) =>
    IO (Term t))
-> IO (Term t)
forall a b. (a -> b) -> a -> b
$
    (Term FPRoundingMode -> Term a -> IO (Term t))
-> Term FPRoundingMode -> Term a -> IO (Term t)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
fullReconstructTerm2 Term FPRoundingMode -> Term a -> IO (Term t)
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm Term FPRoundingMode
r Term a
arg

toCurThreadImpl :: forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl :: forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term t
t | Term t -> WeakThreadId
forall t. Term t -> WeakThreadId
termThreadId Term t
t WeakThreadId -> WeakThreadId -> Bool
forall a. Eq a => a -> a -> Bool
== WeakThreadId
tid = Term t -> IO (Term t)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Term t
t
toCurThreadImpl WeakThreadId
_ Term t
t = Term t -> IO (Term t)
forall t. Term t -> IO (Term t)
fullReconstructTerm Term t
t
{-# INLINE toCurThreadImpl #-}

-- | Convert a term to the current thread.
toCurThread :: forall t. Term t -> IO (Term t)
toCurThread :: forall t. Term t -> IO (Term t)
toCurThread Term t
t = do
  WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
  WeakThreadId -> Term t -> IO (Term t)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term t
t
{-# INLINE toCurThread #-}

-- | Construct and internalizing a 'ConTerm'.
curThreadConTerm :: forall t. (SupportedPrim t) => t -> IO (Term t)
curThreadConTerm :: forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm t
t =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @t ((Typeable t => IO (Term t)) -> IO (Term t))
-> (Typeable t => IO (Term t)) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term t) -> IO (Term t)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term t) -> IO (Term t))
-> Uninterned (Term t) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$
      t -> UTerm t
forall t. SupportedPrim t => t -> UTerm t
UConTerm t
t
{-# INLINE curThreadConTerm #-}

-- | Construct and internalizing a 'SymTerm'.
curThreadSymTerm :: forall knd t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm (TypedSymbol Symbol
s) =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @t ((Typeable t => IO (Term t)) -> IO (Term t))
-> (Typeable t => IO (Term t)) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term t) -> IO (Term t)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term t) -> IO (Term t))
-> Uninterned (Term t) -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'AnyKind t -> UTerm t
forall t. TypedSymbol 'AnyKind t -> UTerm t
USymTerm (TypedSymbol 'AnyKind t -> UTerm t)
-> TypedSymbol 'AnyKind t -> UTerm t
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
{-# INLINE curThreadSymTerm #-}

-- | Construct and internalizing a 'ForallTerm'.
curThreadForallTerm ::
  TypedSymbol 'ConstantKind t ->
  Term Bool ->
  IO (Term Bool)
curThreadForallTerm :: forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'ConstantKind t -> Term Bool -> UTerm Bool
forall a. TypedSymbol 'ConstantKind a -> Term Bool -> UTerm Bool
UForallTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg
{-# INLINE curThreadForallTerm #-}

-- | Construct and internalizing a 'ExistsTerm'.
curThreadExistsTerm ::
  TypedSymbol 'ConstantKind t ->
  Term Bool ->
  IO (Term Bool)
curThreadExistsTerm :: forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ TypedSymbol 'ConstantKind t -> Term Bool -> UTerm Bool
forall a. TypedSymbol 'ConstantKind a -> Term Bool -> UTerm Bool
UExistsTerm TypedSymbol 'ConstantKind t
sym Term Bool
arg
{-# INLINE curThreadExistsTerm #-}

-- | Construct and internalizing a 'SymTerm' with an identifier, using simple
-- symbols.
curThreadSsymTerm :: (SupportedPrim t) => Identifier -> IO (Term t)
curThreadSsymTerm :: forall t. SupportedPrim t => Identifier -> IO (Term t)
curThreadSsymTerm Identifier
ident =
  forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm @AnyKind (TypedSymbol 'AnyKind t -> IO (Term t))
-> TypedSymbol 'AnyKind t -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol 'AnyKind t)
-> Symbol -> TypedSymbol 'AnyKind t
forall a b. (a -> b) -> a -> b
$ Identifier -> Symbol
SimpleSymbol Identifier
ident
{-# INLINE curThreadSsymTerm #-}

-- | Construct and internalizing a 'SymTerm' with an identifier and an index,
-- using indexed symbols.
curThreadIsymTerm :: (SupportedPrim t) => Identifier -> Int -> IO (Term t)
curThreadIsymTerm :: forall t. SupportedPrim t => Identifier -> Int -> IO (Term t)
curThreadIsymTerm Identifier
str Int
idx =
  forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm @AnyKind (TypedSymbol 'AnyKind t -> IO (Term t))
-> TypedSymbol 'AnyKind t -> IO (Term t)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol 'AnyKind t
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol (Symbol -> TypedSymbol 'AnyKind t)
-> Symbol -> TypedSymbol 'AnyKind t
forall a b. (a -> b) -> a -> b
$ Identifier -> Int -> Symbol
IndexedSymbol Identifier
str Int
idx
{-# INLINE curThreadIsymTerm #-}

-- | Construct and internalizing a 'NotTerm'.
curThreadNotTerm :: Term Bool -> IO (Term Bool)
curThreadNotTerm :: Term Bool -> IO (Term Bool)
curThreadNotTerm = Uninterned (Term Bool) -> IO (Term Bool)
UTerm Bool -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm Bool -> IO (Term Bool))
-> (Term Bool -> UTerm Bool) -> Term Bool -> IO (Term Bool)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term Bool -> UTerm Bool
UNotTerm
{-# INLINE curThreadNotTerm #-}

-- | Construct and internalizing a 'OrTerm'.
curThreadOrTerm :: Term Bool -> Term Bool -> IO (Term Bool)
curThreadOrTerm :: Term Bool -> Term Bool -> IO (Term Bool)
curThreadOrTerm Term Bool
l Term Bool
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> UTerm Bool
UOrTerm Term Bool
l Term Bool
r
{-# INLINE curThreadOrTerm #-}

-- | Construct and internalizing a 'AndTerm'.
curThreadAndTerm :: Term Bool -> Term Bool -> IO (Term Bool)
curThreadAndTerm :: Term Bool -> Term Bool -> IO (Term Bool)
curThreadAndTerm Term Bool
l Term Bool
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> UTerm Bool
UAndTerm Term Bool
l Term Bool
r
{-# INLINE curThreadAndTerm #-}

-- | Construct and internalizing a 'EqTerm'.
curThreadEqTerm :: Term a -> Term a -> IO (Term Bool)
curThreadEqTerm :: forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm Term a
l Term a
r = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall a. Term a -> Term a -> UTerm Bool
UEqTerm Term a
l Term a
r
{-# INLINE curThreadEqTerm #-}

-- | Construct and internalizing a 'DistinctTerm'.
curThreadDistinctTerm :: NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm :: forall a. NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm NonEmpty (Term a)
args = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ NonEmpty (Term a) -> UTerm Bool
forall a. NonEmpty (Term a) -> UTerm Bool
UDistinctTerm NonEmpty (Term a)
args
{-# INLINE curThreadDistinctTerm #-}

-- | Construct and internalizing a 'ITETerm'.
curThreadIteTerm :: Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm :: forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm Term Bool
c Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$
      Term Bool -> Term a -> Term a -> UTerm a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> UTerm t
UITETerm Term Bool
c Term a
l Term a
r
{-# INLINE curThreadIteTerm #-}

-- | Construct and internalizing a 'AddNumTerm'.
curThreadAddNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> UTerm t
UAddNumTerm Term a
l Term a
r
{-# INLINE curThreadAddNumTerm #-}

-- | Construct and internalizing a 'NegNumTerm'.
curThreadNegNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadNegNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm Term a
l = Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
UNegNumTerm Term a
l
{-# INLINE curThreadNegNumTerm #-}

-- | Construct and internalizing a 'MulNumTerm'.
curThreadMulNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalNumTerm t) =>
Term t -> Term t -> UTerm t
UMulNumTerm Term a
l Term a
r
{-# INLINE curThreadMulNumTerm #-}

-- | Construct and internalizing a 'AbsNumTerm'.
curThreadAbsNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadAbsNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm Term a
l = Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
UAbsNumTerm Term a
l
{-# INLINE curThreadAbsNumTerm #-}

-- | Construct and internalizing a 'SignumNumTerm'.
curThreadSignumNumTerm :: (PEvalNumTerm a) => Term a -> IO (Term a)
curThreadSignumNumTerm :: forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm Term a
l =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t. (SupportedPrim t, PEvalNumTerm t) => Term t -> UTerm t
USignumNumTerm Term a
l
{-# INLINE curThreadSignumNumTerm #-}

-- | Construct and internalizing a 'LtOrdTerm'.
curThreadLtOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term Bool))
-> IO (Term Bool)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term Bool))
 -> IO (Term Bool))
-> ((SupportedPrim a, Typeable a) => IO (Term Bool))
-> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall a.
(SupportedPrim a, PEvalOrdTerm a) =>
Term a -> Term a -> UTerm Bool
ULtOrdTerm Term a
l Term a
r
{-# INLINE curThreadLtOrdTerm #-}

-- | Construct and internalizing a 'LeOrdTerm'.
curThreadLeOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term Bool))
-> IO (Term Bool)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term Bool))
 -> IO (Term Bool))
-> ((SupportedPrim a, Typeable a) => IO (Term Bool))
-> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm Bool
forall a.
(SupportedPrim a, PEvalOrdTerm a) =>
Term a -> Term a -> UTerm Bool
ULeOrdTerm Term a
l Term a
r
{-# INLINE curThreadLeOrdTerm #-}

-- | Construct and internalizing a 'AndBitsTerm'.
curThreadAndBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UAndBitsTerm Term a
l Term a
r
{-# INLINE curThreadAndBitsTerm #-}

-- | Construct and internalizing a 'OrBitsTerm'.
curThreadOrBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UOrBitsTerm Term a
l Term a
r
{-# INLINE curThreadOrBitsTerm #-}

-- | Construct and internalizing a 'XorBitsTerm'.
curThreadXorBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> Term t -> UTerm t
UXorBitsTerm Term a
l Term a
r
{-# INLINE curThreadXorBitsTerm #-}

-- | Construct and internalizing a 'ComplementBitsTerm'.
curThreadComplementBitsTerm :: (PEvalBitwiseTerm a) => Term a -> IO (Term a)
curThreadComplementBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm Term a
l =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalBitwiseTerm t) =>
Term t -> UTerm t
UComplementBitsTerm Term a
l
{-# INLINE curThreadComplementBitsTerm #-}

-- | Construct and internalizing a 'ShiftLeftTerm'.
curThreadShiftLeftTerm :: (PEvalShiftTerm a) => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm Term a
t Term a
n =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
t (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> UTerm t
UShiftLeftTerm Term a
t Term a
n
{-# INLINE curThreadShiftLeftTerm #-}

-- | Construct and internalizing a 'ShiftRightTerm'.
curThreadShiftRightTerm :: (PEvalShiftTerm a) => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm Term a
t Term a
n =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
t (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalShiftTerm t) =>
Term t -> Term t -> UTerm t
UShiftRightTerm Term a
t Term a
n
{-# INLINE curThreadShiftRightTerm #-}

-- | Construct and internalizing a 'RotateLeftTerm'.
curThreadRotateLeftTerm ::
  (PEvalRotateTerm a) => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm Term a
t Term a
n =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
t (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> UTerm t
URotateLeftTerm Term a
t Term a
n
{-# INLINE curThreadRotateLeftTerm #-}

-- | Construct and internalizing a 'RotateRightTerm'.
curThreadRotateRightTerm ::
  (PEvalRotateTerm a) => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm Term a
t Term a
n =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
t (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalRotateTerm t) =>
Term t -> Term t -> UTerm t
URotateRightTerm Term a
t Term a
n
{-# INLINE curThreadRotateRightTerm #-}

-- | Construct and internalizing a 'BitCastTerm'.
curThreadBitCastTerm ::
  forall a b.
  (SupportedPrim b, PEvalBitCastTerm a b) =>
  Term a ->
  IO (Term b)
curThreadBitCastTerm :: forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @b ((Typeable b => Term a -> IO (Term b)) -> Term a -> IO (Term b))
-> (Typeable b => Term a -> IO (Term b)) -> Term a -> IO (Term b)
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term b) -> IO (Term b)
UTerm b -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm b -> IO (Term b))
-> (Term a -> UTerm b) -> Term a -> IO (Term b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term a -> UTerm b
forall b a.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> UTerm b
UBitCastTerm
{-# INLINE curThreadBitCastTerm #-}

-- | Construct and internalizing a 'BitCastOrTerm'.
curThreadBitCastOrTerm ::
  (PEvalBitCastOrTerm a b) =>
  Term b ->
  Term a ->
  IO (Term b)
curThreadBitCastOrTerm :: forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm Term b
d Term a
a =
  Term b
-> ((SupportedPrim b, Typeable b) => IO (Term b)) -> IO (Term b)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term b
d (((SupportedPrim b, Typeable b) => IO (Term b)) -> IO (Term b))
-> ((SupportedPrim b, Typeable b) => IO (Term b)) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term b) -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term b) -> IO (Term b))
-> Uninterned (Term b) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$ Term b -> Term a -> UTerm b
forall b a.
(SupportedPrim b, PEvalBitCastOrTerm a b) =>
Term b -> Term a -> UTerm b
UBitCastOrTerm Term b
d Term a
a
{-# INLINE curThreadBitCastOrTerm #-}

-- | Construct and internalizing a 'BVConcatTerm'.
curThreadBVConcatTerm ::
  forall bv l r.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    KnownNat (l + r),
    1 <= l,
    1 <= r,
    1 <= l + r,
    SupportedPrim (bv (l + r))
  ) =>
  Term (bv l) ->
  Term (bv r) ->
  IO (Term (bv (l + r)))
curThreadBVConcatTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm Term (bv l)
l Term (bv r)
r =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @(bv (l + r)) ((Typeable (bv (l + r)) => IO (Term (bv (l + r))))
 -> IO (Term (bv (l + r))))
-> (Typeable (bv (l + r)) => IO (Term (bv (l + r))))
-> IO (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r)))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r))))
-> Uninterned (Term (bv (l + r))) -> IO (Term (bv (l + r)))
forall a b. (a -> b) -> a -> b
$ Term (bv l) -> Term (bv r) -> UTerm (bv (l + r))
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, KnownNat (eb + sb),
 1 <= eb, 1 <= sb, 1 <= (eb + sb), SupportedPrim (a (eb + sb))) =>
Term (a eb) -> Term (a sb) -> UTerm (a (eb + sb))
UBVConcatTerm Term (bv l)
l Term (bv r)
r
{-# INLINE curThreadBVConcatTerm #-}

-- | Construct and internalizing a 'BVSelectTerm'.
curThreadBVSelectTerm ::
  forall bv n ix w p q.
  ( PEvalBVTerm bv,
    KnownNat n,
    KnownNat ix,
    KnownNat w,
    1 <= n,
    1 <= w,
    ix + w <= n,
    SupportedPrim (bv w)
  ) =>
  p ix ->
  q w ->
  Term (bv n) ->
  IO (Term (bv w))
curThreadBVSelectTerm :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm p ix
_ q w
_ Term (bv n)
v =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @(bv w) ((Typeable (bv w) => IO (Term (bv w))) -> IO (Term (bv w)))
-> (Typeable (bv w) => IO (Term (bv w))) -> IO (Term (bv w))
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term (bv w)) -> IO (Term (bv w))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv w)) -> IO (Term (bv w)))
-> Uninterned (Term (bv w)) -> IO (Term (bv w))
forall a b. (a -> b) -> a -> b
$
      Proxy ix -> Proxy w -> Term (bv n) -> UTerm (bv w)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural)
       (w :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, KnownNat w, 1 <= eb,
 1 <= w, (sb + w) <= eb, SupportedPrim (a w)) =>
Proxy sb -> Proxy w -> Term (a eb) -> UTerm (a w)
UBVSelectTerm (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @ix) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @w) Term (bv n)
v
{-# INLINE curThreadBVSelectTerm #-}

-- | Construct and internalizing a 'BVExtendTerm'.
curThreadBVExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  Bool ->
  proxy r ->
  Term (bv l) ->
  IO (Term (bv r))
curThreadBVExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed proxy r
_ Term (bv l)
v =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @(bv r) ((Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r)))
-> (Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
      Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, 1 <= eb, 1 <= sb,
 eb <= sb, SupportedPrim (a sb)) =>
Bool -> Proxy sb -> Term (a eb) -> UTerm (a sb)
UBVExtendTerm Bool
signed (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBVExtendTerm #-}

-- | Construct and internalizing a 'BVExtendTerm' with sign extension.
curThreadBvsignExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  proxy r ->
  Term (bv l) ->
  IO (Term (bv r))
curThreadBvsignExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvsignExtendTerm proxy r
_ Term (bv l)
v =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @(bv r) ((Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r)))
-> (Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
      Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, 1 <= eb, 1 <= sb,
 eb <= sb, SupportedPrim (a sb)) =>
Bool -> Proxy sb -> Term (a eb) -> UTerm (a sb)
UBVExtendTerm Bool
True (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBvsignExtendTerm #-}

-- | Construct and internalizing a 'BVExtendTerm' with zero extension.
curThreadBvzeroExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  proxy r ->
  Term (bv l) ->
  IO (Term (bv r))
curThreadBvzeroExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvzeroExtendTerm proxy r
_ Term (bv l)
v =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @(bv r) ((Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r)))
-> (Typeable (bv r) => IO (Term (bv r))) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term (bv r)) -> IO (Term (bv r))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (bv r)) -> IO (Term (bv r)))
-> Uninterned (Term (bv r)) -> IO (Term (bv r))
forall a b. (a -> b) -> a -> b
$
      Bool -> Proxy r -> Term (bv l) -> UTerm (bv r)
forall (a :: Natural -> *) (eb :: Natural) (sb :: Natural).
(PEvalBVTerm a, KnownNat eb, KnownNat sb, 1 <= eb, 1 <= sb,
 eb <= sb, SupportedPrim (a sb)) =>
Bool -> Proxy sb -> Term (a eb) -> UTerm (a sb)
UBVExtendTerm Bool
False (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @r) Term (bv l)
v
{-# INLINE curThreadBvzeroExtendTerm #-}

-- | Construct and internalizing a 'ApplyTerm'.
curThreadApplyTerm ::
  forall f a b.
  (PEvalApplyTerm f a b, SupportedPrim b) =>
  Term f ->
  Term a ->
  IO (Term b)
curThreadApplyTerm :: forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm Term f
f Term a
a =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @b ((Typeable b => IO (Term b)) -> IO (Term b))
-> (Typeable b => IO (Term b)) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$
    Uninterned (Term b) -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term b) -> IO (Term b))
-> Uninterned (Term b) -> IO (Term b)
forall a b. (a -> b) -> a -> b
$
      Term f -> Term a -> UTerm b
forall a eb b.
(PEvalApplyTerm a eb b, SupportedPrim b) =>
Term a -> Term eb -> UTerm b
UApplyTerm Term f
f Term a
a
{-# INLINE curThreadApplyTerm #-}

-- | Construct and internalizing a 'DivIntegralTerm'.
curThreadDivIntegralTerm ::
  (PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UDivIntegralTerm Term a
l Term a
r
{-# INLINE curThreadDivIntegralTerm #-}

-- | Construct and internalizing a 'ModIntegralTerm'.
curThreadModIntegralTerm ::
  (PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UModIntegralTerm Term a
l Term a
r
{-# INLINE curThreadModIntegralTerm #-}

-- | Construct and internalizing a 'QuotIntegralTerm'.
curThreadQuotIntegralTerm ::
  (PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
UQuotIntegralTerm Term a
l Term a
r
{-# INLINE curThreadQuotIntegralTerm #-}

-- | Construct and internalizing a 'RemIntegralTerm'.
curThreadRemIntegralTerm ::
  (PEvalDivModIntegralTerm a) => Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm :: forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalDivModIntegralTerm t) =>
Term t -> Term t -> UTerm t
URemIntegralTerm Term a
l Term a
r
{-# INLINE curThreadRemIntegralTerm #-}

-- | Construct and internalizing a 'FPTraitTerm'.
curThreadFpTraitTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPTrait ->
  Term (FP eb sb) ->
  IO (Term Bool)
curThreadFpTraitTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPTrait -> Term (FP eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait Term (FP eb sb)
v = Uninterned (Term Bool) -> IO (Term Bool)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term Bool) -> IO (Term Bool))
-> Uninterned (Term Bool) -> IO (Term Bool)
forall a b. (a -> b) -> a -> b
$ FPTrait -> Term (FP eb sb) -> UTerm Bool
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
FPTrait -> Term (FP a eb) -> UTerm Bool
UFPTraitTerm FPTrait
trait Term (FP eb sb)
v
{-# INLINE curThreadFpTraitTerm #-}

-- | Construct and internalizing a 'FdivTerm'.
curThreadFdivTerm :: (PEvalFractionalTerm a) => Term a -> Term a -> IO (Term a)
curThreadFdivTerm :: forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm Term a
l Term a
r = Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> Term t -> UTerm t
UFdivTerm Term a
l Term a
r
{-# INLINE curThreadFdivTerm #-}

-- | Construct and internalizing a 'RecipTerm'.
curThreadRecipTerm :: (PEvalFractionalTerm a) => Term a -> IO (Term a)
curThreadRecipTerm :: forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm Term a
l = Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFractionalTerm t) =>
Term t -> UTerm t
URecipTerm Term a
l
{-# INLINE curThreadRecipTerm #-}

-- | Construct and internalizing a 'FloatingUnaryTerm'.
curThreadFloatingUnaryTerm ::
  (PEvalFloatingTerm a) => FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm :: forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op Term a
a =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
a (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ FloatingUnaryOp -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
FloatingUnaryOp -> Term t -> UTerm t
UFloatingUnaryTerm FloatingUnaryOp
op Term a
a
{-# INLINE curThreadFloatingUnaryTerm #-}

-- | Construct and internalizing a 'PowerTerm'.
curThreadPowerTerm :: (PEvalFloatingTerm a) => Term a -> Term a -> IO (Term a)
curThreadPowerTerm :: forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm Term a
l Term a
r =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
l (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$ Term a -> Term a -> UTerm a
forall t.
(SupportedPrim t, PEvalFloatingTerm t) =>
Term t -> Term t -> UTerm t
UPowerTerm Term a
l Term a
r
{-# INLINE curThreadPowerTerm #-}

-- | Construct and internalizing a 'FPUnaryTerm'.
curThreadFpUnaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPUnaryOp ->
  Term (FP eb sb) ->
  IO (Term (FP eb sb))
curThreadFpUnaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPUnaryOp -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpUnaryTerm FPUnaryOp
op Term (FP eb sb)
v = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ FPUnaryOp -> Term (FP eb sb) -> UTerm (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
FPUnaryOp -> Term (FP a eb) -> UTerm (FP a eb)
UFPUnaryTerm FPUnaryOp
op Term (FP eb sb)
v
{-# INLINE curThreadFpUnaryTerm #-}

-- | Construct and internalizing a 'FPBinaryTerm'.
curThreadFpBinaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPBinaryOp ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  IO (Term (FP eb sb))
curThreadFpBinaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpBinaryTerm FPBinaryOp
op Term (FP eb sb)
l Term (FP eb sb)
r = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> UTerm (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
FPBinaryOp -> Term (FP a eb) -> Term (FP a eb) -> UTerm (FP a eb)
UFPBinaryTerm FPBinaryOp
op Term (FP eb sb)
l Term (FP eb sb)
r
{-# INLINE curThreadFpBinaryTerm #-}

-- | Construct and internalizing a 'FPRoundingUnaryTerm'.
curThreadFpRoundingUnaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPRoundingUnaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  IO (Term (FP eb sb))
curThreadFpRoundingUnaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
v = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> UTerm (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP a eb) -> UTerm (FP a eb)
UFPRoundingUnaryTerm FPRoundingUnaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
v
{-# INLINE curThreadFpRoundingUnaryTerm #-}

-- | Construct and internalizing a 'FPRoundingBinaryTerm'.
curThreadFpRoundingBinaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPRoundingBinaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  IO (Term (FP eb sb))
curThreadFpRoundingBinaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
l Term (FP eb sb)
r =
  Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> UTerm (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP a eb)
-> Term (FP a eb)
-> UTerm (FP a eb)
UFPRoundingBinaryTerm FPRoundingBinaryOp
op Term FPRoundingMode
mode Term (FP eb sb)
l Term (FP eb sb)
r
{-# INLINE curThreadFpRoundingBinaryTerm #-}

-- | Construct and internalizing a 'FPFMATerm'.
curThreadFpFMATerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  IO (Term (FP eb sb))
curThreadFpFMATerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpFMATerm Term FPRoundingMode
mode Term (FP eb sb)
l Term (FP eb sb)
r Term (FP eb sb)
s = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> UTerm (FP eb sb)
forall (a :: Natural) (eb :: Natural).
(ValidFP a eb, SupportedPrim (FP a eb)) =>
Term FPRoundingMode
-> Term (FP a eb)
-> Term (FP a eb)
-> Term (FP a eb)
-> UTerm (FP a eb)
UFPFMATerm Term FPRoundingMode
mode Term (FP eb sb)
l Term (FP eb sb)
r Term (FP eb sb)
s
{-# INLINE curThreadFpFMATerm #-}

-- | Construct and internalizing a 'FromIntegralTerm'.
curThreadFromIntegralTerm ::
  forall a b.
  (PEvalFromIntegralTerm a b, SupportedPrim b) =>
  Term a ->
  IO (Term b)
curThreadFromIntegralTerm :: forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm =
  forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @b ((Typeable b => Term a -> IO (Term b)) -> Term a -> IO (Term b))
-> (Typeable b => Term a -> IO (Term b)) -> Term a -> IO (Term b)
forall a b. (a -> b) -> a -> b
$ Uninterned (Term b) -> IO (Term b)
UTerm b -> IO (Term b)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (UTerm b -> IO (Term b))
-> (Term a -> UTerm b) -> Term a -> IO (Term b)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Term a -> UTerm b
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> UTerm b
UFromIntegralTerm
{-# INLINE curThreadFromIntegralTerm #-}

-- | Construct and internalizing a 'FromFPOrTerm'.
curThreadFromFPOrTerm ::
  forall a eb sb.
  ( PEvalIEEEFPConvertibleTerm a,
    ValidFP eb sb
  ) =>
  Term a ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  IO (Term a)
curThreadFromFPOrTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm Term a
d Term FPRoundingMode
r Term (FP eb sb)
f =
  Term a
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
d (((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a))
-> ((SupportedPrim a, Typeable a) => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$
    forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @a ((Typeable a => IO (Term a)) -> IO (Term a))
-> (Typeable a => IO (Term a)) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$
      Uninterned (Term a) -> IO (Term a)
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term a) -> IO (Term a))
-> Uninterned (Term a) -> IO (Term a)
forall a b. (a -> b) -> a -> b
$
        Term a -> Term FPRoundingMode -> Term (FP eb sb) -> UTerm a
forall a (a :: Natural) (eb :: Natural).
(PEvalIEEEFPConvertibleTerm a, SupportedPrim a, ValidFP a eb) =>
Term a -> Term FPRoundingMode -> Term (FP a eb) -> UTerm a
UFromFPOrTerm Term a
d Term FPRoundingMode
r Term (FP eb sb)
f
{-# INLINE curThreadFromFPOrTerm #-}

-- | Construct and internalizing a 'ToFPTerm'.
curThreadToFPTerm ::
  forall a eb sb.
  ( PEvalIEEEFPConvertibleTerm a,
    ValidFP eb sb,
    SupportedPrim (FP eb sb)
  ) =>
  Term FPRoundingMode ->
  Term a ->
  IO (Term (FP eb sb))
curThreadToFPTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm Term FPRoundingMode
r Term a
f = Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall t.
(Interned t, Typeable t, Hashable (Description t),
 Eq (Description t)) =>
Uninterned t -> IO t
intern (Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb)))
-> Uninterned (Term (FP eb sb)) -> IO (Term (FP eb sb))
forall a b. (a -> b) -> a -> b
$ Term FPRoundingMode
-> Term a -> Proxy eb -> Proxy sb -> UTerm (FP eb sb)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term a -> Proxy eb -> Proxy sb -> UTerm (FP eb sb)
UToFPTerm Term FPRoundingMode
r Term a
f (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @eb) (forall (t :: Natural). Proxy t
forall {k} (t :: k). Proxy t
Proxy @sb)
{-# INLINE curThreadToFPTerm #-}

inCurThread1 ::
  forall a b.
  (Term a -> IO (Term b)) ->
  Term a ->
  IO (Term b)
inCurThread1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
inCurThread1 Term a -> IO (Term b)
f Term a
t = do
  WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
  WeakThreadId -> Term a -> IO (Term a)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term a
t IO (Term a) -> (Term a -> IO (Term b)) -> IO (Term b)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Term a -> IO (Term b)
f
{-# INLINE inCurThread1 #-}

inCurThread2 ::
  forall a b c.
  (Term a -> Term b -> IO (Term c)) ->
  Term a ->
  Term b ->
  IO (Term c)
inCurThread2 :: forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
inCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b = do
  WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
  Term a
ra <- WeakThreadId -> Term a -> IO (Term a)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term a
a
  Term b
rb <- WeakThreadId -> Term b -> IO (Term b)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term b
b
  Term a -> Term b -> IO (Term c)
f Term a
ra Term b
rb
{-# INLINE inCurThread2 #-}

inCurThread3 ::
  forall a b c d.
  (Term a -> Term b -> Term c -> IO (Term d)) ->
  Term a ->
  Term b ->
  Term c ->
  IO (Term d)
inCurThread3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
inCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c = do
  WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
  Term a
ra <- WeakThreadId -> Term a -> IO (Term a)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term a
a
  Term b
rb <- WeakThreadId -> Term b -> IO (Term b)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term b
b
  Term c
rc <- WeakThreadId -> Term c -> IO (Term c)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term c
c
  Term a -> Term b -> Term c -> IO (Term d)
f Term a
ra Term b
rb Term c
rc
{-# INLINE inCurThread3 #-}

unsafeInCurThread1 ::
  forall a b.
  (Term a -> IO (Term b)) ->
  Term a ->
  Term b
unsafeInCurThread1 :: forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
f = IO (Term b) -> Term b
forall a. IO a -> a
unsafePerformIO (IO (Term b) -> Term b)
-> (Term a -> IO (Term b)) -> Term a -> Term b
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
forall a b. (Term a -> IO (Term b)) -> Term a -> IO (Term b)
inCurThread1 Term a -> IO (Term b)
f
{-# NOINLINE unsafeInCurThread1 #-}

unsafeInCurThread2 ::
  forall a b c.
  (Term a -> Term b -> IO (Term c)) ->
  Term a ->
  Term b ->
  Term c
unsafeInCurThread2 :: forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b = IO (Term c) -> Term c
forall a. IO a -> a
unsafePerformIO (IO (Term c) -> Term c) -> IO (Term c) -> Term c
forall a b. (a -> b) -> a -> b
$ (Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
forall a b c.
(Term a -> Term b -> IO (Term c))
-> Term a -> Term b -> IO (Term c)
inCurThread2 Term a -> Term b -> IO (Term c)
f Term a
a Term b
b
{-# NOINLINE unsafeInCurThread2 #-}

unsafeInCurThread3 ::
  forall a b c d.
  (Term a -> Term b -> Term c -> IO (Term d)) ->
  Term a ->
  Term b ->
  Term c ->
  Term d
unsafeInCurThread3 :: forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c = IO (Term d) -> Term d
forall a. IO a -> a
unsafePerformIO (IO (Term d) -> Term d) -> IO (Term d) -> Term d
forall a b. (a -> b) -> a -> b
$ (Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> IO (Term d)
inCurThread3 Term a -> Term b -> Term c -> IO (Term d)
f Term a
a Term b
b Term c
c
{-# NOINLINE unsafeInCurThread3 #-}

-- | Construct and internalizing a 'ConTerm'.
conTerm :: (SupportedPrim t) => t -> Term t
conTerm :: forall t. SupportedPrim t => t -> Term t
conTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t) -> (t -> IO (Term t)) -> t -> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. t -> IO (Term t)
forall t. SupportedPrim t => t -> IO (Term t)
curThreadConTerm
{-# NOINLINE conTerm #-}

-- | Construct and internalizing a 'SymTerm'.
symTerm :: TypedSymbol knd t -> Term t
symTerm :: forall (knd :: SymbolKind) t. TypedSymbol knd t -> Term t
symTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t)
-> (TypedSymbol knd t -> IO (Term t))
-> TypedSymbol knd t
-> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. TypedSymbol knd t -> IO (Term t)
forall (knd :: SymbolKind) t. TypedSymbol knd t -> IO (Term t)
curThreadSymTerm
{-# NOINLINE symTerm #-}

-- | Construct and internalizing a 'ForallTerm'.
forallTerm ::
  TypedSymbol 'ConstantKind t ->
  Term Bool ->
  Term Bool
forallTerm :: forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
forallTerm sym :: TypedSymbol 'ConstantKind t
sym@TypedSymbol {} = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadForallTerm TypedSymbol 'ConstantKind t
sym)
{-# NOINLINE forallTerm #-}

-- | Construct and internalizing a 'ExistsTerm'.
existsTerm ::
  TypedSymbol 'ConstantKind t ->
  Term Bool ->
  Term Bool
existsTerm :: forall t. TypedSymbol 'ConstantKind t -> Term Bool -> Term Bool
existsTerm sym :: TypedSymbol 'ConstantKind t
sym@TypedSymbol {} = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
forall t.
TypedSymbol 'ConstantKind t -> Term Bool -> IO (Term Bool)
curThreadExistsTerm TypedSymbol 'ConstantKind t
sym)
{-# NOINLINE existsTerm #-}

-- | Construct and internalizing a 'SymTerm' with an identifier, using simple
-- symbols.
ssymTerm :: (SupportedPrim t) => Identifier -> Term t
ssymTerm :: forall t. SupportedPrim t => Identifier -> Term t
ssymTerm = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t)
-> (Identifier -> IO (Term t)) -> Identifier -> Term t
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Identifier -> IO (Term t)
forall t. SupportedPrim t => Identifier -> IO (Term t)
curThreadSsymTerm
{-# NOINLINE ssymTerm #-}

-- | Construct and internalizing a 'SymTerm' with an identifier and an index,
-- using indexed symbols.
isymTerm :: (SupportedPrim t) => Identifier -> Int -> Term t
isymTerm :: forall t. SupportedPrim t => Identifier -> Int -> Term t
isymTerm Identifier
ident Int
index = IO (Term t) -> Term t
forall a. IO a -> a
unsafePerformIO (IO (Term t) -> Term t) -> IO (Term t) -> Term t
forall a b. (a -> b) -> a -> b
$ Identifier -> Int -> IO (Term t)
forall t. SupportedPrim t => Identifier -> Int -> IO (Term t)
curThreadIsymTerm Identifier
ident Int
index
{-# NOINLINE isymTerm #-}

-- | Construct and internalizing a 'NotTerm'.
notTerm :: Term Bool -> Term Bool
notTerm :: Term Bool -> Term Bool
notTerm = (Term Bool -> IO (Term Bool)) -> Term Bool -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term Bool -> IO (Term Bool)
curThreadNotTerm
{-# NOINLINE notTerm #-}

-- | Construct and internalizing a 'OrTerm'.
orTerm :: Term Bool -> Term Bool -> Term Bool
orTerm :: Term Bool -> Term Bool -> Term Bool
orTerm = (Term Bool -> Term Bool -> IO (Term Bool))
-> Term Bool -> Term Bool -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term Bool -> Term Bool -> IO (Term Bool)
curThreadOrTerm
{-# NOINLINE orTerm #-}

-- | Construct and internalizing a 'AndTerm'.
andTerm :: Term Bool -> Term Bool -> Term Bool
andTerm :: Term Bool -> Term Bool -> Term Bool
andTerm = (Term Bool -> Term Bool -> IO (Term Bool))
-> Term Bool -> Term Bool -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term Bool -> Term Bool -> IO (Term Bool)
curThreadAndTerm
{-# NOINLINE andTerm #-}

-- | Construct and internalizing a 'EqTerm'.
eqTerm :: Term a -> Term a -> Term Bool
eqTerm :: forall a. Term a -> Term a -> Term Bool
eqTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. Term a -> Term a -> IO (Term Bool)
curThreadEqTerm
{-# NOINLINE eqTerm #-}

-- | Construct and internalizing a 'DistinctTerm'.
distinctTerm :: NonEmpty (Term a) -> Term Bool
distinctTerm :: forall a. NonEmpty (Term a) -> Term Bool
distinctTerm NonEmpty (Term a)
args =
  IO (Term Bool) -> Term Bool
forall a. IO a -> a
unsafePerformIO (IO (Term Bool) -> Term Bool) -> IO (Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$ do
    WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
    (Term a -> IO (Term a))
-> NonEmpty (Term a) -> IO (NonEmpty (Term a))
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> NonEmpty a -> f (NonEmpty b)
traverse (WeakThreadId -> Term a -> IO (Term a)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid) NonEmpty (Term a)
args IO (NonEmpty (Term a))
-> (NonEmpty (Term a) -> IO (Term Bool)) -> IO (Term Bool)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= NonEmpty (Term a) -> IO (Term Bool)
forall a. NonEmpty (Term a) -> IO (Term Bool)
curThreadDistinctTerm
{-# NOINLINE distinctTerm #-}

-- | Construct and internalizing a 'ITETerm'.
iteTerm :: Term Bool -> Term a -> Term a -> Term a
iteTerm :: forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm = (Term Bool -> Term a -> Term a -> IO (Term a))
-> Term Bool -> Term a -> Term a -> Term a
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term Bool -> Term a -> Term a -> IO (Term a)
forall a. Term Bool -> Term a -> Term a -> IO (Term a)
curThreadIteTerm
{-# NOINLINE iteTerm #-}

-- | Construct and internalizing a 'AddNumTerm'.
addNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
addNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
addNumTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadAddNumTerm
{-# NOINLINE addNumTerm #-}

-- | Construct and internalizing a 'NegNumTerm'.
negNumTerm :: (PEvalNumTerm a) => Term a -> Term a
negNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
negNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadNegNumTerm
{-# NOINLINE negNumTerm #-}

-- | Construct and internalizing a 'MulNumTerm'.
mulNumTerm :: (PEvalNumTerm a) => Term a -> Term a -> Term a
mulNumTerm :: forall a. PEvalNumTerm a => Term a -> Term a -> Term a
mulNumTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> Term a -> IO (Term a)
curThreadMulNumTerm
{-# NOINLINE mulNumTerm #-}

-- | Construct and internalizing a 'AbsNumTerm'.
absNumTerm :: (PEvalNumTerm a) => Term a -> Term a
absNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
absNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadAbsNumTerm
{-# NOINLINE absNumTerm #-}

-- | Construct and internalizing a 'SignumNumTerm'.
signumNumTerm :: (PEvalNumTerm a) => Term a -> Term a
signumNumTerm :: forall t. PEvalNumTerm t => Term t -> Term t
signumNumTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalNumTerm a => Term a -> IO (Term a)
curThreadSignumNumTerm
{-# NOINLINE signumNumTerm #-}

-- | Construct and internalizing a 'LtOrdTerm'.
ltOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
ltOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
ltOrdTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLtOrdTerm
{-# NOINLINE ltOrdTerm #-}

-- | Construct and internalizing a 'LeOrdTerm'.
leOrdTerm :: (PEvalOrdTerm a) => Term a -> Term a -> Term Bool
leOrdTerm :: forall a. PEvalOrdTerm a => Term a -> Term a -> Term Bool
leOrdTerm = (Term a -> Term a -> IO (Term Bool))
-> Term a -> Term a -> Term Bool
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term Bool)
forall a. PEvalOrdTerm a => Term a -> Term a -> IO (Term Bool)
curThreadLeOrdTerm
{-# NOINLINE leOrdTerm #-}

-- | Construct and internalizing a 'AndBitsTerm'.
andBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
andBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
andBitsTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadAndBitsTerm
{-# NOINLINE andBitsTerm #-}

-- | Construct and internalizing a 'OrBitsTerm'.
orBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
orBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
orBitsTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadOrBitsTerm
{-# NOINLINE orBitsTerm #-}

-- | Construct and internalizing a 'XorBitsTerm'.
xorBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a -> Term a
xorBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a -> Term a
xorBitsTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> Term a -> IO (Term a)
curThreadXorBitsTerm
{-# NOINLINE xorBitsTerm #-}

-- | Construct and internalizing a 'ComplementBitsTerm'.
complementBitsTerm :: (PEvalBitwiseTerm a) => Term a -> Term a
complementBitsTerm :: forall a. PEvalBitwiseTerm a => Term a -> Term a
complementBitsTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalBitwiseTerm a => Term a -> IO (Term a)
curThreadComplementBitsTerm
{-# NOINLINE complementBitsTerm #-}

-- | Construct and internalizing a 'ShiftLeftTerm'.
shiftLeftTerm :: (PEvalShiftTerm a) => Term a -> Term a -> Term a
shiftLeftTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> Term a
shiftLeftTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftLeftTerm
{-# NOINLINE shiftLeftTerm #-}

-- | Construct and internalizing a 'ShiftRightTerm'.
shiftRightTerm :: (PEvalShiftTerm a) => Term a -> Term a -> Term a
shiftRightTerm :: forall a. PEvalShiftTerm a => Term a -> Term a -> Term a
shiftRightTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalShiftTerm a => Term a -> Term a -> IO (Term a)
curThreadShiftRightTerm
{-# NOINLINE shiftRightTerm #-}

-- | Construct and internalizing a 'RotateLeftTerm'.
rotateLeftTerm :: (PEvalRotateTerm a) => Term a -> Term a -> Term a
rotateLeftTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> Term a
rotateLeftTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateLeftTerm
{-# NOINLINE rotateLeftTerm #-}

-- | Construct and internalizing a 'RotateRightTerm'.
rotateRightTerm :: (PEvalRotateTerm a) => Term a -> Term a -> Term a
rotateRightTerm :: forall a. PEvalRotateTerm a => Term a -> Term a -> Term a
rotateRightTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalRotateTerm a => Term a -> Term a -> IO (Term a)
curThreadRotateRightTerm
{-# NOINLINE rotateRightTerm #-}

-- | Construct and internalizing a 'BitCastTerm'.
bitCastTerm ::
  (PEvalBitCastTerm a b, SupportedPrim b) =>
  Term a ->
  Term b
bitCastTerm :: forall a b.
(PEvalBitCastTerm a b, SupportedPrim b) =>
Term a -> Term b
bitCastTerm = (Term a -> IO (Term b)) -> Term a -> Term b
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
forall a b.
(SupportedPrim b, PEvalBitCastTerm a b) =>
Term a -> IO (Term b)
curThreadBitCastTerm
{-# NOINLINE bitCastTerm #-}

-- | Construct and internalizing a 'BitCastOrTerm'.
bitCastOrTerm ::
  (PEvalBitCastOrTerm a b) =>
  Term b ->
  Term a ->
  Term b
bitCastOrTerm :: forall a b. PEvalBitCastOrTerm a b => Term b -> Term a -> Term b
bitCastOrTerm = (Term b -> Term a -> IO (Term b)) -> Term b -> Term a -> Term b
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term b -> Term a -> IO (Term b)
forall a b.
PEvalBitCastOrTerm a b =>
Term b -> Term a -> IO (Term b)
curThreadBitCastOrTerm
{-# NOINLINE bitCastOrTerm #-}

-- | Construct and internalizing a 'BVConcatTerm'.
bvConcatTerm ::
  forall bv l r.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    KnownNat (l + r),
    1 <= l,
    1 <= r,
    1 <= l + r,
    SupportedPrim (bv (l + r))
  ) =>
  Term (bv l) ->
  Term (bv r) ->
  Term (bv (l + r))
bvConcatTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> Term (bv (l + r))
bvConcatTerm = (Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r))))
-> Term (bv l) -> Term (bv r) -> Term (bv (l + r))
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural).
(PEvalBVTerm bv, KnownNat l, KnownNat r, KnownNat (l + r), 1 <= l,
 1 <= r, 1 <= (l + r), SupportedPrim (bv (l + r))) =>
Term (bv l) -> Term (bv r) -> IO (Term (bv (l + r)))
curThreadBVConcatTerm
{-# NOINLINE bvConcatTerm #-}

-- | Construct and internalizing a 'BVSelectTerm'.
bvSelectTerm ::
  forall bv n ix w p q.
  ( PEvalBVTerm bv,
    KnownNat n,
    KnownNat ix,
    KnownNat w,
    1 <= n,
    1 <= w,
    ix + w <= n,
    SupportedPrim (bv w)
  ) =>
  p ix ->
  q w ->
  Term (bv n) ->
  Term (bv w)
bvSelectTerm :: forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> Term (bv w)
bvSelectTerm p ix
ix q w
w = (Term (bv n) -> IO (Term (bv w))) -> Term (bv n) -> Term (bv w)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (p ix -> q w -> Term (bv n) -> IO (Term (bv w))
forall (bv :: Natural -> *) (n :: Natural) (ix :: Natural)
       (w :: Natural) (p :: Natural -> *) (q :: Natural -> *).
(PEvalBVTerm bv, KnownNat n, KnownNat ix, KnownNat w, 1 <= n,
 1 <= w, (ix + w) <= n, SupportedPrim (bv w)) =>
p ix -> q w -> Term (bv n) -> IO (Term (bv w))
curThreadBVSelectTerm p ix
ix q w
w)
{-# NOINLINE bvSelectTerm #-}

-- | Construct and internalizing a 'BVExtendTerm'.
bvExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  Bool ->
  proxy r ->
  Term (bv l) ->
  Term (bv r)
bvExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> Term (bv r)
bvExtendTerm Bool
signed proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
Bool -> proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBVExtendTerm Bool
signed proxy r
r)
{-# NOINLINE bvExtendTerm #-}

-- | Construct and internalizing a 'BVExtendTerm' with sign extension.
bvsignExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  proxy r ->
  Term (bv l) ->
  Term (bv r)
bvsignExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> Term (bv r)
bvsignExtendTerm proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvsignExtendTerm proxy r
r)
{-# NOINLINE bvsignExtendTerm #-}

-- | Construct and internalizing a 'BVExtendTerm' with zero extension.
bvzeroExtendTerm ::
  forall bv l r proxy.
  ( PEvalBVTerm bv,
    KnownNat l,
    KnownNat r,
    1 <= l,
    1 <= r,
    l <= r,
    SupportedPrim (bv r)
  ) =>
  proxy r ->
  Term (bv l) ->
  Term (bv r)
bvzeroExtendTerm :: forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> Term (bv r)
bvzeroExtendTerm proxy r
r = (Term (bv l) -> IO (Term (bv r))) -> Term (bv l) -> Term (bv r)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (proxy r -> Term (bv l) -> IO (Term (bv r))
forall (bv :: Natural -> *) (l :: Natural) (r :: Natural)
       (proxy :: Natural -> *).
(PEvalBVTerm bv, KnownNat l, KnownNat r, 1 <= l, 1 <= r, l <= r,
 SupportedPrim (bv r)) =>
proxy r -> Term (bv l) -> IO (Term (bv r))
curThreadBvzeroExtendTerm proxy r
r)
{-# NOINLINE bvzeroExtendTerm #-}

-- | Construct and internalizing a 'ApplyTerm'.
applyTerm ::
  (PEvalApplyTerm f a b, SupportedPrim b) => Term f -> Term a -> Term b
applyTerm :: forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> Term b
applyTerm = (Term f -> Term a -> IO (Term b)) -> Term f -> Term a -> Term b
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term f -> Term a -> IO (Term b)
forall f a b.
(PEvalApplyTerm f a b, SupportedPrim b) =>
Term f -> Term a -> IO (Term b)
curThreadApplyTerm
{-# NOINLINE applyTerm #-}

-- | Construct and internalizing a 'DivIntegralTerm'.
divIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
divIntegralTerm :: forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
divIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadDivIntegralTerm
{-# NOINLINE divIntegralTerm #-}

-- | Construct and internalizing a 'ModIntegralTerm'.
modIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
modIntegralTerm :: forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
modIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadModIntegralTerm
{-# NOINLINE modIntegralTerm #-}

-- | Construct and internalizing a 'QuotIntegralTerm'.
quotIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
quotIntegralTerm :: forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
quotIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadQuotIntegralTerm
{-# NOINLINE quotIntegralTerm #-}

-- | Construct and internalizing a 'RemIntegralTerm'.
remIntegralTerm :: (PEvalDivModIntegralTerm a) => Term a -> Term a -> Term a
remIntegralTerm :: forall a. PEvalDivModIntegralTerm a => Term a -> Term a -> Term a
remIntegralTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a.
PEvalDivModIntegralTerm a =>
Term a -> Term a -> IO (Term a)
curThreadRemIntegralTerm
{-# NOINLINE remIntegralTerm #-}

-- | Construct and internalizing a 'FPTraitTerm'.
fpTraitTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPTrait ->
  Term (FP eb sb) ->
  Term Bool
fpTraitTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPTrait -> Term (FP eb sb) -> Term Bool
fpTraitTerm FPTrait
trait = (Term (FP eb sb) -> IO (Term Bool)) -> Term (FP eb sb) -> Term Bool
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FPTrait -> Term (FP eb sb) -> IO (Term Bool)
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPTrait -> Term (FP eb sb) -> IO (Term Bool)
curThreadFpTraitTerm FPTrait
trait)
{-# NOINLINE fpTraitTerm #-}

-- | Construct and internalizing a 'FdivTerm'.
fdivTerm :: (PEvalFractionalTerm a) => Term a -> Term a -> Term a
fdivTerm :: forall a. PEvalFractionalTerm a => Term a -> Term a -> Term a
fdivTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalFractionalTerm a => Term a -> Term a -> IO (Term a)
curThreadFdivTerm
{-# NOINLINE fdivTerm #-}

-- | Construct and internalizing a 'RecipTerm'.
recipTerm :: (PEvalFractionalTerm a) => Term a -> Term a
recipTerm :: forall a. PEvalFractionalTerm a => Term a -> Term a
recipTerm = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term a)
forall a. PEvalFractionalTerm a => Term a -> IO (Term a)
curThreadRecipTerm
{-# NOINLINE recipTerm #-}

-- | Construct and internalizing a 'FloatingUnaryTerm'.
floatingUnaryTerm :: (PEvalFloatingTerm a) => FloatingUnaryOp -> Term a -> Term a
floatingUnaryTerm :: forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> Term a
floatingUnaryTerm FloatingUnaryOp
op = (Term a -> IO (Term a)) -> Term a -> Term a
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FloatingUnaryOp -> Term a -> IO (Term a)
forall a.
PEvalFloatingTerm a =>
FloatingUnaryOp -> Term a -> IO (Term a)
curThreadFloatingUnaryTerm FloatingUnaryOp
op)
{-# NOINLINE floatingUnaryTerm #-}

-- | Construct and internalizing a 'PowerTerm'.
powerTerm :: (PEvalFloatingTerm a) => Term a -> Term a -> Term a
powerTerm :: forall a. PEvalFloatingTerm a => Term a -> Term a -> Term a
powerTerm = (Term a -> Term a -> IO (Term a)) -> Term a -> Term a -> Term a
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term a -> Term a -> IO (Term a)
forall a. PEvalFloatingTerm a => Term a -> Term a -> IO (Term a)
curThreadPowerTerm
{-# NOINLINE powerTerm #-}

-- | Construct and internalizing a 'FPUnaryTerm'.
fpUnaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPUnaryOp ->
  Term (FP eb sb) ->
  Term (FP eb sb)
fpUnaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPUnaryOp -> Term (FP eb sb) -> Term (FP eb sb)
fpUnaryTerm FPUnaryOp
op = (Term (FP eb sb) -> IO (Term (FP eb sb)))
-> Term (FP eb sb) -> Term (FP eb sb)
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 (FPUnaryOp -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPUnaryOp -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpUnaryTerm FPUnaryOp
op)
{-# NOINLINE fpUnaryTerm #-}

-- | Construct and internalizing a 'FPBinaryTerm'.
fpBinaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPBinaryOp ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
fpBinaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPBinaryOp -> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
fpBinaryTerm FPBinaryOp
op = (Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb)))
-> Term (FP eb sb) -> Term (FP eb sb) -> Term (FP eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 (FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPBinaryOp
-> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpBinaryTerm FPBinaryOp
op)
{-# NOINLINE fpBinaryTerm #-}

-- | Construct and internalizing a 'FPRoundingUnaryTerm'.
fpRoundingUnaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPRoundingUnaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb)
fpRoundingUnaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> Term (FP eb sb)
fpRoundingUnaryTerm FPRoundingUnaryOp
op = (Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb)))
-> Term FPRoundingMode -> Term (FP eb sb) -> Term (FP eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 (FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingUnaryOp
-> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term (FP eb sb))
curThreadFpRoundingUnaryTerm FPRoundingUnaryOp
op)
{-# NOINLINE fpRoundingUnaryTerm #-}

-- | Construct and internalizing a 'FPRoundingBinaryTerm'.
fpRoundingBinaryTerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  FPRoundingBinaryOp ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
fpRoundingBinaryTerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
fpRoundingBinaryTerm FPRoundingBinaryOp
op = (Term FPRoundingMode
 -> Term (FP eb sb) -> Term (FP eb sb) -> IO (Term (FP eb sb)))
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 (FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
FPRoundingBinaryOp
-> Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpRoundingBinaryTerm FPRoundingBinaryOp
op)
{-# NOINLINE fpRoundingBinaryTerm #-}

-- | Construct and internalizing a 'FPFMATerm'.
fpFMATerm ::
  (ValidFP eb sb, SupportedPrim (FP eb sb)) =>
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb) ->
  Term (FP eb sb)
fpFMATerm :: forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
fpFMATerm Term FPRoundingMode
mode Term (FP eb sb)
a Term (FP eb sb)
b Term (FP eb sb)
c = IO (Term (FP eb sb)) -> Term (FP eb sb)
forall a. IO a -> a
unsafePerformIO (IO (Term (FP eb sb)) -> Term (FP eb sb))
-> IO (Term (FP eb sb)) -> Term (FP eb sb)
forall a b. (a -> b) -> a -> b
$ do
  WeakThreadId
tid <- IO WeakThreadId
myWeakThreadId
  Term FPRoundingMode
mode' <- WeakThreadId -> Term FPRoundingMode -> IO (Term FPRoundingMode)
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term FPRoundingMode
mode
  Term (FP eb sb)
a' <- WeakThreadId -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term (FP eb sb)
a
  Term (FP eb sb)
b' <- WeakThreadId -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term (FP eb sb)
b
  Term (FP eb sb)
c' <- WeakThreadId -> Term (FP eb sb) -> IO (Term (FP eb sb))
forall t. WeakThreadId -> Term t -> IO (Term t)
toCurThreadImpl WeakThreadId
tid Term (FP eb sb)
c
  Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
forall (eb :: Natural) (sb :: Natural).
(ValidFP eb sb, SupportedPrim (FP eb sb)) =>
Term FPRoundingMode
-> Term (FP eb sb)
-> Term (FP eb sb)
-> Term (FP eb sb)
-> IO (Term (FP eb sb))
curThreadFpFMATerm Term FPRoundingMode
mode' Term (FP eb sb)
a' Term (FP eb sb)
b' Term (FP eb sb)
c'
{-# NOINLINE fpFMATerm #-}

-- | Construct and internalizing a 'FromIntegralTerm'.
fromIntegralTerm ::
  (PEvalFromIntegralTerm a b, SupportedPrim b) => Term a -> Term b
fromIntegralTerm :: forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> Term b
fromIntegralTerm = (Term a -> IO (Term b)) -> Term a -> Term b
forall a b. (Term a -> IO (Term b)) -> Term a -> Term b
unsafeInCurThread1 Term a -> IO (Term b)
forall a b.
(PEvalFromIntegralTerm a b, SupportedPrim b) =>
Term a -> IO (Term b)
curThreadFromIntegralTerm
{-# NOINLINE fromIntegralTerm #-}

-- | Construct and internalizing a 'FromFPOrTerm'.
fromFPOrTerm ::
  ( PEvalIEEEFPConvertibleTerm a,
    ValidFP eb sb
  ) =>
  Term a ->
  Term FPRoundingMode ->
  Term (FP eb sb) ->
  Term a
fromFPOrTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
fromFPOrTerm = (Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a))
-> Term a -> Term FPRoundingMode -> Term (FP eb sb) -> Term a
forall a b c d.
(Term a -> Term b -> Term c -> IO (Term d))
-> Term a -> Term b -> Term c -> Term d
unsafeInCurThread3 Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb) =>
Term a -> Term FPRoundingMode -> Term (FP eb sb) -> IO (Term a)
curThreadFromFPOrTerm
{-# NOINLINE fromFPOrTerm #-}

-- | Construct and internalizing a 'ToFPTerm'.
toFPTerm ::
  forall a eb sb.
  ( PEvalIEEEFPConvertibleTerm a,
    ValidFP eb sb,
    SupportedPrim (FP eb sb)
  ) =>
  Term FPRoundingMode ->
  Term a ->
  Term (FP eb sb)
toFPTerm :: forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> Term (FP eb sb)
toFPTerm = (Term FPRoundingMode -> Term a -> IO (Term (FP eb sb)))
-> Term FPRoundingMode -> Term a -> Term (FP eb sb)
forall a b c.
(Term a -> Term b -> IO (Term c)) -> Term a -> Term b -> Term c
unsafeInCurThread2 Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
forall a (eb :: Natural) (sb :: Natural).
(PEvalIEEEFPConvertibleTerm a, ValidFP eb sb,
 SupportedPrim (FP eb sb)) =>
Term FPRoundingMode -> Term a -> IO (Term (FP eb sb))
curThreadToFPTerm
{-# NOINLINE toFPTerm #-}

-- Support for boolean type
defaultValueForBool :: Bool
defaultValueForBool :: Bool
defaultValueForBool = Bool
False

-- | Construct and internalizing 'True' term.
trueTerm :: Term Bool
trueTerm :: Term Bool
trueTerm = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
{-# NOINLINE trueTerm #-}

-- | Construct and internalizing 'False' term.
falseTerm :: Term Bool
falseTerm :: Term Bool
falseTerm = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
False
{-# NOINLINE falseTerm #-}

boolConTermView :: forall a. Term a -> Maybe Bool
boolConTermView :: forall a. Term a -> Maybe Bool
boolConTermView (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ a
b) = forall a b. SupportedPrim a => (Typeable a => b) -> b
withSupportedPrimTypeable @a ((Typeable a => Maybe Bool) -> Maybe Bool)
-> (Typeable a => Maybe Bool) -> Maybe Bool
forall a b. (a -> b) -> a -> b
$ a -> Maybe Bool
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast a
b
boolConTermView Term a
_ = Maybe Bool
forall a. Maybe a
Nothing
{-# INLINE boolConTermView #-}

-- | Pattern matcher for concrete 'Bool' terms.
pattern BoolConTerm :: Bool -> Term a
pattern $mBoolConTerm :: forall {r} {a}. Term a -> (Bool -> r) -> ((# #) -> r) -> r
BoolConTerm b <- (boolConTermView -> Just b)

-- | Pattern matcher for 'True' term.
pattern TrueTerm :: Term a
pattern $mTrueTerm :: forall {r} {a}. Term a -> ((# #) -> r) -> ((# #) -> r) -> r
TrueTerm <- BoolConTerm True

-- | Pattern matcher for 'False' term.
pattern FalseTerm :: Term a
pattern $mFalseTerm :: forall {r} {a}. Term a -> ((# #) -> r) -> ((# #) -> r) -> r
FalseTerm <- BoolConTerm False

boolTermView :: forall a. Term a -> Maybe (Term Bool)
boolTermView :: forall a. Term a -> Maybe (Term Bool)
boolTermView Term a
t = Term a
-> ((SupportedPrim a, Typeable a) => Maybe (Term Bool))
-> Maybe (Term Bool)
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term a
t (((SupportedPrim a, Typeable a) => Maybe (Term Bool))
 -> Maybe (Term Bool))
-> ((SupportedPrim a, Typeable a) => Maybe (Term Bool))
-> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term a -> Maybe (Term Bool)
forall a b. (Typeable a, Typeable b) => a -> Maybe b
cast Term a
t
{-# INLINE boolTermView #-}

-- | Pattern matcher for 'Bool' terms.
pattern BoolTerm :: Term Bool -> Term a
pattern $mBoolTerm :: forall {r} {a}. Term a -> (Term Bool -> r) -> ((# #) -> r) -> r
BoolTerm b <- (boolTermView -> Just b)

-- | Partial evaluation for not terms.
pevalNotTerm :: Term Bool -> Term Bool
pevalNotTerm :: Term Bool -> Term Bool
pevalNotTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
tm) = Term Bool
tm
pevalNotTerm (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
a) = if Bool
a then Term Bool
falseTerm else Term Bool
trueTerm
pevalNotTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1) Term Bool
n2) = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
n1 (Term Bool -> Term Bool
pevalNotTerm Term Bool
n2)
pevalNotTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
n1 :| [Term t
n2])) Term Bool
n3) =
  Term t -> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
n1 (((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool)
-> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
    Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n1 Term t
n2) (Term Bool -> Term Bool
pevalNotTerm Term Bool
n3)
pevalNotTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1 (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n2)) = Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) Term Bool
n2
pevalNotTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1 (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
n2 :| [Term t
n3]))) =
  Term t -> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
n2 (((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool)
-> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
    Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n2 Term t
n3)
pevalNotTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1) Term Bool
n2) = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
n1 (Term Bool -> Term Bool
pevalNotTerm Term Bool
n2)
pevalNotTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
n1 :| [Term t
n2])) Term Bool
n3) =
  Term t -> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
n1 (((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool)
-> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
    Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n1 Term t
n2) (Term Bool -> Term Bool
pevalNotTerm Term Bool
n3)
pevalNotTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1 (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n2)) = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) Term Bool
n2
pevalNotTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
n1 (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
n2 :| [Term t
n3]))) =
  Term t -> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall t a. Term t -> ((SupportedPrim t, Typeable t) => a) -> a
introSupportedPrimConstraint Term t
n2 (((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool)
-> ((SupportedPrim t, Typeable t) => Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
    Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
n1) (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$
      Term t -> Term t -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term t
n2 Term t
n3
pevalNotTerm (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term t
a Term t
b) = NonEmpty (Term t) -> Term Bool
forall a. NonEmpty (Term a) -> Term Bool
distinctTerm (NonEmpty (Term t) -> Term Bool) -> NonEmpty (Term t) -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term t
a Term t -> [Term t] -> NonEmpty (Term t)
forall a. a -> [a] -> NonEmpty a
:| [Term t
b]
pevalNotTerm (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
a :| [Term t
b])) = Term t -> Term t -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term t
a Term t
b
pevalNotTerm Term Bool
tm = Term Bool -> Term Bool
notTerm Term Bool
tm
{-# INLINEABLE pevalNotTerm #-}

orEqFirst :: Term Bool -> Term Bool -> Bool
orEqFirst :: Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
False) = Bool
True
orEqFirst
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((Term t
e1 :: Term a) :| [ec1 :: Term t
ec1@ConTerm {} :: Term b]))
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
-- orEqFirst
--   (NotTerm _ (EqTerm _ (e1 :: Term a) (ec1@(ConTerm _ _ _) :: Term b)))
--   (EqTerm _ (Dyn (e2 :: Term a)) (Dyn (ec2@(ConTerm _ _ _) :: Term b)))
--     | e1 == e2 && ec1 /= ec2 = True
orEqFirst Term Bool
x Term Bool
y
  | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
  | Bool
otherwise = Bool
False
{-# INLINE orEqFirst #-}

orEqTrue :: Term Bool -> Term Bool -> Bool
orEqTrue :: Term Bool -> Term Bool -> Bool
orEqTrue (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
True) ~Term Bool
_ = Bool
True
orEqTrue Term Bool
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
True) = Bool
True
-- orEqTrue (NotTerm _ e1) (NotTerm _ e2) = andEqFalse e1 e2
orEqTrue
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((Term t
e1 :: Term a) :| [ec1 :: Term t
ec1@ConTerm {} :: Term b]))
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
-- orEqTrue
--   (NotTerm _ (EqTerm _ (e1 :: Term a) (ec1@(ConTerm _ _ _ _) :: Term b)))
--   (NotTerm _ (EqTerm _ (Dyn (e2 :: Term a)) (Dyn (ec2@(ConTerm _ _ _ _) :: Term b))))
--     | e1 == e2 && ec1 /= ec2 = True
orEqTrue (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l) Term Bool
r | Term Bool
l Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r = Bool
True
orEqTrue Term Bool
l (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
r) | Term Bool
l Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
r = Bool
True
orEqTrue Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE orEqTrue #-}

andEqFirst :: Term Bool -> Term Bool -> Bool
andEqFirst :: Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
True) = Bool
True
-- andEqFirst x (NotTerm _ y) = andEqFalse x y
andEqFirst
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
-- andEqFirst
--   (EqTerm _ (e1 :: Term a) (ec1@(ConTerm _ _ _ _) :: Term b))
--   (NotTerm _ (EqTerm _ (Dyn (e2 :: Term a)) (Dyn (ec2@(ConTerm _ _ _ _) :: Term b))))
--     | e1 == e2 && ec1 /= ec2 = True
andEqFirst Term Bool
x Term Bool
y
  | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
  | Bool
otherwise = Bool
False
{-# INLINE andEqFirst #-}

andEqFalse :: Term Bool -> Term Bool -> Bool
andEqFalse :: Term Bool -> Term Bool -> Bool
andEqFalse (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
False) ~Term Bool
_ = Bool
True
andEqFalse Term Bool
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
False) = Bool
True
-- andEqFalse (NotTerm _ e1) (NotTerm _ e2) = orEqTrue e1 e2
andEqFalse
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
andEqFalse (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
x) Term Bool
y | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
andEqFalse Term Bool
x (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
y) | Term Bool
x Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
y = Bool
True
andEqFalse Term Bool
_ Term Bool
_ = Bool
False
{-# INLINE andEqFalse #-}

-- | Partial evaluation for or terms.
pevalOrTerm :: Term Bool -> Term Bool -> Term Bool
pevalOrTerm :: Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l ~Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r = Term Bool
trueTerm
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l = Term Bool
r
pevalOrTerm Term Bool
l r :: Term Bool
r@(OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
r1 Term Bool
r2)
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r1 = Term Bool
trueTerm
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r2 = Term Bool
trueTerm
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r1 Term Bool
l = Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r2 Term Bool
l = Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r2
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r1
pevalOrTerm l :: Term Bool
l@(OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1 Term Bool
l2) Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l1 Term Bool
r = Term Bool
trueTerm
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l2 Term Bool
r = Term Bool
trueTerm
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l1 Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l2 Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r
pevalOrTerm Term Bool
l (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
r1 Term Bool
r2)
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r1 = Term Bool
l
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
l Term Bool
r2 = Term Bool
l
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r2
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l Term Bool
r1
pevalOrTerm (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1 Term Bool
l2) Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l1 = Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqFirst Term Bool
r Term Bool
l2 = Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l1 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l2 Term Bool
r
  | Term Bool -> Term Bool -> Bool
orEqTrue Term Bool
l2 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
l1 Term Bool
r
pevalOrTerm
  (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ nl1 :: Term Bool
nl1@(NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1) Term Bool
l2)
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DynTerm (Term Bool
e1 :: Term Bool)) (DynTerm (Term Bool
e2 :: Term Bool)))
    | Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e1 Bool -> Bool -> Bool
&& Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e2 = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
nl1 Term Bool
l2
pevalOrTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nl) (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nr) =
  Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
nl Term Bool
nr
pevalOrTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
orTerm Term Bool
l Term Bool
r
{-# INLINEABLE pevalOrTerm #-}

-- | Partial evaluation for and terms.
pevalAndTerm :: Term Bool -> Term Bool -> Term Bool
pevalAndTerm :: Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l ~Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r = Term Bool
falseTerm
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l = Term Bool
r
pevalAndTerm Term Bool
l r :: Term Bool
r@(AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
r1 Term Bool
r2)
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r1 = Term Bool
falseTerm
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r2 = Term Bool
falseTerm
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r1 Term Bool
l = Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r2 Term Bool
l = Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r2
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r1
pevalAndTerm l :: Term Bool
l@(AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1 Term Bool
l2) Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l1 Term Bool
r = Term Bool
falseTerm
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l2 Term Bool
r = Term Bool
falseTerm
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l1 Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l2 Term Bool
r = Term Bool
l
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r
pevalAndTerm Term Bool
l (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
r1 Term Bool
r2)
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r1 = Term Bool
l
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
l Term Bool
r2 = Term Bool
l
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r1 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r2
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l Term Bool
r2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l Term Bool
r1
pevalAndTerm (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1 Term Bool
l2) Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l1 = Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFirst Term Bool
r Term Bool
l2 = Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l1 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l2 Term Bool
r
  | Term Bool -> Term Bool -> Bool
andEqFalse Term Bool
l2 Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
r
pevalAndTerm
  (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l1 nl2 :: Term Bool
nl2@(NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
l2))
  (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DynTerm (Term Bool
e1 :: Term Bool)) (DynTerm (Term Bool
e2 :: Term Bool))))
    | Term Bool
l1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e1 Bool -> Bool -> Bool
&& Term Bool
l2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
e2 = Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l1 Term Bool
nl2
pevalAndTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nl) (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nr) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
nl Term Bool
nr
pevalAndTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
andTerm Term Bool
l Term Bool
r
{-# INLINEABLE pevalAndTerm #-}

-- | Partial evaluation for imply terms.
pevalImplyTerm :: Term Bool -> Term Bool -> Term Bool
pevalImplyTerm :: Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
l = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
l)

-- | Partial evaluation for xor terms.
pevalXorTerm :: Term Bool -> Term Bool -> Term Bool
pevalXorTerm :: Term Bool -> Term Bool -> Term Bool
pevalXorTerm Term Bool
l Term Bool
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
l) Term Bool
r) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
l (Term Bool -> Term Bool
pevalNotTerm Term Bool
r))

pevalImpliesTerm :: Term Bool -> Term Bool -> Bool
pevalImpliesTerm :: Term Bool -> Term Bool -> Bool
pevalImpliesTerm (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
False) Term Bool
_ = Bool
True
pevalImpliesTerm Term Bool
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
True) = Bool
True
pevalImpliesTerm
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((DynTerm (Term t
e2 :: Term a)) :| [(DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b))]))
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Bool
True
-- pevalImpliesTerm
--   (EqTerm _ (e1 :: Term a) (ec1@(ConTerm _ _ _ _) :: Term b))
--   (NotTerm _ (EqTerm _ (Dyn (e2 :: Term a)) (Dyn (ec2@(ConTerm _ _ _ _) :: Term b))))
--     | e1 == e2 && ec1 /= ec2 = True
pevalImpliesTerm Term Bool
a Term Bool
b
  | Term Bool
a Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
b = Bool
True
  | Bool
otherwise = Bool
False
{-# INLINE pevalImpliesTerm #-}

pevalITEBoolLeftNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot Term Bool
cond Term Bool
nIfTrue Term Bool
ifFalse
  -- need test
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nIfTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
  | Bool
otherwise = case Term Bool
nIfTrue of
      AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nt1 Term Bool
nt2 -> Maybe (Term Bool)
ra
        where
          ra :: Maybe (Term Bool)
ra
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond Term Bool
nt1 =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) Term Bool
ifFalse
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond Term Bool
nt2 =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) Term Bool
ifFalse
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1)
                Bool -> Bool -> Bool
|| Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
            | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
      OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nt1 Term Bool
nt2 -> Maybe (Term Bool)
ra
        where
          ra :: Maybe (Term Bool)
ra
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond Term Bool
nt1 Bool -> Bool -> Bool
|| Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond Term Bool
nt2 =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) Term Bool
ifFalse
            | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt2) =
                Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
nt1) Term Bool
ifFalse
            | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
      Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolBothNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse =
  Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse

pevalITEBoolRightNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot Term Bool
cond Term Bool
ifTrue Term Bool
nIfFalse
  -- need test
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nIfFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifTrue
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing -- need work

pevalInferImplies :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nt1) Term Bool
_ Term Bool
falseRes
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
nt1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
falseRes
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing
-- \| otherwise = case (cond, nt1) of
--     ( EqTerm _ (e1 :: Term a) (ec1@(ConTerm _ _ _ _) :: Term b),
--       EqTerm _ (Dyn (e2 :: Term a)) (Dyn (ec2@(ConTerm _ _ _ _) :: Term b))
--       )
--         | e1 == e2 && ec1 /= ec2 -> Just trueRes
--     _ -> Nothing
pevalInferImplies
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
  (DistinctTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ ((DynTerm (Term t
e2 :: Term a)) :| [DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)]))
  Term Bool
trueRes
  Term Bool
_
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
trueRes
pevalInferImplies
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (Term t
e1 :: Term a) (ec1 :: Term t
ec1@ConTerm {} :: Term b))
  (EqTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (DynTerm (Term t
e2 :: Term a)) (DynTerm (ec2 :: Term t
ec2@ConTerm {} :: Term b)))
  Term Bool
_
  Term Bool
falseRes
    | Term t
e1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
== Term t
e2 Bool -> Bool -> Bool
&& Term t
ec1 Term t -> Term t -> Bool
forall a. Eq a => a -> a -> Bool
/= Term t
ec2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just Term Bool
falseRes
pevalInferImplies Term Bool
_ Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolLeftAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
cond Term Bool
t2
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalImplyTerm Term Bool
cond Term Bool
t1
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse
  | Bool
otherwise =
      [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
        [ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t1 (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse),
          Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t2 (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse)
        ]

pevalITEBoolBothAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothAnd :: Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f2
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f1
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f2
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f1
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolRightAnd :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
  | Term Bool
f1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
f1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
f2
  | Term Bool
f2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
f2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
f1
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolLeftOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
t2
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
t1
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
t2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
  | Bool
otherwise =
      [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
        [ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t1 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
ifFalse),
          Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalInferImplies Term Bool
cond Term Bool
t2 (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse) (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
ifFalse)
        ]

pevalITEBoolBothOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothOr :: Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f2
  | Term Bool
t1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t2 Term Bool
f1
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f1 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f2
  | Term Bool
t2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
f2 = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
t2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool -> Term Bool
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term Bool
t1 Term Bool
f1
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolRightOr :: Term Bool -> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr :: Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
  | Term Bool
f1 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
f1 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
f2
  | Term Bool
f2 Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
f2 (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
f1
  | Bool
otherwise = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft Term Bool
cond (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t1 Term Bool
t2) Term Bool
ifFalse =
  [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
    [ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse,
      case Term Bool
ifFalse of
        AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
f1 Term Bool
f2 -> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothAnd Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
        Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
    ]
pevalITEBoolLeft Term Bool
cond (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
t1 Term Bool
t2) Term Bool
ifFalse =
  [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
    [ Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
ifFalse,
      case Term Bool
ifFalse of
        OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
f1 Term Bool
f2 -> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Term Bool
-> Maybe (Term Bool)
pevalITEBoolBothOr Term Bool
cond Term Bool
t1 Term Bool
t2 Term Bool
f1 Term Bool
f2
        Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
    ]
pevalITEBoolLeft Term Bool
cond (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nIfTrue) Term Bool
ifFalse =
  [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
    [ Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeftNot Term Bool
cond Term Bool
nIfTrue Term Bool
ifFalse,
      case Term Bool
ifFalse of
        NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nIfFalse ->
          Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBothNot Term Bool
cond Term Bool
nIfTrue Term Bool
nIfFalse
        Term Bool
_ -> Maybe (Term Bool)
forall a. Maybe a
Nothing
    ]
pevalITEBoolLeft Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBoolNoLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (AndTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
f1 Term Bool
f2) = Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightAnd Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (OrTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
f1 Term Bool
f2) = Term Bool
-> Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightOr Term Bool
cond Term Bool
ifTrue Term Bool
f1 Term Bool
f2
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
nIfFalse) = Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolRightNot Term Bool
cond Term Bool
ifTrue Term Bool
nIfFalse
pevalITEBoolNoLeft Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing

-- | Basic partial evaluation for ITE terms.
pevalITEBasic :: (SupportedPrim a) => Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic :: forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
True) ~Term a
ifTrue ~Term a
_ = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifTrue
pevalITEBasic (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
False) ~Term a
_ ~Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifFalse
pevalITEBasic (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
ncond) Term a
ifTrue Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
ncond Term a
ifFalse Term a
ifTrue
pevalITEBasic Term Bool
_ Term a
ifTrue Term a
ifFalse | Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just Term a
ifTrue
pevalITEBasic (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
cc Term Bool
ct Term Bool
cf) (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
tc Term a
tt Term a
tf) (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
fc Term a
ft Term a
ff) -- later
  | Term Bool
cc Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
tc Bool -> Bool -> Bool
&& Term Bool
cc Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
fc = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cc (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
ct Term a
tt Term a
ft) (Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cf Term a
tf Term a
ff)
pevalITEBasic Term Bool
cond (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
tc Term a
tt Term a
tf) Term a
ifFalse -- later
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
tc = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
tt Term a
ifFalse
  | Term a
tt Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
tc) Term a
tt Term a
tf
  | Term a
tf Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ifFalse = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
tc) Term a
tt Term a
tf
pevalITEBasic Term Bool
cond Term a
ifTrue (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
fc Term a
ft Term a
ff) -- later
  | Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ft = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
fc) Term a
ifTrue Term a
ff
  | Term a
ifTrue Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
ff = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm (Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond (Term Bool -> Term Bool
pevalNotTerm Term Bool
fc)) Term a
ifTrue Term a
ft
  | Term Bool -> Term Bool -> Bool
pevalImpliesTerm Term Bool
fc Term Bool
cond = Term a -> Maybe (Term a)
forall a. a -> Maybe a
Just (Term a -> Maybe (Term a)) -> Term a -> Maybe (Term a)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term a -> Term a -> Term a
forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITETerm Term Bool
cond Term a
ifTrue Term a
ff
pevalITEBasic Term Bool
_ Term a
_ Term a
_ = Maybe (Term a)
forall a. Maybe a
Nothing

pevalITEBoolBasic :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifTrue = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
  | Term Bool
cond Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term Bool
ifFalse = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
ifTrue
pevalITEBoolBasic Term Bool
cond (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
v) Term Bool
ifFalse
  | Bool
v = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
cond Term Bool
ifFalse
  | Bool
otherwise = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifFalse
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Bool
v)
  | Bool
v = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
cond) Term Bool
ifTrue
  | Bool
otherwise = Term Bool -> Maybe (Term Bool)
forall a. a -> Maybe a
Just (Term Bool -> Maybe (Term Bool)) -> Term Bool -> Maybe (Term Bool)
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
pevalAndTerm Term Bool
cond Term Bool
ifTrue
pevalITEBoolBasic Term Bool
_ Term Bool
_ Term Bool
_ = Maybe (Term Bool)
forall a. Maybe a
Nothing

pevalITEBool :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool :: Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool Term Bool
cond ~Term Bool
ifTrue ~Term Bool
ifFalse =
  [Maybe (Term Bool)] -> Maybe (Term Bool)
forall (t :: * -> *) (m :: * -> *) a.
(Foldable t, MonadPlus m) =>
t (m a) -> m a
msum
    [ Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
      Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolBasic Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
      Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolLeft Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse,
      Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBoolNoLeft Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
    ]

-- | Basic partial evaluation for ITE terms.
pevalITEBasicTerm :: (SupportedPrim a) => Term Bool -> Term a -> Term a -> Term a
pevalITEBasicTerm :: forall t.
SupportedPrim t =>
Term Bool -> Term t -> Term t -> Term t
pevalITEBasicTerm Term Bool
cond ~Term a
ifTrue ~Term a
ifFalse =
  Term a -> Maybe (Term a) -> Term a
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term a -> Term a -> Term a
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term a
ifTrue Term a
ifFalse) (Maybe (Term a) -> Term a) -> Maybe (Term a) -> Term a
forall a b. (a -> b) -> a -> b
$
    Term Bool -> Term a -> Term a -> Maybe (Term a)
forall a.
SupportedPrim a =>
Term Bool -> Term a -> Term a -> Maybe (Term a)
pevalITEBasic Term Bool
cond Term a
ifTrue Term a
ifFalse

-- | Default partial evaluation for equality terms.
pevalDefaultEqTerm :: (SupportedNonFuncPrim a) => Term a -> Term a -> Term Bool
pevalDefaultEqTerm :: forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm l :: Term a
l@ConTerm {} r :: Term a
r@ConTerm {} = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm (Bool -> Term Bool) -> Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r
pevalDefaultEqTerm l :: Term a
l@ConTerm {} Term a
r = Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
r Term a
l
pevalDefaultEqTerm Term a
l (BoolConTerm Bool
rv) =
  if Bool
rv
    then Term a -> Term Bool
forall a b. a -> b
unsafeCoerce Term a
l
    else Term Bool -> Term Bool
pevalNotTerm (Term a -> Term Bool
forall a b. a -> b
unsafeCoerce Term a
l)
pevalDefaultEqTerm (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
lv) Term a
r
  | Term Bool
lv Term Bool -> Term Bool -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
Term Bool
r = Term Bool
falseTerm
pevalDefaultEqTerm Term a
l (NotTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
rv)
  | Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
Term Bool
rv = Term Bool
falseTerm
pevalDefaultEqTerm (AddNumTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ a
c) Term a
v) (ConTerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ a
c2) =
  Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
v (a -> Term a
forall t. SupportedPrim t => t -> Term t
conTerm (a -> Term a) -> a -> Term a
forall a b. (a -> b) -> a -> b
$ a
c2 a -> a -> a
forall a. Num a => a -> a -> a
- a
c)
pevalDefaultEqTerm Term a
l (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
c Term a
t Term a
f)
  | Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
t = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
c (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
l Term a
f)
  | Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
f = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
c) (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
l Term a
t)
pevalDefaultEqTerm (ITETerm WeakThreadId
_ Digest
_ Digest
_ Ident
_ Term Bool
c Term a
t Term a
f) Term a
r
  | Term a
t Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm Term Bool
c (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
f Term a
r)
  | Term a
f Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool -> Term Bool -> Term Bool
pevalOrTerm (Term Bool -> Term Bool
pevalNotTerm Term Bool
c) (Term a -> Term a -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm Term a
t Term a
r)
pevalDefaultEqTerm Term a
l Term a
r
  | Term a
l Term a -> Term a -> Bool
forall a. Eq a => a -> a -> Bool
== Term a
r = Term Bool
trueTerm
  | Bool
otherwise = Term a -> Term a -> Term Bool
forall a. Term a -> Term a -> Term Bool
eqTerm Term a
l Term a
r
{-# INLINEABLE pevalDefaultEqTerm #-}

instance SBVRep Bool where
  type SBVType Bool = SBV.SBV Bool

instance SupportedPrimConstraint Bool

instance SupportedPrim Bool where
  pformatCon :: Bool -> String
pformatCon Bool
True = String
"true"
  pformatCon Bool
False = String
"false"
  defaultValue :: Bool
defaultValue = Bool
defaultValueForBool
  pevalITETerm :: Term Bool -> Term Bool -> Term Bool -> Term Bool
pevalITETerm Term Bool
cond ~Term Bool
ifTrue ~Term Bool
ifFalse =
    Term Bool -> Maybe (Term Bool) -> Term Bool
forall a. a -> Maybe a -> a
fromMaybe (Term Bool -> Term Bool -> Term Bool -> Term Bool
forall a. Term Bool -> Term a -> Term a -> Term a
iteTerm Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse) (Maybe (Term Bool) -> Term Bool) -> Maybe (Term Bool) -> Term Bool
forall a b. (a -> b) -> a -> b
$
      Term Bool -> Term Bool -> Term Bool -> Maybe (Term Bool)
pevalITEBool Term Bool
cond Term Bool
ifTrue Term Bool
ifFalse
  pevalEqTerm :: Term Bool -> Term Bool -> Term Bool
pevalEqTerm = Term Bool -> Term Bool -> Term Bool
forall a. SupportedNonFuncPrim a => Term a -> Term a -> Term Bool
pevalDefaultEqTerm
  pevalDistinctTerm :: NonEmpty (Term Bool) -> Term Bool
pevalDistinctTerm (Term Bool
_ :| []) = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
True
  pevalDistinctTerm (Term Bool
a :| [Term Bool
b]) = Term Bool -> Term Bool
pevalNotTerm (Term Bool -> Term Bool) -> Term Bool -> Term Bool
forall a b. (a -> b) -> a -> b
$ Term Bool -> Term Bool -> Term Bool
forall a. SupportedPrim a => Term a -> Term a -> Term Bool
pevalEqTerm Term Bool
a Term Bool
b
  pevalDistinctTerm NonEmpty (Term Bool)
_ = Bool -> Term Bool
forall t. SupportedPrim t => t -> Term t
conTerm Bool
False
  conSBVTerm :: Bool -> SBVType Bool
conSBVTerm Bool
n = if Bool
n then SBV Bool
SBVType Bool
SBV.sTrue else SBV Bool
SBVType Bool
SBV.sFalse
  symSBVName :: TypedSymbol 'AnyKind Bool -> Int -> String
symSBVName TypedSymbol 'AnyKind Bool
symbol Int
_ = TypedSymbol 'AnyKind Bool -> String
forall a. Show a => a -> String
show TypedSymbol 'AnyKind Bool
symbol
  symSBVTerm :: forall (m :: * -> *). SBVFreshMonad m => String -> m (SBVType Bool)
symSBVTerm = String -> m (SBV Bool)
String -> m (SBVType Bool)
forall a. SymVal a => String -> m (SBV a)
forall (m :: * -> *) a.
(SBVFreshMonad m, SymVal a) =>
String -> m (SBV a)
sbvFresh
  withPrim :: forall a.
((PrimConstraint Bool, SMTDefinable (SBVType Bool),
  Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
 a)
-> a
withPrim (PrimConstraint Bool, SMTDefinable (SBVType Bool),
 Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
a
r = a
(PrimConstraint Bool, SMTDefinable (SBVType Bool),
 Mergeable (SBVType Bool), Typeable (SBVType Bool)) =>
a
r
  parseSMTModelResult :: Int -> ([([CV], CV)], CV) -> Bool
parseSMTModelResult Int
_ = (Bool -> Bool) -> ([([CV], CV)], CV) -> Bool
forall v r.
(SatModel r, Typeable v) =>
(r -> v) -> ([([CV], CV)], CV) -> v
parseScalarSMTModelResult Bool -> Bool
forall a. a -> a
id
  castTypedSymbol ::
    forall knd knd'.
    (IsSymbolKind knd') =>
    TypedSymbol knd Bool ->
    Maybe (TypedSymbol knd' Bool)
  castTypedSymbol :: forall (knd :: SymbolKind) (knd' :: SymbolKind).
IsSymbolKind knd' =>
TypedSymbol knd Bool -> Maybe (TypedSymbol knd' Bool)
castTypedSymbol (TypedSymbol Symbol
s) =
    case forall (ty :: SymbolKind).
IsSymbolKind ty =>
Either (ty :~~: 'ConstantKind) (ty :~~: 'AnyKind)
decideSymbolKind @knd' of
      Left knd' :~~: 'ConstantKind
HRefl -> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a. a -> Maybe a
Just (TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool))
-> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol knd' Bool
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
      Right knd' :~~: 'AnyKind
HRefl -> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a. a -> Maybe a
Just (TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool))
-> TypedSymbol knd' Bool -> Maybe (TypedSymbol knd' Bool)
forall a b. (a -> b) -> a -> b
$ Symbol -> TypedSymbol knd' Bool
forall t (knd :: SymbolKind).
(SupportedPrim t, SymbolKindConstraint knd t, IsSymbolKind knd) =>
Symbol -> TypedSymbol knd t
TypedSymbol Symbol
s
  funcDummyConstraint :: SBVType Bool -> SBV Bool
funcDummyConstraint SBVType Bool
_ = SBV Bool
SBV.sTrue

instance NonFuncSBVRep Bool where
  type NonFuncSBVBaseType Bool = Bool

instance SupportedNonFuncPrim Bool where
  conNonFuncSBVTerm :: Bool -> SBV (NonFuncSBVBaseType Bool)
conNonFuncSBVTerm = Bool -> SBV (NonFuncSBVBaseType Bool)
Bool -> SBVType Bool
forall t. SupportedPrim t => t -> SBVType t
conSBVTerm
  symNonFuncSBVTerm :: forall (m :: * -> *).
SBVFreshMonad m =>
String -> m (SBV (NonFuncSBVBaseType Bool))
symNonFuncSBVTerm = forall t (m :: * -> *).
(SupportedPrim t, SBVFreshMonad m) =>
String -> m (SBVType t)
symSBVTerm @Bool
  withNonFuncPrim :: forall r. (NonFuncPrimConstraint Bool => r) -> r
withNonFuncPrim NonFuncPrimConstraint Bool => r
r = r
NonFuncPrimConstraint Bool => r
r

data PhantomDict a where
  PhantomDict :: (SupportedPrim a) => PhantomDict a

data PhantomNonFuncDict a where
  PhantomNonFuncDict ::
    (SupportedNonFuncPrim a) => PhantomNonFuncDict a

{-# NOINLINE phantomDictCache #-}
phantomDictCache :: IORef (HM.HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache :: IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache = IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomDict Any))
forall a. IO a -> a
unsafePerformIO (IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
 -> IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomDict Any))
forall a b. (a -> b) -> a -> b
$ HashMap SomeTypeRep (PhantomDict Any)
-> IO (IORef (HashMap SomeTypeRep (PhantomDict Any)))
forall a. a -> IO (IORef a)
newIORef HashMap SomeTypeRep (PhantomDict Any)
forall k v. HashMap k v
HM.empty

-- TODO
{-# NOINLINE getPhantomDict #-}
getPhantomDict :: forall a. (SupportedPrim a) => PhantomDict a
getPhantomDict :: forall a. SupportedPrim a => PhantomDict a
getPhantomDict = IO (PhantomDict a) -> PhantomDict a
forall a. IO a -> a
unsafePerformIO (IO (PhantomDict a) -> PhantomDict a)
-> IO (PhantomDict a) -> PhantomDict a
forall a b. (a -> b) -> a -> b
$ do
  HashMap SomeTypeRep (PhantomDict Any)
cache <- IORef (HashMap SomeTypeRep (PhantomDict Any))
-> IO (HashMap SomeTypeRep (PhantomDict Any))
forall a. IORef a -> IO a
readIORef IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache
  let !tr :: SomeTypeRep
tr = TypeRep a -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep a -> SomeTypeRep) -> TypeRep a -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @a
  case SomeTypeRep
-> HashMap SomeTypeRep (PhantomDict Any) -> Maybe (PhantomDict Any)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HM.lookup SomeTypeRep
tr HashMap SomeTypeRep (PhantomDict Any)
cache of
    Just PhantomDict Any
p -> PhantomDict a -> IO (PhantomDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (PhantomDict a -> IO (PhantomDict a))
-> PhantomDict a -> IO (PhantomDict a)
forall a b. (a -> b) -> a -> b
$ PhantomDict Any -> PhantomDict a
forall a b. a -> b
unsafeCoerce PhantomDict Any
p
    Maybe (PhantomDict Any)
Nothing -> do
      let r :: PhantomDict a
r = PhantomDict a
forall a. SupportedPrim a => PhantomDict a
PhantomDict :: PhantomDict a
      IORef (HashMap SomeTypeRep (PhantomDict Any))
-> (HashMap SomeTypeRep (PhantomDict Any)
    -> HashMap SomeTypeRep (PhantomDict Any))
-> IO ()
forall t. IORef t -> (t -> t) -> IO ()
atomicModifyIORefCAS_ IORef (HashMap SomeTypeRep (PhantomDict Any))
phantomDictCache ((HashMap SomeTypeRep (PhantomDict Any)
  -> HashMap SomeTypeRep (PhantomDict Any))
 -> IO ())
-> (HashMap SomeTypeRep (PhantomDict Any)
    -> HashMap SomeTypeRep (PhantomDict Any))
-> IO ()
forall a b. (a -> b) -> a -> b
$ SomeTypeRep
-> PhantomDict Any
-> HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any)
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
HM.insert SomeTypeRep
tr (PhantomDict Any
 -> HashMap SomeTypeRep (PhantomDict Any)
 -> HashMap SomeTypeRep (PhantomDict Any))
-> PhantomDict Any
-> HashMap SomeTypeRep (PhantomDict Any)
-> HashMap SomeTypeRep (PhantomDict Any)
forall a b. (a -> b) -> a -> b
$ PhantomDict a -> PhantomDict Any
forall a b. a -> b
unsafeCoerce PhantomDict a
r
      PhantomDict a -> IO (PhantomDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PhantomDict a
r

{-# NOINLINE phantomNonFuncDictCache #-}
phantomNonFuncDictCache ::
  IORef (HM.HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache :: IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache = IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a. IO a -> a
unsafePerformIO (IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
 -> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
-> IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a b. (a -> b) -> a -> b
$ HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> IO (IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any)))
forall a. a -> IO (IORef a)
newIORef HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall k v. HashMap k v
HM.empty

-- TODO
{-# NOINLINE getPhantomNonFuncDict #-}
getPhantomNonFuncDict ::
  forall a. (SupportedNonFuncPrim a) => PhantomNonFuncDict a
getPhantomNonFuncDict :: forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
getPhantomNonFuncDict = IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a
forall a. IO a -> a
unsafePerformIO (IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a)
-> IO (PhantomNonFuncDict a) -> PhantomNonFuncDict a
forall a b. (a -> b) -> a -> b
$ do
  HashMap SomeTypeRep (PhantomNonFuncDict Any)
cache <- IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO (HashMap SomeTypeRep (PhantomNonFuncDict Any))
forall a. IORef a -> IO a
readIORef IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache
  let !tr :: SomeTypeRep
tr = TypeRep a -> SomeTypeRep
forall k (a :: k). TypeRep a -> SomeTypeRep
SomeTypeRep (TypeRep a -> SomeTypeRep) -> TypeRep a -> SomeTypeRep
forall a b. (a -> b) -> a -> b
$ forall t. SupportedPrim t => TypeRep t
primTypeRep @a
  case SomeTypeRep
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> Maybe (PhantomNonFuncDict Any)
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
HM.lookup SomeTypeRep
tr HashMap SomeTypeRep (PhantomNonFuncDict Any)
cache of
    Just PhantomNonFuncDict Any
p -> PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (PhantomNonFuncDict a -> IO (PhantomNonFuncDict a))
-> PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a b. (a -> b) -> a -> b
$ PhantomNonFuncDict Any -> PhantomNonFuncDict a
forall a b. a -> b
unsafeCoerce PhantomNonFuncDict Any
p
    Maybe (PhantomNonFuncDict Any)
Nothing -> do
      let r :: PhantomNonFuncDict a
r = PhantomNonFuncDict a
forall a. SupportedNonFuncPrim a => PhantomNonFuncDict a
PhantomNonFuncDict :: PhantomNonFuncDict a
      IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> (HashMap SomeTypeRep (PhantomNonFuncDict Any)
    -> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO ()
forall t. IORef t -> (t -> t) -> IO ()
atomicModifyIORefCAS_ IORef (HashMap SomeTypeRep (PhantomNonFuncDict Any))
phantomNonFuncDictCache ((HashMap SomeTypeRep (PhantomNonFuncDict Any)
  -> HashMap SomeTypeRep (PhantomNonFuncDict Any))
 -> IO ())
-> (HashMap SomeTypeRep (PhantomNonFuncDict Any)
    -> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> IO ()
forall a b. (a -> b) -> a -> b
$
        SomeTypeRep
-> PhantomNonFuncDict Any
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall k v.
(Eq k, Hashable k) =>
k -> v -> HashMap k v -> HashMap k v
HM.insert SomeTypeRep
tr (PhantomNonFuncDict Any
 -> HashMap SomeTypeRep (PhantomNonFuncDict Any)
 -> HashMap SomeTypeRep (PhantomNonFuncDict Any))
-> PhantomNonFuncDict Any
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
-> HashMap SomeTypeRep (PhantomNonFuncDict Any)
forall a b. (a -> b) -> a -> b
$
          PhantomNonFuncDict a -> PhantomNonFuncDict Any
forall a b. a -> b
unsafeCoerce PhantomNonFuncDict a
r
      PhantomNonFuncDict a -> IO (PhantomNonFuncDict a)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PhantomNonFuncDict a
r