[ feature ] rewind, factor => minimise

* `rewind` will undo as much as possible the unwiding of the cycle.
  let's call `xs` the list `3 : 1 : rec X. 2 : 1 : 2 : 1 : X`, then
  `rewind xs` reduces to `3 : rec X. 1 : 2 : 1 : 2 : X`.

* `factor` detects repetitions in the cycle of a function and factors
  them out. `factor xs` will output `3 : 1 : rec X. 2 : 1 : X`.

* `minimise` combines both of these functions in order to minimise
  the size of the representation of `xs`. ̀minimise xs` will output
  `3 : rec X. 1 : 2 : X`