Improve handling of core definitions so that they can be inlined in top-level expressions