A Trustworthy Mechanized Formalization of R

被引:5
作者
Bodin, Martin [1 ,2 ]
Diaz, Tomas [3 ,4 ]
Tanter, Eric [3 ,4 ]
机构
[1] Univ Chile, Ctr Math Modeling, Santiago, Chile
[2] Univ Chile, Comp Sci Dept, Santiago, Chile
[3] Univ Chile, Comp Sci Dept, Pleiad Lab, Santiago, Chile
[4] Univ Chile, Comp Sci Dept, IMFD Chile, Santiago, Chile
来源
DLS'18: PROCEEDINGS OF THE 14TH ACM SIGPLAN INTERNATIONAL SYMPOSIUM ON DYNAMIC LANGUAGES | 2018年
关键词
R; Coq; Testing infrastructure;
D O I
10.1145/3276945.3276946
中图分类号
TP31 [计算机软件];
学科分类号
081202 ; 0835 ;
摘要
The R programming language is very popular for developing statistical software and data analysis, thanks to rich libraries, concise and expressive syntax, and support for interactive programming. Yet, the semantics of R is fairly complex, contains many subtle corner cases, and is not formally specified. This makes it difficult to reason about R programs. In this work, we develop a big-step operational semantics for R in the form of an interpreter written in the Coq proof assistant. We ensure the trustworthiness of the formalization by introducing a monadic encoding that allows the Coq interpreter, CoqR, to be in direct visual correspondence with the reference R interpreter, GNU R. Additionally, we provide a testing framework that supports systematic comparison of CoqR and GNU R. In its current state, CoqR covers the nucleus of the R language as well as numerous additional features, making it pass a significant number of realistic test cases from the GNU R and FastR projects. To exercise the formal specification, we prove in Coq the preservation of memory invariants in selected parts of the interpreter. This work is an important first step towards a robust environment for formal verification of R programs.
引用
收藏
页码:13 / 24
页数:12
相关论文
共 36 条
[31]  
The Coq development team, 1984, COQ PROOF ASS
[32]  
Tierney Luke, 2017, R DEVEL
[33]  
Tsegelskyi Roman, 2014, R US C USER
[34]  
Wadler Philip, 1992, MATH STRUCTURES COMP
[35]  
Wuerthinger Thomas, 2012, TRUFFLE SELF OPTIMIZ
[36]   Finding and Understanding Bugs in C Compilers [J].
Yang, Xuejun ;
Chen, Yang ;
Eide, Eric ;
Regehr, John .
ACM SIGPLAN NOTICES, 2011, 46 (06) :283-294