A Preliminary Type- and Control-Flow Analysis for System Fω

被引:0
作者
Wu, Dongyu [1 ]
Fluet, Matthew [1 ]
机构
[1] Rochester Inst Technol, Rochester, NY 14623 USA
来源
TRENDS IN FUNCTIONAL PROGRAMMING, TFP 2024 | 2025年 / 14843卷
关键词
Control-flow analysis; Type-flow analysis; System F-omega; CONSTRAINT;
D O I
10.1007/978-3-031-74558-4_8
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
A type- and control-flow analysis is a program analysis that yields both type-flow information, approximating the types that may instantiate type variables, and control-flow information, approximating the values (especially lambda- and Lambda-expressions) that may be bound to variables. Moreover, each of the flows informs the other; control-flow establishes the types that may instantiate Lambda-bound type variables by determining the Lambda-expressions that flow to a type-application expression, while type-flow filters control-flow by rejecting the flow of values having static types that are incompatible (according to the type-flow information) with the static type of the receiving variable. In previous work [1,13,14], we introduced a (monovariant) type- and control-flow analysis for System F (with recursion). While System F has an expressive type system and has served as a useful core calculus in which to express interesting language features, it only allows abstraction over types and does not allow abstraction over type constructors. Increasingly, researchers are looking at System F-omega, with both term- and type-level abstraction over types of arbitrary kind, as a core calculus in which to explore advanced language features. Hence, we are motivated to define a type- and control-flow analysis for System F-omega that is able to analyze the rich structure of System F-omega types. In this work, we present a preliminary type- and control-flow analysis for System F-omega (with recursion). As in previous work, we give both a specification-based formulation of the analysis, used to prove soundness of the analysis, and a flow-graph-based formulation, used to guide the implementation of an algorithm. While the macro structure of the development for System F-omega follows that for System F, moving to System F-omega introduces subtle challenges that have left some unanswered questions about the meta-theory. In particular, the decidability of type compatibility defined in terms of System F-omega's definitional type equivalence remains an open question. In order to be computable, our flow-graph-based formulation uses a restricted form of definitional type equivalence and performs a 0CFA at the type-level, yielding an analysis result that is less precise than the "best" (but as of yet, uncomputable) analysis result accepted by the specification-based formulation. Our soundness results have been formalized in the Coq proof assistant. This work is based in part on the first author's MS thesis [53].
引用
收藏
页码:160 / 194
页数:35
相关论文
共 53 条
  • [1] AIKEN A, 1991, LECT NOTES COMPUT SC, V523, P427
  • [2] A practical and flexible flow analysis for higher-order languages
    Ashley, JM
    Dybvig, RK
    [J]. ACM TRANSACTIONS ON PROGRAMMING LANGUAGES AND SYSTEMS, 1998, 20 (04): : 845 - 868
  • [3] Practical and Effective Higher-Order Optimizations
    Bergstrom, Lars
    Fluet, Matthew
    Le, Matthew
    Reppy, John
    Sandler, Nora
    [J]. ICFP'14: PROCEEDINGS OF THE 2014 ACM SIGPLAN INTERNATIONAL CONFERENCE ON FUNCTIONAL PROGRAMMING, 2014, : 81 - 93
  • [4] BRUIJN NGD, 1972, P K NED AKAD A MATH, V75, P381
  • [5] System F-omega with Equirecursive Types for Datatype-Generic Programming
    Cai, Yufei
    Giarrusso, Paolo G.
    Ostermann, Klaus
    [J]. ACM SIGPLAN NOTICES, 2016, 51 (01) : 30 - 43
  • [6] Cejtin H, 2000, LECT NOTES COMPUT SC, V1782, P56
  • [7] Type- and Control-Flow Directed Defunctionalization
    Contractor, Maheen Riaz
    Fluet, Matthew
    [J]. PROCEEDINGS OF THE 32ND SYMPOSIUM ON IMPLEMENTATION AND APPLICATION OF FUNCTIONAL LANGUAGES, IFL 2020, 2020, : 79 - 92
  • [8] Coq Development Team, 2024, **DATA OBJECT**, DOI [10.5281/ZENODO.11551307, 10.5281/zenodo.11551307]
  • [9] Coq-std++ Team, 2024, Coq-std++: an extended "standard library" for Coq
  • [10] Cousot P, 1995, LECT NOTES COMPUT SC, V939, P293