The law of total probability only holds when the groups form a partition: they must cover the whole sample space and must not overlap.
groups is a list of sets. Return True only if both conditions hold.
An empty group is allowed; it breaks neither rule.
solve([{1,2}, {3,4}], {1,2,3,4}) -> True
solve([{1,2}, {2,3}], {1,2,3}) -> False # overlap
solve([{1,2}], {1,2,3}) -> False # does not cover
Sign in to write and run your own code.
solve(...)