Added derivation of gen impl midpoint rule