sbv-11.0: 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.KnuckleDragger.RevLen

Description

Proof that reversing a list does not change its length.

Synopsis

Documentation

data Elt Source #

Use an uninterpreted type for the elements

Instances

Instances details
Data Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

Methods

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

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

toConstr :: Elt -> Constr #

dataTypeOf :: Elt -> DataType #

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

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

gmapT :: (forall b. Data b => b -> b) -> Elt -> Elt #

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

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

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

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

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

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

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

Read Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

Show Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

Methods

showsPrec :: Int -> Elt -> ShowS #

show :: Elt -> String #

showList :: [Elt] -> ShowS #

SymVal Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

HasKind Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

SatModel Elt Source # 
Instance details

Defined in Documentation.SBV.Examples.KnuckleDragger.RevLen

Methods

parseCVs :: [CV] -> Maybe (Elt, [CV]) Source #

cvtModel :: (Elt -> Maybe b) -> Maybe (Elt, [CV]) -> Maybe (b, [CV]) Source #

type SElt = SBV Elt Source #

Symbolic version of the type Elt.

revLen :: IO Proof Source #

length xs == length (reverse xs)

We have:

>>> revLen
Lemma: revLen                           Q.E.D.
[Proven] revLen

badRevLen :: IO () Source #

An example where we attempt to prove a non-theorem. Notice the counter-example generated for:

length xs = ite (length xs .== 3) 5 (length xs)

We have:

>>> badRevLen `catch` (\(_ :: SomeException) -> pure ())
Lemma: badRevLen
*** Failed to prove badRevLen.
Falsifiable. Counter-example:
  xs = [Elt_1,Elt_2,Elt_1] :: [Elt]