Elaboration and erasure in type theory

ions before the occurrence determining its type annotation (cf. Sect. ..), reduced the implicit term sizes further by 0.1% and 0.2%. Additional size reductions can be achieved by the elimination of coercion functions (4%) and outermost quantifications (4%). It has to be asked whether one could find an erasure algorithm which yields much smaller representations. To answer this question we determined arguments at implicit positions which the extended bimodal erasure algorithm presented explicitly. We found that, on average, terms could only be reduced by another 1.1% through erasing blindly all those arguments while only 20% of them had enough information to be reconstructed. Erasing, in addition, all remaining type annotations from abstractions reduced the representation by another 7.6%, but none of those implicit terms could be reconstructed. We conclude that the extended bimodal erasure algorithm removes the vast majority of redundant subterms, respecting the given color information, and achieves a near optimal representation thus leaving little room for further improvements. This explains the dismal advance of variations of the extended bimodal algorithm and is consistent with the result of Necula and Lee [NL98]. Their global representation algorithm is not significantly more effective than their one-bit one, but works essentially by simulating type reconstruction to optimize the representation size. In all cases their compression ratio as well as the ratio reported by Berghofer and Nipkow [BN00] exceed 90%. These better values can be explained by the fact that our algorithm removes only arguments at positions marked by the user, and we have analyzed type inference in a higher-order setting, while both reported on type checking for essentially first-order proofs. Figure . shows the elaboration time of term representations calculated by the different erasure algorithms, relative to the number of AST nodes of the corresponding explicit representation. The dotted line corresponds to the absolute effort of elaboration, which is practically equal for all implicit representations. It shows the elaboration time relative to the implicit term sizes. Only the fully explicit representations calculated by the trivial erasure algorithm can be elaborated (by a constant factor) faster, because elaboration reduces to type inference and does not depend on unification or instantiation. One interesting observation concerns the linearity of the elaboration time over the term size for all term representations, because type inference