Functional Languages Home work 5
Due Monday November 2, 2015, uploaded to Blackboard.
- Include your name at the top of the file as a comment. -- Name of programmer:
- Include an email where you want comments sent. -- Email to send comments to:
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:
- Take a look at the notes about proving things by induction.
- List all the definitions and equations you use.
- Label each with a name
- Set up the structure of the proof
- 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.
- Add HUnit testing assertions that create at least 10 tests for either
the "add" or "mul" function, and could be used as
a regression testing suite. Make sure your program passes all your tests. Document
this and turn this in.
- Modify your program so it uses another algorithm to compute "add" or "mul", Validate
that it still passes all the unit tests.
5) Put all this in one file that is an executable Haskell program, This means the proofs
will have to be in comments.
Back to the Daily Record.
Back to the class web-page.