reasoning about recursive
play

Reasoning about Recursive 1 Pr[ nobody disturbs ] 3 2 Pr[ nobody - PowerPoint PPT Presentation

Reasoning about Recursive 1 Pr[ nobody disturbs ] 3 2 Pr[ nobody disturbs ] 1 2 2 Pr[ nobody disturbs ] 1 2 Probabilistic Programs Federico Olmedo Benjamin Kaminski Joost-Pieter Katoen Christoph Matheja


  1. Reasoning about Recursive � 1 Pr[ nobody disturbs ] ≥ � 3 2 Pr[ nobody disturbs ] ≥ � 1 � 2 2 Pr[ nobody disturbs ] ≥ 1 2 Probabilistic Programs Federico Olmedo Benjamin Kaminski Joost-Pieter Katoen Christoph Matheja RWTH Aachen University, Germany LICS 2016 July 8 th — New York City

  2. Randomization Leads to Intricate Behaviours 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  3. Randomization Leads to Intricate Behaviours { skip } [ 1 / 2 ] { call P } P ◃ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  4. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  5. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  6. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ Probability of Termination: 1 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  7. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ Probability of Termination: 1 Runtime: 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  8. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ Probability of Termination: 1 Runtime: 1 sec. 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  9. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ Probability of Termination: 1 Runtime: 1 min. 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  10. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ Probability of Termination: 1 Runtime: 1 hour 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  11. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ It terminates with probability 1, but reaching termination takes Probability of Termination: 1 (in average) infinite time ! ∞ Runtime: www.ragefaces.memesoftware.com/ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  12. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ It terminates with probability 1, but reaching termination takes Probability of Termination: 1 (in average) infinite time ! ∞ Runtime: www.ragefaces.memesoftware.com/ { skip } [ 1 / 2 ] { call P ; call P ; call P } P ◃ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  13. Randomization Leads to Intricate Behaviours It terminates with probability 1, { skip } [ 1 / 2 ] { call P } P ◃ even though it admits arbitrarily Probability of Termination: 1 long executions ! www.walldevil.com/ { skip } [ 1 / 2 ] { call P ; call P } P ◃ It terminates with probability 1, but reaching termination takes Probability of Termination: 1 (in average) infinite time ! ∞ Runtime: www.ragefaces.memesoftware.com/ { skip } [ 1 / 2 ] { call P ; call P ; call P } P ◃ It terminates with an irrational probability ! √ Probability of Termination: 5 − 1 2 www.gagfire.com/ 2 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  14. Randomized (Recursive) Algorithms are Natural and Widespread “For many applications, a randomized algorithm is the simplest algorithm available, or the fastest , or both .” [Motwani & Raghavan] 3 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  15. Randomized (Recursive) Algorithms are Natural and Widespread “For many applications, a randomized algorithm is the simplest algorithm available, or the fastest , or both .” [Motwani & Raghavan] Quicksort: QS( A ) , if ( | A |  1) then return ( A ); i := b | A | / 2 c ; A < := { a 0 2 A | a 0 < A [ i ] } ; A > := { a 0 2 A | a 0 > A [ i ] } ; � � QS( A < ) ++ A [ i ] ++ QS( A > ) return Deterministic version: O (n 2 ) comparisons 3 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  16. Randomized (Recursive) Algorithms are Natural and Widespread “For many applications, a randomized algorithm is the simplest algorithm available, or the fastest , or both .” [Motwani & Raghavan] Randomized Quicksort: rQS( A ) , if ( | A | ≤ 1) then return ( A ); i := rand[1 . . . | A | ]; A < := { a 0 ∈ A | a 0 < A [ i ] } ; A > := { a 0 ∈ A | a 0 > A [ i ] } ; � � QS( A < ) ++ A [ i ] ++ QS( A > ) return Randomized version: O (n log(n)) comparisons 3 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  17. Randomized (Recursive) Algorithms are Natural and Widespread “For many applications, a randomized algorithm is the simplest algorithm available, or the fastest , or both .” [Motwani & Raghavan] Randomized Quicksort: Sample Randomized Recursive Algorithms: rQS( A ) , Quicksort if ( | A | ≤ 1) then return ( A ); Median finding i := rand[1 . . . | A | ]; Binary search A < := { a 0 ∈ A | a 0 < A [ i ] } ; Simple path of length k A > := { a 0 ∈ A | a 0 > A [ i ] } ; Euclidean matching � � QS( A < ) ++ A [ i ] ++ QS( A > ) ….. return Randomized version: O (n log(n)) comparisons 3 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  18. Current Analysis Approaches are Not Satisfactory Current Analysis Approaches: Mathematical ad-hoc reasoning (on involved random variables) Mathematical ad-hoc reasoning (on involved random variables) Probabilistic recurrence relations Probabilistic recurrence relations Dedicated techniques for D&C algorithms Dedicated techniques for D&C algorithms 4 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  19. Current Analysis Approaches are Not Satisfactory Current Analysis Approaches: Cover only a fragment of the proof argument Mathematical ad-hoc reasoning (on involved random variables) Non-trivial claims are taken for granted Probabilistic recurrence relations Dedicated techniques for D&C algorithms 4 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  20. Current Analysis Approaches are Not Satisfactory Current Analysis Approaches: Cover only a fragment of the proof argument Mathematical ad-hoc reasoning (on involved random variables) Non-trivial claims are taken for granted Probabilistic recurrence relations Dedicated techniques for D&C algorithms Our Approach: Formal verification using only first principles directly from the program code 4 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  21. Our Contribution DEDUCTIVE VERIFICATION OF RANDOMIZED RECURSIVE ALGORITHMS Two calculi à la weakest pre-condition: For reasoning about program outcomes , e.g. � x = x opt � ≥ 0 . 9 Pr For reasoning about program expected runtimes , e.g. ert ≤ x + y Soundness of the calculi w.r.t. an operational semantics Application: probabilistic binary search 5 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

  22. Calculi — Basics For Program Outcomes [Kozen ’81] probabilisitic program wp[ c ]: ( S → [0, 1]) → ( S → [0, 1]) quantitative quantitative post-condition pre-condition : probability that c wp[ c ]( Q ) establishes post-condition Q . 6 Reasoning about Recursive Probabilistic Programs — Olmedo , Kaminski, Katoen & Matheja

Recommend


More recommend