{'fraction_non_alphanumeric': 0.014164305949008499, 'fraction_numerical': 0.0, 'mean_word_length': 5.147826086956521, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Distributing probability over nondeterminism

We study the combination of probability and nondeterminism from a categorical point of view. In category theory, nondeterminism and probability are represented by suitable monads. Those two monads do not combine well, as they are. To overcome this problem we introduce the notion of indexed valuations. This notion is used to define a new monad that can be combined with the usual nondeterministic monad via a categorical distributive law. We give an equational characterization of our construction. We discuss the computational meaning of indexed valuations, and we show how they can be used by giving a denotational semantics of a simple imperative language.