on higher order probabilistic computation
play

On Higher-Order Probabilistic Computation: Relational Reasoning, - PowerPoint PPT Presentation

On Higher-Order Probabilistic Computation: Relational Reasoning, Termination, and Bayesian Programming Ugo Dal Lago (Based on joint work with Michele Alberti, Raphalle Crubill, Charles Grellois, Davide Sangiorgi,. . . ) IFIP WG 2.2 Annual


  1. Probabilistic Applicative Bisimulation L M { L/x } N { L/x } λx.M R λx.N R L eval � M � � M � ( E ) M R N � N � eval

  2. Probabilistic Applicative Bisimulation L M { L/x } N { L/x } λx.M R λx.N R L eval � M � � M � ( E ) � N � ( E ) M R N � N � eval

  3. Probabilistic Applicative Bisimulation L M { L/x } N { L/x } λx.M R λx.N R L eval � M � = � M � ( E ) � N � ( E ) M R N � N � eval

  4. Applicative Bisimilarity vs. Context Equivalence ◮ Bisimilarity : the union ∼ of all bisimulation relations. ◮ Is it that ∼ is included in ≡ ? How to prove it? ◮ Natural strategy: is ∼ a congruence? ◮ If this is the case: � � M ∼ N = ⇒ C [ M ] ∼ C [ N ] = ⇒ � C [ M ] � = � C [ N ] � = ⇒ M ≡ N. ◮ This is a necessary sanity check anyway. ◮ The naïve proof by induction fails , due to application: from M ∼ N , one cannot directly conclude that LM ∼ LN .

  5. Howe’s Technique R H R

  6. Howe’s Technique ⊆ R H R

  7. Howe’s Technique R H is a Congruence whenever R is an equivalence ⊆ R H R

  8. Howe’s Technique ∼ H is a Congruence ⊆ ∼ ∼ H

  9. Howe’s Technique ∼ H is a Congruence ⊆ ∼ ∼ H ⊇ Key Lemma

  10. Our Neighborhood ◮ Λ , where we observe convergence ∼ ⊆ ≡ ≡ ⊆ ∼ CBN � � CBV � � [Abramsky1990, Howe1993] ◮ Λ ⊕ with nondeterministic semantics, where we observe convergence , in its may or must flavors. ∼ ⊆ ≡ ≡ ⊆ ∼ × CBN � CBV × � [Ong1993, Lassen1998]

  11. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. ∼ ⊆ ≡ ≡ ⊆ ∼ × CBN � CBV � �

  12. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. ∼ ⊆ ≡ ≡ ⊆ ∼ × CBN � CBV � � ◮ Counterexample for CBN: ( λx.I ) ⊕ ( λx. Ω) �∼ λx.I ⊕ Ω ◮ Where these discrepancies come from?

  13. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. ∼ ⊆ ≡ ≡ ⊆ ∼ × CBN � CBV � � ◮ Counterexample for CBN: ( λx.I ) ⊕ ( λx. Ω) �∼ λx.I ⊕ Ω ◮ Where these discrepancies come from? ◮ From testing !

  14. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. ∼ ⊆ ≡ ≡ ⊆ ∼ × CBN � CBV � � ◮ Counterexample for CBN: ( λx.I ) ⊕ ( λx. Ω) �∼ λx.I ⊕ Ω ◮ Where these discrepancies come from? ◮ From testing ! ◮ Bisimulation can be characterized by testing equivalence as follows: Calculus Testing T ::= ω | a · T Λ T ::= ω | a · T | � T, T � P Λ ⊕ T ::= ω | a · T | ∧ i ∈ I T i | . . . N Λ ⊕

  15. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. � ⊆ ≤ ≤ ⊆ � × CBN � × CBV �

  16. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. � ⊆ ≤ ≤ ⊆ � × CBN � × CBV � ◮ Probabilistic simulation can be characterized by testing as follows: T ::= ω | a · T | � T, T � | T ∨ T

  17. The Probabilistic Case ◮ Λ ⊕ with probabilistic semantics. � ⊆ ≤ ≤ ⊆ � × CBN � × CBV � ◮ Probabilistic simulation can be characterized by testing as follows: T ::= ω | a · T | � T, T � | T ∨ T ◮ Full abstraction can be recovered if endowing Λ ⊕ with parallel disjunction [CDLSV2015]. � ⊆ ≤ ≤ ⊆ � × CBN � CBV � �

  18. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first.

  19. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ;

  20. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M .

  21. x, Γ ⊢ M Context Distance: the Affine Case [CDL2015] Γ ⊢ M ∆ ⊢ N Γ ⊢ M Γ ⊢ N Γ , x ⊢ x Γ , ∆ ⊢ MN Γ ⊢ M ⊕ N Γ ⊢ λx.M ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M .

  22. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M . ◮ Behavioural Distance δ b . ◮ The metric analogue to bisimilarity.

  23. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M . ◮ Behavioural Distance δ b . ◮ The metric analogue to bisimilarity. ◮ Trace Distance δ t . ◮ The maximum distance induced by traces, i.e., sequences of actions: δ t ( M, N ) = sup T | Pr ( M, T ) − Pr ( N, T ) | .

  24. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M . ◮ Behavioural Distance δ b . ◮ The metric analogue to bisimilarity. ◮ Trace Distance δ t . ◮ The maximum distance induced by traces, i.e., sequences of actions: δ t ( M, N ) = sup T | Pr ( M, T ) − Pr ( N, T ) | . ◮ Soundness and Completeness Results: δ b ≤ δ c δ c ≤ δ b δ t ≤ δ c δ c ≤ δ t × � � �

  25. Context Distance: the Affine Case [CDL2015] ◮ Let us consider a simple fragment of Λ ⊕ , first. ◮ Preterms : M, N ::= x | λx.M | MM | M ⊕ M | Ω ; ◮ Terms : any preterm M such that Γ ⊢ M . ◮ Behavioural Distance δ b . ◮ The metric analogue to bisimilarity. ◮ Trace Distance δ t . ◮ The maximum distance induced by traces, i.e., sequences of actions: δ t ( M, N ) = sup T | Pr ( M, T ) − Pr ( N, T ) | . ◮ Soundness and Completeness Results: δ b ≤ δ c δ c ≤ δ b δ t ≤ δ c δ c ≤ δ t × � � � ◮ Example : δ t ( I, I ⊕ Ω) = δ t ( I ⊕ Ω , Ω) = 1 2 .

  26. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . .

  27. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying.

  28. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying. ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms.

  29. Context Distance: the General Case [CDL2016] x, Γ ⊢ M ! x, Γ ⊢ M ◮ The LMC we have have worked so far with induces !Γ , x ⊢ x !Γ , ! x ⊢ x Γ ⊢ λx.M Γ ⊢ λ ! x.M unsound metrics for Λ ⊕ . . . Γ , !Θ ⊢ M ∆ , !Θ ⊢ N !Γ ⊢ M Γ ⊢ M Γ ⊢ N ◮ . . . because it does not adequately model copying. !Γ ⊢ ! M Γ ⊢ M ⊕ N Γ , ∆ , Θ ⊢ MN ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms.

  30. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying. ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms. ◮ Soundness and Completeness Results: δ t ≤ δ c δ c ≤ δ t � �

  31. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying. ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms. ◮ Soundness and Completeness Results: δ t ≤ δ c δ c ≤ δ t � � ◮ Examples : δ t (!( I ⊕ Ω) , !Ω) = 1 δ t (!( I ⊕ Ω) , ! I ) = 1 . 2

  32. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying. ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms. ◮ Soundness and Completeness Results: δ t ≤ δ c δ c ≤ δ t � � ◮ Examples : δ t (!( I ⊕ Ω) , !Ω) = 1 δ t (!( I ⊕ Ω) , ! I ) = 1 . 2 ◮ Trivialisation : the context distance collapses to an equivalence in strongly normalising fragments or in presence of parellel disjuction .

  33. Context Distance: the General Case [CDL2016] ◮ The LMC we have have worked so far with induces unsound metrics for Λ ⊕ . . . ◮ . . . because it does not adequately model copying. ◮ A Tuple LMC . ◮ Preterms : M ::= x | λx.M | λ ! x.M | MM | M ⊕ M | ! M ◮ Terms : any preterm M such that Γ ⊢ M . ◮ States : sequences of terms, rather than terms. ◮ Actions not only model parameter passing, but also copying of terms. What would a sensible notion of ◮ Soundness and Completeness Results: distance look like? δ t ≤ δ c δ c ≤ δ t � � ◮ Examples : δ t (!( I ⊕ Ω) , !Ω) = 1 δ t (!( I ⊕ Ω) , ! I ) = 1 . 2 ◮ Trivialisation : the context distance collapses to an equivalence in strongly normalising fragments or in presence of parellel disjuction .

  34. Part II Bayesian Functional Programming

Recommend


More recommend