I want to provide proofs for parts of a Haskell program I'm writing as part of my thesis. So far however, I failed to find a good reference work.
Graham Hutton's introductory book Programming in Haskell (Google Books)—which I read while learning Haskell—touches on a few techniques for reasoning about programs such as
- equational reasoning
- using non-overlapping patterns
- list induction
in chapter 13 but it's not very in-depth.
Are there any books or article you can recommend which provide a more detailed overview of formal proving techniques for Haskell, or other functional, code?
Theorem app_assoc : ∀ l1 l2 l3 : natlist, (l1 ++ l2) ++ l3 = l1 ++ (l2 ++ l3)
from the Lists chapter. Does this example look anything like the thing you're interested in? They start with functional programming in Coq, but then move on to reasoning about the properties of functional programs. The chapters from Preface up to IndPrinciples cover both of those, and I'd say programming and reasoning are intertwined there. – Anton Trunov Sep 17 '16 at 15:34(l_1 ++ []) ++ l_3 == l_1 ++ l_3 == l_1 ++ ([] ++ l_3)
, (2) induction step, assume the theorem to be proven for a listl_2
with lengthn
then for a list(l_2 : e)
with lengthn + 1
it holds that(l_1 ++ (l_2 : e)) ++ l_3 == (l_1 ++ l_2) ++ (e : l_3) == l_1 ++ (l_2 ++ (e : l_3)) == l_1 ++ ((l_2 : e) ++ l_3)
when applying the induction hypothesis in the second to last step. QED. – FK82 Sep 18 '16 at 12:05