Logical Types for Untyped Languages

被引:0
|
作者
Tobin-Hochstadt, Sam [1 ]
Felleisen, Matthias [1 ]
机构
[1] Northeastern Univ, Boston, MA 02115 USA
关键词
Type systems; Untyped languages; Logic;
D O I
暂无
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Programmers reason about their programs using a wide variety of formal and informal methods. Programmers in untyped languages such as Scheme or Erlang are able to use any such method to reason about the type behavior of their programs. Our type system for Scheme accommodates common reasoning methods by assigning variable occurrences a subtype of their declared type based on the predicates prior to the occurrence, a discipline dubbed occurrence typing. It thus enables programmers to enrich existing Scheme code with types, while requiring few changes to the code itself. Three years of practical experience has revealed serious shortcomings of our type system. In particular, it relied on a system of ad-hoc rules to relate combinations of predicates, it could not reason about subcomponents of data structures, and it could not follow sophisticated reasoning about the relationship among predicate tests, all of which are used in existing code. In this paper, we reformulate occurrence typing to eliminate these shortcomings. The new formulation derives propositional logic formulas that hold when an expression evaluates to true or false, respectively. A simple proof system is then used to determine types of variable occurrences from these propositions. Our implementation of this revised occurrence type system thus copes with many more untyped programming idioms than the original system.
引用
收藏
页码:117 / 128
页数:12
相关论文
共 50 条
  • [41] Logical mobility and locality types
    Moody, J
    LOGIC BASED PROGRAM SYNTHESIS AND TRANSFORMATION, 2005, 3573 : 69 - 84
  • [42] Toulmin’s Logical Types
    David Botting
    Argumentation, 2017, 31 : 433 - 449
  • [43] LANGUAGE TYPES AND LOGICAL THEOREMS
    HAMBLIN, CL
    INFORMATION AND CONTROL, 1973, 22 (02): : 183 - 187
  • [44] THE INTEGRATION OF LOGICAL AND ALGEBRAIC TYPES
    GRAY, JW
    LECTURE NOTES IN COMPUTER SCIENCE, 1989, 393 : 16 - 35
  • [45] Logical relations for monadic types
    Goubault-Larrecq, Jean
    Lasota, Slawomir
    Nowak, David
    MATHEMATICAL STRUCTURES IN COMPUTER SCIENCE, 2008, 18 (06) : 1169 - 1217
  • [46] ORDERS AND TYPES OF LANGUAGES
    BOASSON, L
    NIVAT, M
    COMPTES RENDUS HEBDOMADAIRES DES SEANCES DE L ACADEMIE DES SCIENCES SERIE A, 1977, 284 (11): : 625 - 628
  • [47] ORDERS AND TYPES OF LANGUAGES
    BOASSON, L
    NIVAT, M
    COMPTES RENDUS HEBDOMADAIRES DES SEANCES DE L ACADEMIE DES SCIENCES SERIE A, 1977, 284 (12): : 703 - 705
  • [48] ORDERS AND TYPES OF LANGUAGES
    BOASSON, L
    NIVAT, M
    COMPTES RENDUS HEBDOMADAIRES DES SEANCES DE L ACADEMIE DES SCIENCES SERIE A, 1977, 284 (10): : 559 - 562
  • [49] Logical relations for monadic types
    Goubault-Larrecq, J
    Lasota, S
    Nowak, D
    COMPUTER SCIENCE LOGIC, PROCEEDINGS, 2002, 2471 : 553 - 568
  • [50] Reversible Regular Languages: Logical and Algebraic Characterisations
    Gastin, Paul
    Manuel, Amaldev
    Govind, R.
    FUNDAMENTA INFORMATICAE, 2021, 180 (04) : 333 - 350