A Typed C11 Semantics for Interactive Theorem Proving

被引:17
作者
Krebbers, Robbert [1 ]
Wiedijk, Freek [1 ]
机构
[1] Radboud Univ Nijmegen, ICIS, Nijmegen, Netherlands
来源
CPP'15: PROCEEDINGS OF THE 2015 ACM CONFERENCE ON CERTIFIED PROGRAMS AND PROOFS | 2015年
关键词
ISO C11 Standard; Operational Semantics; Executable Semantics; Interactive Theorem Proving; Coq;
D O I
10.1145/2676724.2693571
中图分类号
TP301 [理论、方法];
学科分类号
081202 ;
摘要
We present a semantics of a significant fragment of the C programming language as described by the C11 standard. It consists of a small step semantics of a core language, which uses a structured memory model to capture subtleties of C11, such as strict-aliasing restrictions related to unions, that have not yet been addressed by others. The semantics of actual C programs is defined by translation into this core language. We have an explicit type system for the core language, and prove type preservation and progress, as well as type correctness of the translation. Due to unspecified order of evaluation, our operational semantics is non-deterministic. To explore all defined and undefined behaviors, we present an executable semantics that computes a stream of finite sets of reachable states. It is proved sound and complete with respect to the operational semantics. Both the translation into the core language and the executable semantics are defined as Coq programs. Extraction to OCaml is used to obtain a C interpreter to run and test the semantics on actual C programs. All proofs are fully formalized in Coq.
引用
收藏
页码:15 / 27
页数:13
相关论文
共 31 条
[1]  
[Anonymous], GNU COMP COLL
[2]  
[Anonymous], 2012, RR7987 INRIA
[3]  
Beringer L, 2014, LECT NOTES COMPUT SC, V8410, P107
[4]   A Trusted Mechanised Java']JavaScript Specification [J].
Bodin, Martin ;
Chargueraud, Arthur ;
Filaretti, Daniele ;
Gardner, Philippa ;
Maffeis, Sergio ;
Naudziuniene, Daiva ;
Schmitt, Alan ;
Smith, Gareth .
ACM SIGPLAN NOTICES, 2014, 49 (01) :87-100
[5]   A Formally-Verified C Compiler Supporting Floating-Point Arithmetic [J].
Boldo, Sylvie ;
Jourdan, Jacques-Henri ;
Leroy, Xavier ;
Melquiond, Guillaume .
2013 21ST IEEE SYMPOSIUM ON COMPUTER ARITHMETIC (ARITH), 2013, :107-115
[6]  
Campbell Brian, 2012, Certified Programs and Proofs. Second International Conference (CPP 2012). Proceedings, P60, DOI 10.1007/978-3-642-35308-6_8
[7]  
Dietz W, 2012, PROC INT CONF SOFTW, P760, DOI 10.1109/ICSE.2012.6227142
[8]  
Ellison C, 2012, POPL 12: PROCEEDINGS OF THE 39TH ANNUAL ACM SIGPLAN-SIGACT SYMPOSIUM ON PRINCIPLES OF PROGRAMMING LANGUAGES, P533
[9]   A SYNTACTIC THEORY OF SEQUENTIAL CONTROL [J].
FELLEISEN, M ;
FRIEDMAN, DP ;
KOHLBECKER, E ;
DUBA, B .
THEORETICAL COMPUTER SCIENCE, 1987, 52 (03) :205-237
[10]  
Huet G., 1997, Journal of Functional Programming, V7, P549, DOI 10.1017/S0956796897002864