20 likes | 106 Views
Semantics of Probabilistic Programs. Approaches discussed in literature E 1 p E 2 => E 1 (with prob. p) => E 2 (with prob. (1-p)) Probability of a specific output is not explicit. [E 1 p E 2 ]s = (p)*[E 1 ]s + (1-p)*[E 2 ]s [E]s is a measure function from events to probabilities.
E N D
Semantics of Probabilistic Programs • Approaches discussed in literature • E1pE2 => E1 (with prob. p) => E2 (with prob. (1-p)) • Probability of a specific output is not explicit. • [E1pE2]s = (p)*[E1]s + (1-p)*[E2]s • [E]s is a measure function from events to probabilities. • Forward or Backward? • Practical Issues • Backward implementation is difficult. (inverses, representation of sets). • Need to be able to compute probabilities, expectations inside of the program.
Haskell Implementation • Using type classes to realize a general parameterized type (Prob a). • Has capability to generalize to product types (a b). • data (DomainClass a) => (Prob a) = … • (DomainClass a) is an assertion that ‘a’ must be an instance of DomainClass. • Still must provide ‘instance DomainClass T’ declaration, which defines functions to operate on values of type T. • Underlying representation • Dimensions: exact/interpolated countable/uncountable • Sample sets and functions considered.