True
is a bad argument10
is a good argument0
average
take
fib
fib
is an uninterpreted function
Allow terminating Haskell functions into the logic!
A. Farmer et al: Reasoning with the HERMIT
Can we express them in Liquid Haskell?
Liquid Types express theorems, and
Haskell functions express proofs.
ProofCombinators
comes with Liquid Haskell and allows for pretty proofs!
ProofCombinators
comes with Liquid Haskell and allows for pretty proofs!
ProofCombinators
comes with Liquid Haskell and allows for pretty proofs!
Can we express them in Liquid Haskell?
Reflect terminating fib
in the logic.
Now fib
can live in the Liquid Types!
fib
is an uninterpreted function
For which logic only knows the congruence axiom...
... and nothing else
The type of fib
connects logic & Haskell implementation
fib :: i:Nat -> {v:Nat | v == fib i && v == propFib i}
propFib i = if i == 0 then 0 else
if i == 1 then 1 else
fib (i-1) + fib (i-2)
Calling fib i
reveals its implementation into the logic!
Q: Can you prove that fib 2 == 1
?
Using combinators from ProofCombinators
!
Using combinators from ProofCombinators
!
fib
is increasing
fib
is monotonic!
Next: Case study: MapReduce: Program Properties that matter!