most of the way, going to have to do stuff with leibnizes

Signed-off-by: Michael Donaghy <md401@srcf.ucam.org>