{-# OPTIONS_GHC -Wall -Werror #-}
module Data.SBV.Control.Types (
CheckSatResult(..)
, Logic(..)
, SMTOption(..), isStartModeOption, isOnlyOnceOption, setSMTOption
, SMTInfoFlag(..)
, SMTErrorBehavior(..)
, SMTReasonUnknown(..)
, SMTInfoResponse(..)
) where
import Control.DeepSeq (NFData(..))
data CheckSatResult = Sat
| DSat (Maybe String)
| Unsat
| Unk
deriving (CheckSatResult -> CheckSatResult -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CheckSatResult -> CheckSatResult -> Bool
$c/= :: CheckSatResult -> CheckSatResult -> Bool
== :: CheckSatResult -> CheckSatResult -> Bool
$c== :: CheckSatResult -> CheckSatResult -> Bool
Eq, Int -> CheckSatResult -> ShowS
[CheckSatResult] -> ShowS
CheckSatResult -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CheckSatResult] -> ShowS
$cshowList :: [CheckSatResult] -> ShowS
show :: CheckSatResult -> String
$cshow :: CheckSatResult -> String
showsPrec :: Int -> CheckSatResult -> ShowS
$cshowsPrec :: Int -> CheckSatResult -> ShowS
Show)
data SMTInfoFlag = AllStatistics
| AssertionStackLevels
| Authors
| ErrorBehavior
| Name
| ReasonUnknown
| Version
| InfoKeyword String
data SMTErrorBehavior = ErrorImmediateExit
| ErrorContinuedExecution
deriving Int -> SMTErrorBehavior -> ShowS
[SMTErrorBehavior] -> ShowS
SMTErrorBehavior -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SMTErrorBehavior] -> ShowS
$cshowList :: [SMTErrorBehavior] -> ShowS
show :: SMTErrorBehavior -> String
$cshow :: SMTErrorBehavior -> String
showsPrec :: Int -> SMTErrorBehavior -> ShowS
$cshowsPrec :: Int -> SMTErrorBehavior -> ShowS
Show
data SMTReasonUnknown = UnknownMemOut
| UnknownIncomplete
| UnknownTimeOut
| UnknownOther String
instance NFData SMTReasonUnknown where rnf :: SMTReasonUnknown -> ()
rnf SMTReasonUnknown
a = seq :: forall a b. a -> b -> b
seq SMTReasonUnknown
a ()
instance Show SMTReasonUnknown where
show :: SMTReasonUnknown -> String
show SMTReasonUnknown
UnknownMemOut = String
"memout"
show SMTReasonUnknown
UnknownIncomplete = String
"incomplete"
show SMTReasonUnknown
UnknownTimeOut = String
"timeout"
show (UnknownOther String
s) = String
s
data SMTInfoResponse = Resp_Unsupported
| Resp_AllStatistics [(String, String)]
| Resp_AssertionStackLevels Integer
| Resp_Authors [String]
| Resp_Error SMTErrorBehavior
| Resp_Name String
| Resp_ReasonUnknown SMTReasonUnknown
| Resp_Version String
| Resp_InfoKeyword String [String]
deriving Int -> SMTInfoResponse -> ShowS
[SMTInfoResponse] -> ShowS
SMTInfoResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SMTInfoResponse] -> ShowS
$cshowList :: [SMTInfoResponse] -> ShowS
show :: SMTInfoResponse -> String
$cshow :: SMTInfoResponse -> String
showsPrec :: Int -> SMTInfoResponse -> ShowS
$cshowsPrec :: Int -> SMTInfoResponse -> ShowS
Show
instance Show SMTInfoFlag where
show :: SMTInfoFlag -> String
show SMTInfoFlag
AllStatistics = String
":all-statistics"
show SMTInfoFlag
AssertionStackLevels = String
":assertion-stack-levels"
show SMTInfoFlag
Authors = String
":authors"
show SMTInfoFlag
ErrorBehavior = String
":error-behavior"
show SMTInfoFlag
Name = String
":name"
show SMTInfoFlag
ReasonUnknown = String
":reason-unknown"
show SMTInfoFlag
Version = String
":version"
show (InfoKeyword String
s) = String
s
data SMTOption = DiagnosticOutputChannel FilePath
| ProduceAssertions Bool
| ProduceAssignments Bool
| ProduceProofs Bool
| ProduceInterpolants Bool
| ProduceUnsatAssumptions Bool
| ProduceUnsatCores Bool
| RandomSeed Integer
| ReproducibleResourceLimit Integer
| SMTVerbosity Integer
| OptionKeyword String [String]
| SetLogic Logic
| SetInfo String [String]
deriving Int -> SMTOption -> ShowS
[SMTOption] -> ShowS
SMTOption -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SMTOption] -> ShowS
$cshowList :: [SMTOption] -> ShowS
show :: SMTOption -> String
$cshow :: SMTOption -> String
showsPrec :: Int -> SMTOption -> ShowS
$cshowsPrec :: Int -> SMTOption -> ShowS
Show
isStartModeOption :: SMTOption -> Bool
isStartModeOption :: SMTOption -> Bool
isStartModeOption DiagnosticOutputChannel{} = Bool
False
isStartModeOption ProduceAssertions{} = Bool
True
isStartModeOption ProduceAssignments{} = Bool
True
isStartModeOption ProduceProofs{} = Bool
True
isStartModeOption ProduceInterpolants{} = Bool
True
isStartModeOption ProduceUnsatAssumptions{} = Bool
True
isStartModeOption ProduceUnsatCores{} = Bool
True
isStartModeOption RandomSeed{} = Bool
True
isStartModeOption ReproducibleResourceLimit{} = Bool
False
isStartModeOption SMTVerbosity{} = Bool
False
isStartModeOption OptionKeyword{} = Bool
True
isStartModeOption SetLogic{} = Bool
True
isStartModeOption SetInfo{} = Bool
False
isOnlyOnceOption :: SMTOption -> Bool
isOnlyOnceOption :: SMTOption -> Bool
isOnlyOnceOption DiagnosticOutputChannel{} = Bool
True
isOnlyOnceOption ProduceAssertions{} = Bool
True
isOnlyOnceOption ProduceAssignments{} = Bool
True
isOnlyOnceOption ProduceProofs{} = Bool
True
isOnlyOnceOption ProduceInterpolants{} = Bool
True
isOnlyOnceOption ProduceUnsatAssumptions{} = Bool
True
isOnlyOnceOption ProduceUnsatCores{} = Bool
True
isOnlyOnceOption RandomSeed{} = Bool
False
isOnlyOnceOption ReproducibleResourceLimit{} = Bool
False
isOnlyOnceOption SMTVerbosity{} = Bool
False
isOnlyOnceOption OptionKeyword{} = Bool
False
isOnlyOnceOption SetLogic{} = Bool
True
isOnlyOnceOption SetInfo{} = Bool
False
smtBool :: Bool -> String
smtBool :: Bool -> String
smtBool Bool
True = String
"true"
smtBool Bool
False = String
"false"
setSMTOption :: SMTOption -> String
setSMTOption :: SMTOption -> String
setSMTOption = SMTOption -> String
cvt
where cvt :: SMTOption -> String
cvt (DiagnosticOutputChannel String
f) = [String] -> String
opt [String
":diagnostic-output-channel", forall a. Show a => a -> String
show String
f]
cvt (ProduceAssertions Bool
b) = [String] -> String
opt [String
":produce-assertions", Bool -> String
smtBool Bool
b]
cvt (ProduceAssignments Bool
b) = [String] -> String
opt [String
":produce-assignments", Bool -> String
smtBool Bool
b]
cvt (ProduceProofs Bool
b) = [String] -> String
opt [String
":produce-proofs", Bool -> String
smtBool Bool
b]
cvt (ProduceInterpolants Bool
b) = [String] -> String
opt [String
":produce-interpolants", Bool -> String
smtBool Bool
b]
cvt (ProduceUnsatAssumptions Bool
b) = [String] -> String
opt [String
":produce-unsat-assumptions", Bool -> String
smtBool Bool
b]
cvt (ProduceUnsatCores Bool
b) = [String] -> String
opt [String
":produce-unsat-cores", Bool -> String
smtBool Bool
b]
cvt (RandomSeed Integer
i) = [String] -> String
opt [String
":random-seed", forall a. Show a => a -> String
show Integer
i]
cvt (ReproducibleResourceLimit Integer
i) = [String] -> String
opt [String
":reproducible-resource-limit", forall a. Show a => a -> String
show Integer
i]
cvt (SMTVerbosity Integer
i) = [String] -> String
opt [String
":verbosity", forall a. Show a => a -> String
show Integer
i]
cvt (OptionKeyword String
k [String]
as) = [String] -> String
opt (String
k forall a. a -> [a] -> [a]
: [String]
as)
cvt (SetLogic Logic
l) = Logic -> String
logic Logic
l
cvt (SetInfo String
k [String]
as) = [String] -> String
info (String
k forall a. a -> [a] -> [a]
: [String]
as)
opt :: [String] -> String
opt [String]
xs = String
"(set-option " forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords [String]
xs forall a. [a] -> [a] -> [a]
++ String
")"
info :: [String] -> String
info [String]
xs = String
"(set-info " forall a. [a] -> [a] -> [a]
++ [String] -> String
unwords [String]
xs forall a. [a] -> [a] -> [a]
++ String
")"
logic :: Logic -> String
logic Logic
Logic_NONE = String
"; NB. not setting the logic per user request of Logic_NONE"
logic Logic
l = String
"(set-logic " forall a. [a] -> [a] -> [a]
++ forall a. Show a => a -> String
show Logic
l forall a. [a] -> [a] -> [a]
++ String
")"
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
| QF_UFNIRA
| UFLRA
| UFNIA
| QF_FPBV
| QF_FP
| QF_FD
| QF_S
| Logic_ALL
| Logic_NONE
| CustomLogic String
instance Show Logic where
show :: Logic -> String
show Logic
AUFLIA = String
"AUFLIA"
show Logic
AUFLIRA = String
"AUFLIRA"
show Logic
AUFNIRA = String
"AUFNIRA"
show Logic
LRA = String
"LRA"
show Logic
QF_ABV = String
"QF_ABV"
show Logic
QF_AUFBV = String
"QF_AUFBV"
show Logic
QF_AUFLIA = String
"QF_AUFLIA"
show Logic
QF_AX = String
"QF_AX"
show Logic
QF_BV = String
"QF_BV"
show Logic
QF_IDL = String
"QF_IDL"
show Logic
QF_LIA = String
"QF_LIA"
show Logic
QF_LRA = String
"QF_LRA"
show Logic
QF_NIA = String
"QF_NIA"
show Logic
QF_NRA = String
"QF_NRA"
show Logic
QF_RDL = String
"QF_RDL"
show Logic
QF_UF = String
"QF_UF"
show Logic
QF_UFBV = String
"QF_UFBV"
show Logic
QF_UFIDL = String
"QF_UFIDL"
show Logic
QF_UFLIA = String
"QF_UFLIA"
show Logic
QF_UFLRA = String
"QF_UFLRA"
show Logic
QF_UFNRA = String
"QF_UFNRA"
show Logic
QF_UFNIRA = String
"QF_UFNIRA"
show Logic
UFLRA = String
"UFLRA"
show Logic
UFNIA = String
"UFNIA"
show Logic
QF_FPBV = String
"QF_FPBV"
show Logic
QF_FP = String
"QF_FP"
show Logic
QF_FD = String
"QF_FD"
show Logic
QF_S = String
"QF_S"
show Logic
Logic_ALL = String
"ALL"
show Logic
Logic_NONE = String
"Logic_NONE"
show (CustomLogic String
l) = String
l
{-# ANN type SMTInfoResponse ("HLint: ignore Use camelCase" :: String) #-}
{-# ANN type Logic ("HLint: ignore Use camelCase" :: String) #-}