<VCC Notes> introduction and installation of VCC and installation of vcc notes
Recently, I followed my instructor to participate in code verification. I needed to use the VCC tool developed by Microsoft Research (Microsoft academic), which is open-source and hosted on Codeplex. There are very few documents in English, and there are basically no Chinese documents. I can only read the official English documents. Therefore, I have the idea to write a few simple blogs, including some translations of documents. Keep a souvenir.
Translated the introduction in the VCC tutorial.:
"VCC is a verification environment that uses and verifies programs written in C language. VCC obtains a program (annotated with functions, assertions, and type constants) and tries to prove that those annotations are correct, that is, they execute each possible program. The environment includes proof of a tool monitoring attempt and failure to build some counterexamples. VCC processes fine-grained concurrency and low-level C language features, and has been used to verify the functional correctness of the code of thousands of concurrent business systems. This tutorial describes how to use VCC to verify C code. It covers the annotation language, verification method, and the use of VCC itself.
This tutorial describes how to use VCC to verify C code. Our main audience is C programmers who want to write the correct code. The only requirement is the knowledge of C language. When using VCC, you must first comment out your code and specify what it does (for example, sort your input) and why it can do this (for example: the constants that adapt to your cycle and data structure ). Then, VCC will try to prove (in mathematics) that the program complies with the specifications you have previously set. Unlike most program analyzers, VCC does not look for bugs or analyzes program abstractions. If VCC proves that the program is correct, your program is correct.
To check the program, VCC uses the deductive Verification Mode. It generates a certain number of mathematical expressions (called verification conditions) to ensure the correctness of the program "validity expression (?)", And try to use an automatic theorem validators to prove these statements. If these proofs fail, VCC will reflect the cause of the failure to your program code (instead of letting you see the formulas used by the theorem validators ). Therefore, you usually interact with VCC at the code and program status level. Generally, you can ignore the mathematical reasoning in VCC. For example, if your program uses division, if VCC cannot prove that the divisor must be non-zero, it will report a (potential) error in your program. This does not mean that your program must be incorrect. In fact, in most cases it is okay. (VCC reports an error.) This is because you have not provided enough information to make VCC infer that this suspected error will not occur. (For example, you may not specify a function parameter that must be non-zero ). Generally, you will solve this "error" by enhancing your comments ". However, this may lead to other error reports, forcing you to add more comments. Therefore, the actual verification is an iterative process. Sometimes, this process will reveal a real programming error. But even if it doesn't, you can at least prove that your code is not affected by this error, and you will also produce precise specification comments-a very useful document.
This tutorial covers the basics of VCC annotation language. When you understand this tutorial, you should be able to use VCC to verify some important projects. This tutorial does not include the theoretical background, implementation details, and advanced topics of VCC. You can find this information on the VCC homepage. For more information about all the summary in the tutorial, you can find them in the VCC manual. The examples in this tutorial are combined with the VCC source code.
You can use VCC through the command line or Visual Studio 2008/2010 ). Visual Studio provides an interface for you to easily access different components of the VCC toolchain. Therefore, we recommend that you use it. VCC can be downloaded from the VCC home page (http://vcc.codeplex.com/), be sure to read the installation instructions, which provides the installation conditions and set the tool path method and other important information ."
Install
Prepare the following environment on the machine before installing VCC:
After preparing the above environment, you can go to the VCC home page (http://vcc.codeplex.com/) to download the latest installer for installation.