CIS 540 Principles of Embedded Computation Spring 2015 Instructor: Rajeev Alur

Slides:



Advertisements
Similar presentations
Model Checking Lecture 1.
Advertisements

Model Checking Lecture 3. Specification Automata Syntax, given a set A of atomic observations: Sfinite set of states S 0 Sset of initial states S S transition.
Model Checking Lecture 2. Three important decisions when choosing system properties: 1automata vs. logic 2branching vs. linear time 3safety vs. liveness.
Automatic Verification Book: Chapter 6. How can we check the model? The model is a graph. The specification should refer the the graph representation.
Modeling issues Book: chapters 4.12, 5.4, 8.4, 10.1.
CS 267: Automated Verification Lecture 2: Linear vs. Branching time. Temporal Logics: CTL, CTL*. CTL model checking algorithm. Counter-example generation.
Algorithmic Software Verification VII. Computation tree logic and bisimulations.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
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.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
ECE Synthesis & Verification - L271 ECE 697B (667) Spring 2006 Synthesis and Verification of Digital Systems Model Checking basics.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Timed Automata.
CS 267: Automated Verification Lecture 10: Nested Depth First Search, Counter- Example Generation Revisited, Bit-State Hashing, On-The-Fly Model Checking.
1 Temporal Claims A temporal claim is defined in Promela by the syntax: never { … body … } never is a keyword, like proctype. The body is the same as for.
Chair of Software Engineering Software Verification Stephan van Staden Lecture 10: Model Checking.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Formal Methods in SE Qaisar Javaid Assistant Professor Lecture # 11.
CSE 555 Protocol Engineering Dr. Mohammed H. Sqalli Computer Engineering Department King Fahd University of Petroleum & Minerals Credits: Dr. Abdul Waheed.
Specification Formalisms Book: Chapter 5. Properties of formalisms Formal. Unique interpretation. Intuitive. Simple to understand (visual). Succinct.
Review of the automata-theoretic approach to model-checking.
ESE601: Hybrid Systems Introduction to verification Spring 2006.
Witness and Counterexample Li Tan Oct. 15, 2002.
Automata and Formal Lanugages Büchi Automata and Model Checking Ralf Möller based on slides by Chang-Beom Choi Provable Software Lab, KAIST.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Flavio Lerda 1 LTL Model Checking Flavio Lerda. 2 LTL Model Checking LTL –Subset of CTL* of the form: A f where f is a path formula LTL model checking.
1 Carnegie Mellon UniversitySPINFlavio Lerda Bug Catching SPIN An explicit state model checker.
15-820A 1 LTL to Büchi Automata Flavio Lerda A 2 LTL to Büchi Automata LTL Formulas Subset of CTL* –Distinct from CTL AFG p  LTL  f  CTL. f.
Regular Model Checking Ahmed Bouajjani,Benget Jonsson, Marcus Nillson and Tayssir Touili Moran Ben Tulila
Institute for Applied Information Processing and Communications 1 Karin Greimel Semmering, Open Implication.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Instructor: Rajeev Alur
Model Checking Lecture 4 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Model Checking Lecture 3 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
Yang Liu, Jun Sun and Jin Song Dong School of Computing National University of Singapore.
CS6133 Software Specification and Verification
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 842: Specification and Verification of Reactive Systems Lecture Specifications: LTL Model Checking Copyright , Matt Dwyer, John Hatcliff,
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Copyright , Doron Peled and Cesare Tinelli. These notes are based on a set of lecture notes originally developed by Doron Peled at the University.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Recognizing safety and liveness Presented by Qian Huang.
Lecture 5 1 CSP tools for verification of Sec Prot Overview of the lecture The Casper interface Refinement checking and FDR Model checking Theorem proving.
VIS Technology Transfer Course Session 7 Fairness Constraints and Monitors Serdar Tasiran.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
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.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Variants of LTL Query Checking Hana ChocklerArie Gurfinkel Ofer Strichman IBM Research SEI Technion Technion - Israel Institute of Technology.
From Natural Language to LTL: Difficulties Capturing Natural Language Specification in Formal Languages for Automatic Analysis Elsa L Gunter NJIT.
About Alternating Automata Daniel Choi Provable Software Laboratory KAIST.
Today’s Agenda  Quiz 4  Temporal Logic Formal Methods in Software Engineering1.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Model Checking Lecture 2. Model-Checking Problem I |= S System modelSystem property.
Model Checking Lecture 2 Tom Henzinger. Model-Checking Problem I |= S System modelSystem property.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
CIS 842: Specification and Verification of Reactive Systems
Instructor: Rajeev Alur
Automatic Verification
Translating Linear Temporal Logic into Büchi Automata
Introduction to verification
Presentation transcript:

CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur

LTL Recap  Syntax: Formulas built from  Base formulas: Boolean-valued expressions over typed variables  Logical connectives: AND, OR, NOT, IMPLIES …  Temporal Operators: Always, Eventually, Next, Until  LTL formula is evaluated w.r.t. a trace  (infinite seq of valuations)  Semantics defined by rules for the satisfaction relation  A system satisfies LTL spec  if every infinite execution satisfies   Derived operators  Repeatedly (Always Eventually); Persistently (Eventually Always)  Sample requirement: Every req is eventually granted Always [ req=1  Eventually ( grant=1) ] CIS 540 Spring 2015; Lecture March 18

Temporal Implications and Equivalences  Understanding subtle differences among different variants of LTL formulas can be tricky  Formula  is stronger than the formula  : whenever a trace satisfies , it is guaranteed to satisfy   Every trace satisfies the implication     Formula  is equivalent to the formula  : a trace satisfies  if and only if it satisfies   Two formulas express exactly the same requirement  Knowing some standard equivalences can be useful for simplifying formulas CIS 540 Spring 2015; Lecture March 18

Temporal Implications and Equivalences  Always  is stronger than   Repeatedly  is equivalent to ~ Persistently ~   Persistently  is stronger than Repeatedly   Always  is equivalent to [  & Next Always  ]  What’s the relationship between  Always Eventually   Next Always Eventually   Eventually Always Eventually  CIS 540 Spring 2015; Lecture March 18

Logical Connectives and Temporal Operators  Are these equivalent? Eventually (  |  ) and Eventually  | Eventually  [Proof in one direction]. Suppose a trace  satisfies Eventually (  |  )  There exists a position j such that ( , j) |=  |   Either ( , j) |=  or ( , j) |=   Suppose ( , j) |=  (the other case is similar)  Then  satisfies Eventually   Hence also satisfies Eventually  | Eventually  [Proof of converse]. Suppose trace  satisfies Eventually  | Eventually   Suppose it satisfies Eventually  (the other case is similar)  There exists a position j such that ( , j) |=   Then, it also is the case that ( , j) |=  |   It follows that  satisfies Eventually (  |  ) CIS 540 Spring 2015; Lecture March 18

Logical Connectives and Temporal Operators  Are these equivalent? Eventually (  &  ) and Eventually  & Eventually  [Proof in one direction]. The first is stronger than the second  Suppose a trace  satisfies Eventually (  &  )  There exists a position j such that ( , j) |=  &   It follows that both ( , j) |=  and ( , j) |=   Since ( , j) |=  it also satisfies Eventually   Similarly it also satisfies Eventually   It follows that the trace satisfies Eventually  & Eventually  [Disprove the converse]. But the two are not equivalent!  Consider trace 0,1,0,1,0,1,… over a boolean variable x  It satisfies Eventually(x=0) & Eventually(x=1)  But does not satisfy Eventually (x=0 & x=1) CIS 540 Spring 2015; Lecture March 18

Logical Connectives and Temporal Operators  Distributivity rules for logical connectives and temporal operators  Are these equivalent?  Always (  &  ) and Always  & Always   Always (  |  ) and Always  | Always    Repeatedly (  &  ) and Repeatedly  & Repeatedly    Repeatedly (  |  ) and Repeatedly  | Repeatedly  CIS 540 Spring 2015; Lecture March 18

Back to Fairness  What fairness assumptions are needed so that P satisfies the spec  Eventually ( x >= 10) : weak-fairness for A  Eventually ( y = 1) : strong-fairness for B  Fairness can be encoded directly in LTL  Instead of checking whether the system satisfies an LTL-formula , check if the system satisfies the formula FairnessAssumption    FairnessAssumption is an LTL formula that encodes the meaning of what it means for an infinite execution to be weak/strong fair with respect to different tasks nat x:=0; bool y:=0 A: x := x+1 B: even(x)  y := 1-y Process P CIS 540 Spring 2015; Lecture March 18

Encoding Weak Fairness in LTL  To encode fairness assumption, let us add a variable called taken whose values are task names, and whenever a task executes, taken is assigned the name of the task  Weak-fairness for a task  Persistently enabled  Repeatedly taken  Alternatively: Always [ enabled  eventually ( taken | ~ enabled) ]  An infinite execution is weakly-fair to task A if it satisfies wf(A): Repeatedly(taken=A)  An infinite execution is weakly-fair to task B if it satisfies wf(B): Persistently(even(x))  Repeatedly (taken =B) nat x:=0; bool y:=0; A: x := x+1; B: even(x)  y := 1-y; Process P {A,B} taken taken := A taken := B CIS 540 Spring 2015; Lecture March 18

Checking Requirements under Weak Fairness in LTL  Does P satisfy Eventually (x >= 10) ?  Does P satisfy wf(A)  Eventually (x >= 10) ?  Does P satisfy wf(B)  Eventually (y=1) ?  Does P satisfy (wf(A) & wf(B) )  Eventually(y=1) ?  What have we achieved?  The problem of checking whether a LTL-spec is satisfied under fairness assumptions is reduced to checking a modified LTL-spec, so verification procedure does not have to worry about handling fairness) nat x:=0; bool y:=0; A: x := x+1; B: even(x)  y := 1-y; Process P {A,B} taken taken := A taken := B CIS 540 Spring 2015; Lecture March 18

Encoding Strong Fairness in LTL  Strong-fairness for a task  Repeatedly enabled  Repeatedly taken  An infinite execution is weakly-fair to task B if it satisfies sf(B): Repeatedly (even(x))  Repeatedly(taken=B)  Observe that the formula sf(B) is stronger than wf(B): if a spec is satisfied assuming weak-fairness, it also holds under strong-fairness  Does P satisfy sf(B)  Eventually (y=1) ?  Does P satisfy sf(B)  Repeatedly (y=1) ?  Does P satisfy sf(B)  Persistently (y=1) ? nat x:=0; bool y:=0; A: x := x+1; B: even(x)  y := 1-y; Process P {A,B} taken taken := A taken := B CIS 540 Spring 2015; Lecture March 18

Model Checking System Model LTL Requirement yes no/bug Model Checker  Performed using enumerative or symbolic search through the state- space of the program  Success story for transitioning academic research to industrial practice  2007 Turing Award to Ed Clarke, Alan Emerson, and Joseph Sifakis  Used to debug multicore protocols, pipelined processors, device driver code, distributed algorithms in Intel, Microsoft, IBM … CIS 540 Spring 2015; Lecture March 18

Buchi Automata  A safety monitor classifies finite executions into good and bad  Verification of safety requirements is done by analyzing reachable states of the system composed with the monitor  Bug: An execution that drives the monitor into an error state  How can a monitor (also called an automaton) classify “infinite” executions into good and bad?  Theoretical model of Buchi automata proposed by Richard Buchi (1960)  Model checking application (1990s) using Buchi automata  Automatically translate LTL formula  to a Buchi monitor M  Consider the composition of system C and monitor M  Reachable cycles in this composite correspond to counter-examples (if no such cycle is found, system satisfies spec)  Implemented in many model checkers including SPIN CIS 540 Spring 2015; Lecture March 18

Buchi Automaton: Example 1 a ~e e  Inputs: boolean variable e  Of two states a and b, a is initial and b is accepting  Given a trace  over e (i.e. infinite sequence of 0/1 values to e), there is a corresponding execution of M  The trace  is accepted if accepting state appears repeatedly  Language of M = Set of traces in which e is satisfied repeatedly  M accepts  iff  |= Repeatedly e ~e e b CIS 540 Spring 2015; Lecture March 18

Buchi Automaton: Example 2 a  Automaton is nondeterministic: as long as it is in state a, at each step it can either stay in state a, or switch to state b  On a given input trace, many possible executions  An execution is accepting if it visits accepting state repeatedly  M accepts an input trace if there exists some accepting execution on that input  M accepts  iff  |= Persistently e e b CIS 540 Spring 2015; Lecture March 18

Buchi Automaton: Example 3  Design a Buchi automaton such that M accepts  iff  |= Always [ e  Eventually f ]  Inputs: Boolean conditions e and f  In an accepting execution, every e must be followed by f b ~ e | f e & ~f f a ~ f CIS 540 Spring 2015; Lecture March 18

Buchi Automaton: Example 4 a e c b f Which traces does this accept? Express it in LTL M accepts  iff  |= Repeatedly e & Repeatedly f CIS 540 Spring 2015; Lecture March 18

Buchi Automaton M Definition  V: set of Boolean input variables  Finite set Q of states  Set Init of initial states  Set F of accepting states  Set of edges/transitions, where each edge is of the form q –Guard  q’ where Guard is a Boolean-valued condition over input vars V  Given an input trace  = v 1, v 2, v 3, … over V, an accepting run/execution of M over  is an infinite sequence of states q 0, q 1, q 2, … such that 1.State q 0 is initial 2.For each i, there exists an edge q i -Guard  q i+1 such that input v i satisfies Guard 3.There are infinitely many positions i such that state q i is in F  The automaton M accepts the input trace  if there exists an accepting run of M over  CIS 540 Spring 2015; Lecture March 18

Buchi Automata: More Examples e Eventually e ~ e e Eventually e CIS 540 Spring 2015; Lecture March 18