Rewrite measure logic