{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -Wall -Werror #-}
module Documentation.SBV.Examples.Uninterpreted.Sort where
import Data.SBV
data Q
mkUninterpretedSort ''Q
f :: SQ -> SQ
f :: SBV Q -> SBV Q
f = String -> SBV Q -> SBV Q
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
t1 :: IO SatResult
t1 :: IO SatResult
t1 = SymbolicT IO SBool -> IO SatResult
forall a. Provable a => a -> IO SatResult
sat (SymbolicT IO SBool -> IO SatResult)
-> SymbolicT IO SBool -> IO SatResult
forall a b. (a -> b) -> a -> b
$ do SBV Q
x <- String -> Symbolic (SBV Q)
forall a. SymVal a => String -> Symbolic (SBV a)
free String
"x"
SBool -> SymbolicT IO SBool
forall (m :: * -> *) a. Monad m => a -> m a
return (SBool -> SymbolicT IO SBool) -> SBool -> SymbolicT IO SBool
forall a b. (a -> b) -> a -> b
$ SBV Q -> SBV Q
f SBV Q
x SBV Q -> SBV Q -> SBool
forall a. EqSymbolic a => a -> a -> SBool
./= SBV Q
x
t2 :: IO SatResult
t2 :: IO SatResult
t2 = SymbolicT IO SBool -> IO SatResult
forall a. Provable a => a -> IO SatResult
sat (SymbolicT IO SBool -> IO SatResult)
-> SymbolicT IO SBool -> IO SatResult
forall a b. (a -> b) -> a -> b
$ do SBV Q
x <- String -> Symbolic (SBV Q)
forall a. SymVal a => String -> Symbolic (SBV a)
free String
"x"
String -> [String] -> SymbolicT IO ()
forall (m :: * -> *). SolverContext m => String -> [String] -> m ()
addAxiom String
"Q" [String
"(assert (forall ((x Q) (y Q)) (= x y)))"]
SBool -> SymbolicT IO SBool
forall (m :: * -> *) a. Monad m => a -> m a
return (SBool -> SymbolicT IO SBool) -> SBool -> SymbolicT IO SBool
forall a b. (a -> b) -> a -> b
$ SBV Q -> SBV Q
f SBV Q
x SBV Q -> SBV Q -> SBool
forall a. EqSymbolic a => a -> a -> SBool
./= SBV Q
x