A Systematic Derivation of the STG Machine Verified in Coq

被引:5
作者
Pirog, Maciej [1 ]
Biernacki, Dariusz [1 ]
机构
[1] Univ Wroclaw, Inst Comp Sci, PL-51151 Wroclaw, Poland
关键词
Languages; Theory; Verification; STG; natural semantics; abstract machine; derivation; verification; Coq;
D O I
10.1145/2088456.1863528
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
Shared Term Graph (STG) is a lazy functional language used as an intermediate language in the Glasgow Haskell Compiler (GHC). In this article, we present a natural operational semantics for STG and we mechanically derive a lazy abstract machine from this semantics, which turns out to coincide with Peyton-Jones and Salkild's Spineless Tag less G-machine (STG machine) used in GHC. Unlike other constructions of STG-like machines present in the literature, ours is based on a systematic and scalable derivation method (inspired by Danvy et al.'s functional correspondence between evaluators and abstract machines) and it leads to an abstract machine that differs from the original STG machine only in inessential details. In particular, it handles non-trivial update scenarios and partial applications identically as the STG machine. The entire derivation has been formalized in the Coq proof assistant. Thus, in effect, we provide a machine checkable proof of the correctness of the STG machine with respect to the natural semantics.
引用
收藏
页码:25 / 36
页数:12
相关论文
共 14 条
[1]  
Ager ABDM03 Mads Sig, 2003, P 5 ACM SIGPLAN INT, P8, DOI DOI 10.1145/888251.888254
[2]   A functional correspondence between call-by-need evaluators and lazy abstract machines [J].
Ager, MS ;
Danvy, O ;
Midtgaard, J .
INFORMATION PROCESSING LETTERS, 2004, 90 (05) :223-232
[3]  
Danvy, 2001, Proceedings of the 3rd ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming, P162, DOI DOI 10.1145/773184.773202
[4]  
de la Encina A., 2003, P 5 INT ACM SIGPLAN, P102
[5]   From natural semantics to C: A formal derivation of two STG machines [J].
De La Encina, Alberto ;
Pena, Ricardo .
JOURNAL OF FUNCTIONAL PROGRAMMING, 2009, 19 :47-94
[6]  
DELAENCINA A, 2003, LECT NOTES COMPUTER, V2670, P88
[7]  
Jones Simon L. Peyton, 1989, P 4 INT C FUNCTIONAL, P184
[8]  
Launchbury John., 1993, Proceedings of the 20th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. POPL'93. New York, NY, P144, DOI DOI 10.1145/158511.158618
[9]  
MILLER D, 2003, P 5 ACM SIGPLAN INT
[10]  
MOUNTJOY J, 1998, P 1998 ACM SIGPLAN I, V34, P163