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.
Input
groups = [{1, 2}, {3, 4}]
sample_space = {1, 2, 3, 4}
Output
True