Defined auxiliary functions for Motion.isLegal.