Probabilistic Programs: Contextuality and Relational Database Theory

[6] have introduced a contextual probability theory called Contextuality-by-Default (C-b-D) which is based on three principles. The first of these principles states that each random variable should be automatically labeled by all condition under which it is recorded. The aim of this article is to relate this principle to block structured computer programming languages where variables are declared local to a construct called a “scope”. In this way a variable declared in two scopes can be safely overloaded meaning that they can have the same label but preserve two distinct identities without the need for the modeller to label each variable in each condition as advocated by C-b-D. A core issue addressed is how to construct a single probabilistic model from the various interim probability distributions returned by each syntactic scope. For this purpose, a probabilistic variant of the natural join operator of relational algebra is used to “glue” together interim distributions into a single distribution. The semantics of this join operator are related to contextual semantics [1].