Certifying Compiler

Document Sample
Certifying Compiler Powered By Docstoc
					Certifying Compiler
for a C-like Programming Lanuage Compiler is complex software. Some compiler bugs are tricky to be found out by testing. How can one trust the compiler? One method is by providing a certified compiler. Formal proofs are given that semantic of source programs is preserved during compilation. It is nearly impossible to prove the full correctness of a practical compiler since compilation phases (including optimizations) are too complex and some of the algorithms are hard to be certified. As another method, a certifying compiler needs to be implemented which can generate proofs when producing assembly codes. The generated proof is a formal proof that the produced codes confirm to their specifications. The code consumer needs not to trust the compiler nor the code producer. It only needs to run a proof checker before executing the codes. However, the design of a certifying compiler is full of challenges and choices. Usually, certifying compiler cooperates with an automated theorem prover. CComp is an on-going project. CComp is a certifying compiler for a C-like programming language Clike. The target language is x86 assembly language. We have designed a program logic (an extension to Hoare logic) for Clike using a fragment of separation logic and constrained first-order logic. There are several intermediate languages which are carefully chosen. The main research aspects are: ● Trade off between expressivity and automation. Finding such a trade-off is non-trivial. Automation of the proof is vital, but the language and logic should be used to develop system software. ● Proof translation, that is, how to reuse the proof at source-level and build the lower level proof. The goal of this research is to provide a practical tool for building large-scale proof-carrying system software. Research results and experiences will be equipped in the project of domain-specific languages and logics in building high-confidence software. Hopefully, certification of large-scale system software such as OS kernels will benefit from using the technique of certifying compilation.

Automated Theorem Proving
in Building High-confidence Software

Tony Hoare proposed Hoare logic as a formal system which has axioms and inference rules for all the constructs of a simple imperative programming language. It oriented program verification and researchers have developed rules for other language constructs ever since. Typically verification conditions will be generated according Hoare logic rules. If they are valid, the verification will terminate successfully. So to make such a formal verification system into practice, theorem proving is the key technique in building high-confidence software by program verification. There are two aspects to evaluate a theorem prover. One is the expressivity that the logic it supports, the other is the automaticity. There are many state-of-the-art theorem provers. The proof assistant Coq supports high order logic but need human interaction. The benefit is that the outputted proof terms can be used in building proof-carrying code. Z3 of Microsoft Research is a typical automated theorem prover. But it only reports Yes/No with no concrete proof term. Our research goal of this project is that to study the techniques of automated theorem proving in building high-confidence software with proof terms output. Currently the following researches are carrying on:  An automated theorem prover for integer arithmetic based on Simplex algorithm. It outputs proof terms which can be checked by Coq.  An automated theorem prover for fragment of separation logic.  Techniques on theory combination in building multi-theory-support theorem prover. This project tightly relates with our certifying compiler project (namely CComp) in our laboratory. These results and tools will be directly used in CComp. The future work is to research on generation of theorem prover based on the experiences of this project. It will be a core part as the generation techniques of certifying compilers.