{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PatternGuards #-}
module Z3.Base (
Config
, Context
, Symbol
, AST
, Sort
, FuncDecl
, App
, Pattern
, Constructor
, Model
, FuncInterp
, FuncEntry
, Params
, Solver
, SortKind(..)
, ASTKind(..)
, Tactic
, ApplyResult
, Goal
, Result(..)
, mkConfig
, delConfig
, setParamValue
, withConfig
, mkContext
, withContext
, mkParams
, paramsSetBool
, paramsSetUInt
, paramsSetDouble
, paramsSetSymbol
, paramsToString
, mkIntSymbol
, mkStringSymbol
, mkUninterpretedSort
, mkBoolSort
, mkIntSort
, mkRealSort
, mkBvSort
, mkFiniteDomainSort
, mkArraySort
, mkTupleSort
, mkConstructor
, mkDatatype
, mkDatatypes
, mkSetSort
, mkFuncDecl
, mkApp
, mkConst
, mkFreshFuncDecl
, mkFreshConst
, mkVar
, mkBoolVar
, mkRealVar
, mkIntVar
, mkBvVar
, mkFreshVar
, mkFreshBoolVar
, mkFreshRealVar
, mkFreshIntVar
, mkFreshBvVar
, mkTrue
, mkFalse
, mkEq
, mkNot
, mkIte
, mkIff
, mkImplies
, mkXor
, mkAnd
, mkOr
, mkDistinct
, mkBool
, mkAdd
, mkMul
, mkSub
, mkUnaryMinus
, mkDiv
, mkMod
, mkRem
, mkLt
, mkLe
, mkGt
, mkGe
, mkInt2Real
, mkReal2Int
, mkIsInt
, mkBvnot
, mkBvredand
, mkBvredor
, mkBvand
, mkBvor
, mkBvxor
, mkBvnand
, mkBvnor
, mkBvxnor
, mkBvneg
, mkBvadd
, mkBvsub
, mkBvmul
, mkBvudiv
, mkBvsdiv
, mkBvurem
, mkBvsrem
, mkBvsmod
, mkBvult
, mkBvslt
, mkBvule
, mkBvsle
, mkBvuge
, mkBvsge
, mkBvugt
, mkBvsgt
, mkConcat
, mkExtract
, mkSignExt
, mkZeroExt
, mkRepeat
, mkBvshl
, mkBvlshr
, mkBvashr
, mkRotateLeft
, mkRotateRight
, mkExtRotateLeft
, mkExtRotateRight
, mkInt2bv
, mkBv2int
, mkBvnegNoOverflow
, mkBvaddNoOverflow
, mkBvaddNoUnderflow
, mkBvsubNoOverflow
, mkBvsubNoUnderflow
, mkBvmulNoOverflow
, mkBvmulNoUnderflow
, mkBvsdivNoOverflow
, mkSelect
, mkStore
, mkConstArray
, mkMap
, mkArrayDefault
, mkEmptySet
, mkFullSet
, mkSetAdd
, mkSetDel
, mkSetUnion
, mkSetIntersect
, mkSetDifference
, mkSetComplement
, mkSetMember
, mkSetSubset
, mkNumeral
, mkReal
, mkInt
, mkUnsignedInt
, mkInt64
, mkUnsignedInt64
, mkIntegral
, mkRational
, mkFixed
, mkRealNum
, mkInteger
, mkIntNum
, mkBitvector
, mkBvNum
, mkPattern
, mkBound
, mkForall
, mkExists
, mkForallConst
, mkExistsConst
, getSymbolString
, getSortKind
, getBvSortSize
, getDatatypeSortConstructors
, getDatatypeSortRecognizers
, getDatatypeSortConstructorAccessors
, getDeclName
, getArity
, getDomain
, getRange
, appToAst
, getAppDecl
, getAppNumArgs
, getAppArg
, getAppArgs
, getSort
, getArraySortDomain
, getArraySortRange
, getBoolValue
, getAstKind
, isApp
, toApp
, getNumeralString
, simplify
, simplifyEx
, getIndexValue
, isQuantifierForall
, isQuantifierExists
, getQuantifierWeight
, getQuantifierNumPatterns
, getQuantifierPatternAST
, getQuantifierPatterns
, getQuantifierNumNoPatterns
, getQuantifierNoPatternAST
, getQuantifierNoPatterns
, getQuantifierNumBound
, getQuantifierBoundName
, getQuantifierBoundSort
, getQuantifierBoundVars
, getQuantifierBody
, getBool
, getInt
, getReal
, getBv
, substituteVars
, modelEval
, evalArray
, getConstInterp
, getFuncInterp
, hasInterp
, numConsts
, numFuncs
, getConstDecl
, getFuncDecl
, getConsts
, getFuncs
, isAsArray
, addFuncInterp
, addConstInterp
, getAsArrayFuncDecl
, funcInterpGetNumEntries
, funcInterpGetEntry
, funcInterpGetElse
, funcInterpGetArity
, funcEntryGetValue
, funcEntryGetNumArgs
, funcEntryGetArg
, modelToString
, showModel
, EvalAst
, eval
, evalBool
, evalInt
, evalReal
, evalBv
, mapEval
, evalT
, FuncModel (..)
, evalFunc
, mkTactic
, andThenTactic
, orElseTactic
, skipTactic
, tryForTactic
, mkQuantifierEliminationTactic
, mkAndInverterGraphTactic
, applyTactic
, getApplyResultNumSubgoals
, getApplyResultSubgoal
, getApplyResultSubgoals
, mkGoal
, goalAssert
, getGoalSize
, getGoalFormula
, getGoalFormulas
, ASTPrintMode(..)
, setASTPrintMode
, astToString
, patternToString
, sortToString
, funcDeclToString
, benchmarkToSMTLibString
, parseSMTLib2String
, parseSMTLib2File
, Z3Error(..)
, Z3ErrorCode(..)
, Version(..)
, getVersion
, Fixedpoint (..)
, mkFixedpoint
, fixedpointAddRule
, fixedpointSetParams
, fixedpointRegisterRelation
, fixedpointQueryRelations
, fixedpointGetAnswer
, fixedpointGetAssertions
, Logic(..)
, mkSolver
, mkSimpleSolver
, mkSolverForLogic
, solverGetHelp
, solverSetParams
, solverPush
, solverPop
, solverReset
, solverGetNumScopes
, solverAssertCnstr
, solverAssertAndTrack
, solverCheck
, solverCheckAssumptions
, solverGetModel
, solverGetUnsatCore
, solverGetReasonUnknown
, solverToString
, solverCheckAndGetModel
) where
import Z3.Base.C
import Control.Applicative ( (<$>), (<*>), (<*), pure )
import Control.Exception ( Exception, bracket, throw )
import Control.Monad ( join, when, forM )
import Data.Fixed ( Fixed, HasResolution )
import Data.Foldable ( Foldable (..) )
import Data.Int
import Data.IORef ( IORef, newIORef, atomicModifyIORef' )
import Data.List.NonEmpty (NonEmpty (..), nonEmpty)
import Data.Maybe ( fromJust )
import Data.Ratio ( numerator, denominator, (%) )
import Data.Traversable ( Traversable )
import qualified Data.Traversable as T
import Data.Typeable ( Typeable )
import Data.Word
import Foreign hiding ( toBool, newForeignPtr )
import Foreign.C
( CDouble, CInt, CUInt, CLLong, CULLong, CString
, peekCString
, withCString )
import Foreign.Concurrent
newtype Config = Config { Config -> Ptr Z3_config
unConfig :: Ptr Z3_config }
deriving Config -> Config -> Bool
(Config -> Config -> Bool)
-> (Config -> Config -> Bool) -> Eq Config
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Config -> Config -> Bool
$c/= :: Config -> Config -> Bool
== :: Config -> Config -> Bool
$c== :: Config -> Config -> Bool
Eq
data Context =
Context {
Context -> ForeignPtr Z3_context
unContext :: ForeignPtr Z3_context
, Context -> IORef Word
refCount :: !(IORef Word)
}
deriving Context -> Context -> Bool
(Context -> Context -> Bool)
-> (Context -> Context -> Bool) -> Eq Context
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Context -> Context -> Bool
$c/= :: Context -> Context -> Bool
== :: Context -> Context -> Bool
$c== :: Context -> Context -> Bool
Eq
newtype Symbol = Symbol { Symbol -> Ptr Z3_symbol
unSymbol :: Ptr Z3_symbol }
deriving (Symbol -> Symbol -> Bool
(Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool) -> Eq Symbol
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Symbol -> Symbol -> Bool
$c/= :: Symbol -> Symbol -> Bool
== :: Symbol -> Symbol -> Bool
$c== :: Symbol -> Symbol -> Bool
Eq, Eq Symbol
Eq Symbol =>
(Symbol -> Symbol -> Ordering)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Bool)
-> (Symbol -> Symbol -> Symbol)
-> (Symbol -> Symbol -> Symbol)
-> Ord Symbol
Symbol -> Symbol -> Bool
Symbol -> Symbol -> Ordering
Symbol -> Symbol -> Symbol
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
min :: Symbol -> Symbol -> Symbol
$cmin :: Symbol -> Symbol -> Symbol
max :: Symbol -> Symbol -> Symbol
$cmax :: Symbol -> Symbol -> Symbol
>= :: Symbol -> Symbol -> Bool
$c>= :: Symbol -> Symbol -> Bool
> :: Symbol -> Symbol -> Bool
$c> :: Symbol -> Symbol -> Bool
<= :: Symbol -> Symbol -> Bool
$c<= :: Symbol -> Symbol -> Bool
< :: Symbol -> Symbol -> Bool
$c< :: Symbol -> Symbol -> Bool
compare :: Symbol -> Symbol -> Ordering
$ccompare :: Symbol -> Symbol -> Ordering
$cp1Ord :: Eq Symbol
Ord, Int -> Symbol -> ShowS
[Symbol] -> ShowS
Symbol -> String
(Int -> Symbol -> ShowS)
-> (Symbol -> String) -> ([Symbol] -> ShowS) -> Show Symbol
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Symbol] -> ShowS
$cshowList :: [Symbol] -> ShowS
show :: Symbol -> String
$cshow :: Symbol -> String
showsPrec :: Int -> Symbol -> ShowS
$cshowsPrec :: Int -> Symbol -> ShowS
Show, Ptr b -> Int -> IO Symbol
Ptr b -> Int -> Symbol -> IO ()
Ptr Symbol -> IO Symbol
Ptr Symbol -> Int -> IO Symbol
Ptr Symbol -> Int -> Symbol -> IO ()
Ptr Symbol -> Symbol -> IO ()
Symbol -> Int
(Symbol -> Int)
-> (Symbol -> Int)
-> (Ptr Symbol -> Int -> IO Symbol)
-> (Ptr Symbol -> Int -> Symbol -> IO ())
-> (forall b. Ptr b -> Int -> IO Symbol)
-> (forall b. Ptr b -> Int -> Symbol -> IO ())
-> (Ptr Symbol -> IO Symbol)
-> (Ptr Symbol -> Symbol -> IO ())
-> Storable Symbol
forall b. Ptr b -> Int -> IO Symbol
forall b. Ptr b -> Int -> Symbol -> IO ()
forall a.
(a -> Int)
-> (a -> Int)
-> (Ptr a -> Int -> IO a)
-> (Ptr a -> Int -> a -> IO ())
-> (forall b. Ptr b -> Int -> IO a)
-> (forall b. Ptr b -> Int -> a -> IO ())
-> (Ptr a -> IO a)
-> (Ptr a -> a -> IO ())
-> Storable a
poke :: Ptr Symbol -> Symbol -> IO ()
$cpoke :: Ptr Symbol -> Symbol -> IO ()
peek :: Ptr Symbol -> IO Symbol
$cpeek :: Ptr Symbol -> IO Symbol
pokeByteOff :: Ptr b -> Int -> Symbol -> IO ()
$cpokeByteOff :: forall b. Ptr b -> Int -> Symbol -> IO ()
peekByteOff :: Ptr b -> Int -> IO Symbol
$cpeekByteOff :: forall b. Ptr b -> Int -> IO Symbol
pokeElemOff :: Ptr Symbol -> Int -> Symbol -> IO ()
$cpokeElemOff :: Ptr Symbol -> Int -> Symbol -> IO ()
peekElemOff :: Ptr Symbol -> Int -> IO Symbol
$cpeekElemOff :: Ptr Symbol -> Int -> IO Symbol
alignment :: Symbol -> Int
$calignment :: Symbol -> Int
sizeOf :: Symbol -> Int
$csizeOf :: Symbol -> Int
Storable)
newtype AST = AST { AST -> ForeignPtr Z3_ast
unAST :: ForeignPtr Z3_ast }
deriving (AST -> AST -> Bool
(AST -> AST -> Bool) -> (AST -> AST -> Bool) -> Eq AST
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AST -> AST -> Bool
$c/= :: AST -> AST -> Bool
== :: AST -> AST -> Bool
$c== :: AST -> AST -> Bool
Eq, Eq AST
Eq AST =>
(AST -> AST -> Ordering)
-> (AST -> AST -> Bool)
-> (AST -> AST -> Bool)
-> (AST -> AST -> Bool)
-> (AST -> AST -> Bool)
-> (AST -> AST -> AST)
-> (AST -> AST -> AST)
-> Ord AST
AST -> AST -> Bool
AST -> AST -> Ordering
AST -> AST -> AST
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
min :: AST -> AST -> AST
$cmin :: AST -> AST -> AST
max :: AST -> AST -> AST
$cmax :: AST -> AST -> AST
>= :: AST -> AST -> Bool
$c>= :: AST -> AST -> Bool
> :: AST -> AST -> Bool
$c> :: AST -> AST -> Bool
<= :: AST -> AST -> Bool
$c<= :: AST -> AST -> Bool
< :: AST -> AST -> Bool
$c< :: AST -> AST -> Bool
compare :: AST -> AST -> Ordering
$ccompare :: AST -> AST -> Ordering
$cp1Ord :: Eq AST
Ord, Int -> AST -> ShowS
[AST] -> ShowS
AST -> String
(Int -> AST -> ShowS)
-> (AST -> String) -> ([AST] -> ShowS) -> Show AST
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AST] -> ShowS
$cshowList :: [AST] -> ShowS
show :: AST -> String
$cshow :: AST -> String
showsPrec :: Int -> AST -> ShowS
$cshowsPrec :: Int -> AST -> ShowS
Show, Typeable)
newtype Sort = Sort { Sort -> ForeignPtr Z3_sort
unSort :: ForeignPtr Z3_sort }
deriving (Sort -> Sort -> Bool
(Sort -> Sort -> Bool) -> (Sort -> Sort -> Bool) -> Eq Sort
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Sort -> Sort -> Bool
$c/= :: Sort -> Sort -> Bool
== :: Sort -> Sort -> Bool
$c== :: Sort -> Sort -> Bool
Eq, Eq Sort
Eq Sort =>
(Sort -> Sort -> Ordering)
-> (Sort -> Sort -> Bool)
-> (Sort -> Sort -> Bool)
-> (Sort -> Sort -> Bool)
-> (Sort -> Sort -> Bool)
-> (Sort -> Sort -> Sort)
-> (Sort -> Sort -> Sort)
-> Ord Sort
Sort -> Sort -> Bool
Sort -> Sort -> Ordering
Sort -> Sort -> Sort
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
min :: Sort -> Sort -> Sort
$cmin :: Sort -> Sort -> Sort
max :: Sort -> Sort -> Sort
$cmax :: Sort -> Sort -> Sort
>= :: Sort -> Sort -> Bool
$c>= :: Sort -> Sort -> Bool
> :: Sort -> Sort -> Bool
$c> :: Sort -> Sort -> Bool
<= :: Sort -> Sort -> Bool
$c<= :: Sort -> Sort -> Bool
< :: Sort -> Sort -> Bool
$c< :: Sort -> Sort -> Bool
compare :: Sort -> Sort -> Ordering
$ccompare :: Sort -> Sort -> Ordering
$cp1Ord :: Eq Sort
Ord, Int -> Sort -> ShowS
[Sort] -> ShowS
Sort -> String
(Int -> Sort -> ShowS)
-> (Sort -> String) -> ([Sort] -> ShowS) -> Show Sort
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Sort] -> ShowS
$cshowList :: [Sort] -> ShowS
show :: Sort -> String
$cshow :: Sort -> String
showsPrec :: Int -> Sort -> ShowS
$cshowsPrec :: Int -> Sort -> ShowS
Show)
newtype FuncDecl = FuncDecl { FuncDecl -> ForeignPtr Z3_func_decl
unFuncDecl :: ForeignPtr Z3_func_decl }
deriving (FuncDecl -> FuncDecl -> Bool
(FuncDecl -> FuncDecl -> Bool)
-> (FuncDecl -> FuncDecl -> Bool) -> Eq FuncDecl
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FuncDecl -> FuncDecl -> Bool
$c/= :: FuncDecl -> FuncDecl -> Bool
== :: FuncDecl -> FuncDecl -> Bool
$c== :: FuncDecl -> FuncDecl -> Bool
Eq, Eq FuncDecl
Eq FuncDecl =>
(FuncDecl -> FuncDecl -> Ordering)
-> (FuncDecl -> FuncDecl -> Bool)
-> (FuncDecl -> FuncDecl -> Bool)
-> (FuncDecl -> FuncDecl -> Bool)
-> (FuncDecl -> FuncDecl -> Bool)
-> (FuncDecl -> FuncDecl -> FuncDecl)
-> (FuncDecl -> FuncDecl -> FuncDecl)
-> Ord FuncDecl
FuncDecl -> FuncDecl -> Bool
FuncDecl -> FuncDecl -> Ordering
FuncDecl -> FuncDecl -> FuncDecl
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
min :: FuncDecl -> FuncDecl -> FuncDecl
$cmin :: FuncDecl -> FuncDecl -> FuncDecl
max :: FuncDecl -> FuncDecl -> FuncDecl
$cmax :: FuncDecl -> FuncDecl -> FuncDecl
>= :: FuncDecl -> FuncDecl -> Bool
$c>= :: FuncDecl -> FuncDecl -> Bool
> :: FuncDecl -> FuncDecl -> Bool
$c> :: FuncDecl -> FuncDecl -> Bool
<= :: FuncDecl -> FuncDecl -> Bool
$c<= :: FuncDecl -> FuncDecl -> Bool
< :: FuncDecl -> FuncDecl -> Bool
$c< :: FuncDecl -> FuncDecl -> Bool
compare :: FuncDecl -> FuncDecl -> Ordering
$ccompare :: FuncDecl -> FuncDecl -> Ordering
$cp1Ord :: Eq FuncDecl
Ord, Int -> FuncDecl -> ShowS
[FuncDecl] -> ShowS
FuncDecl -> String
(Int -> FuncDecl -> ShowS)
-> (FuncDecl -> String) -> ([FuncDecl] -> ShowS) -> Show FuncDecl
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FuncDecl] -> ShowS
$cshowList :: [FuncDecl] -> ShowS
show :: FuncDecl -> String
$cshow :: FuncDecl -> String
showsPrec :: Int -> FuncDecl -> ShowS
$cshowsPrec :: Int -> FuncDecl -> ShowS
Show, Typeable)
newtype App = App { App -> ForeignPtr Z3_app
unApp :: ForeignPtr Z3_app }
deriving (App -> App -> Bool
(App -> App -> Bool) -> (App -> App -> Bool) -> Eq App
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: App -> App -> Bool
$c/= :: App -> App -> Bool
== :: App -> App -> Bool
$c== :: App -> App -> Bool
Eq, Eq App
Eq App =>
(App -> App -> Ordering)
-> (App -> App -> Bool)
-> (App -> App -> Bool)
-> (App -> App -> Bool)
-> (App -> App -> Bool)
-> (App -> App -> App)
-> (App -> App -> App)
-> Ord App
App -> App -> Bool
App -> App -> Ordering
App -> App -> App
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
min :: App -> App -> App
$cmin :: App -> App -> App
max :: App -> App -> App
$cmax :: App -> App -> App
>= :: App -> App -> Bool
$c>= :: App -> App -> Bool
> :: App -> App -> Bool
$c> :: App -> App -> Bool
<= :: App -> App -> Bool
$c<= :: App -> App -> Bool
< :: App -> App -> Bool
$c< :: App -> App -> Bool
compare :: App -> App -> Ordering
$ccompare :: App -> App -> Ordering
$cp1Ord :: Eq App
Ord, Int -> App -> ShowS
[App] -> ShowS
App -> String
(Int -> App -> ShowS)
-> (App -> String) -> ([App] -> ShowS) -> Show App
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [App] -> ShowS
$cshowList :: [App] -> ShowS
show :: App -> String
$cshow :: App -> String
showsPrec :: Int -> App -> ShowS
$cshowsPrec :: Int -> App -> ShowS
Show)
newtype Pattern = Pattern { Pattern -> ForeignPtr Z3_pattern
unPattern :: ForeignPtr Z3_pattern }
deriving (Pattern -> Pattern -> Bool
(Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool) -> Eq Pattern
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Pattern -> Pattern -> Bool
$c/= :: Pattern -> Pattern -> Bool
== :: Pattern -> Pattern -> Bool
$c== :: Pattern -> Pattern -> Bool
Eq, Eq Pattern
Eq Pattern =>
(Pattern -> Pattern -> Ordering)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Bool)
-> (Pattern -> Pattern -> Pattern)
-> (Pattern -> Pattern -> Pattern)
-> Ord Pattern
Pattern -> Pattern -> Bool
Pattern -> Pattern -> Ordering
Pattern -> Pattern -> Pattern
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
min :: Pattern -> Pattern -> Pattern
$cmin :: Pattern -> Pattern -> Pattern
max :: Pattern -> Pattern -> Pattern
$cmax :: Pattern -> Pattern -> Pattern
>= :: Pattern -> Pattern -> Bool
$c>= :: Pattern -> Pattern -> Bool
> :: Pattern -> Pattern -> Bool
$c> :: Pattern -> Pattern -> Bool
<= :: Pattern -> Pattern -> Bool
$c<= :: Pattern -> Pattern -> Bool
< :: Pattern -> Pattern -> Bool
$c< :: Pattern -> Pattern -> Bool
compare :: Pattern -> Pattern -> Ordering
$ccompare :: Pattern -> Pattern -> Ordering
$cp1Ord :: Eq Pattern
Ord, Int -> Pattern -> ShowS
[Pattern] -> ShowS
Pattern -> String
(Int -> Pattern -> ShowS)
-> (Pattern -> String) -> ([Pattern] -> ShowS) -> Show Pattern
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Pattern] -> ShowS
$cshowList :: [Pattern] -> ShowS
show :: Pattern -> String
$cshow :: Pattern -> String
showsPrec :: Int -> Pattern -> ShowS
$cshowsPrec :: Int -> Pattern -> ShowS
Show)
newtype Constructor = Constructor { Constructor -> ForeignPtr Z3_constructor
unConstructor :: ForeignPtr Z3_constructor }
deriving (Constructor -> Constructor -> Bool
(Constructor -> Constructor -> Bool)
-> (Constructor -> Constructor -> Bool) -> Eq Constructor
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Constructor -> Constructor -> Bool
$c/= :: Constructor -> Constructor -> Bool
== :: Constructor -> Constructor -> Bool
$c== :: Constructor -> Constructor -> Bool
Eq, Eq Constructor
Eq Constructor =>
(Constructor -> Constructor -> Ordering)
-> (Constructor -> Constructor -> Bool)
-> (Constructor -> Constructor -> Bool)
-> (Constructor -> Constructor -> Bool)
-> (Constructor -> Constructor -> Bool)
-> (Constructor -> Constructor -> Constructor)
-> (Constructor -> Constructor -> Constructor)
-> Ord Constructor
Constructor -> Constructor -> Bool
Constructor -> Constructor -> Ordering
Constructor -> Constructor -> Constructor
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
min :: Constructor -> Constructor -> Constructor
$cmin :: Constructor -> Constructor -> Constructor
max :: Constructor -> Constructor -> Constructor
$cmax :: Constructor -> Constructor -> Constructor
>= :: Constructor -> Constructor -> Bool
$c>= :: Constructor -> Constructor -> Bool
> :: Constructor -> Constructor -> Bool
$c> :: Constructor -> Constructor -> Bool
<= :: Constructor -> Constructor -> Bool
$c<= :: Constructor -> Constructor -> Bool
< :: Constructor -> Constructor -> Bool
$c< :: Constructor -> Constructor -> Bool
compare :: Constructor -> Constructor -> Ordering
$ccompare :: Constructor -> Constructor -> Ordering
$cp1Ord :: Eq Constructor
Ord, Int -> Constructor -> ShowS
[Constructor] -> ShowS
Constructor -> String
(Int -> Constructor -> ShowS)
-> (Constructor -> String)
-> ([Constructor] -> ShowS)
-> Show Constructor
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Constructor] -> ShowS
$cshowList :: [Constructor] -> ShowS
show :: Constructor -> String
$cshow :: Constructor -> String
showsPrec :: Int -> Constructor -> ShowS
$cshowsPrec :: Int -> Constructor -> ShowS
Show)
newtype ConstructorList = ConstructorList { ConstructorList -> ForeignPtr Z3_constructor_list
unConstructorList :: ForeignPtr Z3_constructor_list }
deriving (ConstructorList -> ConstructorList -> Bool
(ConstructorList -> ConstructorList -> Bool)
-> (ConstructorList -> ConstructorList -> Bool)
-> Eq ConstructorList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ConstructorList -> ConstructorList -> Bool
$c/= :: ConstructorList -> ConstructorList -> Bool
== :: ConstructorList -> ConstructorList -> Bool
$c== :: ConstructorList -> ConstructorList -> Bool
Eq, Eq ConstructorList
Eq ConstructorList =>
(ConstructorList -> ConstructorList -> Ordering)
-> (ConstructorList -> ConstructorList -> Bool)
-> (ConstructorList -> ConstructorList -> Bool)
-> (ConstructorList -> ConstructorList -> Bool)
-> (ConstructorList -> ConstructorList -> Bool)
-> (ConstructorList -> ConstructorList -> ConstructorList)
-> (ConstructorList -> ConstructorList -> ConstructorList)
-> Ord ConstructorList
ConstructorList -> ConstructorList -> Bool
ConstructorList -> ConstructorList -> Ordering
ConstructorList -> ConstructorList -> ConstructorList
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
min :: ConstructorList -> ConstructorList -> ConstructorList
$cmin :: ConstructorList -> ConstructorList -> ConstructorList
max :: ConstructorList -> ConstructorList -> ConstructorList
$cmax :: ConstructorList -> ConstructorList -> ConstructorList
>= :: ConstructorList -> ConstructorList -> Bool
$c>= :: ConstructorList -> ConstructorList -> Bool
> :: ConstructorList -> ConstructorList -> Bool
$c> :: ConstructorList -> ConstructorList -> Bool
<= :: ConstructorList -> ConstructorList -> Bool
$c<= :: ConstructorList -> ConstructorList -> Bool
< :: ConstructorList -> ConstructorList -> Bool
$c< :: ConstructorList -> ConstructorList -> Bool
compare :: ConstructorList -> ConstructorList -> Ordering
$ccompare :: ConstructorList -> ConstructorList -> Ordering
$cp1Ord :: Eq ConstructorList
Ord, Int -> ConstructorList -> ShowS
[ConstructorList] -> ShowS
ConstructorList -> String
(Int -> ConstructorList -> ShowS)
-> (ConstructorList -> String)
-> ([ConstructorList] -> ShowS)
-> Show ConstructorList
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ConstructorList] -> ShowS
$cshowList :: [ConstructorList] -> ShowS
show :: ConstructorList -> String
$cshow :: ConstructorList -> String
showsPrec :: Int -> ConstructorList -> ShowS
$cshowsPrec :: Int -> ConstructorList -> ShowS
Show)
newtype Model = Model { Model -> ForeignPtr Z3_model
unModel :: ForeignPtr Z3_model }
deriving Model -> Model -> Bool
(Model -> Model -> Bool) -> (Model -> Model -> Bool) -> Eq Model
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Model -> Model -> Bool
$c/= :: Model -> Model -> Bool
== :: Model -> Model -> Bool
$c== :: Model -> Model -> Bool
Eq
newtype FuncInterp = FuncInterp { FuncInterp -> ForeignPtr Z3_func_interp
unFuncInterp :: ForeignPtr Z3_func_interp }
deriving FuncInterp -> FuncInterp -> Bool
(FuncInterp -> FuncInterp -> Bool)
-> (FuncInterp -> FuncInterp -> Bool) -> Eq FuncInterp
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FuncInterp -> FuncInterp -> Bool
$c/= :: FuncInterp -> FuncInterp -> Bool
== :: FuncInterp -> FuncInterp -> Bool
$c== :: FuncInterp -> FuncInterp -> Bool
Eq
newtype FuncEntry = FuncEntry { FuncEntry -> ForeignPtr Z3_func_entry
unFuncEntry :: ForeignPtr Z3_func_entry }
deriving FuncEntry -> FuncEntry -> Bool
(FuncEntry -> FuncEntry -> Bool)
-> (FuncEntry -> FuncEntry -> Bool) -> Eq FuncEntry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FuncEntry -> FuncEntry -> Bool
$c/= :: FuncEntry -> FuncEntry -> Bool
== :: FuncEntry -> FuncEntry -> Bool
$c== :: FuncEntry -> FuncEntry -> Bool
Eq
newtype Tactic = Tactic { Tactic -> ForeignPtr Z3_tactic
unTactic :: ForeignPtr Z3_tactic }
deriving Tactic -> Tactic -> Bool
(Tactic -> Tactic -> Bool)
-> (Tactic -> Tactic -> Bool) -> Eq Tactic
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Tactic -> Tactic -> Bool
$c/= :: Tactic -> Tactic -> Bool
== :: Tactic -> Tactic -> Bool
$c== :: Tactic -> Tactic -> Bool
Eq
newtype Goal = Goal { Goal -> ForeignPtr Z3_goal
unGoal :: ForeignPtr Z3_goal }
deriving Goal -> Goal -> Bool
(Goal -> Goal -> Bool) -> (Goal -> Goal -> Bool) -> Eq Goal
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Goal -> Goal -> Bool
$c/= :: Goal -> Goal -> Bool
== :: Goal -> Goal -> Bool
$c== :: Goal -> Goal -> Bool
Eq
newtype ApplyResult = ApplyResult { ApplyResult -> ForeignPtr Z3_apply_result
unApplyResult :: ForeignPtr Z3_apply_result }
deriving ApplyResult -> ApplyResult -> Bool
(ApplyResult -> ApplyResult -> Bool)
-> (ApplyResult -> ApplyResult -> Bool) -> Eq ApplyResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApplyResult -> ApplyResult -> Bool
$c/= :: ApplyResult -> ApplyResult -> Bool
== :: ApplyResult -> ApplyResult -> Bool
$c== :: ApplyResult -> ApplyResult -> Bool
Eq
newtype Params = Params { Params -> ForeignPtr Z3_params
unParams :: ForeignPtr Z3_params }
deriving Params -> Params -> Bool
(Params -> Params -> Bool)
-> (Params -> Params -> Bool) -> Eq Params
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Params -> Params -> Bool
$c/= :: Params -> Params -> Bool
== :: Params -> Params -> Bool
$c== :: Params -> Params -> Bool
Eq
newtype Solver = Solver { Solver -> ForeignPtr Z3_solver
unSolver :: ForeignPtr Z3_solver }
deriving Solver -> Solver -> Bool
(Solver -> Solver -> Bool)
-> (Solver -> Solver -> Bool) -> Eq Solver
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Solver -> Solver -> Bool
$c/= :: Solver -> Solver -> Bool
== :: Solver -> Solver -> Bool
$c== :: Solver -> Solver -> Bool
Eq
data Result
= Sat
| Unsat
| Undef
deriving (Result -> Result -> Bool
(Result -> Result -> Bool)
-> (Result -> Result -> Bool) -> Eq Result
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Result -> Result -> Bool
$c/= :: Result -> Result -> Bool
== :: Result -> Result -> Bool
$c== :: Result -> Result -> Bool
Eq, Eq Result
Eq Result =>
(Result -> Result -> Ordering)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Bool)
-> (Result -> Result -> Result)
-> (Result -> Result -> Result)
-> Ord Result
Result -> Result -> Bool
Result -> Result -> Ordering
Result -> Result -> Result
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
min :: Result -> Result -> Result
$cmin :: Result -> Result -> Result
max :: Result -> Result -> Result
$cmax :: Result -> Result -> Result
>= :: Result -> Result -> Bool
$c>= :: Result -> Result -> Bool
> :: Result -> Result -> Bool
$c> :: Result -> Result -> Bool
<= :: Result -> Result -> Bool
$c<= :: Result -> Result -> Bool
< :: Result -> Result -> Bool
$c< :: Result -> Result -> Bool
compare :: Result -> Result -> Ordering
$ccompare :: Result -> Result -> Ordering
$cp1Ord :: Eq Result
Ord, ReadPrec [Result]
ReadPrec Result
Int -> ReadS Result
ReadS [Result]
(Int -> ReadS Result)
-> ReadS [Result]
-> ReadPrec Result
-> ReadPrec [Result]
-> Read Result
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Result]
$creadListPrec :: ReadPrec [Result]
readPrec :: ReadPrec Result
$creadPrec :: ReadPrec Result
readList :: ReadS [Result]
$creadList :: ReadS [Result]
readsPrec :: Int -> ReadS Result
$creadsPrec :: Int -> ReadS Result
Read, Int -> Result -> ShowS
[Result] -> ShowS
Result -> String
(Int -> Result -> ShowS)
-> (Result -> String) -> ([Result] -> ShowS) -> Show Result
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Result] -> ShowS
$cshowList :: [Result] -> ShowS
show :: Result -> String
$cshow :: Result -> String
showsPrec :: Int -> Result -> ShowS
$cshowsPrec :: Int -> Result -> ShowS
Show)
data SortKind
= Z3_UNINTERPRETED_SORT
| Z3_BOOL_SORT
| Z3_INT_SORT
| Z3_REAL_SORT
| Z3_BV_SORT
| Z3_ARRAY_SORT
| Z3_DATATYPE_SORT
| Z3_RELATION_SORT
| Z3_FINITE_DOMAIN_SORT
| Z3_FLOATING_POINT_SORT
| Z3_ROUNDING_MODE_SORT
| Z3_UNKNOWN_SORT
deriving (SortKind -> SortKind -> Bool
(SortKind -> SortKind -> Bool)
-> (SortKind -> SortKind -> Bool) -> Eq SortKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SortKind -> SortKind -> Bool
$c/= :: SortKind -> SortKind -> Bool
== :: SortKind -> SortKind -> Bool
$c== :: SortKind -> SortKind -> Bool
Eq, Int -> SortKind -> ShowS
[SortKind] -> ShowS
SortKind -> String
(Int -> SortKind -> ShowS)
-> (SortKind -> String) -> ([SortKind] -> ShowS) -> Show SortKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SortKind] -> ShowS
$cshowList :: [SortKind] -> ShowS
show :: SortKind -> String
$cshow :: SortKind -> String
showsPrec :: Int -> SortKind -> ShowS
$cshowsPrec :: Int -> SortKind -> ShowS
Show)
data ASTKind
= Z3_NUMERAL_AST
| Z3_APP_AST
| Z3_VAR_AST
| Z3_QUANTIFIER_AST
| Z3_SORT_AST
| Z3_FUNC_DECL_AST
| Z3_UNKNOWN_AST
deriving (ASTKind -> ASTKind -> Bool
(ASTKind -> ASTKind -> Bool)
-> (ASTKind -> ASTKind -> Bool) -> Eq ASTKind
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ASTKind -> ASTKind -> Bool
$c/= :: ASTKind -> ASTKind -> Bool
== :: ASTKind -> ASTKind -> Bool
$c== :: ASTKind -> ASTKind -> Bool
Eq, Int -> ASTKind -> ShowS
[ASTKind] -> ShowS
ASTKind -> String
(Int -> ASTKind -> ShowS)
-> (ASTKind -> String) -> ([ASTKind] -> ShowS) -> Show ASTKind
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ASTKind] -> ShowS
$cshowList :: [ASTKind] -> ShowS
show :: ASTKind -> String
$cshow :: ASTKind -> String
showsPrec :: Int -> ASTKind -> ShowS
$cshowsPrec :: Int -> ASTKind -> ShowS
Show)
mkConfig :: IO Config
mkConfig :: IO Config
mkConfig = Ptr Z3_config -> Config
Config (Ptr Z3_config -> Config) -> IO (Ptr Z3_config) -> IO Config
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> IO (Ptr Z3_config)
z3_mk_config
delConfig :: Config -> IO ()
delConfig :: Config -> IO ()
delConfig = Ptr Z3_config -> IO ()
z3_del_config (Ptr Z3_config -> IO ())
-> (Config -> Ptr Z3_config) -> Config -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Config -> Ptr Z3_config
unConfig
setParamValue :: Config -> String -> String -> IO ()
setParamValue :: Config -> String -> String -> IO ()
setParamValue cfg :: Config
cfg s1 :: String
s1 s2 :: String
s2 =
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
s1 ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \cs1 :: CString
cs1 ->
String -> (CString -> IO ()) -> IO ()
forall a. String -> (CString -> IO a) -> IO a
withCString String
s2 ((CString -> IO ()) -> IO ()) -> (CString -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \cs2 :: CString
cs2 ->
Ptr Z3_config -> CString -> CString -> IO ()
z3_set_param_value (Config -> Ptr Z3_config
unConfig Config
cfg) CString
cs1 CString
cs2
withConfig :: (Config -> IO a) -> IO a
withConfig :: (Config -> IO a) -> IO a
withConfig = IO Config -> (Config -> IO ()) -> (Config -> IO a) -> IO a
forall a b c. IO a -> (a -> IO b) -> (a -> IO c) -> IO c
bracket IO Config
mkConfig Config -> IO ()
delConfig
mkContextWith :: (Ptr Z3_config -> IO (Ptr Z3_context)) -> Config -> IO Context
mkContextWith :: (Ptr Z3_config -> IO (Ptr Z3_context)) -> Config -> IO Context
mkContextWith mkCtx :: Ptr Z3_config -> IO (Ptr Z3_context)
mkCtx cfg :: Config
cfg = do
Ptr Z3_context
ctxPtr <- Ptr Z3_config -> IO (Ptr Z3_context)
mkCtx (Config -> Ptr Z3_config
unConfig Config
cfg)
Ptr Z3_context -> FunPtr Z3_error_handler -> IO ()
z3_set_error_handler Ptr Z3_context
ctxPtr FunPtr Z3_error_handler
forall a. FunPtr a
nullFunPtr
IORef Word
count <- Word -> IO (IORef Word)
forall a. a -> IO (IORef a)
newIORef 1
ForeignPtr Z3_context -> IORef Word -> Context
Context (ForeignPtr Z3_context -> IORef Word -> Context)
-> IO (ForeignPtr Z3_context) -> IO (IORef Word -> Context)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr Z3_context -> IO () -> IO (ForeignPtr Z3_context)
forall a. Ptr a -> IO () -> IO (ForeignPtr a)
newForeignPtr Ptr Z3_context
ctxPtr (Ptr Z3_context -> IORef Word -> IO ()
contextDecRef Ptr Z3_context
ctxPtr IORef Word
count)
IO (IORef Word -> Context) -> IO (IORef Word) -> IO Context
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> IORef Word -> IO (IORef Word)
forall (f :: * -> *) a. Applicative f => a -> f a
pure IORef Word
count
mkContext :: Config -> IO Context
mkContext :: Config -> IO Context
mkContext = (Ptr Z3_config -> IO (Ptr Z3_context)) -> Config -> IO Context
mkContextWith Ptr Z3_config -> IO (Ptr Z3_context)
z3_mk_context_rc
contextIncRef :: Context -> IO ()
contextIncRef :: Context -> IO ()
contextIncRef ctx :: Context
ctx = IORef Word -> (Word -> (Word, ())) -> IO ()
forall a b. IORef a -> (a -> (a, b)) -> IO b
atomicModifyIORef' (Context -> IORef Word
refCount Context
ctx) ((Word -> (Word, ())) -> IO ()) -> (Word -> (Word, ())) -> IO ()
forall a b. (a -> b) -> a -> b
$ \n :: Word
n ->
(Word
nWord -> Word -> Word
forall a. Num a => a -> a -> a
+1, ())
contextDecRef :: Ptr Z3_context -> IORef Word -> IO ()
contextDecRef :: Ptr Z3_context -> IORef Word -> IO ()
contextDecRef ctxPtr :: Ptr Z3_context
ctxPtr count :: IORef Word
count = IO (IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => m (m a) -> m a
join (IO (IO ()) -> IO ()) -> IO (IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ IORef Word -> (Word -> (Word, IO ())) -> IO (IO ())
forall a b. IORef a -> (a -> (a, b)) -> IO b
atomicModifyIORef' IORef Word
count ((Word -> (Word, IO ())) -> IO (IO ()))
-> (Word -> (Word, IO ())) -> IO (IO ())
forall a b. (a -> b) -> a -> b
$ \n :: Word
n ->
if Word
n Word -> Word -> Bool
forall a. Ord a => a -> a -> Bool
> 1
then (Word
nWord -> Word -> Word
forall a. Num a => a -> a -> a
-1, () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ())
else ( 0, Ptr Z3_context -> IO ()
z3_del_context Ptr Z3_context
ctxPtr)
mkParams :: Context -> IO Params
mkParams :: Context -> IO Params
mkParams = (Ptr Z3_context -> IO (Ptr Z3_params)) -> Context -> IO Params
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_params)
z3_mk_params
paramsSetBool :: Context -> Params -> Symbol -> Bool -> IO ()
paramsSetBool :: Context -> Params -> Symbol -> Bool -> IO ()
paramsSetBool = (Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> Z3_bool -> IO ())
-> Context -> Params -> Symbol -> Bool -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> Z3_bool -> IO ()
z3_params_set_bool
paramsSetUInt :: Context -> Params -> Symbol -> Word -> IO ()
paramsSetUInt :: Context -> Params -> Symbol -> Word -> IO ()
paramsSetUInt = (Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> CUInt -> IO ())
-> Context -> Params -> Symbol -> Word -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context -> Ptr Z3_params -> Ptr Z3_symbol -> CUInt -> IO ()
z3_params_set_uint
paramsSetDouble :: Context -> Params -> Symbol -> Double -> IO ()
paramsSetDouble :: Context -> Params -> Symbol -> Double -> IO ()
paramsSetDouble = (Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> CDouble -> IO ())
-> Context -> Params -> Symbol -> Double -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> CDouble -> IO ()
z3_params_set_double
paramsSetSymbol :: Context -> Params -> Symbol -> Symbol -> IO ()
paramsSetSymbol :: Context -> Params -> Symbol -> Symbol -> IO ()
paramsSetSymbol = (Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> Ptr Z3_symbol -> IO ())
-> Context -> Params -> Symbol -> Symbol -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_params -> Ptr Z3_symbol -> Ptr Z3_symbol -> IO ()
z3_params_set_symbol
paramsToString :: Context -> Params -> IO String
paramsToString :: Context -> Params -> IO String
paramsToString = (Ptr Z3_context -> Ptr Z3_params -> IO CString)
-> Context -> Params -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_params -> IO CString
z3_params_to_string
mkIntSymbol :: Integral int => Context -> int -> IO Symbol
mkIntSymbol :: Context -> int -> IO Symbol
mkIntSymbol c :: Context
c i :: int
i
| 0 int -> int -> Bool
forall a. Ord a => a -> a -> Bool
<= int
i Bool -> Bool -> Bool
&& int
i int -> int -> Bool
forall a. Ord a => a -> a -> Bool
<= 2int -> Int -> int
forall a b. (Num a, Integral b) => a -> b -> a
^(30::Int)int -> int -> int
forall a. Num a => a -> a -> a
-1
= (Ptr Z3_context -> CInt -> IO (Ptr Z3_symbol))
-> Context -> int -> IO Symbol
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> CInt -> IO (Ptr Z3_symbol)
z3_mk_int_symbol Context
c int
i
| Bool
otherwise
= String -> IO Symbol
forall a. HasCallStack => String -> a
error "Z3.Base.mkIntSymbol: invalid range"
mkStringSymbol :: Context -> String -> IO Symbol
mkStringSymbol :: Context -> String -> IO Symbol
mkStringSymbol = (Ptr Z3_context -> CString -> IO (Ptr Z3_symbol))
-> Context -> String -> IO Symbol
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> CString -> IO (Ptr Z3_symbol)
z3_mk_string_symbol
mkUninterpretedSort :: Context -> Symbol -> IO Sort
mkUninterpretedSort :: Context -> Symbol -> IO Sort
mkUninterpretedSort = (Ptr Z3_context -> Ptr Z3_symbol -> IO (Ptr Z3_sort))
-> Context -> Symbol -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_symbol -> IO (Ptr Z3_sort)
z3_mk_uninterpreted_sort
mkBoolSort :: Context -> IO Sort
mkBoolSort :: Context -> IO Sort
mkBoolSort = (Ptr Z3_context -> IO (Ptr Z3_sort)) -> Context -> IO Sort
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_sort)
z3_mk_bool_sort
mkIntSort :: Context -> IO Sort
mkIntSort :: Context -> IO Sort
mkIntSort = (Ptr Z3_context -> IO (Ptr Z3_sort)) -> Context -> IO Sort
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_sort)
z3_mk_int_sort
mkRealSort :: Context -> IO Sort
mkRealSort :: Context -> IO Sort
mkRealSort = (Ptr Z3_context -> IO (Ptr Z3_sort)) -> Context -> IO Sort
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_sort)
z3_mk_real_sort
mkBvSort :: Integral int => Context -> int -> IO Sort
mkBvSort :: Context -> int -> IO Sort
mkBvSort c :: Context
c i :: int
i
| int
i int -> int -> Bool
forall a. Ord a => a -> a -> Bool
>= 0 = (Ptr Z3_context -> CUInt -> IO (Ptr Z3_sort))
-> Context -> int -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> CUInt -> IO (Ptr Z3_sort)
z3_mk_bv_sort Context
c int
i
| Bool
otherwise = String -> IO Sort
forall a. HasCallStack => String -> a
error "Z3.Base.mkBvSort: negative size"
mkFiniteDomainSort :: Context -> Symbol -> Word64 -> IO Sort
mkFiniteDomainSort :: Context -> Symbol -> Word64 -> IO Sort
mkFiniteDomainSort = (Ptr Z3_context -> Ptr Z3_symbol -> CULLong -> IO (Ptr Z3_sort))
-> Context -> Symbol -> Word64 -> IO Sort
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_symbol -> CULLong -> IO (Ptr Z3_sort)
z3_mk_finite_domain_sort
mkArraySort :: Context -> Sort -> Sort -> IO Sort
mkArraySort :: Context -> Sort -> Sort -> IO Sort
mkArraySort = (Ptr Z3_context -> Ptr Z3_sort -> Ptr Z3_sort -> IO (Ptr Z3_sort))
-> Context -> Sort -> Sort -> IO Sort
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_sort -> Ptr Z3_sort -> IO (Ptr Z3_sort)
z3_mk_array_sort
mkTupleSort :: Context
-> Symbol
-> [(Symbol, Sort)]
-> IO (Sort, FuncDecl, [FuncDecl])
mkTupleSort :: Context
-> Symbol -> [(Symbol, Sort)] -> IO (Sort, FuncDecl, [FuncDecl])
mkTupleSort c :: Context
c sym :: Symbol
sym symSorts :: [(Symbol, Sort)]
symSorts = Context
-> (Ptr Z3_context -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Ptr Z3_context -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Symbol
-> (Ptr Z3_symbol -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Symbol
sym ((Ptr Z3_symbol -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Ptr Z3_symbol -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \symPtr :: Ptr Z3_symbol
symPtr ->
[Symbol]
-> (Int -> Ptr (Ptr Z3_symbol) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Symbol]
syms ((Int -> Ptr (Ptr Z3_symbol) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Int -> Ptr (Ptr Z3_symbol) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \ n :: Int
n symsPtr :: Ptr (Ptr Z3_symbol)
symsPtr ->
[Sort]
-> (Ptr (Ptr Z3_sort) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Sort]
sorts ((Ptr (Ptr Z3_sort) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Ptr (Ptr Z3_sort) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \ sortsPtr :: Ptr (Ptr Z3_sort)
sortsPtr ->
(Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \ outConstrPtr :: Ptr (Ptr Z3_func_decl)
outConstrPtr ->
Int
-> (Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
n ((Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl]))
-> (Ptr (Ptr Z3_func_decl) -> IO (Sort, FuncDecl, [FuncDecl]))
-> IO (Sort, FuncDecl, [FuncDecl])
forall a b. (a -> b) -> a -> b
$ \ outProjsPtr :: Ptr (Ptr Z3_func_decl)
outProjsPtr -> do
Ptr Z3_sort
srtPtr <- Ptr Z3_context -> IO (Ptr Z3_sort) -> IO (Ptr Z3_sort)
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (IO (Ptr Z3_sort) -> IO (Ptr Z3_sort))
-> IO (Ptr Z3_sort) -> IO (Ptr Z3_sort)
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context
-> Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_func_decl)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_sort)
z3_mk_tuple_sort Ptr Z3_context
cPtr Ptr Z3_symbol
symPtr
(Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n) Ptr (Ptr Z3_symbol)
symsPtr Ptr (Ptr Z3_sort)
sortsPtr
Ptr (Ptr Z3_func_decl)
outConstrPtr Ptr (Ptr Z3_func_decl)
outProjsPtr
Ptr Z3_func_decl
outConstr <- Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_func_decl)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Z3_func_decl)
outConstrPtr
[Ptr Z3_func_decl]
outProjs <- Int -> Ptr (Ptr Z3_func_decl) -> IO [Ptr Z3_func_decl]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
n Ptr (Ptr Z3_func_decl)
outProjsPtr
Sort
sort <- Context -> Ptr Z3_sort -> IO Sort
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c Ptr Z3_sort
srtPtr
FuncDecl
constrFd <- Context -> Ptr Z3_func_decl -> IO FuncDecl
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c Ptr Z3_func_decl
outConstr
[FuncDecl]
projsFds <- (Ptr Z3_func_decl -> IO FuncDecl)
-> [Ptr Z3_func_decl] -> IO [FuncDecl]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> Ptr Z3_func_decl -> IO FuncDecl
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c) [Ptr Z3_func_decl]
outProjs
(Sort, FuncDecl, [FuncDecl]) -> IO (Sort, FuncDecl, [FuncDecl])
forall (m :: * -> *) a. Monad m => a -> m a
return (Sort
sort, FuncDecl
constrFd, [FuncDecl]
projsFds)
where (syms :: [Symbol]
syms, sorts :: [Sort]
sorts) = [(Symbol, Sort)] -> ([Symbol], [Sort])
forall a b. [(a, b)] -> ([a], [b])
unzip [(Symbol, Sort)]
symSorts
mkConstructor :: Context
-> Symbol
-> Symbol
-> [(Symbol, Maybe Sort, Int)]
-> IO Constructor
mkConstructor :: Context
-> Symbol
-> Symbol
-> [(Symbol, Maybe Sort, Int)]
-> IO Constructor
mkConstructor c :: Context
c sym :: Symbol
sym recog :: Symbol
recog symSortsRefs :: [(Symbol, Maybe Sort, Int)]
symSortsRefs =
Context -> (Ptr Z3_context -> IO Constructor) -> IO Constructor
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO Constructor) -> IO Constructor)
-> (Ptr Z3_context -> IO Constructor) -> IO Constructor
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Symbol -> (Ptr Z3_symbol -> IO Constructor) -> IO Constructor
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Symbol
sym ((Ptr Z3_symbol -> IO Constructor) -> IO Constructor)
-> (Ptr Z3_symbol -> IO Constructor) -> IO Constructor
forall a b. (a -> b) -> a -> b
$ \symPtr :: Ptr Z3_symbol
symPtr ->
Symbol -> (Ptr Z3_symbol -> IO Constructor) -> IO Constructor
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Symbol
recog ((Ptr Z3_symbol -> IO Constructor) -> IO Constructor)
-> (Ptr Z3_symbol -> IO Constructor) -> IO Constructor
forall a b. (a -> b) -> a -> b
$ \recogPtr :: Ptr Z3_symbol
recogPtr ->
[Symbol]
-> (CUInt -> Ptr (Ptr Z3_symbol) -> IO Constructor)
-> IO Constructor
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Symbol]
syms ((CUInt -> Ptr (Ptr Z3_symbol) -> IO Constructor)
-> IO Constructor)
-> (CUInt -> Ptr (Ptr Z3_symbol) -> IO Constructor)
-> IO Constructor
forall a b. (a -> b) -> a -> b
$ \ n :: CUInt
n symsPtr :: Ptr (Ptr Z3_symbol)
symsPtr ->
[Maybe Sort]
-> (Ptr (Ptr Z3_sort) -> IO Constructor) -> IO Constructor
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Maybe Sort]
maybeSorts ((Ptr (Ptr Z3_sort) -> IO Constructor) -> IO Constructor)
-> (Ptr (Ptr Z3_sort) -> IO Constructor) -> IO Constructor
forall a b. (a -> b) -> a -> b
$ \ sortsPtr :: Ptr (Ptr Z3_sort)
sortsPtr ->
[Integer] -> (Ptr CUInt -> IO Constructor) -> IO Constructor
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray ((Int -> Integer) -> [Int] -> [Integer]
forall a b. (a -> b) -> [a] -> [b]
map Int -> Integer
forall a. Integral a => a -> Integer
toInteger [Int]
refs) ((Ptr CUInt -> IO Constructor) -> IO Constructor)
-> (Ptr CUInt -> IO Constructor) -> IO Constructor
forall a b. (a -> b) -> a -> b
$ \ refsPtr :: Ptr CUInt
refsPtr -> do
Ptr Z3_constructor
constructor <- Ptr Z3_context
-> IO (Ptr Z3_constructor) -> IO (Ptr Z3_constructor)
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (IO (Ptr Z3_constructor) -> IO (Ptr Z3_constructor))
-> IO (Ptr Z3_constructor) -> IO (Ptr Z3_constructor)
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context
-> Ptr Z3_symbol
-> Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> Ptr CUInt
-> IO (Ptr Z3_constructor)
z3_mk_constructor
Ptr Z3_context
cPtr Ptr Z3_symbol
symPtr Ptr Z3_symbol
recogPtr CUInt
n Ptr (Ptr Z3_symbol)
symsPtr Ptr (Ptr Z3_sort)
sortsPtr Ptr CUInt
refsPtr
Context -> Ptr Z3_constructor -> IO Constructor
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c Ptr Z3_constructor
constructor
where (syms :: [Symbol]
syms, maybeSorts :: [Maybe Sort]
maybeSorts, refs :: [Int]
refs) = [(Symbol, Maybe Sort, Int)] -> ([Symbol], [Maybe Sort], [Int])
forall a b c. [(a, b, c)] -> ([a], [b], [c])
unzip3 [(Symbol, Maybe Sort, Int)]
symSortsRefs
mkDatatype :: Context
-> Symbol
-> [Constructor]
-> IO Sort
mkDatatype :: Context -> Symbol -> [Constructor] -> IO Sort
mkDatatype c :: Context
c sym :: Symbol
sym consList :: [Constructor]
consList = [Constructor]
-> (CUInt -> Ptr (Ptr Z3_constructor) -> IO Sort) -> IO Sort
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Constructor]
consList ((CUInt -> Ptr (Ptr Z3_constructor) -> IO Sort) -> IO Sort)
-> (CUInt -> Ptr (Ptr Z3_constructor) -> IO Sort) -> IO Sort
forall a b. (a -> b) -> a -> b
$ \ n :: CUInt
n consPtrs :: Ptr (Ptr Z3_constructor)
consPtrs -> do
Context -> (Ptr Z3_context -> IO (Ptr Z3_sort)) -> IO Sort
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_sort)) -> IO Sort)
-> (Ptr Z3_context -> IO (Ptr Z3_sort)) -> IO Sort
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context
-> Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_constructor)
-> IO (Ptr Z3_sort)
z3_mk_datatype Ptr Z3_context
cPtr (Symbol -> Ptr Z3_symbol
unSymbol Symbol
sym) CUInt
n Ptr (Ptr Z3_constructor)
consPtrs
mkConstructorList :: Context
-> [Constructor]
-> IO ConstructorList
mkConstructorList :: Context -> [Constructor] -> IO ConstructorList
mkConstructorList c :: Context
c consList :: [Constructor]
consList = [Constructor]
-> (CUInt -> Ptr (Ptr Z3_constructor) -> IO ConstructorList)
-> IO ConstructorList
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Constructor]
consList ((CUInt -> Ptr (Ptr Z3_constructor) -> IO ConstructorList)
-> IO ConstructorList)
-> (CUInt -> Ptr (Ptr Z3_constructor) -> IO ConstructorList)
-> IO ConstructorList
forall a b. (a -> b) -> a -> b
$ \ n :: CUInt
n consPtrs :: Ptr (Ptr Z3_constructor)
consPtrs -> do
Context
-> (Ptr Z3_context -> IO (Ptr Z3_constructor_list))
-> IO ConstructorList
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_constructor_list))
-> IO ConstructorList)
-> (Ptr Z3_context -> IO (Ptr Z3_constructor_list))
-> IO ConstructorList
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context
-> CUInt
-> Ptr (Ptr Z3_constructor)
-> IO (Ptr Z3_constructor_list)
z3_mk_constructor_list Ptr Z3_context
cPtr CUInt
n Ptr (Ptr Z3_constructor)
consPtrs
mkDatatypes :: Context
-> [Symbol]
-> [[Constructor]]
-> IO ([Sort])
mkDatatypes :: Context -> [Symbol] -> [[Constructor]] -> IO [Sort]
mkDatatypes c :: Context
c syms :: [Symbol]
syms consLists :: [[Constructor]]
consLists =
if [[Constructor]] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [[Constructor]]
consLists Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
n then do
[ConstructorList]
consLists' <- ([Constructor] -> IO ConstructorList)
-> [[Constructor]] -> IO [ConstructorList]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> [Constructor] -> IO ConstructorList
mkConstructorList Context
c) [[Constructor]]
consLists
Context -> (Ptr Z3_context -> IO [Sort]) -> IO [Sort]
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO [Sort]) -> IO [Sort])
-> (Ptr Z3_context -> IO [Sort]) -> IO [Sort]
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
[Symbol]
-> (CUInt -> Ptr (Ptr Z3_symbol) -> IO [Sort]) -> IO [Sort]
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Symbol]
syms ((CUInt -> Ptr (Ptr Z3_symbol) -> IO [Sort]) -> IO [Sort])
-> (CUInt -> Ptr (Ptr Z3_symbol) -> IO [Sort]) -> IO [Sort]
forall a b. (a -> b) -> a -> b
$ \ symLen :: CUInt
symLen symsPtr :: Ptr (Ptr Z3_symbol)
symsPtr ->
[ConstructorList]
-> (Ptr (Ptr Z3_constructor_list) -> IO [Sort]) -> IO [Sort]
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [ConstructorList]
consLists' ((Ptr (Ptr Z3_constructor_list) -> IO [Sort]) -> IO [Sort])
-> (Ptr (Ptr Z3_constructor_list) -> IO [Sort]) -> IO [Sort]
forall a b. (a -> b) -> a -> b
$ \ consPtr :: Ptr (Ptr Z3_constructor_list)
consPtr ->
Int -> (Ptr (Ptr Z3_sort) -> IO [Sort]) -> IO [Sort]
forall a b. Storable a => Int -> (Ptr a -> IO b) -> IO b
allocaArray Int
n ((Ptr (Ptr Z3_sort) -> IO [Sort]) -> IO [Sort])
-> (Ptr (Ptr Z3_sort) -> IO [Sort]) -> IO [Sort]
forall a b. (a -> b) -> a -> b
$ \ sortsPtr :: Ptr (Ptr Z3_sort)
sortsPtr -> do
Ptr Z3_context
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_constructor_list)
-> IO ()
z3_mk_datatypes Ptr Z3_context
cPtr CUInt
symLen Ptr (Ptr Z3_symbol)
symsPtr Ptr (Ptr Z3_sort)
sortsPtr Ptr (Ptr Z3_constructor_list)
consPtr
Context -> Int -> Ptr (Ptr Z3_sort) -> IO [Sort]
forall h c.
(Marshal h c, Storable c) =>
Context -> Int -> Ptr c -> IO [h]
peekArrayToHs Context
c Int
n Ptr (Ptr Z3_sort)
sortsPtr
else
String -> IO [Sort]
forall a. HasCallStack => String -> a
error "Z3.Base.mkDatatypes: lists of different length"
where n :: Int
n = [Symbol] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Symbol]
syms
mkSetSort :: Context -> Sort -> IO Sort
mkSetSort :: Context -> Sort -> IO Sort
mkSetSort = (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort))
-> Context -> Sort -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort)
z3_mk_set_sort
mkFuncDecl :: Context
-> Symbol
-> [Sort]
-> Sort
-> IO FuncDecl
mkFuncDecl :: Context -> Symbol -> [Sort] -> Sort -> IO FuncDecl
mkFuncDecl ctx :: Context
ctx smb :: Symbol
smb dom :: [Sort]
dom rng :: Sort
rng =
(Ptr Z3_context
-> Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> Context
-> ((Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
z3_mk_func_decl Context
ctx (((Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl)
-> ((Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
f ->
Symbol
-> (Ptr Z3_symbol -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Symbol
smb ((Ptr Z3_symbol -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl))
-> (Ptr Z3_symbol -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \ptrSym :: Ptr Z3_symbol
ptrSym ->
[Sort]
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Sort]
dom ((CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \domNum :: CUInt
domNum domArr :: Ptr (Ptr Z3_sort)
domArr ->
Sort
-> (Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Sort
rng ((Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl))
-> (Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \ptrRange :: Ptr Z3_sort
ptrRange ->
Ptr Z3_symbol
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
f Ptr Z3_symbol
ptrSym CUInt
domNum Ptr (Ptr Z3_sort)
domArr Ptr Z3_sort
ptrRange
mkApp :: Context -> FuncDecl -> [AST] -> IO AST
mkApp :: Context -> FuncDecl -> [AST] -> IO AST
mkApp ctx :: Context
ctx fd :: FuncDecl
fd args :: [AST]
args = (Ptr Z3_context
-> Ptr Z3_func_decl
-> CUInt
-> Ptr (Ptr Z3_ast)
-> IO (Ptr Z3_ast))
-> Context
-> ((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_app Context
ctx (((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f ->
FuncDecl
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c FuncDecl
fd ((Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \fdPtr :: Ptr Z3_func_decl
fdPtr ->
[AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
args ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \argsNum :: CUInt
argsNum argsArr :: Ptr (Ptr Z3_ast)
argsArr ->
Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f Ptr Z3_func_decl
fdPtr CUInt
argsNum Ptr (Ptr Z3_ast)
argsArr
mkConst :: Context -> Symbol -> Sort -> IO AST
mkConst :: Context -> Symbol -> Sort -> IO AST
mkConst = (Ptr Z3_context -> Ptr Z3_symbol -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Symbol -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_symbol -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_const
mkFreshFuncDecl :: Context -> String -> [Sort] -> Sort -> IO FuncDecl
mkFreshFuncDecl :: Context -> String -> [Sort] -> Sort -> IO FuncDecl
mkFreshFuncDecl ctx :: Context
ctx str :: String
str dom :: [Sort]
dom rng :: Sort
rng =
String -> (CString -> IO FuncDecl) -> IO FuncDecl
forall a. String -> (CString -> IO a) -> IO a
withCString String
str ((CString -> IO FuncDecl) -> IO FuncDecl)
-> (CString -> IO FuncDecl) -> IO FuncDecl
forall a b. (a -> b) -> a -> b
$ \cstr :: CString
cstr ->
(Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> Context
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
forall z3_context.
Ptr z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
z3_mk_fresh_func_decl Context
ctx (((CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl)
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> IO FuncDecl
forall a b. (a -> b) -> a -> b
$ \f :: CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
f ->
[Sort]
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Sort]
dom ((CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \domNum :: CUInt
domNum domArr :: Ptr (Ptr Z3_sort)
domArr ->
Sort
-> (Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Sort
rng ((Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl))
-> (Ptr Z3_sort -> IO (Ptr Z3_func_decl)) -> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \ptrRange :: Ptr Z3_sort
ptrRange ->
CString
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr Z3_sort
-> IO (Ptr Z3_func_decl)
f CString
cstr CUInt
domNum Ptr (Ptr Z3_sort)
domArr Ptr Z3_sort
ptrRange
mkFreshConst :: Context
-> String
-> Sort
-> IO AST
mkFreshConst :: Context -> String -> Sort -> IO AST
mkFreshConst = (Ptr Z3_context -> CString -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> String -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CString -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_fresh_const
mkVar :: Context -> Symbol -> Sort -> IO AST
mkVar :: Context -> Symbol -> Sort -> IO AST
mkVar = Context -> Symbol -> Sort -> IO AST
mkConst
mkBoolVar :: Context -> Symbol -> IO AST
mkBoolVar :: Context -> Symbol -> IO AST
mkBoolVar ctx :: Context
ctx sym :: Symbol
sym = Context -> Symbol -> Sort -> IO AST
mkVar Context
ctx Symbol
sym (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkBoolSort Context
ctx
mkRealVar :: Context -> Symbol -> IO AST
mkRealVar :: Context -> Symbol -> IO AST
mkRealVar ctx :: Context
ctx sym :: Symbol
sym = Context -> Symbol -> Sort -> IO AST
mkVar Context
ctx Symbol
sym (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkRealSort Context
ctx
mkIntVar :: Context -> Symbol -> IO AST
mkIntVar :: Context -> Symbol -> IO AST
mkIntVar ctx :: Context
ctx sym :: Symbol
sym = Context -> Symbol -> Sort -> IO AST
mkVar Context
ctx Symbol
sym (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkIntSort Context
ctx
mkBvVar :: Context -> Symbol
-> Int
-> IO AST
mkBvVar :: Context -> Symbol -> Int -> IO AST
mkBvVar ctx :: Context
ctx sym :: Symbol
sym sz :: Int
sz = Context -> Symbol -> Sort -> IO AST
mkVar Context
ctx Symbol
sym (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> Int -> IO Sort
forall int. Integral int => Context -> int -> IO Sort
mkBvSort Context
ctx Int
sz
mkFreshVar :: Context -> String -> Sort -> IO AST
mkFreshVar :: Context -> String -> Sort -> IO AST
mkFreshVar = Context -> String -> Sort -> IO AST
mkFreshConst
mkFreshBoolVar :: Context -> String -> IO AST
mkFreshBoolVar :: Context -> String -> IO AST
mkFreshBoolVar ctx :: Context
ctx str :: String
str = Context -> String -> Sort -> IO AST
mkFreshVar Context
ctx String
str (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkBoolSort Context
ctx
mkFreshRealVar :: Context -> String -> IO AST
mkFreshRealVar :: Context -> String -> IO AST
mkFreshRealVar ctx :: Context
ctx str :: String
str = Context -> String -> Sort -> IO AST
mkFreshVar Context
ctx String
str (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkRealSort Context
ctx
mkFreshIntVar :: Context -> String -> IO AST
mkFreshIntVar :: Context -> String -> IO AST
mkFreshIntVar ctx :: Context
ctx str :: String
str = Context -> String -> Sort -> IO AST
mkFreshVar Context
ctx String
str (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkIntSort Context
ctx
mkFreshBvVar :: Context -> String
-> Int
-> IO AST
mkFreshBvVar :: Context -> String -> Int -> IO AST
mkFreshBvVar ctx :: Context
ctx str :: String
str sz :: Int
sz = Context -> String -> Sort -> IO AST
mkFreshVar Context
ctx String
str (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> Int -> IO Sort
forall int. Integral int => Context -> int -> IO Sort
mkBvSort Context
ctx Int
sz
mkTrue :: Context -> IO AST
mkTrue :: Context -> IO AST
mkTrue = (Ptr Z3_context -> IO (Ptr Z3_ast)) -> Context -> IO AST
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_ast)
z3_mk_true
mkFalse :: Context -> IO AST
mkFalse :: Context -> IO AST
mkFalse = (Ptr Z3_context -> IO (Ptr Z3_ast)) -> Context -> IO AST
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_ast)
z3_mk_false
mkEq :: Context -> AST -> AST -> IO AST
mkEq :: Context -> AST -> AST -> IO AST
mkEq = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_eq
mkDistinct :: Context -> [AST] -> IO AST
mkDistinct :: Context -> [AST] -> IO AST
mkDistinct = (Ptr Z3_context -> IO (Ptr Z3_ast))
-> (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> [AST]
-> IO AST
liftAstN Ptr Z3_context -> IO (Ptr Z3_ast)
z3_mk_true Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_distinct
mkNot :: Context -> AST -> IO AST
mkNot :: Context -> AST -> IO AST
mkNot = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_not
mkIte :: Context -> AST -> AST -> AST -> IO AST
mkIte :: Context -> AST -> AST -> AST -> IO AST
mkIte = (Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> AST -> IO AST
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_ite
mkIff :: Context -> AST -> AST -> IO AST
mkIff :: Context -> AST -> AST -> IO AST
mkIff = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_iff
mkImplies :: Context -> AST -> AST -> IO AST
mkImplies :: Context -> AST -> AST -> IO AST
mkImplies = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_implies
mkXor :: Context -> AST -> AST -> IO AST
mkXor :: Context -> AST -> AST -> IO AST
mkXor = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_xor
mkAnd :: Context -> [AST] -> IO AST
mkAnd :: Context -> [AST] -> IO AST
mkAnd = (Ptr Z3_context -> IO (Ptr Z3_ast))
-> (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> [AST]
-> IO AST
liftAstN Ptr Z3_context -> IO (Ptr Z3_ast)
z3_mk_true Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_and
mkOr :: Context -> [AST] -> IO AST
mkOr :: Context -> [AST] -> IO AST
mkOr = (Ptr Z3_context -> IO (Ptr Z3_ast))
-> (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> [AST]
-> IO AST
liftAstN Ptr Z3_context -> IO (Ptr Z3_ast)
z3_mk_false Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_or
mkBool :: Context -> Bool -> IO AST
mkBool :: Context -> Bool -> IO AST
mkBool ctx :: Context
ctx False = Context -> IO AST
mkFalse Context
ctx
mkBool ctx :: Context
ctx True = Context -> IO AST
mkTrue Context
ctx
mkAdd :: Context -> [AST] -> IO AST
mkAdd :: Context -> [AST] -> IO AST
mkAdd ctx :: Context
ctx = IO AST
-> (NonEmpty AST -> IO AST) -> Maybe (NonEmpty AST) -> IO AST
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Context -> Integer -> IO AST
mkInteger Context
ctx 0) ((Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_add Context
ctx) (Maybe (NonEmpty AST) -> IO AST)
-> ([AST] -> Maybe (NonEmpty AST)) -> [AST] -> IO AST
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [AST] -> Maybe (NonEmpty AST)
forall a. [a] -> Maybe (NonEmpty a)
nonEmpty
mkMul :: Context -> [AST] -> IO AST
mkMul :: Context -> [AST] -> IO AST
mkMul ctx :: Context
ctx = IO AST
-> (NonEmpty AST -> IO AST) -> Maybe (NonEmpty AST) -> IO AST
forall b a. b -> (a -> b) -> Maybe a -> b
maybe (Context -> Integer -> IO AST
mkInteger Context
ctx 1) ((Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_mul Context
ctx) (Maybe (NonEmpty AST) -> IO AST)
-> ([AST] -> Maybe (NonEmpty AST)) -> [AST] -> IO AST
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [AST] -> Maybe (NonEmpty AST)
forall a. [a] -> Maybe (NonEmpty a)
nonEmpty
mkSub :: Context -> NonEmpty AST -> IO AST
mkSub :: Context -> NonEmpty AST -> IO AST
mkSub = (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_sub
mkUnaryMinus :: Context -> AST -> IO AST
mkUnaryMinus :: Context -> AST -> IO AST
mkUnaryMinus = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_unary_minus
mkDiv :: Context -> AST -> AST -> IO AST
mkDiv :: Context -> AST -> AST -> IO AST
mkDiv = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_div
mkMod :: Context -> AST -> AST -> IO AST
mkMod :: Context -> AST -> AST -> IO AST
mkMod = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_mod
mkRem :: Context -> AST -> AST -> IO AST
mkRem :: Context -> AST -> AST -> IO AST
mkRem = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_rem
mkLt :: Context -> AST -> AST -> IO AST
mkLt :: Context -> AST -> AST -> IO AST
mkLt = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_lt
mkLe :: Context -> AST -> AST -> IO AST
mkLe :: Context -> AST -> AST -> IO AST
mkLe = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_le
mkGt :: Context -> AST -> AST -> IO AST
mkGt :: Context -> AST -> AST -> IO AST
mkGt = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_gt
mkGe :: Context -> AST -> AST -> IO AST
mkGe :: Context -> AST -> AST -> IO AST
mkGe = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_ge
mkInt2Real :: Context -> AST -> IO AST
mkInt2Real :: Context -> AST -> IO AST
mkInt2Real = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_int2real
mkReal2Int :: Context -> AST -> IO AST
mkReal2Int :: Context -> AST -> IO AST
mkReal2Int = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_real2int
mkIsInt :: Context -> AST -> IO AST
mkIsInt :: Context -> AST -> IO AST
mkIsInt = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_is_int
mkBvnot :: Context -> AST -> IO AST
mkBvnot :: Context -> AST -> IO AST
mkBvnot = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvnot
mkBvredand :: Context -> AST -> IO AST
mkBvredand :: Context -> AST -> IO AST
mkBvredand = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvredand
mkBvredor :: Context -> AST -> IO AST
mkBvredor :: Context -> AST -> IO AST
mkBvredor = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvredor
mkBvand :: Context -> AST -> AST -> IO AST
mkBvand :: Context -> AST -> AST -> IO AST
mkBvand = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvand
mkBvor :: Context -> AST -> AST -> IO AST
mkBvor :: Context -> AST -> AST -> IO AST
mkBvor = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvor
mkBvxor :: Context -> AST -> AST -> IO AST
mkBvxor :: Context -> AST -> AST -> IO AST
mkBvxor = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvxor
mkBvnand :: Context -> AST -> AST -> IO AST
mkBvnand :: Context -> AST -> AST -> IO AST
mkBvnand = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvnand
mkBvnor :: Context -> AST -> AST -> IO AST
mkBvnor :: Context -> AST -> AST -> IO AST
mkBvnor = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvnor
mkBvxnor :: Context -> AST -> AST -> IO AST
mkBvxnor :: Context -> AST -> AST -> IO AST
mkBvxnor = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvxnor
mkBvneg :: Context -> AST -> IO AST
mkBvneg :: Context -> AST -> IO AST
mkBvneg = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvneg
mkBvadd :: Context -> AST -> AST -> IO AST
mkBvadd :: Context -> AST -> AST -> IO AST
mkBvadd = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvadd
mkBvsub :: Context -> AST -> AST -> IO AST
mkBvsub :: Context -> AST -> AST -> IO AST
mkBvsub = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsub
mkBvmul :: Context -> AST -> AST -> IO AST
mkBvmul :: Context -> AST -> AST -> IO AST
mkBvmul = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvmul
mkBvudiv :: Context -> AST -> AST -> IO AST
mkBvudiv :: Context -> AST -> AST -> IO AST
mkBvudiv = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvudiv
mkBvsdiv :: Context -> AST -> AST -> IO AST
mkBvsdiv :: Context -> AST -> AST -> IO AST
mkBvsdiv = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsdiv
mkBvurem :: Context -> AST -> AST -> IO AST
mkBvurem :: Context -> AST -> AST -> IO AST
mkBvurem = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvurem
mkBvsrem :: Context -> AST -> AST -> IO AST
mkBvsrem :: Context -> AST -> AST -> IO AST
mkBvsrem = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsrem
mkBvsmod :: Context -> AST -> AST -> IO AST
mkBvsmod :: Context -> AST -> AST -> IO AST
mkBvsmod = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsmod
mkBvult :: Context -> AST -> AST -> IO AST
mkBvult :: Context -> AST -> AST -> IO AST
mkBvult = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvult
mkBvslt :: Context -> AST -> AST -> IO AST
mkBvslt :: Context -> AST -> AST -> IO AST
mkBvslt = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvslt
mkBvule :: Context -> AST -> AST -> IO AST
mkBvule :: Context -> AST -> AST -> IO AST
mkBvule = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvule
mkBvsle :: Context -> AST -> AST -> IO AST
mkBvsle :: Context -> AST -> AST -> IO AST
mkBvsle = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsle
mkBvuge :: Context -> AST -> AST -> IO AST
mkBvuge :: Context -> AST -> AST -> IO AST
mkBvuge = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvuge
mkBvsge :: Context -> AST -> AST -> IO AST
mkBvsge :: Context -> AST -> AST -> IO AST
mkBvsge = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsge
mkBvugt :: Context -> AST -> AST -> IO AST
mkBvugt :: Context -> AST -> AST -> IO AST
mkBvugt = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvugt
mkBvsgt :: Context -> AST -> AST -> IO AST
mkBvsgt :: Context -> AST -> AST -> IO AST
mkBvsgt = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsgt
mkConcat :: Context -> AST -> AST -> IO AST
mkConcat :: Context -> AST -> AST -> IO AST
mkConcat = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_concat
mkExtract :: Context -> Int -> Int -> AST -> IO AST
= (Ptr Z3_context -> CUInt -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> Int -> AST -> IO AST
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context -> CUInt -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_extract
mkSignExt :: Context -> Int -> AST -> IO AST
mkSignExt :: Context -> Int -> AST -> IO AST
mkSignExt = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_sign_ext
mkZeroExt :: Context -> Int -> AST -> IO AST
mkZeroExt :: Context -> Int -> AST -> IO AST
mkZeroExt = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_zero_ext
mkRepeat :: Context -> Int -> AST -> IO AST
mkRepeat :: Context -> Int -> AST -> IO AST
mkRepeat = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_repeat
mkBvshl :: Context -> AST -> AST -> IO AST
mkBvshl :: Context -> AST -> AST -> IO AST
mkBvshl = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvshl
mkBvlshr :: Context -> AST -> AST -> IO AST
mkBvlshr :: Context -> AST -> AST -> IO AST
mkBvlshr = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvlshr
mkBvashr :: Context -> AST -> AST -> IO AST
mkBvashr :: Context -> AST -> AST -> IO AST
mkBvashr = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvashr
mkRotateLeft :: Context -> Int -> AST -> IO AST
mkRotateLeft :: Context -> Int -> AST -> IO AST
mkRotateLeft = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_rotate_left
mkRotateRight :: Context -> Int -> AST -> IO AST
mkRotateRight :: Context -> Int -> AST -> IO AST
mkRotateRight = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_rotate_right
mkExtRotateLeft :: Context -> AST -> AST -> IO AST
mkExtRotateLeft :: Context -> AST -> AST -> IO AST
mkExtRotateLeft = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_ext_rotate_left
mkExtRotateRight :: Context -> AST -> AST -> IO AST
mkExtRotateRight :: Context -> AST -> AST -> IO AST
mkExtRotateRight = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_ext_rotate_right
mkInt2bv :: Context -> Int -> AST -> IO AST
mkInt2bv :: Context -> Int -> AST -> IO AST
mkInt2bv = (Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Int -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_int2bv
mkBv2int :: Context -> AST -> Bool -> IO AST
mkBv2int :: Context -> AST -> Bool -> IO AST
mkBv2int = (Ptr Z3_context -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast))
-> Context -> AST -> Bool -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast)
z3_mk_bv2int
mkBvaddNoOverflow :: Context -> AST -> AST -> Bool -> IO AST
mkBvaddNoOverflow :: Context -> AST -> AST -> Bool -> IO AST
mkBvaddNoOverflow = (Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> Bool -> IO AST
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast)
z3_mk_bvadd_no_overflow
mkBvaddNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvaddNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvaddNoUnderflow = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvadd_no_underflow
mkBvsubNoOverflow :: Context -> AST -> AST -> IO AST
mkBvsubNoOverflow :: Context -> AST -> AST -> IO AST
mkBvsubNoOverflow = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsub_no_overflow
mkBvsubNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvsubNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvsubNoUnderflow = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsub_no_underflow
mkBvsdivNoOverflow :: Context -> AST -> AST -> IO AST
mkBvsdivNoOverflow :: Context -> AST -> AST -> IO AST
mkBvsdivNoOverflow = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvsdiv_no_overflow
mkBvnegNoOverflow :: Context -> AST -> IO AST
mkBvnegNoOverflow :: Context -> AST -> IO AST
mkBvnegNoOverflow = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvneg_no_overflow
mkBvmulNoOverflow :: Context -> AST -> AST -> Bool -> IO AST
mkBvmulNoOverflow :: Context -> AST -> AST -> Bool -> IO AST
mkBvmulNoOverflow = (Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> Bool -> IO AST
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Z3_bool -> IO (Ptr Z3_ast)
z3_mk_bvmul_no_overflow
mkBvmulNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvmulNoUnderflow :: Context -> AST -> AST -> IO AST
mkBvmulNoUnderflow = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_bvmul_no_underflow
mkSelect :: Context
-> AST
-> AST
-> IO AST
mkSelect :: Context -> AST -> AST -> IO AST
mkSelect = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_select
mkStore :: Context
-> AST
-> AST
-> AST
-> IO AST
mkStore :: Context -> AST -> AST -> AST -> IO AST
mkStore = (Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> AST -> IO AST
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_ast -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_store
mkConstArray :: Context
-> Sort
-> AST
-> IO AST
mkConstArray :: Context -> Sort -> AST -> IO AST
mkConstArray = (Ptr Z3_context -> Ptr Z3_sort -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> Sort -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_sort -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_const_array
mkMap :: Context
-> FuncDecl
-> [AST]
-> IO AST
mkMap :: Context -> FuncDecl -> [AST] -> IO AST
mkMap ctx :: Context
ctx fun :: FuncDecl
fun args :: [AST]
args = (Ptr Z3_context
-> Ptr Z3_func_decl
-> CUInt
-> Ptr (Ptr Z3_ast)
-> IO (Ptr Z3_ast))
-> Context
-> ((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_map Context
ctx (((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((Ptr Z3_func_decl
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f ->
FuncDecl
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c FuncDecl
fun ((Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \funPtr :: Ptr Z3_func_decl
funPtr ->
[AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
args ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \argsNum :: CUInt
argsNum argsArr :: Ptr (Ptr Z3_ast)
argsArr ->
Ptr Z3_func_decl -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f Ptr Z3_func_decl
funPtr CUInt
argsNum Ptr (Ptr Z3_ast)
argsArr
mkArrayDefault :: Context
-> AST
-> IO AST
mkArrayDefault :: Context -> AST -> IO AST
mkArrayDefault = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_array_default
mkEmptySet :: Context
-> Sort
-> IO AST
mkEmptySet :: Context -> Sort -> IO AST
mkEmptySet = (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Sort -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_empty_set
mkFullSet :: Context
-> Sort
-> IO AST
mkFullSet :: Context -> Sort -> IO AST
mkFullSet = (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Sort -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_full_set
mkSetAdd :: Context
-> AST
-> AST
-> IO AST
mkSetAdd :: Context -> AST -> AST -> IO AST
mkSetAdd = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_add
mkSetDel :: Context
-> AST
-> AST
-> IO AST
mkSetDel :: Context -> AST -> AST -> IO AST
mkSetDel = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_del
mkSetUnion :: Context -> [AST] -> IO AST
mkSetUnion :: Context -> [AST] -> IO AST
mkSetUnion ctx :: Context
ctx args :: [AST]
args = (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_set_union Context
ctx (((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f ->
[AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
args ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \argsNum :: CUInt
argsNum argsArr :: Ptr (Ptr Z3_ast)
argsArr ->
CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f CUInt
argsNum Ptr (Ptr Z3_ast)
argsArr
mkSetIntersect :: Context -> [AST] -> IO AST
mkSetIntersect :: Context -> [AST] -> IO AST
mkSetIntersect ctx :: Context
ctx args :: [AST]
args = (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_mk_set_intersect Context
ctx (((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f ->
[AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
args ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \argsNum :: CUInt
argsNum argsArr :: Ptr (Ptr Z3_ast)
argsArr ->
CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f CUInt
argsNum Ptr (Ptr Z3_ast)
argsArr
mkSetDifference :: Context
-> AST
-> AST
-> IO AST
mkSetDifference :: Context -> AST -> AST -> IO AST
mkSetDifference = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_difference
mkSetComplement :: Context
-> AST
-> IO AST
mkSetComplement :: Context -> AST -> IO AST
mkSetComplement = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_complement
mkSetMember :: Context
-> AST
-> AST
-> IO AST
mkSetMember :: Context -> AST -> AST -> IO AST
mkSetMember = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_member
mkSetSubset :: Context
-> AST
-> AST
-> IO AST
mkSetSubset :: Context -> AST -> AST -> IO AST
mkSetSubset = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> AST -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_mk_set_subset
mkNumeral :: Context -> String -> Sort -> IO AST
mkNumeral :: Context -> String -> Sort -> IO AST
mkNumeral = (Ptr Z3_context -> CString -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> String -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CString -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_numeral
mkReal :: Context -> Int
-> Int
-> IO AST
mkReal :: Context -> Int -> Int -> IO AST
mkReal ctx :: Context
ctx num :: Int
num den :: Int
den
| Int
den Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= 0 = (Ptr Z3_context -> CInt -> CInt -> IO (Ptr Z3_ast))
-> Context -> Int -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CInt -> CInt -> IO (Ptr Z3_ast)
z3_mk_real Context
ctx Int
num Int
den
| Bool
otherwise = String -> IO AST
forall a. HasCallStack => String -> a
error "Z3.Base.mkReal: zero denominator"
mkInt :: Context -> Int -> Sort -> IO AST
mkInt :: Context -> Int -> Sort -> IO AST
mkInt = (Ptr Z3_context -> CInt -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Int -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CInt -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_int
mkUnsignedInt :: Context -> Word -> Sort -> IO AST
mkUnsignedInt :: Context -> Word -> Sort -> IO AST
mkUnsignedInt = (Ptr Z3_context -> CUInt -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Word -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_unsigned_int
mkInt64 :: Context -> Int64 -> Sort -> IO AST
mkInt64 :: Context -> Int64 -> Sort -> IO AST
mkInt64 = (Ptr Z3_context -> CLLong -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Int64 -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CLLong -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_int64
mkUnsignedInt64 :: Context -> Word64 -> Sort -> IO AST
mkUnsignedInt64 :: Context -> Word64 -> Sort -> IO AST
mkUnsignedInt64 = (Ptr Z3_context -> CULLong -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Word64 -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CULLong -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_unsigned_int64
mkIntegral :: Integral a => Context -> a -> Sort -> IO AST
mkIntegral :: Context -> a -> Sort -> IO AST
mkIntegral c :: Context
c n :: a
n s :: Sort
s = Context -> String -> Sort -> IO AST
mkNumeral Context
c String
n_str Sort
s
where n_str :: String
n_str = Integer -> String
forall a. Show a => a -> String
show (Integer -> String) -> Integer -> String
forall a b. (a -> b) -> a -> b
$ a -> Integer
forall a. Integral a => a -> Integer
toInteger a
n
mkRational :: Context -> Rational -> IO AST
mkRational :: Context -> Rational -> IO AST
mkRational = Context -> Rational -> IO AST
forall r. Real r => Context -> r -> IO AST
mkRealNum
mkFixed :: HasResolution a => Context -> Fixed a -> IO AST
mkFixed :: Context -> Fixed a -> IO AST
mkFixed ctx :: Context
ctx = Context -> Rational -> IO AST
mkRational Context
ctx (Rational -> IO AST) -> (Fixed a -> Rational) -> Fixed a -> IO AST
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Fixed a -> Rational
forall a. Real a => a -> Rational
toRational
mkRealNum :: Real r => Context -> r -> IO AST
mkRealNum :: Context -> r -> IO AST
mkRealNum c :: Context
c n :: r
n = Context -> String -> Sort -> IO AST
mkNumeral Context
c String
n_str (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkRealSort Context
c
where r :: Rational
r = r -> Rational
forall a. Real a => a -> Rational
toRational r
n
r_n :: Integer
r_n = Integer -> Integer
forall a. Integral a => a -> Integer
toInteger (Integer -> Integer) -> Integer -> Integer
forall a b. (a -> b) -> a -> b
$ Rational -> Integer
forall a. Ratio a -> a
numerator Rational
r
r_d :: Integer
r_d = Integer -> Integer
forall a. Integral a => a -> Integer
toInteger (Integer -> Integer) -> Integer -> Integer
forall a b. (a -> b) -> a -> b
$ Rational -> Integer
forall a. Ratio a -> a
denominator Rational
r
n_str :: String
n_str = Integer -> String
forall a. Show a => a -> String
show Integer
r_n String -> ShowS
forall a. [a] -> [a] -> [a]
++ " / " String -> ShowS
forall a. [a] -> [a] -> [a]
++ Integer -> String
forall a. Show a => a -> String
show Integer
r_d
mkInteger :: Context -> Integer -> IO AST
mkInteger :: Context -> Integer -> IO AST
mkInteger = Context -> Integer -> IO AST
forall a. Integral a => Context -> a -> IO AST
mkIntNum
mkIntNum :: Integral a => Context -> a -> IO AST
mkIntNum :: Context -> a -> IO AST
mkIntNum ctx :: Context
ctx n :: a
n = Context -> a -> Sort -> IO AST
forall a. Integral a => Context -> a -> Sort -> IO AST
mkIntegral Context
ctx a
n (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> IO Sort
mkIntSort Context
ctx
mkBitvector :: Context -> Int
-> Integer
-> IO AST
mkBitvector :: Context -> Int -> Integer -> IO AST
mkBitvector = Context -> Int -> Integer -> IO AST
forall i. Integral i => Context -> Int -> i -> IO AST
mkBvNum
mkBvNum :: Integral i => Context -> Int
-> i
-> IO AST
mkBvNum :: Context -> Int -> i -> IO AST
mkBvNum ctx :: Context
ctx s :: Int
s n :: i
n = Context -> i -> Sort -> IO AST
forall a. Integral a => Context -> a -> Sort -> IO AST
mkIntegral Context
ctx i
n (Sort -> IO AST) -> IO Sort -> IO AST
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> Int -> IO Sort
forall int. Integral int => Context -> int -> IO Sort
mkBvSort Context
ctx Int
s
mkPattern :: Context
-> NonEmpty AST
-> IO Pattern
mkPattern :: Context -> NonEmpty AST -> IO Pattern
mkPattern c :: Context
c es :: NonEmpty AST
es = (Ptr Z3_context
-> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern))
-> Context
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern))
-> IO (Ptr Z3_pattern))
-> IO Pattern
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern)
z3_mk_pattern Context
c (((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern))
-> IO (Ptr Z3_pattern))
-> IO Pattern)
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern))
-> IO (Ptr Z3_pattern))
-> IO Pattern
forall a b. (a -> b) -> a -> b
$ [AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_pattern))
-> IO (Ptr Z3_pattern)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen (NonEmpty AST -> [AST]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList NonEmpty AST
es)
mkBound :: Context
-> Int
-> Sort
-> IO AST
mkBound :: Context -> Int -> Sort -> IO AST
mkBound c :: Context
c i :: Int
i s :: Sort
s
| Int
i Int -> Int -> Bool
forall a. Ord a => a -> a -> Bool
>= 0 = (Ptr Z3_context -> CUInt -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Context -> Int -> Sort -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> CUInt -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_mk_bound Context
c Int
i Sort
s
| Bool
otherwise = String -> IO AST
forall a. HasCallStack => String -> a
error "Z3.Base.mkBound: negative de-Bruijn index"
type MkZ3Quantifier = Ptr Z3_context -> CUInt
-> CUInt -> Ptr (Ptr Z3_pattern)
-> CUInt -> Ptr (Ptr Z3_sort) -> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
marshalMkQ :: MkZ3Quantifier
-> Context
-> [Pattern]
-> [Symbol]
-> [Sort]
-> AST
-> IO AST
marshalMkQ :: MkZ3Quantifier
-> Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
marshalMkQ z3_mk_Q :: MkZ3Quantifier
z3_mk_Q ctx :: Context
ctx pats :: [Pattern]
pats x :: [Symbol]
x s :: [Sort]
s body :: AST
body = MkZ3Quantifier
-> Context
-> ((CUInt
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal MkZ3Quantifier
z3_mk_Q Context
ctx (((CUInt
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CUInt
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CUInt
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
f ->
[Pattern]
-> (CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Pattern]
pats ((CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \n :: CUInt
n patsArr :: Ptr (Ptr Z3_pattern)
patsArr ->
[Symbol]
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Symbol]
x ((Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \xArr :: Ptr (Ptr Z3_symbol)
xArr ->
[Sort] -> (Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Sort]
s ((Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \sArr :: Ptr (Ptr Z3_sort)
sArr ->
AST -> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
body ((Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \bodyPtr :: Ptr Z3_ast
bodyPtr ->
CUInt
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> CUInt
-> Ptr (Ptr Z3_sort)
-> Ptr (Ptr Z3_symbol)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
f 0 CUInt
n Ptr (Ptr Z3_pattern)
patsArr CUInt
len Ptr (Ptr Z3_sort)
sArr Ptr (Ptr Z3_symbol)
xArr Ptr Z3_ast
bodyPtr
where len :: CUInt
len
| Int
l Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 = String -> CUInt
forall a. HasCallStack => String -> a
error "Z3.Base.mkQuantifier:\
\ quantifier with 0 bound variables"
| Int
l Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
/= [Symbol] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Symbol]
x = String -> CUInt
forall a. HasCallStack => String -> a
error "Z3.Base.mkQuantifier:\
\ different number of symbols and sorts"
| Bool
otherwise = Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
l
where l :: Int
l = [Sort] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [Sort]
s
mkForall :: Context
-> [Pattern]
-> [Symbol]
-> [Sort]
-> AST
-> IO AST
mkForall :: Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
mkForall = MkZ3Quantifier
-> Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
marshalMkQ MkZ3Quantifier
z3_mk_forall
mkExists :: Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
mkExists :: Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
mkExists = MkZ3Quantifier
-> Context -> [Pattern] -> [Symbol] -> [Sort] -> AST -> IO AST
marshalMkQ MkZ3Quantifier
z3_mk_exists
type MkZ3QuantifierConst = Ptr Z3_context
-> CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
marshalMkQConst :: MkZ3QuantifierConst
-> Context
-> [Pattern]
-> [App]
-> AST
-> IO AST
marshalMkQConst :: MkZ3QuantifierConst
-> Context -> [Pattern] -> [App] -> AST -> IO AST
marshalMkQConst z3_mk_Q_const :: MkZ3QuantifierConst
z3_mk_Q_const ctx :: Context
ctx pats :: [Pattern]
pats apps :: [App]
apps body :: AST
body =
MkZ3QuantifierConst
-> Context
-> ((CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal MkZ3QuantifierConst
z3_mk_Q_const Context
ctx (((CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
f ->
[Pattern]
-> (CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Pattern]
pats ((CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_pattern) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \patsNum :: CUInt
patsNum patsArr :: Ptr (Ptr Z3_pattern)
patsArr ->
[App] -> (Ptr (Ptr Z3_app) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [App]
apps ((Ptr (Ptr Z3_app) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_app) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \appsArr :: Ptr (Ptr Z3_app)
appsArr ->
AST -> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
body ((Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \bodyPtr :: Ptr Z3_ast
bodyPtr ->
CUInt
-> CUInt
-> Ptr (Ptr Z3_app)
-> CUInt
-> Ptr (Ptr Z3_pattern)
-> Ptr Z3_ast
-> IO (Ptr Z3_ast)
f 0 CUInt
len Ptr (Ptr Z3_app)
appsArr CUInt
patsNum Ptr (Ptr Z3_pattern)
patsArr Ptr Z3_ast
bodyPtr
where len :: CUInt
len
| Int
l Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== 0 = String -> CUInt
forall a. HasCallStack => String -> a
error "Z3.Base.mkQuantifierConst:\
\ quantifier with 0 bound variables"
| Bool
otherwise = Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
l
where l :: Int
l = [App] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
length [App]
apps
mkForallConst :: Context
-> [Pattern]
-> [App]
-> AST
-> IO AST
mkForallConst :: Context -> [Pattern] -> [App] -> AST -> IO AST
mkForallConst = MkZ3QuantifierConst
-> Context -> [Pattern] -> [App] -> AST -> IO AST
marshalMkQConst MkZ3QuantifierConst
z3_mk_forall_const
mkExistsConst :: Context
-> [Pattern]
-> [App]
-> AST
-> IO AST
mkExistsConst :: Context -> [Pattern] -> [App] -> AST -> IO AST
mkExistsConst = MkZ3QuantifierConst
-> Context -> [Pattern] -> [App] -> AST -> IO AST
marshalMkQConst MkZ3QuantifierConst
z3_mk_exists_const
getSymbolString :: Context -> Symbol -> IO String
getSymbolString :: Context -> Symbol -> IO String
getSymbolString = (Ptr Z3_context -> Ptr Z3_symbol -> IO CString)
-> Context -> Symbol -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_symbol -> IO CString
z3_get_symbol_string
getSortKind :: Context -> Sort -> IO SortKind
getSortKind :: Context -> Sort -> IO SortKind
getSortKind ctx :: Context
ctx sort :: Sort
sort = CInt -> SortKind
toSortKind (CInt -> SortKind) -> IO CInt -> IO SortKind
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Z3_context -> Ptr Z3_sort -> IO CInt)
-> Context -> Sort -> IO CInt
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO CInt
z3_get_sort_kind Context
ctx Sort
sort
where toSortKind :: Z3_sort_kind -> SortKind
toSortKind :: CInt -> SortKind
toSortKind k :: CInt
k
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_uninterpreted_sort = SortKind
Z3_UNINTERPRETED_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_bool_sort = SortKind
Z3_BOOL_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_int_sort = SortKind
Z3_INT_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_real_sort = SortKind
Z3_REAL_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_bv_sort = SortKind
Z3_BV_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_array_sort = SortKind
Z3_ARRAY_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_datatype_sort = SortKind
Z3_DATATYPE_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_relation_sort = SortKind
Z3_RELATION_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_finite_domain_sort = SortKind
Z3_FINITE_DOMAIN_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_floating_point_sort = SortKind
Z3_FLOATING_POINT_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_rounding_mode_sort = SortKind
Z3_ROUNDING_MODE_SORT
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_unknown_sort = SortKind
Z3_UNKNOWN_SORT
| Bool
otherwise =
String -> SortKind
forall a. HasCallStack => String -> a
error "Z3.Base.getSortKind: unknown `Z3_sort_kind'"
getBvSortSize :: Context -> Sort -> IO Int
getBvSortSize :: Context -> Sort -> IO Int
getBvSortSize = (Ptr Z3_context -> Ptr Z3_sort -> IO CUInt)
-> Context -> Sort -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO CUInt
z3_get_bv_sort_size
getArraySortDomain :: Context -> Sort -> IO Sort
getArraySortDomain :: Context -> Sort -> IO Sort
getArraySortDomain = (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort))
-> Context -> Sort -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort)
z3_get_array_sort_domain
getArraySortRange :: Context -> Sort -> IO Sort
getArraySortRange :: Context -> Sort -> IO Sort
getArraySortRange = (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort))
-> Context -> Sort -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_sort)
z3_get_array_sort_range
getDatatypeSortConstructors :: Context
-> Sort
-> IO [FuncDecl]
getDatatypeSortConstructors :: Context -> Sort -> IO [FuncDecl]
getDatatypeSortConstructors c :: Context
c dtSort :: Sort
dtSort =
Context -> (Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl]
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl])
-> (Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Sort -> (Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl]
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Sort
dtSort ((Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl])
-> (Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \dtSortPtr :: Ptr Z3_sort
dtSortPtr -> do
CUInt
numCons <- Ptr Z3_context -> IO CUInt -> IO CUInt
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (IO CUInt -> IO CUInt) -> IO CUInt -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context -> Ptr Z3_sort -> IO CUInt
z3_get_datatype_sort_num_constructors Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr
(CUInt -> IO FuncDecl) -> [CUInt] -> IO [FuncDecl]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (Ptr Z3_sort -> CUInt -> IO FuncDecl
forall h.
Marshal h (Ptr Z3_func_decl) =>
Ptr Z3_sort -> CUInt -> IO h
getConstructor Ptr Z3_sort
dtSortPtr) [0..(CUInt
numConsCUInt -> CUInt -> CUInt
forall a. Num a => a -> a -> a
-1)]
where
getConstructor :: Ptr Z3_sort -> CUInt -> IO h
getConstructor dtSortPtr :: Ptr Z3_sort
dtSortPtr idx :: CUInt
idx =
Context -> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h)
-> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_sort -> CUInt -> IO (Ptr Z3_func_decl)
z3_get_datatype_sort_constructor Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr CUInt
idx
getDatatypeSortRecognizers :: Context
-> Sort
-> IO [FuncDecl]
getDatatypeSortRecognizers :: Context -> Sort -> IO [FuncDecl]
getDatatypeSortRecognizers c :: Context
c dtSort :: Sort
dtSort =
Context -> (Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl]
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl])
-> (Ptr Z3_context -> IO [FuncDecl]) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Sort -> (Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl]
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Sort
dtSort ((Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl])
-> (Ptr Z3_sort -> IO [FuncDecl]) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \dtSortPtr :: Ptr Z3_sort
dtSortPtr -> do
CUInt
numCons <- Ptr Z3_context -> IO CUInt -> IO CUInt
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (IO CUInt -> IO CUInt) -> IO CUInt -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context -> Ptr Z3_sort -> IO CUInt
z3_get_datatype_sort_num_constructors Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr
(CUInt -> IO FuncDecl) -> [CUInt] -> IO [FuncDecl]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (Ptr Z3_sort -> CUInt -> IO FuncDecl
forall h.
Marshal h (Ptr Z3_func_decl) =>
Ptr Z3_sort -> CUInt -> IO h
getRecognizer Ptr Z3_sort
dtSortPtr) [0..(CUInt
numConsCUInt -> CUInt -> CUInt
forall a. Num a => a -> a -> a
-1)]
where
getRecognizer :: Ptr Z3_sort -> CUInt -> IO h
getRecognizer dtSortPtr :: Ptr Z3_sort
dtSortPtr idx :: CUInt
idx =
Context -> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h)
-> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_sort -> CUInt -> IO (Ptr Z3_func_decl)
z3_get_datatype_sort_recognizer Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr CUInt
idx
getDatatypeSortConstructorAccessors :: Context
-> Sort
-> IO [[FuncDecl]]
getDatatypeSortConstructorAccessors :: Context -> Sort -> IO [[FuncDecl]]
getDatatypeSortConstructorAccessors c :: Context
c dtSort :: Sort
dtSort =
Context -> (Ptr Z3_context -> IO [[FuncDecl]]) -> IO [[FuncDecl]]
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c ((Ptr Z3_context -> IO [[FuncDecl]]) -> IO [[FuncDecl]])
-> (Ptr Z3_context -> IO [[FuncDecl]]) -> IO [[FuncDecl]]
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Sort -> (Ptr Z3_sort -> IO [[FuncDecl]]) -> IO [[FuncDecl]]
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Sort
dtSort ((Ptr Z3_sort -> IO [[FuncDecl]]) -> IO [[FuncDecl]])
-> (Ptr Z3_sort -> IO [[FuncDecl]]) -> IO [[FuncDecl]]
forall a b. (a -> b) -> a -> b
$ \dtSortPtr :: Ptr Z3_sort
dtSortPtr -> do
CUInt
numCons <- Ptr Z3_context -> IO CUInt -> IO CUInt
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (IO CUInt -> IO CUInt) -> IO CUInt -> IO CUInt
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context -> Ptr Z3_sort -> IO CUInt
z3_get_datatype_sort_num_constructors Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr
(CUInt -> IO [FuncDecl]) -> [CUInt] -> IO [[FuncDecl]]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (Ptr Z3_sort -> CUInt -> IO [FuncDecl]
forall b.
Marshal b (Ptr Z3_func_decl) =>
Ptr Z3_sort -> CUInt -> IO [b]
getAccessors Ptr Z3_sort
dtSortPtr) [0..(CUInt
numConsCUInt -> CUInt -> CUInt
forall a. Num a => a -> a -> a
-1)]
where
getConstructor :: Ptr Z3_sort -> CUInt -> IO (Ptr Z3_func_decl)
getConstructor dtSortPtr :: Ptr Z3_sort
dtSortPtr idx_c :: CUInt
idx_c =
Context
-> (Ptr Z3_context -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
c ((Ptr Z3_context -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl))
-> (Ptr Z3_context -> IO (Ptr Z3_func_decl))
-> IO (Ptr Z3_func_decl)
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_sort -> CUInt -> IO (Ptr Z3_func_decl)
z3_get_datatype_sort_constructor Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr CUInt
idx_c
getAccessors :: Ptr Z3_sort -> CUInt -> IO [b]
getAccessors dtSortPtr :: Ptr Z3_sort
dtSortPtr idx_c :: CUInt
idx_c = do
Ptr Z3_func_decl
consPtr <- Ptr Z3_sort -> CUInt -> IO (Ptr Z3_func_decl)
getConstructor Ptr Z3_sort
dtSortPtr CUInt
idx_c
CUInt
numAs <- Context -> (Ptr Z3_context -> IO CUInt) -> IO CUInt
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO CUInt) -> IO CUInt)
-> (Ptr Z3_context -> IO CUInt) -> IO CUInt
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_func_decl -> IO CUInt
z3_get_arity Ptr Z3_context
cPtr Ptr Z3_func_decl
consPtr
if CUInt
numAs CUInt -> CUInt -> Bool
forall a. Ord a => a -> a -> Bool
> 0
then (CUInt -> IO b) -> [CUInt] -> IO [b]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (\idx_a :: CUInt
idx_a -> Ptr Z3_sort -> CUInt -> CUInt -> IO b
forall h.
Marshal h (Ptr Z3_func_decl) =>
Ptr Z3_sort -> CUInt -> CUInt -> IO h
getAccessors' Ptr Z3_sort
dtSortPtr CUInt
idx_c CUInt
idx_a) [0..(CUInt
numAs CUInt -> CUInt -> CUInt
forall a. Num a => a -> a -> a
- 1)]
else [b] -> IO [b]
forall (m :: * -> *) a. Monad m => a -> m a
return []
getAccessors' :: Ptr Z3_sort -> CUInt -> CUInt -> IO h
getAccessors' dtSortPtr :: Ptr Z3_sort
dtSortPtr idx_c :: CUInt
idx_c idx_a :: CUInt
idx_a =
Context -> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h)
-> (Ptr Z3_context -> IO (Ptr Z3_func_decl)) -> IO h
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context
-> Ptr Z3_sort -> CUInt -> CUInt -> IO (Ptr Z3_func_decl)
z3_get_datatype_sort_constructor_accessor Ptr Z3_context
cPtr Ptr Z3_sort
dtSortPtr CUInt
idx_c CUInt
idx_a
getDeclName :: Context -> FuncDecl -> IO Symbol
getDeclName :: Context -> FuncDecl -> IO Symbol
getDeclName c :: Context
c decl :: FuncDecl
decl = FuncDecl -> (Ptr Z3_func_decl -> IO Symbol) -> IO Symbol
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c FuncDecl
decl ((Ptr Z3_func_decl -> IO Symbol) -> IO Symbol)
-> (Ptr Z3_func_decl -> IO Symbol) -> IO Symbol
forall a b. (a -> b) -> a -> b
$ \declPtr :: Ptr Z3_func_decl
declPtr ->
Ptr Z3_symbol -> Symbol
Symbol (Ptr Z3_symbol -> Symbol) -> IO (Ptr Z3_symbol) -> IO Symbol
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context
-> (Ptr Z3_context -> IO (Ptr Z3_symbol)) -> IO (Ptr Z3_symbol)
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c (\cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_symbol)
z3_get_decl_name Ptr Z3_context
cPtr Ptr Z3_func_decl
declPtr)
getArity :: Context -> FuncDecl -> IO Int
getArity :: Context -> FuncDecl -> IO Int
getArity = (Ptr Z3_context -> Ptr Z3_func_decl -> IO CUInt)
-> Context -> FuncDecl -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_decl -> IO CUInt
z3_get_arity
getDomain :: Context
-> FuncDecl
-> Int
-> IO Sort
getDomain :: Context -> FuncDecl -> Int -> IO Sort
getDomain = (Ptr Z3_context -> Ptr Z3_func_decl -> CUInt -> IO (Ptr Z3_sort))
-> Context -> FuncDecl -> Int -> IO Sort
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_func_decl -> CUInt -> IO (Ptr Z3_sort)
z3_get_domain
getRange :: Context -> FuncDecl -> IO Sort
getRange :: Context -> FuncDecl -> IO Sort
getRange = (Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_sort))
-> Context -> FuncDecl -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_sort)
z3_get_range
appToAst :: Context -> App -> IO AST
appToAst :: Context -> App -> IO AST
appToAst = (Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast))
-> Context -> App -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast)
z3_app_to_ast
getAppDecl :: Context -> App -> IO FuncDecl
getAppDecl :: Context -> App -> IO FuncDecl
getAppDecl = (Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_func_decl))
-> Context -> App -> IO FuncDecl
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_func_decl)
z3_get_app_decl
getAppNumArgs :: Context -> App -> IO Int
getAppNumArgs :: Context -> App -> IO Int
getAppNumArgs = (Ptr Z3_context -> Ptr Z3_app -> IO CUInt)
-> Context -> App -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_app -> IO CUInt
z3_get_app_num_args
getAppArg :: Context -> App -> Int -> IO AST
getAppArg :: Context -> App -> Int -> IO AST
getAppArg = (Ptr Z3_context -> Ptr Z3_app -> CUInt -> IO (Ptr Z3_ast))
-> Context -> App -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_app -> CUInt -> IO (Ptr Z3_ast)
z3_get_app_arg
getAppArgs :: Context -> App -> IO [AST]
getAppArgs :: Context -> App -> IO [AST]
getAppArgs ctx :: Context
ctx a :: App
a = do
Int
n <- Context -> App -> IO Int
getAppNumArgs Context
ctx App
a
[Int] -> (Int -> IO AST) -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] (Context -> App -> Int -> IO AST
getAppArg Context
ctx App
a)
getSort :: Context -> AST -> IO Sort
getSort :: Context -> AST -> IO Sort
getSort = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_sort))
-> Context -> AST -> IO Sort
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_sort)
z3_get_sort
getBoolValue :: Context -> AST -> IO (Maybe Bool)
getBoolValue :: Context -> AST -> IO (Maybe Bool)
getBoolValue c :: Context
c a :: AST
a = AST -> (Ptr Z3_ast -> IO (Maybe Bool)) -> IO (Maybe Bool)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
a ((Ptr Z3_ast -> IO (Maybe Bool)) -> IO (Maybe Bool))
-> (Ptr Z3_ast -> IO (Maybe Bool)) -> IO (Maybe Bool)
forall a b. (a -> b) -> a -> b
$ \astPtr :: Ptr Z3_ast
astPtr ->
Z3_lbool -> Maybe Bool
castLBool (Z3_lbool -> Maybe Bool) -> IO Z3_lbool -> IO (Maybe Bool)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context -> (Ptr Z3_context -> IO Z3_lbool) -> IO Z3_lbool
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
c (\cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_ast -> IO Z3_lbool
z3_get_bool_value Ptr Z3_context
cPtr Ptr Z3_ast
astPtr)
where castLBool :: Z3_lbool -> Maybe Bool
castLBool :: Z3_lbool -> Maybe Bool
castLBool lb :: Z3_lbool
lb
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_true = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
True
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_false = Bool -> Maybe Bool
forall a. a -> Maybe a
Just Bool
False
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_undef = Maybe Bool
forall a. Maybe a
Nothing
| Bool
otherwise =
String -> Maybe Bool
forall a. HasCallStack => String -> a
error "Z3.Base.castLBool: illegal `Z3_lbool' value"
getAstKind :: Context -> AST -> IO ASTKind
getAstKind :: Context -> AST -> IO ASTKind
getAstKind ctx :: Context
ctx ast :: AST
ast = CInt -> ASTKind
toAstKind (CInt -> ASTKind) -> IO CInt -> IO ASTKind
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (Ptr Z3_context -> Ptr Z3_ast -> IO CInt)
-> Context -> AST -> IO CInt
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CInt
z3_get_ast_kind Context
ctx AST
ast
where toAstKind :: Z3_ast_kind -> ASTKind
toAstKind :: CInt -> ASTKind
toAstKind k :: CInt
k
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_numeral_ast = ASTKind
Z3_NUMERAL_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_app_ast = ASTKind
Z3_APP_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_var_ast = ASTKind
Z3_VAR_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_quantifier_ast = ASTKind
Z3_QUANTIFIER_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_sort_ast = ASTKind
Z3_SORT_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_func_decl_ast = ASTKind
Z3_FUNC_DECL_AST
| CInt
k CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_unknown_ast = ASTKind
Z3_UNKNOWN_AST
| Bool
otherwise =
String -> ASTKind
forall a. HasCallStack => String -> a
error "Z3.Base.getAstKind: unknown `Z3_ast_kind'"
isApp :: Context -> AST -> IO Bool
isApp :: Context -> AST -> IO Bool
isApp = (Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool)
-> Context -> AST -> IO Bool
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool
z3_is_app
toApp :: Context -> AST -> IO App
toApp :: Context -> AST -> IO App
toApp = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_app))
-> Context -> AST -> IO App
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_app)
z3_to_app
getNumeralString :: Context -> AST -> IO String
getNumeralString :: Context -> AST -> IO String
getNumeralString = (Ptr Z3_context -> Ptr Z3_ast -> IO CString)
-> Context -> AST -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CString
z3_get_numeral_string
getIndexValue :: Context -> AST -> IO Int
getIndexValue :: Context -> AST -> IO Int
getIndexValue = (Ptr Z3_context -> Ptr Z3_ast -> IO CUInt)
-> Context -> AST -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CUInt
z3_get_index_value
isQuantifierForall :: Context -> AST -> IO Bool
isQuantifierForall :: Context -> AST -> IO Bool
isQuantifierForall = (Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool)
-> Context -> AST -> IO Bool
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool
z3_is_quantifier_forall
isQuantifierExists :: Context -> AST -> IO Bool
isQuantifierExists :: Context -> AST -> IO Bool
isQuantifierExists ctx :: Context
ctx = (Bool -> Bool) -> IO Bool -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap Bool -> Bool
not (IO Bool -> IO Bool) -> (AST -> IO Bool) -> AST -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Context -> AST -> IO Bool
isQuantifierForall Context
ctx
getQuantifierWeight :: Context -> AST -> IO Int
getQuantifierWeight :: Context -> AST -> IO Int
getQuantifierWeight = (Ptr Z3_context -> Ptr Z3_ast -> IO CUInt)
-> Context -> AST -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CUInt
z3_get_quantifier_weight
getQuantifierNumPatterns :: Context -> AST -> IO Int
getQuantifierNumPatterns :: Context -> AST -> IO Int
getQuantifierNumPatterns = (Ptr Z3_context -> Ptr Z3_ast -> IO CUInt)
-> Context -> AST -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CUInt
z3_get_quantifier_num_patterns
getQuantifierPatternAST :: Context -> AST -> Int -> IO AST
getQuantifierPatternAST :: Context -> AST -> Int -> IO AST
getQuantifierPatternAST = (Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_ast))
-> Context -> AST -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_ast)
z3_get_quantifier_pattern_ast
getQuantifierPatterns :: Context -> AST -> IO [AST]
getQuantifierPatterns :: Context -> AST -> IO [AST]
getQuantifierPatterns ctx :: Context
ctx a :: AST
a = do
Int
n <- Context -> AST -> IO Int
getQuantifierNumPatterns Context
ctx AST
a
[Int] -> (Int -> IO AST) -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] (Context -> AST -> Int -> IO AST
getQuantifierPatternAST Context
ctx AST
a)
getQuantifierNumNoPatterns :: Context -> AST -> IO Int
getQuantifierNumNoPatterns :: Context -> AST -> IO Int
getQuantifierNumNoPatterns = (Ptr Z3_context -> Ptr Z3_ast -> IO CUInt)
-> Context -> AST -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CUInt
z3_get_quantifier_num_no_patterns
getQuantifierNoPatternAST :: Context -> AST -> Int -> IO AST
getQuantifierNoPatternAST :: Context -> AST -> Int -> IO AST
getQuantifierNoPatternAST = (Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_ast))
-> Context -> AST -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_ast)
z3_get_quantifier_no_pattern_ast
getQuantifierNoPatterns :: Context -> AST -> IO [AST]
getQuantifierNoPatterns :: Context -> AST -> IO [AST]
getQuantifierNoPatterns ctx :: Context
ctx a :: AST
a = do
Int
n <- Context -> AST -> IO Int
getQuantifierNumNoPatterns Context
ctx AST
a
[Int] -> (Int -> IO AST) -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] (Context -> AST -> Int -> IO AST
getQuantifierNoPatternAST Context
ctx AST
a)
getQuantifierNumBound :: Context -> AST -> IO Int
getQuantifierNumBound :: Context -> AST -> IO Int
getQuantifierNumBound = (Ptr Z3_context -> Ptr Z3_ast -> IO CUInt)
-> Context -> AST -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CUInt
z3_get_quantifier_num_bound
getQuantifierBoundName :: Context -> AST -> Int -> IO Symbol
getQuantifierBoundName :: Context -> AST -> Int -> IO Symbol
getQuantifierBoundName = (Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_symbol))
-> Context -> AST -> Int -> IO Symbol
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_symbol)
z3_get_quantifier_bound_name
getQuantifierBoundSort :: Context -> AST -> Int -> IO Sort
getQuantifierBoundSort :: Context -> AST -> Int -> IO Sort
getQuantifierBoundSort = (Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_sort))
-> Context -> AST -> Int -> IO Sort
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> CUInt -> IO (Ptr Z3_sort)
z3_get_quantifier_bound_sort
getQuantifierBoundVars :: Context -> AST -> IO [AST]
getQuantifierBoundVars :: Context -> AST -> IO [AST]
getQuantifierBoundVars ctx :: Context
ctx a :: AST
a = do
Int
n <- Context -> AST -> IO Int
getQuantifierNumBound Context
ctx AST
a
[Int] -> (Int -> IO AST) -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] ((Int -> IO AST) -> IO [AST]) -> (Int -> IO AST) -> IO [AST]
forall a b. (a -> b) -> a -> b
$ \i :: Int
i -> do
Symbol
b <- Context -> AST -> Int -> IO Symbol
getQuantifierBoundName Context
ctx AST
a Int
i
Sort
s <- Context -> AST -> Int -> IO Sort
getQuantifierBoundSort Context
ctx AST
a Int
i
Context -> Symbol -> Sort -> IO AST
mkVar Context
ctx Symbol
b Sort
s
getQuantifierBody :: Context -> AST -> IO AST
getQuantifierBody :: Context -> AST -> IO AST
getQuantifierBody = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_get_quantifier_body
simplify :: Context -> AST -> IO AST
simplify :: Context -> AST -> IO AST
simplify = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast))
-> Context -> AST -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_ast)
z3_simplify
simplifyEx :: Context -> AST -> Params -> IO AST
simplifyEx :: Context -> AST -> Params -> IO AST
simplifyEx = (Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_params -> IO (Ptr Z3_ast))
-> Context -> AST -> Params -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_ast -> Ptr Z3_params -> IO (Ptr Z3_ast)
z3_simplify_ex
getBool :: Context -> AST -> IO Bool
getBool :: Context -> AST -> IO Bool
getBool c :: Context
c a :: AST
a = Maybe Bool -> Bool
forall a. HasCallStack => Maybe a -> a
fromJust (Maybe Bool -> Bool) -> IO (Maybe Bool) -> IO Bool
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context -> AST -> IO (Maybe Bool)
getBoolValue Context
c AST
a
getInt :: Context -> AST -> IO Integer
getInt :: Context -> AST -> IO Integer
getInt c :: Context
c a :: AST
a = String -> Integer
forall a. Read a => String -> a
read (String -> Integer) -> IO String -> IO Integer
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context -> AST -> IO String
getNumeralString Context
c AST
a
getReal :: Context -> AST -> IO Rational
getReal :: Context -> AST -> IO Rational
getReal c :: Context
c a :: AST
a = String -> Rational
parse (String -> Rational) -> IO String -> IO Rational
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context -> AST -> IO String
getNumeralString Context
c AST
a
where parse :: String -> Rational
parse :: String -> Rational
parse s :: String
s
| [(i :: Integer
i, sj :: String
sj)] <- ReadS Integer
forall a. Read a => ReadS a
reads String
s = Integer
i Integer -> Integer -> Rational
forall a. Integral a => a -> a -> Ratio a
% String -> Integer
parseDen ((Char -> Bool) -> ShowS
forall a. (a -> Bool) -> [a] -> [a]
dropWhile (Char -> Char -> Bool
forall a. Eq a => a -> a -> Bool
== ' ') String
sj)
| Bool
otherwise = String -> Rational
forall a. HasCallStack => String -> a
error "Z3.Base.getReal: no parse"
parseDen :: String -> Integer
parseDen :: String -> Integer
parseDen "" = 1
parseDen ('/':sj :: String
sj) = String -> Integer
forall a. Read a => String -> a
read String
sj
parseDen _ = String -> Integer
forall a. HasCallStack => String -> a
error "Z3.Base.getReal: no parse"
getBv :: Context -> AST
-> Bool
-> IO Integer
getBv :: Context -> AST -> Bool -> IO Integer
getBv c :: Context
c a :: AST
a signed :: Bool
signed = Context -> AST -> IO Integer
getInt Context
c (AST -> IO Integer) -> IO AST -> IO Integer
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Context -> AST -> Bool -> IO AST
mkBv2int Context
c AST
a Bool
signed
substituteVars :: Context -> AST -> [AST] -> IO AST
substituteVars :: Context -> AST -> [AST] -> IO AST
substituteVars ctx :: Context
ctx a :: AST
a vars :: [AST]
vars =
(Ptr Z3_context
-> Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> ((Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
z3_substitute_vars Context
ctx (((Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f ->
AST -> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
a ((Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_ast -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \aPtr :: Ptr Z3_ast
aPtr ->
[AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
vars ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \varsNum :: CUInt
varsNum varsArr :: Ptr (Ptr Z3_ast)
varsArr ->
Ptr Z3_ast -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f Ptr Z3_ast
aPtr CUInt
varsNum Ptr (Ptr Z3_ast)
varsArr
modelEval :: Context
-> Model
-> AST
-> Bool
-> IO (Maybe AST)
modelEval :: Context -> Model -> AST -> Bool -> IO (Maybe AST)
modelEval ctx :: Context
ctx m :: Model
m a :: AST
a b :: Bool
b =
Context -> (Ptr Z3_context -> IO (Maybe AST)) -> IO (Maybe AST)
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
ctx ((Ptr Z3_context -> IO (Maybe AST)) -> IO (Maybe AST))
-> (Ptr Z3_context -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \ctxPtr :: Ptr Z3_context
ctxPtr ->
(Ptr (Ptr Z3_ast) -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr (Ptr Z3_ast) -> IO (Maybe AST)) -> IO (Maybe AST))
-> (Ptr (Ptr Z3_ast) -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \aptr2 :: Ptr (Ptr Z3_ast)
aptr2 ->
AST -> (Ptr Z3_ast -> IO (Maybe AST)) -> IO (Maybe AST)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
a ((Ptr Z3_ast -> IO (Maybe AST)) -> IO (Maybe AST))
-> (Ptr Z3_ast -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \astPtr :: Ptr Z3_ast
astPtr ->
Model -> (Ptr Z3_model -> IO (Maybe AST)) -> IO (Maybe AST)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Model
m ((Ptr Z3_model -> IO (Maybe AST)) -> IO (Maybe AST))
-> (Ptr Z3_model -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \mPtr :: Ptr Z3_model
mPtr ->
Bool -> (Z3_bool -> IO (Maybe AST)) -> IO (Maybe AST)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Bool
b ((Z3_bool -> IO (Maybe AST)) -> IO (Maybe AST))
-> (Z3_bool -> IO (Maybe AST)) -> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \b' :: Z3_bool
b' ->
Ptr Z3_context -> IO Z3_bool -> IO Z3_bool
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
ctxPtr
(Ptr Z3_context
-> Ptr Z3_model
-> Ptr Z3_ast
-> Z3_bool
-> Ptr (Ptr Z3_ast)
-> IO Z3_bool
z3_model_eval Ptr Z3_context
ctxPtr Ptr Z3_model
mPtr Ptr Z3_ast
astPtr Z3_bool
b' Ptr (Ptr Z3_ast)
aptr2) IO Z3_bool -> (Z3_bool -> IO (Maybe AST)) -> IO (Maybe AST)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Ptr (Ptr Z3_ast) -> Bool -> IO (Maybe AST)
peekAST Ptr (Ptr Z3_ast)
aptr2 (Bool -> IO (Maybe AST))
-> (Z3_bool -> Bool) -> Z3_bool -> IO (Maybe AST)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Z3_bool -> Bool
toBool
where peekAST :: Ptr (Ptr Z3_ast) -> Bool -> IO (Maybe AST)
peekAST :: Ptr (Ptr Z3_ast) -> Bool -> IO (Maybe AST)
peekAST _p :: Ptr (Ptr Z3_ast)
_p False = Maybe AST -> IO (Maybe AST)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe AST
forall a. Maybe a
Nothing
peekAST p :: Ptr (Ptr Z3_ast)
p True = (AST -> Maybe AST) -> IO AST -> IO (Maybe AST)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap AST -> Maybe AST
forall a. a -> Maybe a
Just (IO AST -> IO (Maybe AST))
-> (Ptr Z3_ast -> IO AST) -> Ptr Z3_ast -> IO (Maybe AST)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Context -> Ptr Z3_ast -> IO AST
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
ctx (Ptr Z3_ast -> IO (Maybe AST)) -> IO (Ptr Z3_ast) -> IO (Maybe AST)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
forall a. Storable a => Ptr a -> IO a
peek Ptr (Ptr Z3_ast)
p
getConstInterp :: Context -> Model -> FuncDecl -> IO (Maybe AST)
getConstInterp :: Context -> Model -> FuncDecl -> IO (Maybe AST)
getConstInterp ctx :: Context
ctx m :: Model
m fd :: FuncDecl
fd = (Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> Context
-> ((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO (Maybe AST)
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast)
z3_model_get_const_interp Context
ctx (((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO (Maybe AST))
-> ((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO (Maybe AST)
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast)
f ->
Model -> (Ptr Z3_model -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Model
m ((Ptr Z3_model -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_model -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \mPtr :: Ptr Z3_model
mPtr ->
FuncDecl
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c FuncDecl
fd ((Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr Z3_func_decl -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \fdPtr :: Ptr Z3_func_decl
fdPtr ->
Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_ast)
f Ptr Z3_model
mPtr Ptr Z3_func_decl
fdPtr
hasInterp :: Context -> Model -> FuncDecl -> IO Bool
hasInterp :: Context -> Model -> FuncDecl -> IO Bool
hasInterp = (Ptr Z3_context -> Ptr Z3_model -> Ptr Z3_func_decl -> IO Z3_bool)
-> Context -> Model -> FuncDecl -> IO Bool
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_model -> Ptr Z3_func_decl -> IO Z3_bool
z3_model_has_interp
numConsts :: Context -> Model -> IO Word
numConsts :: Context -> Model -> IO Word
numConsts = (Ptr Z3_context -> Ptr Z3_model -> IO CUInt)
-> Context -> Model -> IO Word
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_model -> IO CUInt
z3_model_get_num_consts
numFuncs :: Context -> Model -> IO Word
numFuncs :: Context -> Model -> IO Word
numFuncs = (Ptr Z3_context -> Ptr Z3_model -> IO CUInt)
-> Context -> Model -> IO Word
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_model -> IO CUInt
z3_model_get_num_funcs
getConstDecl :: Context -> Model -> Word -> IO FuncDecl
getConstDecl :: Context -> Model -> Word -> IO FuncDecl
getConstDecl = (Ptr Z3_context -> Ptr Z3_model -> CUInt -> IO (Ptr Z3_func_decl))
-> Context -> Model -> Word -> IO FuncDecl
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_model -> CUInt -> IO (Ptr Z3_func_decl)
z3_model_get_const_decl
getFuncDecl :: Context -> Model -> Word -> IO FuncDecl
getFuncDecl :: Context -> Model -> Word -> IO FuncDecl
getFuncDecl = (Ptr Z3_context -> Ptr Z3_model -> CUInt -> IO (Ptr Z3_func_decl))
-> Context -> Model -> Word -> IO FuncDecl
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_model -> CUInt -> IO (Ptr Z3_func_decl)
z3_model_get_func_decl
getConsts :: Context -> Model -> IO [FuncDecl]
getConsts :: Context -> Model -> IO [FuncDecl]
getConsts ctx :: Context
ctx m :: Model
m = do
Word
n <- Context -> Model -> IO Word
numConsts Context
ctx Model
m
[Word] -> (Word -> IO FuncDecl) -> IO [FuncDecl]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [0..Word
nWord -> Word -> Word
forall a. Num a => a -> a -> a
-1] ((Word -> IO FuncDecl) -> IO [FuncDecl])
-> (Word -> IO FuncDecl) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \i :: Word
i -> Context -> Model -> Word -> IO FuncDecl
getConstDecl Context
ctx Model
m Word
i
getFuncs :: Context -> Model -> IO [FuncDecl]
getFuncs :: Context -> Model -> IO [FuncDecl]
getFuncs ctx :: Context
ctx m :: Model
m = do
Word
n <- Context -> Model -> IO Word
numFuncs Context
ctx Model
m
[Word] -> (Word -> IO FuncDecl) -> IO [FuncDecl]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
forM [0..Word
nWord -> Word -> Word
forall a. Num a => a -> a -> a
-1] ((Word -> IO FuncDecl) -> IO [FuncDecl])
-> (Word -> IO FuncDecl) -> IO [FuncDecl]
forall a b. (a -> b) -> a -> b
$ \i :: Word
i -> Context -> Model -> Word -> IO FuncDecl
getFuncDecl Context
ctx Model
m Word
i
evalArray :: Context -> Model -> AST -> IO (Maybe FuncModel)
evalArray :: Context -> Model -> AST -> IO (Maybe FuncModel)
evalArray ctx :: Context
ctx model :: Model
model array :: AST
array =
do
Maybe AST
evaldArrayMb <- Context -> EvalAst AST
eval Context
ctx Model
model AST
array
case Maybe AST
evaldArrayMb of
Nothing -> Maybe FuncModel -> IO (Maybe FuncModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FuncModel
forall a. Maybe a
Nothing
Just evaldArray :: AST
evaldArray ->
do Bool
canConvert <- Context -> AST -> IO Bool
isAsArray Context
ctx AST
evaldArray
if Bool
canConvert
then
do FuncDecl
arrayDecl <- Context -> AST -> IO FuncDecl
getAsArrayFuncDecl Context
ctx AST
evaldArray
Context -> Model -> FuncDecl -> IO (Maybe FuncModel)
evalFunc Context
ctx Model
model FuncDecl
arrayDecl
else Maybe FuncModel -> IO (Maybe FuncModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FuncModel
forall a. Maybe a
Nothing
getAsArrayFuncDecl :: Context -> AST -> IO FuncDecl
getAsArrayFuncDecl :: Context -> AST -> IO FuncDecl
getAsArrayFuncDecl = (Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_func_decl))
-> Context -> AST -> IO FuncDecl
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO (Ptr Z3_func_decl)
z3_get_as_array_func_decl
isAsArray :: Context -> AST -> IO Bool
isAsArray :: Context -> AST -> IO Bool
isAsArray = (Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool)
-> Context -> AST -> IO Bool
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO Z3_bool
z3_is_as_array
addFuncInterp :: Context -> Model -> FuncDecl -> AST -> IO FuncInterp
addFuncInterp :: Context -> Model -> FuncDecl -> AST -> IO FuncInterp
addFuncInterp = (Ptr Z3_context
-> Ptr Z3_model
-> Ptr Z3_func_decl
-> Ptr Z3_ast
-> IO (Ptr Z3_func_interp))
-> Context -> Model -> FuncDecl -> AST -> IO FuncInterp
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_model
-> Ptr Z3_func_decl
-> Ptr Z3_ast
-> IO (Ptr Z3_func_interp)
z3_add_func_interp
addConstInterp :: Context -> Model -> FuncDecl -> AST -> IO ()
addConstInterp :: Context -> Model -> FuncDecl -> AST -> IO ()
addConstInterp = (Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> Ptr Z3_ast -> IO ())
-> Context -> Model -> FuncDecl -> AST -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> Ptr Z3_ast -> IO ()
z3_add_const_interp
getMapFromInterp :: Context -> FuncInterp -> IO [([AST], AST)]
getMapFromInterp :: Context -> FuncInterp -> IO [([AST], AST)]
getMapFromInterp ctx :: Context
ctx interp :: FuncInterp
interp =
do Int
n <- Context -> FuncInterp -> IO Int
funcInterpGetNumEntries Context
ctx FuncInterp
interp
[FuncEntry]
entries <- (Int -> IO FuncEntry) -> [Int] -> IO [FuncEntry]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> FuncInterp -> Int -> IO FuncEntry
funcInterpGetEntry Context
ctx FuncInterp
interp) [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1]
(FuncEntry -> IO ([AST], AST)) -> [FuncEntry] -> IO [([AST], AST)]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> FuncEntry -> IO ([AST], AST)
getEntry Context
ctx) [FuncEntry]
entries
getEntry :: Context -> FuncEntry -> IO ([AST], AST)
getEntry :: Context -> FuncEntry -> IO ([AST], AST)
getEntry ctx :: Context
ctx entry :: FuncEntry
entry =
do AST
val <- Context -> FuncEntry -> IO AST
funcEntryGetValue Context
ctx FuncEntry
entry
[AST]
args <- Context -> FuncEntry -> IO [AST]
getEntryArgs Context
ctx FuncEntry
entry
([AST], AST) -> IO ([AST], AST)
forall (m :: * -> *) a. Monad m => a -> m a
return ([AST]
args, AST
val)
getEntryArgs :: Context -> FuncEntry -> IO [AST]
getEntryArgs :: Context -> FuncEntry -> IO [AST]
getEntryArgs ctx :: Context
ctx entry :: FuncEntry
entry =
do Int
n <- Context -> FuncEntry -> IO Int
funcEntryGetNumArgs Context
ctx FuncEntry
entry
(Int -> IO AST) -> [Int] -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> FuncEntry -> Int -> IO AST
funcEntryGetArg Context
ctx FuncEntry
entry) [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1]
getFuncInterp :: Context -> Model -> FuncDecl -> IO (Maybe FuncInterp)
getFuncInterp :: Context -> Model -> FuncDecl -> IO (Maybe FuncInterp)
getFuncInterp ctx :: Context
ctx m :: Model
m fd :: FuncDecl
fd = (Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> Context
-> ((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp))
-> IO (Maybe FuncInterp)
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp)
z3_model_get_func_interp Context
ctx (((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp))
-> IO (Maybe FuncInterp))
-> ((Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp))
-> IO (Maybe FuncInterp)
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp)
f ->
Model
-> (Ptr Z3_model -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Model
m ((Ptr Z3_model -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp))
-> (Ptr Z3_model -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp)
forall a b. (a -> b) -> a -> b
$ \mPtr :: Ptr Z3_model
mPtr ->
FuncDecl
-> (Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c FuncDecl
fd ((Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp))
-> (Ptr Z3_func_decl -> IO (Ptr Z3_func_interp))
-> IO (Ptr Z3_func_interp)
forall a b. (a -> b) -> a -> b
$ \fdPtr :: Ptr Z3_func_decl
fdPtr ->
Ptr Z3_model -> Ptr Z3_func_decl -> IO (Ptr Z3_func_interp)
f Ptr Z3_model
mPtr Ptr Z3_func_decl
fdPtr
funcInterpGetNumEntries :: Context -> FuncInterp -> IO Int
funcInterpGetNumEntries :: Context -> FuncInterp -> IO Int
funcInterpGetNumEntries = (Ptr Z3_context -> Ptr Z3_func_interp -> IO CUInt)
-> Context -> FuncInterp -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_interp -> IO CUInt
z3_func_interp_get_num_entries
funcInterpGetEntry :: Context -> FuncInterp -> Int -> IO FuncEntry
funcInterpGetEntry :: Context -> FuncInterp -> Int -> IO FuncEntry
funcInterpGetEntry = (Ptr Z3_context
-> Ptr Z3_func_interp -> CUInt -> IO (Ptr Z3_func_entry))
-> Context -> FuncInterp -> Int -> IO FuncEntry
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context
-> Ptr Z3_func_interp -> CUInt -> IO (Ptr Z3_func_entry)
z3_func_interp_get_entry
funcInterpGetElse :: Context -> FuncInterp -> IO AST
funcInterpGetElse :: Context -> FuncInterp -> IO AST
funcInterpGetElse = (Ptr Z3_context -> Ptr Z3_func_interp -> IO (Ptr Z3_ast))
-> Context -> FuncInterp -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_interp -> IO (Ptr Z3_ast)
z3_func_interp_get_else
funcInterpGetArity :: Context -> FuncInterp -> IO Int
funcInterpGetArity :: Context -> FuncInterp -> IO Int
funcInterpGetArity = (Ptr Z3_context -> Ptr Z3_func_interp -> IO CUInt)
-> Context -> FuncInterp -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_interp -> IO CUInt
z3_func_interp_get_arity
funcEntryGetValue :: Context -> FuncEntry -> IO AST
funcEntryGetValue :: Context -> FuncEntry -> IO AST
funcEntryGetValue = (Ptr Z3_context -> Ptr Z3_func_entry -> IO (Ptr Z3_ast))
-> Context -> FuncEntry -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_entry -> IO (Ptr Z3_ast)
z3_func_entry_get_value
funcEntryGetNumArgs :: Context -> FuncEntry -> IO Int
funcEntryGetNumArgs :: Context -> FuncEntry -> IO Int
funcEntryGetNumArgs = (Ptr Z3_context -> Ptr Z3_func_entry -> IO CUInt)
-> Context -> FuncEntry -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_entry -> IO CUInt
z3_func_entry_get_num_args
funcEntryGetArg :: Context -> FuncEntry -> Int -> IO AST
funcEntryGetArg :: Context -> FuncEntry -> Int -> IO AST
funcEntryGetArg = (Ptr Z3_context -> Ptr Z3_func_entry -> CUInt -> IO (Ptr Z3_ast))
-> Context -> FuncEntry -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_func_entry -> CUInt -> IO (Ptr Z3_ast)
z3_func_entry_get_arg
modelToString :: Context -> Model -> IO String
modelToString :: Context -> Model -> IO String
modelToString = (Ptr Z3_context -> Ptr Z3_model -> IO CString)
-> Context -> Model -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_model -> IO CString
z3_model_to_string
showModel :: Context -> Model -> IO String
showModel :: Context -> Model -> IO String
showModel = Context -> Model -> IO String
modelToString
{-# DEPRECATED showModel "Use modelToString instead." #-}
type EvalAst a = Model -> AST -> IO (Maybe a)
eval :: Context -> EvalAst AST
eval :: Context -> EvalAst AST
eval ctx :: Context
ctx m :: Model
m a :: AST
a = Context -> Model -> AST -> Bool -> IO (Maybe AST)
modelEval Context
ctx Model
m AST
a Bool
True
evalBool :: Context -> EvalAst Bool
evalBool :: Context -> EvalAst Bool
evalBool ctx :: Context
ctx m :: Model
m ast :: AST
ast = Context -> EvalAst AST
eval Context
ctx Model
m AST
ast IO (Maybe AST) -> (Maybe AST -> IO (Maybe Bool)) -> IO (Maybe Bool)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (AST -> IO Bool) -> Maybe AST -> IO (Maybe Bool)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (Context -> AST -> IO Bool
getBool Context
ctx)
evalInt :: Context -> EvalAst Integer
evalInt :: Context -> EvalAst Integer
evalInt ctx :: Context
ctx m :: Model
m ast :: AST
ast = Context -> EvalAst AST
eval Context
ctx Model
m AST
ast IO (Maybe AST)
-> (Maybe AST -> IO (Maybe Integer)) -> IO (Maybe Integer)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (AST -> IO Integer) -> Maybe AST -> IO (Maybe Integer)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (Context -> AST -> IO Integer
getInt Context
ctx)
evalReal :: Context -> EvalAst Rational
evalReal :: Context -> EvalAst Rational
evalReal ctx :: Context
ctx m :: Model
m ast :: AST
ast = Context -> EvalAst AST
eval Context
ctx Model
m AST
ast IO (Maybe AST)
-> (Maybe AST -> IO (Maybe Rational)) -> IO (Maybe Rational)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (AST -> IO Rational) -> Maybe AST -> IO (Maybe Rational)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (Context -> AST -> IO Rational
getReal Context
ctx)
evalBv :: Context -> Bool
-> EvalAst Integer
evalBv :: Context -> Bool -> EvalAst Integer
evalBv ctx :: Context
ctx signed :: Bool
signed m :: Model
m ast :: AST
ast =
Context -> EvalAst AST
eval Context
ctx Model
m AST
ast IO (Maybe AST)
-> (Maybe AST -> IO (Maybe Integer)) -> IO (Maybe Integer)
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (AST -> IO Integer) -> Maybe AST -> IO (Maybe Integer)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable t, Applicative f) =>
(a -> f b) -> t a -> f (t b)
T.traverse (\a :: AST
a -> Context -> AST -> Bool -> IO Integer
getBv Context
ctx AST
a Bool
signed)
evalT :: Traversable t => Context -> Model -> t AST -> IO (Maybe (t AST))
evalT :: Context -> Model -> t AST -> IO (Maybe (t AST))
evalT c :: Context
c = EvalAst AST -> Model -> t AST -> IO (Maybe (t AST))
forall (t :: * -> *) a.
Traversable t =>
EvalAst a -> Model -> t AST -> IO (Maybe (t a))
mapEval (Context -> EvalAst AST
eval Context
c)
mapEval :: Traversable t => EvalAst a -> Model -> t AST -> IO (Maybe (t a))
mapEval :: EvalAst a -> Model -> t AST -> IO (Maybe (t a))
mapEval f :: EvalAst a
f m :: Model
m = (t (Maybe a) -> Maybe (t a))
-> IO (t (Maybe a)) -> IO (Maybe (t a))
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
fmap t (Maybe a) -> Maybe (t a)
forall (t :: * -> *) (m :: * -> *) a.
(Traversable t, Monad m) =>
t (m a) -> m (t a)
T.sequence (IO (t (Maybe a)) -> IO (Maybe (t a)))
-> (t AST -> IO (t (Maybe a))) -> t AST -> IO (Maybe (t a))
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (AST -> IO (Maybe a)) -> t AST -> IO (t (Maybe a))
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (EvalAst a
f Model
m)
data FuncModel = FuncModel
{ FuncModel -> [([AST], AST)]
interpMap :: [([AST], AST)]
, FuncModel -> AST
interpElse :: AST
}
evalFunc :: Context -> Model -> FuncDecl -> IO (Maybe FuncModel)
evalFunc :: Context -> Model -> FuncDecl -> IO (Maybe FuncModel)
evalFunc ctx :: Context
ctx m :: Model
m fDecl :: FuncDecl
fDecl =
do Maybe FuncInterp
interpMb <- Context -> Model -> FuncDecl -> IO (Maybe FuncInterp)
getFuncInterp Context
ctx Model
m FuncDecl
fDecl
case Maybe FuncInterp
interpMb of
Nothing -> Maybe FuncModel -> IO (Maybe FuncModel)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe FuncModel
forall a. Maybe a
Nothing
Just interp :: FuncInterp
interp ->
do [([AST], AST)]
funcMap <- Context -> FuncInterp -> IO [([AST], AST)]
getMapFromInterp Context
ctx FuncInterp
interp
AST
elsePart <- Context -> FuncInterp -> IO AST
funcInterpGetElse Context
ctx FuncInterp
interp
Maybe FuncModel -> IO (Maybe FuncModel)
forall (m :: * -> *) a. Monad m => a -> m a
return (FuncModel -> Maybe FuncModel
forall a. a -> Maybe a
Just (FuncModel -> Maybe FuncModel) -> FuncModel -> Maybe FuncModel
forall a b. (a -> b) -> a -> b
$ [([AST], AST)] -> AST -> FuncModel
FuncModel [([AST], AST)]
funcMap AST
elsePart)
data ASTPrintMode
= Z3_PRINT_SMTLIB_FULL
| Z3_PRINT_LOW_LEVEL
| Z3_PRINT_SMTLIB2_COMPLIANT
setASTPrintMode :: Context -> ASTPrintMode -> IO ()
setASTPrintMode :: Context -> ASTPrintMode -> IO ()
setASTPrintMode ctx :: Context
ctx mode :: ASTPrintMode
mode = Context -> (Ptr Z3_context -> IO ()) -> IO ()
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError Context
ctx ((Ptr Z3_context -> IO ()) -> IO ())
-> (Ptr Z3_context -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ctxPtr :: Ptr Z3_context
ctxPtr ->
case ASTPrintMode
mode of
Z3_PRINT_SMTLIB_FULL ->
Z3_error_handler
z3_set_ast_print_mode Ptr Z3_context
ctxPtr CInt
z3_print_smtlib_full
Z3_PRINT_LOW_LEVEL ->
Z3_error_handler
z3_set_ast_print_mode Ptr Z3_context
ctxPtr CInt
z3_print_low_level
Z3_PRINT_SMTLIB2_COMPLIANT ->
Z3_error_handler
z3_set_ast_print_mode Ptr Z3_context
ctxPtr CInt
z3_print_smtlib2_compliant
astToString :: Context -> AST -> IO String
astToString :: Context -> AST -> IO String
astToString = (Ptr Z3_context -> Ptr Z3_ast -> IO CString)
-> Context -> AST -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_ast -> IO CString
z3_ast_to_string
patternToString :: Context -> Pattern -> IO String
patternToString :: Context -> Pattern -> IO String
patternToString = (Ptr Z3_context -> Ptr Z3_pattern -> IO CString)
-> Context -> Pattern -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_pattern -> IO CString
z3_pattern_to_string
sortToString :: Context -> Sort -> IO String
sortToString :: Context -> Sort -> IO String
sortToString = (Ptr Z3_context -> Ptr Z3_sort -> IO CString)
-> Context -> Sort -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_sort -> IO CString
z3_sort_to_string
funcDeclToString :: Context -> FuncDecl -> IO String
funcDeclToString :: Context -> FuncDecl -> IO String
funcDeclToString = (Ptr Z3_context -> Ptr Z3_func_decl -> IO CString)
-> Context -> FuncDecl -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_func_decl -> IO CString
z3_func_decl_to_string
benchmarkToSMTLibString :: Context
-> String
-> String
-> String
-> String
-> [AST]
-> AST
-> IO String
benchmarkToSMTLibString :: Context
-> String
-> String
-> String
-> String
-> [AST]
-> AST
-> IO String
benchmarkToSMTLibString ctx :: Context
ctx name :: String
name logic :: String
logic status :: String
status attr :: String
attr assump :: [AST]
assump form :: AST
form =
(Ptr Z3_context
-> CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString)
-> Context
-> ((CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString)
-> IO CString)
-> IO String
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString
z3_benchmark_to_smtlib_string Context
ctx (((CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString)
-> IO CString)
-> IO String)
-> ((CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString)
-> IO CString)
-> IO String
forall a b. (a -> b) -> a -> b
$ \f :: CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString
f ->
String -> (CString -> IO CString) -> IO CString
forall a. String -> (CString -> IO a) -> IO a
withCString String
name ((CString -> IO CString) -> IO CString)
-> (CString -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \namePtr :: CString
namePtr ->
String -> (CString -> IO CString) -> IO CString
forall a. String -> (CString -> IO a) -> IO a
withCString String
logic ((CString -> IO CString) -> IO CString)
-> (CString -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \logicPtr :: CString
logicPtr ->
String -> (CString -> IO CString) -> IO CString
forall a. String -> (CString -> IO a) -> IO a
withCString String
status ((CString -> IO CString) -> IO CString)
-> (CString -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \statusPtr :: CString
statusPtr ->
String -> (CString -> IO CString) -> IO CString
forall a. String -> (CString -> IO a) -> IO a
withCString String
attr ((CString -> IO CString) -> IO CString)
-> (CString -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \attrPtr :: CString
attrPtr ->
[AST] -> (CUInt -> Ptr (Ptr Z3_ast) -> IO CString) -> IO CString
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
assump ((CUInt -> Ptr (Ptr Z3_ast) -> IO CString) -> IO CString)
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \assumpNum :: CUInt
assumpNum assumpArr :: Ptr (Ptr Z3_ast)
assumpArr ->
AST -> (Ptr Z3_ast -> IO CString) -> IO CString
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c AST
form ((Ptr Z3_ast -> IO CString) -> IO CString)
-> (Ptr Z3_ast -> IO CString) -> IO CString
forall a b. (a -> b) -> a -> b
$ \formPtr :: Ptr Z3_ast
formPtr ->
CString
-> CString
-> CString
-> CString
-> CUInt
-> Ptr (Ptr Z3_ast)
-> Ptr Z3_ast
-> IO CString
f CString
namePtr CString
logicPtr CString
statusPtr CString
attrPtr CUInt
assumpNum Ptr (Ptr Z3_ast)
assumpArr Ptr Z3_ast
formPtr
mkTactic :: Context -> String -> IO Tactic
mkTactic :: Context -> String -> IO Tactic
mkTactic = (Ptr Z3_context -> CString -> IO (Ptr Z3_tactic))
-> Context -> String -> IO Tactic
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> CString -> IO (Ptr Z3_tactic)
z3_mk_tactic
andThenTactic :: Context -> Tactic -> Tactic -> IO Tactic
andThenTactic :: Context -> Tactic -> Tactic -> IO Tactic
andThenTactic = (Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_tactic -> IO (Ptr Z3_tactic))
-> Context -> Tactic -> Tactic -> IO Tactic
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_tactic -> IO (Ptr Z3_tactic)
z3_tactic_and_then
orElseTactic :: Context -> Tactic -> Tactic -> IO Tactic
orElseTactic :: Context -> Tactic -> Tactic -> IO Tactic
orElseTactic = (Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_tactic -> IO (Ptr Z3_tactic))
-> Context -> Tactic -> Tactic -> IO Tactic
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_tactic -> IO (Ptr Z3_tactic)
z3_tactic_or_else
skipTactic :: Context -> IO Tactic
skipTactic :: Context -> IO Tactic
skipTactic = (Ptr Z3_context -> IO (Ptr Z3_tactic)) -> Context -> IO Tactic
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_tactic)
z3_tactic_skip
tryForTactic :: Context -> Tactic -> Int -> IO Tactic
tryForTactic :: Context -> Tactic -> Int -> IO Tactic
tryForTactic = (Ptr Z3_context -> Ptr Z3_tactic -> CUInt -> IO (Ptr Z3_tactic))
-> Context -> Tactic -> Int -> IO Tactic
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_tactic -> CUInt -> IO (Ptr Z3_tactic)
z3_tactic_try_for
mkQuantifierEliminationTactic :: Context -> IO Tactic
mkQuantifierEliminationTactic :: Context -> IO Tactic
mkQuantifierEliminationTactic ctx :: Context
ctx = Context -> String -> IO Tactic
mkTactic Context
ctx "qe"
mkAndInverterGraphTactic :: Context -> IO Tactic
mkAndInverterGraphTactic :: Context -> IO Tactic
mkAndInverterGraphTactic ctx :: Context
ctx = Context -> String -> IO Tactic
mkTactic Context
ctx "aig"
applyTactic :: Context -> Tactic -> Goal -> IO ApplyResult
applyTactic :: Context -> Tactic -> Goal -> IO ApplyResult
applyTactic = (Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_goal -> IO (Ptr Z3_apply_result))
-> Context -> Tactic -> Goal -> IO ApplyResult
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context
-> Ptr Z3_tactic -> Ptr Z3_goal -> IO (Ptr Z3_apply_result)
z3_tactic_apply
getApplyResultNumSubgoals :: Context -> ApplyResult -> IO Int
getApplyResultNumSubgoals :: Context -> ApplyResult -> IO Int
getApplyResultNumSubgoals = (Ptr Z3_context -> Ptr Z3_apply_result -> IO CUInt)
-> Context -> ApplyResult -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_apply_result -> IO CUInt
z3_apply_result_get_num_subgoals
getApplyResultSubgoal :: Context -> ApplyResult -> Int -> IO Goal
getApplyResultSubgoal :: Context -> ApplyResult -> Int -> IO Goal
getApplyResultSubgoal = (Ptr Z3_context
-> Ptr Z3_apply_result -> CUInt -> IO (Ptr Z3_goal))
-> Context -> ApplyResult -> Int -> IO Goal
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_apply_result -> CUInt -> IO (Ptr Z3_goal)
z3_apply_result_get_subgoal
getApplyResultSubgoals :: Context -> ApplyResult -> IO [Goal]
getApplyResultSubgoals :: Context -> ApplyResult -> IO [Goal]
getApplyResultSubgoals ctx :: Context
ctx a :: ApplyResult
a = do
Int
n <- Context -> ApplyResult -> IO Int
getApplyResultNumSubgoals Context
ctx ApplyResult
a
[Int] -> (Int -> IO Goal) -> IO [Goal]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] (Context -> ApplyResult -> Int -> IO Goal
getApplyResultSubgoal Context
ctx ApplyResult
a)
mkGoal :: Context -> Bool -> Bool -> Bool -> IO Goal
mkGoal :: Context -> Bool -> Bool -> Bool -> IO Goal
mkGoal = (Ptr Z3_context
-> Z3_bool -> Z3_bool -> Z3_bool -> IO (Ptr Z3_goal))
-> Context -> Bool -> Bool -> Bool -> IO Goal
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context -> Z3_bool -> Z3_bool -> Z3_bool -> IO (Ptr Z3_goal)
z3_mk_goal
goalAssert :: Context -> Goal -> AST -> IO ()
goalAssert :: Context -> Goal -> AST -> IO ()
goalAssert = (Ptr Z3_context -> Ptr Z3_goal -> Ptr Z3_ast -> IO ())
-> Context -> Goal -> AST -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_goal -> Ptr Z3_ast -> IO ()
z3_goal_assert
getGoalSize :: Context -> Goal -> IO Int
getGoalSize :: Context -> Goal -> IO Int
getGoalSize = (Ptr Z3_context -> Ptr Z3_goal -> IO CUInt)
-> Context -> Goal -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_goal -> IO CUInt
z3_goal_size
getGoalFormula :: Context -> Goal -> Int -> IO AST
getGoalFormula :: Context -> Goal -> Int -> IO AST
getGoalFormula = (Ptr Z3_context -> Ptr Z3_goal -> CUInt -> IO (Ptr Z3_ast))
-> Context -> Goal -> Int -> IO AST
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_goal -> CUInt -> IO (Ptr Z3_ast)
z3_goal_formula
getGoalFormulas :: Context -> Goal -> IO [AST]
getGoalFormulas :: Context -> Goal -> IO [AST]
getGoalFormulas ctx :: Context
ctx g :: Goal
g = do
Int
n <- Context -> Goal -> IO Int
getGoalSize Context
ctx Goal
g
[Int] -> (Int -> IO AST) -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
t a -> (a -> m b) -> m (t b)
T.forM [0..Int
nInt -> Int -> Int
forall a. Num a => a -> a -> a
-1] (Context -> Goal -> Int -> IO AST
getGoalFormula Context
ctx Goal
g)
parseSMTLib2String :: Context
-> String
-> [Symbol]
-> [Sort]
-> [Symbol]
-> [FuncDecl]
-> IO AST
parseSMTLib2String :: Context
-> String -> [Symbol] -> [Sort] -> [Symbol] -> [FuncDecl] -> IO AST
parseSMTLib2String ctx :: Context
ctx str :: String
str sortNames :: [Symbol]
sortNames sorts :: [Sort]
sorts declNames :: [Symbol]
declNames decls :: [FuncDecl]
decls =
(Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> Context
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
z3_parse_smtlib2_string Context
ctx (((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
f ->
String -> (CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a. String -> (CString -> IO a) -> IO a
withCString String
str ((CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \cstr :: CString
cstr ->
[Sort]
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Sort]
sorts ((CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \sortNum :: CUInt
sortNum sortArr :: Ptr (Ptr Z3_sort)
sortArr ->
[Symbol]
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Symbol]
sortNames ((Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \sortNameArr :: Ptr (Ptr Z3_symbol)
sortNameArr ->
[FuncDecl]
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [FuncDecl]
decls ((CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \declNum :: CUInt
declNum declArr :: Ptr (Ptr Z3_func_decl)
declArr ->
[Symbol]
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Symbol]
declNames ((Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \declNameArr :: Ptr (Ptr Z3_symbol)
declNameArr ->
CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
f CString
cstr CUInt
sortNum Ptr (Ptr Z3_symbol)
sortNameArr Ptr (Ptr Z3_sort)
sortArr CUInt
declNum Ptr (Ptr Z3_symbol)
declNameArr Ptr (Ptr Z3_func_decl)
declArr
parseSMTLib2File :: Context
-> String
-> [Symbol]
-> [Sort]
-> [Symbol]
-> [FuncDecl]
-> IO AST
parseSMTLib2File :: Context
-> String -> [Symbol] -> [Sort] -> [Symbol] -> [FuncDecl] -> IO AST
parseSMTLib2File ctx :: Context
ctx file :: String
file sortNames :: [Symbol]
sortNames sorts :: [Sort]
sorts declNames :: [Symbol]
declNames decls :: [FuncDecl]
decls =
(Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> Context
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
z3_parse_smtlib2_string Context
ctx (((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> ((CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall a b. (a -> b) -> a -> b
$ \f :: CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
f ->
String -> (CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a. String -> (CString -> IO a) -> IO a
withCString String
file ((CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (CString -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \fileName :: CString
fileName ->
[Sort]
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [Sort]
sorts ((CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_sort) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \sortNum :: CUInt
sortNum sortArr :: Ptr (Ptr Z3_sort)
sortArr ->
[Symbol]
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Symbol]
sortNames ((Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \sortNameArr :: Ptr (Ptr Z3_symbol)
sortNameArr ->
[FuncDecl]
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [FuncDecl]
decls ((CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \declNum :: CUInt
declNum declArr :: Ptr (Ptr Z3_func_decl)
declArr ->
[Symbol]
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall h c a.
(Marshal h c, Storable c) =>
[h] -> (Ptr c -> IO a) -> IO a
marshalArray [Symbol]
declNames ((Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast))
-> (Ptr (Ptr Z3_symbol) -> IO (Ptr Z3_ast)) -> IO (Ptr Z3_ast)
forall a b. (a -> b) -> a -> b
$ \declNameArr :: Ptr (Ptr Z3_symbol)
declNameArr ->
CString
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_sort)
-> CUInt
-> Ptr (Ptr Z3_symbol)
-> Ptr (Ptr Z3_func_decl)
-> IO (Ptr Z3_ast)
f CString
fileName CUInt
sortNum Ptr (Ptr Z3_symbol)
sortNameArr Ptr (Ptr Z3_sort)
sortArr CUInt
declNum Ptr (Ptr Z3_symbol)
declNameArr Ptr (Ptr Z3_func_decl)
declArr
data Z3Error = Z3Error
{ Z3Error -> Z3ErrorCode
errCode :: Z3ErrorCode
, Z3Error -> String
errMsg :: String
}
deriving Typeable
instance Show Z3Error where
show :: Z3Error -> String
show (Z3Error _ s :: String
s) = "Z3 error: " String -> ShowS
forall a. [a] -> [a] -> [a]
++ String
s
data Z3ErrorCode = SortError | IOB | InvalidArg | ParserError | NoParser
| InvalidPattern | MemoutFail | FileAccessError | InternalFatal
| InvalidUsage | DecRefError | Z3Exception
deriving (Int -> Z3ErrorCode -> ShowS
[Z3ErrorCode] -> ShowS
Z3ErrorCode -> String
(Int -> Z3ErrorCode -> ShowS)
-> (Z3ErrorCode -> String)
-> ([Z3ErrorCode] -> ShowS)
-> Show Z3ErrorCode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Z3ErrorCode] -> ShowS
$cshowList :: [Z3ErrorCode] -> ShowS
show :: Z3ErrorCode -> String
$cshow :: Z3ErrorCode -> String
showsPrec :: Int -> Z3ErrorCode -> ShowS
$cshowsPrec :: Int -> Z3ErrorCode -> ShowS
Show, Typeable)
toZ3Error :: Z3_error_code -> Z3ErrorCode
toZ3Error :: CInt -> Z3ErrorCode
toZ3Error e :: CInt
e
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_sort_error = Z3ErrorCode
SortError
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_iob = Z3ErrorCode
IOB
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_invalid_arg = Z3ErrorCode
InvalidArg
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_parser_error = Z3ErrorCode
ParserError
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_no_parser = Z3ErrorCode
NoParser
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_invalid_pattern = Z3ErrorCode
InvalidPattern
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_memout_fail = Z3ErrorCode
MemoutFail
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_file_access_error = Z3ErrorCode
FileAccessError
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_internal_fatal = Z3ErrorCode
InternalFatal
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_invalid_usage = Z3ErrorCode
InvalidUsage
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_dec_ref_error = Z3ErrorCode
DecRefError
| CInt
e CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== CInt
z3_exception = Z3ErrorCode
Z3Exception
| Bool
otherwise = String -> Z3ErrorCode
forall a. HasCallStack => String -> a
error "Z3.Base.toZ3Error: illegal `Z3_error_code' value"
instance Exception Z3Error
z3Error :: Z3ErrorCode -> String -> IO ()
z3Error :: Z3ErrorCode -> String -> IO ()
z3Error cd :: Z3ErrorCode
cd = Z3Error -> IO ()
forall a e. Exception e => e -> a
throw (Z3Error -> IO ()) -> (String -> Z3Error) -> String -> IO ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Z3ErrorCode -> String -> Z3Error
Z3Error Z3ErrorCode
cd
checkError :: Ptr Z3_context -> IO a -> IO a
checkError :: Ptr Z3_context -> IO a -> IO a
checkError cPtr :: Ptr Z3_context
cPtr m :: IO a
m = do
IO a
m IO a -> IO () -> IO a
forall (f :: * -> *) a b. Applicative f => f a -> f b -> f a
<* (Ptr Z3_context -> IO CInt
z3_get_error_code Ptr Z3_context
cPtr IO CInt -> (CInt -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= CInt -> IO ()
throwZ3Exn)
where getErrStr :: CInt -> IO String
getErrStr i :: CInt
i = CString -> IO String
peekCString (CString -> IO String) -> IO CString -> IO String
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Ptr Z3_context -> CInt -> IO CString
z3_get_error_msg_ex Ptr Z3_context
cPtr CInt
i
throwZ3Exn :: CInt -> IO ()
throwZ3Exn i :: CInt
i = Bool -> IO () -> IO ()
forall (f :: * -> *). Applicative f => Bool -> f () -> f ()
when (CInt
i CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
z3_ok) (IO () -> IO ()) -> IO () -> IO ()
forall a b. (a -> b) -> a -> b
$ CInt -> IO String
getErrStr CInt
i IO String -> (String -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Z3ErrorCode -> String -> IO ()
z3Error (CInt -> Z3ErrorCode
toZ3Error CInt
i)
data Version
= Version {
Version -> Int
z3Major :: !Int
, Version -> Int
z3Minor :: !Int
, Version -> Int
z3Build :: !Int
, Version -> Int
z3Revision :: !Int
}
deriving (Version -> Version -> Bool
(Version -> Version -> Bool)
-> (Version -> Version -> Bool) -> Eq Version
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Version -> Version -> Bool
$c/= :: Version -> Version -> Bool
== :: Version -> Version -> Bool
$c== :: Version -> Version -> Bool
Eq,Eq Version
Eq Version =>
(Version -> Version -> Ordering)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Bool)
-> (Version -> Version -> Version)
-> (Version -> Version -> Version)
-> Ord Version
Version -> Version -> Bool
Version -> Version -> Ordering
Version -> Version -> Version
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
min :: Version -> Version -> Version
$cmin :: Version -> Version -> Version
max :: Version -> Version -> Version
$cmax :: Version -> Version -> Version
>= :: Version -> Version -> Bool
$c>= :: Version -> Version -> Bool
> :: Version -> Version -> Bool
$c> :: Version -> Version -> Bool
<= :: Version -> Version -> Bool
$c<= :: Version -> Version -> Bool
< :: Version -> Version -> Bool
$c< :: Version -> Version -> Bool
compare :: Version -> Version -> Ordering
$ccompare :: Version -> Version -> Ordering
$cp1Ord :: Eq Version
Ord)
instance Show Version where
show :: Version -> String
show (Version major :: Int
major minor :: Int
minor build :: Int
build _) =
Int -> String
forall a. Show a => a -> String
show Int
major String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
minor String -> ShowS
forall a. [a] -> [a] -> [a]
++ "." String -> ShowS
forall a. [a] -> [a] -> [a]
++ Int -> String
forall a. Show a => a -> String
show Int
build
getVersion :: IO Version
getVersion :: IO Version
getVersion =
(Ptr CUInt -> IO Version) -> IO Version
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO Version) -> IO Version)
-> (Ptr CUInt -> IO Version) -> IO Version
forall a b. (a -> b) -> a -> b
$ \ptrMinor :: Ptr CUInt
ptrMinor ->
(Ptr CUInt -> IO Version) -> IO Version
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO Version) -> IO Version)
-> (Ptr CUInt -> IO Version) -> IO Version
forall a b. (a -> b) -> a -> b
$ \ptrMajor :: Ptr CUInt
ptrMajor ->
(Ptr CUInt -> IO Version) -> IO Version
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO Version) -> IO Version)
-> (Ptr CUInt -> IO Version) -> IO Version
forall a b. (a -> b) -> a -> b
$ \ptrBuild :: Ptr CUInt
ptrBuild ->
(Ptr CUInt -> IO Version) -> IO Version
forall a b. Storable a => (Ptr a -> IO b) -> IO b
alloca ((Ptr CUInt -> IO Version) -> IO Version)
-> (Ptr CUInt -> IO Version) -> IO Version
forall a b. (a -> b) -> a -> b
$ \ptrRevision :: Ptr CUInt
ptrRevision -> do
Ptr CUInt -> Ptr CUInt -> Ptr CUInt -> Ptr CUInt -> IO ()
z3_get_version Ptr CUInt
ptrMinor Ptr CUInt
ptrMajor Ptr CUInt
ptrBuild Ptr CUInt
ptrRevision
Int
minor <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
ptrMinor
Int
major <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
ptrMajor
Int
build <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
ptrBuild
Int
revision <- CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CUInt -> Int) -> IO CUInt -> IO Int
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek Ptr CUInt
ptrRevision
Version -> IO Version
forall (m :: * -> *) a. Monad m => a -> m a
return (Version -> IO Version) -> Version -> IO Version
forall a b. (a -> b) -> a -> b
$ Int -> Int -> Int -> Int -> Version
Version Int
minor Int
major Int
build Int
revision
newtype Fixedpoint = Fixedpoint { Fixedpoint -> ForeignPtr Z3_fixedpoint
unFixedpoint :: ForeignPtr Z3_fixedpoint }
deriving Fixedpoint -> Fixedpoint -> Bool
(Fixedpoint -> Fixedpoint -> Bool)
-> (Fixedpoint -> Fixedpoint -> Bool) -> Eq Fixedpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Fixedpoint -> Fixedpoint -> Bool
$c/= :: Fixedpoint -> Fixedpoint -> Bool
== :: Fixedpoint -> Fixedpoint -> Bool
$c== :: Fixedpoint -> Fixedpoint -> Bool
Eq
instance Marshal Fixedpoint (Ptr Z3_fixedpoint) where
c2h :: Context -> Ptr Z3_fixedpoint -> IO Fixedpoint
c2h = (ForeignPtr Z3_fixedpoint -> Fixedpoint)
-> Z3IncRefFun Z3_fixedpoint
-> Z3IncRefFun Z3_fixedpoint
-> Context
-> Ptr Z3_fixedpoint
-> IO Fixedpoint
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_fixedpoint -> Fixedpoint
Fixedpoint Z3IncRefFun Z3_fixedpoint
z3_fixedpoint_inc_ref Z3IncRefFun Z3_fixedpoint
z3_fixedpoint_dec_ref
h2c :: Fixedpoint -> (Ptr Z3_fixedpoint -> IO r) -> IO r
h2c fp :: Fixedpoint
fp = ForeignPtr Z3_fixedpoint -> (Ptr Z3_fixedpoint -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Fixedpoint -> ForeignPtr Z3_fixedpoint
unFixedpoint Fixedpoint
fp)
mkFixedpoint :: Context -> IO Fixedpoint
mkFixedpoint :: Context -> IO Fixedpoint
mkFixedpoint = (Ptr Z3_context -> IO (Ptr Z3_fixedpoint))
-> Context -> IO Fixedpoint
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_fixedpoint)
z3_mk_fixedpoint
fixedpointAddRule :: Context -> Fixedpoint -> AST -> Symbol -> IO ()
fixedpointAddRule :: Context -> Fixedpoint -> AST -> Symbol -> IO ()
fixedpointAddRule = (Ptr Z3_context
-> Ptr Z3_fixedpoint -> Ptr Z3_ast -> Ptr Z3_symbol -> IO ())
-> Context -> Fixedpoint -> AST -> Symbol -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_fixedpoint -> Ptr Z3_ast -> Ptr Z3_symbol -> IO ()
z3_fixedpoint_add_rule
fixedpointSetParams :: Context -> Fixedpoint -> Params -> IO ()
fixedpointSetParams :: Context -> Fixedpoint -> Params -> IO ()
fixedpointSetParams = (Ptr Z3_context -> Ptr Z3_fixedpoint -> Ptr Z3_params -> IO ())
-> Context -> Fixedpoint -> Params -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_fixedpoint -> Ptr Z3_params -> IO ()
z3_fixedpoint_set_params
fixedpointRegisterRelation :: Context -> Fixedpoint -> FuncDecl -> IO ()
fixedpointRegisterRelation :: Context -> Fixedpoint -> FuncDecl -> IO ()
fixedpointRegisterRelation = (Ptr Z3_context -> Ptr Z3_fixedpoint -> Ptr Z3_func_decl -> IO ())
-> Context -> Fixedpoint -> FuncDecl -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_fixedpoint -> Ptr Z3_func_decl -> IO ()
z3_fixedpoint_register_relation
fixedpointQueryRelations :: Context -> Fixedpoint -> [FuncDecl] -> IO Result
fixedpointQueryRelations :: Context -> Fixedpoint -> [FuncDecl] -> IO Result
fixedpointQueryRelations ctx :: Context
ctx fixedpoint :: Fixedpoint
fixedpoint fds :: [FuncDecl]
fds =
(Ptr Z3_context
-> Ptr Z3_fixedpoint
-> CUInt
-> Ptr (Ptr Z3_func_decl)
-> IO Z3_lbool)
-> Context
-> ((Ptr Z3_fixedpoint
-> CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_fixedpoint
-> CUInt
-> Ptr (Ptr Z3_func_decl)
-> IO Z3_lbool
z3_fixedpoint_query_relations Context
ctx (((Ptr Z3_fixedpoint
-> CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result)
-> ((Ptr Z3_fixedpoint
-> CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_fixedpoint -> CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool
f ->
Fixedpoint -> (Ptr Z3_fixedpoint -> IO Z3_lbool) -> IO Z3_lbool
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Fixedpoint
fixedpoint ((Ptr Z3_fixedpoint -> IO Z3_lbool) -> IO Z3_lbool)
-> (Ptr Z3_fixedpoint -> IO Z3_lbool) -> IO Z3_lbool
forall a b. (a -> b) -> a -> b
$ \fixedpointPtr :: Ptr Z3_fixedpoint
fixedpointPtr ->
[FuncDecl]
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool) -> IO Z3_lbool
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [FuncDecl]
fds ((CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool) -> IO Z3_lbool)
-> (CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool) -> IO Z3_lbool
forall a b. (a -> b) -> a -> b
$ \fdsNum :: CUInt
fdsNum fdsArr :: Ptr (Ptr Z3_func_decl)
fdsArr ->
Ptr Z3_fixedpoint -> CUInt -> Ptr (Ptr Z3_func_decl) -> IO Z3_lbool
f Ptr Z3_fixedpoint
fixedpointPtr CUInt
fdsNum Ptr (Ptr Z3_func_decl)
fdsArr
fixedpointGetAnswer :: Context -> Fixedpoint -> IO AST
fixedpointGetAnswer :: Context -> Fixedpoint -> IO AST
fixedpointGetAnswer = (Ptr Z3_context -> Ptr Z3_fixedpoint -> IO (Ptr Z3_ast))
-> Context -> Fixedpoint -> IO AST
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_fixedpoint -> IO (Ptr Z3_ast)
z3_fixedpoint_get_answer
fixedpointGetAssertions :: Context -> Fixedpoint -> IO [AST]
fixedpointGetAssertions :: Context -> Fixedpoint -> IO [AST]
fixedpointGetAssertions = (Ptr Z3_context -> Ptr Z3_fixedpoint -> IO (Ptr Z3_ast_vector))
-> Context -> Fixedpoint -> IO [AST]
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_fixedpoint -> IO (Ptr Z3_ast_vector)
z3_fixedpoint_get_assertions
data Logic
= AUFLIA
| AUFLIRA
| AUFNIRA
| LRA
| QF_ABV
| QF_AUFBV
| QF_AUFLIA
| QF_AX
| QF_BV
| QF_IDL
| QF_LIA
| QF_LRA
| QF_NIA
| QF_NRA
| QF_RDL
| QF_UF
| QF_UFBV
| QF_UFIDL
| QF_UFLIA
| QF_UFLRA
| QF_UFNRA
| UFLRA
| UFNIA
instance Show Logic where
show :: Logic -> String
show AUFLIA = "AUFLIA"
show AUFLIRA = "AUFLIRA"
show AUFNIRA = "AUFNIRA"
show LRA = "LRA"
show QF_ABV = "QF_ABV"
show QF_AUFBV = "QF_AUFBV"
show QF_AUFLIA = "QF_AUFLIA"
show QF_AX = "QF_AX"
show QF_BV = "QF_BV"
show QF_IDL = "QF_IDL"
show QF_LIA = "QF_LIA"
show QF_LRA = "QF_LRA"
show QF_NIA = "QF_NIA"
show QF_NRA = "QF_NRA"
show QF_RDL = "QF_RDL"
show QF_UF = "QF_UF"
show QF_UFBV = "QF_UFBV"
show QF_UFIDL = "QF_UFIDL"
show QF_UFLIA = "QF_UFLIA"
show QF_UFLRA = "QF_UFLRA"
show QF_UFNRA = "QF_UFNRA"
show UFLRA = "UFLRA"
show UFNIA = "UFNIA"
mkSolver :: Context -> IO Solver
mkSolver :: Context -> IO Solver
mkSolver = (Ptr Z3_context -> IO (Ptr Z3_solver)) -> Context -> IO Solver
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_solver)
z3_mk_solver
mkSimpleSolver :: Context -> IO Solver
mkSimpleSolver :: Context -> IO Solver
mkSimpleSolver = (Ptr Z3_context -> IO (Ptr Z3_solver)) -> Context -> IO Solver
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_solver)
z3_mk_simple_solver
mkSolverForLogic :: Context -> Logic -> IO Solver
mkSolverForLogic :: Context -> Logic -> IO Solver
mkSolverForLogic c :: Context
c logic :: Logic
logic = Context -> String -> IO Symbol
mkStringSymbol Context
c (Logic -> String
forall a. Show a => a -> String
show Logic
logic) IO Symbol -> (Symbol -> IO Solver) -> IO Solver
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \sym :: Symbol
sym ->
Context -> (Ptr Z3_context -> IO (Ptr Z3_solver)) -> IO Solver
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO (Ptr Z3_solver)) -> IO Solver)
-> (Ptr Z3_context -> IO (Ptr Z3_solver)) -> IO Solver
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> Ptr Z3_symbol -> IO (Ptr Z3_solver)
z3_mk_solver_for_logic Ptr Z3_context
cPtr (Ptr Z3_symbol -> IO (Ptr Z3_solver))
-> Ptr Z3_symbol -> IO (Ptr Z3_solver)
forall a b. (a -> b) -> a -> b
$ Symbol -> Ptr Z3_symbol
unSymbol Symbol
sym
solverGetHelp :: Context -> Solver -> IO String
solverGetHelp :: Context -> Solver -> IO String
solverGetHelp = (Ptr Z3_context -> Ptr Z3_solver -> IO CString)
-> Context -> Solver -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO CString
z3_solver_get_help
solverSetParams :: Context -> Solver -> Params -> IO ()
solverSetParams :: Context -> Solver -> Params -> IO ()
solverSetParams = (Ptr Z3_context -> Ptr Z3_solver -> Ptr Z3_params -> IO ())
-> Context -> Solver -> Params -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_solver -> Ptr Z3_params -> IO ()
z3_solver_set_params
solverPush :: Context -> Solver -> IO ()
solverPush :: Context -> Solver -> IO ()
solverPush = (Ptr Z3_context -> Ptr Z3_solver -> IO ())
-> Context -> Solver -> IO ()
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO ()
z3_solver_push
solverPop :: Context -> Solver -> Int -> IO ()
solverPop :: Context -> Solver -> Int -> IO ()
solverPop = (Ptr Z3_context -> Ptr Z3_solver -> CUInt -> IO ())
-> Context -> Solver -> Int -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_solver -> CUInt -> IO ()
z3_solver_pop
solverReset :: Context -> Solver -> IO ()
solverReset :: Context -> Solver -> IO ()
solverReset = (Ptr Z3_context -> Ptr Z3_solver -> IO ())
-> Context -> Solver -> IO ()
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO ()
z3_solver_reset
solverGetNumScopes :: Context -> Solver -> IO Int
solverGetNumScopes :: Context -> Solver -> IO Int
solverGetNumScopes = (Ptr Z3_context -> Ptr Z3_solver -> IO CUInt)
-> Context -> Solver -> IO Int
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO CUInt
z3_solver_get_num_scopes
solverAssertCnstr :: Context -> Solver -> AST -> IO ()
solverAssertCnstr :: Context -> Solver -> AST -> IO ()
solverAssertCnstr = (Ptr Z3_context -> Ptr Z3_solver -> Ptr Z3_ast -> IO ())
-> Context -> Solver -> AST -> IO ()
forall ah ac bh bc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 Ptr Z3_context -> Ptr Z3_solver -> Ptr Z3_ast -> IO ()
z3_solver_assert
solverAssertAndTrack :: Context -> Solver -> AST -> AST -> IO ()
solverAssertAndTrack :: Context -> Solver -> AST -> AST -> IO ()
solverAssertAndTrack = (Ptr Z3_context
-> Ptr Z3_solver -> Ptr Z3_ast -> Ptr Z3_ast -> IO ())
-> Context -> Solver -> AST -> AST -> IO ()
forall ah ac bh bc ch cc rh rc.
(Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 Ptr Z3_context
-> Ptr Z3_solver -> Ptr Z3_ast -> Ptr Z3_ast -> IO ()
z3_solver_assert_and_track
solverCheck :: Context -> Solver -> IO Result
solverCheck :: Context -> Solver -> IO Result
solverCheck ctx :: Context
ctx solver :: Solver
solver = (Ptr Z3_context -> Ptr Z3_solver -> IO Z3_lbool)
-> Context
-> ((Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool)
-> IO Result
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> Ptr Z3_solver -> IO Z3_lbool
z3_solver_check Context
ctx (((Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool) -> IO Result)
-> ((Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool) -> IO Result
forall a b. (a -> b) -> a -> b
$ Solver -> (Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Solver
solver
solverCheckAssumptions :: Context -> Solver -> [AST] -> IO Result
solverCheckAssumptions :: Context -> Solver -> [AST] -> IO Result
solverCheckAssumptions ctx :: Context
ctx solver :: Solver
solver assump :: [AST]
assump =
(Ptr Z3_context
-> Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool)
-> Context
-> ((Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context
-> Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool
z3_solver_check_assumptions Context
ctx (((Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result)
-> ((Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool)
-> IO Z3_lbool)
-> IO Result
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool
f ->
Solver -> (Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Solver
solver ((Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool)
-> (Ptr Z3_solver -> IO Z3_lbool) -> IO Z3_lbool
forall a b. (a -> b) -> a -> b
$ \solverPtr :: Ptr Z3_solver
solverPtr ->
[AST] -> (CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool) -> IO Z3_lbool
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen [AST]
assump ((CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool) -> IO Z3_lbool)
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool) -> IO Z3_lbool
forall a b. (a -> b) -> a -> b
$ \assumpNum :: CUInt
assumpNum assumpArr :: Ptr (Ptr Z3_ast)
assumpArr ->
Ptr Z3_solver -> CUInt -> Ptr (Ptr Z3_ast) -> IO Z3_lbool
f Ptr Z3_solver
solverPtr CUInt
assumpNum Ptr (Ptr Z3_ast)
assumpArr
solverGetModel :: Context -> Solver -> IO Model
solverGetModel :: Context -> Solver -> IO Model
solverGetModel ctx :: Context
ctx solver :: Solver
solver = (Ptr Z3_context -> Ptr Z3_solver -> IO (Ptr Z3_model))
-> Context
-> ((Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model))
-> IO Model
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> Ptr Z3_solver -> IO (Ptr Z3_model)
z3_solver_get_model Context
ctx (((Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model))
-> IO Model)
-> ((Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model))
-> IO Model
forall a b. (a -> b) -> a -> b
$ \f :: Ptr Z3_solver -> IO (Ptr Z3_model)
f ->
Solver -> (Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model)
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c Solver
solver ((Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model))
-> (Ptr Z3_solver -> IO (Ptr Z3_model)) -> IO (Ptr Z3_model)
forall a b. (a -> b) -> a -> b
$ \solverPtr :: Ptr Z3_solver
solverPtr ->
Ptr Z3_solver -> IO (Ptr Z3_model)
f Ptr Z3_solver
solverPtr
solverGetUnsatCore :: Context -> Solver -> IO [AST]
solverGetUnsatCore :: Context -> Solver -> IO [AST]
solverGetUnsatCore = (Ptr Z3_context -> Ptr Z3_solver -> IO (Ptr Z3_ast_vector))
-> Context -> Solver -> IO [AST]
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO (Ptr Z3_ast_vector)
z3_solver_get_unsat_core
solverGetReasonUnknown :: Context -> Solver -> IO String
solverGetReasonUnknown :: Context -> Solver -> IO String
solverGetReasonUnknown = (Ptr Z3_context -> Ptr Z3_solver -> IO CString)
-> Context -> Solver -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO CString
z3_solver_get_reason_unknown
solverToString :: Context -> Solver -> IO String
solverToString :: Context -> Solver -> IO String
solverToString = (Ptr Z3_context -> Ptr Z3_solver -> IO CString)
-> Context -> Solver -> IO String
forall ah ac rh rc.
(Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 Ptr Z3_context -> Ptr Z3_solver -> IO CString
z3_solver_to_string
solverCheckAndGetModel :: Context -> Solver -> IO (Result, Maybe Model)
solverCheckAndGetModel :: Context -> Solver -> IO (Result, Maybe Model)
solverCheckAndGetModel ctx :: Context
ctx solver :: Solver
solver =
do Result
res <- Context -> Solver -> IO Result
solverCheck Context
ctx Solver
solver
Maybe Model
mbModel <- case Result
res of
Unsat -> Maybe Model -> IO (Maybe Model)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Model
forall a. Maybe a
Nothing
_ -> Model -> Maybe Model
forall a. a -> Maybe a
Just (Model -> Maybe Model) -> IO Model -> IO (Maybe Model)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Context -> Solver -> IO Model
solverGetModel Context
ctx Solver
solver
(Result, Maybe Model) -> IO (Result, Maybe Model)
forall (m :: * -> *) a. Monad m => a -> m a
return (Result
res, Maybe Model
mbModel)
withContext :: Context -> (Ptr Z3_context -> IO r) -> IO r
withContext :: Context -> (Ptr Z3_context -> IO r) -> IO r
withContext c :: Context
c = ForeignPtr Z3_context -> (Ptr Z3_context -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Context -> ForeignPtr Z3_context
unContext Context
c)
withContextError :: Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError :: Context -> (Ptr Z3_context -> IO r) -> IO r
withContextError c :: Context
c f :: Ptr Z3_context -> IO r
f = Context -> (Ptr Z3_context -> IO r) -> IO r
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
c ((Ptr Z3_context -> IO r) -> IO r)
-> (Ptr Z3_context -> IO r) -> IO r
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> IO r -> IO r
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (Ptr Z3_context -> IO r
f Ptr Z3_context
cPtr)
marshalArray :: (Marshal h c, Storable c) => [h] -> (Ptr c -> IO a) -> IO a
marshalArray :: [h] -> (Ptr c -> IO a) -> IO a
marshalArray hs :: [h]
hs f :: Ptr c -> IO a
f = [h] -> ([c] -> IO a) -> IO a
forall h c r. Marshal h c => [h] -> ([c] -> IO r) -> IO r
hs2cs [h]
hs (([c] -> IO a) -> IO a) -> ([c] -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \cs :: [c]
cs -> [c] -> (Ptr c -> IO a) -> IO a
forall a b. Storable a => [a] -> (Ptr a -> IO b) -> IO b
withArray [c]
cs Ptr c -> IO a
f
marshalArrayLen :: (Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen :: [h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen hs :: [h]
hs f :: i -> Ptr c -> IO a
f =
[h] -> ([c] -> IO a) -> IO a
forall h c r. Marshal h c => [h] -> ([c] -> IO r) -> IO r
hs2cs [h]
hs (([c] -> IO a) -> IO a) -> ([c] -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \cs :: [c]
cs -> [c] -> (Int -> Ptr c -> IO a) -> IO a
forall a b. Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b
withArrayLen [c]
cs ((Int -> Ptr c -> IO a) -> IO a) -> (Int -> Ptr c -> IO a) -> IO a
forall a b. (a -> b) -> a -> b
$ \n :: Int
n -> i -> Ptr c -> IO a
f (Int -> i
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
n)
liftAstN :: (Ptr Z3_context -> IO (Ptr Z3_ast))
-> (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> [AST] -> IO AST
liftAstN :: (Ptr Z3_context -> IO (Ptr Z3_ast))
-> (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> [AST]
-> IO AST
liftAstN s :: Ptr Z3_context -> IO (Ptr Z3_ast)
s f :: Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f c :: Context
c = IO AST
-> (NonEmpty AST -> IO AST) -> Maybe (NonEmpty AST) -> IO AST
forall b a. b -> (a -> b) -> Maybe a -> b
maybe ((Ptr Z3_context -> IO (Ptr Z3_ast)) -> Context -> IO AST
forall rh rc.
Marshal rh rc =>
(Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 Ptr Z3_context -> IO (Ptr Z3_ast)
s Context
c) ((Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f Context
c) (Maybe (NonEmpty AST) -> IO AST)
-> ([AST] -> Maybe (NonEmpty AST)) -> [AST] -> IO AST
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [AST] -> Maybe (NonEmpty AST)
forall a. [a] -> Maybe (NonEmpty a)
nonEmpty
{-# INLINE liftAstN #-}
liftAstN1 :: (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 :: (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context -> NonEmpty AST -> IO AST
liftAstN1 f :: Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f c :: Context
c = (Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> Context
-> ((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST
forall rh rc t.
Marshal rh rc =>
(Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal Ptr Z3_context -> CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast)
f Context
c (((CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> IO AST)
-> (NonEmpty AST
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> NonEmpty AST
-> IO AST
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall h c i a.
(Marshal h c, Storable c, Integral i) =>
[h] -> (i -> Ptr c -> IO a) -> IO a
marshalArrayLen ([AST]
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast))
-> (NonEmpty AST -> [AST])
-> NonEmpty AST
-> (CUInt -> Ptr (Ptr Z3_ast) -> IO (Ptr Z3_ast))
-> IO (Ptr Z3_ast)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. NonEmpty AST -> [AST]
forall (t :: * -> *) a. Foldable t => t a -> [a]
toList
{-# INLINE liftAstN1 #-}
class Marshal h c where
c2h :: Context -> c -> IO h
h2c :: h -> (c -> IO r) -> IO r
hs2cs :: Marshal h c => [h] -> ([c] -> IO r) -> IO r
hs2cs :: [h] -> ([c] -> IO r) -> IO r
hs2cs [] f :: [c] -> IO r
f = [c] -> IO r
f []
hs2cs (h :: h
h:hs :: [h]
hs) f :: [c] -> IO r
f =
h -> (c -> IO r) -> IO r
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c h
h ((c -> IO r) -> IO r) -> (c -> IO r) -> IO r
forall a b. (a -> b) -> a -> b
$ \c :: c
c ->
[h] -> ([c] -> IO r) -> IO r
forall h c r. Marshal h c => [h] -> ([c] -> IO r) -> IO r
hs2cs [h]
hs (([c] -> IO r) -> IO r) -> ([c] -> IO r) -> IO r
forall a b. (a -> b) -> a -> b
$ \cs :: [c]
cs -> [c] -> IO r
f (c
cc -> [c] -> [c]
forall a. a -> [a] -> [a]
:[c]
cs)
cs2hs :: Marshal h c => Context -> [c] -> IO [h]
cs2hs :: Context -> [c] -> IO [h]
cs2hs ctx :: Context
ctx = (c -> IO h) -> [c] -> IO [h]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (Context -> c -> IO h
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
ctx)
peekArrayToHs :: (Marshal h c, Storable c) => Context -> Int -> Ptr c -> IO [h]
peekArrayToHs :: Context -> Int -> Ptr c -> IO [h]
peekArrayToHs c :: Context
c n :: Int
n dPtr :: Ptr c
dPtr =
Context -> [c] -> IO [h]
forall h c. Marshal h c => Context -> [c] -> IO [h]
cs2hs Context
c ([c] -> IO [h]) -> IO [c] -> IO [h]
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Int -> Ptr c -> IO [c]
forall a. Storable a => Int -> Ptr a -> IO [a]
peekArray Int
n Ptr c
dPtr
toHsCheckError :: Marshal h c => Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError :: Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError c :: Context
c f :: Ptr Z3_context -> IO c
f = Context -> (Ptr Z3_context -> IO h) -> IO h
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
c ((Ptr Z3_context -> IO h) -> IO h)
-> (Ptr Z3_context -> IO h) -> IO h
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr ->
Context -> c -> IO h
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c (c -> IO h) -> IO c -> IO h
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Ptr Z3_context -> IO c -> IO c
forall a. Ptr Z3_context -> IO a -> IO a
checkError Ptr Z3_context
cPtr (Ptr Z3_context -> IO c
f Ptr Z3_context
cPtr)
type Z3SetRefCount c = Ptr Z3_context -> Ptr c -> IO ()
type Z3IncRefFun c = Z3SetRefCount c
type Z3DecRefFun c = Z3SetRefCount c
mkC2hRefCount :: (ForeignPtr c -> h)
-> Z3IncRefFun c
-> Z3DecRefFun c
-> Context -> Ptr c -> IO h
mkC2hRefCount :: (ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount mk :: ForeignPtr c -> h
mk incRef :: Z3IncRefFun c
incRef decRef :: Z3IncRefFun c
decRef ctx :: Context
ctx xPtr :: Ptr c
xPtr =
Context -> (Ptr Z3_context -> IO h) -> IO h
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
ctx ((Ptr Z3_context -> IO h) -> IO h)
-> (Ptr Z3_context -> IO h) -> IO h
forall a b. (a -> b) -> a -> b
$ \ctxPtr :: Ptr Z3_context
ctxPtr -> do
Z3IncRefFun c
incRef Ptr Z3_context
ctxPtr Ptr c
xPtr
Context -> IO ()
contextIncRef Context
ctx
let xFinalizer :: IO ()
xFinalizer = do
Z3IncRefFun c
decRef Ptr Z3_context
ctxPtr Ptr c
xPtr
Ptr Z3_context -> IORef Word -> IO ()
contextDecRef Ptr Z3_context
ctxPtr (Context -> IORef Word
refCount Context
ctx)
ForeignPtr c -> h
mk (ForeignPtr c -> h) -> IO (ForeignPtr c) -> IO h
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Ptr c -> IO () -> IO (ForeignPtr c)
forall a. Ptr a -> IO () -> IO (ForeignPtr a)
newForeignPtr Ptr c
xPtr IO ()
xFinalizer
dummy_inc_ref :: Z3IncRefFun c
dummy_inc_ref :: Z3IncRefFun c
dummy_inc_ref _ _ = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
on_ast_ptr :: Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast))
-> Z3SetRefCount a
f :: Z3SetRefCount Z3_ast
f on_ast_ptr :: Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` t :: Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)
t = \ctxPtr :: Ptr Z3_context
ctxPtr ptr :: Ptr a
ptr -> Z3SetRefCount Z3_ast
f Ptr Z3_context
ctxPtr (Ptr Z3_ast -> IO ()) -> IO (Ptr Z3_ast) -> IO ()
forall (m :: * -> *) a b. Monad m => (a -> m b) -> m a -> m b
=<< Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)
t Ptr Z3_context
ctxPtr Ptr a
ptr
instance Marshal h (Ptr x) => Marshal (Maybe h) (Ptr x) where
c2h :: Context -> Ptr x -> IO (Maybe h)
c2h c :: Context
c = (Ptr x -> IO h) -> Maybe (Ptr x) -> IO (Maybe h)
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
T.mapM (Context -> Ptr x -> IO h
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
c) (Maybe (Ptr x) -> IO (Maybe h))
-> (Ptr x -> Maybe (Ptr x)) -> Ptr x -> IO (Maybe h)
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr x -> Maybe (Ptr x)
forall a. Ptr a -> Maybe (Ptr a)
ptrToMaybe
h2c :: Maybe h -> (Ptr x -> IO r) -> IO r
h2c Nothing f :: Ptr x -> IO r
f = Ptr x -> IO r
f Ptr x
forall a. Ptr a
nullPtr
h2c (Just x :: h
x) f :: Ptr x -> IO r
f = h -> (Ptr x -> IO r) -> IO r
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c h
x Ptr x -> IO r
f
instance Marshal () () where
c2h :: Context -> () -> IO ()
c2h _ = () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return
h2c :: () -> (() -> IO r) -> IO r
h2c x :: ()
x f :: () -> IO r
f = () -> IO r
f ()
x
instance Marshal Bool Z3_bool where
c2h :: Context -> Z3_bool -> IO Bool
c2h _ = Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> IO Bool) -> (Z3_bool -> Bool) -> Z3_bool -> IO Bool
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Z3_bool -> Bool
toBool
h2c :: Bool -> (Z3_bool -> IO r) -> IO r
h2c b :: Bool
b f :: Z3_bool -> IO r
f = Z3_bool -> IO r
f (Bool -> Z3_bool
unBool Bool
b)
instance Marshal Result Z3_lbool where
c2h :: Context -> Z3_lbool -> IO Result
c2h _ = Result -> IO Result
forall (m :: * -> *) a. Monad m => a -> m a
return (Result -> IO Result)
-> (Z3_lbool -> Result) -> Z3_lbool -> IO Result
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Z3_lbool -> Result
toResult
h2c :: Result -> (Z3_lbool -> IO r) -> IO r
h2c = String -> Result -> (Z3_lbool -> IO r) -> IO r
forall a. HasCallStack => String -> a
error "Marshal Result Z3_lbool => h2c not implemented"
instance Integral h => Marshal h CInt where
c2h :: Context -> CInt -> IO h
c2h _ = h -> IO h
forall (m :: * -> *) a. Monad m => a -> m a
return (h -> IO h) -> (CInt -> h) -> CInt -> IO h
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> h
forall a b. (Integral a, Num b) => a -> b
fromIntegral
h2c :: h -> (CInt -> IO r) -> IO r
h2c i :: h
i f :: CInt -> IO r
f = CInt -> IO r
f (h -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral h
i)
instance Integral h => Marshal h CUInt where
c2h :: Context -> CUInt -> IO h
c2h _ = h -> IO h
forall (m :: * -> *) a. Monad m => a -> m a
return (h -> IO h) -> (CUInt -> h) -> CUInt -> IO h
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> h
forall a b. (Integral a, Num b) => a -> b
fromIntegral
h2c :: h -> (CUInt -> IO r) -> IO r
h2c i :: h
i f :: CUInt -> IO r
f = CUInt -> IO r
f (h -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral h
i)
instance Integral h => Marshal h CLLong where
c2h :: Context -> CLLong -> IO h
c2h _ = h -> IO h
forall (m :: * -> *) a. Monad m => a -> m a
return (h -> IO h) -> (CLLong -> h) -> CLLong -> IO h
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CLLong -> h
forall a b. (Integral a, Num b) => a -> b
fromIntegral
h2c :: h -> (CLLong -> IO r) -> IO r
h2c i :: h
i f :: CLLong -> IO r
f = CLLong -> IO r
f (h -> CLLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral h
i)
instance Integral h => Marshal h CULLong where
c2h :: Context -> CULLong -> IO h
c2h _ = h -> IO h
forall (m :: * -> *) a. Monad m => a -> m a
return (h -> IO h) -> (CULLong -> h) -> CULLong -> IO h
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CULLong -> h
forall a b. (Integral a, Num b) => a -> b
fromIntegral
h2c :: h -> (CULLong -> IO r) -> IO r
h2c i :: h
i f :: CULLong -> IO r
f = CULLong -> IO r
f (h -> CULLong
forall a b. (Integral a, Num b) => a -> b
fromIntegral h
i)
instance Marshal Double CDouble where
c2h :: Context -> CDouble -> IO Double
c2h _ = Double -> IO Double
forall (m :: * -> *) a. Monad m => a -> m a
return (Double -> IO Double)
-> (CDouble -> Double) -> CDouble -> IO Double
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac
h2c :: Double -> (CDouble -> IO r) -> IO r
h2c d :: Double
d f :: CDouble -> IO r
f = CDouble -> IO r
f (Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
d)
instance Marshal String CString where
c2h :: Context -> CString -> IO String
c2h _ = CString -> IO String
peekCString
h2c :: String -> (CString -> IO r) -> IO r
h2c = String -> (CString -> IO r) -> IO r
forall a. String -> (CString -> IO a) -> IO a
withCString
instance Marshal App (Ptr Z3_app) where
c2h :: Context -> Ptr Z3_app -> IO App
c2h = (ForeignPtr Z3_app -> App)
-> Z3IncRefFun Z3_app
-> Z3IncRefFun Z3_app
-> Context
-> Ptr Z3_app
-> IO App
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_app -> App
App
(Z3SetRefCount Z3_ast
z3_inc_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_app
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast)
z3_app_to_ast)
(Z3SetRefCount Z3_ast
z3_dec_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_app
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_app -> IO (Ptr Z3_ast)
z3_app_to_ast)
h2c :: App -> (Ptr Z3_app -> IO r) -> IO r
h2c app :: App
app = ForeignPtr Z3_app -> (Ptr Z3_app -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (App -> ForeignPtr Z3_app
unApp App
app)
instance Marshal Params (Ptr Z3_params) where
c2h :: Context -> Ptr Z3_params -> IO Params
c2h = (ForeignPtr Z3_params -> Params)
-> Z3IncRefFun Z3_params
-> Z3IncRefFun Z3_params
-> Context
-> Ptr Z3_params
-> IO Params
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_params -> Params
Params Z3IncRefFun Z3_params
z3_params_inc_ref Z3IncRefFun Z3_params
z3_params_dec_ref
h2c :: Params -> (Ptr Z3_params -> IO r) -> IO r
h2c prm :: Params
prm = ForeignPtr Z3_params -> (Ptr Z3_params -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Params -> ForeignPtr Z3_params
unParams Params
prm)
instance Marshal Symbol (Ptr Z3_symbol) where
c2h :: Context -> Ptr Z3_symbol -> IO Symbol
c2h _ = Symbol -> IO Symbol
forall (m :: * -> *) a. Monad m => a -> m a
return (Symbol -> IO Symbol)
-> (Ptr Z3_symbol -> Symbol) -> Ptr Z3_symbol -> IO Symbol
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Ptr Z3_symbol -> Symbol
Symbol
h2c :: Symbol -> (Ptr Z3_symbol -> IO r) -> IO r
h2c s :: Symbol
s f :: Ptr Z3_symbol -> IO r
f = Ptr Z3_symbol -> IO r
f (Symbol -> Ptr Z3_symbol
unSymbol Symbol
s)
instance Marshal AST (Ptr Z3_ast) where
c2h :: Context -> Ptr Z3_ast -> IO AST
c2h = (ForeignPtr Z3_ast -> AST)
-> Z3SetRefCount Z3_ast
-> Z3SetRefCount Z3_ast
-> Context
-> Ptr Z3_ast
-> IO AST
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_ast -> AST
AST Z3SetRefCount Z3_ast
z3_inc_ref Z3SetRefCount Z3_ast
z3_dec_ref
h2c :: AST -> (Ptr Z3_ast -> IO r) -> IO r
h2c a :: AST
a f :: Ptr Z3_ast -> IO r
f = ForeignPtr Z3_ast -> (Ptr Z3_ast -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (AST -> ForeignPtr Z3_ast
unAST AST
a) Ptr Z3_ast -> IO r
f
instance Marshal [AST] (Ptr Z3_ast_vector) where
c2h :: Context -> Ptr Z3_ast_vector -> IO [AST]
c2h ctx :: Context
ctx vecPtr :: Ptr Z3_ast_vector
vecPtr = Context -> (Ptr Z3_context -> IO [AST]) -> IO [AST]
forall r. Context -> (Ptr Z3_context -> IO r) -> IO r
withContext Context
ctx ((Ptr Z3_context -> IO [AST]) -> IO [AST])
-> (Ptr Z3_context -> IO [AST]) -> IO [AST]
forall a b. (a -> b) -> a -> b
$ \ctxPtr :: Ptr Z3_context
ctxPtr -> do
Ptr Z3_context -> Ptr Z3_ast_vector -> IO ()
z3_ast_vector_inc_ref Ptr Z3_context
ctxPtr Ptr Z3_ast_vector
vecPtr
CUInt
n <- Ptr Z3_context -> Ptr Z3_ast_vector -> IO CUInt
z3_ast_vector_size Ptr Z3_context
ctxPtr Ptr Z3_ast_vector
vecPtr
[AST]
res <- if CUInt
n CUInt -> CUInt -> Bool
forall a. Eq a => a -> a -> Bool
== 0
then [AST] -> IO [AST]
forall (m :: * -> *) a. Monad m => a -> m a
return []
else (CUInt -> IO AST) -> [CUInt] -> IO [AST]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
mapM (\i :: CUInt
i -> Ptr Z3_context -> Ptr Z3_ast_vector -> CUInt -> IO (Ptr Z3_ast)
z3_ast_vector_get Ptr Z3_context
ctxPtr Ptr Z3_ast_vector
vecPtr CUInt
i IO (Ptr Z3_ast) -> (Ptr Z3_ast -> IO AST) -> IO AST
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Context -> Ptr Z3_ast -> IO AST
forall h c. Marshal h c => Context -> c -> IO h
c2h Context
ctx) [0 .. (CUInt
n CUInt -> CUInt -> CUInt
forall a. Num a => a -> a -> a
- 1)]
Ptr Z3_context -> Ptr Z3_ast_vector -> IO ()
z3_ast_vector_dec_ref Ptr Z3_context
ctxPtr Ptr Z3_ast_vector
vecPtr
[AST] -> IO [AST]
forall (m :: * -> *) a. Monad m => a -> m a
return [AST]
res
h2c :: [AST] -> (Ptr Z3_ast_vector -> IO r) -> IO r
h2c _ _ = String -> IO r
forall a. HasCallStack => String -> a
error "Marshal [AST] (Ptr Z3_ast_vector) => h2c not implemented"
instance Marshal Sort (Ptr Z3_sort) where
c2h :: Context -> Ptr Z3_sort -> IO Sort
c2h = (ForeignPtr Z3_sort -> Sort)
-> Z3IncRefFun Z3_sort
-> Z3IncRefFun Z3_sort
-> Context
-> Ptr Z3_sort
-> IO Sort
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_sort -> Sort
Sort
(Z3SetRefCount Z3_ast
z3_inc_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_sort
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_sort_to_ast)
(Z3SetRefCount Z3_ast
z3_dec_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_sort
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_sort -> IO (Ptr Z3_ast)
z3_sort_to_ast)
h2c :: Sort -> (Ptr Z3_sort -> IO r) -> IO r
h2c srt :: Sort
srt = ForeignPtr Z3_sort -> (Ptr Z3_sort -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Sort -> ForeignPtr Z3_sort
unSort Sort
srt)
instance Marshal FuncDecl (Ptr Z3_func_decl) where
c2h :: Context -> Ptr Z3_func_decl -> IO FuncDecl
c2h = (ForeignPtr Z3_func_decl -> FuncDecl)
-> Z3IncRefFun Z3_func_decl
-> Z3IncRefFun Z3_func_decl
-> Context
-> Ptr Z3_func_decl
-> IO FuncDecl
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_func_decl -> FuncDecl
FuncDecl
(Z3SetRefCount Z3_ast
z3_inc_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_func_decl
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_ast)
z3_func_decl_to_ast)
(Z3SetRefCount Z3_ast
z3_dec_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_func_decl
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_func_decl -> IO (Ptr Z3_ast)
z3_func_decl_to_ast)
h2c :: FuncDecl -> (Ptr Z3_func_decl -> IO r) -> IO r
h2c fnd :: FuncDecl
fnd = ForeignPtr Z3_func_decl -> (Ptr Z3_func_decl -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (FuncDecl -> ForeignPtr Z3_func_decl
unFuncDecl FuncDecl
fnd)
instance Marshal FuncEntry (Ptr Z3_func_entry) where
c2h :: Context -> Ptr Z3_func_entry -> IO FuncEntry
c2h = (ForeignPtr Z3_func_entry -> FuncEntry)
-> Z3IncRefFun Z3_func_entry
-> Z3IncRefFun Z3_func_entry
-> Context
-> Ptr Z3_func_entry
-> IO FuncEntry
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_func_entry -> FuncEntry
FuncEntry Z3IncRefFun Z3_func_entry
z3_func_entry_inc_ref
Z3IncRefFun Z3_func_entry
z3_func_entry_dec_ref
h2c :: FuncEntry -> (Ptr Z3_func_entry -> IO r) -> IO r
h2c fne :: FuncEntry
fne = ForeignPtr Z3_func_entry -> (Ptr Z3_func_entry -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (FuncEntry -> ForeignPtr Z3_func_entry
unFuncEntry FuncEntry
fne)
instance Marshal FuncInterp (Ptr Z3_func_interp) where
c2h :: Context -> Ptr Z3_func_interp -> IO FuncInterp
c2h = (ForeignPtr Z3_func_interp -> FuncInterp)
-> Z3IncRefFun Z3_func_interp
-> Z3IncRefFun Z3_func_interp
-> Context
-> Ptr Z3_func_interp
-> IO FuncInterp
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_func_interp -> FuncInterp
FuncInterp Z3IncRefFun Z3_func_interp
z3_func_interp_inc_ref
Z3IncRefFun Z3_func_interp
z3_func_interp_dec_ref
h2c :: FuncInterp -> (Ptr Z3_func_interp -> IO r) -> IO r
h2c fni :: FuncInterp
fni = ForeignPtr Z3_func_interp -> (Ptr Z3_func_interp -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (FuncInterp -> ForeignPtr Z3_func_interp
unFuncInterp FuncInterp
fni)
instance Marshal Model (Ptr Z3_model) where
c2h :: Context -> Ptr Z3_model -> IO Model
c2h = (ForeignPtr Z3_model -> Model)
-> Z3IncRefFun Z3_model
-> Z3IncRefFun Z3_model
-> Context
-> Ptr Z3_model
-> IO Model
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_model -> Model
Model Z3IncRefFun Z3_model
z3_model_inc_ref Z3IncRefFun Z3_model
z3_model_dec_ref
h2c :: Model -> (Ptr Z3_model -> IO r) -> IO r
h2c m :: Model
m = ForeignPtr Z3_model -> (Ptr Z3_model -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Model -> ForeignPtr Z3_model
unModel Model
m)
instance Marshal Pattern (Ptr Z3_pattern) where
c2h :: Context -> Ptr Z3_pattern -> IO Pattern
c2h = (ForeignPtr Z3_pattern -> Pattern)
-> Z3IncRefFun Z3_pattern
-> Z3IncRefFun Z3_pattern
-> Context
-> Ptr Z3_pattern
-> IO Pattern
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_pattern -> Pattern
Pattern
(Z3SetRefCount Z3_ast
z3_inc_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_pattern -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_pattern
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_pattern -> IO (Ptr Z3_ast)
z3_pattern_to_ast)
(Z3SetRefCount Z3_ast
z3_dec_ref Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr Z3_pattern -> IO (Ptr Z3_ast))
-> Z3IncRefFun Z3_pattern
forall a.
Z3SetRefCount Z3_ast
-> (Ptr Z3_context -> Ptr a -> IO (Ptr Z3_ast)) -> Z3SetRefCount a
`on_ast_ptr` Ptr Z3_context -> Ptr Z3_pattern -> IO (Ptr Z3_ast)
z3_pattern_to_ast)
h2c :: Pattern -> (Ptr Z3_pattern -> IO r) -> IO r
h2c pat :: Pattern
pat = ForeignPtr Z3_pattern -> (Ptr Z3_pattern -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Pattern -> ForeignPtr Z3_pattern
unPattern Pattern
pat)
instance Marshal Constructor (Ptr Z3_constructor) where
c2h :: Context -> Ptr Z3_constructor -> IO Constructor
c2h = (ForeignPtr Z3_constructor -> Constructor)
-> Z3IncRefFun Z3_constructor
-> Z3IncRefFun Z3_constructor
-> Context
-> Ptr Z3_constructor
-> IO Constructor
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_constructor -> Constructor
Constructor Z3IncRefFun Z3_constructor
forall c. Z3IncRefFun c
dummy_inc_ref Z3IncRefFun Z3_constructor
z3_del_constructor
h2c :: Constructor -> (Ptr Z3_constructor -> IO r) -> IO r
h2c cns :: Constructor
cns = ForeignPtr Z3_constructor -> (Ptr Z3_constructor -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Constructor -> ForeignPtr Z3_constructor
unConstructor Constructor
cns)
instance Marshal ConstructorList (Ptr Z3_constructor_list) where
c2h :: Context -> Ptr Z3_constructor_list -> IO ConstructorList
c2h = (ForeignPtr Z3_constructor_list -> ConstructorList)
-> Z3IncRefFun Z3_constructor_list
-> Z3IncRefFun Z3_constructor_list
-> Context
-> Ptr Z3_constructor_list
-> IO ConstructorList
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_constructor_list -> ConstructorList
ConstructorList Z3IncRefFun Z3_constructor_list
forall c. Z3IncRefFun c
dummy_inc_ref Z3IncRefFun Z3_constructor_list
z3_del_constructor_list
h2c :: ConstructorList -> (Ptr Z3_constructor_list -> IO r) -> IO r
h2c cl :: ConstructorList
cl = ForeignPtr Z3_constructor_list
-> (Ptr Z3_constructor_list -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (ConstructorList -> ForeignPtr Z3_constructor_list
unConstructorList ConstructorList
cl)
instance Marshal Solver (Ptr Z3_solver) where
c2h :: Context -> Ptr Z3_solver -> IO Solver
c2h = (ForeignPtr Z3_solver -> Solver)
-> (Ptr Z3_context -> Ptr Z3_solver -> IO ())
-> (Ptr Z3_context -> Ptr Z3_solver -> IO ())
-> Context
-> Ptr Z3_solver
-> IO Solver
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_solver -> Solver
Solver Ptr Z3_context -> Ptr Z3_solver -> IO ()
z3_solver_inc_ref Ptr Z3_context -> Ptr Z3_solver -> IO ()
z3_solver_dec_ref
h2c :: Solver -> (Ptr Z3_solver -> IO r) -> IO r
h2c slv :: Solver
slv = ForeignPtr Z3_solver -> (Ptr Z3_solver -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Solver -> ForeignPtr Z3_solver
unSolver Solver
slv)
instance Marshal Tactic (Ptr Z3_tactic) where
c2h :: Context -> Ptr Z3_tactic -> IO Tactic
c2h = (ForeignPtr Z3_tactic -> Tactic)
-> Z3IncRefFun Z3_tactic
-> Z3IncRefFun Z3_tactic
-> Context
-> Ptr Z3_tactic
-> IO Tactic
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_tactic -> Tactic
Tactic Z3IncRefFun Z3_tactic
z3_tactic_inc_ref Z3IncRefFun Z3_tactic
z3_tactic_dec_ref
h2c :: Tactic -> (Ptr Z3_tactic -> IO r) -> IO r
h2c tac :: Tactic
tac = ForeignPtr Z3_tactic -> (Ptr Z3_tactic -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Tactic -> ForeignPtr Z3_tactic
unTactic Tactic
tac)
instance Marshal ApplyResult (Ptr Z3_apply_result) where
c2h :: Context -> Ptr Z3_apply_result -> IO ApplyResult
c2h = (ForeignPtr Z3_apply_result -> ApplyResult)
-> Z3IncRefFun Z3_apply_result
-> Z3IncRefFun Z3_apply_result
-> Context
-> Ptr Z3_apply_result
-> IO ApplyResult
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_apply_result -> ApplyResult
ApplyResult Z3IncRefFun Z3_apply_result
z3_apply_result_inc_ref Z3IncRefFun Z3_apply_result
z3_apply_result_dec_ref
h2c :: ApplyResult -> (Ptr Z3_apply_result -> IO r) -> IO r
h2c apl :: ApplyResult
apl = ForeignPtr Z3_apply_result -> (Ptr Z3_apply_result -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (ApplyResult -> ForeignPtr Z3_apply_result
unApplyResult ApplyResult
apl)
instance Marshal Goal (Ptr Z3_goal) where
c2h :: Context -> Ptr Z3_goal -> IO Goal
c2h = (ForeignPtr Z3_goal -> Goal)
-> Z3IncRefFun Z3_goal
-> Z3IncRefFun Z3_goal
-> Context
-> Ptr Z3_goal
-> IO Goal
forall c h.
(ForeignPtr c -> h)
-> Z3IncRefFun c -> Z3IncRefFun c -> Context -> Ptr c -> IO h
mkC2hRefCount ForeignPtr Z3_goal -> Goal
Goal Z3IncRefFun Z3_goal
z3_goal_inc_ref Z3IncRefFun Z3_goal
z3_goal_dec_ref
h2c :: Goal -> (Ptr Z3_goal -> IO r) -> IO r
h2c goa :: Goal
goa = ForeignPtr Z3_goal -> (Ptr Z3_goal -> IO r) -> IO r
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr (Goal -> ForeignPtr Z3_goal
unGoal Goal
goa)
marshal :: Marshal rh rc => (Ptr Z3_context -> t) ->
Context -> (t -> IO rc) -> IO rh
marshal :: (Ptr Z3_context -> t) -> Context -> (t -> IO rc) -> IO rh
marshal f :: Ptr Z3_context -> t
f c :: Context
c cont :: t -> IO rc
cont = Context -> (Ptr Z3_context -> IO rc) -> IO rh
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO rc) -> IO rh)
-> (Ptr Z3_context -> IO rc) -> IO rh
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> t -> IO rc
cont (t -> IO rc) -> t -> IO rc
forall a b. (a -> b) -> a -> b
$ Ptr Z3_context -> t
f Ptr Z3_context
cPtr
liftFun0 :: Marshal rh rc => (Ptr Z3_context -> IO rc) ->
Context -> IO rh
liftFun0 :: (Ptr Z3_context -> IO rc) -> Context -> IO rh
liftFun0 = (Context -> (Ptr Z3_context -> IO rc) -> IO rh)
-> (Ptr Z3_context -> IO rc) -> Context -> IO rh
forall a b c. (a -> b -> c) -> b -> a -> c
flip Context -> (Ptr Z3_context -> IO rc) -> IO rh
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError
{-# INLINE liftFun0 #-}
liftFun1 :: (Marshal ah ac, Marshal rh rc) =>
(Ptr Z3_context -> ac -> IO rc) ->
Context -> ah -> IO rh
liftFun1 :: (Ptr Z3_context -> ac -> IO rc) -> Context -> ah -> IO rh
liftFun1 f :: Ptr Z3_context -> ac -> IO rc
f c :: Context
c x :: ah
x = ah -> (ac -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c ah
x ((ac -> IO rh) -> IO rh) -> (ac -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \a :: ac
a ->
Context -> (Ptr Z3_context -> IO rc) -> IO rh
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO rc) -> IO rh)
-> (Ptr Z3_context -> IO rc) -> IO rh
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> ac -> IO rc
f Ptr Z3_context
cPtr ac
a
{-# INLINE liftFun1 #-}
liftFun2 :: (Marshal ah ac, Marshal bh bc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> IO rc) ->
Context -> ah -> bh -> IO rh
liftFun2 :: (Ptr Z3_context -> ac -> bc -> IO rc)
-> Context -> ah -> bh -> IO rh
liftFun2 f :: Ptr Z3_context -> ac -> bc -> IO rc
f c :: Context
c x :: ah
x y :: bh
y = ah -> (ac -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c ah
x ((ac -> IO rh) -> IO rh) -> (ac -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \a :: ac
a -> bh -> (bc -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c bh
y ((bc -> IO rh) -> IO rh) -> (bc -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \b :: bc
b ->
Context -> (Ptr Z3_context -> IO rc) -> IO rh
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO rc) -> IO rh)
-> (Ptr Z3_context -> IO rc) -> IO rh
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> ac -> bc -> IO rc
f Ptr Z3_context
cPtr ac
a bc
b
{-# INLINE liftFun2 #-}
liftFun3 :: (Marshal ah ac, Marshal bh bc, Marshal ch cc, Marshal rh rc) =>
(Ptr Z3_context -> ac -> bc -> cc -> IO rc) ->
Context -> ah -> bh -> ch -> IO rh
liftFun3 :: (Ptr Z3_context -> ac -> bc -> cc -> IO rc)
-> Context -> ah -> bh -> ch -> IO rh
liftFun3 f :: Ptr Z3_context -> ac -> bc -> cc -> IO rc
f c :: Context
c x :: ah
x y :: bh
y z :: ch
z = ah -> (ac -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c ah
x ((ac -> IO rh) -> IO rh) -> (ac -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \x1 :: ac
x1 -> bh -> (bc -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c bh
y ((bc -> IO rh) -> IO rh) -> (bc -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \y1 :: bc
y1 -> ch -> (cc -> IO rh) -> IO rh
forall h c r. Marshal h c => h -> (c -> IO r) -> IO r
h2c ch
z ((cc -> IO rh) -> IO rh) -> (cc -> IO rh) -> IO rh
forall a b. (a -> b) -> a -> b
$ \z1 :: cc
z1 ->
Context -> (Ptr Z3_context -> IO rc) -> IO rh
forall h c.
Marshal h c =>
Context -> (Ptr Z3_context -> IO c) -> IO h
toHsCheckError Context
c ((Ptr Z3_context -> IO rc) -> IO rh)
-> (Ptr Z3_context -> IO rc) -> IO rh
forall a b. (a -> b) -> a -> b
$ \cPtr :: Ptr Z3_context
cPtr -> Ptr Z3_context -> ac -> bc -> cc -> IO rc
f Ptr Z3_context
cPtr ac
x1 bc
y1 cc
z1
{-# INLINE liftFun3 #-}
toResult :: Z3_lbool -> Result
toResult :: Z3_lbool -> Result
toResult lb :: Z3_lbool
lb
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_true = Result
Sat
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_false = Result
Unsat
| Z3_lbool
lb Z3_lbool -> Z3_lbool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_lbool
z3_l_undef = Result
Undef
| Bool
otherwise = String -> Result
forall a. HasCallStack => String -> a
error "Z3.Base.toResult: illegal `Z3_lbool' value"
toBool :: Z3_bool -> Bool
toBool :: Z3_bool -> Bool
toBool b :: Z3_bool
b
| Z3_bool
b Z3_bool -> Z3_bool -> Bool
forall a. Eq a => a -> a -> Bool
== Z3_bool
z3_false = Bool
False
| Bool
otherwise = Bool
True
unBool :: Bool -> Z3_bool
unBool :: Bool -> Z3_bool
unBool True = Z3_bool
z3_true
unBool False = Z3_bool
z3_false
ptrToMaybe :: Ptr a -> Maybe (Ptr a)
ptrToMaybe :: Ptr a -> Maybe (Ptr a)
ptrToMaybe ptr :: Ptr a
ptr | Ptr a
ptr Ptr a -> Ptr a -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr a
forall a. Ptr a
nullPtr = Maybe (Ptr a)
forall a. Maybe a
Nothing
| Bool
otherwise = Ptr a -> Maybe (Ptr a)
forall a. a -> Maybe a
Just Ptr a
ptr