True
is a bad argument10
is a good argument0
average
take
fib
fib
is an uninterpreted function
Allow terminating Haskell functions into the logic!
e.g. Equivalence of Parallelization
forall xs. sum xs == psum xs
A. Farmer et al: Reasoning with the HERMIT
Can we express the above theorems 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 fib
in the logic.
fib
terminatesfib
into the logic!
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 == 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?
fib
is monotonic!
Next: Case Study: MapReduce: Program Properties that matter!