VIDE Integrated Environment for Development and Verification of Programs.

Slides:



Advertisements
Similar presentations
Technologies for finding errors in object-oriented software K. Rustan M. Leino Microsoft Research, Redmond, WA Lecture 1 Summer school on Formal Models.
Advertisements

Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
An Abstract Interpretation Framework for Refactoring P. Cousot, NYU, ENS, CNRS, INRIA R. Cousot, ENS, CNRS, INRIA F. Logozzo, M. Barnett, Microsoft Research.
PZ03D Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ03D - Program verification Programming Language Design.
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Verifying Executable Object-Oriented Specifications with Separation Logic Stephan van Staden, Cristiano Calcagno, Bertrand Meyer.
Hoare’s Correctness Triplets Dijkstra’s Predicate Transformers
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
B. Sharma, S.D. Dhodapkar, S. Ramesh 1 Assertion Checking Environment (ACE) for Formal Verification of C Programs Babita Sharma, S.D.Dhodapkar RCnD, BARC,
Background information Formal verification methods based on theorem proving techniques and model­checking –to prove the absence of errors (in the formal.
1 Concurrency Specification. 2 Outline 4 Issues in concurrent systems 4 Programming language support for concurrency 4 Concurrency analysis - A specification.
VIDE als voortzetting van Cocktail SET Seminar 11 september 2008 Dr. ir. Michael Franssen.
Functional Design and Programming Lecture 11: Functional reasoning.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
ESC Java. Static Analysis Spectrum Power Cost Type checking Data-flow analysis Model checking Program verification AutomatedManual ESC.
ECI 2007: Specification and Verification of Object- Oriented Programs Lecture 1.
Copyright © 2006 The McGraw-Hill Companies, Inc. Programming Languages 2nd edition Tucker and Noonan Chapter 18 Program Correctness To treat programming.
From last time S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l t S1 p L2 l t S1 p S2 l t.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Describing Syntax and Semantics
Mechanized Metatheory for User- Defined Type Extensions Dan Marino, Brian Chin, Todd Millstein UCLA Gang Tan Boston College Robert J. Simmons, David Walker.
Floyd Hoare Logic. Semantics A programming language specification consists of a syntactic description and a semantic description. Syntactic description:symbols.
Pre/Post Condition Logic 03/06/2013. Agenda Hoare’s Logic Overview Application to Pre/Post Conditions.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Chapter 25 Formal Methods Formal methods Specify program using math Develop program using math Prove program matches specification using.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Formal Verification Lecture 9. Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems.
© Andrew IrelandDependable Systems Group On the Scalability of Proof Carrying Code for Software Certification Andrew Ireland School of Mathematical & Computer.
Model Checking and Model-Based Design Bruce H. Krogh Carnegie Mellon University.
© Andrew IrelandDependable Systems Group Static Analysis and Program Proof Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University.
ISBN Chapter 3 Describing Semantics.
Chapter 3 Part II Describing Syntax and Semantics.
Semantics In Text: Chapter 3.
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
13 Aug 2013 Program Verification. Proofs about Programs Why make you study logic? Why make you do proofs? Because we want to prove properties of programs.
Principle of Programming Lanugages 3: Compilation of statements Statements in C Assertion Hoare logic Department of Information Science and Engineering.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
This Week Lecture on relational semantics Exercises on logic and relations Labs on using Isabelle to do proofs.
Formal Verification. Background Information Formal verification methods based on theorem proving techniques and model­checking –To prove the absence of.
Lecture 4 Correctness and Fairness Verification and Assurance.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
Program Analysis and Verification
IS 2620: Developing Secure Systems Formal Verification/Methods Lecture 9 March 15, 2012.
Model Checking Early Requirements Specifications in Tropos Presented by Chin-Yi Tsai.
Formal methods: Lecture
Further with Hoare Logic Sections 6.12, 6.10, 6.13
Matching Logic An Alternative to Hoare/Floyd Logic
Formal Methods in Software Engineering 1
B (The language of B-Method )
Levels of Software Assurance in SPARK
Proof-Transforming Compilation of Programs with Abrupt Termination
Logical architecture refinement
Lecture 5 Floyd-Hoare Style Verification
IS 2935: Developing Secure Systems
Programming Languages 2nd edition Tucker and Noonan
Predicate Transformers
Formal Methods in software development
Program correctness Axiomatic semantics
CIS 720 Lecture 3.
Programming Languages and Compilers (CS 421)
CIS 720 Lecture 3.
Programming Languages 2nd edition Tucker and Noonan
Program Correctness an introduction.
Presentation transcript:

VIDE Integrated Environment for Development and Verification of Programs

Program Correctness Programs; in a general sense: –statements, expressions, procedures and functions, modules, classes, etc.; Specifications; in a general sense: – properties that programs should satisfy type-correctness absence of common errors full functional correctness performance properties Ways of establishing that a program satisfies a specification.

Programs and Specifications Flowcharts and inductive assertions (Floyd) While-programs and pre-/post-conditions (Hoare/Dijkstra) Cyclic/reactive programs and intermittent assertions Concurrent programs –safety (deadlock freedom, mutual exclusion) –liveness (termination, non-starvation) Functional programs and predicates Lambda terms and types Logic programs And many more …

Correctness Problems Main correctness problems: Synthesis: Given a specification S, make a program P satisfying S. Analysis: Given a program P, find a specification S satisfied by P. Verification: Given a program P and a specification S, prove that P satisfies S. Construction: Given a specification S, make a program P according to a method that guarantees that P satisfies S.

Some Approaches and Methods Decomposition: Given a specification S, decompose it into one or more more sub-specifications S1, …, Sn Composition: Given a specification S and subprograms P1,…, Pn satisfying specifications S1,…, Sn respectively, compose P1,…,Pn to a program P satisfying S. Transformation: Given a program P satisfying a specification S, transform P into a "better" program P0 by means of correctness preserving transformations. Refinement: This is usually divided into –Refinement of specification: Given a specification S, construct a more restrictive specification S0. –Refinement of code: Given a program P satisfying a specification S, construct a more restrictive program P0 (also satisfying S). –Refinement of data: Given a program P operating on data D, construct an equivalent program P0 operating on more concrete data D0. Correction: Given a specification S and a program P not satisfying S, find a program P0 which is "close" to P and which satisfies S. Extraction: Given a specification S and a constructive proof that S can be satisfied, extract a program P (the "witness") from the proof.

Hoare/Dijkstra Small imperative programs S ::= skip x := E S 1 ; S 2 if B then S 1 else S 2 fi while B do S od

Hoare logic (SKIP){P} S {P} (ASSN){P x E } x := E {Q} (SEQ){P} S 1 {R} {R} S 2 {Q} {P} S 1 ;S 2 {Q} (IF){P⋀B} S 1 {Q} {P ⋀ ¬ B} S 2 {Q} {P} if B then S1 else S2 fi {Q} (WHILE) {P ⋀ B} S {P} {P} while B do S od {P ⋀ ¬ B} (CONS)P ⇒ P1 {P1} S {Q1} Q1 ⇒ Q {P} S {Q}

Correctness problems, related to Hoare logic Synthesis –Given P and Q, make an S such that {P} S {Q} Analysis –Given S, find P and Q such that {P} S {Q} Verification –Given S, P and Q, check whether {P} S {Q} Construction –Given P and Q, construct S and proof such that {P} S {Q} …

Example of Analysis Problem Given the following program, determine P and Q: |[ con N: nat, var f: nat | {P} |[ var i: nat | i, f := 0, 1; while i ≠ N do f := f * (i + 1); i := i+1 od ]| {Q} ]|

Example of Verification Problem Given the following partially annotated program, check whether it satisfies its specification. |[ con N: nat, var f: nat | {true} |[ var i: nat | i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do f := f * (i + 1); i := i+1 od ]| {f = N!} ]|

Example of Program Construction Given the following program specification, construct a program on the red dots. |[ con N: nat, var f: nat | {true} {f = N!} ]|

Annotated Program |[ con N: nat, var f: nat | {true} {f = N!} ]| |[ con N: nat, var f: nat Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} {(0 ≤ 0 ≤ N) ⋀ 1 = 0!} i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} (Note 0) {(0 ≤ 0 ≤ N) ⋀ 1 = 0!} i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 0) = : true ⇒ (0 ≤ 0 ≤ N) ⋀ 1 = 0! (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} (Note 0) {(0 ≤ 0 ≤ N) ⋀ 1 = 0!} i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} { (0 <= i + 1 <= N) ⋀ f = (i+1)!} i := i+1 {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 0) = : true ⇒ (0 ≤ 0 ≤ N) ⋀ 1 = 0! (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} (Note 0) {(0 ≤ 0 ≤ N) ⋀ 1 = 0!} i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} { (0 <= i + 1 <= N) ⋀ f * (i + 1) = (i+1)!} f := f * (i + 1); { (0 <= i + 1 <= N) ⋀ f = (i+1)!} i := i+1 {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 0) = : true ⇒ (0 ≤ 0 ≤ N) ⋀ 1 = 0! (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

Annotated Program |[ con N: nat, var f: nat | {true} |[ var i: nat | {true} (Note 0) {(0 ≤ 0 ≤ N) ⋀ 1 = 0!} i, f := 0, 1; {(0 ≤ i ≤ N) ⋀ f = i!} while i ≠ N do {i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i!} (Note 1) { (0 <= i + 1 <= N) ⋀ f * (i + 1) = (i+1)!} f := f * (i + 1); { (0 <= i + 1 <= N) ⋀ f = (i+1)!} i := i+1 {(0 <= i <= N) ⋀ f = i!} od {(0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N)} (Note 2) {f = N!} ]| {f = N!} ]| |[ con N: nat, var f: nat |[ var i: nat; (Note 0) = : true ⇒ (0 ≤ 0 ≤ N) ⋀ 1 = 0! (Note 1) = : i ≠ N ⋀ (0 ≤ i ≤ N) ⋀ f = i! ⇒ (0 <= i + 1 <= N) ⋀ f * (i + 1) = (i+1)! (Note 2) = : (0 <= i <= N) ⋀ f = i! ⋀ ¬ (i ≠ N) ⇒ f = N! Verification Conditions

IDE (Integrated Development Environment) Helps in constructing and analyzing source code Maintains consistency in various stages of development Integrates several development tools, e.g.: –language specific code editor –type checking / code completion during editing –compiler –debugger / monitor of execution –browser for properties of procedures / classes /... –make/build facilities –project manager –... IDE supports several development modes, but does not enforce them. Extensible using plug ins

VIDE (Verifying IDE) Helps in constructing and analyzing code that satisfies specifications Maintains consistency between code and specifications in various stages of development Integrates several development and verification tools: –Some which are also offered by a normal IDE, e.g.: editor, compiler –Some which reappear in a more general form, e.g.: type checker, browser,... –Some specific for verification: verification condition generator, runtime assertion checker, proof assistant, automatic prover, invariant generator,... VIDE supports several development and verification modes, but does not enforce them Extensible using plug-ins

Some Scenarios Level: single block of code Given P and Q, construct S such that {P}S{Q} holds: –plain coding, runtime checking of P and Q –informal stepwise refinement, intermediate assertions, runtime assertion checking (“Eiffel style”) –plain coding, intermediate assertions, post hoc verification (“Perfect Developer style”) –formal stepwise refinement with complete formal verification ("Cocktail style") Formal development with congruence and refinement calculi Sandbox execution –monitor values of variables –check whether assertions hold Invariant reconstruction

Required machinery Program editor(s) –text, structure, hybrid, (also for specs), … Language tooling –scanning, parsing, tree building, annotation, flattening,... Context manager –available definitions, assumptions, theories,... Verification tools –verification condition generator, proof assistant, automatic prover,...

Existing Tools Cocktail PD Perfect Developer (Demo) …

Research problems Architecture of a VIDE –Independent but cooperating tools? –Closely integrated components? Integrated language –What kind of program constructs? –What kind of specification constructs? –What kind of logic? Context management –Theory –Tools Development styles and methods