{-# OPTIONS_GHC -Wall -Werror #-}
module Documentation.SBV.Examples.Uninterpreted.Shannon where
import Data.SBV hiding (universal, existential)
type Ternary = SBool -> SBool -> SBool -> SBool
type Binary = SBool -> SBool-> SBool
pos :: (SBool -> a) -> a
pos :: (SBool -> a) -> a
pos SBool -> a
f = SBool -> a
f SBool
sTrue
neg :: (SBool -> a) -> a
neg :: (SBool -> a) -> a
neg SBool -> a
f = SBool -> a
f SBool
sFalse
shannon :: IO ThmResult
shannon :: IO ThmResult
shannon = (SBool -> SBool -> SBool -> SBool) -> IO ThmResult
forall a. Provable a => a -> IO ThmResult
prove ((SBool -> SBool -> SBool -> SBool) -> IO ThmResult)
-> (SBool -> SBool -> SBool -> SBool) -> IO ThmResult
forall a b. (a -> b) -> a -> b
$ \SBool
x SBool
y SBool
z -> SBool -> SBool -> SBool -> SBool
f SBool
x SBool
y SBool
z SBool -> SBool -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== (SBool
x SBool -> SBool -> SBool
.&& (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.|| SBool -> SBool
sNot SBool
x SBool -> SBool -> SBool
.&& (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z)
where f :: Ternary
f :: SBool -> SBool -> SBool -> SBool
f = String -> SBool -> SBool -> SBool -> SBool
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
shannon2 :: IO ThmResult
shannon2 :: IO ThmResult
shannon2 = (SBool -> SBool -> SBool -> SBool) -> IO ThmResult
forall a. Provable a => a -> IO ThmResult
prove ((SBool -> SBool -> SBool -> SBool) -> IO ThmResult)
-> (SBool -> SBool -> SBool -> SBool) -> IO ThmResult
forall a b. (a -> b) -> a -> b
$ \SBool
x SBool
y SBool
z -> SBool -> SBool -> SBool -> SBool
f SBool
x SBool
y SBool
z SBool -> SBool -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== ((SBool
x SBool -> SBool -> SBool
.|| (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z) SBool -> SBool -> SBool
.&& (SBool -> SBool
sNot SBool
x SBool -> SBool -> SBool
.|| (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z))
where f :: Ternary
f :: SBool -> SBool -> SBool -> SBool
f = String -> SBool -> SBool -> SBool -> SBool
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
derivative :: Ternary -> Binary
derivative :: (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
derivative SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.<+> (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
noWiggle :: IO ThmResult
noWiggle :: IO ThmResult
noWiggle = (SBool -> SBool -> SBool) -> IO ThmResult
forall a. Provable a => a -> IO ThmResult
prove ((SBool -> SBool -> SBool) -> IO ThmResult)
-> (SBool -> SBool -> SBool) -> IO ThmResult
forall a b. (a -> b) -> a -> b
$ \SBool
y SBool
z -> SBool -> SBool
sNot (SBool -> SBool -> SBool
f' SBool
y SBool
z) SBool -> SBool -> SBool
.<=> (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
where f :: Ternary
f :: SBool -> SBool -> SBool -> SBool
f = String -> SBool -> SBool -> SBool -> SBool
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
f' :: SBool -> SBool -> SBool
f' = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
derivative SBool -> SBool -> SBool -> SBool
f
universal :: Ternary -> Binary
universal :: (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
universal SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.&& (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
univOK :: IO ThmResult
univOK :: IO ThmResult
univOK = (SBool -> SBool -> SBool) -> IO ThmResult
forall a. Provable a => a -> IO ThmResult
prove ((SBool -> SBool -> SBool) -> IO ThmResult)
-> (SBool -> SBool -> SBool) -> IO ThmResult
forall a b. (a -> b) -> a -> b
$ \SBool
y SBool
z -> SBool -> SBool -> SBool
f' SBool
y SBool
z SBool -> SBool -> SBool
.=> (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.&& (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
where f :: Ternary
f :: SBool -> SBool -> SBool -> SBool
f = String -> SBool -> SBool -> SBool -> SBool
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
f' :: SBool -> SBool -> SBool
f' = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
universal SBool -> SBool -> SBool -> SBool
f
existential :: Ternary -> Binary
existential :: (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
existential SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.|| (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
existsOK :: IO ThmResult
existsOK :: IO ThmResult
existsOK = (SBool -> SBool -> SBool) -> IO ThmResult
forall a. Provable a => a -> IO ThmResult
prove ((SBool -> SBool -> SBool) -> IO ThmResult)
-> (SBool -> SBool -> SBool) -> IO ThmResult
forall a b. (a -> b) -> a -> b
$ \SBool
y SBool
z -> SBool -> SBool -> SBool
f' SBool
y SBool
z SBool -> SBool -> SBool
.=> (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
pos SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z SBool -> SBool -> SBool
.|| (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
forall a. (SBool -> a) -> a
neg SBool -> SBool -> SBool -> SBool
f SBool
y SBool
z
where f :: Ternary
f :: SBool -> SBool -> SBool -> SBool
f = String -> SBool -> SBool -> SBool -> SBool
forall a. Uninterpreted a => String -> a
uninterpret String
"f"
f' :: SBool -> SBool -> SBool
f' = (SBool -> SBool -> SBool -> SBool) -> SBool -> SBool -> SBool
existential SBool -> SBool -> SBool -> SBool
f