Skip to main content

random_set_of_subsets

Function random_set_of_subsets 

Source
pub fn random_set_of_subsets(
    k: &Value,
    n: &Value,
    set: &Value,
    ctx: Ctx,
    src: &mut dyn RandomSource,
) -> Result<Value, RandomError>
Expand description

RandomSetOfSubsets(k, n, S): k pseudo-random subsets of S, each containing each element of S with probability n / |S|, duplicates removed (tlc2.module.Randomization.RandomSetOfSubsets, SubsetValue.getRandomSetOfSubsets with CoinTossingSubsetEnumerator). Draws k * |S| doubles, in pick order and the normalized order of S.

The result is unnormalized, as in TLC. TLC orders it by a Java HashSet; dive keeps the first occurrence of each subset in pick order. No TLA+ operation observes the difference: the elements are mutually comparable subsets of S, and TLC normalizes before printing, choosing or comparing elementwise.

§Errors

TLC’s TLC_MODULE_ARGUMENT_ERRORs, in TLC’s order of checks.