Abstract
AbstractThere has been much progress in designing bidirectional type systems and associated type synthesis algorithms, but mainly on a case-by-case basis. To remedy the situation, this paper develops a general and formal theory of bidirectional typing for simply typed languages: for every signature that specifies a mode-correct bidirectionally typed language, there exists a proof-relevant type synthesiser which, given an input abstract syntax tree, constructs a typing derivation if any, gives its refutation if not, or reports that the input does not have enough type annotations. Sufficient conditions for deriving a type synthesiser such as soundness, completeness, and mode-correctness are studied universally for all signatures. We propose a preprocessing step called mode decoration, which helps the user to deal with missing type annotations. The entire theory is formally implemented in Agda, so we provide a verified generator of proof-relevant type synthesisers as a by-product of our formalism.
Publisher
Springer Nature Switzerland
Reference32 articles.
1. Aczel, P.: A general Church–Rosser theorem (1978),http://www.ens-lyon.fr/LIP/REWRITING/MISC/AGeneralChurch-RosserTheorem.pdf
2. Ahrens, B., Matthes, R., Mörtberg, A.: Implementing a category-theoretic
3. Allais, G., Atkey, R., Chapman, J., McBride, C., McKinna, J.: A type- andscope-safe universe of syntaxes with binding: their semantics and proofs.Journal of Functional Programming 31, e22:1–55 (2021),https://doi.org/10.1017/S0956796820000076
4. Arkor, N., Fiore, M.: Algebraic models of simple type theories: a polynomialapproach. In: Symposium on Logic in Computer Science (LICS), pp. 88–101, ACM(2020), https://doi.org/10.1145/3373718.3394771
5. Assaf, A., Burel, G., Cauderlier, R., Delahaye, D., Dowek, G., Dubois, C.,