Coupling Proofs Are Probabilistic Product Programs Gilles Barthe, - - PowerPoint PPT Presentation

coupling proofs are probabilistic product programs
SMART_READER_LITE
LIVE PREVIEW

Coupling Proofs Are Probabilistic Product Programs Gilles Barthe, - - PowerPoint PPT Presentation

Coupling Proofs Are Probabilistic Product Programs Gilles Barthe, Benjmain Grgoire, Justin Hsu*, Pierre-Yves Strub IMDEA Software, Inria, University of Pennsylvania*, cole Polytechnique January 18, 2017 1 A simple card-flipping process


slide-1
SLIDE 1

Coupling Proofs Are Probabilistic Product Programs

Gilles Barthe, Benjmain Grégoire, Justin Hsu*, Pierre-Yves Strub

IMDEA Software, Inria, University of Pennsylvania*, École Polytechnique

January 18, 2017

1

slide-2
SLIDE 2

A simple card-flipping process

Setup

◮ Input: position in {1, . . . , 9} ◮ Repeat:

– Draw uniformly random card ∈ {1, . . . , 9} – Go forward that many steps

◮ Output last position before crossing 100 2

slide-3
SLIDE 3

In pictures

3

3

slide-4
SLIDE 4

In pictures

3 1

3

slide-5
SLIDE 5

In pictures

3 1 5

3

slide-6
SLIDE 6

In pictures

3 1 5 4

3

slide-7
SLIDE 7

In pictures

3 1 5 4

Output last position: 99

3

slide-8
SLIDE 8

Starting at a different position

1

4

slide-9
SLIDE 9

Starting at a different position

1 2

4

slide-10
SLIDE 10

Starting at a different position

1 2 9

4

slide-11
SLIDE 11

Starting at a different position

1 2 9 8

4

slide-12
SLIDE 12

Starting at a different position

1 2 9 8

How close are the two output distributions?

4

slide-13
SLIDE 13

Combine first process and second process

5

slide-14
SLIDE 14

Combine first process and second process

3

5

slide-15
SLIDE 15

Combine first process and second process

3

5

slide-16
SLIDE 16

Combine first process and second process

3 1

5

slide-17
SLIDE 17

Combine first process and second process

3 1

5

slide-18
SLIDE 18

Combine first process and second process

3 1 2

5

slide-19
SLIDE 19

Combine first process and second process

3 1 2

5

slide-20
SLIDE 20

Combine first process and second process

3 1 2 1

5

slide-21
SLIDE 21

Combine first process and second process

3 1 2 1

5

slide-22
SLIDE 22

Combine first process and second process

3 1 2 1 1

5

slide-23
SLIDE 23

Combine first process and second process

3 1 2 1 1

5

slide-24
SLIDE 24

Combine first process and second process

3 1 2 1 1 7

5

slide-25
SLIDE 25

Combine first process and second process

3 1 2 1 1 7 4

5

slide-26
SLIDE 26

Combine first process and second process

3 1 2 1 1 7 4

Product program: One program simulating two programs

5

slide-27
SLIDE 27

Why is this interesting?

6

slide-28
SLIDE 28

In general

Property P of product program

Property P ′ of two programs

7

slide-29
SLIDE 29

Our construction

Two simulated programs can share randomness

8

slide-30
SLIDE 30

3 1 5 4 1 2 9 8

Distance between

  • utput distributions

9

slide-31
SLIDE 31

3 1 5 4 1 2 9 8

= ⇒

3 1 2 1 1 7 4

Distance between

  • utput distributions

9

slide-32
SLIDE 32

3 1 5 4 1 2 9 8

= ⇒

3 1 2 1 1 7 4

Distance between

  • utput distributions

Probability that

  • utputs differ

9

slide-33
SLIDE 33

3 1 5 4 1 2 9 8

Today:

= ⇒

3 1 2 1 1 7 4

Distance between

  • utput distributions

Probability that

  • utputs differ

9

slide-34
SLIDE 34

Our technical contributions

A probabilistic product construction with shared randomness A probabilistic program logic ×pRHL: a proof-relevant version of pRHL

10

slide-35
SLIDE 35

A crash course: Probabilistic Relational Hoare Logic [BGZ-B]

11

slide-36
SLIDE 36

Imperative language

c ::= x ← e | c ; c | if e then c else c | while e do c

12

slide-37
SLIDE 37

Imperative language

c ::= x ← e | c ; c | if e then c else c | while e do c | x

$

← [S]

Uniform sampling from finite set [S]

◮ coin flip: [ heads, tails ] ◮ random card: [ 1, ..., 9 ] 12

slide-38
SLIDE 38

Imperative language

c ::= x ← e | c ; c | if e then c else c | while e do c | x

$

← [S]

Uniform sampling from finite set [S]

◮ coin flip: [ heads, tails ] ◮ random card: [ 1, ..., 9 ]

Command semantics [ [c] ]

◮ Input: memory ◮ Output: distribution over memories 12

slide-39
SLIDE 39

Judgments: similar to Hoare logic

{P} c {Q}

13

slide-40
SLIDE 40

Judgments: similar to Hoare logic

{P} c {Q}

Assertions: binary relation on memories

◮ Can refer to tagged program variables: x1 and x2 ◮ First order formulas, non-probabilistic 13

slide-41
SLIDE 41

Judgments: similar to Hoare logic

{P} c {Q}

Assertions: binary relation on memories

◮ Can refer to tagged program variables: x1 and x2 ◮ First order formulas, non-probabilistic

If the two inputs satisfy P, we can share the randomness on two runs of c so that the two outputs satisfy Q.

13

slide-42
SLIDE 42

Proof rules in pRHL: mostly similar to Hoare logic

14

slide-43
SLIDE 43

Proof rules in pRHL: mostly similar to Hoare logic

14

slide-44
SLIDE 44

Proof rules in pRHL: Random sampling

f : S → S bijection {⊤} x

$

← [S] {x2 = f(x1)}

15

slide-45
SLIDE 45

Proof rules in pRHL: Random sampling

f : S → S bijection {⊤} x

$

← [S] {x2 = f(x1)}

Select how to share randomness

15

slide-46
SLIDE 46

Introducing ×pRHL

Product pRHL

16

slide-47
SLIDE 47

Idea: Product program c× simulates two processes

{P} c {Q}

17

slide-48
SLIDE 48

Idea: Product program c× simulates two processes

{P} c {Q} c×

17

slide-49
SLIDE 49

Idea: Product program c× simulates two processes

{P} c {Q} c×

Runs in combined memory

◮ Two separate copies of single memory ◮ Duplicate program variables: x1 and x2 17

slide-50
SLIDE 50

Idea: Product program c× simulates two processes

{P} c {Q} c×

Runs in combined memory

◮ Two separate copies of single memory ◮ Duplicate program variables: x1 and x2

Property of c× = ⇒ property of two runs of c

17

slide-51
SLIDE 51

A tour of ×pRHL rules: [Seq]

In pRHL:

{P} c {Q} {Q} c′ {R} {P} c ; c′ {R}

18

slide-52
SLIDE 52

A tour of ×pRHL rules: [Seq]

In ×pRHL:

{P} c {Q} c× {Q} c′ {R} c×′ {P} c ; c′ {R} c× ; c×′

18

slide-53
SLIDE 53

A tour of ×pRHL rules: [Seq]

In ×pRHL:

{P} c {Q} c× {Q} c′ {R} c×′ {P} c ; c′ {R} c× ; c×′

Sequence product programs

18

slide-54
SLIDE 54

A tour of ×pRHL proof rules: [Rand]

In pRHL:

f : S → S bijection {⊤} x

$

← [S] {x2 = f(x1)}

19

slide-55
SLIDE 55

A tour of ×pRHL proof rules: [Rand]

In ×pRHL:

f : S → S bijection {⊤} x

$

← [S] {x2 = f(x1)} x1

$

← [S] ; x2 ← f(x1)

19

slide-56
SLIDE 56

A tour of ×pRHL proof rules: [Rand]

In ×pRHL:

f : S → S bijection {⊤} x

$

← [S] {x2 = f(x1)} x1

$

← [S] ; x2 ← f(x1)

Sample x2 depends on x1

19

slide-57
SLIDE 57

A tour of ×pRHL rules: [Case]

In pRHL:

{P ∧ Q} c {R} {P ∧ ¬Q} c {R} {P} c {R}

20

slide-58
SLIDE 58

A tour of ×pRHL rules: [Case]

In ×pRHL:

{P ∧ Q} c {R} c× {P ∧ ¬Q} c {R} c×

¬

{P} c {R} if Q then c× else c×

¬

20

slide-59
SLIDE 59

A tour of ×pRHL rules: [Case]

In ×pRHL:

{P ∧ Q} c {R} c× {P ∧ ¬Q} c {R} c×

¬

{P} c {R} if Q then c× else c×

¬

Case in proof conditional in product

20

slide-60
SLIDE 60

See the paper for ...

Verifying rapid mixing for Markov chains

◮ Examples from statistical physics ◮ A cool card trick

Advanced proof rules

◮ Asynchronous loop rule

Soundness

21

slide-61
SLIDE 61

Our technical contributions

A probabilistic product construction with shared randomness A probabilistic program logic ×pRHL: a proof-relevant version of pRHL

22

slide-62
SLIDE 62

23

slide-63
SLIDE 63

Proof by coupling

A proof technique from probability theory

◮ Given: two processes ◮ Specify: how to coordinate random samplings ◮ Analyze: properties of linked/coupled processes

Attractive features

◮ Compositional ◮ Reason about relation between samples, not probabilities ◮ Reduce properties of two programs to properties of one program 24

slide-64
SLIDE 64

Coupling proofs ≈ pRHL proofs

25

slide-65
SLIDE 65

Coupling proofs ≈ pRHL proofs

describe Two coupled processes

25

slide-66
SLIDE 66

Coupling proofs ≈ pRHL proofs

describe encode Two coupled processes

Probabilistic product programs

25

slide-67
SLIDE 67

Coupling proofs ≈ pRHL proofs

describe encode Two coupled processes

Probabilistic product programs

Probabilistic product programs are the computational content

  • f coupling proofs

25