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 条
  • [31] Type Inference in Context
    Gundry, Adam
    McBride, Conor
    McKinna, James
    MSFP 2010: PROCEEDINGS OF THE 2010 ACM SIGPLAN WORKSHOP ON MATHEMATICALLY STRUCTURED FUNCTIONAL PROGRAMMING, 2010, : 43 - 54
  • [32] Type inference for objects
    ACM Comput Surv, 2 (358):
  • [33] Complexity of Type Inference
    Tyszkiewicz, Jerzy
    FUNDAMENTA INFORMATICAE, 2010, 103 (1-4) : 289 - 301
  • [34] Visual type inference
    Erwig, M
    JOURNAL OF VISUAL LANGUAGES AND COMPUTING, 2006, 17 (02): : 161 - 186
  • [35] Type inference for MLj
    McAdam, B
    Kennedy, A
    Benton, N
    TRENDS IN FUNCTIONAL PROGRAMMING, VOL 2, 2000, : 159 - 171
  • [36] TYPE INFERENCE WITH SUBTYPES
    FUH, YC
    MISHRA, P
    THEORETICAL COMPUTER SCIENCE, 1990, 73 (02) : 155 - 175
  • [37] Explaining type inference
    Duggan, D
    Bent, F
    SCIENCE OF COMPUTER PROGRAMMING, 1996, 27 (01) : 37 - 83
  • [38] Local type inference
    Pierce, BC
    Turner, DN
    ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 2000, 22 (01): : 1 - 44
  • [39] Type inference in mathematics
    Avigad, Jeremy
    Bulletin of the European Association for Theoretical Computer Science, 2012, 106 (01): : 78 - 98
  • [40] Type Inference on Executables
    Caballero, Juan
    Lin, Zhiqiang
    ACM COMPUTING SURVEYS, 2016, 48 (04)