Formal Verification of Programs and Their Transformations

Size: px
Start display at page:

Download "Formal Verification of Programs and Their Transformations"

Transcription

1 Formal Verification of Programs and Their Transformations Guodong Li Advisor : Ganesh Gopalakrishnan June 25,

2 Dissertation statement Formal methods are essential for reliable software design. For maximum effectiveness, one should tailor it to the domain, the program representation, and the kind of analysis insights being sought. This dissertation takes three widely different domains and concretely illustrates what formal methods worked for each. 2

3 Outline Formal Model and Analysis Program semantics Reasoning mechanisms Three Case Studies A trusted compiler from logic specifications to assembly code A formalization of MPI 2.0 A symbolic checker for CUDA kernel programs 3

4 Meaning of Programs Euclid s s algorithm for computing GCD int gcd(int x, int y) { while (x!= y) do if x <= y then y = y - x; else x = x - y; } gcd(a,b) = if a=b then a else if a>b then gcd(a-b,b) else gcd(a,b-a) 4

5 Program Semantics Operational semantics: program behaviour: states and transitions granularity: big-step, small-step, Denotational semantics: programs as state transformers Axiomatic semantics: programs as predicate transformers properties of states as logic assertions 5

6 Examples of Operational Semantics Robin Milner's semantics for Standard ML Xavier Leory's semantics for a subset of C (Clight Clight) 6

7 Main Issues The correctness of the semantics Formal modeling of a language and its semantics Soundness checking, e.g. static and dynamic type checking The usability of the semantics It must be convenient (e.g. manually) to reason about the programs w.r.t the semantics The reasoning procedure should be as automated as possible 7

8 Example: reasoning about imperative intermediate languages of our compiler Use Hoare logic to reason about the language Synthesize a mathematical function from an imperative program 8

9 A language satisfying the two requirements (correctness and usability) HOL's specification language a logic language embedded in the higher order logic of HOL its semantics is ensured to be correct (w.r.t the logic) the semantics is tractable (i.e. extremely easy to reason about) since all reasoning mechanisms in HOL are built on it. 9

10 Example f1(x, a) = if (x = 0) then (x,a) else f1 (x - 1, x * a) f2 x = if (x = 0) then 1 else x * f2(x - 1) The semantics is transparent (defined by the logic of the theorem prover) no operational or denotational semantics The semantics is executable e.g. rewrite f2 3 to 6 The semantics is tractable e.g. induct on x to prove x. #2(f1(x,1)) = f2 x 10

11 This language is expressive A logic version of a large subset of Standard ML 11

12 Case Study I: compiling HOL specs A problem: programs run on real machines; compilers may introduce bugs when translating a high level program. Our solution Specify systems (like cryptographic algorithms) in the HOL logic Compile the specifications to assembly Automatically prove the correctness of the compilation 12

13 Example: Trusted Compiler source transformation proof of equivalence code generation 13

14 Compilation Front-end: removing high-level features such as polymorphism, higher-order functions, pattern matching and composite expressions. Mid-end: normalization, inline expansion, register allocation and optimizations (such as SSA conversion, dead code elimination, common expression elimination constant folding, code motion, ect.) Back-end HSL (Heap and Stack Level) CFL (Control Flow Level) ARM SAL (Structured Assembly Language) ARM formal semantics and reasoning mechanisms 14

15 Translation Validation (not verifying the compiler itself) Per-run based proof: the given source and its target is equivalent. We've implemented two register allocators offline: use traditional graph coloring algorithms online: use a small set of rewriting rules The result can be β-reduced to a form that is α-equivalent to original expression. Round ((y,z),(k0,k1,k2,k3),s) = let s' = s + DELTA in let y' = y + ShiftXor(z, s', k0, k1) in ((y', z + ShiftXor(y', s', k2, k3)), (k0,k1,k2,k3), s')` Round ((r0,r1),(r2,r3,m1,m2),m3) = let m4 = r2 in let r2 = m3 in let r2 = r2 + DELTA in let m3 = r3 in let r3 = ShiftXor (r1,r2,m4,m3) in let r0 = r0 + r3 in let r3 = ShiftXor (r0,r2,m1,m2) in let r1 = r1 + r3 in ((r0,r1),(m4,m3,m1,m2),r2) 15

16 Summary of the trusted compiler A proof-based compiler from a higher order logic to assembly (both abstract and realistic). specify programs as mathematical (and logic) functions translate to low-level executable format (e.g. assembly) by proof perform ad-hol translation validation rely heavily on term rewriting Verification Method: mechanical theorem proving translation validation (by comparing the source and target program) 16

17 Case Studies II and III Address concurrent programs Much more difficult to handle concurrent behaviors are tricky Not use (interactive) theorem proving apply more automated (yet less rigid) methods such as model checking and constraint solving 17

18 Example of CPU-GPU hardware/software OpenCL CPU / GPU Communication (image courtesy Khronos Group) 18

19 Parallel Programming Models Message Passing (e.g. MPI) Process 0 Process 1 Process 2 Process 3 SIMD (e.g. CUDA) Grid 1 Block (0, 0) Block (0, 1) Block (1, 0) Block (1, 1) Block (2, 0) Block (2, 1) Block (2, 0) Thread Thread (0, 0) (1, 0) Thread (0, 1) Thread (1, 1) Thread Thread (0, 2) (1, 2) Thread (2, 0) Thread (2, 1) Thread (2, 2) Thread (3, 0) Thread (3, 1) Thread (3, 2) Thread (4, 0) Thread (4, 1) Thread (4, 2) Global Memory Shared Memory 19

20 Concurrency introduces new challenges: Exponentially growing interleavings init: x = 0; y = 0; t0: x++; if (x > 1) assert(0); t1: y++; x++; Traditional testing is ineffective: Question : How can you shuffle the actions of threads t0 and t1 so as to cause the assert(0) assert(0) to be reached? (answer in next slide) 20

21 Reason why testing is ineffective: Exponentially growing interleavings and input values init: x = 0; y = 0; t0: x++; if (x > 1) assert(0); t1: y++; x++; Question : How can you shuffle the actions of threads t0 and t1 so as to cause the assert(0) assert(0) to be reached? Ans: See the arrows! BEGIN HERE! 21

22 Testing v.s Formal Analysis Ad-hoc Testing Incomplete analysis Formal Verification exhaustive analysis Why formal analysis works in practice: * It applies Exhaustive Analysis, as opposed to Incomplete Analysis * It may rely on Abstraction (both manual, and automated) 22

23 Case Study II: Formalizing concurrent APIs (MPI 2.0) A Simple MPI Program P0 MPI_Irecv(rcvbuf1 Irecv(rcvbuf1, *, req1); MPI_Irecv(rcvbuf2 Irecv(rcvbuf2, from 1, req2); MPI_Wait(req1); MPI_Wait(req2); MPI_Bcast(revbuf3 Bcast(revbuf3, root = 1); P1 sendbuf1 = 10; MPI_Bcast(sendbuf1 Bcast(sendbuf1, root = 1); MPI_Isend(sendbuf2 Isend(sendbuf2, to 0, req); MPI_Wait(req); P2 sendbuf2 = 20; MPI_Isend(sendbuf2 Isend(sendbuf2, to 0, req); MPI_Bcast(recvbuf2 Bcast(recvbuf2, root = 1); MPI_Wait(req); 23

24 Concurrent Behaviors P0 Irecv Irecv(from 1) Wait Wait Bcast P1 Bcast Isend Wait P2 Isend Bcast Wait schedule 1: OK P0 Irecv Irecv(from 1) Wait Wait Bcast P1 Bcast Isend Wait P2 Isend Bcast Wait schedule 2: deadlock! 24

25 Verification of MPI Programs 1.Formal Executable Spec of the operations of MPI written in TLA+ 2.Simple MPI / C programs are compiled into TLA+ models and linked with Formal Semantics all under Microsoft VisualStudio (by Robert Palmer and Micheal DeLisi) 3.Errors in Litmus Tests generate error traces that can step the Visual-Studio debugger 25

26 Operational Semantics A state consists of all the MPI objects A MPI function is modeled by a transition rule relating the old state and new state A scheduler to perform message passing and synchronization Low level details (e.g. topology) are abstracted away 26

27 Example: the transfer rule 27

28 The Specification Size of the MPI 2.0 specification (excluding comments and blank lines) 28

29 Summary of the MPI Verification concrete input C MPI program Microsoft Phoenix Compiler TLA+ code TLC Model Checker TLA+ model of MPI calls Problems: Require concrete configuration and input values; Need partial order reduction (and symmetry reduction ) to prune redundant interleavings 29

30 An Alternative: symbolic analysis t0: x++; if (x > 1) assert(0); t1: y++; x++; Symbolic methods can Cover all possible input values in one go Cover all possible interleavings in one go Can smartly avoid un-necessary interleavings Made possible by CONSTRAINT SOLVING ENGINES (Satisfiability Modulo Theory solvers (SMT solvers) which work FAR BETTER than exhaustive search in practice. 30

31 Case Study III: Symbolic Analysis of CUDA kernels CUDA kernel programs are a good fit They are extremely light-weight threaded programs They are SIMD (Single Instruction Multiple Data) programs with high symmetry. The syntax is simple (e.g. without dynamic memory allocation and recursive function calls) Only simple API calls (e.g. math functions) are supported; no need to interpret native API calls. 31

32 The Tool (PUG) Flow C Application Containing Multiple Kernels Analyzer Kernel Descriptions PUG Analyzer for Kernels Verification Results CPU / GPU Communication Codes Kernel Invocation Contexts CPU / GPU Communication Verifier (CGV) Verification Results 32

33 Internal Architecture of PUG Kernel Program In C Analyzer supported by LLNL Rose Verification Conditions in SMT format SMT checker for unsatisfiability UNSAT: The instance is OK OK (no bug is found ) SAT: The instance has bugs (the SAT instance gives a counter example) 33

34 Model programs as logical formulas (symbolic constraints) Program: Symbolic Constraint P: if i > 0 { j = i * 10; k = j i;} else k = i + k; ite (i0 > 0, j1 = i0 * 10 k1 = j1 i0, k1 1 = i0 0 + k0 j1 = j0 ) Claim: Input: i = x, k = y Output: k = x + y? P i0 = x k0 = y k1 x + y Satisfiable: the claim is false Executable: if x and y are concrete then k1's concrete value is returned by the solver 34

35 Concurrency: different interleavings (schedules) lead to different results v is shared; initially v = 0 thread t1 thread t2 v := v + 1; v := a; v := b; v s s possible value after the execution may be 1, a, b, a + 1 or b + 1 schedule 1: v := 0 v := a v := b v := schedule 2: v := b schedule 3: v := a v := a + 1 schedule 4: v := b v := b

36 Explore the interleavings (schedules) in a symbolic manner v is shared; initially v = 0 thread t1 thread t2 v := v + 1; v := a; v := b; with SIds (schedule ids) thread t1 thread t2 v[v t1 1 ] := v[v t1 0] ] + 1; v[v t2 1] ] := a; v[v t2 2] ] := b; Constraints (as logical formulas) v t1 0,, v t1 1,, v t2 1,, v t2 2 {1,2,3,4} v t1 0 < v t1 1 /\ v t2 1 < v t2 2 for i {2,3,4}, v[i] s s previous value is v[i-1] the solutions of these constraints give all the possible schedules A schedule corresponding to the a solution of the constraint t2 1 = 1 t1 0 = 2 t2 2 = 3 t1 1 = 4 v t2 v t1 v t2 v t1 v[v 1 ] := a v = a read v[v 0 ] v = a v[v 2] ] := b v = b v[v 1 ] := v[v 0] ] + 1 v = b

37 Checking specific properties (e.g. races) Can two threads ever conflict on the same memory location? void global kernel (int *a, int b, int N) { int idx = blockidx.x * blockdim.x + threadidx.x; if (idx < N) { a[idx] = a[idx] + b; } } A race occurs when (1) different threads access the same element; (2) at least one of the accesses is write. (and (and (/= t1.x t2.x) (bv-lt t1.x bdim.x) (bv-lt t2.x bdim.x)) (and (= idx1@t1 (bv-add (bv-mul bid.x bdim.x) t1.x)) (ite (bv-lt idx1@t1 N0) true (= a1 a0))) (and (= idx1@t2 (bv-add (bv-mul bid.x bdim.x) t2.x)) (ite (bv-lt idx1@t2 N0) true (= a1 a0))) true true (or (and (bv-lt idx1@t1 N0) (bv-lt idx1@t2 N0) (= idx1@t1 idx1@t2)) (and (bv-lt idx1@t1 N0) (bv-lt idx1@t2 N0) (= idx1@t1 idx1@t2)))) Unsatisfiable No races or synchronization errors are found. solving time = 0.01s 37

38 PUG in Action : Example with a race void global kernel (int *a, int b, int N) { int idx = blockidx.x * blockdim.x + threadidx.x; if (idx < N) a[idx] = a[idx-1] + b; } race occurs for t1 = 0 and t2 = 1. Witness Tells us Exactly how Race happens! (and (and (/= t1.x t2.x) (bv-lt t1.x bdim.x) (bv-lt t2.x bdim.x)) (and (= idx1@t1 (bv-add (bv-mul bid.x bdim.x) t1.x)) (ite (bv-lt idx1@t1 N0) true (= a1 a0))) (and (= idx1@t2 (bv-add (bv-mul bid.x bdim.x) t2.x)) (ite (bv-lt idx1@t2 N0) true (= a1 a0))) true true (or (and (bv-lt idx1@t1 N0) (bv-lt idx1@t2 N0) (= (bv-sub idx1@t1 0b ) idx1@t2)) (and (bv-lt idx1@t1 N0) (bv-lt idx1@t2 N0) (= idx1@t1 idx1@t2)))) satisfiable (= bid.x 0b ) (= bdim.x 0b ) (= t1.x 0b ) (= t2.x 0b ) (= idx1@t1 0b ) (= N0 0b ) (= idx1@t2 0b ) (= (a1 0b ) 0b ) (= (a0 0b ) 0b )!!!!!!! Found conflict: There exists a race on variable a. solving time = 0.01s 38

39 Other Details Modeling Barrier Intervals Handling Conditional Statements Reducing Checking Complexity through Serialization (Partial Order Reduction) Checking Consistent Barrier Usage Incremental Solving Handling Aliasing Incorporating Memory Consistency Models Handling Loops Efficiently (Loop Abstraction) Checking performance bugs (e.g. bank conflicts) 39

40 Experimental Results (Conflict Checking) Kernels (in loc +O +C +R B.C. Time CUDA SDK ) (pass) Bitonic Sort 65 LOW 2.2s MatrixMult 102 * * HIGH <1s Histogram LOW 2.9s Sobel 130 * HIGH 5.6s Reduction 315 HIGH 3.4s Scan 255 * * * LOW 3.5s Scan Large 237 * * LOW 5.7s Nbody 206 * HIGH 7.4s Bisect Large 1400 * * HIGH 44s Radix Sort 1150 * * * LOW 39s Eigenvalues 2300 * * * HIGH 68s + O: require bit-vector computations do not overflow +C: require constraints on the input values +R: require manual refinement B.C.: measure how serious the bank conflicts are Time: SMT solving time 40

41 Ongoing Work Parameterized verification (the analysis is independent of the number of threads) Equivalence checking (tells whether the optimized version of a kernel is equivalent to the original one) Combination of the run-time and the static method Automatic test generation; use the symbolic analyzer to generate inputs for the runtime checker 41

42 Review of this talk 1.A trusted compiler from logic specifications to assembly code 2.A formaliation of MPI programs 3.A symbolic checker for CUDA kernels Method Theorem Proving (1) Model Checking (2) Generality Good Fair Poor Rigidity Good Poor Fair Constraint Solving (3) Productivity Poor Fair Good Automation Poor Good Good 42

43 Thank You! Questions? 43

Scalable SMT-based Verification for GPU Kernel Functions

Scalable SMT-based Verification for GPU Kernel Functions Scalable SMT-based Verification for GPU Kernel Functions Guodong Li and Ganesh Gopalakrishnan Salt Lake City, UT 84112, USA www.cs.utah.edu/fv/pug GPUs are fueling HPC advances! Tianhe-1a : World s fastest

More information

FORMAL VERIFICATION OF PROGRAMS AND THEIR TRANSFORMATIONS

FORMAL VERIFICATION OF PROGRAMS AND THEIR TRANSFORMATIONS FORMAL VERIFICATION OF PROGRAMS AND THEIR TRANSFORMATIONS by Guodong Li A dissertation submitted to the faculty of The University of Utah in partial fulfillment of the requirements for the degree of Doctor

More information

PUG (Prover of User GPU Programs) v0.2

PUG (Prover of User GPU Programs) v0.2 PUG (Prover of User GPU Programs) v0.2 Guodong Li School of Computing, University of Utah 1 Installation For details on PUG, see our forthcoming FSE 2010 paper. This manual pertains to our tool for which

More information

Scalable SMT-Based Verification of GPU Kernel Functions

Scalable SMT-Based Verification of GPU Kernel Functions Scalable SMT-Based Verification of GPU Kernel Functions Guodong Li School of Computing, University of Utah UT, USA ligd@cs.utah.edu Ganesh Gopalakrishnan School of Computing, University of Utah UT, USA

More information

: A Symbolic Verifier of GPU Programs

: A Symbolic Verifier of GPU Programs 1 PUG : A Symbolic Verifier of GPU Programs Guodong Li, Ganesh Gopalakrishnan, Robert M Kirby and Dan Quinlan School of Computing, University of Utah, Salt Lake City, UT Email: {ligd, ganesh, kirby@csutahedu

More information

Trickle: Automated Infeasible Path

Trickle: Automated Infeasible Path Trickle: Automated Infeasible Path Detection Using All Minimal Unsatisfiable Subsets Bernard Blackham, Mark Liffiton, Gernot Heiser School of Computer Science & Engineering, UNSW Software Systems Research

More information

Verifying Concurrent Programs

Verifying Concurrent Programs Verifying Concurrent Programs Daniel Kroening 8 May 1 June 01 Outline Shared-Variable Concurrency Predicate Abstraction for Concurrent Programs Boolean Programs with Bounded Replication Boolean Programs

More information

The design of a programming language for provably correct programs: success and failure

The design of a programming language for provably correct programs: success and failure The design of a programming language for provably correct programs: success and failure Don Sannella Laboratory for Foundations of Computer Science School of Informatics, University of Edinburgh http://homepages.inf.ed.ac.uk/dts

More information

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013

Principles of Program Analysis. Lecture 1 Harry Xu Spring 2013 Principles of Program Analysis Lecture 1 Harry Xu Spring 2013 An Imperfect World Software has bugs The northeast blackout of 2003, affected 10 million people in Ontario and 45 million in eight U.S. states

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

Turning proof assistants into programming assistants

Turning proof assistants into programming assistants Turning proof assistants into programming assistants ST Winter Meeting, 3 Feb 2015 Magnus Myréen Why? Why combine proof- and programming assistants? Why proofs? Testing cannot show absence of bugs. Some

More information

Formal Analysis for Debugging and Performance Optimization of MPI

Formal Analysis for Debugging and Performance Optimization of MPI Formal Analysis for Debugging and Performance Optimization of MPI Ganesh Gopalakrishnan Robert M. Kirby School of Computing University of Utah NSF CNS 0509379 1 On programming machines that turn electricity

More information

Formalization of Incremental Simplex Algorithm by Stepwise Refinement

Formalization of Incremental Simplex Algorithm by Stepwise Refinement Formalization of Incremental Simplex Algorithm by Stepwise Refinement Mirko Spasić, Filip Marić Faculty of Mathematics, University of Belgrade FM2012, 30. August 2012. Overview 1 Introduction 2 Approach

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

Static program checking and verification

Static program checking and verification Chair of Software Engineering Software Engineering Prof. Dr. Bertrand Meyer March 2007 June 2007 Slides: Based on KSE06 With kind permission of Peter Müller Static program checking and verification Correctness

More information

Symbolic and Concolic Execution of Programs

Symbolic and Concolic Execution of Programs Symbolic and Concolic Execution of Programs Information Security, CS 526 Omar Chowdhury 10/7/2015 Information Security, CS 526 1 Reading for this lecture Symbolic execution and program testing - James

More information

Runtime Checking for Program Verification Systems

Runtime Checking for Program Verification Systems Runtime Checking for Program Verification Systems Karen Zee, Viktor Kuncak, and Martin Rinard MIT CSAIL Tuesday, March 13, 2007 Workshop on Runtime Verification 1 Background Jahob program verification

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

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

How much is a mechanized proof worth, certification-wise?

How much is a mechanized proof worth, certification-wise? How much is a mechanized proof worth, certification-wise? Xavier Leroy Inria Paris-Rocquencourt PiP 2014: Principles in Practice In this talk... Some feedback from the aircraft industry concerning the

More information

Matching Logic. Grigore Rosu University of Illinois at Urbana-Champaign

Matching Logic. Grigore Rosu University of Illinois at Urbana-Champaign Matching Logic Grigore Rosu University of Illinois at Urbana-Champaign Joint work with Andrei Stefanescu and Chucky Ellison. Started with Wolfram Schulte at Microsoft Research in 2009 Question could it

More information

Lecture 11 Lecture 11 Nov 5, 2014

Lecture 11 Lecture 11 Nov 5, 2014 Formal Verification/Methods Lecture 11 Lecture 11 Nov 5, 2014 Formal Verification Formal verification relies on Descriptions of the properties or requirements Descriptions of systems to be analyzed, and

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Translation Validation for a Verified OS Kernel

Translation Validation for a Verified OS Kernel To appear in PLDI 13 Translation Validation for a Verified OS Kernel Thomas Sewell 1, Magnus Myreen 2, Gerwin Klein 1 1 NICTA, Australia 2 University of Cambridge, UK L4.verified sel4 = a formally verified

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

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001

Research Collection. Formal background and algorithms. Other Conference Item. ETH Library. Author(s): Biere, Armin. Publication Date: 2001 Research Collection Other Conference Item Formal background and algorithms Author(s): Biere, Armin Publication Date: 2001 Permanent Link: https://doi.org/10.3929/ethz-a-004239730 Rights / License: In Copyright

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

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. !

! Use of formal notations. ! in software system descriptions. ! for a broad range of effects. ! and varying levels of use. ! What Are Formal Methods? David S. Rosenblum ICS 221 Winter 2001! Use of formal notations! first-order logic, state machines, etc.! in software system descriptions! system models, constraints, specifications,

More information

IronFleet. Dmitry Bondarenko, Yixuan Chen

IronFleet. Dmitry Bondarenko, Yixuan Chen IronFleet Dmitry Bondarenko, Yixuan Chen A short survey How many people have the confidence that your Paxos implementation has no bug? How many people have proved that the implementation is correct? Why

More information

Distributed Systems Programming (F21DS1) Formal Verification

Distributed Systems Programming (F21DS1) Formal Verification Distributed Systems Programming (F21DS1) Formal Verification Andrew Ireland Department of Computer Science School of Mathematical and Computer Sciences Heriot-Watt University Edinburgh Overview Focus on

More information

On partial order semantics for SAT/SMT-based symbolic encodings of weak memory concurrency

On partial order semantics for SAT/SMT-based symbolic encodings of weak memory concurrency On partial order semantics for SAT/SMT-based symbolic encodings of weak memory concurrency Alex Horn and Daniel Kroening University of Oxford April 30, 2015 Outline What s Our Problem? Motivation and Example

More information

Model Checking and Its Applications

Model Checking and Its Applications Model Checking and Its Applications Orna Grumberg Technion, Israel Verification and Deduction Mentoring Workshop July 13, 2018 1 Personal data Ph.d. in (non-automated) verification Postdoc in Model Checking

More information

Software Model Checking. Xiangyu Zhang

Software Model Checking. Xiangyu Zhang Software Model Checking Xiangyu Zhang Symbolic Software Model Checking CS510 S o f t w a r e E n g i n e e r i n g Symbolic analysis explicitly explores individual paths, encodes and resolves path conditions

More information

Satisfiability Modulo Theories: ABsolver

Satisfiability Modulo Theories: ABsolver Satisfiability Modulo Theories: ABsolver Michael Tautschnig Joint work with: Andreas Bauer Martin Leucker Christian Schallhart Michael Tautschnig 1 Outline 1. Introduction Michael Tautschnig 2 Outline

More information

GPU Programming with Ateji PX June 8 th Ateji All rights reserved.

GPU Programming with Ateji PX June 8 th Ateji All rights reserved. GPU Programming with Ateji PX June 8 th 2010 Ateji All rights reserved. Goals Write once, run everywhere, even on a GPU Target heterogeneous architectures from Java GPU accelerators OpenCL standard Get

More information

Proof Carrying Code(PCC)

Proof Carrying Code(PCC) Discussion p./6 Proof Carrying Code(PCC Languaged based security policy instead of OS-based A mechanism to determine with certainity that it is safe execute a program or not Generic architecture for providing

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

arxiv: v2 [cs.pl] 3 Apr 2018

arxiv: v2 [cs.pl] 3 Apr 2018 1 Scheduling Constraint Based Abstraction Refinement for Multi-Threaded Program Verification arxiv:1708.08323v2 [cs.pl] 3 Apr 2018 LIANGZE YIN, School of Computer, National University of Defense Technology,

More information

Synchronous Specification

Synchronous Specification Translation Validation for Synchronous Specification in the Signal Compiler Van-Chan Ngo Jean-Pierre Talpin Thierry Gautier INRIA Rennes, France FORTE 2015 Construct a modular translation validationbased

More information

Simply-Typed Lambda Calculus

Simply-Typed Lambda Calculus #1 Simply-Typed Lambda Calculus #2 Back to School What is operational semantics? When would you use contextual (small-step) semantics? What is denotational semantics? What is axiomatic semantics? What

More information

Programming Languages

Programming Languages : Winter 2010 Principles of Programming Languages Lecture 1: Welcome, etc. Ranjit Jhala UC San Diego Computation & Interaction Precisely expressed by PL Dependence means need for analysis Safety Security

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

Proving the Correctness of Distributed Algorithms using TLA

Proving the Correctness of Distributed Algorithms using TLA Proving the Correctness of Distributed Algorithms using TLA Khushboo Kanjani, khush@cs.tamu.edu, Texas A & M University 11 May 2007 Abstract This work is a summary of the Temporal Logic of Actions(TLA)

More information

Formal Methods for Aviation Software Design and Certification

Formal Methods for Aviation Software Design and Certification Formal Methods for Aviation Software Design and Certification PART II: Formal Methods Gordon Stewart COUNT Short Course Series May 24-26 RUSS COLLEGE OF ENGINEERING AND TECHNOLOGY DO- 333: What Are Formal

More information

Lecture 5 - Axiomatic semantics

Lecture 5 - Axiomatic semantics Program Verification March 2014 Lecture 5 - Axiomatic semantics Lecturer: Noam Rinetzky Scribes by: Nir Hemed 1.1 Axiomatic semantics The development of the theory is contributed to Robert Floyd, C.A.R

More information

CS 351 Design of Large Programs Programming Abstractions

CS 351 Design of Large Programs Programming Abstractions CS 351 Design of Large Programs Programming Abstractions Brooke Chenoweth University of New Mexico Spring 2019 Searching for the Right Abstraction The language we speak relates to the way we think. The

More information

Hoare logic. A proof system for separation logic. Introduction. Separation logic

Hoare logic. A proof system for separation logic. Introduction. Separation logic Introduction Hoare logic Lecture 6: Examples in separation logic In the previous lecture, we saw how reasoning about pointers in Hoare logic was problematic, which motivated introducing separation logic.

More information

Lecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning

Lecture 1 Contracts : Principles of Imperative Computation (Fall 2018) Frank Pfenning Lecture 1 Contracts 15-122: Principles of Imperative Computation (Fall 2018) Frank Pfenning In these notes we review contracts, which we use to collectively denote function contracts, loop invariants,

More information

K and Matching Logic

K and Matching Logic K and Matching Logic Grigore Rosu University of Illinois at Urbana-Champaign Joint work with the FSL group at UIUC (USA) and the FMSE group at UAIC (Romania) Question could it be that, after 40 years of

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 310 Advanced Data Structures and Algorithms Recursion June 27, 2017 Tong Wang UMass Boston CS 310 June 27, 2017 1 / 20 Recursion Recursion means defining something, such as a function, in terms of itself

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

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

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

CS/CoE 1541 Final exam (Fall 2017). This is the cumulative final exam given in the Fall of Question 1 (12 points): was on Chapter 4

CS/CoE 1541 Final exam (Fall 2017). This is the cumulative final exam given in the Fall of Question 1 (12 points): was on Chapter 4 CS/CoE 1541 Final exam (Fall 2017). Name: This is the cumulative final exam given in the Fall of 2017. Question 1 (12 points): was on Chapter 4 Question 2 (13 points): was on Chapter 4 For Exam 2, you

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

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

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions)

CIS 1.5 Course Objectives. a. Understand the concept of a program (i.e., a computer following a series of instructions) By the end of this course, students should CIS 1.5 Course Objectives a. Understand the concept of a program (i.e., a computer following a series of instructions) b. Understand the concept of a variable

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far. Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)

More information

Module 3. Requirements Analysis and Specification. Version 2 CSE IIT, Kharagpur

Module 3. Requirements Analysis and Specification. Version 2 CSE IIT, Kharagpur Module 3 Requirements Analysis and Specification Lesson 6 Formal Requirements Specification Specific Instructional Objectives At the end of this lesson the student will be able to: Explain what a formal

More information

Lecture Notes on Contracts

Lecture Notes on Contracts Lecture Notes on Contracts 15-122: Principles of Imperative Computation Frank Pfenning Lecture 2 August 30, 2012 1 Introduction For an overview the course goals and the mechanics and schedule of the course,

More information

Finite Model Generation for Isabelle/HOL Using a SAT Solver

Finite Model Generation for Isabelle/HOL Using a SAT Solver Finite Model Generation for / Using a SAT Solver Tjark Weber webertj@in.tum.de Technische Universität München Winterhütte, März 2004 Finite Model Generation for / p.1/21 is a generic proof assistant: Highly

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

GPU Programming. Parallel Patterns. Miaoqing Huang University of Arkansas 1 / 102

GPU Programming. Parallel Patterns. Miaoqing Huang University of Arkansas 1 / 102 1 / 102 GPU Programming Parallel Patterns Miaoqing Huang University of Arkansas 2 / 102 Outline Introduction Reduction All-Prefix-Sums Applications Avoiding Bank Conflicts Segmented Scan Sorting 3 / 102

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

Applications of Program analysis in Model-Based Design

Applications of Program analysis in Model-Based Design Applications of Program analysis in Model-Based Design Prahlad Sampath (Prahlad.Sampath@mathworks.com) 2018 by The MathWorks, Inc., MATLAB, Simulink, Stateflow, are registered trademarks of The MathWorks,

More information

Verifying Concurrent ML programs

Verifying Concurrent ML programs Verifying Concurrent ML programs a research proposal Gergely Buday Eszterházy Károly University Gyöngyös, Hungary Synchron 2016 Bamberg December 2016 Concurrent ML is a synchronous language a CML program

More information

INF672 Protocol Safety and Verification. Karthik Bhargavan Xavier Rival Thomas Clausen

INF672 Protocol Safety and Verification. Karthik Bhargavan Xavier Rival Thomas Clausen INF672 Protocol Safety and Verication Karthik Bhargavan Xavier Rival Thomas Clausen 1 Course Outline Lecture 1 [Today, Sep 15] Introduction, Motivating Examples Lectures 2-4 [Sep 22,29, Oct 6] Network

More information

School of Computer & Communication Sciences École Polytechnique Fédérale de Lausanne

School of Computer & Communication Sciences École Polytechnique Fédérale de Lausanne Principles of Dependable Systems Building Reliable Software School of Computer & Communication Sciences École Polytechnique Fédérale de Lausanne Winter 2006-2007 Outline Class Projects: mtgs next week

More information

Operational Semantics 1 / 13

Operational Semantics 1 / 13 Operational Semantics 1 / 13 Outline What is semantics? Operational Semantics What is semantics? 2 / 13 What is the meaning of a program? Recall: aspects of a language syntax: the structure of its programs

More information

Model Checking Embedded C Software using k-induction and Invariants

Model Checking Embedded C Software using k-induction and Invariants FEDERAL UNIVERSITY OF RORAIMA and FEDERAL UNIVESITY OF AMAZONAS Model Checking Embedded C Software using k-induction and Invariants Herbert Rocha, Hussama Ismail, Lucas Cordeiro and Raimundo Barreto Agenda

More information

Parallel Programming and Debugging with CUDA C. Geoff Gerfin Sr. System Software Engineer

Parallel Programming and Debugging with CUDA C. Geoff Gerfin Sr. System Software Engineer Parallel Programming and Debugging with CUDA C Geoff Gerfin Sr. System Software Engineer CUDA - NVIDIA s Architecture for GPU Computing Broad Adoption Over 250M installed CUDA-enabled GPUs GPU Computing

More information

HECTOR: Formal System-Level to RTL Equivalence Checking

HECTOR: Formal System-Level to RTL Equivalence Checking ATG SoC HECTOR: Formal System-Level to RTL Equivalence Checking Alfred Koelbl, Sergey Berezin, Reily Jacoby, Jerry Burch, William Nicholls, Carl Pixley Advanced Technology Group Synopsys, Inc. June 2008

More information

Formal Verification in Industry

Formal Verification in Industry Formal Verification in Industry 1 Formal Verification in Industry John Harrison Intel Corporation The cost of bugs Formal verification Machine-checked proof Automatic and interactive approaches HOL Light

More information

Predicate Refinement Heuristics in Program Verification with CEGAR

Predicate Refinement Heuristics in Program Verification with CEGAR Predicate Refinement Heuristics in Program Verification with CEGAR Tachio Terauchi (JAIST) Part of this is joint work with Hiroshi Unno (U. Tsukuba) 1 Predicate Abstraction with CEGAR Iteratively generate

More information

Towards Certified Compilation for IEC 61499

Towards Certified Compilation for IEC 61499 Towards Certified Compilation for IEC 61499 Per Lindgren and Marcus Lindner Luleå University of Technology David Pereira and Luís Miguel Pinho CISTER / INESC TEC, ISEP 2016-09-06 1 Goal: verified software

More information

Introduction to Axiomatic Semantics (1/2)

Introduction to Axiomatic Semantics (1/2) #1 Introduction to Axiomatic Semantics (1/2) How s The Homework Going? Remember: just do the counterexample guided abstraction refinement part of DPLL(T). If you notice any other errors, those are good

More information

An experiment with variable binding, denotational semantics, and logical relations in Coq. Adam Chlipala University of California, Berkeley

An experiment with variable binding, denotational semantics, and logical relations in Coq. Adam Chlipala University of California, Berkeley A Certified TypePreserving Compiler from Lambda Calculus to Assembly Language An experiment with variable binding, denotational semantics, and logical relations in Coq Adam Chlipala University of California,

More information

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers.

The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. Semantics The semantics of a programming language is concerned with the meaning of programs, that is, how programs behave when executed on computers. The semantics of a programming language assigns a precise

More information

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5

Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 Formal Methods of Software Design, Eric Hehner, segment 24 page 1 out of 5 [talking head] This lecture we study theory design and implementation. Programmers have two roles to play here. In one role, they

More information

Formal Verification. Lecture 10

Formal Verification. Lecture 10 Formal Verification Lecture 10 Formal Verification Formal verification relies on Descriptions of the properties or requirements of interest Descriptions of systems to be analyzed, and rely on underlying

More information

Automatic Software Verification

Automatic Software Verification Automatic Software Verification Instructor: Mooly Sagiv TA: Oded Padon Slides from Eran Yahav and the Noun Project, Wikipedia Course Requirements Summarize one lecture 10% one lecture notes 45% homework

More information

Crafting a Compiler with C (II) Compiler V. S. Interpreter

Crafting a Compiler with C (II) Compiler V. S. Interpreter Crafting a Compiler with C (II) 資科系 林偉川 Compiler V S Interpreter Compilation - Translate high-level program to machine code Lexical Analyzer, Syntax Analyzer, Intermediate code generator(semantics Analyzer),

More information

CUDA C Programming Mark Harris NVIDIA Corporation

CUDA C Programming Mark Harris NVIDIA Corporation CUDA C Programming Mark Harris NVIDIA Corporation Agenda Tesla GPU Computing CUDA Fermi What is GPU Computing? Introduction to Tesla CUDA Architecture Programming & Memory Models Programming Environment

More information

Program analysis parameterized by the semantics in Maude

Program analysis parameterized by the semantics in Maude Program analysis parameterized by the semantics in Maude A. Riesco (joint work with I. M. Asăvoae and M. Asăvoae) Universidad Complutense de Madrid, Madrid, Spain Workshop on Logic, Algebra and Category

More information

Hyperkernel: Push-Button Verification of an OS Kernel

Hyperkernel: Push-Button Verification of an OS Kernel Hyperkernel: Push-Button Verification of an OS Kernel Luke Nelson, Helgi Sigurbjarnarson, Kaiyuan Zhang, Dylan Johnson, James Bornholt, Emina Torlak, and Xi Wang The OS Kernel is a critical component Essential

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

Seminar in Software Engineering Presented by Dima Pavlov, November 2010

Seminar in Software Engineering Presented by Dima Pavlov, November 2010 Seminar in Software Engineering-236800 Presented by Dima Pavlov, November 2010 1. Introduction 2. Overview CBMC and SAT 3. CBMC Loop Unwinding 4. Running CBMC 5. Lets Compare 6. How does it work? 7. Conclusions

More information

Program Synthesis for Forth Forth Day 2012

Program Synthesis for Forth Forth Day 2012 Program Synthesis for Forth Forth Day 2012 Computer Science UC Berkeley Ras Bodik Mangpo Phitchaya Phothilimthana Tikhon Jelvis Rohin Shah Synthesis with sketches Extend your language with two constructs

More information

Applied Theorem Proving: Modelling Instruction Sets and Decompiling Machine Code. Anthony Fox University of Cambridge, Computer Laboratory

Applied Theorem Proving: Modelling Instruction Sets and Decompiling Machine Code. Anthony Fox University of Cambridge, Computer Laboratory Applied Theorem Proving: Modelling Instruction Sets and Decompiling Machine Code Anthony Fox University of Cambridge, Computer Laboratory Overview This talk will mainly focus on 1. Specifying instruction

More information

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion

introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion introduction to Programming in C Department of Computer Science and Engineering Lecture No. #40 Recursion Linear Recursion Today s video will talk about an important concept in computer science which is

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

Cover Page. The handle holds various files of this Leiden University dissertation

Cover Page. The handle   holds various files of this Leiden University dissertation Cover Page The handle http://hdl.handle.net/1887/22891 holds various files of this Leiden University dissertation Author: Gouw, Stijn de Title: Combining monitoring with run-time assertion checking Issue

More information

Formal Verification Techniques for GPU Kernels Lecture 1

Formal Verification Techniques for GPU Kernels Lecture 1 École de Recherche: Semantics and Tools for Low-Level Concurrent Programming ENS Lyon Formal Verification Techniques for GPU Kernels Lecture 1 Alastair Donaldson Imperial College London www.doc.ic.ac.uk/~afd

More information

Verifying C & C++ with ESBMC

Verifying C & C++ with ESBMC Verifying C & C++ with ESBMC Denis A Nicole dan@ecs.soton.ac.uk CyberSecuritySoton.org [w] @CybSecSoton [fb & tw] ESBMC ESBMC, the Efficient SMT-Based Context-Bounded Model Checker was originally developed

More information

Denotational Semantics of a Simple Imperative Language Using Intensional Logic

Denotational Semantics of a Simple Imperative Language Using Intensional Logic Denotational Semantics of a Simple Imperative Language Using Intensional Logic Marc Bender bendermm@mcmaster.ca CAS 706 - Programming Languages Instructor: Dr. Jacques Carette Dept. of Computing and Software

More information

CSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA

CSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA CSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA Sreepathi Pai October 18, 2017 URCS Outline Background Memory Code Execution Model Outline Background Memory Code Execution Model

More information

A unified machine-checked model for multithreaded Java

A unified machine-checked model for multithreaded Java A unified machine-checked model for multithreaded Java Andre Lochbihler IPD, PROGRAMMING PARADIGMS GROUP, COMPUTER SCIENCE DEPARTMENT KIT - University of the State of Baden-Wuerttemberg and National Research

More information

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine

No model may be available. Software Abstractions. Recap on Model Checking. Model Checking for SW Verif. More on the big picture. Abst -> MC -> Refine No model may be available Programmer Software Abstractions Tests Coverage Code Abhik Roychoudhury CS 5219 National University of Singapore Testing Debug Today s lecture Abstract model (Boolean pgm.) Desirable

More information

GPU programming: CUDA basics. Sylvain Collange Inria Rennes Bretagne Atlantique

GPU programming: CUDA basics. Sylvain Collange Inria Rennes Bretagne Atlantique GPU programming: CUDA basics Sylvain Collange Inria Rennes Bretagne Atlantique sylvain.collange@inria.fr This lecture: CUDA programming We have seen some GPU architecture Now how to program it? 2 Outline

More information

Advanced CUDA Optimization 1. Introduction

Advanced CUDA Optimization 1. Introduction Advanced CUDA Optimization 1. Introduction Thomas Bradley Agenda CUDA Review Review of CUDA Architecture Programming & Memory Models Programming Environment Execution Performance Optimization Guidelines

More information