Reimplement DegreesOfFreedom using Pair; introduce RelativeDegreesOfFreedom.