Type Inference Logics

被引:0
|
作者
Carnier, Denis [1 ]
Pottier, Francois [2 ]
Keuchel, Steven [3 ]
机构
[1] Katholieke Univ Leuven, Leuven, Belgium
[2] Inria, Paris, France
[3] Vrije Univ Brussel, Brussels, Belgium
来源
PROCEEDINGS OF THE ACM ON PROGRAMMING LANGUAGES-PACMPL | 2024年 / 8卷 / OOPSLA2期
基金
欧洲研究理事会;
关键词
program verification; type inference; elaboration; UNIFICATION; PROGRAMS;
D O I
10.1145/3689786
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Type inference is essential for statically-typed languages such as OCaml and Haskell. It can be decomposed into two (possibly interleaved) phases: a generator converts programs to constraints; a solver decides whether a constraint is satisfiable. Elaboration, the task of decorating a program with explicit type annotations, can also be structured in this way. Unfortunately, most machine-checked implementations of type inference do not follow this phase-separated, constraint-based approach. Those that do are rarely executable, lack effectful abstractions, and do not include elaboration. To close the gap between common practice in real-world implementations and mechanizations inside proof assistants, we propose an approach that enables modular reasoning about monadic constraint generation in the presence of elaboration. Our approach includes a domain-specific base logic for reasoning about metavariables and a program logic that allows us to reason abstractly about the meaning of constraints. To evaluate it, we report on a machine-checked implementation of our techniques inside the COQ proof assistant. As a case study, we verify both soundness and completeness for three elaborating type inferencers for the simply typed lambda-calculus with Booleans. Our results are the first demonstration that type inference algorithms can be verified in the same form as they are implemented in practice: in an imperative style, modularly decomposed into constraint generation and solving, and delivering elaborated terms to the remainder of the compiler chain.
引用
收藏
页数:31
相关论文
共 50 条
  • [21] Inference Rules in Nelson's Logics, Admissibility and Weak Admissibility
    Odintsov, Sergei
    Rybakov, Vladimir
    LOGICA UNIVERSALIS, 2015, 9 (01) : 93 - 120
  • [22] TYPE INFERENCE AND TYPE CONTAINMENT
    MITCHELL, J
    LECTURE NOTES IN COMPUTER SCIENCE, 1984, 173 : 257 - 277
  • [23] Preservation of admissibility of inference rules in the logics similar to S4.2
    Rybakov, VV
    Rimatskii, VV
    SIBERIAN MATHEMATICAL JOURNAL, 2002, 43 (02) : 357 - 362
  • [24] Preservation of Admissibility of Inference Rules in the Logics Similar to S4.2
    V. V. Rybakov
    V. V. Rimatskii
    Siberian Mathematical Journal, 2002, 43 : 357 - 362
  • [25] Taming Displayed Tense Logics Using Nested Sequents with Deep Inference
    Gore, Rajeev
    Postniece, Linda
    Tin, Alwen
    AUTOMATED REASONING WITH ANALYTIC TABLEAUX AND RELATED METHODS, PROCEEDINGS, 2009, 5607 : 189 - 204
  • [26] Modal logics preserving admissible for S4 inference rules
    Rybakov, VV
    COMPUTER SCIENCE LOGIC, 1995, 933 : 512 - 526
  • [27] Combining Logics in Simple Type Theory
    Benzmueller, Christoph
    COMPUTATIONAL LOGIC IN MULTI-AGENT SYSTEMS, 2010, 6245 : 33 - 48
  • [28] Modalities in constructive logics and type theories
    de Paiva, V
    Goré, R
    Mendler, M
    JOURNAL OF LOGIC AND COMPUTATION, 2004, 14 (04) : 439 - 446
  • [29] A Type Theory for Defining Logics and Proofs
    Pientka, Brigitte
    Thibodeau, David
    Abel, Andreas
    Ferreira, Francisco
    Zucchini, Rebecca
    2019 34TH ANNUAL ACM/IEEE SYMPOSIUM ON LOGIC IN COMPUTER SCIENCE (LICS), 2019,
  • [30] TYPE INFERENCE IN MATHEMATICS
    Gurevich, Yuri
    Avigad, Jeremy
    BULLETIN OF THE EUROPEAN ASSOCIATION FOR THEORETICAL COMPUTER SCIENCE, 2012, (106): : 78 - 98