Deductive Program Verification with Why3

Size: px
Start display at page:

Download "Deductive Program Verification with Why3"

Transcription

1 Deductive Program Verification with Why3 Jean-Christophe Filliâtre CNRS Mathematical Structures of Computation Formal Proof, Symbolic Computation and Computer Arithmetic Lyon, February 2014

2 definition program + specification verification conditions proof

3 this is not new A. M. Turing. Checking a large routine STOP r = 1 u = 1 v = u TEST r n s = 1 u = u + v s = s + 1 r = r + 1 TEST s r

4 this is not new Tony Hoare. Proof of a program: FIND. Commun. ACM, k v v v

5 which programs? which specs? program + specification verification conditions proof programs pseudo code / mainstream languages / DSL small / large specs safety, i.e. the program does not crash absence of arithmetic overflow complex behavioral property, e.g. sorts an array

6 which logic? program + specification verification conditions proof too rich: we won t be able to automate proofs too poor: we can t model programming languages and we can t specify programs typically, a compromise e.g. first-order logic + equality + arithmetic

7 what about proofs? program + specification verification conditions proof a gift: theorem provers proof assistants: Coq, PVS, Isabelle, etc. TPTP provers: Vampire, Eprover, SPASS, etc. SMT solvers: CVC3, Z3, Yices, Alt-Ergo, etc. dedicated provers

8 checking a large routine (Turing, 1949) STOP r = 1 u = 1 v = u TEST r n s = 1 u = u + v s = s + 1 r = r + 1 TEST s r

9 checking a large routine (Turing, 1949) STOP r = 1 u = 1 v = u TEST r n s = 1 u = u + v s = s + 1 r = r + 1 TEST s r u 1 for r = 0 to n 1 do v u for s = 1 to r do u u + v

10 checking a large routine (Turing, 1949) STOP r = 1 u = 1 v = u TEST r n s = 1 u = u + v s = s + 1 r = r + 1 TEST s r requires {n 0} u 1 for r = 0 to n 1 do v u for s = 1 to r do u u + v ensures {u = fact(n)}

11 checking a large routine (Turing, 1949) STOP r = 1 u = 1 v = u TEST r n s = 1 u = u + v s = s + 1 r = r + 1 TEST s r requires {n 0} u 1 for r = 0 to n 1 do v u for s = 1 to r do u u + v ensures {u = fact(n)} invariant {u = fact(r)} invariant {u = s fact(r)}

12 verification condition function fact(int) : int axiom fact0: fact(0) = 1 axiom factn: n:int. n 1 fact(n) = n * fact(n-1) goal vc: n:int. n 0 (0 > n = fact(n)) (0 n = fact(0) ( u:int. ( r:int. 0 r r n - 1 u = fact(r) (1 > r u = fact(r + 1)) (1 r u = 1 * fact(r) ( u1:int. ( s:int. 1 s s r u1 = s * fact(r) ( u2:int. u2 = u1 + u u2 = (s + 1) * fact(r))) (u1 = (r + 1) * fact(r) u1 = fact(r + 1))))) (u = fact((n - 1) + 1) u = fact(n))))

13 verification condition function fact(int) : int axiom fact0: fact(0) = 1 goal vc: n:int. n 0 (0 > n = fact(n))

14 verification condition function fact(int) : int axiom factn: n:int. n 1 fact(n) = n * fact(n-1) goal vc: n:int. n 0 (0 n - 1 ( u:int. ( r:int. 0 r r n - 1 u = fact(r) (1 r ( u1:int. (u1 = (r + 1) * fact(r) u1 = fact(r + 1)))))

15 the SMT revolution SMT means Satisfiability Modulo Theories an SMT solver combines + SAT + Equality + Arith +... e.g. n 0 0 > n 1 (Arith) n = 0 1 = fact(n) fact(0) = 1 (Ax) (Equality)

16 extracting verification conditions a well-known technique (weakest preconditions, Dijkstra 1971, Barnett/Leino 2005) yet doing it for a realistic programming language is a lot of work

17 extracting verification conditions a well-known technique (weakest preconditions, Dijkstra 1971, Barnett/Leino 2005) yet doing it for a realistic programming language is a lot of work as in a compiler, we rather design an intermediate language from which we extract VCs two examples: Boogie (Microsoft Research) Why3 (Univ. Paris Sud / Inria)

18 Why3 in a nutshell a simple programming language, with polymorphism pattern-matching exceptions mutable data structures, with controlled aliasing a polymorphic first-order logic, with algebraic data types recursive definitions inductive and coinductive predicates file.why file.mlw WhyML VCgen Why transform/translate print/run Coq Alt-Ergo CVC3 Z3 etc.

19 1. a taste of program verification

20 election given a multiset of N votes A A A C C B B C C C B C C determine the majority, if any

21 an elegant solution due to Boyer & Moore (1980) linear time constant extra space

22 principle A A A C C B B C C C B C C cand = A k = 1

23 principle A A A C C B B C C C B C C cand = A k = 2

24 principle A A A C C B B C C C B C C cand = A k = 3

25 principle A A A C C B B C C C B C C cand = A k = 2

26 principle A A A C C B B C C C B C C cand = A k = 1

27 principle A A A C C B B C C C B C C cand = A k = 0

28 principle A A A C C B B C C C B C C cand = B k = 1

29 principle A A A C C B B C C C B C C cand = B k = 0

30 principle A A A C C B B C C C B C C cand = C k = 1

31 principle A A A C C B B C C C B C C cand = C k = 2

32 principle A A A C C B B C C C B C C cand = C k = 1

33 principle A A A C C B B C C C B C C cand = C k = 2

34 principle A A A C C B B C C C B C C cand = C k = 3

35 principle A A A C C B B C C C B C C cand = C k = 3 then we check if C indeed has majority, with a second pass (in that case, it has: 7 > 13/2)

36 Fortran code

37 let mjrty (a: array candidate) : candidate = let n = length a in let cand = ref a[0] in let k = ref 0 in for i = 0 to n-1 do if!k = 0 then begin cand := a[i]; k := 1 end else if!cand = a[i] then incr k else decr k done; if!k = 0 then raise Not found; try if 2 *!k > n then raise Found; k := 0; for i = 0 to n-1 do if a[i] =!cand then begin incr k; if 2 *!k > n then raise Found end done; raise Not found with Found!cand end Why3 code

38 demo

39 specification precondition let mjrty (a: array candidate) requires { 1 length a } postcondition in case of success ensures { 2 * numof a result 0 (length a) > length a } postcondition in case of failure raises { Not found c: candidate. 2 * numof a c 0 (length a) length a }

40 loop invariants first loop for i = 0 to n-1 do invariant { 0!k numof a!cand 0 i } invariant { 2 * (numof a!cand 0 i -!k) i -!k } invariant { c: candidate. c!cand 2 * numof a c 0 i i -!k }... second loop for i = 0 to n-1 do invariant {!k = numof a!cand 0 i } invariant { 2 *!k n }...

41 proof the verification condition expresses safety array access within bounds termination validity of annotations invariants are initialized and preserved postconditions are established automatically discharged by SMT solvers

42 2. one logic to use them all

43 using theorem provers there are many theorem provers SMT solvers: Alt-Ergo, Z3, CVC3, Yices, etc. TPTP provers: Vampire, Eprover, SPASS, etc. proof assistants: Coq, PVS, Isabelle, etc. dedicated provers, e.g. Gappa (Guillaume s talk on Thursday) we want to use all of them if possible we make a compromise

44 in a nutshell logic of Why3 = polymorphic first-order logic, with (mutually) recursive algebraic data types (mutually) recursive function/predicate symbols (mutually) inductive predicates let-in, match-with, if-then-else more details: Expressing Polymorphic Types in a Many-Sorted Language (FroCos 2011) One Logic To Use Them All (CADE 2013)

45 declarations types abstract: type t alias: type t = list int algebraic: type list α = Nil Cons α (list α) function / predicate uninterpreted: function f int : int defined: predicate non empty (l: list α) = l Nil inductive predicate inductive trans t t =... axiom / lemma / goal goal G: x: int. x 0 x*x 0

46 theories logic declarations organized in theories theory end theories can be reused e.g. the theory of integers theory end generic theories can be instantiated e.g. notion of path theory end

47 under the hood a technology to talk to provers central concept: task a context (a list of declarations) a goal (a formula) goal

48 workflow theory end Alt-Ergo theory end Z3 theory Vampire end

49 workflow theory end Alt-Ergo theory end goal Z3 theory Vampire end

50 workflow theory end Alt-Ergo theory end goal T 1 goal Z3 theory Vampire end

51 workflow theory end Alt-Ergo theory end T 1 T 2 goal goal goal Z3 theory Vampire end

52 workflow theory end Alt-Ergo theory end T 1 T 2 P goal goal goal Z3 theory Vampire end

53 transformations eliminate algebraic data types and match-with eliminate inductive predicates eliminate if-then-else, let-in encode polymorphism, encode types etc. efficient: results of transformations are memoized

54 driver a task journey is driven by a file transformations to apply prover s input format syntax predefined symbols / axioms prover s diagnostic messages more details: Why3: Shepherd your herd of provers (Boogie 2011)

55 example: Z3 driver (excerpt) printer "smtv2" valid "^unsat" invalid "^sat" transformation "inline trivial" transformation "eliminate builtin" transformation "eliminate definition" transformation "eliminate inductive" transformation "eliminate algebraic" transformation "simplify formula" transformation "discriminate" transformation "encoding smt" prelude "(set-logic AUFNIRA)" theory BuiltIn syntax type int "Int" syntax type real "Real" syntax predicate (=) "(= %1 %2)" meta "encoding : kept" type int end

56 proof sessions proofs are stored into an XML file and read/written/updated by various tools why3ide why3replayer yes/no OCaml API proof session why3session L A TEX HTML... more details: Preserving User Proofs Across Specification Changes (VSTTE 2013)

57 3. to do what?

58 option 1 Why3 as a front-end to many theorem provers saves you a lot of work currently supports Coq, PVS, Isabelle Alt-Ergo, CVC3, CVC4, Simplify, Yices, Yices2, Z3 E, iprover, SPASS, Vampire, Zenon Gappa, Mathematica through files or via the OCaml API

59 example Why3 comes with a Coq tactic to call external ATPs as oracles Coq let why3 p gl =... Why3... generalize (h6 (i+1)%z h). why3 "alt-ergo"....

60 option 2 Why3 as a programming language to prove algorithms more than 80 examples in our gallery, e.g. Knuth-Morris-Pratt algorithm Bellman-Ford algorithm Red-black trees etc. automatically translated to OCaml code

61 option 3 Why3 as an intermediate language, to verify programs written in other, more complex programming languages Java programs: Krakatoa (Marché Paulin Urbain) C programs: Frama-C plug-ins Jessie (Marché), WP (Correnson) Ada programs: GNATprove (Adacore) probabilistic programs: EasyCrypt (Barthe et al.)

62 various ways of using Why3 Ada Java C prob. pgms GNATprove Krakatoa Frama-C Jessie WP Easycrypt Why3 WhyML logic proof assistants SMT solvers ATP systems other provers

63 how to tackle a realistic programming language you have to model most aspects pointers objects dynamic allocation arithmetic etc.

64 example 1: modeling the heap to verify programs with arbitrary aliasing, you have to come up with a memory model type loc type value =... type state = map loc value... this is what is done for C, Java, Ada, etc.

65 example 2: modeling integer arithmetic type int32 function to int (n: int32) : int constant min : int = - 0x constant max : int = 0x7fff ffff predicate in bounds (n: int) = min n max axiom to int in bounds: n: int32. in bounds (to int n) val of int (n: int) : int32 requires { in bounds n } ensures { to int result = n } val (+) (a b: int32) : int32 requires { in bounds (to int a + to int b) } ensures { to int result = to int a + to int b }

66 example 3: modeling floating-point arithmetic following the IEEE-754 standard type mode = NearestTiesToEven ToZero Up Down NearestTiesToAway function round mode real : real... type single function value single: real... type class = Finite Infinite NaN function class single : class... mode details: Sylvie s talk on Tuesday

67 conclusion

68 future work to simultaneously increase proof automation e.g. automatic induction enrich the specification logic e.g. higher-order logic support more programming constructs e.g. higher-order functions e.g. module subtyping

69 more details at source code under LGPL related publications more than 80 examples documentation, lecture notes

Why3 where programs meet provers

Why3 where programs meet provers Why3 where programs meet provers Jean-Christophe Filliâtre CNRS KeY Symposium 2017 Rastatt, Germany October 5, 2017 history started in 2001, as an intermediate language in the process of verifying C and

More information

An Introduction to Deductive Program Verification

An Introduction to Deductive Program Verification An Introduction to Deductive Program Verification Jean-Christophe Filliâtre CNRS Sixth Summer School on Formal Techniques May 2016 http://why3.lri.fr/ssft-16/ 1 / 145 Software is hard. Don Knuth why? wrong

More information

Why3 A Multi-Prover Platform for Program Verification

Why3 A Multi-Prover Platform for Program Verification Why3 A Multi-Prover Platform for Program Verification Jean-Christophe Filliâtre CNRS joint work with Andrei Paskevich, Claude Marché, and François Bobot ProVal team, Orsay, France IFIP WG 1.9/2.14 Verified

More information

Deductive Program Verification with Why3, Past and Future

Deductive Program Verification with Why3, Past and Future Deductive Program Verification with Why3, Past and Future Claude Marché ProofInUse Kick-Off Day February 2nd, 2015 A bit of history 1999: Jean-Christophe Filliâtre s PhD Thesis Proof of imperative programs,

More information

Why. an intermediate language for deductive program verification

Why. an intermediate language for deductive program verification Why an intermediate language for deductive program verification Jean-Christophe Filliâtre CNRS Orsay, France AFM workshop Grenoble, June 27, 2009 Jean-Christophe Filliâtre Why tutorial AFM 09 1 / 56 Motivations

More information

Deductive Program Verification with Why3 A Tutorial

Deductive Program Verification with Why3 A Tutorial Lecture at École Jeunes Chercheurs en Programmation (EJCP) 2015 Deductive Program Verification with Why3 A Tutorial Jean-Christophe Filliâtre May 2015 Preface This lecture has been prepared using Why3

More information

Deductive Verification in Frama-C and SPARK2014: Past, Present and Future

Deductive Verification in Frama-C and SPARK2014: Past, Present and Future Deductive Verification in Frama-C and SPARK2014: Past, Present and Future Claude Marché (Inria & Université Paris-Saclay) OSIS, Frama-C & SPARK day, May 30th, 2017 1 / 31 Outline Why this joint Frama-C

More information

Why3 Where Programs Meet Provers

Why3 Where Programs Meet Provers Why3 Where Programs Meet Provers Jean-Christophe Filliâtre, Andrei Paskevich To cite this version: Jean-Christophe Filliâtre, Andrei Paskevich. Why3 Where Programs Meet Provers. ESOP 13 22nd European Symposium

More information

Numerical Computations and Formal Methods

Numerical Computations and Formal Methods Program verification Formal arithmetic Decision procedures Proval, Laboratoire de Recherche en Informatique INRIA Saclay IdF, Université Paris Sud, CNRS October 28, 2009 Program verification Formal arithmetic

More information

Deductive Program Verification with WHY3

Deductive Program Verification with WHY3 Deductive Program Verification with WHY3 Andrei Paskevich LRI, Université Paris-Sud Toccata, Inria Saclay http://why3.lri.fr/ejcp-2017 ÉJCP 2017 1. A quick look back 2 / 121 Introduction Software is hard.

More information

Simple proofs of simple programs in Why3

Simple proofs of simple programs in Why3 Simple proofs of simple programs in Why3 Jean-Jacques Lévy State Key Laboratory for Computer Science, Institute of Software, Chinese Academy of Sciences & Inria Abstract We want simple proofs for proving

More information

GNATprove a Spark2014 verifying compiler Florian Schanda, Altran UK

GNATprove a Spark2014 verifying compiler Florian Schanda, Altran UK 1 GNATprove a Spark2014 verifying compiler Florian Schanda, Altran UK Tool architecture User view Source gnatprove Verdict 2 Tool architecture More detailed view... Source Encoding CVC4 gnat2why gnatwhy3

More information

Combining Coq and Gappa for Certifying FP Programs

Combining Coq and Gappa for Certifying FP Programs Introduction Example Gappa Tactic Conclusion Combining Coq and Gappa for Certifying Floating-Point Programs Sylvie Boldo Jean-Christophe Filliâtre Guillaume Melquiond Proval, Laboratoire de Recherche en

More information

A Modular Way to Reason About Iteration

A Modular Way to Reason About Iteration A Modular Way to Reason About Iteration Jean-Christophe Filliâtre Mário Pereira LRI, Univ. Paris-Sud, CNRS, Inria Saclay INRIA Paris - Séminaire Gallium Mars 7, 2016 iteration iteration: hello old friend!

More information

The Why/Krakatoa/Caduceus Platform for Deductive Program Verication

The Why/Krakatoa/Caduceus Platform for Deductive Program Verication The Why/Krakatoa/Caduceus Platform for Deductive Program Verication Jean-Christophe Filliâtre 1,3 and Claude Marché 2,3 1 CNRS, Lab. de Recherche en Informatique, UMR 8623, Orsay, F-91405 2 INRIA Futurs,

More information

Formal Verification of MIX Programs

Formal Verification of MIX Programs Formal Verification of MIX Programs Jean-Christophe Filliâtre CNRS LRI, Univ Paris-Sud, Orsay F-91405 INRIA Futurs, ProVal, Orsay F-91893 Abstract We introduce a methodology to formally verify MIX programs.

More information

WP Plug-in (Draft) Manual

WP Plug-in (Draft) Manual WP (Draft Manual) WP Plug-in (Draft) Manual Frama-C Carbon 20101202 beta-2 Loïc Correnson, Zaynah Dargaye, Anne Pacalet CEA LIST, Software Reliability Laboratory c 2010 CEA LIST This work has been supported

More information

Producing All Ideals of a Forest, Formally (Verification Pearl)

Producing All Ideals of a Forest, Formally (Verification Pearl) Producing All Ideals of a Forest, Formally (Verification Pearl) Jean-Christophe Filliâtre, Mário Pereira To cite this version: Jean-Christophe Filliâtre, Mário Pereira. Producing All Ideals of a Forest,

More information

Reminder of the last lecture. Aliasing Issues: Call by reference, Pointer programs. Introducing Aliasing Issues. Home Work from previous lecture

Reminder of the last lecture. Aliasing Issues: Call by reference, Pointer programs. Introducing Aliasing Issues. Home Work from previous lecture Reminder of the last lecture Aliasing Issues: Call by reference, Pointer programs Claude Marché Cours MPRI 2-36-1 Preuve de Programme 18 janvier 2017 Additional features of the specification language Abstract

More information

How to get an efficient yet verified arbitrary-precision integer library

How to get an efficient yet verified arbitrary-precision integer library How to get an efficient yet verified arbitrary-precision integer library Raphaël Rieu-Helft (joint work with Guillaume Melquiond and Claude Marché) TrustInSoft Inria May 28, 2018 1/31 Context, motivation,

More information

Lost in translation. Leonardo de Moura Microsoft Research. how easy problems become hard due to bad encodings. Vampire Workshop 2015

Lost in translation. Leonardo de Moura Microsoft Research. how easy problems become hard due to bad encodings. Vampire Workshop 2015 Lost in translation how easy problems become hard due to bad encodings Vampire Workshop 2015 Leonardo de Moura Microsoft Research I wanted to give the following talk http://leanprover.github.io/ Automated

More information

Verification Condition Generation

Verification Condition Generation Verification Condition Generation Jorge Sousa Pinto Departamento de Informática / Universidade do Minho jsp@di.uminho.pt www.di.uminho.pt/~jsp Outline (1) - From Hoare Logic to VCGen algorithms: an architecture

More information

Formal Verification of Floating-Point programs

Formal Verification of Floating-Point programs Formal Verification of Floating-Point programs Sylvie Boldo and Jean-Christophe Filliâtre Montpellier June, 26th 2007 INRIA Futurs CNRS, LRI Motivations Goal: reliability in numerical software Motivations

More information

An Annotated Language

An Annotated Language Hoare Logic An Annotated Language State and Semantics Expressions are interpreted as functions from states to the corresponding domain of interpretation Operators have the obvious interpretation Free of

More information

Improving Coq Propositional Reasoning Using a Lazy CNF Conversion

Improving Coq Propositional Reasoning Using a Lazy CNF Conversion Using a Lazy CNF Conversion Stéphane Lescuyer Sylvain Conchon Université Paris-Sud / CNRS / INRIA Saclay Île-de-France FroCoS 09 Trento 18/09/2009 Outline 1 Motivation and background Verifying an SMT solver

More information

Coq. LASER 2011 Summerschool Elba Island, Italy. Christine Paulin-Mohring

Coq. LASER 2011 Summerschool Elba Island, Italy. Christine Paulin-Mohring Coq LASER 2011 Summerschool Elba Island, Italy Christine Paulin-Mohring http://www.lri.fr/~paulin/laser Université Paris Sud & INRIA Saclay - Île-de-France September 2011 Lecture 4 : Advanced functional

More information

Software Verification of Safety-Critical Aerospace Systems1

Software Verification of Safety-Critical Aerospace Systems1 Software Verification of Safety-Critical Aerospace Systems1 Ce sar A. Mun oz Alwyn Goodloe {cesar.a.munoz,a.goodloe}@nasa.gov Frama-C Day 2016 June 20th, 2016 1 This presentation reports joint work with

More information

Why3: Shepherd Your Herd of Provers

Why3: Shepherd Your Herd of Provers Why3: Shepherd Your Herd of Provers François Bobot, Jean-Christophe Filliâtre, Claude Marché, Andrei Paskevich To cite this version: François Bobot, Jean-Christophe Filliâtre, Claude Marché, Andrei Paskevich.

More information

Program Verification (6EC version only)

Program Verification (6EC version only) Program Verification (6EC version only) Erik Poll Digital Security Radboud University Nijmegen Overview Program Verification using Verification Condition Generators JML a formal specification language

More information

A Case Study on Model Checking and Deductive Verification Techniques of Safety-Critical Software

A Case Study on Model Checking and Deductive Verification Techniques of Safety-Critical Software A Case Study on Model Checking and Deductive Verification Techniques of Safety-Critical Software Rovedy A. B. e Silva 1,2, Jose M. Parente de Oliveira 2, and Jorge Sousa Pinto 3 1 Aeronautics and Space

More information

Main Goal. Language-independent program verification framework. Derive program properties from operational semantics

Main Goal. Language-independent program verification framework. Derive program properties from operational semantics Main Goal Language-independent program verification framework Derive program properties from operational semantics Questions: Is it possible? Is it practical? Answers: Sound and complete proof system,

More information

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin

Coq, a formal proof development environment combining logic and programming. Hugo Herbelin Coq, a formal proof development environment combining logic and programming Hugo Herbelin 1 Coq in a nutshell (http://coq.inria.fr) A logical formalism that embeds an executable typed programming language:

More information

Specification, Verification, and Interactive Proof

Specification, Verification, and Interactive Proof Specification, Verification, and Interactive Proof SRI International May 23, 2016 PVS PVS - Prototype Verification System PVS is a verification system combining language expressiveness with automated tools.

More information

Lectures 20, 21: Axiomatic Semantics

Lectures 20, 21: Axiomatic Semantics Lectures 20, 21: Axiomatic Semantics Polyvios Pratikakis Computer Science Department, University of Crete Type Systems and Static Analysis Based on slides by George Necula Pratikakis (CSD) Axiomatic Semantics

More information

Formally Certified Satisfiability Solving

Formally Certified Satisfiability Solving SAT/SMT Proof Checking Verifying SAT Solver Code Future Work Computer Science, The University of Iowa, USA April 23, 2012 Seoul National University SAT/SMT Proof Checking Verifying SAT Solver Code Future

More information

BOOGIE. Presentation by Itsik Hefez A MODULAR REUSABLE VERIFIER FOR OBJECT-ORIENTED PROGRAMS MICROSOFT RESEARCH

BOOGIE. Presentation by Itsik Hefez A MODULAR REUSABLE VERIFIER FOR OBJECT-ORIENTED PROGRAMS MICROSOFT RESEARCH BOOGIE A MODULAR REUSABLE VERIFIER FOR OBJECT-ORIENTED PROGRAMS MICROSOFT RESEARCH Presentation by Itsik Hefez Introduction Boogie is an intermediate verification language, intended as a layer on which

More information

Satisfiability Modulo Theories. DPLL solves Satisfiability fine on some problems but not others

Satisfiability Modulo Theories. DPLL solves Satisfiability fine on some problems but not others DPLL solves Satisfiability fine on some problems but not others DPLL solves Satisfiability fine on some problems but not others Does not do well on proving multipliers correct pigeon hole formulas cardinality

More information

CSC313 High Integrity Systems/CSCM13 Critical Systems. CSC313/CSCM13 Chapter 2 1/ 221

CSC313 High Integrity Systems/CSCM13 Critical Systems. CSC313/CSCM13 Chapter 2 1/ 221 CSC313 High Integrity Systems/CSCM13 Critical Systems CSC313/CSCM13 Chapter 2 1/ 221 CSC313 High Integrity Systems/ CSCM13 Critical Systems Course Notes Chapter 2: SPARK Ada Sect. 2 (f) Anton Setzer Dept.

More information

Let s Verify This with Why3

Let s Verify This with Why3 Let s Verify This with Why3 François Bobot, Jean-Christophe Filliâtre, Claude Marché, Andrei Paskevich To cite this version: François Bobot, Jean-Christophe Filliâtre, Claude Marché, Andrei Paskevich.

More information

SMT-LIB for HOL. Daniel Kroening Philipp Rümmer Georg Weissenbacher Oxford University Computing Laboratory. ITP Workshop MSR Cambridge 25 August 2009

SMT-LIB for HOL. Daniel Kroening Philipp Rümmer Georg Weissenbacher Oxford University Computing Laboratory. ITP Workshop MSR Cambridge 25 August 2009 1 / 13 SMT-LIB for HOL Daniel Kroening Philipp Rümmer Georg Weissenbacher Oxford University Computing Laboratory ITP Workshop MSR Cambridge 25 August 2009 2 / 13 The SMT-LIB Standard SMT Satisfiability

More information

Laboratory for Automated Reasoning and Analysis

Laboratory for Automated Reasoning and Analysis http://lara.epfl.ch Laboratory for Automated Reasoning and Analysis Viktor Kuncak Assistant Professor, IC a project: http://javaverification.org ongoing class: http://richmodels.org/lat Spring, will be

More information

WP 0.6 (Draft Manual)

WP 0.6 (Draft Manual) WP 0.6 (Draft Manual) WP Plug-in (Draft) Manual Version 0.6 for Oxygen-20120901 Patrick Baudin, Loïc Correnson, Zaynah Dargaye CEA LIST, Software Safety Laboratory c 2010-2012 CEA LIST This work has been

More information

WP 0.4 (Draft Manual)

WP 0.4 (Draft Manual) WP 0.4 (Draft Manual) WP Plug-in (Draft) Manual Version 0.4 for Nitrogen-20111001 Loïc Correnson, Zaynah Dargaye, Anne Pacalet CEA LIST, Software Safety Laboratory c 2010-2011 CEA LIST This work has been

More information

Integration of SMT Solvers with ITPs There and Back Again

Integration of SMT Solvers with ITPs There and Back Again Integration of SMT Solvers with ITPs There and Back Again Sascha Böhme and University of Sheffield 7 May 2010 1 2 Features: SMT-LIB vs. Yices Translation Techniques Caveats 3 4 Motivation Motivation System

More information

A CRASH COURSE IN SEMANTICS

A CRASH COURSE IN SEMANTICS LAST TIME Recdef More induction NICTA Advanced Course Well founded orders Slide 1 Theorem Proving Principles, Techniques, Applications Slide 3 Well founded recursion Calculations: also/finally {P}... {Q}

More information

Trends in Automated Verification

Trends in Automated Verification Trends in Automated Verification K. Rustan M. Leino Senior Principal Engineer Automated Reasoning Group (ARG), Amazon Web Services 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved.

More information

Lecture 10 Design by Contract

Lecture 10 Design by Contract CS 5959 Writing Solid Code Fall 2015 Nov-23 Lecture 10 Design by Contract Zvonimir Rakamarić University of Utah Design by Contract Also called assume-guarantee reasoning Developers annotate software components

More information

Chapter 1. Introduction

Chapter 1. Introduction 1 Chapter 1 Introduction An exciting development of the 21st century is that the 20th-century vision of mechanized program verification is finally becoming practical, thanks to 30 years of advances in

More information

Built-in Treatment of an Axiomatic Floating-Point Theory for SMT Solvers

Built-in Treatment of an Axiomatic Floating-Point Theory for SMT Solvers Built-in Treatment of an Axiomatic Floating-Point Theory for SMT Solvers Sylvain Conchon LRI, Université Paris Sud Guillaume Melquiond INRIA Saclay Île-de-France Cody Roux LRI, Université Paris Sud Mohamed

More information

WP Plug-in Manual. Version 0.9 for Magnesium Patrick Baudin, François Bobot, Loïc Correnson, Zaynah Dargaye

WP Plug-in Manual. Version 0.9 for Magnesium Patrick Baudin, François Bobot, Loïc Correnson, Zaynah Dargaye WP 0.9 WP Plug-in Manual Version 0.9 for Magnesium-20151002 Patrick Baudin, François Bobot, Loïc Correnson, Zaynah Dargaye CEA LIST, Software Safety Laboratory October 2015 2010-2015 CEA LIST This work

More information

An Extensible Programming Language for Verified Systems Software. Adam Chlipala MIT CSAIL WG 2.16 meeting, 2012

An Extensible Programming Language for Verified Systems Software. Adam Chlipala MIT CSAIL WG 2.16 meeting, 2012 An Extensible Programming Language for Verified Systems Software Adam Chlipala MIT CSAIL WG 2.16 meeting, 2012 The status quo in computer system design DOM JS API Web page Network JS API CPU Timer interrupts

More information

Generating Small Countermodels. Andrew Reynolds Intel August 30, 2012

Generating Small Countermodels. Andrew Reynolds Intel August 30, 2012 Generating Small Countermodels using SMT Andrew Reynolds Intel August 30, 2012 Acknowledgements Intel Corporation AmitGoel, Sava Krstic University of Iowa Cesare Tinelli, Francois Bobot New York University

More information

A Formally Proved, Complete Algorithm for Path Resolution with Symbolic Links

A Formally Proved, Complete Algorithm for Path Resolution with Symbolic Links A Formally Proved, Complete Algorithm for Path Resolution with Symbolic Links Ran Chen Institute of Software, Chinese Academy of Science, Beijing, China Martin Clochard LRI (CNRS & Univ. Paris-Sud), Université

More information

Semi-Persistent Data Structures

Semi-Persistent Data Structures Semi-Persistent Data Structures Sylvain Conchon and Jean-Christophe Filliâtre Université Paris Sud CNRS ESOP 2008 S. Conchon & J.-C. Filliâtre Semi-Persistent Data Structures ESOP 2008 1 Persistence persistent

More information

Pointer Programs, Separation Logic

Pointer Programs, Separation Logic Chapter 6 Pointer Programs, Separation Logic The goal of this section is to drop the hypothesis that we have until now, that is, references are not values of the language, and in particular there is nothing

More information

Verifying Two Lines of C with Why3: An Exercise in Program Verification

Verifying Two Lines of C with Why3: An Exercise in Program Verification Verifying Two Lines of C with Why3: An Exercise in Program Verification Jean-Christophe Filliâtre CNRS LRI, Univ Paris-Sud, CNRS, Orsay F-91405 INRIA Saclay-Île-de-France, ProVal, Orsay F-91893 Abstract.

More information

Jessie Plug-In Tutorial

Jessie Plug-In Tutorial Jessie Plug-In Tutorial Frama-C version: Carbon Jessie plug-in version: 2.28 Claude Marché 1,3, Yannick Moy 2,3, December 17, 2010 1 INRIA Saclay - Île-de-France, ProVal, Orsay, F-91893 2 France Télécom,

More information

Isabelle/HOL:Selected Features and Recent Improvements

Isabelle/HOL:Selected Features and Recent Improvements /: Selected Features and Recent Improvements webertj@in.tum.de Security of Systems Group, Radboud University Nijmegen February 20, 2007 /:Selected Features and Recent Improvements 1 2 Logic User Interface

More information

Deductive Methods, Bounded Model Checking

Deductive Methods, Bounded Model Checking Deductive Methods, Bounded Model Checking http://d3s.mff.cuni.cz Pavel Parízek CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics Deductive methods Pavel Parízek Deductive Methods, Bounded

More information

Practical introduction to Frama-C (without Mathematical notations ;-) )

Practical introduction to Frama-C (without Mathematical notations ;-) ) Practical introduction to Frama-C (without Mathematical notations ;-) ) David MENTRÉ Using content of Jochen Burghardt (Fraunhofer First), Virgile Prevosto (CEA), Julien Signoles

More information

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

Automated Theorem Proving and Proof Checking

Automated Theorem Proving and Proof Checking Automated Theorem Proving and Proof Checking #1 #2 Cunning Theorem-Proving Plan There are full-semester courses on automated deduction; we will elide details. Logic Syntax Theories Satisfiability Procedures

More information

Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm

Strongly Connected Components in graphs, formal proof of Tarjan1972 algorithm Strongly Connected Components in graphs, formal proof of Tarjan972 algorithm jean-jacques.levy@inria.fr Inria Sophia, -03-207 Plan motivation algorithm pre-/post-conditions imperative programs conclusion..

More information

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs?

Part II. Hoare Logic and Program Verification. Why specify programs? Specification and Verification. Code Verification. Why verify programs? Part II. Hoare Logic and Program Verification Part II. Hoare Logic and Program Verification Dilian Gurov Props: Models: Specs: Method: Tool: safety of data manipulation source code logic assertions Hoare

More information

6. Hoare Logic and Weakest Preconditions

6. Hoare Logic and Weakest Preconditions 6. Hoare Logic and Weakest Preconditions Program Verification ETH Zurich, Spring Semester 07 Alexander J. Summers 30 Program Correctness There are many notions of correctness properties for a given program

More information

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré

Hoare Logic. COMP2600 Formal Methods for Software Engineering. Rajeev Goré Hoare Logic COMP2600 Formal Methods for Software Engineering Rajeev Goré Australian National University Semester 2, 2016 (Slides courtesy of Ranald Clouston) COMP 2600 Hoare Logic 1 Australian Capital

More information

Yices 1.0: An Efficient SMT Solver

Yices 1.0: An Efficient SMT Solver Yices 1.0: An Efficient SMT Solver AFM 06 Tutorial Leonardo de Moura (joint work with Bruno Dutertre) {demoura, bruno}@csl.sri.com. Computer Science Laboratory SRI International Menlo Park, CA Yices: An

More information

Combining Coq and Gappa for Certifying Floating-Point Programs

Combining Coq and Gappa for Certifying Floating-Point Programs Combining Coq and Gappa for Certifying Floating-Point Programs Sylvie Boldo 1,2, Jean-Christophe Filliâtre 2,1, and Guillaume Melquiond 1,2 1 INRIA Saclay - Île-de-France, ProVal, Orsay, F-91893 2 LRI,

More information

Jessie Plugin Tutorial

Jessie Plugin Tutorial Jessie Plugin Tutorial Frama-C version: Boron Jessie plugin version: 2.26 Claude Marché 1,3, Yannick Moy 2,3, May 31, 2010 1 INRIA Saclay - Île-de-France, ProVal, Orsay, F-91893 2 France Télécom, Lannion,

More information

The SMT-LIB 2 Standard: Overview and Proposed New Theories

The SMT-LIB 2 Standard: Overview and Proposed New Theories 1 / 23 The SMT-LIB 2 Standard: Overview and Proposed New Theories Philipp Rümmer Oxford University Computing Laboratory philr@comlab.ox.ac.uk Third Workshop on Formal and Automated Theorem Proving and

More information

λ calculus is inconsistent

λ calculus is inconsistent Content Rough timeline COMP 4161 NICTA Advanced Course Advanced Topics in Software Verification Gerwin Klein, June Andronick, Toby Murray λ Intro & motivation, getting started [1] Foundations & Principles

More information

A Decision Procedure for (Co)datatypes in SMT Solvers. Andrew Reynolds Jasmin Christian Blanchette IJCAI sister conference track, July 12, 2016

A Decision Procedure for (Co)datatypes in SMT Solvers. Andrew Reynolds Jasmin Christian Blanchette IJCAI sister conference track, July 12, 2016 A Decision Procedure for (Co)datatypes in SMT Solvers Andrew Reynolds Jasmin Christian Blanchette IJCAI sister conference track, July 12, 2016 Satisfiability Modulo Theories (SMT) Solvers Software Verification

More information

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing

More information

Abstract Interpretation

Abstract Interpretation Abstract Interpretation Ranjit Jhala, UC San Diego April 22, 2013 Fundamental Challenge of Program Analysis How to infer (loop) invariants? Fundamental Challenge of Program Analysis Key issue for any analysis

More information

Frama-C A Collaborative Framework for C Code Verification

Frama-C A Collaborative Framework for C Code Verification Frama-C A Collaborative Framework for C Code Verification Tutorial at ISSRE 2017 Nikolai Kosmatov, Julien Signoles Toulouse, October 26 th, 2017 N. Kosmatov, J. Signoles (CEA LIST) Frama-C 2017-10-26 1

More information

How to Compute the Area of a Triangle: a Formal Revisit

How to Compute the Area of a Triangle: a Formal Revisit 21st IEEE International Symposium on Computer Arithmetic How to Compute the Area of a Triangle: a Formal Revisit Sylvie Boldo Inria Saclay Île-de-France, LRI, Université Paris-Sud April 9th, 2013 Motivations

More information

Readable semi-automatic formal proofs of Depth-First Search in graphs using Why3

Readable semi-automatic formal proofs of Depth-First Search in graphs using Why3 Readable semi-automatic formal proofs of Depth-First Search in graphs using Why3 Ran Chen, Jean-Jacques Levy To cite this version: Ran Chen, Jean-Jacques Levy. Readable semi-automatic formal proofs of

More information

Combining Coq and Gappa for Certifying Floating-Point Programs

Combining Coq and Gappa for Certifying Floating-Point Programs Combining Coq and Gappa for Certifying Floating-Point Programs Sylvie Boldo 1,2, Jean-Christophe Filliâtre 2,1, and Guillaume Melquiond 1,2 1 INRIA Saclay - Île-de-France, ProVal, Orsay, F-91893 2 LRI,

More information

Chapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes

Chapter 13: Reference. Why reference Typing Evaluation Store Typings Safety Notes Chapter 13: Reference Why reference Typing Evaluation Store Typings Safety Notes References Computational Effects Also known as side effects. A function or expression is said to have a side effect if,

More information

From Z3 to Lean, Efficient Verification

From Z3 to Lean, Efficient Verification From Z3 to Lean, Efficient Verification Turing Gateway to Mathematics, 19 July 2017 Leonardo de Moura, Microsoft Research Joint work with Nikolaj Bjorner and Christoph Wintersteiger Satisfiability Solution/Model

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

Complete Instantiation of Quantified Formulas in Satisfiability Modulo Theories. ACSys Seminar

Complete Instantiation of Quantified Formulas in Satisfiability Modulo Theories. ACSys Seminar Complete Instantiation of Quantified Formulas in Satisfiability Modulo Theories Yeting Ge Leonardo de Moura ACSys Seminar 2008.12 Motivation SMT solvers have been successful Quantified smt formulas are

More information

Adam Chlipala University of California, Berkeley ICFP 2006

Adam Chlipala University of California, Berkeley ICFP 2006 Modular Development of Certified Program Verifiers with a Proof Assistant Adam Chlipala University of California, Berkeley ICFP 2006 1 Who Watches the Watcher? Program Verifier Might want to ensure: Memory

More information

VS 3 : SMT Solvers for Program Verification

VS 3 : SMT Solvers for Program Verification VS 3 : SMT Solvers for Program Verification Saurabh Srivastava 1,, Sumit Gulwani 2, and Jeffrey S. Foster 1 1 University of Maryland, College Park, {saurabhs,jfoster}@cs.umd.edu 2 Microsoft Research, Redmond,

More information

Type Theory meets Effects. Greg Morrisett

Type Theory meets Effects. Greg Morrisett Type Theory meets Effects Greg Morrisett A Famous Phrase: Well typed programs won t go wrong. 1. Describe abstract machine: M ::= 2. Give transition relation: M 1 M 2

More information

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214

Theorem proving. PVS theorem prover. Hoare style verification PVS. More on embeddings. What if. Abhik Roychoudhury CS 6214 Theorem proving PVS theorem prover Abhik Roychoudhury National University of Singapore Both specification and implementation can be formalized in a suitable logic. Proof rules for proving statements in

More information

Provably Correct Software

Provably Correct Software Provably Correct Software Max Schäfer Institute of Information Science/Academia Sinica September 17, 2007 1 / 48 The Need for Provably Correct Software BUT bugs are annoying, embarrassing, and cost gazillions

More information

Verification Conditions. Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany

Verification Conditions. Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany Verification Conditions Juan Pablo Galeotti, Alessandra Gorla, Andreas Rau Saarland University, Germany 30% projects (10% each) At least 50% threshold for exam admittance Groups of 2 70% final exam (see

More information

Proving SPARK Verification Conditions with SMT solvers

Proving SPARK Verification Conditions with SMT solvers manuscript No. (will be inserted by the editor) Proving SPARK Verification Conditions with SMT solvers Paul B. Jackson Grant Olney Passmore Received: date / Accepted: date Abstract We have constructed

More information

The Mezzo case. Jonathan Protzenko. François Pottier FSFMA'13. Why design a new programming language?

The Mezzo case. Jonathan Protzenko. François Pottier FSFMA'13. Why design a new programming language? Why design a new programming language? The Mezzo case François Pottier francois.pottier@inria.fr Jonathan Protzenko jonathan.protzenko@inria.fr INRIA FSFMA'13 Jonathan Protzenko (INRIA) The Mezzo language

More information

Compositional Cutpoint Verification

Compositional Cutpoint Verification Compositional Cutpoint Verification Eric Smith (Stanford University) Collaborators: David Dill (Stanford University) David Hardin (Rockwell Collins) Contact ewsmith@stanford.edu Background Based on A Symbolic

More information

Lecture 4. First order logic is a formal notation for mathematics which involves:

Lecture 4. First order logic is a formal notation for mathematics which involves: 0368.4435 Automatic Software Verification April 14, 2015 Lecture 4 Lecturer: Mooly Sagiv Scribe: Nimrod Busany, Yotam Frank Lesson Plan 1. First order logic recap. 2. The SMT decision problem. 3. Basic

More information

Verification of the Functional Behavior of a Floating-Point Program: an Industrial Case Study

Verification of the Functional Behavior of a Floating-Point Program: an Industrial Case Study Verification of the Functional Behavior of a Floating-Point Program: an Industrial Case Study Claude Marché To cite this version: Claude Marché. Verification of the Functional Behavior of a Floating-Point

More information

Formal C semantics: CompCert and the C standard

Formal C semantics: CompCert and the C standard Formal C semantics: CompCert and the C standard Robbert Krebbers 1, Xavier Leroy 2, and Freek Wiedijk 1 1 ICIS, Radboud University Nijmegen, The Netherlands 2 Inria Paris-Rocquencourt, France Abstract.

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information

A short manual for the tool Accumulator

A short manual for the tool Accumulator A short manual for the tool Accumulator ZHAO Jianhua State Key Laboratory of Novel Software Technology Dept. of Computer Sci. and Tech. Nanjing University Nanjing, Jiangsu, P.R.China 210093 zhaojh@nju.edu.cn

More information

The Prototype Verification System PVS

The Prototype Verification System PVS The Prototype Verification System PVS Wolfgang Schreiner Wolfgang.Schreiner@risc.uni-linz.ac.at Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria http://www.risc.uni-linz.ac.at

More information

An Industrially Useful Prover

An Industrially Useful Prover An Industrially Useful Prover J Strother Moore Department of Computer Science University of Texas at Austin July, 2017 1 Recap Yesterday s Talk: ACL2 is used routinely in the microprocessor industry to

More information

Formal Methods. CITS5501 Software Testing and Quality Assurance

Formal Methods. CITS5501 Software Testing and Quality Assurance Formal Methods CITS5501 Software Testing and Quality Assurance Pressman, R. Software Engineering: A Practitioner s Approach. Chapter 28. McGraw-Hill, 2005 The Science of Programming, David Gries, 1981

More information

DPLL(Γ+T): a new style of reasoning for program checking

DPLL(Γ+T): a new style of reasoning for program checking DPLL(Γ+T ): a new style of reasoning for program checking Dipartimento di Informatica Università degli Studi di Verona Verona, Italy June, 2011 Motivation: reasoning for program checking Program checking

More information