Total re-write. Supports re-association of associative operators to
group by invariance status when possible