• Aucun résultat trouvé

(Not that) Old and New Results on Probabilistic Intersection Type Systems

N/A
N/A
Protected

Academic year: 2022

Partager "(Not that) Old and New Results on Probabilistic Intersection Type Systems"

Copied!
20
0
0

Texte intégral

(1)

(Not that) Old and New Results on

Probabilistic Intersection Type Systems

Flavien BREUVART, Ugo Dal Lago

Focus, Inria team, Bologna

GdR-LL: June 12-13 2016

(2)

Randomized Programming

Motivations

Randomized Algorithmics Efficiency analysis

Cryptography Security Machine Learning

Modeling

Probabilistic

λ

-calculus (Weak head-reduction)

M,N := x|λx.M|M N|MN (λx.M)N 1 M[N/x]

MN

M N

1 2

1 2

YA0 I

YA1

• I

YA2

• I

YA3

A:=λux.x(λy.(u(Sx)y)I Prob(YA0)<1

1 1 2

1 2

1 1 2

1 2

1 2 1 2

1 1 2

1 2

1 1 2 2

1 2

(3)

Probability of Normalization:

A difficult problem

Problem PConv:

What is the probability pof convergence of a given programM?

PConv is

Π02

-complete:

one derivation is insufficient

The following(and any variation) isimpossibleto getfrom r.e. type systems:

Prob(M)=p π

`M:p·α

Probabilistic dependency is not type dependency

Probabilistic Dependency non-uniform; randomized;

only propagate dependency Type Dependency uniform; non-deterministic;

waiting for data to propagate

(4)

Some Recursion Theory

The lower-bound problem is

Σ01

-complete

Asking whether Prob(M)>p is recursively enumerable.

The upper-bound problem is

Σ02

-complete

Asking whether Prob(M)<p is a problem of the form:

∃xy,φ(x,y)

The exact bound problem (PConv) is

Π02

-complete

Asking whether Prob(M)=p is a problem of the form:

∀xy,φ(x,y)

(5)

Non deterministic IT systems:

Idempotent Intersection Types

Grammar

(types) α,β := ∗ |a→α (intersections) a,b finite sets of types

(weight) p,q {0, ...,1}

(context) Γ,∆ := _ | x:a,Γ (sequent) s := Γ`M:α

Weak head reduction Rule furnishing a type toλx.Ω

Γ,x:{

[

α

]

}`x:

1·

α

Γ`M:

p·

α Γ`MN:

p 2·

α

Γ`N:α Γ`MN:

p 2·

α Γ`λx.M:

1·

∗ Γ;x:a`M:

p·

α Γ`λx.M:

1·(

a

p·

α

)

Γ`M:

p·(

a

q·

β

)

h∆α

`N:

rα·

α¯

¯

¯α∈a

i

o

Γ

+P∆α

`M N:

pq(Qiri)·

β

(6)

Non-deterministic IT systems:

Non-idempotent IT [De Carvalho]

Grammar

(types) α,β := ∗ |a→α

(intersections) a,b finite multisets of types

(weight) p,q {0, ...,1}

(context) Γ,∆ := _ | x:a,Γ (sequent) s := Γ`M:α

Multisets of intersections Multiplicities corresponding to

different uses

Γ,

x: [α]`x:

1·

α

Γ`M:

p·

α Γ`MN:

p 2·

α

Γ`N:α Γ`MN:

p 2·

α

Γ

`λx.M:

1·

∗ Γ;x:a`M:

p·

α Γ`λx.M:

1·(

a

p·

α

)

Γ`M:

p·(

a

q·

β

)

h∆α`N:

rα·

α¯

¯

¯α∈ai Γ+P∆α`M N:

pq(Qiri)·

β

(7)

Probabilistic IT systems:

Weight monad [Ehrhard et al]

Grammar

(types) α,β := ∗ |ap·α

(intersections) a,b finite multisets of types (weight) p,q {0, ...,1}

(context) Γ,∆ := _ | x:a,Γ (sequent) s := Γ`M:p·α

Probability for the function to get

this result Sums weighted but non-deterministic

Γ,

x: [α]`x:1·α

Γ`M:p·α Γ`MN:p2·α

Γ`N:α Γ`MN:p2·α

Γ

`λx.M:1·∗

Γ;x:a`M:p·α Γ`λx.M:1·(ap·α)

Γ`M:p·(aq·β) hα`N:rα·α¯¯¯αai Γ+P∆α`M N:pq(Qiri)·β

(8)

Probabilistic IT systems:

Weight monad [Ehrhard et al]

Grammar

(types) α,β := ∗ |ap·α

(intersections) a,b finite multisets of types (weight) p,q {0, ...,1}

(context) Γ,∆ := _ | x:a,Γ (sequent) s := Γ`M:p·α

A derivation is an execution the weight is the probability to get this

execution

M: 1

23·α •

λx.N:1·α

1

1 2

1 2

1 2

1 2

1

1 2

1 2

(9)

Summing all possible executions?

The (naive) theorem

Prob(M) = Xhp¯¯¯ π

`M:p·α i

Not summing too much

Issue:

`λx.x:1·∗

x: [α]`x:1·α

`λx.x:1·([α]1·α)

Solution:

Ph

p¯¯¯ π

`M:p·∗

i

Summing all of them

Issue:

M: [α,α]→∗

N1:1·α N1N2:12α

N2:1·α N1N2:12α M (N1⊕N2) :14·∗

Solution:

Use keyed-multisets

(10)

Theorem and implications

The theorem

Prob(M) = XW(M) whereW(M)=hp¯¯¯ π

`M:p·∗

i

Lower-bound problem (

Σ01

)

Prob. of conv. ofM >q iff

∃Pf W(M), X pP

p>q

Upper-bound problem (

Σ02

)

Prob. of conv. ofM <q iff

∃q0,∀PfW(M), X pP

p <q0 < q

The exact bound problem is

Π02

(11)

Sketching the proof

Cut Elimination

π

`M:p·∗

π0

`M0:pq·∗

such that:

Mq M0,

is normalizing and deterministic

Small-step distrib.

ΛR ΠR

Λ Π

deriv.

deriv.

red red

Value determinism

∀normal formV, Unicity of derivation

`V:1·∗

`λx.M:1·∗

Big-step distribution

Λ Π

Λv ΠV

deriv.

deriv.

eval eval

Conclusion

X

V

P(MV)=XW(M)

(12)

Toward distributions of derivations

Unsatisfactory completeness

Uninformative derivations Each derivation carries the

information regarding onepossible execution.

Quantifying over ALL derivations Distinguishing derivations and looking for new one is not really

computationally-friendly.

A monad of probabilistic distributions over types

(types) α,β := ∗ |a→τ

(intersections) a,b finite multisets of types (monadic distributions) ρ,τ finite distribution over types

A comonad of probabilistic distributions over intersections

(types) α,β := ∗ |Ap·α

(intersections) a,b finite multisets of types

(comonadic distributions) A,B finite distribution over intersections

(13)

Toward distributions of derivations

Unsatisfactory completeness

Uninformative derivations Each derivation carries the

information regarding onepossible execution.

Quantifying over ALL derivations Distinguishing derivations and looking for new one is not really

computationally-friendly.

A monad of probabilistic distributions over types

(types) α,β := ∗ |a→τ

(intersections) a,b finite multisets of types (monadic distributions) ρ,τ finite distribution over types

A comonad of probabilistic distributions over intersections

(types) α,β := ∗ |Ap·α

(intersections) a,b finite multisets of types

(comonadic distributions) A,B finite distribution over intersections

(14)

An unavoidable issue:

Probabilistic dependency

x : 1 2 []

+

1

2 [

β

]

`

c

α

x : 1 2

α+

1 2

β

`λ

x

.

c

α

x :

n

1 2 []

+

1

2 [

β

]

on

1 2

α+

1 2

β

o

`

c

β

: 1 2

β

`

(

λ

x

.

c

α

x ) (c

β⊕Ω

) : 1 2

α+

1 4

β

No such a rule

No reasonable and systematic rule can perform this step.

Forgotten dependency

(15)

An unavoidable issue:

Probabilistic dependency

x : 1 2 []

+

1

2 [

β

]

`

c

α

x : 1 2

α+

1 2

β

`λ

x

.

c

α

x :

n

1 2 []

+

1

2 [

β

]

on

1 2

α+

1 2

β

o

`

c

β

: 1 2

β

`

(

λ

x

.

c

α

x ) (c

β⊕Ω

) : 1 2

α+

1 4

β

No such a rule

No reasonable and systematic rule can perform this step.

Forgotten dependency

(16)

An unavoidable issue:

Probabilistic dependency

x : 1 2 []

+

1

2 [

β

]

`

c

α

x : 1 2

α+

1 2

β

`λ

x

.

c

α

x :

n

1 2 []

+

1

2 [

β

]

on

1 2

α+

1 2

β

o

`

c

β

: 1 2

β

`

(

λ

x

.

c

α

x ) (c

β⊕Ω

) : 1 2

α+

1 4

β

No such a rule

No reasonable and systematic rule can perform this step.

Forgotten dependency

(17)

An unavoidable issue:

Probabilistic dependency

x : 1 2 []

+

1

2 [

β

]

`

c

α

x : 1 2

α+

1 2

β

`λ

x

.

c

α

x :

n

1 2 []

+

1

2 [

β

]

on

1 2

α+

1 2

β

o

`

c

β

: 1 2

β

`

(

λ

x

.

c

α

x ) (c

β⊕Ω

) : 1 2

α+

1 4

β

No such a rule

No reasonable and systematic rule can perform this step.

Forgotten dependency

(18)

Distributions over sequents

Grammar

(types) α,β := ∗ |a→α

(intersections) a,b finite multisets of types (context) Γ,∆ := _ | x:a,Γ

(logical sequent) l := Γ`α

(sequent distributions) L Distributions over logical sequents (type sequent) s := (~x,M)D

(x,x){[α]`α}

MD NE

MN12D+12E M{}

M{pi·(Γi;x:ai`αi)|in}

λx.M{pi·Γi`ai→αi|in}+{(1Pipi)· ∗} M©p·(Γ`[αi,1, ...,αi,mi]→β)¯¯inª i,j, NDi,j M NPin

n(piQjmiDi,j(i,j`αi,j))·(Γ+Pji,j`:βi)¯¯∀(ij)jo

(19)

Distributions over sequents

Grammar

(types) α,β := ∗ |a→α

(intersections) a,b finite multisets of types (context) Γ,∆ := _ | x:a,Γ

(logical sequent) l := Γ`α

(sequent distributions) L Distributions over logical sequents (type sequent) s := (~x,M)D

Theorem

Prob(M) = SupnD(` ∗)¯¯¯ π MD

o

(20)

Conclusion

Past

[Ehr,Pag,Tas]

A fully abstract model for Λ.

Sketched intersection type

system.

Now

Refinment of the ITS.

Combinatorial and simpler proof of

completeness.

Collapsed intersection type system.

future

Fixpoint/coninductive proofs

unbounded terms:

while coin continue Σ01, cherckable or

inferenceable fragments

Références

Documents relatifs

The paper introduces symbolic bisimulations for a simple probabilistic π-calculus to overcome the infinite branching problem that still exists in checking ground bisimulations

• We use the Dining Cryptographers [9] to illustrate the problem caused by full-information schedulers, our so- lution based on admissible schedulers, and our proving

We now discuss location-synchronization under the general safety condition where the energy constraint for each location can be a bounded interval, lower or upper-bounded, or

Examinateurs : Mihaela BARONI, Professeur, Universit´e Dunarea de Jos, Romania Laurent GEORGE, MCF HDR, Universit´e Marne la Val´ee, France Thomas NOLTE, Professeur,

hold, i.e., that there are sets of matrices that are continuous time stabilizable with switched uncertainty, but such that, if the uncertainty is fixed, all the matrices in the set

We target systems modelled as Markov de- cision processes, developing incremental methods for constructing mod- els from high-level system descriptions and for numerical solution

We have argued the need for incremental approaches to quantitative verification of probabilistic systems, citing several scenarios where multiple verification runs need to be

However, having different possible outputs at different ports or inputs and outputs at the same port, from a state q, causes no problem since PIOTSs do contain probabilistic