RE: https://mathstodon.xyz/@MartinEscardo/117520485395194585 If we want to serio...
Meven Lennon-Bertrand @mevenlennonbertrand@lipn.info
RE: https://mathstodon.xyz/@MartinEscardo/117520485395194585
If we want to seriously think about elaborator correctness (which we should) we must sort out the mess that the current situation is. Because "elaboration" as it is today mixes too many things. Probably at least 3.
The first is a morphism between two very reasonable type theories, that could be expressed at the level of GATs, to translate away features that people are/were too afraid about implementing correctly to include in their core language, and/or that we do not as of yet know how to capture well in type theory, eg complicated definitions of recursive functions.
The second is the reliable reconstruction of missing information. This cannot be expressed at the level of GATs, which only let you define "fully annotated" type theories. But @andrejbauer, Anja Petković Komel and friends had something cool to say about elaboration in this sense. Some things here we've figured out (eg, that we don't need to record domain/codomain in function application), others we still don't know how to do (eg implicit arguments, still handled by unification-based heuristics).
Third there's the part that's close to parsing, handling notations and stuff like this. Yet another very different kind of work, with a very different way to specify it.
Last (but not least?) is the dark and ugly bit, where there are a bunch of heuristics: non-mg unification, proof search (including typeclass resolution), etc. Can this be totally eliminated? If not, how should it be specified? Here maybe @jonmsterling's correct-by-construction elaboration has a role.
Claim: in my ideal proof assistant, 1 and 2 never happen when a proof is checked, as they've been done once and for all by type theorists to justify what the kernel implements.