Module PFLP

Library for Probabilistic Functional Logic Programming

Author: Sandra Dylus, Jan Christiansen, Finn Teegen

Version: October 2017

Summary of exported operations:

enum :: [a] -> [Float] -> Dist a   
Creates a distribution based on a given list of events and another list providing the corresponding probabilities.
uniform :: [a] -> Dist a   
Creates a uniform distribution based on a given list of events.
certainly :: a -> Dist a   
Creates a single-event-distribution with probability 1.0.
(>>>=) :: Dist a -> (a -> Dist b) -> Dist b   
Combines two (dependent) distributions.
joinWith :: (a -> b -> c) -> Dist a -> Dist b -> Dist c   
Combines two (independent) distributions with respect to a given function.
(??) :: (a -> Bool) -> Dist a -> Float   
Queries a distribution for the probabilitiy of events that satisfy a given predicate.
pick :: (() -> a) -> a   
Triggers the evaluation of a run-time choice value (see type synonym RT).
replicateDist :: Int -> (() -> Dist a) -> Dist [a]   
Independently replicates a distribution a given number of times.

Exported datatypes:


Probability

Probabilities. Floating point numbers are used to model probabilities.

Type synonym: Probability = Float


Dist

Probability distributions. Distributions are abstract and can only be created using the functions provided by this library, e.g., enum and uniform. Internally, Curry's built-in non-determinism is used to model distributions with more than one event-probability pair.

Constructors:


RT

Run-time choice values. Currently, the only way to construct a run-time choice value is to explicitly use a lambda abstraction. The evaluation of a run-time choice can be triggered by the function pick.

Type synonym: RT a = () -> a


Exported operations:

enum :: [a] -> [Float] -> Dist a   

Creates a distribution based on a given list of events and another list providing the corresponding probabilities. This function also ensures that the relevant probabilities add up to 1.0 and are strictly positive.

uniform :: [a] -> Dist a   

Creates a uniform distribution based on a given list of events. The list of events must be non-empty.

certainly :: a -> Dist a   

Creates a single-event-distribution with probability 1.0.

Further infos:
  • solution complete, i.e., able to compute all solutions

(>>>=) :: Dist a -> (a -> Dist b) -> Dist b   

Combines two (dependent) distributions.

Further infos:
  • defined as left-associative infix operator with precedence 1

joinWith :: (a -> b -> c) -> Dist a -> Dist b -> Dist c   

Combines two (independent) distributions with respect to a given function.

(??) :: (a -> Bool) -> Dist a -> Float   

Queries a distribution for the probabilitiy of events that satisfy a given predicate.

Further infos:
  • defined as right-associative infix operator with precedence 1

pick :: (() -> a) -> a   

Triggers the evaluation of a run-time choice value (see type synonym RT). Everytime a run-time choice value is evaluated, a new choice is made.

replicateDist :: Int -> (() -> Dist a) -> Dist [a]   

Independently replicates a distribution a given number of times. In order to behave properly, the given distribution is required to be a run-time choice value (see type synonym RT).