SS 2017 Software Verification Software Model Checking 2 - Parallelism

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Synthesis, Analysis, and Verification Lecture 04c Lectures: Viktor Kuncak VC Generation for Programs with Data Structures “Beyond Integers”
50.530: Software Engineering
Models of Concurrency Manna, Pnueli.
Satisfiability Modulo Theories (An introduction)
SMT Solvers (an extension of SAT) Kenneth Roe. Slide thanks to C. Barrett & S. A. Seshia, ICCAD 2009 Tutorial 2 Boolean Satisfiability (SAT) ⋁ ⋀ ¬ ⋁ ⋀
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Software Engineering & Automated Deduction Willem Visser Stellenbosch University With Nikolaj Bjorner (Microsoft Research, Redmond) Natarajan Shankar (SRI.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der.
A Semantic Characterization of Unbounded-Nondeterministic Abstract State Machines Andreas Glausch and Wolfgang Reisig 1.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Formal Verification of SpecC Programs using Predicate Abstraction Himanshu Jain Daniel Kroening Edmund Clarke Carnegie Mellon University.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
SAT and SMT solvers Ayrat Khalimov (based on Georg Hofferek‘s slides) AKDV 2014.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
1 First order theories (Chapter 1, Sections 1.4 – 1.5) From the slides for the book “Decision procedures” by D.Kroening and O.Strichman.
This Week Lecture on relational semantics Exercises on logic and relations Labs on using Isabelle to do proofs.
Daniel Kroening and Ofer Strichman Decision Procedures An Algorithmic Point of View Deciding Combined Theories.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
CS357 Lecture 13: Symbolic model checking without BDDs Alex Aiken David Dill 1.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View Basic Concepts and Background.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Selected Decision Procedures and Techniques for SMT More on combination – theories sharing sets – convex theory Un-interpreted function symbols (quantifier-free.
Software Verification 2 Automated Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität and Fraunhofer Institut für.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer Institut.
Software Verification 1 Deductive Verification Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt Universität und Fraunhofer.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
SS 2017 Software Verification Timed Automata
Formal methods: Lecture
SS 2017 Software Verification Bounded Model Checking, Outlook
SS 2017 Software Verification SMT Solving, Partial Order Methods
SS 2017 Software Verification Probabilistic modelling – DTMC / MDP
Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1
Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1
Chapter 2: Data Abstraction 2
SS 2017 Software Verification LTL monitoring
SMT-Based Verification of Parameterized Systems
SS 2018 Software Verification FOL to ML
SS 2018 Software Verification LTL Satisfiability applied
SS 2018 Software Verification ML, state machines
SS 2017 Software Verification CTL model checking, BDDs
SS 2017 Software Verification Tableaus, CTL model checking
Software Verification 2 Automated Verification
SS 2018 Software Verification SAT & FOL
SS 2018 Software Verification Strategic Reasoning
Software Verification 2 Automated Verification
SS 2017 Software Verification Modal Logics
SS 2017 Software Verification Automated Verification
Program correctness Axiomatic semantics
The SMT-LIB Initiative
Rich Model Toolkit – An Infrastructure for Reliable Computer Systems
Presentation transcript:

SS 2017 Software Verification Software Model Checking 2 - Parallelism Prof. Dr. Holger Schlingloff 1,2 Dr. Esteban Pavese 1 (1) Institut für Informatik der Humboldt Universität (2) Fraunhofer Institut für offene Kommunikationssysteme FOKUS

Recap What is the difference between a model and a program? Syntax of while-programs? Semantics of while-programs? SOS: How? SOS-rule for while? Do nondeterministic programs exist? Sources of nondeterminism?

Parallelism Parallelism is the primary source of nondeterminism in programs Thus: hard to understand, error-prone But: of increasing importance (multicores) in Java, parallelism by multithreading key issue: synchronization via shared variables or message passing test-and-set, lock / semaphores, monitors

Parallelism Concept Language we add the following new constructs to the language of while-programs { 1 || 2 } or, more generally, { 1 || ... || n } await (b) ; semantics parallel (interleaved) execution of the i blocking wait until condition is satisfied; program fragment within await is noninterruptable for simplicity, assignments are atomic actions (unlike Java; cf. “synchronized” and “volatile” attributes)

Interleaving Semantics A state of the program consists of an assignment of values to variables a set of program counters (depending on the number of parallel components), and SOS-rules for parallel programs if (U,I,V) ⊨ b and (, V)* (skip,V’), then (await (b) , V) (skip,V’) if (1, V) (1’,V’), then ({1 ||  2}, V) ({1’ || 2},V’) if (2, V) (2’,V’), then ({1 ||  2}, V) ({1 || 2’},V’) ({skip || skip}, V) (skip,V) In general, several possible executions! (tree of possibilities)

Examples Note: „for“ is a suitable abbreviation of „while“ int n=0; { for (int i = 0; i<100; i++) n++; || for (int i = 0; i<100; i++) n--; } int n=0; int l, r; {for (int i = 0; i<100; i++) {l=n; l++; n=l;} || for (int i = 0; i<100; i++) {r=n; r--; n=r;}} int n=0; {for (int i = 0; i<100; i++) await (1) {l=n; l++; n=l;} || for (int i = 0; i<100; i++) await (1) {r=n; r--; n=r;}}

More Examples a=0; b=0; {a*=a; a-=5; || b=2*b+3; b=1-b;} a=0; {a*=a; a-=5; || a=2*a+3; a=1-a;} a=0; {a++; || a--;} {a=0; a++; || a=0; a--} a=0; {await (a>=0); a++; || await (a<=0); a--} a=0; {await (a>=0) a++; || await (a<=0) a--} Executions of second example:

Deadlocks a=0; b=0; {await (a!=0) || await (b!=0)} a=0; b=0; {await (a==1) b=1 || await (b==1) a=1} prt=T; dsk=T; {await (prt) prt=F; await(dsk) dsk=F; foo; prt=T; dsk=T; || await (dsk) dsk=F; await(prt) prt=F; bar; prt=T; dsk=T;} Checking for deadlock freedom?

A more practical example Calculate binomial coefficient in parallel by divisor and dividend: a=n; b=0; c=1; { while (a!=n-k) {c=c*a; a--;} || while (b!=k) {b++; c=c/b;} } Problem with this solution?

Correction Correctness of this solution? a=n; b=0; c=1; { while (a ≠ n-k) {c=c*a; a--;} || while (b ≠ k) {b++; await (a+b ≤ n); c=c/b;} } Correctness of this solution?

If a+b≤n, then n-i+j≤n, thus j≤i. In this case, c is divisible by i: a=n; b=0; c=1; :{ 1: while (a ≠ n-k) { 2: c=c*a; 3: a--; } 4: || 1: while (b ≠ k) { 2: b++; 3: await (a+b ≤ n); 4: c=c/b; } 5: } Proof idea: at the await (3) it holds that c=(n*(n-1)*...*(n-i+1) / 1*2*...*(j-1) a=n-i, b=j If a+b≤n, then n-i+j≤n, thus j≤i. In this case, c is divisible by i: n is divisible by 1 n*(n-1) is divisible by 2 n*(n-1)*(n-2) is divisible by 2 and 3 n*(n-1)*(n-2)*(n-3) is divisible by 1*2*3*4 What must a model checker know to do such a proof?

SMT Satisfiability modulo theories: Checking the satisfiability of a formula, where certain functions/relations are interpreted according to a particular mathematical theory Theory: set of axioms / consequences Theory of linear orders, natural numbers, reals, rings, fields, ... E.g., is (x+y=2) satisfiable? E.g., is (an+bn=cn  n>2) satisfiable? Slides thanks to (C) Cesare Tinelli, http://fm.csl.sri.com/SSFT11/Tinelli.pdf

SMT Satisfiability of quantifier-free formulas is decidable for many theories of interest in model checking Equality with “Uninterpreted Function Symbols” Linear Arithmetic (Real and Integer) Arrays (i.e., updatable maps) Finite sets and multisets Inductive data types (enumerations, lists, trees, . . . ) . . . Thanks to advances in SAT and in decision procedures, this can be done very efficiently by current SMT solvers SMT solvers differ from traditional theorem provers by having built-in theories, and using specialized methods to reason about them

Model Checking by SMT SMT-based model checking techniques blur the line between traditional model checking and deductive verification Different approaches, e.g., predicate abstraction, bounded model checking, backward reachability, temporal induction, ...