This is the first step toward compacting the prefix, but there are many subtleties in what definitions we keep and how we rewrite toplevels. I should have committed more.
Ill-formed code... why?