from functools import reduce


def compare(*dpools):
    """
    Compare a group of pools on the values they can produce and their probabilities. Returns a
    dictionary from numbers to a list of numbers. The keys are the values that the pools together
    can produce, and the values are the probabilities that the pools will produce those values, in
    the same order as the input.
    """
    values = sorted(reduce(lambda p1, p2: p1.values.union(p2.values), dpools))
    return {val: [pool.prob(val) for pool in dpools] for val in values}