Motivation Probabilistic Programs Probabilistic Programs What does a probabilistic program C do? Run program C on initial state Ļ Obtain final set of (subā)distributions µ over terminal states What is the runātime of C on input Ļ ? Behavior of C not entirely determined by Ļ Probabilistic nature of C influences its runātime Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 4
Motivation Probabilistic Programs Probabilistic Programs What does a probabilistic program C do? Run program C on initial state Ļ Obtain final set of (subā)distributions µ over terminal states What is the runātime of C on input Ļ ? Behavior of C not entirely determined by Ļ Probabilistic nature of C influences its runātime Better Question: What is the expected runātime (ERT) of C on input Ļ ? Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 4
Motivation Expected RunāTimes Expected RunāTime Phenomena Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations x := 1; while ( 1 / 2 ) { x := 2 Ā· x } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations x := 1; while ( 1 / 2 ) { x := 2 Ā· x } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: x := 1; while ( 1 / 2 ) { x := 2 Ā· x } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite x := 1; while ( 1 / 2 ) { x := 2 Ā· x } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite x := 1; while ( 1 / 2 ) { x := 2 Ā· x } ; while ( x > 0) { x := x ā 1 } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite Positively almostāsurely terminating programs are not closed under sequential composition x := 1; while ( 1 / 2 ) { x := 2 Ā· x } ; while ( x > 0) { x := x ā 1 } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite Positively almostāsurely terminating programs are not closed under sequential composition Reasoning about positive almostāsure termination is computationally very difficult: x := 1; while ( 1 / 2 ) { x := 2 Ā· x } ; while ( x > 0) { x := x ā 1 } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite Positively almostāsurely terminating programs are not closed under sequential composition Reasoning about positive almostāsure termination is computationally very difficult: Strictly more difficult than the termination problem for nonāprobabilistic programs [MFCS 2015] x := 1; while ( 1 / 2 ) { x := 2 Ā· x } ; while ( x > 0) { x := x ā 1 } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTime Phenomena ERT of C can be finite even if C admits infinite computations Positive almostāsure termination: ERT of C is finite Positively almostāsurely terminating programs are not closed under sequential composition Reasoning about positive almostāsure termination is computationally very difficult: Strictly more difficult than the termination problem for nonāprobabilistic programs [MFCS 2015] ERT of C can be infinite, even if C terminates almostāsurely 1 x := 1; while ( 1 / 2 ) { x := 2 Ā· x } ; while ( x > 0) { x := x ā 1 } 1 i.e. with probability 1 Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 5
Motivation Expected RunāTimes Expected RunāTimes Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 ERT if C does not terminate almostāsurely on Ļ : ā Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 ERT if C does not terminate almostāsurely on Ļ : ā In general: ERT of C is a function t : Ī£ ā R ā ā„ 0 Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 ERT if C does not terminate almostāsurely on Ļ : ā In general: ERT of C is a function t : Ī£ ā R ā ā„ 0 Call such a t a runātime. Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 ERT if C does not terminate almostāsurely on Ļ : ā In general: ERT of C is a function t : Ī£ ā R ā ā„ 0 Call such a t a runātime. Denote set of runātimes by T . Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Motivation Expected RunāTimes Expected RunāTimes ERT if C terminates almostāsurely on Ļ : ļæ½ ā C terminates after ā ļæ½ ļæ½ i Ā· Pr i steps on input Ļ ā i =1 ERT if C does not terminate almostāsurely on Ļ : ā In general: ERT of C is a function t : Ī£ ā R ā ā„ 0 Call such a t a runātime. Denote set of runātimes by T . Complete partial order on T : t 1 ļæ½ t 2 iff ā Ļ ā Ī£: t 1 ( Ļ ) ⤠t 2 ( Ļ ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 6
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . C Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . C t time needed after executing C Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . C t time needed after executing C Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . ert [ C ] ( t ) C t expected time needed time needed before executing C after executing C Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Use a continuation passing style ERT transformer ert [ C ]: T ā T . ert [ C ] ( t ) C t expected time needed time needed before executing C after executing C ERT in Terms of ert ert [ C ] ( 0 ) ( Ļ ) = āERT of C on input Ļ ā Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 7
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] C 1 ; C 2 ert [ C 1 ] ( ert [ C 2 ] ( t )) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] C 1 ; C 2 ert [ C 1 ] ( ert [ C 2 ] ( t )) { C 1 } ļæ½ { C 2 } max { ert [ C 1 ] ( t ) , ert [ C 2 ] ( t ) } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] C 1 ; C 2 ert [ C 1 ] ( ert [ C 2 ] ( t )) { C 1 } ļæ½ { C 2 } max { ert [ C 1 ] ( t ) , ert [ C 2 ] ( t ) } if ( ξ ) { C 1 } else { C 2 } 1 + ļæ½ ξ : true ļæ½ Ā· ert [ C 1 ] ( t ) + ļæ½ ξ : false ļæ½ Ā· ert [ C 2 ] ( t ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes The ert Transformer Rules for the ert Transformer ert [ C ] ( t ) C 1 + t skip x := E 1 + t [ x/E ] C 1 ; C 2 ert [ C 1 ] ( ert [ C 2 ] ( t )) { C 1 } ļæ½ { C 2 } max { ert [ C 1 ] ( t ) , ert [ C 2 ] ( t ) } if ( ξ ) { C 1 } else { C 2 } 1 + ļæ½ ξ : true ļæ½ Ā· ert [ C 1 ] ( t ) + ļæ½ ξ : false ļæ½ Ā· ert [ C 2 ] ( t ) while ( ξ ) { C ā² } lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ā² ] ( X ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 8
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Recall the definition of ert [ while ( ξ ) { C } ] ( t ) : lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ] ( X ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Recall the definition of ert [ while ( ξ ) { C } ] ( t ) : lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ] ( X ) ļæ½ �� ļæ½ =: F ( X ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Recall the definition of ert [ while ( ξ ) { C } ] ( t ) : lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ] ( X ) ļæ½ �� ļæ½ =: F ( X ) Theorem: Upper Bounds from Upper Invariants Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Recall the definition of ert [ while ( ξ ) { C } ] ( t ) : lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ] ( X ) ļæ½ �� ļæ½ =: F ( X ) Theorem: Upper Bounds from Upper Invariants If I ā T is an upper invariant of while ( ξ ) { C } , i.e. if F ( I ) ļæ½ I Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Upper Bounds for ert of Loops Recall the definition of ert [ while ( ξ ) { C } ] ( t ) : lfp X ⢠1 + ļæ½ ξ : false ļæ½ Ā· t + ļæ½ ξ : true ļæ½ Ā· ert [ C ] ( X ) ļæ½ �� ļæ½ =: F ( X ) Theorem: Upper Bounds from Upper Invariants If I ā T is an upper invariant of while ( ξ ) { C } , i.e. if F ( I ) ļæ½ I then ert [ while ( ξ ) { C } ] ( t ) ļæ½ I . Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 9
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Lower Bounds for ert of Loops Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 10
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Lower Bounds for ert of Loops Reasoning on lower bounds is more involved: Find an argument for being below a least fixed point Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 10
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Lower Bounds for ert of Loops Reasoning on lower bounds is more involved: Find an argument for being below a least fixed point Theorem: Lower Bounds from Lower Ļ āInvariants Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 10
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Lower Bounds for ert of Loops Reasoning on lower bounds is more involved: Find an argument for being below a least fixed point Theorem: Lower Bounds from Lower Ļ āInvariants If { I n } n ā N ā T is a lower Ļ āinvariant, i.e. if I 0 ļæ½ F ( 0 ) , and I n +1 ļæ½ F ( I n ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 10
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Lower Bounds for ert of Loops Reasoning on lower bounds is more involved: Find an argument for being below a least fixed point Theorem: Lower Bounds from Lower Ļ āInvariants If { I n } n ā N ā T is a lower Ļ āinvariant, i.e. if I 0 ļæ½ F ( 0 ) , and I n +1 ļæ½ F ( I n ) then sup I n ļæ½ ert [ while ( ξ ) { C } ] ( t ) . n ā N Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 10
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Theorem: Completeness of Proof Rules The presented proof rules are complete Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 11
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Theorem: Completeness of Proof Rules The presented proof rules are complete, since I = lfp F is an upper invariant Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 11
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Theorem: Completeness of Proof Rules The presented proof rules are complete, since I = lfp F is an upper invariant and a lower Ļ āinvariant is given by I n = F ⦠· Ā· Ā· ⦠F ( 0 ) . ļæ½ �� ļæ½ n times Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 11
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Theorem: Completeness of Proof Rules The presented proof rules are complete, since I = lfp F is an upper invariant and a lower Ļ āinvariant is given by I n = F ⦠· Ā· Ā· ⦠F ( 0 ) . ļæ½ �� ļæ½ n times Theorem: Bound Refinement If I is an upper bound and F ( I ) ļæ½ I , then F ( I ) is also an upper bound. Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 11
Weakest Precondition Reasoning for Expected RunāTimes Reasoning about ert Theorem: Completeness of Proof Rules The presented proof rules are complete, since I = lfp F is an upper invariant and a lower Ļ āinvariant is given by I n = F ⦠· Ā· Ā· ⦠F ( 0 ) . ļæ½ �� ļæ½ n times Theorem: Bound Refinement If I is an upper bound and F ( I ) ļæ½ I , then F ( I ) is also an upper bound. Dually for lower bounds. Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 11
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Enables bounded model checking of expected runātimes Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Enables bounded model checking of expected runātimes Nielsonās Hoareāstyle logic for reasoning about runātime orders of magnitude of deterministic programs : Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Enables bounded model checking of expected runātimes Nielsonās Hoareāstyle logic for reasoning about runātime orders of magnitude of deterministic programs : Nielsonās logic relies on introducing additional logical variables Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Enables bounded model checking of expected runātimes Nielsonās Hoareāstyle logic for reasoning about runātime orders of magnitude of deterministic programs : Nielsonās logic relies on introducing additional logical variables ert is sound and complete with respect to Nielsonās logic Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Correspondence to Other RunāTime Models Is the ert Calculus a Reasonable RunāTime Model? Correspondence to an operational semantics: Operational model defined in terms of a reward MDP ` a la [QEST 2012] and [MFPS 2015] ert coincides with expected reward in the operational MDP Enables bounded model checking of expected runātimes Nielsonās Hoareāstyle logic for reasoning about runātime orders of magnitude of deterministic programs : Nielsonās logic relies on introducing additional logical variables ert is sound and complete with respect to Nielsonās logic ert calculus is arguably easier to apply ā no additional variables! Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 12
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem We model it by the following algorithm: cp := [0 , . . . , 0] ; i := 1 ; x := N ; while ( x > 0) { while ( cp [ i ] ļæ½ = 0) { i : ā Unif [1 . . . N ] } ; cp [ i ] := 1 ; x := x ā 1 } Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem We model it by the following algorithm: cp := [0 , . . . , 0] ; i := 1 ; x := N ; while ( x > 0) { while ( cp [ i ] ļæ½ = 0) { i : ā Unif [1 . . . N ] } ; cp [ i ] := 1 ; x := x ā 1 } Using ert, we can analyze the ERT of the above algorithm directly on the source code given above: Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem We model it by the following algorithm: cp := [0 , . . . , 0] ; i := 1 ; x := N ; while ( x > 0) { while ( cp [ i ] ļæ½ = 0) { i : ā Unif [1 . . . N ] } ; cp [ i ] := 1 ; x := x ā 1 } Using ert, we can analyze the ERT of the above algorithm directly on the source code given above: ert [ coup . coll . ] ( 0 ) = 4 + [ N > 0] Ā· 2 N Ā· ( 2 + H N ā 1 ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem We model it by the following algorithm: cp := [0 , . . . , 0] ; i := 1 ; x := N ; while ( x > 0) { while ( cp [ i ] ļæ½ = 0) { i : ā Unif [1 . . . N ] } ; cp [ i ] := 1 ; x := x ā 1 } Using ert, we can analyze the ERT of the above algorithm directly on the source code given above: ert [ coup . coll . ] ( 0 ) = 4 + [ N > 0] Ā· 2 N Ā· ( 2 + H N ā 1 ) Harmonic number H N ā 1 is in Ī(log N ) Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Weakest Precondition Reasoning for Expected RunāTimes Case Study Case Study: The Coupon Collectorās Problem The coupon collector is a wellāknown problem We model it by the following algorithm: cp := [0 , . . . , 0] ; i := 1 ; x := N ; while ( x > 0) { while ( cp [ i ] ļæ½ = 0) { i : ā Unif [1 . . . N ] } ; cp [ i ] := 1 ; x := x ā 1 } Using ert, we can analyze the ERT of the above algorithm directly on the source code given above: ert [ coup . coll . ] ( 0 ) = 4 + [ N > 0] Ā· 2 N Ā· ( 2 + H N ā 1 ) Harmonic number H N ā 1 is in Ī(log N ) Coupon collector program runs in Ī( N Ā· log N ) for N > 0 Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 13
Het Einde Summary Summary Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Het Einde Summary Summary ert is an easy to understand weakestāpreconditionāstyle calculus for reasoning about ERT of probabilistic programs Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Het Einde Summary Summary ert is an easy to understand weakestāpreconditionāstyle calculus for reasoning about ERT of probabilistic programs ert is sound and complete for reasoning about expected runātimes and positive almostāsure termination Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Het Einde Summary Summary ert is an easy to understand weakestāpreconditionāstyle calculus for reasoning about ERT of probabilistic programs ert is sound and complete for reasoning about expected runātimes and positive almostāsure termination ert comes with proof rules for reasoning about loops Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Het Einde Summary Summary ert is an easy to understand weakestāpreconditionāstyle calculus for reasoning about ERT of probabilistic programs ert is sound and complete for reasoning about expected runātimes and positive almostāsure termination ert comes with proof rules for reasoning about loops ert is a powerful alternative to ranking superāmartingales Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Het Einde Summary Summary ert is an easy to understand weakestāpreconditionāstyle calculus for reasoning about ERT of probabilistic programs ert is sound and complete for reasoning about expected runātimes and positive almostāsure termination ert comes with proof rules for reasoning about loops ert is a powerful alternative to ranking superāmartingales ert is applicable to tricky realāworld examples which are difficult to reason about by formal verification techniques Kaminski, Katoen, Matheja, Olmedo Weakest Precondition Reasoning for Expected RunāTimes 4.4.2016 14
Recommend
More recommend