Formal methods: Lecture

Slides:



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

Model Checking Lecture 2. Three important decisions when choosing system properties: 1automata vs. logic 2branching vs. linear time 3safety vs. liveness.
Modeling Software Systems Lecture 2 Book: Chapter 4.
Auto-Generation of Test Cases for Infinite States Reactive Systems Based on Symbolic Execution and Formula Rewriting Donghuo Chen School of Computer Science.
Metodi formali dello sviluppo software a.a.2013/2014 Prof.Anna Labella.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
Partial Order Reduction: Main Idea
Models of Concurrency Manna, Pnueli.
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.
Verification of Evolving Software Natasha Sharygina Joint work with Sagar Chaki and Nishant Sinha Carnegie Mellon University.
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.
CS6133 Software Specification and Verification
1 Partial Order Reduction. 2 Basic idea P1P1 P2P2 P3P3 a1a1 a2a2 a3a3 a1a1 a1a1 a2a2 a2a2 a2a2 a2a2 a3a3 a3a3 a3a3 a3a3 a1a1 a1a1 3 independent processes.
卜磊 Transition System. Part I: Introduction  Chapter 0: Preliminaries  Chapter 1: Language and Computation Part II: Models  Chapter.
Chair of Software Engineering Software Verification Stephan van Staden Lecture 10: Model Checking.
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.
August Moscow meeting1August Moscow meeting1August Moscow meeting11 Deductive tools in insertion modeling verification A.Letichevsky.
CSEP590 – Model Checking and Software Verification University of Washington Department of Computer Science and Engineering Summer 2003.
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
1 Model Checking, Abstraction- Refinement, and Their Implementation Based on slides by: Orna Grumberg Presented by: Yael Meller June 2008.
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.
Modeling Software Systems Lecture 2 Book: Chapter 4.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Model Checking LTL over (discrete time) Controllable Linear System is Decidable P. Tabuada and G. J. Pappas Michael, Roozbeh Ph.D. Course November 2005.
Propositional Calculus Math Foundations of Computer Science.
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.
Verification technique on SA applications using Incremental Model Checking 컴퓨터학과 신영주.
50.530: Software Engineering
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.
CS6133 Software Specification and Verification
Survey on Trace Analyzer (2) Hong, Shin /34Survey on Trace Analyzer (2) KAIST.
1 Bisimulations as a Technique for State Space Reductions.
Lecture 81 Optimizing CTL Model checking + Model checking TCTL CS 5270 Lecture 9.
卜磊 Transition System. Definitions and notations Reactive System The intuition is that a transition system consists of a set of possible.
1 CSEP590 – Model Checking and Automated Verification Lecture outline for July 9, 2003.
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.
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
/ PSWLAB Thread Modular Model Checking by Cormac Flanagan and Shaz Qadeer (published in Spin’03) Hong,Shin Thread Modular Model.
Program Analysis and Verification
Model Checking Lecture 2. Model-Checking Problem I |= S System modelSystem property.
CS5270 Lecture 41 Timed Automata I CS 5270 Lecture 4.
Model Checking Lecture 2 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
Basic concepts of Model Checking
CIS 842: Specification and Verification of Reactive Systems
Semantically Equivalent Formulas
SS 2017 Software Verification Software Model Checking 2 - Parallelism
Program Synthesis is a Game
SS 2018 Software Verification ML, state machines
Model Checking for an Executable Subset of UML
CSCI1600: Embedded and Real Time Software
Over-Approximating Boolean Programs with Unbounded Thread Creation
Formal Methods in software development
Formal Methods in software development
CSCI1600: Embedded and Real Time Software
An explicit state model checker
50.530: Software Engineering
Translating Linear Temporal Logic into Büchi Automata
Introduction to verification
COMP60621 Designing for Parallelism
Program Analysis and Verification
Presentation transcript:

Formal methods: Lecture 2 12.02.2009 Model Checking I: transition systems

Model Checking Problem Property  is a temporal property M is a state-transition system that models the implementation Model checking is an enumeration of the state space of M that determines if it satisfies the property .

Advantage of MC Fully automatic Error trace (counter example) generated by checker helps to analyze the source of the problem Good for bug-hunting: a “debugger” that does not require the execution of your program.

Modeling How to get M? By the process of abstraction: Makes verification possible by retaining the part of the system that is relevant to modeling; Should not discard too much so that the result is doubtable, or the verification is not feasible; Usually done by human (novel automatic model extraction techniques are winning popularity).

Choice of models We focus on state-transition systems Acceptable by model checkers Mostly finite set of states and transitions Also push-down systems possible Even source programs can be used as models, e.g., Java Pathfinder

Notions of modeling State We concern what is true of a particular state A state is a “snapshot” of the system variables’ (possibly a set of) valuation(s) Transition Relation between states Can be a C statement: x++; Or can be a circuit Or nothing but an arrow, the source and destination of which matter.

Atomicity of a transition Represents abstraction level too big step may miss intermediate states that are relevant; too small step may blow up the model unnecessarily. Must consider concurrency make possible interleaving of transitions explicit.

Kripke Structure (KS) 4-tuple (S, S0, L, R) over a set of atomic propositions AP where S is a set of (control) states S0 is a set of initial states L is a labelling function: S  2AP R is the transition relation: S x S

Example of a KS S= {s0, s1} S0 = {s0} R = {(s0, s1), (s1, s0)} Assume in s0 x=1 and y=1 S= {s0, s1} S0 = {s0} R = {(s0, s1), (s1, s0)} L(s0) = {x=1, y=1} L(s1) = {x=0, y=1} x:= (x+y) mod 2 S0 S1 x:= (x+y) mod 2

Modeling Reactive System Reactive systems: do not terminate; interact with their environment constantly; KS is one way of modeling them. Properties to verify: race condition; deadlock freedom; no starvation, etc. Consider KS as a simple modeling language.

Modeling Concurrent Programs with KS Steps from program to KS (by Manna and Pnueli) Model components of the concurrent program (i.e., sequential programs) as logic relations. Compose the logic relations for the concurrent program. Compute a Kripke structure from the logic relations.

Describing States We use first order predicate logic… true, false, ¬, , , , , → extended with equality “=” and interpreted predicate and function symbols: x=y even (x) ...

Chains of State Representation y<z Abstraction1 x=0; y=1; z=2; Selective observation y=1; z=2; z is prime Abstraction2

Representing States Valuation of a state Set of states A type-preserving mapping from observable state variables V to their values Set of states A first-order logic formula describing the set We use S0 for the logic formula describing the set S0 Example: S0 == (x=1)  (y=1)

Representing a transition Transition is a statement (circuit) Distinguish two sets of variables (signals) V and V’ for variables before and after transition, respectively Transition is a relation Relation is a set of tuples, e.g., pairs represented as a logic formula on V, V’ with “=”, Example: x’ = x+1 for statement x:=x+1

From a Logic Relation to a Kripke Structure Rules S (statespace) is the set of all valuations for V; S0 is the set of all valuations that satisfy S0 If s and s’ are two states, then (s,s’)  R(s,s’) is a transition in KS; L is defined so that L(s) is the subset of all atomic propositions true in s.

Example (1,1) (0,1) x:= (x+y) mod 2 S0 == x = 1  y = 1 S= B x B, where B = {0,1} S0 = {(1,1)} R = {((1,1), (0,1)), ((0,1),(1,1))} L((1,1)) = {x=1, y=1} L((0,1)) = {x=0, y=1} (1,1) (0,1) x:= (x+y) mod 2

Simple Programming Language A parallel program contains processes Synchr. primitives: wait, lock and unlock Processes share variables No assumption about the speed and execution order of these processes Program is labeled by l1… ln We use C(l1, P, l2) to denote the logic relation of the transition that represents program P.

How to Compute Transition Relation for sequential programs? Base case: atomic statements: skip Assignment: x:=e Let C describe valuations before and after executing P: x:=e C(l1, x:=e, l2) == pc= l1  pc’=l2  x’= e  same(V \{x}) same(Y) means y’= y, for all y  Y.

How to Compute a Transition for Sequential Programs? (2) Sequential composition C(l0, P1; l: P2, l1) = C(l0, P1, l) ∨ C(l, P2, l1) C(l, if b then l1 :P1 else l2 : P2 end if,l’) is the disjuction of: pc = l  pc’= l1  b  same(V) pc = l  pc’= l2  ¬ b  same(V) C (l1, P1, l’) C(l2, P2, l’) Conditional part Body part

Example identify variables, including program counters L0: while (true) do NC0: wait (turn =0); CR0: turn := 1; end while L0’ L1: while (true) do NC1: wait (turn =1); CR1: turn := 0; L1’ identify variables, including program counters • compute set of states and set of initial states • compute translations

Example (continued I) Identify variables, including program counters: L0: while (true) do NC0: wait (turn =0); CR0: turn := 1; end while L0’ L1: while (true) do NC1: wait (turn =1); CR1: turn := 0; L1’ Identify variables, including program counters: • V = { pc_0, pc_1, turn} • domain of pc_0 is L0, NC0, CR0, L0’ • domain of turn is {0,1}

Example (continued II) L0: while (true) do NC0: wait (turn =0); CR0: turn := 1; end while L0’ L1: while (true) do NC1: wait (turn =1); CR1: turn := 0; L1’ Compute set of states and set of initial states S= {(L0, L1, 1), (L0,L1,0), (L0, NC1, 1)…} S0 = {(L0,L1,0), (L0,L1,1)}

Example (continued III) m: cobegin Compute transition relation separately & then compose them together: A global dom(pc) = {m, m’, }  represents one of local pc is taking effect. L1: while (true) do NC1: wait (turn =1); CR1: turn := 0; end while L1’ L0: while (true) do NC0: wait (turn =0); CR0: turn := 1; end while L0’ m’: coend

Example (continued IV) m: cobegin Transition relations of the composition: C(L0, P0, L0’)  same(V\V0)  same(PC \PC0) L0: while (true) do NC0: wait (turn =0); CR0: turn := 1; end while L0’ L1: while (true) do NC1: wait (turn =1); CR1: turn := 0; end while L1’ m’: coend

Summary Concept of MC (at very high level): State transition system: An automatic procedure that verifies TL properties Requires in input a state transition system a temporal property State transition system: Kripke structure is our (teaching) language KS models an implementation An example demonstrated how a concurrent program is translated to KS: Concurrent programs to logic relations Logic relations to KS.

Next lecture Temporal properties CTL*, CTL and LTL Their semantics CTL model checking on a Kripke structure

Exercise Write a meaningful program that can be modeled as the Kripke structure below. Give your definition of APs p, q, r. L(s0) = {¬ p, ¬ q, ¬ r} L(s1) = {¬ p, ¬ q, r} L(s2) = {¬ p, q, ¬ r} L(s3) = {¬ p, q, r} L(s4) = {p, ¬ q, ¬ r} L(s5) = {p, ¬ q, r} L(s6) = {p, q, ¬ r} L(s7) = {p, q, r} s7 s0 s3 s1 s2 s5 s6 s4