Mathematical Logic and Programming Languages Exercise #2

This is the second exercise. It is due before class on Monday October 6, 2014 (1:45 PM). You must submit your solution to D2L. It will not be graded, but it I will check that it is submitted and I will glance over it. Be prepared to discuss what you have done. We will spend considerable time discussing this in class on Monday. You may be called upon to elaborate your submission.

In this exercise you will implement an algorithm for simplifying propositional logic formulas represented by the Haskell datatype (Prop n). Import the file SimpleProp.hs to get these definitions.

The goal is to write a single function simplify:: Prop n -> Prop n which applies equivalences to its input to produce its output. The object is to return the smallest answer that is equivalent to the input. You are free to use any strategy you want. But it should always be the case that for all boolean assignments env: eval env x == eval env (simplify x).

I have suggested a few strategies you might try. I do not know the best way to do this, so I am interested in what students come up with.

Put all these functions into a file called Ex2.hs, test your functions using QuickCheck or SmallCheck and submit it to D2L.