formal semantics of probabilistic programming languages: … · 2017-11-20 · formal semantics of...

98
Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok Yang KAIST, Korea Based on several joint projects with Yufei Cai, Zoubin Ghahramani, Bradley Gram-hansen, Chris Heunen, Ohad Kammar, Sean Moss, Klaus Ostermann, Adam Scibior, Sam Staton, Matthijs Vakar, Frank Wood, and Yuan Zhou

Upload: others

Post on 27-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal Semantics of Probabilistic Programming Languages: Issues,

Results and Opportunities

Hongseok YangKAIST, Korea

Based on several joint projects with Yufei Cai, Zoubin Ghahramani, Bradley Gram-hansen, Chris Heunen, Ohad Kammar, Sean Moss, Klaus Ostermann,

Adam Scibior, Sam Staton, Matthijs Vakar, Frank Wood, and Yuan Zhou

Page 2: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal Semantics of Probabilistic Programming Languages: Issues,

Results and Opportunities

Hongseok YangKAIST, Korea

Based on several joint projects with Yufei Cai, Zoubin Ghahramani, Bradley Gram-hansen, Chris Heunen, Ohad Kammar, Sean Moss, Klaus Ostermann,

Adam Scibior, Sam Staton, Matthijs Vakar, Frank Wood, and Yuan Zhou

Page 3: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal Semantics of Probabilistic Programming Languages: Issues,

Results and Opportunities

Hongseok YangKAIST, Korea

Based on several joint projects with Yufei Cai, Zoubin Ghahramani, Bradley Gram-hansen, Chris Heunen, Ohad Kammar, Sean Moss, Klaus Ostermann,

Adam Scibior, Sam Staton, Matthijs Vakar, Frank Wood, and Yuan Zhou

Page 4: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

Page 5: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)

Page 6: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)

Page 7: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)

Page 8: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)

Page 9: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

= p(x | y=2)(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)⟦ ⟧

Page 10: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Formal semantics describes a mapping from probabilistic programs to probabilistic models.

= p(x, y=2)(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)⟦ ⟧’

= p(x | y=2)(let [x (sample (normal 0 1)) y (observe (normal x 1) 2)] x)⟦ ⟧

Page 11: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Why should one care about formal semantics?

1. Specification of inference algorithms.

2. Compiler optimisation.

3. Detection of ill-defined models.

Page 12: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Why should one care about formal semantics?

1. Specification of inference algorithms.

2. Compiler optimisation.

3. Detection of ill-defined models.

Page 13: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Why should one care about formal semantics?

1. Specification of inference algorithms.

2. Compiler optimisation.

3. Detection of ill-defined models.

Page 14: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Why should one care about formal semantics?

1. Specification of inference algorithms.

2. Compiler optimisation.

3. Detection of ill-defined models.

Page 15: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Why should one care about formal semantics?

1. Specification of inference algorithms.

2. Compiler optimisation.

3. Detection of ill-defined models.

Page 16: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 17: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 18: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 19: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 20: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 21: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

5K samples

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 22: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

10K samples

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 23: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

15K samples

Page 24: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

20K samplesUniform[-6,6]?No posterior.Uniform[-∞,∞].

Page 25: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

20K samplesUniform[-6,6]?No posterior.Uniform[-∞,∞].

Page 26: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

20K samplesUniform[-6,6]?No posterior.Uniform[-∞,∞].

Page 27: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

20K samplesUniform[-6,6]?No posterior.Uniform[-∞,∞].

Page 28: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y|x) = exponential-pdf(y;1/p(x))) = 1/p(x) * exp(y * 1/p(x))

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 29: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y=0|x) = exponential-pdf(y=0;1/p(x)) = 1/p(x) * exp(y * 1/p(x))

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 30: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y=0|x) = exponential-pdf(y=0;1/p(x)) = 1/p(x)

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 31: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y=0|x) = exponential-pdf(y=0;1/p(x)) = 1/p(x)

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 32: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y=0|x) = exponential-pdf(y=0;1/p(x)) = 1/p(x)

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 33: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

p(x) = normal-pdf(x;0,1)p(y=0|x) = exponential-pdf(y=0;1/p(x)) = 1/p(x)

p(x,y=0) = p(x) * p(y=0|x) = p(x) * 1/p(x) = 1p(y=0) = ∫p(x,y=0)dx = ∫dx = ∞

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

Page 34: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf)) 0)] x)

= p(x, y=0) = Lebesgue(x)

Page 35: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Issues and results

Page 36: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Issue 1:Normalised posterior or unnormalized posterior?

Page 37: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧

Page 38: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’

Page 39: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)

……

Page 40: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)…

Page 41: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)

Page 42: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)

⟦ ⟧’= undefined ≠ p(x’|y=0,y’=0) = normal-pdf(x’;0,1)

Page 43: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)

⟦ ⟧’= undefined ≠ p(x’|y=0,y’=0) = normal-pdf(x’;0,1)

Page 44: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0) = Lebesgue(x)

⟦ ⟧(let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x|y=0) = undefined

⟦ ⟧’(let [x’ (let [x (sample (normal 0 1)) x-pdf (normal-pdf x 0 1) y (observe …)] x) y’ (observe (normal x’ 1) 0)] x’)

⟦ ⟧’= p(x, y=0, y’=0) = normal-pdf(x;0,1)

Page 45: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

In general, semantics interprets programs as unnormalized conditional distributions [Staton17].

Always s-finite unnormalised cond. distributions (also called s-finite kernels) [Staton17].

Page 46: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

In general, semantics interprets programs as unnormalized conditional distributions [Staton17].

Always s-finite unnormalised cond. distributions (also called s-finite kernels) [Staton17].

(let [x (sample (normal z 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0 | z)

⟦ ⟧

Page 47: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

In general, semantics interprets programs as unnormalized conditional distributions [Staton17].

Always s-finite unnormalised cond. distributions (also called s-finite kernels) [Staton17].

(let [x (sample (normal z 1)) x-pdf (normal-pdf x 0 1) y (observe (exponential (/ 1 x-pdf) 0))] x)

= p(x, y=0 | z)

⟦ ⟧

Page 48: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

S-finite kernel

A kernel k from X to Y is finite if supx k(x,Y) < ∞.

A kernel k is s-finite if it is a countable sum of finite kernels.

Page 49: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

S-finite kernel

A kernel k from X to Y is finite if supx k(x,Y) < ∞.

A kernel k is s-finite if it is a countable sum of finite kernels.

The fact that programs mean s-finite kernels justifies program reordering for optimisation:

(let [x e1 y e2] e)⟦ ⟧ (let [y e2

x e1] e)⟦ ⟧= if x∉Free(e1)

∧ y∉Free(e2)

Page 50: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Issue 2:Should marginalise or not?

Page 51: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

Page 52: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

Page 53: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

Page 54: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

Page 55: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

Page 56: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

z2

x1

y

Page 57: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x>0) then 2 else z2,1)Here f(a;m,s) = normal-pdf(a;m,s).

z2

x1

y

Page 58: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Page 59: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * f(y=-1; 2, 1) * [x1>0] + ∫ f(x1;0,1) * f(z2;-2,1) * f(y=-1; 2, 1) * [x1>0] dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

Page 60: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

……

Page 61: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Page 62: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Page 63: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Page 64: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Graphical model

Page 65: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Graphical model

Model on execution traces

Page 66: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧

= p(x1, y=-1) = ∫p(x1, z2, y=-1) dz2

= f(x1;0,1) * [x1>0] * f(y=-1; 2, 1) + f(x1;0,1) * [x1≤0] *∫ f(z2;-2,1) * f(y=-1; z2, 1) dz2

(let [x1 (sample (normal 0 1)) x2 (if (> x1 0) 2 (sample (normal -2 1))) y (observe (normal x2 1) -1)] x1)

⟦ ⟧’

= p(x1, z2, y=-1) = f(x1;0,1) * f(z2;-2,1) * f(y=-1; if (x1>0) then 2 else z2,1)Here f(x;μ,σ) = normal-pdf(x;μ,σ).

z2

x1

y

Graphical model

Model on execution traces

Page 67: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Semantics without marginalisation.

1. Converts prob. progs to graphical models.

2. Basis for graph-based inference algorithm.

Semantics with marginalisation.

1. Defines models based on prog. execution.

2. Basis for evaluation-based inference algo.

Page 68: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Issue 3: Higher-order functions

Page 69: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 70: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 71: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 72: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 73: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 74: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

Page 75: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4)

[s b])

⟦ ⟧∈ Measure(ℝ2)

Page 76: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4) f) [s b])

⟦ ⟧∈ Measure(ℝ2)

Page 77: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4) f) [s b])

⟦ ⟧∈ Measure(ℝ2)Measure(ℝ→ℝ)

Page 78: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Linear regression(let [s (sample (normal 0 2)) b (sample (normal 0 6)) f (fn [x] (+ (* s x) b))]

(observe (normal (f 0) .5) .6) (observe (normal (f 1) .5) .7) (observe (normal (f 2) .5) 1.2) (observe (normal (f 3) .5) 3.2) (observe (normal (f 4) .5) 6.8) (observe (normal (f 5) .5) 8.2) (observe (normal (f 6) .5) 8.4) f) [s b])

⟦ ⟧∈ Measure(ℝ2)

Troublemakerin measure theory

Measure(ℝ→ℝ)

Page 79: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Measure-theoretic issue

Measure theory provides a foundation for modern probability theory.

But it doesn’t support higher-order fns well.

ev : (ℝ→mℝ) x ℝ → ℝ, ev(f,x) = f(x).

[Aumann 61] ev is not measurable no matter which σ-algebra is used for ℝ→mℝ.

Page 80: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

We formulated a new probability theory that puts random variable as primary concept [LICS’17].

Used it to define the semantics of expressive prob. programming languages, such as Anglican.

Quasi-Borel space - core notion of this theory.

Page 81: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

We formulated a new probability theory that puts random variable as primary concept [LICS’17].

Used it to define the semantics of expressive prob. programming languages, such as Anglican.

Quasi-Borel space - core notion of this theory.

Page 82: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

Page 83: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

Page 84: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

1. σ-algebras Σ⊆2Ω, Θ⊆2Χ

2. measure μ : Σ→[0,∞]3. α-1(B)∈Σ for all B∈Θ

in measure theory

Page 85: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

in measure theory

1. Σ⊆2Ω, Θ⊆2Χ

2. μ : Σ→[0,∞]

Page 86: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

in measure theory

1. Σ⊆2Ω, Θ⊆2Χ

2. μ : Σ→[0,1]

Page 87: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

1. Σ⊆2Ω, Θ⊆2Χ

2. μ : Σ→[0,1]

in measure theory

is a random variable if α-1(A)∈Σ for all A∈Θ

Page 88: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

Page 89: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : Ω → X

• X - set of values.

• Ω - set of random seeds.

• Random seed generator.

in quasi-Borel spaces

Page 90: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : [0,1] → X

• X - set of values.

• [0,1] - set of random seeds.

• Random seed generator.

in quasi-Borel spaces

1. [0,1] random source2. Borel subsets 𝕭⊆2[0,1]

3. Uniform[0,1]4. M ⊆ [[0,1]→X]

Page 91: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : [0,1] → X

• X - set of values.

• [0,1] - set of random seeds.

• Random seed generator.

in quasi-Borel spaces

1. [0,1] random source2. Borel subsets 𝕭⊆2[0,1]

3. Uniform[0,1]4. M ⊆ [[0,1]→X]

Page 92: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : [0,1] → X

• X - set of values.

• [0,1] - set of random seeds.

• Random seed generator.

in quasi-Borel spaces

1. [0,1] random source2. Borel subsets 𝕭⊆2[0,1]

3. Uniform[0,1]4. M ⊆ [[0,1]→X]

Page 93: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Random variable α in X

α : [0,1] → X

• X - set of values.

• [0,1] - set of random seeds.

• Random seed generator.

in quasi-Borel spaces

is a random variable if α∈M

1. [0,1] random source2. Borel subsets 𝕭⊆2[0,1]

3. Uniform[0,1]4. M ⊆ [[0,1]→X]

Page 94: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

• Measure theory:

• Measurable space (X, Θ⊆2Χ).

• Random variable is an induced concept.

• Quasi-Borel space:

• Quasi-Borel space (X, M⊆[[0,1]→X]).

• M is the set of random variables.

Page 95: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

[Theorem] The category of measurable spaces is not cartesian closed.

[Theorem] The category of quasi-Borel spaces is cartesian closed.

Intuitively, cartesian closure means good support for higher-order functions.

Compositional inference algo. by Scibior et al. are justified using quasi-Borel spaces [POPL18].

Page 96: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Choices

1. Unnormalised or normalized posterior?

2. Marginalised or un-marginalised?

3. Focus on measurable sets or random vars?

Page 97: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

Choices

1. Unnormalised or normalized posterior?

2. Marginalised or un-marginalised?

3. Focus on measurable sets or random vars?

Page 98: Formal Semantics of Probabilistic Programming Languages: … · 2017-11-20 · Formal Semantics of Probabilistic Programming Languages: Issues, Results and Opportunities Hongseok

References

1. Commutative semantics for probabilistic programs. Staton. ESOP’17.

2. A convenient category for higher-order probability theory. Heunen et al. LICS’17.

3. A tutorial on probabilistic programming. Van de Meent et al. Draft book.