sbv-8.7: SMT Based Verification: Symbolic Haskell theorem prover using SMT solving.
Copyright(c) Levent Erkok
LicenseBSD3
Maintainererkokl@gmail.com
Stabilityexperimental
Safe HaskellNone
LanguageHaskell2010

Documentation.SBV.Examples.Uninterpreted.Deduce

Description

Demonstrates uninterpreted sorts and how they can be used for deduction. This example is inspired by the discussion at http://stackoverflow.com/questions/10635783/using-axioms-for-deductions-in-z3, essentially showing how to show the required deduction using SBV.

Synopsis

Representing uninterpreted booleans

newtype B Source #

The uninterpreted sort B, corresponding to the carrier. To prevent SBV from translating it to an enumerated type, we simply attach an unused field

Constructors

B () 

Instances

Instances details
Eq B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

(==) :: B -> B -> Bool

(/=) :: B -> B -> Bool

Data B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> B -> c B

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c B

toConstr :: B -> Constr

dataTypeOf :: B -> DataType

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c B)

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c B)

gmapT :: (forall b. Data b => b -> b) -> B -> B

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> B -> r

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> B -> r

gmapQ :: (forall d. Data d => d -> u) -> B -> [u]

gmapQi :: Int -> (forall d. Data d => d -> u) -> B -> u

gmapM :: Monad m => (forall d. Data d => d -> m d) -> B -> m B

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> B -> m B

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> B -> m B

Ord B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

compare :: B -> B -> Ordering

(<) :: B -> B -> Bool

(<=) :: B -> B -> Bool

(>) :: B -> B -> Bool

(>=) :: B -> B -> Bool

max :: B -> B -> B

min :: B -> B -> B

Read B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

readsPrec :: Int -> ReadS B

readList :: ReadS [B]

readPrec :: ReadPrec B

readListPrec :: ReadPrec [B]

Show B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

showsPrec :: Int -> B -> ShowS

show :: B -> String

showList :: [B] -> ShowS

HasKind B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

kindOf :: B -> Kind Source #

hasSign :: B -> Bool Source #

intSizeOf :: B -> Int Source #

isBoolean :: B -> Bool Source #

isBounded :: B -> Bool Source #

isReal :: B -> Bool Source #

isFloat :: B -> Bool Source #

isDouble :: B -> Bool Source #

isUnbounded :: B -> Bool Source #

isUninterpreted :: B -> Bool Source #

isChar :: B -> Bool Source #

isString :: B -> Bool Source #

isList :: B -> Bool Source #

isSet :: B -> Bool Source #

isTuple :: B -> Bool Source #

isMaybe :: B -> Bool Source #

isEither :: B -> Bool Source #

showType :: B -> String Source #

SymVal B Source # 
Instance details

Defined in Documentation.SBV.Examples.Uninterpreted.Deduce

Methods

mkSymVal :: MonadSymbolic m => Maybe Quantifier -> Maybe String -> m (SBV B) Source #

literal :: B -> SBV B Source #

fromCV :: CV -> B Source #

isConcretely :: SBV B -> (B -> Bool) -> Bool Source #

forall :: MonadSymbolic m => String -> m (SBV B) Source #

forall_ :: MonadSymbolic m => m (SBV B) Source #

mkForallVars :: MonadSymbolic m => Int -> m [SBV B] Source #

exists :: MonadSymbolic m => String -> m (SBV B) Source #

exists_ :: MonadSymbolic m => m (SBV B) Source #

mkExistVars :: MonadSymbolic m => Int -> m [SBV B] Source #

free :: MonadSymbolic m => String -> m (SBV B) Source #

free_ :: MonadSymbolic m => m (SBV B) Source #

mkFreeVars :: MonadSymbolic m => Int -> m [SBV B] Source #

symbolic :: MonadSymbolic m => String -> m (SBV B) Source #

symbolics :: MonadSymbolic m => [String] -> m [SBV B] Source #

unliteral :: SBV B -> Maybe B Source #

isConcrete :: SBV B -> Bool Source #

isSymbolic :: SBV B -> Bool Source #

type SB = SBV B Source #

Handy shortcut for the type of symbolic values over B

Uninterpreted connectives over B

and :: SB -> SB -> SB Source #

Uninterpreted logical connective and

or :: SB -> SB -> SB Source #

Uninterpreted logical connective or

not :: SB -> SB Source #

Uninterpreted logical connective not

Axioms of the logical system

ax1 :: [String] Source #

Distributivity of OR over AND, as an axiom in terms of the uninterpreted functions we have introduced. Note how variables range over the uninterpreted sort B.

ax2 :: [String] Source #

One of De Morgan's laws, again as an axiom in terms of our uninterpeted logical connectives.

ax3 :: [String] Source #

Double negation axiom, similar to the above.

Demonstrated deduction

test :: IO ThmResult Source #

Proves the equivalence NOT (p OR (q AND r)) == (NOT p AND NOT q) OR (NOT p AND NOT r), following from the axioms we have specified above. We have:

>>> test
Q.E.D.