Abstract
We address the problem of model checking stochastic systems, i.e., checking whether a stochastic system satisfies a certain temporal property with a probability greater (or smaller) than a fixed threshold. In particular, we present a Statistical Model Checking (SMC) approach based on Bayesian statistics. We show that our approach is feasible for a certain class of hybrid systems with stochastic transitions, a generalization of Simulink/Stateflow models. Standard approaches to stochastic discrete systems require numerical solutions for large optimization problems and quickly become infeasible with larger state spaces. Generalizations of these techniques to hybrid systems with stochastic effects are even more challenging. The SMC approach was pioneered by Younes and Simmons in the discrete and non-Bayesian case. It solves the verification problem by combining randomized sampling of system traces (which is very efficient for Simulink/Stateflow) with hypothesis testing (i.e., testing against a probability threshold) or estimation (i.e., computing with high probability a value close to the true probability). We believe SMC is essential for scaling up to large Stateflow/Simulink models. While the answer to the verification problem is not guaranteed to be correct, we prove that Bayesian SMC can make the probability of giving a wrong answer arbitrarily small. The advantage is that answers can usually be obtained much faster than with standard, exhaustive model checking techniques. We apply our Bayesian SMC approach to a representative example of stochastic discrete-time hybrid system models in Stateflow/Simulink: a fuel control system featuring hybrid behavior and fault tolerance. We show that our technique enables faster verification than state-of-the-art statistical techniques. We emphasize that Bayesian SMC is by no means restricted to Stateflow/Simulink models. It is in principle applicable to a variety of stochastic models from other domains, e.g., systems biology.
Similar content being viewed by others
Notes
A distribution P(θ) is said to be a conjugate prior for a likelihood function, P(d|θ), if the posterior, P(θ|d) is in the same family of distributions.
Modeling a Fault-Tolerant Fuel Control System. http://www.mathworks.com/help/simulink/examples/modeling-a-fault-tolerant-fuel-control-system.html.
A simple hypothesis completely specifies a distribution. For example, a Bernoulli distribution of parameter p is fully specified by the hypothesis p=0.3 (or some other numerical value). A composite hypothesis, instead, still leaves the free parameter p in the distribution. This results, e.g., in a family of Bernoulli distributions with parameter p<0.3.
References
Alur R, Courcoubetis C, Dill D (1991) Model-checking for probabilistic real-time systems. In: ICALP. LNCS, vol 510, pp 115–126
Baier C, Clarke EM, Hartonas-Garmhausen V, Kwiatkowska MZ, Ryan M (1997) Symbolic model checking for probabilistic processes. In: ICALP. LNCS, vol 1256, pp 430–440
Baier C, Haverkort BR, Hermanns H, Katoen J-P (2003) Model-checking algorithms for continuous-time Markov chains. IEEE Trans Softw Eng 29(6):524–541
Beals R, Wong R (2010) Special functions. Cambridge University Press, Cambridge
Bechhofer R (1960) A note on the limiting relative efficiency of the Wald sequential probability ratio test. J Am Stat Assoc 55:660–663
Bujorianu ML, Lygeros J (2006) Towards a general theory of stochastic hybrid systems. In: Blom HAP, Lygeros J (eds) Stochastic hybrid systems: theory and safety critical applications. Lecture notes contr inf, vol 337. Springer, Berlin, pp 3–30
Carlin BP, Louis TA (2009) Bayesian methods for data analysis, 3rd edn. CRC Press, Boca Raton
Cassandras CG, Lygeros J (eds) (2006) Stochastic hybrid systems. CRC Press, Boca Raton
Chadha R, Viswanathan M (2010) A counterexample-guided abstraction-refinement framework for Markov decision processes. ACM Trans Comput Log 12(1):1
Chow YS, Robbins H (1965) On the asymptotic theory of fixed-width sequential confidence intervals for the mean. Ann Math Stat 36(2):457–462
Ciesinski F, Größer M (2004) On probabilistic computation tree logic. In: Validation of stochastic systems. LNCS, vol 2925. Springer, Berlin, pp 147–188
Cohn DL (1994) Measure theory. Birkhäuser, Basel
Courcoubetis C, Yannakakis M (1995) The complexity of probabilistic verification. J ACM 42(4):857–907
DeGroot MH (2004) Optimal statistical decisions. Wiley, New York
Diaconis P, Ylvisaker D (1985) Quantifying prior opinion. In: Bayesian statistics 2: 2nd Valencia international meeting. Elsevier, Amsterdam, pp 133–156
Finkbeiner B, Sipma H (2001) Checking finite traces using alternating automata. In: Runtime verification (RV’01). ENTCS, vol 55, pp 44–60
Gelman A, Carlin JB, Stern HS, Rubin DB (1997) Bayesian data analysis. Chapman & Hall, London
Ghosh MK, Arapostathis A, Marcus SI (1997) Ergodic control of switching diffusions. SIAM J Control Optim 35(6):1952–1988
Gillespie DT (1976) A general method for numerically simulating the stochastic time evolution of coupled chemical reactions. J Comput Phys 22(4):403–434
Gong H, Zuliani P, Komuravelli A, Faeder JR, Clarke EM (2010) Analysis and verification of the HMGB1 signaling pathway. BMC Bioinform 11(S7):S10
Grosu R, Smolka S (2005) Monte Carlo model checking. In: TACAS. LNCS, vol 3440, pp 271–286
Hahn EM, Hermanns H, Wachter B, Zhang L (2009) INFAMY: an infinite-state Markov model checker. In: CAV, pp 641–647
Hansson H, Jonsson B (1994) A logic for reasoning about time and reliability. Form Asp Comput 6(5):512–535
Henriques D, Martins J, Zuliani P, Platzer A, Clarke EM (2012) Statistical model checking for Markov decision processes. In: QEST 2012: Proceedings of the 9th international conference on quantitative evaluation of systems. IEEE Press, New York, pp 84–93
Hérault T, Lassaigne R, Magniette F, Peyronnet S (2004) Approximate probabilistic model checking. In: VMCAI. LNCS, vol 2937, pp 73–84
Hlavacek WS, Faeder JR, Blinov ML, Posner RG, Hucka M, Fontana W (2006) Rules for modeling signal-transduction system. Sci STKE 18(344):re6
Hoeffding W (1963) Probability inequalities for sums of bounded random variables. J Am Stat Assoc 58(301):13–30
Jeffreys H (1961) Theory of probability. Clarendon, Oxford
Jha SK, Clarke EM, Langmead CJ, Legay A, Platzer A, Zuliani P (2009) A Bayesian approach to model checking biological systems. In: CMSB. LNCS, vol 5688, pp 218–234
Koymans R (1990) Specifying real-time properties with metric temporal logic. Real-Time Syst 2(4):255–299
Kwiatkowska M, Norman G, Parker D (2011) PRISM 4.0: verification of probabilistic real-time systems. In: CAV. LNCS, vol 6806, pp 585–591
Kwiatkowska MZ, Norman G, Parker D (2006) Symmetry reduction for probabilistic model checking. In: CAV. LNCS, vol 4144, pp 234–248
Langmead CJ (2009) Generalized queries and Bayesian statistical model checking in dynamic Bayesian networks: application to personalized medicine. In: CSB, pp 201–212
Maler O, Nickovic D (2004) Monitoring temporal properties of continuous signals. In: FORMATS. LNCS, vol 3253, pp 152–166
Meseguer J, Sharykin R (2006) Specification and analysis of distributed object-based stochastic hybrid systems. In: Hespanha JP, Tiwari A (eds) HSCC, vol 3927. Springer, Berlin, pp 460–475
Ouaknine J, Worrell J (2008) Some recent results in metric temporal logic. In: Proc of FORMATS. LNCS, vol 5215, pp 1–13
Platzer A (2011) Stochastic differential dynamic logic for stochastic hybrid programs. In: Bjørner N, Sofronie-Stokkermans V (eds) CADE. LNCS, vol 6803. Springer, Berlin, pp 431–445
Pnueli A (1977) The temporal logic of programs. In: FOCS. IEEE Press, New York, pp 46–57
Robert CP (2001) The Bayesian choice. Springer, Berlin
Rubinstein RY, Kroese DP (2008) Simulation and the Monte Carlo method. Wiley, New York
Sen K, Viswanathan M, Agha G (2004) Statistical model checking of black-box probabilistic systems. In: CAV. LNCS, vol 3114, pp 202–215
Sen K, Viswanathan M, Agha G (2005) On statistical model checking of stochastic systems. In: CAV. LNCS, vol 3576, pp 266–280
Shiryaev AN (1995) Probability. Springer, Berlin
Tiwari A (2002) Formal semantics and analysis methods for Simulink Stateflow models. Technical report, SRI International
Tiwari A (2008) Abstractions for hybrid systems. Form Methods Syst Des 32(1):57–83
Wald A (1945) Sequential tests of statistical hypotheses. Ann Math Stat 16(2):117–186
Wang Y-C, Komuravelli A, Zuliani P, Clarke EM (2011) Analog circuit verification by statistical model checking. In: ASP-DAC 2011: Proceedings of the 16th Asia and South Pacific design automation conference. IEEE Press, New York, pp 1–6
Younes HLS, Kwiatkowska MZ, Norman G, Parker D (2006) Numerical vs statistical probabilistic model checking. Int J Softw Tools Technol Transf 8(3):216–228
Younes HLS, Musliner DJ (2002) Probabilistic plan verification through acceptance sampling. In: AIPS workshop on planning via model checking, pp 81–88
Younes HLS, Simmons RG (2006) Statistical probabilistic model checking with a focus on time-bounded properties. Inf Comput 204(9):1368–1409
Yu PS, Krishna CM, Lee Y-H (1988) Optimal design and sequential analysis of VLSI testing strategy. IEEE Trans Comput 37(3):339–347
Zuliani P, Platzer A, Clarke EM (2010) Bayesian statistical model checking with application to Stateflow/Simulink verification. Technical report CMU-CS-10-100, Computer Science Department, Carnegie Mellon University
Acknowledgements
This research was sponsored in part by the GigaScale Research Center under contract no. 1041377 (Princeton University), National Science Foundation under contracts no. CNS0926181, CNS0931985, and no. CNS1054246, Semiconductor Research Corporation under contract no. 2005TJ1366, General Motors under contract no. GMCMUCRLNV301, by the US DOT award DTRT12GUTC11, and the Office of Naval Research under award no. N000141010188. This work was carried out while P. Zuliani was at Carnegie Mellon University.
Author information
Authors and Affiliations
Corresponding author
Appendix
Appendix
1.1 A.1 Proofs
In this Section we report proofs for some of the results presented in the paper.
Lemma 1 Function \(K:S\times\mathcal{B}(S)\rightarrow[0,1]\) is a stochastic kernel.
Proof
We show that K is in fact a convex combination of two stochastic kernels. It is easy to see that stochastic kernels are closed with respect to convex combinations.
We have already shown above that the discrete part of K, i.e., the summation term, is a stochastic kernel. Because jump is a function and x is fixed, jump e (x) is uniquely determined from x and e, so the argument from above still applies. For continuous transitions, consider any (q,x)∈S. Then the following integral
defines a probability measure over \(\mathcal{B}(S)\). Note that Π c (q,x) is a probability density over time, φ q is a continuous (thus measurable) function of time, and I B is measurable since \(B\in\mathcal{B}(S)\) is a measurable set. Thus, the integral is well-defined and satisfies the usual probability requirements for B=∅ and B=S. Countable additivity follows easily from Lebesgue’s dominated convergence theorem. It remains to prove that, for any \(B\in\mathcal{B}(S)\)
is a measurable function defined over \(\mathbb{R}^{n}\). Again, note that \(\mathcal{I}(x)\) is finite for all x, because the integrand functions are all measurable and integrate up to 1. We recall that the Lebesgue integral of a (non-negative, real) measurable function f with respect to some measure μ, is defined as
where a simple function takes only finitely many values (piecewise constant). A measurable simple function s can be written as a finite sum \(s = \sum_{i=1}^{l} c_{i} I_{C_{i}}\), where the c i ’s are non-negative reals, and the C i ’s are disjoint measurable sets. The integral of s with respect to μ is defined to be the finite sum
and it is easy to check that the integral does not depend on the particular representation of s.
It can be shown (see for example [12, Proposition 2.3.3]) that the Lebesgue integral (16) is equivalently defined as lim i→∞∫f i dμ, where {f i } is any non-decreasing sequence of measurable simple functions that converges pointwise to f. Such a sequence can always be found [12, Proposition 2.1.7]. Finally, for any sequence {g i } of (non-negative, real) measurable functions, the function lim i→∞ g i (with domain {x | lim inf i→∞ g i (x)=lim sup i→∞ g i (x)}), is measurable [12, Proposition 2.1.4]. Therefore, \(\mathcal{I}(\cdot)\) is a measurable function. □
Lemma 2 (Bounded sampling) The problem “σ⊨ϕ” is well-defined and can be checked for BLTL formulas ϕ and traces σ based on only a finite prefix of σ of bounded duration.
Proof
According to Lemma 3, the decision “σ⊨ϕ” is uniquely determined (and well-defined) by considering only a prefix of σ of duration \(\#(\phi) \in \mathbb{Q}_{{\geq}0}\). By divergence of time, σ reaches or exceeds this duration #(ϕ) in some finite number of steps n. Let σ′ denote a finite prefix of σ of length n such that ∑0≤l<n t l ≥#(ϕ). Again by Lemma 3, the semantics of σ′⊨ϕ is well-defined because any extension σ″ of σ′ satisfies σ″⊨ϕ if and only if σ′⊨ϕ. Consequently the semantics of σ′⊨ϕ coincides with the semantics of σ⊨ϕ. On the finite trace σ′, it is easy to see that BLTL is decidable by evaluating the atomic formulas x∼v at each state s i of the system simulation. □
Lemma 3 (BLTL on bounded simulation traces) Let ϕ be a BLTL formula, \(k\in\mathbb{N}\) . Then for any two infinite traces σ=(s 0,t 0),(s 1,t 1),… and \(\tilde{\sigma}= (\tilde{s_{0}},\tilde{t_{0}}),(\tilde{s_{1}},\tilde {t_{1}}),\dots\) with
we have that
Proof
The proof is by induction on the structure of the BLTL formula ϕ. IH is short for induction hypothesis.
-
1.
If ϕ is of the form y∼v, then σ k⊨y∼v iff \(\tilde{\sigma}^{k} \models y \sim v\), because \(s_{k} = \tilde{s}_{k}\) by using (17) for i=0.
-
2.
If ϕ is of the form ϕ 1∨ϕ 2, then
$$\begin{aligned} & \sigma^k \models\phi_1 \lor\phi_2 \\ &\quad\text{iff} \quad\sigma^k \models\phi_1 \quad\text {or}\quad\sigma^k \models\phi_2 \\ &\quad\text{iff} \quad\tilde{\sigma}^k \models\phi_1 \quad\text {or}\quad\tilde{\sigma}^k \models\phi_2 \quad\text{by IH as } \# (\phi_1\lor\phi_2)\geq\#(\phi_1) \ \ \ \text{and}\ \ \ \#(\phi_1\lor\phi_2)\geq\#(\phi_2) \\ &\quad\text{iff} \quad\tilde{\sigma}^k \models\phi_1 \lor\phi_2 \end{aligned}$$The proof is similar for ¬ϕ 1 and ϕ 1∧ϕ 2.
-
3.
If ϕ is of the form ϕ 1 U t ϕ 2, then σ k⊨ϕ 1 U t ϕ 2 iff conditions (a), (b), (c) of Definition 6 hold. Those conditions are equivalent, respectively, to the following conditions (a′), (b′), (c′):
- (a′):
-
\(\sum_{0\leq l<i} {\tilde{t}}_{k+l} \leq t\), because #(ϕ 1 U t ϕ 2)≥t such that the durations of trace σ and \(\tilde{\sigma}\) are \(t_{k+l}=\tilde{t}_{k+l}\) for each index l with 0≤l<i by assumption (17).
- (b′):
-
\(\tilde{\sigma}^{k+i}\models\phi_{2}\) by induction hypothesis as follows: We know that the traces σ and \(\tilde{\sigma}\) match at k for duration #(ϕ 1 U t ϕ 2) and need to show that the semantics of ϕ 1 U t ϕ 2 matches at k. By IH we know that ϕ 2 has the same semantics at k+i (that is \(\tilde{\sigma}^{k+i}\models\phi_{2}\) iff σ k+i⊨ϕ 2) provided that we can show that the traces σ and \(\tilde{\sigma}\) match at k+i for duration #(ϕ 2). For this, consider any \(I\in\mathbb{N}\) with ∑0≤l<I t k+i+l ≤#(ϕ 2). Then
$$\begin{aligned} \#(\phi_2) &\geq\sum_{0\leq l<I} {t}_{k+i+l} = \sum_{0\leq l<i+I} {t}_{k+l} - \sum_{0\leq l<i} {t}_{k+l} \stackrel {(\mathrm{a})}{\geq} \sum_{0\leq l<i+I} {t}_{k+l} - t \end{aligned}$$Thus
$$\begin{aligned} \sum_{0\leq l<i+I} {t}_{k+l} &\leq t+\# (\phi_2) \leq t+\max\bigl(\#(\phi_1),\# (\phi_2)\bigr) = \#(\phi_1{ \mathbf{U}}^t {\phi_2}) \end{aligned}$$As \(I\in\mathbb{N}\) was arbitrary, we conclude from this with assumption (17) that, indeed \(s_{I}=\tilde{s}_{I} \) and \(t_{I}=\tilde{t}_{I}\) for all \(I\in\mathbb{N}\) with
$$\sum_{0\leq l<I} {t}_{k+i+l}\leq\# (\phi_2) $$Thus the IH for ϕ 2 yields the equivalence of σ k+i⊨ϕ 2 and \(\tilde{\sigma}^{k+i}\models\phi_{2}\) when using the equivalence of (a) and (a′).
- (c′):
-
for each 0≤j<i, \(\tilde{\sigma }^{k+j}\models \phi_{1}\). The proof of equivalence to (c) is similar to that for (b′) using j<i.
The existence of an \(i\in\mathbb{N}\) for which these conditions (a′),(b′),(c′) hold is equivalent to \(\tilde{\sigma}^{k} \models\phi_{1}{\mathbf{U}}^{t} {\phi_{2}}\). □
Theorem 1 (Termination of Bayesian estimation) The Sequential Bayesian interval estimation Algorithm 2 terminates with probability one.
Proof
We follow an argument by DeGroot [14, Sect. 10.5]. Let p be the actual probability that the BLTL formula ϕ holds, and let x 1,…,x n a sample given by model checking ϕ over n simulation traces (i.e., iid as the random variable X defined by (2)). Recall that the estimation algorithm returns an interval of width 2δ which contains p with posterior probability at least c, where \(\delta\in(0,\frac {1}{2})\) and \(c\in(\frac{1}{2},1)\) are user-specified parameters. We shall show that the posterior probability of any open interval containing p must converge almost surely to 1, as n→∞.
Let α,β>0 be the parameters of the Beta prior. We know that the posterior X n given the sample x 1,…,x n has a Beta distribution (5) with parameters x+α and n−x+β, where \(x = \sum_{i=1}^{n} x_{i}\). Recall that the posterior mean (8) is:
and the posterior variance is (see Appendix A.2):
Because x⩽n and α,β>0, we have that
and thus \(\lim_{n\rightarrow\infty} \hat{\sigma}^{2}_{n} = 0\), i.e., the posterior variance tends to 0 as we increase the sample size. (Intuitively, X n will be arbitrarily close to its mean, as n→∞.) Also, note that this is everywhere convergence, and not just almost sure convergence.
Now, since α and β are fixed, from the law of large numbers it follows that
But \(\lim_{n\rightarrow\infty} \hat{\sigma}^{2}_{n} = \lim _{n\rightarrow\infty} E[ (X_{n} - \hat{p}_{n})^{2}] =0\), so X n converges almost surely to the constant random variable p. Therefore, the posterior probability P(X n ∈I) of any open interval I containing p must converge almost surely to 1, as n→∞. Finally, note that the interval returned by the algorithm is always of fixed size 2δ>0. □
Theorem 2 (Error bound for hypothesis testing) For any discrete random variable and prior, the probability of a Type I-II error for the Bayesian hypothesis testing Algorithm 1 is bounded above by \(\frac{1}{T}\) , where T is the Bayes Factor threshold given as input.
Proof
We present the proof for Type I error only—for Type II it is very similar. A Type I error occurs when the null hypothesis H 0 is true, but we reject it. We then want to bound P(reject H 0∣H 0). If the Bayesian Algorithm 1 stops at step n, then it will accept H 0 if \(\mathcal{B}(d) > T\), and reject H 0 if \(\mathcal {B}(d)< \frac{1}{T}\), where d=(x 1,…,x n ) is the data sample, and the Bayes Factor is
The event {reject H 0} is formally defined as
where D is the random variable denoting a sequence of n (finite) discrete random variables, and Ω is the sample space of D—i.e., the (countable) set of all the possible realizations of D (in our case D is clearly finite). We now reason:
□
Theorem 3 (Error bound for estimation) For any discrete random variable and prior, the Type I and II errors for the output interval (t 0,t 1) of the Bayesian estimation Algorithm 2 are bounded above by \(\frac{(1-c)\pi_{0}}{c(1-\pi_{0})}\) , where c is the coverage coefficient given as input and π 0 is the prior probability of the hypothesis H 0:p∈(t 0,t 1).
Proof
Let (t 0,t 1) be the interval estimate when the estimation Algorithm 2 terminates (with coverage c). From the hypothesis
we compute the Bayes factor for H 0 vs. the alternate hypothesis H 1:p∉(t 0,t 1). Then we use Theorem 2 to derive the bounds on the Type I and II error. If the estimation Algorithm 2 terminates at step n with output t 0,t 1, we have that:
and therefore (since the posterior is a distribution):
By (13) we get the Bayes factor of H 0 vs. H 1, which can then be bounded by (21) and (22) as follows
Therefore, by Theorem 2 the error is bounded above by \((\frac{c(1-\pi_{0})}{(1-c)\pi_{0}} )^{-1} = \frac{(1-c)\pi _{0}}{c(1-\pi_{0})}\). □
1.2 A.2 The Beta Distribution
For the reader’s convenience, we calculate the mean and variance of a random variable Y with Beta density of parameters u,v>0. What we outline below can be found in most textbooks on Bayesian statistics and special functions, e.g., [39] and [4].
Recall that the Beta density is
where the Beta function B(u,v) is defined as:
It is well known that
where Γ(⋅) is Euler’s gamma function defined for \(z\in \mathbb{C}\) with ℜ(z)>0 as:
Also, the gamma function satisfies the equation Γ(z+1)=zΓ(z), for ℜ(z)>0. By means of a few algebraic steps, we are now able to compute the mean of Y:
For the variance, we proceed analogously to show that
and therefore
Rights and permissions
About this article
Cite this article
Zuliani, P., Platzer, A. & Clarke, E.M. Bayesian statistical model checking with application to Stateflow/Simulink verification. Form Methods Syst Des 43, 338–367 (2013). https://doi.org/10.1007/s10703-013-0195-3
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10703-013-0195-3