Monte Carlo Model Checking Radu Grosu SUNY at Stony Brook Joint work with Scott A. Smolka.

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.
Avoiding Determinization Orna Kupferman Hebrew University Joint work with Moshe Vardi.
1 Reasoning with Promela Safety properties bad things do not happen can check by inspecting finite behaviours Liveness properties good things do eventually.
Inference in the Simple Regression Model
Model Checking and Testing combined
Black Box Checking Book: Chapter 9 Model Checking Finite state description of a system B. LTL formula. Translate into an automaton P. Check whether L(B)
Automatic Verification Book: Chapter 6. How can we check the model? The model is a graph. The specification should refer the the graph representation.
Randomized Algorithms Introduction Rom Aschner & Michal Shemesh.
Review bootstrap and permutation
2 4 Theorem:Proof: What shall we do for an undirected graph?
A Survey of Runtime Verification Jonathan Amir 2004.
CS 267: Automated Verification Lecture 8: Automata Theoretic Model Checking Instructor: Tevfik Bultan.
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:
Distributed Markov Chains P S Thiagarajan School of Computing, National University of Singapore Joint work with Madhavan Mukund, Sumit K Jha and Ratul.
Hypothesis testing Another judgment method of sampling data.
CS6133 Software Specification and Verification
Timed Automata.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 6.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Randomized Algorithms Kyomin Jung KAIST Applied Algorithm Lab Jan 12, WSAC
Probability theory and average-case complexity. Review of probability theory.
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:
Infinite Automata -automata is an automaton that accepts infinite strings A Buchi automaton is similar to a finite automaton: S is a finite set of states,
Temporal Logic Model- checking with SPIN COMP6004 Stéphane Lo Presti Part 4: Specifications.
Topic 2: Statistical Concepts and Market Returns
Review of the automata-theoretic approach to model-checking.
Probabilistic Verification of Discrete Event Systems Håkan L. S. Younes.
k r Factorial Designs with Replications r replications of 2 k Experiments –2 k r observations. –Allows estimation of experimental errors Model:
Study Group Randomized Algorithms Jun 7, 2003 Jun 14, 2003.
C4: DISCRETE RANDOM VARIABLES CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics Longin Jan Latecki.
1 Formal Engineering of Reliable Software LASER 2004 school Tutorial, Lecture1 Natasha Sharygina Carnegie Mellon University.
Monte Carlo Analysis of Security Protocols: Needham-Schroeder Revisited Radu Grosu SUNY at Stony Brook Joint work with Xiaowan Huang, Scott Smolka, & Ping.
Monte Carlo Model Checking Scott Smolka SUNY at Stony Brook Joint work with Radu Grosu Main source of support: ARO – David Hislop.
The Model Checker SPIN Written by Gerard J. Holzmann Presented by Chris Jensen.
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.
Jun. Sun Singapore University of Technology and Design Songzheng Song and Yang Liu National University of Singapore.
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.
Hypothesis Testing. Central Limit Theorem Hypotheses and statistics are dependent upon this theorem.
Review of Statistical Inference Prepared by Vera Tabakova, East Carolina University ECON 4550 Econometrics Memorial University of Newfoundland.
Deep Random Search for Efficient Model Checking of Timed Automata Stony Brook University Radu Grosu Joint work with: X. Huang, S.A. Smolka, W. Tan and.
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Statistical Review We will be working with two types of probability distributions: Discrete distributions –If the random variable of interest can take.
Sept COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 15 More Advanced Program Properties: Temporal logic and jSpin John Gurd,
Computation Model and Complexity Class. 2 An algorithmic process that uses the result of a random draw to make an approximated decision has the ability.
COMP 170 L2 L17: Random Variables and Expectation Page 1.
Static and Runtime Verification A Monte Carlo Approach State University of New York at Stony Brook Radu Grosu.
EMIS 7300 SYSTEMS ANALYSIS METHODS FALL 2005 Dr. John Lipp Copyright © Dr. John Lipp.
Monte Carlo Model Checking Radu Grosu SUNY at Stony Brook Joint work with Scott A. Smolka.
Quantitative Model Checking Radu Grosu SUNY at Stony Brook Joint work with Scott A. Smolka.
The Markov Chain Monte Carlo Method Isabelle Stanton May 8, 2008 Theory Lunch.
CIS 540 Principles of Embedded Computation Spring Instructor: Rajeev Alur
Hypothesis Testing. Central Limit Theorem Hypotheses and statistics are dependent upon this theorem.
C4: DISCRETE RANDOM VARIABLES CIS 2033 based on Dekking et al. A Modern Introduction to Probability and Statistics Longin Jan Latecki.
ICS 353: Design and Analysis of Algorithms
Model Checking Lecture 1. Model checking, narrowly interpreted: Decision procedures for checking if a given Kripke structure is a model for a given formula.
Probability theory and average-case complexity. Review of probability theory.
Model Checking Lecture 1: Specification Tom Henzinger.
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.
Complexity of Compositional Model Checking of Computation Tree Logic on Simple Structures Krishnendu Chatterjee Pallab Dasgupta P.P. Chakrabarti IWDC 2004,
C4: DISCRETE RANDOM VARIABLES
IEE 380 Review.
On Statistical Model Checking of Stochastic Systems
‘Crowds’ through a PRISM
COMP60621 Designing for Parallelism
Presentation transcript:

Monte Carlo Model Checking Radu Grosu SUNY at Stony Brook Joint work with Scott A. Smolka

Model Checking ? Is system S a model of formula φ?

Model Checking S is a nondeterministic/concurrent system.  is a temporal logic formula. –in our case Linear Temporal Logic (LTL).

LTL Model Checking Every LTL formula  can be translated to a Büchi automaton B  such that L(  ) = L(B  ) Automata-theoretic approach: S |=  iff L ( B S )  L ( B  ) iff L ( B S  B  )   Checking non-emptiness is equivalent to finding a reachable accepting cycle (lasso).

recurrence diameter Lassos Computation tree (CT) Explore all lassos in the CT DDFS,SCC: time efficient DFS: memory efficient Checking Non-Emptiness LTL

Randomized Algorithms Huge impact on CS: (distributed) algorithms, complexity theory, cryptography, etc. Takes of next step algorithm may depend on random choice (coin flip). Benefits of randomization include simplicity, efficiency, and symmetry breaking.

Randomized Algorithms Monte Carlo: may produce incorrect result but with bounded error probability. –Example: Election’s result prediction Las Vegas: always gives correct result but running time is a random variable. –Example: Randomized Quick Sort

recurrence diameter Explore N( ,  ) independent lassos in the CT Error margin  and confidence ratio  Monte Carlo Approach LTL … flip a k-sided coin Lassos Computation tree (CT)

Lassos Probability Space Sample Space: lassos in B S  B  Bernoulli random variable Z : –Outcome = 1 if randomly chosen lasso accepting –Outcome = 0 otherwise p Z = ∑ p i Z i (expectation of an accepting lasso) where p i is lasso prob. (uniform random walk)

Example: Lassos Probability Space ½ ¼⅛ ⅛ q Z = 7/8 p Z = 1/8

Geometric Random Variable Value of geometric RV X with parameter p z : No. of independent lassos until success. Probability mass function: p(N) = P[X = N] = q z N-1 p z Cumulative Distribution Function: F(N) = P[X  N] = ∑ i  N p(i) = 1 - q z N

How Many Lassos? Requiring P[X  N] = 1- δ yields : N = ln (δ) / ln (1- p z ) Lower bound on number of trials N needed to achieve success with confidence ratio δ.

What If p z Unknown? Requiring p z  ε yields : M = ln (δ) / ln (1- ε)  N = ln (δ) / ln (1- p z ) and therefore P[X  M]  1- δ Lower bound on number of trials M needed to achieve success with confidence ratio δ and error margin ε.

Statistical Hypothesis Testing Null hypothesis H 0 : p z  ε Alternative hypothesis H 1 : p z < ε If no success after N trials, then reject H 0 Type I error: α = P[ X > M | H 0 ] < δ Since: P[ X  M | H 0 ]  1- δ

Monte Carlo Model Checking (MC 2 ) input: B=(Σ,Q,Q 0,δ,F), ε, δ N = ln (δ) / ln (1- ε) for (i = 1; i  N; i++) if (RL(B) == 1) return (1, error-trace ); return (0, “reject H 0 with α = Pr[ X>N | H 0 ] < δ”); where RL(B) performs a uniform random walk through B to obtain a random lasso.

Correctness of MC 2 Theorem: Given a Büchi automaton B, error margin ε, and confidence ratio δ, if MC 2 rejects H 0, then its type I error has probability α = P[ X > M | H 0 ] < δ

Complexity of MC 2 Theorem: Given a Büchi automaton B having diameter D, error margin ε, and confidence ratio δ, MC 2 runs in time O(N∙D) and uses space O(D), where N = ln(δ) / ln(1- ε) Cf. DDFS which runs in O(2 |S|+|φ| ) time for B = B S  B .

Implementation Implemented DDFS and MC 2 in jMocha model checker for synchronous systems specified using Reactive Modules. Performance and scalability of MC 2 compares very favorably to DDFS.

(Deadlock freedom) DPh: Symmetric Unfair Version

(Starvation freedom) DPh: Symmetric Unfair Version

DPh: Asymmetric Fair Version (Deadlock freedom) δ = ε = 1.8*10 -3 N = 1278

DPh: Asymmetric Fair Version (Starvation freedom) δ = ε = 1.8*10 -3 N = 1278

Related Work Random walk testing: –Heimdahl et al: Lurch debugger. Random walks to sample system state space: –Mihail & Papadimitriou (and others) Monte Carlo Model Checking of Markov Chains: –Herault et al: LTL-RP, bonded MC, zero/one ET –Younes et al: Time-Bounded CSL, sequential analysis –Sen et al: Time-Bounded CSL, zero/one ET Probabilistic Model Checking of Markov Chains: – ETMCC, PRISM, PIOAtool, and others.

Conclusions MC 2 is first randomized, Monte Carlo algorithm for the classical problem of temporal-logic model checking. Future Work: Use BDDs to improve run time. Also, take samples in parallel! Open Problem: Branching-Time Temporal Logic (e.g. CTL, modal mu-calculus).

Talk Outline 1.Model Checking 2.Randomized Algorithms 3.LTL Model Checking 4.Probability Theory Primer 5.Monte Carlo Model Checking 6.Implementation & Results 7.Conclusions & Open Problem

Model Checking S is a nondeterministic/concurrent system.  is a temporal logic formula. –in our case Linear Temporal Logic (LTL). Basic idea: intelligently explore S ’s state space in attempt to establish S |= .

Linear Temporal Logic LTL formula: made up inductively of atomic propositions p, boolean connectives , ,  temporal modalities X (neXt) and U (Until). Safety: “nothing bad ever happens” E.g. G(  (pc 1 =cs  pc 2 =cs)) where G is a derived modality (Globally). Liveness: “something good eventually happens” E.g. G( req  F serviced ) where F is a derived modality (Finally).

Emptiness Checking Checking non-emptiness is equivalent to finding an accepting cycle reachable from initial state (lasso). Double Depth-First Search (DDFS) algorithm can be used to search for such cycles, and this can be done on-the-fly! s1s1 s2s2 s3s3 sksk s k-2 s k-1 s k+1 s k+2 s k+3 snsn DFS 2 DFS 1

Bernoulli Random Variable (coin flip) Value of Bernoulli RV Z: Z = 1 (success) & Z = 0 (failure) Probability mass function: p(1) = Pr[Z=1] = p z p(0) = Pr[Z=0] = 1- p z = q z Expectation: E[Z] = p z

Statistical Hypothesis Testing Example: Given a fair and a biased coin. –Null hypothesis H 0 - fair coin selected. –Alternative hypothesis H 1 - biased coin selected. Hypothesis testing: Perform N trials. –If number of heads is LOW, reject H 0. –Else fail to reject H 0.

Statistical Hypothesis Testing H 0 is TrueH 0 is False reject H 0 Type I error w/prob. α Correct to reject H 0 fail to reject H 0 Correct to fail to reject H 0 Type II error w/prob. β

Random Lasso (RL) Algorithm

Randomized Algorithms Huge impact on CS: (distributed) algorithms, complexity theory, cryptography, etc. Takes of next step algorithm may depend on random choice (coin flip). Benefits of randomization include simplicity, efficiency, and symmetry breaking.

Randomized Algorithms Monte Carlo: may produce incorrect result but with bounded error probability. –Example: Rabin’s primality testing Las Vegas: always gives correct result but running time is a random variable. –Example: Randomized Quick Sort

Lassos Probability Space L 1 = 11 L 2 = 1244 L 3 = 1231 L 4 = Pr[L 1 ]= ½ Pr[L 2 ]= ¼ Pr[L 3 ]= ⅛ Pr[L 4 ]= ⅛ q Z = L 1 + L 2 = ¾ p Z = L 3 + L 4 = ¼

Alternative Sampling Strategies 01 n n-1 Multilasso sampling: ignores backedges that do not lead to an accepting lasso. Pr[L n ]= O(2 -n ) Probabilistic systems: there is a natural way to assign a probability to a RL. Input partitioning: partition input into classes that trigger the same behavior (guards).