added a Formula module, to deal cleanly with formulas.
Conversion between formulas and terms is possible.