Modify Transformation interface

This changes the Transformation interface from simply requiring
``expand`` to requiring ``encode`` and ``decode``, where the latter are
inverses and ``decode`` performs the same role as ``expand``.