{-# LANGUAGE CPP #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeAbstractions #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -Wall -Werror #-}
module Documentation.SBV.Examples.TP.Basics where
import Prelude hiding(reverse, length, elem)
import Data.SBV
import Data.SBV.List
import Data.SBV.TP
import Control.Monad (void)
#ifdef DOCTEST
#endif
trueIsProvable :: IO (Proof SBool)
trueIsProvable :: IO (Proof SBool)
trueIsProvable = TP (Proof SBool) -> IO (Proof SBool)
forall a. TP a -> IO a
runTP (TP (Proof SBool) -> IO (Proof SBool))
-> TP (Proof SBool) -> IO (Proof SBool)
forall a b. (a -> b) -> a -> b
$ String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"true" SBool
sTrue []
falseIsn'tProvable :: IO ()
falseIsn'tProvable :: IO ()
falseIsn'tProvable = TP () -> IO ()
forall a. TP a -> IO a
runTP (TP () -> IO ()) -> TP () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
Proof SBool
_won'tGoThrough <- String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"sFalse" SBool
sFalse []
() -> TP ()
forall a. a -> TP a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
largerIntegerExists :: IO (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
largerIntegerExists :: IO (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
largerIntegerExists = TP (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
-> IO (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
forall a. TP a -> IO a
runTP (TP (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
-> IO (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool)))
-> TP (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
-> IO (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
forall a b. (a -> b) -> a -> b
$ String
-> (Forall "x" Integer -> Exists "y" Integer -> SBool)
-> [ProofObj]
-> TP (Proof (Forall "x" Integer -> Exists "y" Integer -> SBool))
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"largerIntegerExists"
(\(Forall SInteger
x) (Exists SInteger
y) -> SInteger
x SInteger -> SInteger -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.< SInteger
y)
[]
forallConjunction :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO (Proof SBool)
forallConjunction :: forall a.
SymVal a =>
(SBV a -> SBool) -> (SBV a -> SBool) -> IO (Proof SBool)
forallConjunction SBV a -> SBool
p SBV a -> SBool
q = TP (Proof SBool) -> IO (Proof SBool)
forall a. TP a -> IO a
runTP (TP (Proof SBool) -> IO (Proof SBool))
-> TP (Proof SBool) -> IO (Proof SBool)
forall a b. (a -> b) -> a -> b
$ do
let qb :: (Forall Any a -> SBool) -> SBool
qb = (Forall Any a -> SBool) -> SBool
forall a. QuantifiedBool a => a -> SBool
quantifiedBool
String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"forallConjunction"
( ((Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
p SBV a
x) SBool -> SBool -> SBool
.&& (Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
q SBV a
x))
SBool -> SBool -> SBool
.<=>
(Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
p SBV a
x SBool -> SBool -> SBool
.&& SBV a -> SBool
q SBV a
x)
)
[]
existsDisjunction :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO (Proof SBool)
existsDisjunction :: forall a.
SymVal a =>
(SBV a -> SBool) -> (SBV a -> SBool) -> IO (Proof SBool)
existsDisjunction SBV a -> SBool
p SBV a -> SBool
q = TP (Proof SBool) -> IO (Proof SBool)
forall a. TP a -> IO a
runTP (TP (Proof SBool) -> IO (Proof SBool))
-> TP (Proof SBool) -> IO (Proof SBool)
forall a b. (a -> b) -> a -> b
$ do
let qb :: (Exists Any a -> SBool) -> SBool
qb = (Exists Any a -> SBool) -> SBool
forall a. QuantifiedBool a => a -> SBool
quantifiedBool
String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"existsDisjunction"
( ((Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
p SBV a
x) SBool -> SBool -> SBool
.|| (Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
q SBV a
x))
SBool -> SBool -> SBool
.<=>
(Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
p SBV a
x SBool -> SBool -> SBool
.|| SBV a -> SBool
q SBV a
x)
)
[]
forallDisjunctionNot :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO ()
forallDisjunctionNot :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO ()
forallDisjunctionNot SBV a -> SBool
p SBV a -> SBool
q = TP () -> IO ()
forall a. TP a -> IO a
runTP (TP () -> IO ()) -> TP () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
let qb :: (Forall Any a -> SBool) -> SBool
qb = (Forall Any a -> SBool) -> SBool
forall a. QuantifiedBool a => a -> SBool
quantifiedBool
Proof SBool
_won'tGoThrough <- String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"forallConjunctionNot"
( ((Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
p SBV a
x) SBool -> SBool -> SBool
.|| (Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
q SBV a
x))
SBool -> SBool -> SBool
.<=>
(Forall Any a -> SBool) -> SBool
qb (\(Forall SBV a
x) -> SBV a -> SBool
p SBV a
x SBool -> SBool -> SBool
.|| SBV a -> SBool
q SBV a
x)
)
[]
() -> TP ()
forall a. a -> TP a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
existsConjunctionNot :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO ()
existsConjunctionNot :: forall a. SymVal a => (SBV a -> SBool) -> (SBV a -> SBool) -> IO ()
existsConjunctionNot SBV a -> SBool
p SBV a -> SBool
q = TP () -> IO ()
forall a. TP a -> IO a
runTP (TP () -> IO ()) -> TP () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
let qb :: (Exists Any a -> SBool) -> SBool
qb = (Exists Any a -> SBool) -> SBool
forall a. QuantifiedBool a => a -> SBool
quantifiedBool
Proof SBool
_wont'GoThrough <- String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"existsConjunctionNot"
( ((Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
p SBV a
x) SBool -> SBool -> SBool
.&& (Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
q SBV a
x))
SBool -> SBool -> SBool
.<=>
(Exists Any a -> SBool) -> SBool
qb (\(Exists SBV a
x) -> SBV a -> SBool
p SBV a
x SBool -> SBool -> SBool
.&& SBV a -> SBool
q SBV a
x)
)
[]
() -> TP ()
forall a. a -> TP a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()
qcExample :: TP (Proof (Forall "n" Word8 -> SBool))
qcExample :: TP (Proof (Forall "n" Word8 -> SBool))
qcExample = String
-> (Forall "n" Word8 -> SBool)
-> StepArgs (Forall "n" Word8 -> SBool) Word8
-> TP (Proof (Forall "n" Word8 -> SBool))
forall t.
(Proposition (Forall "n" Word8 -> SBool), SymVal t,
EqSymbolic (SBV t)) =>
String
-> (Forall "n" Word8 -> SBool)
-> StepArgs (Forall "n" Word8 -> SBool) t
-> TP (Proof (Forall "n" Word8 -> SBool))
forall a t.
(Calc a, Proposition a, SymVal t, EqSymbolic (SBV t)) =>
String -> a -> StepArgs a t -> TP (Proof a)
calc String
"qcExample"
(\(Forall SBV Word8
n) -> SBV Word8
n SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
+ SBV Word8
n SBV Word8 -> SBV Word8 -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== SBV Word8
2 SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
* SBV Word8
n) (StepArgs (Forall "n" Word8 -> SBool) Word8
-> TP (Proof (Forall "n" Word8 -> SBool)))
-> StepArgs (Forall "n" Word8 -> SBool) Word8
-> TP (Proof (Forall "n" Word8 -> SBool))
forall a b. (a -> b) -> a -> b
$
\SBV Word8
n -> [] [SBool]
-> TPProofRaw (SBV Word8) -> (SBool, TPProofRaw (SBV Word8))
forall a. [SBool] -> TPProofRaw a -> (SBool, TPProofRaw a)
|- SBV Word8
n SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
+ SBV Word8
n
SBV Word8 -> Helper -> Hinted (SBV Word8)
forall a b. HintsTo a b => a -> b -> Hinted a
?? Int -> Helper
qc Int
1000
TPProofRaw (SBV Word8)
-> ChainsTo (TPProofRaw (SBV Word8))
-> ChainsTo (TPProofRaw (SBV Word8))
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: SBV Word8
2 SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
* SBV Word8
n
SBV Word8 -> Helper -> Hinted (SBV Word8)
forall a b. HintsTo a b => a -> b -> Hinted a
?? Int -> Helper
qc Int
1000
TPProofRaw (SBV Word8) -> Helper -> Hinted (TPProofRaw (SBV Word8))
forall a b. HintsTo a b => a -> b -> Hinted a
?? String -> SBV Word8 -> Helper
forall a. String -> SBV a -> Helper
disp String
"val" (SBV Word8
2 SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
* SBV Word8
n)
Hinted (TPProofRaw (SBV Word8))
-> ChainsTo (Hinted (TPProofRaw (SBV Word8)))
-> ChainsTo (Hinted (TPProofRaw (SBV Word8)))
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: SBV Word8
2 SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
* SBV Word8
n SBV Word8 -> SBV Word8 -> SBV Word8
forall a. Num a => a -> a -> a
+ SBV Word8
1
SBV Word8 -> ChainsTo (SBV Word8) -> ChainsTo (SBV Word8)
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: ChainsTo (SBV Word8)
TPProofRaw (SBV Word8)
forall a. TPProofRaw a
qed
qcFermat :: Integer -> TP (Proof (Forall "x" Integer -> Forall "y" Integer -> Forall "z" Integer -> SBool))
qcFermat :: Integer
-> TP
(Proof
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool))
qcFermat Integer
e = String
-> (Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
-> StepArgs
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
Bool
-> TP
(Proof
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool))
forall t.
(Proposition
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool),
SymVal t, EqSymbolic (SBV t)) =>
String
-> (Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
-> StepArgs
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
t
-> TP
(Proof
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool))
forall a t.
(Calc a, Proposition a, SymVal t, EqSymbolic (SBV t)) =>
String -> a -> StepArgs a t -> TP (Proof a)
calc (String
"qcFermat " String -> String -> String
forall a. Semigroup a => a -> a -> a
<> Integer -> String
forall a. Show a => a -> String
show Integer
e)
(\(Forall SInteger
x) (Forall SInteger
y) (Forall SInteger
z) -> SInteger
n SInteger -> SInteger -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.> SInteger
2 SBool -> SBool -> SBool
.=> SInteger
xSInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^SInteger
n SInteger -> SInteger -> SInteger
forall a. Num a => a -> a -> a
+ SInteger
ySInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^SInteger
n SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
./= SInteger
zSInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^SInteger
n) (StepArgs
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
Bool
-> TP
(Proof
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)))
-> StepArgs
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool)
Bool
-> TP
(Proof
(Forall "x" Integer
-> Forall "y" Integer -> Forall "z" Integer -> SBool))
forall a b. (a -> b) -> a -> b
$
\SInteger
x SInteger
y SInteger
z -> [SInteger
n SInteger -> SInteger -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.> SInteger
2]
[SBool] -> TPProofRaw SBool -> (SBool, TPProofRaw SBool)
forall a. [SBool] -> TPProofRaw a -> (SBool, TPProofRaw a)
|- SInteger
x SInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^ SInteger
n SInteger -> SInteger -> SInteger
forall a. Num a => a -> a -> a
+ SInteger
y SInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^ SInteger
n SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
./= SInteger
z SInteger -> SInteger -> SInteger
forall b e. (Mergeable b, Num b, SIntegral e) => b -> SBV e -> b
.^ SInteger
n
SBool -> Helper -> Hinted SBool
forall a b. HintsTo a b => a -> b -> Hinted a
?? Int -> Helper
qc Int
1000
TPProofRaw SBool
-> ChainsTo (TPProofRaw SBool) -> ChainsTo (TPProofRaw SBool)
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: SBool
sTrue
SBool -> ChainsTo SBool -> ChainsTo SBool
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: ChainsTo SBool
TPProofRaw SBool
forall a. TPProofRaw a
qed
where n :: SInteger
n = Integer -> SInteger
forall a. SymVal a => a -> SBV a
literal Integer
e
noTerminationChecks :: IO (Proof SBool)
noTerminationChecks :: IO (Proof SBool)
noTerminationChecks = TP (Proof SBool) -> IO (Proof SBool)
forall a. TP a -> IO a
runTP (TP (Proof SBool) -> IO (Proof SBool))
-> TP (Proof SBool) -> IO (Proof SBool)
forall a b. (a -> b) -> a -> b
$ do
let f :: SInteger -> SInteger
f :: SInteger -> SInteger
f = String -> SInteger -> SInteger
forall a. SMTDefinable a => String -> a
uninterpret String
"f"
Proof (Forall "n" Integer -> SBool)
badAxiom <- String
-> (Forall "n" Integer -> SBool)
-> TP (Proof (Forall "n" Integer -> SBool))
forall a. Proposition a => String -> a -> TP (Proof a)
axiom String
"bad" (\(Forall SInteger
n) -> SInteger -> SInteger
f SInteger
n SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== SInteger
1 SInteger -> SInteger -> SInteger
forall a. Num a => a -> a -> a
+ SInteger -> SInteger
f SInteger
n)
String -> SBool -> StepArgs SBool Integer -> TP (Proof SBool)
forall t.
(Proposition SBool, SymVal t, EqSymbolic (SBV t)) =>
String -> SBool -> StepArgs SBool t -> TP (Proof SBool)
forall a t.
(Calc a, Proposition a, SymVal t, EqSymbolic (SBV t)) =>
String -> a -> StepArgs a t -> TP (Proof a)
calc String
"noTerminationImpliesFalse"
SBool
sFalse
([] [SBool] -> TPProofRaw SInteger -> (SBool, TPProofRaw SInteger)
forall a. [SBool] -> TPProofRaw a -> (SBool, TPProofRaw a)
|- SInteger -> SInteger
f SInteger
0
SInteger -> Proof Bool -> Hinted SInteger
forall a b. HintsTo a b => a -> b -> Hinted a
?? Proof (Forall "n" Integer -> SBool)
badAxiom Proof (Forall "n" Integer -> SBool)
-> IArgs (Forall "n" Integer -> SBool) -> Proof Bool
forall a. Instantiatable a => Proof a -> IArgs a -> Proof Bool
`at` forall (nm :: Symbol) a. SBV a -> Inst nm a
Inst @"n" (SInteger
0 :: SInteger)
TPProofRaw SInteger
-> ChainsTo (TPProofRaw SInteger) -> ChainsTo (TPProofRaw SInteger)
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: SInteger
1 SInteger -> SInteger -> SInteger
forall a. Num a => a -> a -> a
+ SInteger -> SInteger
f SInteger
0
SInteger -> ChainsTo SInteger -> ChainsTo SInteger
forall a. ChainStep a (ChainsTo a) => a -> ChainsTo a -> ChainsTo a
=: ChainsTo SInteger
TPProofRaw SInteger
forall a. TPProofRaw a
qed)
badRevLen :: IO ()
badRevLen :: IO ()
badRevLen = TP () -> IO ()
forall a. TP a -> IO a
runTP (TP () -> IO ()) -> TP () -> IO ()
forall a b. (a -> b) -> a -> b
$
TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ())
-> TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ()
forall a b. (a -> b) -> a -> b
$ String
-> (Forall "xs" [Integer] -> SBool)
-> [ProofObj]
-> TP (Proof (Forall "xs" [Integer] -> SBool))
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"badRevLen"
(\(Forall @"xs" (SList Integer
xs :: SList Integer)) -> SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length (SList Integer -> SList Integer
forall a. SymVal a => SList a -> SList a
reverse SList Integer
xs) SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== SBool -> SInteger -> SInteger -> SInteger
forall a. Mergeable a => SBool -> a -> a -> a
ite (SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length SList Integer
xs SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== SInteger
3) SInteger
5 (SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length SList Integer
xs))
[]
badLengthProof :: IO ()
badLengthProof :: IO ()
badLengthProof = TP () -> IO ()
forall a. TP a -> IO a
runTP (TP () -> IO ()) -> TP () -> IO ()
forall a b. (a -> b) -> a -> b
$ do
let badLength :: SList Integer -> SInteger
badLength :: SList Integer -> SInteger
badLength SList Integer
xs = SBool -> SInteger -> SInteger -> SInteger
forall a. Mergeable a => SBool -> a -> a -> a
ite (SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length SList Integer
xs SInteger -> SInteger -> SBool
forall a. OrdSymbolic a => a -> a -> SBool
.> SInteger
5 SBool -> SBool -> SBool
.&& SInteger
42 SInteger -> SList Integer -> SBool
forall a. (Eq a, SymVal a) => SBV a -> SList a -> SBool
`elem` SList Integer
xs) SInteger
42 (SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length SList Integer
xs)
TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ()
forall (f :: * -> *) a. Functor f => f a -> f ()
void (TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ())
-> TP (Proof (Forall "xs" [Integer] -> SBool)) -> TP ()
forall a b. (a -> b) -> a -> b
$ String
-> (Forall "xs" [Integer] -> SBool)
-> [ProofObj]
-> TP (Proof (Forall "xs" [Integer] -> SBool))
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"badLengthProof" (\(Forall @"xs" SList Integer
xs) -> String -> SInteger -> SInteger
forall a. SymVal a => String -> SBV a -> SBV a
observe String
"imp" (SList Integer -> SInteger
badLength SList Integer
xs) SInteger -> SInteger -> SBool
forall a. EqSymbolic a => a -> a -> SBool
.== String -> SInteger -> SInteger
forall a. SymVal a => String -> SBV a -> SBV a
observe String
"spec" (SList Integer -> SInteger
forall a. SymVal a => SList a -> SInteger
length SList Integer
xs)) []
badCaching :: TP ()
badCaching :: TP ()
badCaching = do
Proof SBool
_ <- String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"evil" SBool
sTrue []
Proof SBool
_ <- String -> SBool -> [ProofObj] -> TP (Proof SBool)
forall a.
Proposition a =>
String -> a -> [ProofObj] -> TP (Proof a)
lemma String
"evil" SBool
sFalse []
() -> TP ()
forall a. a -> TP a
forall (f :: * -> *) a. Applicative f => a -> f a
pure ()