From Hard Work to Trickery: A Systematic Approach to

From Hard Work to Trickery:
A Systematic Approach to Probabilistic Rewriting.
Flavien BREUVART, Ugo Dal Lago
Focus, Inria team, Bologna
Crecogi: August 28 2016
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
1 / 1
Probabilistic Rewriting
Probabilistic λ-calculus
(Weak head-reduction)
Motivations
Randomized Algorithmics
Efficiency analysis
M , N := x | λx .M | M N | M ⊕ N
Cryptography
1
(λx .M) N
Security
Machine Learning
YA0
1 ∗
•
1
2
I
1
2
YA1
1 ∗
•
•
1
2
1
2
1
2
I
Focus
M
1
2
N
YA2
1∗
1
2
1
2
•
•
A := λux .x(λy .(u(Sx) ⊕ y )I )
Flavien BREUVART, Ugo Dal Lago
1
2
M ⊕N
Modeling
1
2
M[N/x]
1
2
1
2
•
I
1
2
YA3
Prob(YA0 ⇓) < 1
Systematic probabilistic rewriting
2 / 1
The Quest for a Semantics
Denotational Semantics:
a 20 years old challenge
Operational Semantics:
a hidden challenge
Finding subclass of domains that:
Rewriting theory with:
• is a Cartesian close
• have probabilistic powerdomains
• probabilistic behaviors
• systematic proof-schemes
Real issue:
higher order probabilities
Real issue:
proba forces topological arguments
Unconventional solution:
Probabilistic coherent spaces
[EhrhardPaganiTasson2014]
Flavien BREUVART, Ugo Dal Lago
Focus
Unconventional solution
???
Our objective
Systematic probabilistic rewriting
3 / 1
What is a Systematic Proof Schema?
The Example of Infinite Rewriting
Question:
How to relate small-step and multi-step?
At the beguiling: Topology
Limits for Cantor topology of sequential small-step reductions.
Now-day: Coinduction
M →∗ f (L1 , . . . , Lk )
∀i ≤ k , Li →ω Ni
M →ω f (N1 , . . . , Nk )
Coinduction Schema
For any relation
over terms, if for all M f (N1 , ..., Nk ), there is
L1 , ..., Lk such that M →∗ f (L1 , ..., Lk ) and Li Ni , then ⊆→ω .
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
4 / 1
What About Probabilistic Rewriting
Probabilities and Non-determinism does not mix well
For now, let’s forget about non determinism. This means:
Fixing a strategy
Big step rather than multistep
Probabilities are
inherently topological
Most rewriting theory’s tools
are continuous
Bisimulations, encoding,
typing, modeling...
[0, 1] is, before all,
a topological space...
Can we treat those tools without referring to topology?
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
5 / 1
What About Probabilistic Rewriting
Probabilities and Non-determinism does not mix well
For now, let’s forget about non determinism. This means:
Fixing a strategy
Big step rather than multistep
Probabilities are
inherently topological
Most rewriting theory’s tools
are continuous
Bisimulations, encoding,
typing, modeling...
[0, 1] is, before all,
a topological space...
Can we treat those tools without referring to topology?
Yes! but there is a price to pay: a dynamic target
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
5 / 1
Probabilistic Rewriting System
Randomized function
f : UV denotes a function f : U → D (V )
D (V ) = {d ∈ V → [0, 1] | Σv ∈V d (v ) ≤ 1}
Definition of (Abstract) Probabilistic Rewriting System
Terms
Normal forms
Λ
Λ = ΛV ] ΛR
Small step
reduction : ΛR Λ
Remark: We only consider deterministic systems (with a strategy)
Coalgebraic approach of the big step reduction [Hasuo]
The evaluation eval : ΛΛV corresponds to the final arrow
in the (_ × N)-coalgebra category over set and randomized functions.
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
6 / 1
Theorem: Randomized Encoding
Λ, Π
encoding : ΛΠ
ΛR
encoding
reduction
Λ
probabilistic rewriting systems.
a randomized function preserving NF and reducibles.
ΠR
⇒
reduction
encoding
Flavien BREUVART, Ugo Dal Lago
Π
Focus
encoding
Λ
eval
Λv
Π
eval
encoding
Systematic probabilistic rewriting
Πv
7 / 1
Dynamic is Essential
ΛR
Λ
interpret
interpret
Π
reduction
6⇒
Π
eval
interpret
interpret
Λv
Λ
Only true if ||interpret(M)|| ≤ ||eval(M)||
Require a nontrivial realisability proof.
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
8 / 1
Example: Performing Choices First
Example
In any (binary) probabilistic rewriting system, the probabilistic choices
can be chosen uniformly over Boolω at the beginning.
ΛR
Unif({_} × Boolω )
reduction
Λ
reduction
Unif({_} × Boolω )
Flavien BREUVART, Ugo Dal Lago
ΛR × Boolω
⇒
Λ × Boolω
Focus
Unif({_} × Boolω )
Λ
eval
Λv
Unif({_} × Boolω )
Systematic probabilistic rewriting
Λ × Boolω
eval
Λv × Boolω
9 / 1
Example: Performing Choices First
Example
In any (binary) probabilistic rewriting system, the probabilistic choices
can be chosen uniformly over Boolω at the beginning.
ΛR
Unif({_} × Boolω )
ΛR × Boolω
Unif({_} × Boolω )
Λ
Λ × Boolω
Our theorem is Valid
for continuous probabilities!
reduction
Λ
reduction
Unif({_} × Boolω )
Flavien BREUVART, Ugo Dal Lago
⇒
Λ × Boolω
Focus
eval
Λv
Unif({_} × Boolω )
Systematic probabilistic rewriting
eval
Λv × Boolω
9 / 1
Probabilistic Intersection Types
From Probabilistic Coherence Spaces
To Probabilistic Intersection Types
π
` M : p ·α
Standard translation:
• compacts points intersection types
• prime algebraic points linear types
probabilistic bound
or weight
The adequation (reformulation)
Prob(M ⇓) =
h ¯
¯
where W (M) = p ¯
π
` M : p ·∗
X
W (M)
i
Underlying function
Ã
||eval(M)|| = ||deriv(M)||
Flavien BREUVART, Ugo Dal Lago
Focus
deriv :
Λ
M
→
7→
n
Systematic probabilistic rewriting
D (Π)
o
π
7→ p
` M : p ·∗
!
10 / 1
Probabilistic Intersection Types
From Probabilistic Coherence Spaces
To Probabilistic Intersection Types
π
` M : p ·α
Standard translation:
• compacts points intersection
types
p IS
NOT the probability
• prime algebraic points linearfor
types
M to be of type α
The adequation
Rather,(reformulation)
p IS the probability
X
Prob(M
= be W
(M) of ` M : α
for ⇓π) to
a proof
π
h ¯
¯
where W (M) = p ¯ ` M : p ·∗
i
Underlying function
Ã
||eval(M)|| = ||deriv(M)||
Flavien BREUVART, Ugo Dal Lago
Focus
deriv :
Λ
M
→
7→
n
Systematic probabilistic rewriting
D (Π)
o
π
7→ p
` M : p ·∗
!
10 / 1
Sketching the Proof of intersection types
Small-step distrib.
Cut Elimination
π
` M : p ·∗
π
` M 0 : q ·∗
such that:
is
0
ΛR
deriv
ΠR
reduction
• normalizing
• deterministic
Λ
deriv
Value determinism
∀ normal form V ,
Unicity of derivation
` V : 1·∗
red.
Π
` λx .M : 1·∗
“Poliadic λ-calculus”
Big-step distribution
deriv
Λ
||eval(M)|| = ||deriv(eval(M))||
eval
eval
Λv
Π
deriv
Flavien BREUVART, Ugo Dal Lago
Conclusion
ΠV
Focus
= ||eval(deriv(M))||
= ||deriv(M)||
Systematic probabilistic rewriting
11 / 1
And Then?
Introduce non-determinism
Convex set of distributions
A randomized simulation is a function
f : U → C (D (V ))
targeting convex sets of distributions.
• Our Theorem holds for randomized simulation,
• A randomized encoding is a functional randomized simulation,
• A probabilistic bisimulation a derandomized randomized simulation.
Maybe a direction to treat real rewriting issues
Probabilistic confluence, Powerful bisimulations...
Flavien BREUVART, Ugo Dal Lago
Focus
Systematic probabilistic rewriting
12 / 1