Copyright | (c) Levent Erkok |
---|---|
License | BSD3 |
Maintainer | erkokl@gmail.com |
Stability | experimental |
Safe Haskell | None |
Language | Haskell2010 |
Proof that reversing a list does not change its length.
Documentation
Use an uninterpreted type for the elements
Instances
length xs == length (reverse xs)
We have:
>>>
revLen
Lemma: revLen Q.E.D. [Proven] revLen
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]