Question on rewriting and program specification