Formal Methods for Critical Systems: A verified implementation of nested procedures⋆
⋆ Research project funded by AdaCore, the GNAT Pro Company
- 1. CNAM / Cedric / CPR team
- 2. INRIA / Gallium team
- 3. UPMC / LIP6 / Whisper team
Formal Methods for Critical Systems: A verified implementation of - - PowerPoint PPT Presentation
Formal Methods for Critical Systems: A verified implementation of nested procedures Tristan Crolard 1 ICAR15 8-9 October 2015 Joint work with: 1 Pierre Courtieu, 1 , 2 Maria-Virginia Aponte, Julia Lawall 3 1. CNAM / Cedric / CPR team 2.
⋆ Research project funded by AdaCore, the GNAT Pro Company
Formal Methods for Critical Systems: A verified implementation of nested procedures
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
formal specifications mathematical proofs of properties
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
formal specifications mathematical proofs of properties
1
Formal Methods for Critical Systems: A verified implementation of nested procedures
some safety and security properties of your system the full correctness of your implementation with respect to
2
Formal Methods for Critical Systems: A verified implementation of nested procedures
some safety and security properties of your system the full correctness of your implementation with respect to
2
Formal Methods for Critical Systems: A verified implementation of nested procedures
3
Formal Methods for Critical Systems: A verified implementation of nested procedures
3
Formal Methods for Critical Systems: A verified implementation of nested procedures
3
Formal Methods for Critical Systems: A verified implementation of nested procedures
the behavior of the programming language, the operating system, and the underlying hardware.
4
Formal Methods for Critical Systems: A verified implementation of nested procedures
The seL4 project developed at NICTA (SSRG).
The CompCert project developed at INRIA (Gallium team).
5
Formal Methods for Critical Systems: A verified implementation of nested procedures
Formal proof of correctness down to binary level Developed for ARM and Intel processors The fastest existing microkernel (faster than L4) 10,000 lines of code 200,000 lines of proof about 30 person.years
6
Formal Methods for Critical Systems: A verified implementation of nested procedures
Formal proof of correctness down to binary level Developed for PowerPC, ARM and Intel processors Generated code only 20% slower than gcc -O2 15,000 lines of code 100,000 lines of proof about 6 person.years
7
Formal Methods for Critical Systems: A verified implementation of nested procedures
8
Formal Methods for Critical Systems: A verified implementation of nested procedures
8
Formal Methods for Critical Systems: A verified implementation of nested procedures
8
Formal Methods for Critical Systems: A verified implementation of nested procedures
8
Formal Methods for Critical Systems: A verified implementation of nested procedures
8
Formal Methods for Critical Systems: A verified implementation of nested procedures
9
Formal Methods for Critical Systems: A verified implementation of nested procedures
9
Formal Methods for Critical Systems: A verified implementation of nested procedures
9
Formal Methods for Critical Systems: A verified implementation of nested procedures
9
Formal Methods for Critical Systems: A verified implementation of nested procedures
9
Formal Methods for Critical Systems: A verified implementation of nested procedures
10
Formal Methods for Critical Systems: A verified implementation of nested procedures
10
Formal Methods for Critical Systems: A verified implementation of nested procedures
10
Formal Methods for Critical Systems: A verified implementation of nested procedures
10
Formal Methods for Critical Systems: A verified implementation of nested procedures
10
Formal Methods for Critical Systems: A verified implementation of nested procedures
A compiler translates a source program into a target
The translation is correct if the target program has the
Formally, we need some mathematical abstraction of the
11
Formal Methods for Critical Systems: A verified implementation of nested procedures
Let us call ⋆ the translation performed by the compiler Correctness: For any source program p,
Let us write p ∼ p′ when p and p′ have the same behaviour
11
Formal Methods for Critical Systems: A verified implementation of nested procedures
For each program p, prove p ∼ p⋆
Prove ∀p, p ∼ p⋆
11
Formal Methods for Critical Systems: A verified implementation of nested procedures
Such verified compilers come with a mathematical,
By ruling out the possibility of compiler-introduced bugs,
12
Formal Methods for Critical Systems: A verified implementation of nested procedures
13
Formal Methods for Critical Systems: A verified implementation of nested procedures
13
Formal Methods for Critical Systems: A verified implementation of nested procedures
Embedded systems are usually developed in C or Ada
Critical systems are developed in subsets of these
Dedicated frameworks also generate either C or (SPARK)
14
Formal Methods for Critical Systems: A verified implementation of nested procedures
First standardized version in 1983 Ada is an algol-like language:
15
Formal Methods for Critical Systems: A verified implementation of nested procedures
Commercial Aviation:
Commercial Rockets:
Railway Transportation:
...
16
Formal Methods for Critical Systems: A verified implementation of nested procedures
Developed by ALTRAN Praxis and AdaCore Supported by any standard Ada 2012 compiler Well-defined subset of Ada designed for Critical Systems
Static analysis (SPARK tools)
17
Formal Methods for Critical Systems: A verified implementation of nested procedures
Developed by ALTRAN Praxis and AdaCore Supported by any standard Ada 2012 compiler Well-defined subset of Ada designed for Critical Systems
Static analysis (SPARK tools)
17
Formal Methods for Critical Systems: A verified implementation of nested procedures
A large on-going project, in collaboration with AdaCore and
Current state of the formal specification:
Unsupported features:
18
Formal Methods for Critical Systems: A verified implementation of nested procedures
Current state of the compiler:
Current state of the proofs:
18
Formal Methods for Critical Systems: A verified implementation of nested procedures
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language SPARK Ada
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language SPARK Ada SPARK Ada is much larger
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language SPARK Ada SPARK Ada is much larger
should require several
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
lexer and parser are specific to the C language Clight and C#minor are still too close to the C language SPARK Ada SPARK Ada is much larger
should require several
19
Formal Methods for Critical Systems: A verified implementation of nested procedures
20
Formal Methods for Critical Systems: A verified implementation of nested procedures
21
Formal Methods for Critical Systems: A verified implementation of nested procedures
22
Formal Methods for Critical Systems: A verified implementation of nested procedures
22
Formal Methods for Critical Systems: A verified implementation of nested procedures
22
Formal Methods for Critical Systems: A verified implementation of nested procedures
In functional or object-oriented languages:
In languages that obey a stack discipline, classical
23
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type We provided two implementations of this ADT:
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type We provided two implementations of this ADT:
We proved in Coq that the optimized implementation is
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
We formalized a frame stack as an Abstract Data Type We provided two implementations of this ADT:
We proved in Coq that the optimized implementation is
This bi-simulation then gives us for free a strong property
Parametricity in implemented in Coq as a plugin [Keller &
24
Formal Methods for Critical Systems: A verified implementation of nested procedures
As a corollary of parametricity, you obtain the following
25
Formal Methods for Critical Systems: A verified implementation of nested procedures
As a corollary of parametricity, you obtain the following
You need to provide the syntax and the semantics of your
25
Formal Methods for Critical Systems: A verified implementation of nested procedures
As a corollary of parametricity, you obtain the following
You need to provide the syntax and the semantics of your
Some statistics (just for nested procedures)
25
Formal Methods for Critical Systems: A verified implementation of nested procedures
Full SPARK 2014 support (packages, generics, ...) Correctness of SPARK tools (static analysis, contracts, ...) Correctness of the OCaml compiler (and its runtime)? Correctness of the Coq proof assistant? ...
26