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

Grisette.Core.Data.Class.Integer

Description

 
Synopsis

Symbolic integer operations

class SignedDivMod a where Source #

Safe signed div and mod with monadic error handling in multi-path execution. These procedures show throw DivideByZero exception when the divisor is zero. The result should be able to handle errors with MonadError, and the error type should be compatible with ArithException (see TransformError for more details).

Methods

divs :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

Safe signed div with monadic error handling in multi-path execution.

>>> divs (ssym "a") (ssym "b") :: ExceptT AssertionError UnionM SymInteger
ExceptT {If (= b 0) (Left AssertionError) (Right (div a b))}

mods :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

Safe signed mod with monadic error handling in multi-path execution.

>>> mods (ssym "a") (ssym "b") :: ExceptT AssertionError UnionM SymInteger
ExceptT {If (= b 0) (Left AssertionError) (Right (mod a b))}

class UnsignedDivMod a where Source #

Safe unsigned div and mod with monadic error handling in multi-path execution. These procedures show throw DivideByZero exception when the divisor is zero. The result should be able to handle errors with MonadError, and the error type should be compatible with ArithException (see TransformError for more details).

Methods

udivs :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

umods :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

class SignedQuotRem a where Source #

Safe signed quot and rem with monadic error handling in multi-path execution. These procedures show throw DivideByZero exception when the divisor is zero. The result should be able to handle errors with MonadError, and the error type should be compatible with ArithException (see TransformError for more details).

Methods

quots :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

rems :: (MonadError e uf, MonadUnion uf, TransformError ArithException e) => a -> a -> uf a Source #

class (Num a, SEq a, SOrd a, Solvable Integer a) => SymIntegerOp a Source #

Aggregation for the operations on symbolic integer types

Instances

Instances details
SymIntegerOp (Sym Integer) Source # 
Instance details

Defined in Grisette.IR.SymPrim.Data.SymPrim