Rating Disambiguation Errors ⋆ Andrea Asperti and Wilmer Ricciotti Department of Computer Science, University of Bologna {asperti,ricciott}@cs.unibo.it Abstract. Ambiguous notation is a powerful tool developed to deal with the complexity of mathematics without sacrificing clarity or conciseness. In the mechanized parsing of ambiguous terms, a disambiguation algo- rithm can be used to provide the system with the intelligence necessary to select valid interpretations for the overloaded symbols received in input. Disambiguation works by means of an incremental analysis of the in- put term, progressively discarding all invalid interpretations. As a result, if the input term cannot be disambiguated, many errors will be produced, only a handful of which are truly meaningful to the user. In this paper, we improve the existing technique to classify disam- biguation errors by introducing a new heuristic to sort errors from the most meaningful to the least, showing that it can be implemented in a natural way in the existing disambiguation algorithm. We also describe a neat interface to present disambiguation errors to the user, suitable for the use in interactive theorem proving applications. 1 Introduction One of the most notable features of mathematical notation is ambiguity: for instance, it is possible to overload operators, as long as the intended interpre- tation of a given formula can be inferred from its context. On the other hand, results to be stored in formal libraries of interactive provers [13], need to be in an unambiguous form. Ambiguous notation serves an important purpose, hiding redundant informa- tion and providing a standardized lexicon through which mathematicians can communicate more easily. It is therefore important that tools for mechanized mathematics be able to bridge the gap between mathematical notation and the unambiguous formalism used by the system. Hence, all interactive theorem provers address the issue of ambiguous notation in some way. Some provers try to resolve the ambiguity at parsing time by means of a deterministic system of in- terpretation scopes (an approach used in Coq). A more sophisticated technique popularized by the Haskell programming language and extended to theorem proving first in Isabelle, then in Coq and Matita, is that of type classes [12]; in this case every notation is associated unambiguously to a certain type class and ⋆ The project CerCo acknowledges the financial support of the Future and Emerg- ing Technologies (FET) programme within the Seventh Framework Programme for Research of the European Commission, under FET-Open grant number: 243881. C. Hawblitzel and D. Miller (Eds.): CPP 2012, LNCS 7679, pp. 240–255, 2012. c Springer-Verlag Berlin Heidelberg 2012