Probabilistic inference often leads to MapReduce computations of the auspicious form with few distinct cases of mapping. Indeed, we write models that express generic knowledge about elements of the domain, incorporating specific information we happen to have about particular elements.

The problem is how to automatically discover the auspicious form of the mapping function. We would like to write the function as an expression in a general purpose programming language -- the expression that we can evaluate as usual. Our goal is to abstractly interpret the very same expression to find out the particular cases and the default. The problem is trivial for simple loops. It becomes harder if MapReduce computations are nested and the mapping function includes (equality) comparisons of variables of different loops. The problem is really interesting if we want to loop over all subsets of the domain, when the straightforward enumeration becomes intractable even for small domains.

One may regard the switch data structure as a representation of the normal form of a term in the lambda-calculus with many-component sums. Our reification of nested loop bodies is then an instance of normalization-by-evaluation, and a non-trivial application of multi-prompt delimited continuations.

This is joint work with Chung-chieh Shan.