Functional Languages Home work 5

Due Tuesday, February 9, 2010, uploaded to Blackboard.

In this homework we ask you to prove a few things using equational reasoning and induction, and to use the HUnit and QuickCheck tesing frameworks.

1) Prove the following property: map f x ++ map f y = map f (x ++ y). Use the following steps:

  1. Take a look at the notes about proving things by induction.
  2. List all the definitions and equations you use.
  3. Label each with a name
  4. Set up the structure of the proof
  5. label each step with the label of the definition or equation that justifes it.

2) Pick an example from the Laws Worksheet we looked at on Tuesday February 2, and prove it by induction (Be sure you don't choose one discussed in the notes on induction). If it requires a helper lemma, prove the helper lemma as well.

3) Using the same example from the Laws Worksheet construct a program that uses QuickCheck to randomly test that law.

4) Go back to Homework 3.

5) Put all this in one file that is an executable Haskell program, This means the proofs will have to be in comments.