Statistical probabilistic model checking
description
Transcript of Statistical probabilistic model checking
Statistical probabilistic model checking
Håkan L. S. YounesCarnegie Mellon University(now at Google Inc.)
Younes Statistical probabilistic model checking 2
Introduction
Model-independent approach to probabilistic model checking
Relies on simulation and statistical sampling
Wrong answer possible, but can be bounded (probabilistically)
Low memory requirements (can handle large/infinite models)
Trivially parallelizable (distributed sampling gives linear speedup)
Topics covered in this talk:
Error control
Hypothesis testing vs. estimation
Dealing with unbounded properties/infinite trajectories
Younes Statistical probabilistic model checking 3
Probabilistic model checking
Given a model , a state s, and a property , does hold in s for ?
Model: stochastic discrete-event system
Property: probabilistic temporal logic formula
Example: tandem queuing network
“The probability is at least 0.1 that both queuesbecome full within 5 minutes”
q1 q2
arrive route depart
Younes Statistical probabilistic model checking 4
Probabilistic temporal logic (PCTL, CSL)
Standard logic operators: , , …
Probabilistic operator: ≥ [ ]
Holds in state s iff probability is at least for paths satisfying and starting in s
Bounded until: ≤T Holds over path iff becomes true along within time T, and is true
until then
Unbounded until: Holds over path iff becomes true eventually along , and is true until
then
Younes Statistical probabilistic model checking 5
Property examples
“The probability is at least 0.1 that both queues become full within 5 minutes”
≥0.1[ ≤5 full1 full2 ]
“The probability is at most 0.05 that the second queue becomes full before the first queue”
≤0.05[ full1 full2 ]
Younes Statistical probabilistic model checking 6
The problem (in detail)
Before we propose a solution, we need to fully define the problem
Possible outcomes of model-checking algorithm
Ideal vs. realistic error control
Younes Statistical probabilistic model checking 7
Possible outcomes of model-checking algorithm
Given a state s and a formula , a model-checking algorithm can:
Accept as true in s (s )
Reject as false in s (s )
Return an undecided result (s I )
An error occurs if:
rejects when is true (false negative)
accepts when is false (false positive)
Note: an undecided result is not an error, but still not desirable
Younes Statistical probabilistic model checking 8
Ideal error control
Bound the probability of false negatives/positives and undecided results under all circumstances
Bound on false negatives: Pr[s | s ]
Bound on false positives: Pr[s | s ]
Bound on undecided results: Pr[s I ]
If , , and are all low, then model-checking algorithm produces a correct result with high probability
Younes Statistical probabilistic model checking 9
Unrealistic expectations
Ideal error control for verifying probabilistic formula ≥ [ ] in state s
Actual probability of holding
s ≥ [ ]s ≥ [ ]
p
Pro
bab
ility
of a
cce
ptin
g ≥
[
] as
true
in s
1 – –
+
1 – 1
False negatives
False positives
Undecided
Younes Statistical probabilistic model checking 10
Relaxing the problem
Indifference region of width 2 centered around probability thresholds
Probabilistic operator: ≥ [ ]
Holds in state s if probability is at least + for paths satisfying and starting in s
Does not hold if probability is at most − for paths satisfying and starting in s
“Too close to call” if probability is within distance of (indifference)
Essentially three-valued logic, but we care only about true and false
Younes Statistical probabilistic model checking 11
Error control for relaxed problem
Option 1: bound the probability of false positives/negatives outside of the indifference region; no undecided results
Bound on false negatives: Pr[s | s ]
Bound on false positives: Pr[s | s ]
No undecided results: = 0 Pr[s I ] = 0
Option 2: bound the probability of undecided results outside of the indifference region; low error probability under all circumstances
Bound on false negatives: Pr[s | s ]
Bound on false positives: Pr[s | s ]
Bound on undecided results: Pr[s I | (s ) (s )]
Younes Statistical probabilistic model checking 12
Realistic error control—no undecided results
Error control for verifying probabilistic formula ≥ [ ] in state s
Actual probability of holding
s ≥ [ ]s ≥ [ ]
p
Pro
bab
ility
of a
cce
ptin
g ≥
[
] as
true
in s
1 – 1
False negatives
False positives + −
High error probabilityin indifference region
Younes Statistical probabilistic model checking 13
Realistic error control—with undecided results
Error control for verifying probabilistic formula ≥ [ ] in state s
Actual probability of holding
s ≥ [ ]s ≥ [ ]
p
Pro
bab
ility
of a
cce
ptin
g ≥
[
] as
true
in s
1 – 1
−
+ −
Acceptance probabilityRejection probability
High undecided probability in indifference region
Younes Statistical probabilistic model checking 14
The solution
Statistical sampling (hypothesis testing vs. estimation)
Undecided results
Avoiding infinite sample trajectories in simulation for unbounded until
Younes Statistical probabilistic model checking 15
Verifying probabilistic properties—no undecided resultsYounes & Simmons (CAV’02, Information and Computation’06)
Use acceptance sampling to verify ≥ [ ] in state s
Test hypothesis H0: p + against hypothesis H1: p –
Observation: verify over sample trajectories generated using simulation
Younes Statistical probabilistic model checking 16
Acceptance sampling with fixed sample size
Single sampling plan: n, c Generate n sample trajectories
Accept H0: p + iff more than c paths satisfy
Pick n and c such that: Probability of accepting H1 when H0 holds is at most
Probability of accepting H0 when H1 holds is at most
Sequential single sampling plan:
Accept H0 after m < n observations if more than c observations are positive
Accept H1 after m < n observations if at most k observations are positive and k + (n – m) ≤ c
Younes Statistical probabilistic model checking 17
Graphical representation of sequential single sampling plan
reject
accept
continue
Number of observations
Nu
mb
er
of p
osi
tive
obs
erv
atio
ns
Start here
Make observations
Continue untilline is crossed
n – c
c
n
Younes Statistical probabilistic model checking 18
Sequential probability ratio test (SPRT)Wald (Annals of Mathematical Statistics’45)
More efficient than sequential single sampling plan
After m observations, k positive, compute ratio:
Accept H0: p + if ≤ ∕ (1 – )
Accept H1: p – if ≥ (1 – ) ∕
No fixed upper bound on sample size, but much smaller on average
kmk
kmk
f
)1()(
)1()(
Younes Statistical probabilistic model checking 19
Graphical representation of SPRT
reject
accept
continue
Number of observations
Nu
mb
er
of p
osi
tive
obs
erv
atio
ns
Start here
Make observations
Continue untilline is crossed
Younes Statistical probabilistic model checking 20
Statistical estimationHérault et al. (VMCAI’04)
Estimate p with confidence interval of width 2 Accept H0: p + iff center of confidence interval is at least
Choosing sample size:
Same as single sampling plan n, n + 1; never more efficient!
1~Pr
2log
2
12 ppn
nest nopt nest ∕ nopt
0.5 10−2 10−2 26,492 13,527 1.96
0.5 10−8 10−2 95,570 39,379 2.43
0.5 10−8 10−8 95,570 78,725 1.21
0.9 10−2 10−2 26,492 4,861 5.45
0.9 10−8 10−2 95,570 13,982 6.84
0.9 10−8 10−8 95,570 28,280 3.38
Younes Statistical probabilistic model checking 21
Acceptance sampling with undecided resultsYounes (VMCAI’06)
Simultaneous acceptance sampling plans
H0: p against H1: p –
H0: p + against H1: p
Combining the results
Accept ≥ [ ] if H0 and H0 are accepted
Reject ≥ [ ] if H1 and H1 are accepted
Undecided result otherwise
Younes Statistical probabilistic model checking 22
Graphical representation of SPRT with undecided results
rejectcontinue
Number of observations
Nu
mb
er
of p
osi
tive
obs
erv
atio
ns
Start here
Make observations
Continue untilline is crossed
accept undecided
Younes Statistical probabilistic model checking 23
Unbounded until—avoiding infinite sample trajectoriesYounes (unpublished manuscript)
Premature termination with probability pt after each state transition
Ensures finite sample trajectories
Change value of positive sample trajectory from 1 to (1 – pt)–||
Inspired by Monte Carlo method for matrix inversion by Forsythe & Leibler (1950)
Observations no longer 0 or 1: previous methods do not apply
Use sequential estimation by Chow & Robbins (1965)
Lower pt means fewer samples, by longer trajectories
Note: Sen et al. (CAV’05) tried to handle unbounded until with termination probability, but flawed because observations are still 0 or 1
Younes Statistical probabilistic model checking 24
Empirical evaluation
Younes Statistical probabilistic model checking 25
Numerical vs. statistical (tandem queuing network)Younes et al. (TACAS’04)
Veri
fica
tion
tim
e (
seco
nds)
Size of state space101 102 103 104 105 106 107 108 109 1010 1011
10−2
10−1
100
101
102
103
104
105
106 T=500 (numerical)T=50 ( " )T=5 ( " )T=500 (statistical)T=50 ( " )T=5 ( " )
≥0.5( ≤T full)
= 10−6
= = 10−2
= 0.5·10−2
Younes Statistical probabilistic model checking 26
Numerical vs. statistical (symmetric polling system)Younes et al. (TACAS’04)
T=40 (numerical)T=20 ( " )T=10 ( " )T=40 (statistical)T=20 ( " )T=10 ( " )
Veri
fica
tion
tim
e (
seco
nds)
Size of state space
10−2
10−1
100
101
102
103
104
105
106
102 104 106 108 1010 1012 1014
serv1 ≥0.5( ≤T poll1)
= 10−6
= = 10−2
= 0.5·10−2
Younes Statistical probabilistic model checking 27
20
15
10
5
014 14.1 14.2 14.3 14.4 14.5
= 0 = 10–2
Formula time bound (T )
Ve
rific
atio
n ti
me
(se
con
ds)
Undecided results (symmetric polling system)Younes (VMCAI’06)
serv1 ≥0.5[ ≤T poll1]
Younes Statistical probabilistic model checking 28
Undecided results (symmetric polling system)
result 14.10 14.15 14.20 14.25 14.30 14.35 14.40
accept 0 3 9 50 88 97 100
reject 100 97 91 50 12 3 0
accept 0 0 0 0 32 99 100
reject 100 99 42 1 0 0 0
undecided 0 1 58 99 68 1 0
= = = 10–2
Younes Statistical probabilistic model checking 29
Thank you!
Questions?