Formalising Semantics for Expected Running Time of Probabilistic - - PowerPoint PPT Presentation

formalising semantics for expected running time of
SMART_READER_LITE
LIVE PREVIEW

Formalising Semantics for Expected Running Time of Probabilistic - - PowerPoint PPT Presentation

Johannes Hlzl TU Mnchen, Germany Formalising Semantics for Expected Running Time of Probabilistic Programs (Rough Diamond) Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] Denotational: Operational: Correspondence: Denotational 2


slide-1
SLIDE 1

Formalising Semantics for Expected Running Time of Probabilistic Programs

(Rough Diamond) Johannes Hölzl TU München, Germany

slide-2
SLIDE 2

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: pgcl Operational: pgcl pgcl stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-3
SLIDE 3

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: pgcl Operational: pgcl pgcl stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-4
SLIDE 4

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: pgcl Operational: pgcl pgcl stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-5
SLIDE 5

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: pgcl Operational: pgcl pgcl stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-6
SLIDE 6

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: pgcl pgcl stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-7
SLIDE 7

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-8
SLIDE 8

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-9
SLIDE 9

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-10
SLIDE 10

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-11
SLIDE 11

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-12
SLIDE 12

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-13
SLIDE 13

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-14
SLIDE 14

This Talk

  • Probabilistic programs (pGCL) + expected running time.

Kaminski, Katoen, Matheja, and Olmedo [ESOP 2016] ⋆

  • Two semantics:

Denotational: σ pgcl ⇒ ( σ ⇒ R≥0 ) ⇒ ( σ ⇒ R≥0 ) Operational: ( σ pgcl × σ ) ⇒ ( σ pgcl × σ ) stream measure Correspondence: Denotational ⇔ Operational

  • Examples:
  • Simple Random Walk 
  • Coupon Collector

Our work: – clarified semantics – different proofs – correct proofs –

2

slide-15
SLIDE 15

pGCL

slide-16
SLIDE 16

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥   x

  • r

x expr Assign pmf p1 p2 p1 p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-17
SLIDE 17

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |   x

  • r

x expr Assign pmf p1 p2 p1 p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-18
SLIDE 18

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  x

  • r

x expr Assign pmf p1 p2 p1 p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-19
SLIDE 19

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  | x :∼ D

  • r

x := expr ”Assign (σ ⇒ σ pmf)” p1 p2 p1 p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-20
SLIDE 20

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  | x :∼ D

  • r

x := expr ”Assign (σ ⇒ σ pmf)” | p1 ; p2 p1 p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-21
SLIDE 21

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  | x :∼ D

  • r

x := expr ”Assign (σ ⇒ σ pmf)” | p1 ; p2 | p1 | p2 ITE g p1 p2 g bool WHILE g DO p

4

slide-22
SLIDE 22

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  | x :∼ D

  • r

x := expr ”Assign (σ ⇒ σ pmf)” | p1 ; p2 | p1 | p2 | ITE g p1 p2 g :: σ ⇒ bool WHILE g DO p

4

slide-23
SLIDE 23

Probabilistic Guarded Command Language (pGCL)

σ pgcl = ⊥ |  |  | x :∼ D

  • r

x := expr ”Assign (σ ⇒ σ pmf)” | p1 ; p2 | p1 | p2 | ITE g p1 p2 g :: σ ⇒ bool | WHILE g DO p

4

slide-24
SLIDE 24

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert c c ert  c 1 c ert  c ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-25
SLIDE 25

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert c c ert  c 1 c ert  c ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-26
SLIDE 26

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert c c ert  c 1 c ert  c ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-27
SLIDE 27

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c 1 c ert  c ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-28
SLIDE 28

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-29
SLIDE 29

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert Assign u c 1 x

y

c y d u x ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-30
SLIDE 30

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert (Assign u) c = 1 + ( λx. ∫

y

c y d(u x) ) ert p1 p2 c ert p1 ert p2 c ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-31
SLIDE 31

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert (Assign u) c = 1 + ( λx. ∫

y

c y d(u x) ) ert (p1; p2) c = ert p1 (ert p2 c) ert p1 p2 c ert p1 c ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-32
SLIDE 32

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert (Assign u) c = 1 + ( λx. ∫

y

c y d(u x) ) ert (p1; p2) c = ert p1 (ert p2 c) ert (p1 | p2) c = ert p1 c ⊔ ert p2 c ert ITE g p1 p2 c 1 x if g x then ert p1 c x else ert p2 c x ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-33
SLIDE 33

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert (Assign u) c = 1 + ( λx. ∫

y

c y d(u x) ) ert (p1; p2) c = ert p1 (ert p2 c) ert (p1 | p2) c = ert p1 c ⊔ ert p2 c ert (ITE g p1 p2) c = 1 + ( λx. if g x then ert p1 c x else ert p2 c x ) ert WHILE g DO p c lfp W x 1 if g x then ert p W x else c x

5

slide-34
SLIDE 34

Denotational Semantics (Expected Running Time)

ert :: σ pgcl ⇒ (σ ⇒ R≥0) ⇒ (σ ⇒ R≥0) Values we want assigned to a terminal state Values computed for the a starting state ert ⊥ c = c ert  c = 1 + c ert  c = ert (Assign u) c = 1 + ( λx. ∫

y

c y d(u x) ) ert (p1; p2) c = ert p1 (ert p2 c) ert (p1 | p2) c = ert p1 c ⊔ ert p2 c ert (ITE g p1 p2) c = 1 + ( λx. if g x then ert p1 c x else ert p2 c x ) ert (WHILE g DO p) c = lfp ( λW x. 1 + if g x then ert p W x else c x )

5

slide-35
SLIDE 35

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 s Construct maximal expectation

s f of a (cost) function f: s f D K s t t

f t dD

6

slide-36
SLIDE 36

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation

s f of a (cost) function f: s f D K s t t

f t dD

6

slide-37
SLIDE 37

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation

s f of a (cost) function f: s f D K s t t

f t dD

6

slide-38
SLIDE 38

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation ˆ Es[f] of a (cost) function f: ˆ Es[f] = ⊔

D∈K s

t

ˆ Et[λω. f (t · ω)] dD

6

slide-39
SLIDE 39

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation ˆ Es[f] of a (cost) function f: ˆ Es[f] = ⊔

D∈K s

t

ˆ Et[λω. f (t · ω)] dD

6

slide-40
SLIDE 40

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation ˆ Es[f] of a (cost) function f: ˆ Es[f] = ⊔

D∈K s

t

ˆ Et[λω. f (t · ω)] dD

6

slide-41
SLIDE 41

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation ˆ Es[f] of a (cost) function f: ˆ Es[f] = ⊔

D∈K s

t

ˆ Et[λω. f (t · ω)] dD

6

slide-42
SLIDE 42

Interjection: Markov decision processes

Automata with probabilistic and non-deterministic choice K :: σ ⇒ σ pmf set K s ̸= ∅ t1 t2 t3 s p q r Construct maximal expectation ˆ Es[f] of a (cost) function f: ˆ Es[f] = ⊔

D∈K s

t

ˆ Et[λω. f (t · ω)] dD

6

slide-43
SLIDE 43

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K s s K  s s K  s  s K Assign u s s s u s K p1 p2 s p1 s p2 s K ITE g p1 p2 s if g s then p1 s else p2 s K WHILE g DO p s if g s then p WHILE g DO p s else s K p1 p2 s s p2 s  s  s p s p p2 s K p1 s x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-44
SLIDE 44

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K Assign u s s s u s K p1 p2 s p1 s p2 s K ITE g p1 p2 s if g s then p1 s else p2 s K WHILE g DO p s if g s then p WHILE g DO p s else s K p1 p2 s s p2 s  s  s p s p p2 s K p1 s x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-45
SLIDE 45

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K(Assign u, s) = [ λs′. (⊥, s′) ] { u s } K p1 p2 s p1 s p2 s K ITE g p1 p2 s if g s then p1 s else p2 s K WHILE g DO p s if g s then p WHILE g DO p s else s K p1 p2 s s p2 s  s  s p s p p2 s K p1 s x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-46
SLIDE 46

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K(Assign u, s) = [ λs′. (⊥, s′) ] { u s } K(p1 | p2, s) = ≪p1,s≫ ∪ ≪p2,s≫ K ITE g p1 p2 s if g s then p1 s else p2 s K WHILE g DO p s if g s then p WHILE g DO p s else s K p1 p2 s s p2 s  s  s p s p p2 s K p1 s x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-47
SLIDE 47

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K(Assign u, s) = [ λs′. (⊥, s′) ] { u s } K(p1 | p2, s) = ≪p1,s≫ ∪ ≪p2,s≫ K(ITE g p1 p2, s) = if g s then ≪p1,s≫ else ≪p2,s≫ K(WHILE g DO p, s) = if g s then ≪p; WHILE g DO p,s≫ else ≪⊥,s≫ K p1 p2 s s p2 s  s  s p s p p2 s K p1 s x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-48
SLIDE 48

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K(Assign u, s) = [ λs′. (⊥, s′) ] { u s } K(p1 | p2, s) = ≪p1,s≫ ∪ ≪p2,s≫ K(ITE g p1 p2, s) = if g s then ≪p1,s≫ else ≪p2,s≫ K(WHILE g DO p, s) = if g s then ≪p; WHILE g DO p,s≫ else ≪⊥,s≫ K(p1; p2, s) =   λ (⊥, s′). (p2, s′) (, s′). (, s′) (p′, s′). (p′; p2, s′)    K(p1, s) x 1  s x 1 s  s s

  • p2

x 1  p2 s x 1 p2 s  s p2 s

7

slide-49
SLIDE 49

Operational Semantics

K :: (σ pgcl × σ) ⇒ (σ pgcl × σ) pmf set K(⊥, s) = ≪⊥,s≫ K(, s) = ≪⊥,s≫ K(, s) = ≪,s≫ K(Assign u, s) = [ λs′. (⊥, s′) ] { u s } K(p1 | p2, s) = ≪p1,s≫ ∪ ≪p2,s≫ K(ITE g p1 p2, s) = if g s then ≪p1,s≫ else ≪p2,s≫ K(WHILE g DO p, s) = if g s then ≪p; WHILE g DO p,s≫ else ≪⊥,s≫ K(p1; p2, s) =   λ (⊥, s′). (p2, s′) (, s′). (, s′) (p′, s′). (p′; p2, s′)    K(p1, s) (x := 1|, s) (x := 1, s) (, s) (⊥, s′)

⇐ =

  • ; p2

((x := 1|); p2, s) (x := 1; p2, s) (, s) (p2, s′)

7

slide-50
SLIDE 50

Traces

Trace coststream ((x := 1|); y := 0, s) x 1 y 0 s 1 y 0 s 1 s f s . . . Cost per stream: coststream f (s·ω)

lfp

= cost f s (coststream f ω)

8

slide-51
SLIDE 51

Traces

Trace coststream ((x := 1|); y := 0, s) (x := 1; y := 0, s) + 1 y 0 s 1 s f s . . . Cost per stream: coststream f (s·ω)

lfp

= cost f s (coststream f ω)

8

slide-52
SLIDE 52

Traces

Trace coststream ((x := 1|); y := 0, s) (x := 1; y := 0, s) + 1 (y := 0, s′) + 1 s f s . . . Cost per stream: coststream f (s·ω)

lfp

= cost f s (coststream f ω)

8

slide-53
SLIDE 53

Traces

Trace coststream ((x := 1|); y := 0, s) (x := 1; y := 0, s) + 1 (y := 0, s′) + 1 (⊥, s′′) + f s′′ . . . Cost per stream: coststream f (s·ω)

lfp

= cost f s (coststream f ω)

8

slide-54
SLIDE 54

Interjection: Least Fixed Points

Theorem (Transfer rule for least fixed points) ⊔−continuous α, f, g α ⊥ = ⊥ α ◦ f = g ◦ α α(lfp f) = lfp g lfp f f f f f f g g g f f g g g g g lfp g f

s f

for f Borel-measurable

p s coststream f

lfp

K s

cost p s

9

slide-55
SLIDE 55

Interjection: Least Fixed Points

Theorem (Transfer rule for least fixed points) ⊔−continuous α, f, g α ⊥ = ⊥ α ◦ f = g ◦ α α(lfp f) = lfp g α(lfp f) = α ◦ f ◦ f ◦ f ◦ f ◦ f ◦ · · · ◦ ⊥ = g ◦ g ◦ g ◦ α ◦ f ◦ f ◦ · · · ◦ ⊥ = g ◦ g ◦ g ◦ g ◦ g ◦ · · · ◦ α ⊥ = lfp g f

s f

for f Borel-measurable

p s coststream f

lfp

K s

cost p s

9

slide-56
SLIDE 56

Interjection: Least Fixed Points

Theorem (Transfer rule for least fixed points) ⊔−continuous α, f, g α ⊥ = ⊥ α ◦ f = g ◦ α α(lfp f) = lfp g lfp f f f f f f g g g f f g g g g g lfp g α f = ˆ Es[f] for f Borel-measurable

p s coststream f

lfp

K s

cost p s

9

slide-57
SLIDE 57

Interjection: Least Fixed Points

Theorem (Transfer rule for least fixed points) ⊔−continuous α, f, g α ⊥ = ⊥ α ◦ f = g ◦ α α(lfp f) = lfp g lfp f f f f f f g g g f f g g g g g lfp g f

s f

for f Borel-measurable ˆ E(p,s)[coststream f] = lfp (⊔

K s

∫ cost ) p s

9

slide-58
SLIDE 58

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1 p2 – Antisymmetry then fixed point induction

p1 s coststream p2

coststream f

p1 p2 s coststream f

WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence

330 lines of theory

  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-59
SLIDE 59

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1 p2 – Antisymmetry then fixed point induction

p1 s coststream p2

coststream f

p1 p2 s coststream f

WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence

330 lines of theory

  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-60
SLIDE 60

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1; p2 – Antisymmetry then fixed point induction ˆ E(p1,s)[coststream (ˆ E(p2,·)[coststream f])] = ˆ E(p1;p2,s)[coststream f] WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence

330 lines of theory

  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-61
SLIDE 61

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1; p2 – Antisymmetry then fixed point induction ˆ E(p1,s)[coststream (ˆ E(p2,·)[coststream f])] = ˆ E(p1;p2,s)[coststream f] WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence

330 lines of theory

  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-62
SLIDE 62

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1; p2 – Antisymmetry then fixed point induction ˆ E(p1,s)[coststream (ˆ E(p2,·)[coststream f])] = ˆ E(p1;p2,s)[coststream f] WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence ∼ 330 lines of theory
  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-63
SLIDE 63

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1; p2 – Antisymmetry then fixed point induction ˆ E(p1,s)[coststream (ˆ E(p2,·)[coststream f])] = ˆ E(p1;p2,s)[coststream f] WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence ∼ 330 lines of theory
  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-64
SLIDE 64

Correspondence Proof

Theorem ˆ E(p,s)[coststream f] = ert p f s Proof by induction on p: p1; p2 – Antisymmetry then fixed point induction ˆ E(p1,s)[coststream (ˆ E(p2,·)[coststream f])] = ˆ E(p1;p2,s)[coststream f] WHILE g DO p1 – Fixed point massaging

  • Operational semantics & Correspondence ∼ 330 lines of theory
  • Central to our proof: Expectation as fixed point
  • [KKMO 2016]: Expectation as sums over all paths

10

slide-65
SLIDE 65

Examples

slide-66
SLIDE 66

Simple Symmetric Random Walk (ssrw)

1 −1 2 −2 3 −3

· · · · · ·

1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2

  • Pri(♢j) = 1
  • H i j := ert (ssrw j) ⊥ i

for i ̸= j: H i j =

12

slide-67
SLIDE 67

Simple Symmetric Random Walk (ssrw)

1 −1 2 −2 3 −3

· · · · · ·

1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2 1/2

  • Pri(♢j) = 1
  • H i j := ert (ssrw j) ⊥ i

for i ̸= j: H i j = ∞

12

slide-68
SLIDE 68

Simple Symmetric Random Walk – [KKMO]

How do Kaminski, Katoen, Matheja, and Olmedo prove it?

  • ert ssrw j

i has lower

  • invariant In

1

ert STEP In: In 1 x n

  • They need to prove this equation:

1 x 2 1 x n 1 x n 1 1 x 2 x n 1

E R R O R

Fails for x 1 and n 0.

13

slide-69
SLIDE 69

Simple Symmetric Random Walk – [KKMO]

How do Kaminski, Katoen, Matheja, and Olmedo prove it?

  • ert (ssrw j) ⊥ i has lower ω-invariant In+1 ≤ ert STEP In:

In = 1 + 0 < x ≤ n · ∞

  • They need to prove this equation:

1 x 2 1 x n 1 x n 1 1 x 2 x n 1

E R R O R

Fails for x 1 and n 0.

13

slide-70
SLIDE 70

Simple Symmetric Random Walk – [KKMO]

How do Kaminski, Katoen, Matheja, and Olmedo prove it?

  • ert (ssrw j) ⊥ i has lower ω-invariant In+1 ≤ ert STEP In:

In = 1 + 0 < x ≤ n · ∞

  • They need to prove this equation:

1 + x > 0 · 2 + 1 < x ≤ n + 1 · ∞ + 0 < x ≤ n − 1 · ∞ = 1 + x > 0 · 2 + 0 < x ≤ n + 1 · ∞

E R R O R

Fails for x 1 and n 0.

13

slide-71
SLIDE 71

Simple Symmetric Random Walk – [KKMO]

How do Kaminski, Katoen, Matheja, and Olmedo prove it?

  • ert (ssrw j) ⊥ i has lower ω-invariant In+1 ≤ ert STEP In:

In = 1 + 0 < x ≤ n · ∞

  • They need to prove this equation:

1 + x > 0 · 2 + 1 < x ≤ n + 1 · ∞ + 0 < x ≤ n − 1 · ∞ = 1 + x > 0 · 2 + 0 < x ≤ n + 1 · ∞

E R R O R

Fails for x 1 and n 0.

13

slide-72
SLIDE 72

Simple Symmetric Random Walk – [KKMO]

How do Kaminski, Katoen, Matheja, and Olmedo prove it?

  • ert (ssrw j) ⊥ i has lower ω-invariant In+1 ≤ ert STEP In:

In = 1 + 0 < x ≤ n · ∞

  • They need to prove this equation:

1 + x > 0 · 2 + 1 < x ≤ n + 1 · ∞ + 0 < x ≤ n − 1 · ∞ = 1 + x > 0 · 2 + 0 < x ≤ n + 1 · ∞

E R R O R

Fails for x = 1 and n = 0.

13

slide-73
SLIDE 73

Simple Symmetric Random Walk – our Solution

Use H i j = ˆ E(ssrw j,i)[coststream] to prove H i j = H i k + H k j for i ≤ k ≤ j Operational semantics – trace representation Then derive H i j for i j

14

slide-74
SLIDE 74

Simple Symmetric Random Walk – our Solution

Use H i j = ˆ E(ssrw j,i)[coststream] to prove H i j = H i k + H k j for i ≤ k ≤ j Operational semantics – trace representation Then derive H i j = ∞ for i ̸= j

14

slide-75
SLIDE 75

Simple Symmetric Random Walk – our Solution

Use H i j = ˆ E(ssrw j,i)[coststream] to prove H i j = H i k + H k j for i ≤ k ≤ j Operational semantics – trace representation Then derive H i j = ∞ for i ̸= j ✓

14

slide-76
SLIDE 76

Coupon Collector

x := 0, i := 0, cp := [

N times

F, . . . , F]; c 0 b F WHILE x < N DO x c WHILE c N DO WHILE cp[i] DO cp i b WHILE b DO i :∼ U({1, . . . , N}); cp x b x N cp[i] := T, x := x + 1 b T c c 1 ert CCN 0 s = 2 + N · ( 4 + 2 ∑N

i=1 1 i

) . KKMO use loop invariants to prove running time

15

slide-77
SLIDE 77

Coupon Collector

x := 0, i := 0, cp := [

N times

F, . . . , F]; c := 0, b := F; WHILE x < N DO x c WHILE c < N DO WHILE cp[i] DO cp i b WHILE b DO i :∼ U({1, . . . , N}); cp x b :∼ B(x/N); cp[i] := T, x := x + 1 b := T, c := c + 1 ert CCN 0 s = 2 + N · ( 4 + 2 ∑N

i=1 1 i

) . KKMO use loop invariants to prove running time

15

slide-78
SLIDE 78

Coupon Collector

x := 0, i := 0, cp := [

N times

F, . . . , F]; c := 0, b := F; WHILE x < N DO x → c WHILE c < N DO WHILE cp[i] DO cp[i] → b WHILE b DO i :∼ U({1, . . . , N}); |cp| = x b :∼ B(x/N); cp[i] := T, x := x + 1 b := T, c := c + 1 ert CCN 0 s = 2 + N · ( 4 + 2 ∑N

i=1 1 i

) . KKMO use loop invariants to prove running time

15

slide-79
SLIDE 79

Coupon Collector

x := 0, i := 0, cp := [

N times

F, . . . , F]; c := 0, b := F; WHILE x < N DO x → c WHILE c < N DO WHILE cp[i] DO cp[i] → b WHILE b DO i :∼ U({1, . . . , N}); |cp| = x b :∼ B(x/N); cp[i] := T, x := x + 1 b := T, c := c + 1 ert CCN 0 s = 2 + N · ( 4 + 2 ∑N

i=1 1 i

) . KKMO use loop invariants to prove running time

15

slide-80
SLIDE 80

Conclusion

slide-81
SLIDE 81

Related Work

Different pGCL formalizations already exist: Hurd et al. [QAPL 2003] VCG in HOL, deep Celiku & McIver [N. J. C. 2004] Expected running time

  • Allow cost analysis for pGCL
  • Refinement only for upper

bounds

  • No relation to an operational

model Cock [SSV 2012] VCG in Isabelle/HOL, shallow Various other formalizations of purely probabilistic programs…

17

slide-82
SLIDE 82

Related Work

Different pGCL formalizations already exist: Hurd et al. [QAPL 2003] VCG in HOL, deep Celiku & McIver [N. J. C. 2004] Expected running time

  • Allow cost analysis for pGCL
  • Refinement only for upper

bounds

  • No relation to an operational

model Cock [SSV 2012] VCG in Isabelle/HOL, shallow Various other formalizations of purely probabilistic programs…

17

slide-83
SLIDE 83

Related Work

Different pGCL formalizations already exist: Hurd et al. [QAPL 2003] VCG in HOL, deep Celiku & McIver [N. J. C. 2004] Expected running time

  • Allow cost analysis for pGCL
  • Refinement only for upper

bounds

  • No relation to an operational

model Cock [SSV 2012] VCG in Isabelle/HOL, shallow Various other formalizations of purely probabilistic programs…

17

slide-84
SLIDE 84

Related Work

Different pGCL formalizations already exist: Hurd et al. [QAPL 2003] VCG in HOL, deep Celiku & McIver [N. J. C. 2004] Expected running time

  • Allow cost analysis for pGCL
  • Refinement only for upper

bounds

  • No relation to an operational

model Cock [SSV 2012] VCG in Isabelle/HOL, shallow Various other formalizations of purely probabilistic programs…

17

slide-85
SLIDE 85

Related Work

Different pGCL formalizations already exist: Hurd et al. [QAPL 2003] VCG in HOL, deep Celiku & McIver [N. J. C. 2004] Expected running time

  • Allow cost analysis for pGCL
  • Refinement only for upper

bounds

  • No relation to an operational

model Cock [SSV 2012] VCG in Isabelle/HOL, shallow Various other formalizations of purely probabilistic programs…

17

slide-86
SLIDE 86

Conclusion & Future Work

  • Relating denotational and operational semantics
  • Explore use cases where this relation simplifies proofs

Loop invariants are not always enough

  • Explore: Probabilistic relational Hoare logic (pRHL) +

non-determinism

18

slide-87
SLIDE 87

Conclusion & Future Work

  • Relating denotational and operational semantics
  • Explore use cases where this relation simplifies proofs

Loop invariants are not always enough

  • Explore: Probabilistic relational Hoare logic (pRHL) +

non-determinism

18

slide-88
SLIDE 88

Conclusion & Future Work

  • Relating denotational and operational semantics
  • Explore use cases where this relation simplifies proofs

Loop invariants are not always enough

  • Explore: Probabilistic relational Hoare logic (pRHL) +

non-determinism

18

slide-89
SLIDE 89

Conclusion & Future Work

  • Relating denotational and operational semantics
  • Explore use cases where this relation simplifies proofs

Loop invariants are not always enough

  • Explore: Probabilistic relational Hoare logic (pRHL) +

non-determinism

18