analysis of probabilistic systemsa new hope: use the theory of programming languages to give a...
TRANSCRIPT
![Page 1: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/1.jpg)
Analysis of Probabilistic SystemsBootcamp Lecture 1: Probabilistic Programming Languages
Prakash Panangaden1
1School of Computer ScienceMcGill University
Fall 2016, Simons Institute
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 1 / 23
![Page 2: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/2.jpg)
Outline
1 Introduction
2 Early programming languages
3 Probabilistic transition systems
4 Recent developments
5 What’s in the course
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 2 / 23
![Page 3: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/3.jpg)
The true logic!
The “true” logic of the World.The actual science of logic is conversant at present only with thingseither certain, impossible or entirely doubtful; none of which,fortunately, we have to reason on. Therefore the true logic for thisworld is the calculus of Probabilities which takes account of themagnitude of the probability which is, or ought to be, in a reasonableman’s mind — James Clerk Maxwell (1850)
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 3 / 23
![Page 4: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/4.jpg)
The age of stochasticity!?
The dawning of the age of stochasticityFor over two millenia, Aristotle’s logic has ruled over the thinking ofWestern intellectuals. All precise theories, all scientific models, evenmodels of the process of thinking itself, have in principle conformed tothe straight- jacket of logic. But from its shady beginnings devisinggambling strategies and counting corpses in medieval London,probability theory and statistical inference now emerge as betterfoundations for scientific models,... — David Mumford
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 4 / 23
![Page 5: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/5.jpg)
Conditioning as inference
p p⇒ qq or (p ∧ (p⇒ q))⇒ q
Pr(A | B) = Pr(A ∩ B)Pr(B)
or
Pr(A ∧ B) = Pr(A | B) · Pr(B).Conditioning allows you to revise your probability estimates as yougain information.
(Bayes’ theorem) Pr(H | O) =Pr(O | H) · Pr(H)
Pr(O).
What if Pr(B) = 0?In discrete probability Pr(B) > 0 is a side condition.On continuous spaces; one cannot just dismiss this case.One needs conditional probability distributions or regularconditional probability densities aka disintegrations.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 5 / 23
![Page 6: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/6.jpg)
Basic discrete probability
S: a finite set; the sample space.A,B, . . . ⊆ S: events.Pr(·) : S −→ [0, 1] assigns probabilties to elements of S and henceto events.X : S −→ R a random variable.Pr(U ⊂ R)X := Pr({s|X(s) ∈ U}); probability distribution on Rinduced by X.Notation Pr({X = r}) or Pr({X ∈ U}).
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 6 / 23
![Page 7: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/7.jpg)
Independence
Fix (S,Pr(·)).Two events A,B are independent if Pr(A ∧ B) = Pr(A) · Pr(B).Two random variables X,Y are independent if for all r1, r2,Pr({X = r1}) and Pr({Y = r2}) are independent.Given three random variables X,Y,Z we say X,Y are independentconditional on Z ifPr(X = r1 ∧ Y = r2 | Z = r3) =Pr(X = r1 | Z = r3) · Pr(Y = r2 | Z = r3).For 3 or more we can define pairwise independence and mutualindependence. They are not the same.Consider two tosses of a fair coin. A: first toss is H, B second tossis H and C: the two tosses give the same result.Pr(A) = Pr(B) = Pr(C) = 1
2 .Pr(AB) = Pr(AC) = Pr(BC) = 1
4 .However Pr(ABC) = 1
4 not 18 .
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 7 / 23
![Page 8: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/8.jpg)
Probabilistic models
Reasoning under uncertainty involves the interplay betweenindependence and conditioning: Bayes nets.Hugely successful framework: graphical models – a way ofrepresenting Bayes nets.Conditional independence structure captures the model in acompact way and is useful for computing marginals andconditional probabilities.Claim: these models are indeed useful for many situations butthey are not compositional and they often “flatten out” thestructure inherent in a situation.Example: Perhaps a subgraph is repeated many times in a regularpattern.A new hope: use the theory of programming languages to give astructural way of presenting and reasoning about probabilisticmodels.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 8 / 23
![Page 9: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/9.jpg)
Other developments
Verification of probabilistic systems: Vardi, de Alfaro, Segala,Baier, Katoen, Kwiatkowska, Hermanns, ....Performance analysis: Jane HillstonProbabilistic transition systems: Larsen, Skou, van Glabbeek, ...Continuous state spaces: Desharnais, Edalat, P.; Doberkat,Rutten and de Vink, Mislove et al.,Metrics and approximation theory: Smolka et al.; DesharnaisGupta, Jagadesan, P.; Chaput, Danos, P. and Plotkin; van Breugeland Worrell.Combining probability and non-determinism: Mislove, Keimel andPlotkin, Varacca, Winskel, Goubault-Larrecq,...
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 9 / 23
![Page 10: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/10.jpg)
Probability and domains
Saheb-Djahromi (1978) developed probabilistic LCF.(1980) Developed probability distributions on domains. Showedthat dcpo structure is preserved.Higher-order language but probabilities only at ground types.Claire Jones and Gordon Plotkin (1989) developed a probabilisticpower domain.Tix, Jung: showed that this was a “vexing” construction. No knowncartesian-closed categories suitable for programming languagesemantics in which this lives.Edalat: integration on domains.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 10 / 23
![Page 11: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/11.jpg)
Kozen’s language (1981)
Syntax
S ::== xi := f (~x)|S1; S2|if B then S1 else S2|while B do S.
Semantics: programs transform input distributions to outputdistributions.Backward semantics: expectation value transformers.Many contributions from the “Oxford group”: Hoare, He, Seidel,Morgan, McIver, ...
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 11 / 23
![Page 12: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/12.jpg)
Probabilistic ccp
Saraswat, Gupta, Jagadeesan (1997): Combined probability withthe concurrent constraint programming paradigm.Gupta, Jagadeesan, P. (1999) added recursion, showedinteresting computational effects with no pure measure-theorycounterpart.Explicit use of conditioning.Largely ignored.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 12 / 23
![Page 13: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/13.jpg)
The ask/tell model
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 13 / 23
![Page 14: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/14.jpg)
CCP processes
CCP processes
ask(�) : does the current store (�) entail �?
tell(�) : add � to the current store.
P1||P2 : run P1 and P2 in parallel.
new X in P : fresh local variable; ⌫X.P .
recursive procedures
Underlying (first-order) language and `.
6Tuesday, 3 June, 14
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 14 / 23
![Page 15: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/15.jpg)
Prob CCP
Probabalistic CCP
New ingredient: choose X from Dom in P
X: local variable, scope is P
Dom is a finite set
• Random variables are hidden
• Each random variable has its ownindependent probability distribution.
19Tuesday, 3 June, 14
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 15 / 23
![Page 16: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/16.jpg)
Conditioning
Constraints and conditioning
choose X from {0, 1, 2, 3} in
tell(X 2) || [ask((X = 0) _ (X = 1)) ! tell(a)] ||[ask(X = 2) ! tell(b)]
Produces a with probability 0.5 and b with probability 0.25,
however, it cannot produce true because of the constraint on X.
Inconsistent stores are discarded and the probabilities are renormalized.
21Tuesday, 3 June, 14
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 16 / 23
![Page 17: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/17.jpg)
Modelling probabilistic systems
Systems feature probabilistic components: protocols usingrandomization, bluetooth, controllers, cells,...Probabilistic transition systems as abstractions of real systemsLogics for reasonong about probability
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 17 / 23
![Page 18: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/18.jpg)
Labelled Transition Systems
A set of states S,a set of labels or actions, L or A anda transition relation ⊆ S×A× S, usually written
→a⊆ S× S.
The transitions could be indeterminate (nondeterministic).We write s a−−→ s′ for (s, s′) ∈→a.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 18 / 23
![Page 19: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/19.jpg)
Discrete probabilistic transition systems
Just like a labelled transition system with probabilities associatedwith the transitions.
(S,L, ∀a ∈ L Ta : S× S −→ [0, 1])
The model is reactive: All probabilistic data is internal - noprobabilities associated with environment behaviour.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 19 / 23
![Page 20: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/20.jpg)
Examples of PTSs
s0a[ 1
4 ]
��
a[ 34 ]
��s1 s2
a[1]��
s3
s0a[1]
��
b[1]
��s1
c[ 12 ]
��
c[ 12 ]
&&
s2
a[1]��
s4 s3A1 A2
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 20 / 23
![Page 21: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/21.jpg)
Probability at higher type
Conditioning as a basic primitive: CCP+prob, CHURCH, TabularDomain theory in conjunction with probability: Saheb-Djahromi,Ramsey & Pfeffer, Ugo Dal Lago, Varacca & Goubault-Larrecq,...Prof. Scott’s work showing that random variables can beintroduced in a model of λ-calculus. Application of a randomvariable to another produces a random variable.Recent work (2016) by Staton et al. on semantics and reasoningprinciples for a higher-order probabilistic programming language.Recent work (2016) on approximate equational reasoning byMardare, P. and Plotkin.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 21 / 23
![Page 22: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/22.jpg)
The Shock
Ackerman, Freer, RoyThere is a pair of computable probability random variables such thatthe conditional probability distribution is not computable.
We need to control how we allow conditioning.
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 22 / 23
![Page 23: Analysis of Probabilistic SystemsA new hope: use the theory of programming languages to give a structural way of presenting and reasoning about probabilistic models. Panangaden (McGill)](https://reader030.vdocuments.site/reader030/viewer/2022041018/5ecce78ae8355a7b3b2fa9b7/html5/thumbnails/23.jpg)
Four more lectures
Review of measure and integrationLawvere-Gìry monadLogical characterization of bisimulationMetrics measuring behavioural similarity of Markov processesGuest lecture: Mislove on probability theory and domain theory
Panangaden (McGill) Analysis of Probabilistic Systems Prob. Prog. Languages 23 / 23