• 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

This re- port addresses the problem of using free/open-source libraries of recommender systems for evaluating recommender systems based on Probabilistic Relational Models (PRMs) or,

Finally, we prove some Liouville type results for systems in the whole space by, on one hand, extending to general systems a recent monotonicity result by Busca and Manasevich [10],

To this end, a methodology is proposed for the derivation of probabilistic functionality curves for bridge systems: these curves directly provide the probability

Please cite this article in press as: Geenen V, The thymus as an obligatory intersection between the immune and neuroendocrine systems: pharmacological implications, Curr Opin

In order to give a firm semantical classification of diagnosability notions, we define criteria for diagnosability in probabilistic systems, depending on (1) whether the ambiguity

In this paper a constructive method to determine and compute probabilistic reachable and invariant sets for linear discrete-time systems, excited by a stochastic disturbance,

Summary: We consider a porous media type equation over all of R d with d = 1, with monotone discontinuous coefficient with linear growth and prove a probabilistic representation of

We presented a unified framework for type inference and type checking of owner- ship type systems, and instantiated the framework for two such systems: Universe Types and