abstraction refinement for probabilistic software
play

Abstraction Refinement for Probabilistic Software Sascha Kurowski - PowerPoint PPT Presentation

Abstraction Refinement for Probabilistic Software Abstraction Refinement for Probabilistic Software Sascha Kurowski 6. Juli 2016 0/25 1/25 Sascha Kurowski | 6. Juli 2016 Sascha Kurowski | 6. Juli 2016 Probabilistic programs Outline ANSI-C


  1. Abstraction Refinement for Probabilistic Software Abstraction Refinement for Probabilistic Software Sascha Kurowski 6. Juli 2016 0/25 1/25 Sascha Kurowski | 6. Juli 2016 Sascha Kurowski | 6. Juli 2016

  2. Probabilistic programs Outline ANSI-C program 2/25 Sascha Kurowski | 6. Juli 2016

  3. Probabilistic programs Gambler’s ruin int main ( ) { 1: int c = ndet (2) + 1; 2: while (0 < c && c < 3) { 3: c += coin ( 0 . 5 ) ? 1: − 1; } 4: assert ( c > 0 ) ; } 3/25 Sascha Kurowski | 6. Juli 2016

  4. Probabilistic programs Gambler’s ruin int main ( ) { 1: int c = ndet (2) + 1; 2: while (0 < c && c < 3) { c += coin ( 0 . 5 ) ? 1: − 1; 3: } 4: assert ( c > 0 ) ; } Non-deterministic choice: int ndet( int n) ◮ No information about outcome ◮ Returns any value between 0 and n ◮ E.g. user input or underspecified function 3/25 Sascha Kurowski | 6. Juli 2016

  5. Probabilistic programs Gambler’s ruin int main ( ) { 1: int c = ndet (2) + 1; 2: while (0 < c && c < 3) { c += coin ( 0 . 5 ) ? 1: − 1; 3: } 4: assert ( c > 0 ) ; } Probabilistic choices: int coin( float p) ◮ Likelyhood of each possible outcome known ◮ Returns 1 with probability p and 0 with probability 1 − p ◮ E.g. randomization or network communication 3/25 Sascha Kurowski | 6. Juli 2016

  6. Probabilistic programs Gambler’s ruin int main ( ) { 1: int c = ndet (2) + 1; 2: while (0 < c && c < 3) { 3: c += coin ( 0 . 5 ) ? 1: − 1; } 4: assert ( c > 0 ) ; } 3/25 Sascha Kurowski | 6. Juli 2016

  7. Probabilistic programs Outline ANSI-C program Model extraction Probabilistic program 4/25 Sascha Kurowski | 6. Juli 2016

  8. Probabilistic programs Gambler’s ruin int main ( ) { 1 1: int c = ndet (2) + 1; 2: while (0 < c && c < 3) { c=ndet(2)+1 if (c <= 0 c += coin ( 0 . 5 ) ? 1: − 1; 3: || c >= 3) 4 2 } 4: assert ( c > 0 ) ; if (0 < c c += } && c < 3) coin(0.5) ? 1: − 1 3 5/25 Sascha Kurowski | 6. Juli 2016

  9. Probabilistic programs Semantics of probabilistic programs 1 c=ndet(2)+1 if (c <= 0 || c >= 3) 4 2 if (0 < c c += && c < 3) coin(0.5) ? 1: − 1 3 6/25 Sascha Kurowski | 6. Juli 2016

  10. Probabilistic programs Semantics of probabilistic programs 1 : c = 0 1 1 2 : c = 0 2 : c = 1 2 : c = 2 2 : c = 3 1 1 1 3 : c = 1 3 : c = 2 1 0 . 5 0 . 5 0 . 5 0 . 5 4 : c = 3 4 : c = 0 7/25 Sascha Kurowski | 6. Juli 2016

  11. Model checking Schedulers ◮ Schedulers resolve non-determinism by mapping each state to a non-deterministic choice 1 : c = 0 1 1 2 : c = 0 2 : c = 1 2 : c = 2 2 : c = 3 1 1 1 3 : c = 1 3 : c = 2 1 0 . 5 0 . 5 0 . 5 0 . 5 4 : c = 0 4 : c = 3 8/25 Sascha Kurowski | 6. Juli 2016

  12. Model checking Schedulers ◮ Schedulers resolve non-determinism by mapping each state to a non-deterministic choice 1 : c = 0 1 1 2 : c = 0 2 : c = 1 2 : c = 2 2 : c = 3 1 1 1 3 : c = 1 3 : c = 2 1 0 . 5 0 . 5 0 . 5 0 . 5 4 : c = 0 4 : c = 3 8/25 Sascha Kurowski | 6. Juli 2016

  13. Model checking Schedulers ◮ Schedulers resolve non-determinism by mapping each state to a non-deterministic choice 1 : c = 0 1 1 2 : c = 0 2 : c = 1 2 : c = 2 2 : c = 3 1 1 1 3 : c = 1 3 : c = 2 1 0 . 5 0 . 5 0 . 5 0 . 5 4 : c = 0 4 : c = 3 8/25 Sascha Kurowski | 6. Juli 2016

  14. Model checking Probabilities Problem ◮ Calculating the probability of a state is impossible ◮ Instead, there is a separate probability for each scheduler Idea ◮ Define properties over minimal and maximal probabilities ◮ I.e. consider the best-case and the worst-case scheduler 9/25 Sascha Kurowski | 6. Juli 2016

  15. Model checking Probabilities Probability of ♦ red 1 + 1 3 + 1 5 + · · · = 2 ◮ Scheduler c = 1 : 1 2 2 2 3 10/25 Sascha Kurowski | 6. Juli 2016

  16. Model checking Probabilities Probability of ♦ red 1 + 1 3 + 1 5 + · · · = 2 ◮ Scheduler c = 1 : 1 2 2 2 3 1 + 1 3 + 1 5 + . . . ) = 1 ◮ Scheduler c = 2 : 1 2 × ( 1 2 2 2 3 10/25 Sascha Kurowski | 6. Juli 2016

  17. Model checking Probabilities Probability of ♦ red 1 + 1 3 + 1 5 + · · · = 2 ◮ Scheduler c = 1 : 1 2 2 2 3 Maximal probability 1 + 1 3 + 1 5 + . . . ) = 1 ◮ Scheduler c = 2 : 1 2 × ( 1 2 2 2 3 Minimal probability 10/25 Sascha Kurowski | 6. Juli 2016

  18. Model checking Probabilities Probability of ♦ red 1 + 1 3 + 1 5 + · · · = 2 ◮ Scheduler c = 1 : 1 2 2 2 3 1 + 1 3 + 1 5 + . . . ) = 1 ◮ Scheduler c = 2 : 1 2 × ( 1 2 2 2 3 ◮ Probabilities can be calculated using a linear optimisation problem 10/25 Sascha Kurowski | 6. Juli 2016

  19. Model checking State space explosion ◮ MDP semantics often have too many (or even infinitely many) states 1 c=0 int main ( ) { 1: int c = 0; 2 6 2: bool f a i l = false ; 3: while ( ! f a i l ) { if ( fail ) fail =false 4: f a i l = coin ( 0 . 5 ) ; 3 5: c++; 6: } if (! fail ) c++ } 4 5 fail =coin(0.5) 11/25 Sascha Kurowski | 6. Juli 2016

  20. Model checking State space explosion Problem 2 32 + · · · + 2 32 |M| ≈ × Number of statements � �� � Number of 32-bit integer variables Idea Reduce the value ranges of variables 12/25 Sascha Kurowski | 6. Juli 2016

  21. Abstraction of Probabilistic Programs Outline Stochastic game ANSI-C program Model construction Model extraction Boolean Probabilistic probabilistic program program 13/25 Sascha Kurowski | 6. Juli 2016

  22. Abstraction of Probabilistic Programs Predicate abstraction Solution Replace original variables with predicates (boolean expressions) 14/25 Sascha Kurowski | 6. Juli 2016

  23. Abstraction of Probabilistic Programs Predicate abstraction Solution Replace original variables with predicates (boolean expressions) int main ( ) { int i = 0; while ( true ) { assert ( i != 443); i f ( i < 10) { i = i + 1; } else i = i + 2; } } 14/25 Sascha Kurowski | 6. Juli 2016

  24. Abstraction of Probabilistic Programs Predicate abstraction Solution Replace original variables with predicates (boolean expressions) Predicates: i < 10 , i mod 2 = 0 int main ( ) { 0 , 2 , . . . , 8 1 , 3 , . . . , 9 int i = 0; while ( true ) { ✓✓ ✓✗ assert ( i != 443); i f ( i < 10) { i = i + 1; } ✗✗ ✗✓ else i = i + 2; . . . , 443 , . . . 10 , 12 , . . . } Min. and max. Prob ( ♦ ✗✗ ) = 0 } 14/25 Sascha Kurowski | 6. Juli 2016

  25. Abstraction of Probabilistic Programs Predicate abstraction Solution Replace original variables with predicates (boolean expressions) Predicates: i < 10 , i mod 2 = 0 int main ( ) { 0 , 2 , . . . , 8 1 , 3 , . . . , 9 int i = 0; while ( true ) { ✓✓ ✓✗ assert ( i != 443); i f ( i < 10) { i = i + 1; } ✗✗ ✗✓ else i = i + 2; . . . , 443 , . . . 10 , 12 , . . . } Min. and max. Prob ( ♦ ✗✗ ) = 0 } 14/25 Sascha Kurowski | 6. Juli 2016

  26. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  27. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  28. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  29. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  30. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  31. Abstraction of Probabilistic Programs Two-player stochastic game 0 . 5 Definition B A two-player stochastic game is a 0 . 5 1 tuple ˆ M = ( ˆ s init , ˆ S, ˆ P ) with 1 1 ◮ countable, non-empty set of A C states ˆ S s init ∈ ˆ 1 ◮ initial state ˆ S 0 . 4 ◮ transition function P : ˆ 0 . 6 ˆ S → P ( P ( Dist ˆ S )) 15/25 Sascha Kurowski | 6. Juli 2016

  32. Abstraction of Probabilistic Programs Outline Stochastic game ANSI-C program Model construction Model checking Model extraction Boolean Probabilistic probabilistic error ≤ ǫ ? Results program Yes program 16/25 Sascha Kurowski | 6. Juli 2016

Recommend


More recommend