The Powerdomain of Continuous Random Variables Jean - - PowerPoint PPT Presentation

the powerdomain of continuous random variables
SMART_READER_LITE
LIVE PREVIEW

The Powerdomain of Continuous Random Variables Jean - - PowerPoint PPT Presentation

The Powerdomain of Continuous Random Variables Jean Goubault-Larrecq, Daniele Varacca LSV - ENS Cachan, PPS - Paris Diderot LICS, June 21, 2011 Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables Semantics of Higher-Order


slide-1
SLIDE 1

The Powerdomain of Continuous Random Variables

Jean Goubault-Larrecq, Daniele Varacca

LSV - ENS Cachan, PPS - Paris Diderot

LICS, June 21, 2011

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-2
SLIDE 2

Semantics of Higher-Order Probabilistic Languages

휎, 휏 ::= 훾 ∣ 휎 → 휏 functions ∣ V휏 probability ∣ . . . distributions M, N, P ::= x휏 ∣ 휆x휎 ⋅ M ∣ MN ∣ . . . ∣ ⋇ fair coin ∣ val M ∣ let x = M in N sequence

Open Problem: Does there exist a Cartesian closed category (=interpret 휎 → 휏)

  • f continuous domains,

closed under the probabilistic powerdomain (=interpret V휏)? We still do not know, but present an interesting alternative.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-3
SLIDE 3

Continuous Random Variables Semantics

Road Map

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-4
SLIDE 4

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Road Map

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-5
SLIDE 5

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-6
SLIDE 6

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Continuous Valuations

Classical view [JonesPlotkin89]: interpret V휏 as space of continuous valuations (=measures on a topology).

Definition (Continuous Valuation)

A function 휈 : Opens(X) → [0, 1] with: 휈(∅) = (strictness) U ⊆ V ⇒ 휈(U) ≤ 휈(V) 휈(U ∪ V) + 휈(U ∩ V) = 휈(U) + 휈(V) 휈( ∪↑

i∈I Ui)

= sup↑

i∈I 휈(Ui)

We shall also require 휈(X) = 1 (probability).

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-7
SLIDE 7

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Dirac Valuations

A Prominent Example. For any x ∈ X, the Dirac valuation 훿x is defined as 훿x(U) = { 1 if x ∈ U

  • therwise

Simple valuations are finite linear combinations of Dirac valuations

n

i=1

ai훿xi with a1, . . . , an ≥ 0, ∑n

i=1 ai = 1.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-8
SLIDE 8

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

Basic open sets: ↑ x for finite sequence x

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-9
SLIDE 9

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

Evaluating

1 4훿00 + 1 6훿0 + 1 3훿01 + 1 4훿11

  • n ↑ 0

3 4

Basic open sets: ↑ x for finite sequence x

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-10
SLIDE 10

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

1 4훿00 + 1 6훿0 + 1 3훿01 + 1 4훿11

Evaluating

  • n ↑ 01

1 3

Basic open sets: ↑ x for finite sequence x

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-11
SLIDE 11

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

Evaluating

1 4훿00 + 1 6훿0 + 1 3훿01 + 1 4훿11

  • n ↑ 010

Basic open sets: ↑ x for finite sequence x

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-12
SLIDE 12

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

E.g., p = 0.2, q = 0.8. 0.2 Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-13
SLIDE 13

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

E.g., p = 0.2, q = 0.8.

0.16

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-14
SLIDE 14

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

E.g., p = 0.2, q = 0.8.

0.032

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-15
SLIDE 15

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 2

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s If p = q = 1/2 the induced valuation is the uniform valuation Λ (on the top elts)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-16
SLIDE 16

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 4

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s If p = q = 1/2 the induced valuation is the uniform valuation Λ (on the top elts)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-17
SLIDE 17

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01 휖 1 111 000 001 010 011 101 100 110 1 8

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s If p = q = 1/2 the induced valuation is the uniform valuation Λ (on the top elts)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-18
SLIDE 18

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree. The support of Λ is

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

the whole Cantor tree Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s If p = q = 1/2 the induced valuation is the uniform valuation Λ (on the top elts) The support supp 휈, is the complement of the largest U such that 휈(U) = 0

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-19
SLIDE 19

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Examples

{0, 1}≤휔: the Cantor tree.

00 11 10 01

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

The support of

1 4훿00 + 1 6훿0 + 1 3훿01 + 1 4훿11

Basic open sets: ↑ x for finite sequence x Any biased coin (p, q) with p + q = 1 induces a continuous valuation 휈(x) = pa(1 − p)b where a is the number of 0’s in x, while b is the number of 1’s If p = q = 1/2 the induced valuation is the uniform valuation Λ (on the top elts) The support supp 휈, is the complement of the largest U such that 휈(U) = 0

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-20
SLIDE 20

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Troublesome Probabilistic Powerdomain

The functor V preserves the category of continuous domains. The category of continuous domains is not Cartesian closed. No Cartesian closed subcategory of continuous domains is known to be preserved by V. No known (interesting) denotational semantics of probabilistic higher order languages.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-21
SLIDE 21

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-22
SLIDE 22

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Random Variables

Random variable= measure on a space Ω + a measurable map f : Ω → X: induces a measure on X (the image measure) Ω is the sample space X is the space of observations or outcomes

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-23
SLIDE 23

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Continuous Random Variables

A continuous random variable is a continuous valuation 휈 on some space Ω, together with a continuous function f : supp 휈 → X. We will fix Ω to be the Cantor tree. Ω f X

00 11 10 01

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

( 1

4)

( 7

12)

( 1

6)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-24
SLIDE 24

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Ordering on CRVs

If F = supp 휈, let pF(w) be largest prefix of w in F (projection).

Definition (≦)

(휈, f) ≦ (휈′, f ′) iff: “increase supp, preserve probabilities” 휈 is img of 휈′ by psupp 휈 “increase values” f ∘ psupp 휈 ≤ f ′ Ω f X

00 11 10 01

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-25
SLIDE 25

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Ordering on CRVs

If F = supp 휈, let pF(w) be largest prefix of w in F (projection).

Definition (≦)

(휈, f) ≦ (휈′, f ′) iff: “increase supp, preserve probabilities” 휈 is img of 휈′ by psupp 휈 “increase values” f ∘ psupp 휈 ≤ f ′ Ω f ′ X

00 11 10 01

1 4

휖 1

1 4

111

1 6

000 001 010 011 101 100 110

1 9 1 6 1 18

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-26
SLIDE 26

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Ordering on CRVs

If F = supp 휈, let pF(w) be largest prefix of w in F (projection).

Definition (≦)

(휈, f) ≦ (휈′, f ′) iff: “increase supp, preserve probabilities” 휈 is img of 휈′ by psupp 휈 “increase values” f ∘ psupp 휈 ≤ f ′ Ω f X

00 11 10 01

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-27
SLIDE 27

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Ordering on CRVs

If F = supp 휈, let pF(w) be largest prefix of w in F (projection).

Definition (≦)

(휈, f) ≦ (휈′, f ′) iff: “increase supp, preserve probabilities” 휈 is img of 휈′ by psupp 휈 “increase values” f ∘ psupp 휈 ≤ f ′ Ω X f

00 11 10 01

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

(Probabilities fixed forever)

Deadlock states

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-28
SLIDE 28

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Thin Random Variables

A continuous valuation that does not deadlock is called thin, as all the information can be gathered on the maximal elements of the support (a “thin” set). Thin Not Thin

00 11 10 01 00 11 10 01

1 4

휖 1

5 12

111

1 3

000 001 010 011 101 100 110

1 4

휖 1

1 4

111

1 3 1 6

000 001 010 011 101 100 110

Deadlock states Note: the uniform valuation Λ is thin.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-29
SLIDE 29

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Thin Random Variables

Definition (Thin CRV (휈, f))

휈 is a thin continuous valuation on Ω f is a continuous map from Max supp 휈 to X

. . . so f is defined only on the non-deadlock elements of supp 휈.

Ω f X

00 11 10 01

1 4

휖 1

5 12

111

1 3

000 001 010 011 101 100 110

Note to the purist: if X is a bc-domain (needed later anyway), f extends canonically to supp 휈. So thin CRVs are CRVs in this sense.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-30
SLIDE 30

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Monad of Thin CRVs

Theorem

Thin CRVs form a monad.

Proof: Arise as a free dcpo-algebra for some equational theory (see later.)

This says things such as (A; B); C = A; (B; C), and other expected equations. Not the case for (non-thin) CRVs.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-31
SLIDE 31

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Monad of Thin CRVs

Explicitly, 휃R(X) is space of thin CRVs over X; unit 휂X : X → 휃R(X) maps x to Ω f X

00 11 10 01 휖 1 111 000 001 010 011 101 100 110

1 x “Flip no coin, return x right away”

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-32
SLIDE 32

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Monad of Thin CRVs

Extension h† : 휃R(X) → 휃R(Y) of h : X → 휃R(Y):

Y Ω X Ω Y Ω Ω Y

“concatenate sequences of coin flips”

x1 x2 2 3 x1 x2 1 3 1 3

h† :

5 36 1 9 1 12 1 3

(sequential composition)

Then: E.g., take

1 2

h

1 2 1 4 1 3 5 12

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-33
SLIDE 33

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-34
SLIDE 34

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Category of Bc-Domains

Definition

A dcpo D is a bc-domain iff it is continuous (there is a notion of approximation) it is bounded-complete (any finite set of elements that has an upper bound has a least one) The bc-domains are exactly the densely injective T0 spaces [Scott, Escardó], a fact we require in the paper.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-35
SLIDE 35

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

The Cartesian Closed Category of Bc-Domains

Theorem (Jung) The category of bc-domains and continuous functions is Cartesian closed.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-36
SLIDE 36

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Thin CRVs and Bc-Domains

Theorem

Thin CRVs over a bc-domain D form a bc-domain 휃R(D).

Proof (sketch.) Thin CRVs arise as retract from semi-thin CRVs (i.e., (휈, f) where 휈 thin, but f defined on whole of supp 휈), construction through dense injectivity Retracts of bc-domains are bc-domains, so prove semi-thin CRVs form a bc-domain: Approximation on semi-thin CRVs (휈, f) < ⊲ (휈′, f ′) iff 휈 has finite support, (휈, f) ≦ (휈′, f ′) and f(w) ≪ f ′(w) for every w Least upper bound of (휈, f) and (휈′, f ′) if they have an upper bound (휈′′, f ′′) at all: project (휈′′, f ′′) onto supp 휈 ∪ supp 휈′.

We can use thin CRVs for semantics!

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-37
SLIDE 37

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Uniform CRVs

Definition (Uniform CRVs)

(휈, f) uniform iff thin + 휈 = psupp 휈(Λ) (proj. of uniform valuation). “Flip all bits with probability 1

2, independently”

Theorem

Uniform CRVs also form a monad.

Theorem

Uniform CRVs over a bc-domain D form a bc-domain 휐R(D).

Proof: Sups of uniform CRVs taken in 휃R(D) are uniform.

We can use uniform CRVs for semantics!

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-38
SLIDE 38

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-39
SLIDE 39

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Equational Theories

Sorry, I don’t think we’ll have time for a complete tour. In short: Nice characterizations through equational theories We exhibit relationship with DV’s indexed valuations Nice interplay with angelic non-determinism (distributive law)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-40
SLIDE 40

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Valuations

Equational Theory for V

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y

4

x = x ⊕p x with x ⊕p y continuous in x, y, p ∈ [0, 1]

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-41
SLIDE 41

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Layered Hoare Indexed Valuations

Equational Theory for I V [This paper, variant]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y

4

x ≤ x ⊕p x (Hoare indexed) with x ⊕p y continuous in x, y, p ∈ [0, 1] (layered)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-42
SLIDE 42

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Thin Random Variables

Equational Theory for 휃R [This paper]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y x ⊕1 y independent of y, x ⊕0 y independent of x

4

x ≤ x ⊕p x with x ⊕p y continuous in x, y, p ∈ [0, 1]

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-43
SLIDE 43

Continuous Random Variables Semantics Valuations Random Variables CCC Theories

Uniform Random Variables

Equational Theory for 휐R [This paper]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y x ⊕1 y independent of y, x ⊕0 y independent of x

4

x ≤ x ⊕p x with x ⊕p y continuous in x, y, p ∈ [0, 1] and p ∈ {0, 1

2, 1}

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-44
SLIDE 44

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Road Map

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-45
SLIDE 45

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-46
SLIDE 46

Continuous Random Variables Semantics Language Semi-Decidability of Testing

How Good are CRVs at Giving Semantics?

We claim that:

Theorem (somewhat imprecise for now)

Thin CRVs, uniform CRVs are as good as valuations in giving semantics of higher-order programming languages. Intuition: no primitive in the language has explicit access to the random bits.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-47
SLIDE 47

Continuous Random Variables Semantics Language Semi-Decidability of Testing

A Higher-Order Probabilistic Language

훾 ::= Bool ∣ Nat ∣ . . . base types 휎, 휏 ::= 훾 ∣ 휎 × 휏 pairs ∣ 휎 → 휏 functions ∣ V휏 probability distributions ∣ . . . M, N, P ::= x휏 all sorts ∣ 휆x휎 ⋅ M

  • f constructs

∣ MN from the ∣ if M then N else P PCF language, ∣ Y 휏M

  • r extensions

∣ . . . ∣ ⋇ fair coin ∣ val M monadic return ∣ let x = M in N sequential composition

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-48
SLIDE 48

Continuous Random Variables Semantics Language Semi-Decidability of Testing

The Valuation Semantics

_1 is the standard valuation-based semantics

Definition (_1)

V휏1 = V(휏1) ⋇1 =

1 2훿1 + 1 2훿0

fair coin val M1 = 훿M1 let x = M in N = U → ∫

x N1 (x)(U)d M1

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-49
SLIDE 49

Continuous Random Variables Semantics Language Semi-Decidability of Testing

The Random Variable Semantics

_2 is the uniform CRV-based semantics

Definition (_2)

V휏2 = 휐R(휏2) ⋇2 =

00 11 10 01 휖 1 000 001 010 011 101 100 110 111 Ω 픹⊥ = Bool2

1 2

1

1 2

⊥ fair coin val M2 = 휂(M2) let x = M in N2 = (x → N2 (x))†(M2)

Note: The val and let cases are as in every monad.

휏2 (not 휏1) is a bc-domain for every 휏.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-50
SLIDE 50

Continuous Random Variables Semantics Language Semi-Decidability of Testing

CRVs are as Good as Valuations

Theorem (Random Variables are as Good as Valuations)

Let M be any closed term of ground type 훾. Then M1 = M2

Proof: Define a logical relation (R휏)휏 type, where R휏 ⊆ 휏1 × 휏2: 휇 RV휏 (휈, f) iff ∫

x h1(x)d휇 =

w h2(f(w))d휈 whenever h1 ˆ

R휏 h2 h1 ˆ R휏 h2 iff h1(x1) = h2(x2) whenever x1 R휏 x2 “휇 is obs. indistinguishable from image measure 휈 ∘ f −1 of (휈, f)” Prove the Basic Lemma: M1 R휏 M2 for all M : 휏. At ground types, R훾 is equality: conclude.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-51
SLIDE 51

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Outline

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-52
SLIDE 52

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Probabilistic Testing

Definition (Testing Equivalence)

M, N : V Bool are probabilistically equivalent iff Prob[M ⇓ 1] = Prob[N ⇓ 1] Escardó [2009] also defines may-testing, must-testing equivalence (replace Prob by ∃, ∀) — I’ll skip this, see paper. Formally requires operational semantics

⋇ ⇓ 1 ⋇ ⇓ 0 M ⇓ V val M ⇓ val V M ⇓ val V N[x := V] ⇓ V ′ let x = M in N ⇓ V ′

Prob defined by “⋇ ⇓ 1 or ⋇ ⇓ 0 with prob. 1

2”

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-53
SLIDE 53

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Decidability?

Escardó’s goal [2009] is to show that probabilistic testing is semi-decidable.

Theorem

Probabilistic testing is undecidable.

Proof: by reduction from PFA reachability ([Paz71,CondonLipton89,BlondelCanterini03], see nice proof of undecidability by [GimbertOualhadj, ICALP’09]).

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-54
SLIDE 54

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Going Denotational

Definition (Testing Equivalence)

M, N : V Bool are probabilistically equivalent iff ∫ 1d M1 = ∫ 1d N1. This is equivalent to previous definition by computational adequacy. Escardó describes all this elegantly by adding a testing

  • perator

∫ (integration) into the language.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-55
SLIDE 55

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Escardó’s MMP

Let MMP [Escardó09] be PCF+the V monad(+others)+testing

  • perators.

훾 ::= Bool ∣ Nat ∣ I ∣ . . . base types (I = [0, 1]휎) M, N, P ::= x휏 ∣ 휆x휎 ⋅ M ∣ MN ∣ Y 휏M ∣ if M then N else P ∣ . . . ∣ ⋇ fair coin ∣ val M monadic return ∣ let x = M in N sequential composition ∣ max ∣ min ∣ ⊕ average ((x + y)/2) ∣ ∫ MN integration ( ∫ MN

x M (x)d N)

M, N : V Bool are eqv iff ∫ 1M

  • 1 =

∫ 1N

  • 1

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-56
SLIDE 56

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Escardó’s Argument

Theorem

Probabilistic (also, may-, must-) testing is semi-decidable.

Proof ideas: Escardó [2009] reduces this to the problem of showing 휙(M)1 = M1 for M : I where 휙(M) is term that implements ∫ using ⊕ and fixpoints. Target language is real PCF, which is computable (e.g., every implementable boolean question is semi-decidable). Manages to do using V 휏1 as free cone algebra. . . . only works when 휏1 continuous, i.e., at low orders.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-57
SLIDE 57

Continuous Random Variables Semantics Language Semi-Decidability of Testing

Escardó’s Argument

Theorem

Probabilistic (also, may-, must-) testing is semi-decidable.

Proof ideas: Escardó [2009] reduces this to the problem of showing 휙(M)1 = M1 for M : I where 휙(M) is term that implements ∫ using ⊕ and fixpoints. Target language is real PCF, which is computable (e.g., every implementable boolean question is semi-decidable). Manages to do using V 휏1 as free cone algebra. . . . only works when 휏1 continuous, i.e., at low orders. We know that _1 = _2 at ground types. So prove 휙(M)2 = M2 for M : I now we are in the cozy category of bc-domains, at all types.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-58
SLIDE 58

Appendix

Related Work

The troublesome probabilistic powerdomain [JungTix98] Indexed valuations [V03] very much related to CRVs. Indexed valuations (although not the kind presented here) preserve FS-domains [Mislove07] Models of non-deterministic+probabilistic choice [MOW03,TKP05,JGL07] Testing of higher-order programs [Escardó09]

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-59
SLIDE 59

Appendix

Summary

New monads of prob. choice, through random variables A definite plus, compared to the prob. powerdomain V: they live in the cozy CCC of bc-domains Clarifies notion of indexed valuation (see paper) Random variables as good as valuations for semantics (at ground types) We solved an problem left open by M. Escardó: prob. (and may-, must-) testing of extended PCF is semi-decidable.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-60
SLIDE 60

Appendix

Summary

New monads of prob. choice, through random variables A definite plus, compared to the prob. powerdomain V: they live in the cozy CCC of bc-domains Clarifies notion of indexed valuation (see paper) Random variables as good as valuations for semantics (at ground types) We solved an problem left open by M. Escardó: prob. (and may-, must-) testing of extended PCF is semi-decidable. We were initially looking for a concrete description of indexed valuations: is there any? Combining CRVs with non-determinism: doable? comparison with previsions/convex non-determinism?

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-61
SLIDE 61

Appendix Theories Proof

Road Map

1

Continuous Random Variables The Classical Probabilistic Powerdomain The Definition of Continuous Random Variables In the CCC of BC-Domains Equational Theories

2

Semantics A Probabilistic Higher Order Language Semi-Decidability of Testing

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-62
SLIDE 62

Appendix Theories Proof

Outline

3

Appendix Equational Theories A More Complete Proof of Escardó’s Claim

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-63
SLIDE 63

Appendix Theories Proof

Equational Theory for Non-Determinism

Hoare Powerdomain

The Hoare powerdomain H (X) is the free algebra for the equational theory x ∪ – x = x x ∪ – y = y ∪ – x (x ∪ – y) ∪ – z = x ∪ – (y ∪ – z) x ≤ x ∪ – y This models angelic non-determinism. What about languages with both non-determinism and probabilities?

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-64
SLIDE 64

Appendix Theories Proof

Distributive laws

Theorem (Varacca, PhD Thesis, 2003)

There is no distributive law between the Hoare powerdomain monad H and the continuous valuation monad V. . . . and neither H V nor VH a monad the categorical way of saying that probabilistic choice and non-deterministic choice do not commute:

0.7 0.3 0.4 0.25 0.35 1.0 0.7 0.3 0.7 0.3 1 0.7 0.3 0.7 0.3 0.7 0.3 0.7 0.3 a b c d Flip1 Flip1 a b c d a b c d e

H V H V V H

?

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-65
SLIDE 65

Appendix Theories Proof

Solutions

Replace Hoare powerdomain by convex Hoare powerdomain [MOW03, TKP05]: H cvxV is a monad

. . . i.e., use randomized, not pure, schedulers to resolve non-determinism

Use previsions [JGL07]

. . . (roughly) isomorphic to previous [JGL08a]

Realize V satisfies too many equations, e.g., x ⊕p x = x. ↝ Keep H , but replace V by indexed valuations I V [V03].

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-66
SLIDE 66

Appendix Theories Proof

Valuations

Equational Theory for V

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y

4

x = x ⊕p x with x ⊕p y continuous in x, y, p ∈ [0, 1]

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-67
SLIDE 67

Appendix Theories Proof

Layered Hoare Indexed Valuations

Equational Theory for I V [This paper, variant]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y

4

x ≤ x ⊕p x (Hoare indexed) with x ⊕p y continuous in x, y, p ∈ [0, 1] (layered)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-68
SLIDE 68

Appendix Theories Proof

Thin Random Variables

Equational Theory for 휃R [This paper]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y x ⊕1 y independent of y, x ⊕0 y independent of x

4

x ≤ x ⊕p x (Hoare indexed) with x ⊕p y continuous in x, y, p ∈ [0, 1] (layered)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-69
SLIDE 69

Appendix Theories Proof

Uniform Random Variables

Equational Theory for 휐R [This paper]

1

x ⊕p y = y ⊕1−p x

2

x ⊕p (y ⊕q z) = (x ⊕

p p+q−pq y) ⊕p+q−pq z 3

x ⊕1 y = x, x ⊕0 y = y x ⊕1 y independent of y, x ⊕0 y independent of x

4

x ≤ x ⊕p x with x ⊕p y continuous in x, y, p ∈ [0, 1] and p ∈ {0, 1

2, 1}

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-70
SLIDE 70

Appendix Theories Proof

Indexed valuations

Indexed valuations are between valuations and CRVs:

Theorem

There are collapse maps

Ω X

+ 1

4훿b 3 4훿a

00 11 10 01

휃R(X) {(a, prob 5

12),

(b, prob 1

4)}

(a, prob 1

3),

a b 1 4 휖 1 5 12 111 1 3 000 001 010 011 101 100 110

I V (X) V(X)

Proof: In each arrow A → B above, B is a T-algebra and A the free T-algebra for some T.

Note: The composite qX : 휃R(X) → V(X) maps (휈, f) to the image measure of 휈 by f (“forgets coin flips”)

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-71
SLIDE 71

Appendix Theories Proof

Distributive Laws

Theorem

There is a distributive law between H and 휃R. Resulting monad obtained by: taking unions of equational theories of H , 휃R making ∪ – and ⊕p distribute

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-72
SLIDE 72

Appendix Theories Proof

Outline

3

Appendix Equational Theories A More Complete Proof of Escardó’s Claim

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-73
SLIDE 73

Appendix Theories Proof

Escardó’s Argument

Theorem

Probabilistic (also, may-, must-) testing is semi-decidable.

Proof: [Escardó09]

1

Compile MMP to sub-language PCF + S + I(=MMP minus ∫ ): 휙(V휏) = Cantor → 휙(휏) where Cantor = Nat → Bool (“infinite sequences of coin flips”) 휙( ∫ MN) = int(휙(N) ∘ 휙(M)) where int is integration wrt. to uniform prob. on Cantor: int(h) = max(h(⊥), int(휆s⋅h(cons 1s))⊕int(휆s⋅h(cons 0s)))

2

Show 휙(M)1 = M1 for M : I (*)

3

Show comp. adequacy for PCF + S + I: M ⇓ V iff M1 = V.

4

Since reachability in PCF + S + I semi-decidable, conclude.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-74
SLIDE 74

Appendix Theories Proof

휙 is Correct

So everything boils down to proving

Correctness

휙(M)1 = M1 for M : I Escardó proves this for M at low orders: restrict V 휏 so that V 휏1 is free cone algebra, e.g., 휏1 continuous “The troublesome probabilistic powerdomain”

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-75
SLIDE 75

Appendix Theories Proof

휙 is Correct

So everything boils down to proving

Correctness

휙(M)1 = M1 for M : I Escardó proves this for M at low orders: restrict V 휏 so that V 휏1 is free cone algebra, e.g., 휏1 continuous “The troublesome probabilistic powerdomain” But remember random variables as good as valuations: N1 = N2 for all N : 훾. So boils down to proving 휙(M)2 = M2 for M : I. . . and now we are in the cozy category of bc-domains, at all types.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-76
SLIDE 76

Appendix Theories Proof

Coin Flips

Therefore:

Theorem (This paper)

Probabilistic (also, may-, must-) testing is semi-decidable.

Proof: (sketch) We must show 휙(M)2 = M2 whenever M : 훾. 휙(V휏)2 is a fair-coin algebra, V휏2 = 휐R(휏2) is the free fair-coin algebra ⇒ unique fair-coin algebra morphism 휓 : V휏2 → 휙(V휏)2. int implements integration correctly: int2 (k ∘ 휓(휈, f)) = ∫

x∈X

k(x)dqX(휈, f) Define logical relation R휏 ⊆ 휏2 × 휙(휏)2 with (휈, f) RV휏 휉 iff int2 (k1 ∘ 휓(휈, f)) = int2 (k2 ∘ 휉) whenever k1 R휏→I k2 Since R훾 is equality, conclude.

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables

slide-77
SLIDE 77

Appendix Theories Proof

Comparing Ω and Cantor

CRVs and Escardó’s translation both flip coins. uniform CRVs 휙 translation Monad? Yes No Coin flips {1, 0}≤휔 {1, 0}=휔

Extension concatenation interleaving (sequential composition) 10 110 10110 100 . . . 110 . . . 110100 . . .

Goubault-Larrecq, Varacca The Powerdomain of Continuous Random Variables