Scala: simplify the parts of the rational