We have had six lectures so far. And in those lectures, we have invented data Nu...

@pigworker@types.pl

We have had six lectures so far. And in those lectures, we have invented

data Number = Z | S Number

we have defined + and *, and we have proven that * over + gives a rig.

(Of course, we have also introduced the very notions of "monoid" and "rig".)

Meanwhile, we have also invented

data Formula = X | N Formula | Formula :+: Formula | Formula :*: Formula

and we have implemented

evaluate :: Formula -> Number -> Number
... evaluate X x = x

A key homework was to define substitution for X in a Formula, prove that that gives a monoid with neutral element X, and then prove that evaluate is a monoid map from substitution to composition.