29/06/2016Verification Synchronous Languages Verification.

Slides:



Advertisements
Similar presentations
1 Verification by Model Checking. 2 Part 1 : Motivation.
Advertisements

Model Checking Lecture 4. Outline 1 Specifications: logic vs. automata, linear vs. branching, safety vs. liveness 2 Graph algorithms for model checking.
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Automatic Verification Book: Chapter 6. How can we check the model? The model is a graph. The specification should refer the the graph representation.
Metodi formali dello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Representing Boolean Functions for Symbolic Model Checking Supratik Chakraborty IIT Bombay.
M ODEL CHECKING -Vasvi Kakkad University of Sydney.
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Introduction to Formal Methods for SW and HW Development 09: SAT Based Abstraction/Refinement in Model-Checking Roberto Sebastiani Based on work and slides.
1 Model checking. 2 And now... the system How do we model a reactive system with an automaton ? It is convenient to model systems with Transition systems.
Planning based on Model Checking Dept. of Information Systems and Applied CS Bamberg University Seminar Paper Svetlana Balinova.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
An Introduction to the Model Verifier verds Wenhui Zhang September 15 th, 2010.
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
Timed Automata.
SYMBOLIC MODEL CHECKING: STATES AND BEYOND J.R. Burch E.M. Clarke K.L. McMillan D. L. Dill L. J. Hwang Presented by Rehana Begam.
Software Failure: Reasons Incorrect, missing, impossible requirements * Requirement validation. Incorrect specification * Specification verification. Faulty.
Review of topics Final exam : -May 2nd to May 7 th - Projects due on May 7th.
SAT and Model Checking. Bounded Model Checking (BMC) A.I. Planning problems: can we reach a desired state in k steps? Verification of safety properties:
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture # 11.
1 Carnegie Mellon UniversitySPINFlavio Lerda SPIN An explicit state model checker.
Lecture 4&5: Model Checking: A quick introduction Professor Aditya Ghose Director, Decision Systems Lab School of IT and Computer Science University of.
ECE Synthesis & Verification1 ECE 667 Spring 2011 Synthesis and Verification of Digital Systems Verification Introduction.
Review of the automata-theoretic approach to model-checking.
Witness and Counterexample Li Tan Oct. 15, 2002.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
CS 267: Automated Verification Lecture 13: Bounded Model Checking Instructor: Tevfik Bultan.
272: Software Engineering Fall 2012 Instructor: Tevfik Bultan Lecture 4: SMT-based Bounded Model Checking of Concurrent Software.
1 Carnegie Mellon UniversitySPINFlavio Lerda Bug Catching SPIN An explicit state model checker.
Software Testing Sudipto Ghosh CS 406 Fall 99 November 9, 1999.
1 Introduction to SMV and Model Checking Mostly by: Ken McMillan Cadence Berkeley Labs Small parts by: Brandon Eames ISIS/Vanderbilt.
Binary Decision Diagrams (BDDs)
Model Checking Lecture 4 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
1 Program Correctness CIS 375 Bruce R. Maxim UM-Dearborn.
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
1 Automatic Refinement and Vacuity Detection for Symbolic Trajectory Evaluation Orna Grumberg Technion Haifa, Israel Joint work with Rachel Tzoref.
10/19/2015COSC , Lecture 171 Real-Time Systems, COSC , Lecture 17 Stefan Andrei.
Automatic Verification of Finite-State Concurrent Systems Using Temporal Logic Specifications 1.
On Reducing the Global State Graph for Verification of Distributed Computations Vijay K. Garg, Arindam Chakraborty Parallel and Distributed Systems Laboratory.
Daniel Kroening and Ofer Strichman 1 Decision Procedures An Algorithmic Point of View BDDs.
CS 267: Automated Verification Lecture 3: Fixpoints and Temporal Properties Instructor: Tevfik Bultan.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 05/06 Universität Dortmund Validation - Formal verification -
Scientific Debugging. Errors in Software Errors are unexpected behaviors or outputs in programs As long as software is developed by humans, it will contain.
Verification & Validation By: Amir Masoud Gharehbaghi
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Program Analysis and Verification Spring 2015 Program Analysis and Verification Lecture 13: Abstract Interpretation V Roman Manevich Ben-Gurion University.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
1 Temporal logic. 2 Prop. logic: model and reason about static situations. Example: Are there truth values that can be assigned to x,y simultaneously.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Bounded Model Checking A. Biere, A. Cimatti, E. Clarke, Y. Zhu, Symbolic Model Checking without BDDs, TACAS’99 Presented by Daniel Choi Provable Software.
1 Iterative Program Analysis Abstract Interpretation Mooly Sagiv Tel Aviv University Textbook:
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Presentation Title 2/4/2018 Software Verification using Predicate Abstraction and Iterative Refinement: Part Bug Catching: Automated Program Verification.
Basic concepts of Model Checking
CSEP590 – Model Checking and Automated Verification
CIS 842: Specification and Verification of Reactive Systems
Automatic Verification
CSCI1600: Embedded and Real Time Software
Program Analysis and Verification
Automatic Verification of Industrial Designs
Software testing.
Albert M. K. Cheng Real-Time Systems Laboratory University of Houston
CSCI1600: Embedded and Real Time Software
Software Verification and Validation
Software Verification and Validation
CSCI1600: Embedded and Real Time Software
Software Verification and Validation
Program correctness Model-checking CTL
Presentation transcript:

29/06/2016Verification Synchronous Languages Verification

29/06/2016Verification How Develop critical softwares ? Classical Development U Cycle investigation Qualification in laboratory in operation specification design developmenttests integration validation tests white box tests black box tests of integrated system

29/06/2016Verification How Develop Critical Software test reuse test coverage test generation MODEL proofs code automatic code generation functional validation abstract interpretation simulation no more integration tests

29/06/2016Verification Critical Software Validation  What is a correct software?  No execution errors, time constraints respected, compliance of results.  Solutions:  At model level :  Simulation  Formal proofs  At implementation level:  Test  Abstract interpretation

29/06/2016Verification Validation Methods  Testing  Run the program on set of inputs and check the results  Static Analysis  Examine the source code to increase confidence that it works as intended  Formal Verification  Argue formally that the application always works as intended

29/06/2016Verification Testing  Dynamic verification process applied at implementation level.  Feed the system (or one if its components) with a set of input data values:  Input data set not too large to avoid huge time testing procedure.  Maximal coverage of different cases required.

29/06/2016Verification Testing (2) Program Testing Concrete semantics Test coverage errors all program executions executions tested ok undetected failure “Testing only highlights bugs but not ensure their absence “ (E. Dijkstra)

29/06/2016Verification Static Analysis  The aim of static analysis is to search for errors without running the program.  Abstract interpretation = replace data of the program by an abstraction in order to be able to compute program properties.  Abstraction must ensure :  A (P) “correct”  P correct  But A (P) “incorrect”  ?

29/06/2016Verification Static Analysis: example abstraction: integer by intervals 1: x:= 1; 2: while (x < 1000) { 3: x := x+1; 4: } x1 = [1,1] x2 = x1 U x3 ∩ [-∞, 999] x3 = x2  [1,1] x4 = x1 U x3 ∩ [1000, ∞] Abstract interpretation theory  values are fix point equation solutions.

29/06/2016Verification Formal verification  What about functional validation ?  Does the program compute the expected outputs?  Respect of time constraints (temporal properties)  Intuitive partition of temporal properties:  Safety properties: something bad never happens  Liveness properties: something good eventually happens

29/06/2016Verification Safety and Liveness Properties  Example: the beacon counter in a train:  Count the difference between beacons and seconds  Decide when the train is ontime, late, early node train (sec, bea : bool) returns (ontime, early, late: bool) let diff = (0 ->pre diff) + (if bea then 1 else 0) + (if sec then -1 else 0); early = (true -> pre ontime) and (diff > 3) or (false -> pre early) and (diff > 1); late = (true -> pre ontime) and (diff < -3) or (false -> pre late) and (diff < -1); ontime = not (early or late); tel

29/06/2016Verification Safety and Liveness Properties  Some properties: 1. It is impossible to be late and early; 2. It is impossible to directly pass from late to early; 3. It is impossible to remain late only one instant; 4. If the train stops, it will eventually get late  Properties 1, 2, 3 : safety  Property 4 : liveness It refers to unbound future

29/06/2016Verification Safety and Liveness Properties Checking  Use of model checking techniques  Model checking goal: prove safety and liveness properties of a system in analyzing a model of the system.  Model checking techniques require:  model of the system  express properties  algorithm to check properties on the model (  decidability)

29/06/2016Verification Model Checking Techniques  Model = automata which is the set of program behaviors  Properties expression = temporal logic:  LTL : liveness properties  CTL: safety properties  Algorithm =  LTL : algorithm exponential wrt the formula size and linear wrt automata size.  CTL: algorithm linear wrt formula size and wrt automata size

29/06/2016Verification Properties Checking  Liveness Property  :    automata B(  )  L (B(  )) =  décidable   |= M : L ( M  B(~  )) =   Scade allows only to verify safety properties, thus we will study such properties verification techniques.

29/06/2016Verification Safety Properties  CTL formula characterization:  Atomic formulas  Usual logic operators: not, and, or (  )  Specific temporal operators:  EX , EF , EG   AX , AF , AG   EU(  1,  2 ), AU(  1,  2 )

29/06/2016Verification Safety Properties Verification (1)  Mathematical framework: ( P    S : finite state, ( P (S),  ) is a complete lattice with S as greater element and  as least one. P  f : P (S) P (S) :  f is monotonic iff  x,y  P (S), x  y  f(x)  f(y)  f is  -continue iff for each decreasing sequence f(  x i ) =  f(x i )  f is  -continue iff for each increasing sequence f(  x i ) =  f(x i )

29/06/2016Verification Safety Properties Verification (2)  Mathematical framework:  if S is finite then monotonic   -continue et  -continue.  x is a fix point iff of f iff f(x) = x  x is a least fix point (lfp) iff  y such that f(y) = y, x  y  x is a greatest fix point (gfp) iff  y such that f(y) = y, y  x

29/06/2016Verification Safety Properties Verification (3)  Theorem:  f monotonic  f has a lfp (resp glp)  lfp(f) =  f n (  )  gfp(f) =  f n (S) Fixpoints are limits of approximations

29/06/2016Verification Safety Properties Verification (4)  We call Sat(  ) the set of states where  is true.  M |=  iff s init  Sat(  ).  Algorithm:  Sat(  ) = { s |  |= s}  Sat(not  ) = S\Sat(  )  Sat(  1  1) U Sat(  2)  Sat(  1 or  2) = Sat(  1) U Sat(  2)  Sat (EX  ) = {s |  t  Sat(  ), s → t} (Pre Sat(  ))  Sat (EG  ) = gfp (  (x) = Sat(  )  Pre(x))  Sat (E(  1 U  2)) = lfp (  (x) = Sat(  2) U (Sat(  1)  Pre(x))

29/06/2016Verification Example s0s0 s1s1 s2s2 s3s3 s4s4 atomic formulas: a, b, cab a,b,c c b,c EG (a or b) gfp (  (x) = Sat(  )  Pre(x))  ({s 0, s 1, s 2, s 3, s 4 }) = Sat (a or b)  Pre({s 0, s 1, s 2, s 3, s 4 })  ({s 0, s 1, s 2, s 3, s 4 }) = {s 0, s 1, s 2, s 4 }  {s 0, s 1, s 2, s 3, s 4 }  ({s 0, s 1, s 2, s 3, s 4 }) = {s 0, s 1, s 2, s 4 }

29/06/2016Verification Example s0s0 s1s1 s2s2 s3s3 s4s4 atomic formulas: a, b, cab a,b,c c b,c EG (a or b)  ({s 0, s 1, s 2, s 3, s 4 }) = {s 0, s 1, s 2, s 4 }  ({s 0, s 1, s 2, s 4 }) = Sat (a or b)  Pre({s 0, s 1, s 2,, s 4 })  ({s 0, s 1, s 2, s 4 }) = {s 0, s 1, s 2, s 4 } S 0 |= EG( a or b)

29/06/2016Verification Model checking implementation  Problem: the size of automata  Solution: symbolic model checking  Usage of BDD (Binary Decision Diagram) to encode both automata and formula.  Each boolean function has a unique representation  Shannon decomposition:  f(x 0,x 1,…,x n ) = f(1, x 1,…., x n ) v f(0, x 1,…,x n )

29/06/2016Verification Model Checking Implementation  When applying recursively shannon decomposition on all variables, we obtain a tree where leaves are either 1 or 0.  BDD are:  A concise representation of the Shannon tree  no useless node (if x then g else g  g)  Share common sub graphs

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y0y0y0y0 y1y1 y0y0y0y0 y1y x1x1x1x1 y0y0y0y0 y1y1 y0y0y0y0 y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y0y0y0y0 y1y1 y0y0y0y0 y1y x1x1x1x1 y0y0y0y0 y1y1 y0y0y0y0 y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y0y0y0y0 y1y x1x1x1x1 y0y0y0y0 y1y1 y0y0y0y0 y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 01 x1x1x1x1 y0y0y0y0 y1y1y1y1 y1y1y1y1 y0y0y0y0 y1y1y1y1 y1y1y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 01 x1x1x1x1 y0y0y0y0 y1y1y1y1 y1y1y1y1 y0y0y0y0 y1y1y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 01 x1x1x1x1 y0y0y0y0 y1y1y1y1 y1y1y1y1 y0y0y0y0 y1y1y1y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 01 x1x1x1x1 y0y0y0y0 y1y1y1y1 y0y0y0y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 01 x1x1x1x1 y0y0y0y0 y0y0y0y

29/06/2016Verification Model Checking Implementation (2) (x 1  x 0 ) v (( x 1 v y 1 )  (x 0  y 0 )) x0x0x0x0 x1x1x1x1 y1y1y1y1 1 x1x1x1x1 y0y0y0y0 y0y0y0y

29/06/2016Verification Model Checking Implementation(3)  Implicit representation of the of states set and of the transition relation of automata with BDD.  BDD allows  canonical representation  test of emptyness immediate (bdd =0)  complementarity immediate (1 = 0)  union and intersection not immediate  Pre immediate

29/06/2016Verification Model Checking Implementation (4)  But BDD efficiency depends on the number of variables  Other method: SAT-Solver  Sat-solvers answer the question: given a propositional formula, is there exist a valuation of the formula variables such that this formula holds  first algorithm (DPLL) exponential (1960)

29/06/2016Verification Model Checking Implementation (4)  SAT-Solver algorithm:   formula  CNF formula  set of clauses  heuristics to choose variables  deduction engine:  propagation  specific reduction rule apllication (unit clause)  Others reduction rules  conflit analysis + learning

29/06/2016Verification Model Checking Implementation (5)  SAT-Solver usage:  encoding of the paths of length k by propositional formulas   the existence of a path of length k (for a given k) where a temporal property  is true can be reduce to the satisfaction of a propositional formula   theorem: given  a temporal property and M a model, then M |=    n such that M |= n  ( n < |S|. 2 |  | )

29/06/2016Verification Bounded Model Checking  SAT-Solver are used in complement of implicit (BDD based) methods.  M |=   verify ¬  on all paths of length k (k bounded)  useful to quickly extract counter examples

29/06/2016Verification Model Checking with Observers  Express safety properties as observers.  An observer is a program which observes the program and outputs ok when the property holds and failure when its fails program observer inputs outputs ok failure

29/06/2016Verification Model Checking with observers (2) Observers in Scade P: aircraft autopilot and security system P aircraft_altitudelanding_order  aircraft_altitude 200 landing_ordernot alarm and implies 

29/06/2016Verification Properties Validation  Taking into account the environment  without any assumption on the environment, proving properties is difficult  but the environment is indeterminist  Human presence no predictable  Fault occurrence  …  Solution: use assertion to make hypothesis on the environment and make it determinist

29/06/2016Verification Properties Validation (2)  Express safety properties as observers.  Express constraints about the environment as assertions. program observer inputs outputs ok failure assertions assume

29/06/2016Verification Properties Validation (3)  if assume remains true, then ok also remains true (or failure false). program observer inputs outputs ok failure assertions assume

29/06/2016Verification Safety and Liveness Properties  Example: the beacon counter in a train:  Count the difference between beacons and seconds  Decide when the train is ontime, late, early node train (sec, bea : bool) returns (ontime, early, late: bool) let diff = (0 ->pre diff) + (if bea then 1 else 0) + (if sec then -1 else 0); early = (true -> pre ontime) and (diff > 3) or (false -> pre early) and (diff > 1); late = (true -> pre ontime) and (diff < -3) or (false -> pre late) and (diff < -1); ontime = not (early or late); tel

29/06/2016Verification Train Safety Properties  It is impossible to be late and early;  ok = not (late and early)  It is impossible to directly pass from late to early;  ok = true -> (not early and pre late);  It is impossible to remain late only one instant;  Plate = false -> pre late; PPlate = false -> pre Plate; ok = not (not late and Plate and not PPlate);

29/06/2016Verification Train Assumptions  property = assumption + observer: “ if the train keeps the right speed, it remains on time”  observer = ok = ontime  assumption:  naïve: assume = (bea = sec);  more precise : bea and sec alternate:  SF = Switch (sec and not bea, bea and not sec); BF = Switch (bea and not sec, sec and not bea); assume = (SF => not sec) and (BF => not bea);