Set Complements and the Universe

The complement of a set contains all elements of a declared universe outside the set. Changing the universe changes the answer.

Source
Anbloq
Language
English
Created
Updated
Chapters
4
Reading time
1 min
In this article4 chapters
  1. Trace eligibility
  2. Check future values
  3. Recalculate one complement after changing the universe
  4. Check how out-of-universe values are represented

Trace eligibility

If the only known zones are east, west, and north, and east is permitted, the complement is west and north. Adding south to the universe enlarges the complement. This is set difference with the universe on the left.

Check future values

A check saying “not east” in code may also accept a misspelling. First validate membership in the known zones or define intentional behavior for new ones. See exhaustive decisions.[1]

Recalculate one complement after changing the universe

If \(U=\{1,2,3,4,5\}\) and \(A=\{2,4\}\), the complement is \(\{1,3,5\}\). Declaring \(U'=\{0,1,2,3,4,5\}\) adds zero to the complement without changing A. Define an eligibility universe before interpreting categories like “every item not selected.” See set difference.

In U:  A and U\A partition {1,2,3,4,5}
In U′: A and U′\A partition {0,1,2,3,4,5}
Taking the complement twice within one universe restores A

Check how out-of-universe values are represented

A filter over a catalogue should tell an unknown ID apart from a known unselected one. When combining complements in Boolean algebra, keep the same universe in every term and test a boundary value from it.

References

  1. Eric Lehman, F. Thomson Leighton and Albert R. Meyer, Mathematics for Computer Science ↩