The complement laws: A ∪ A′ = U and A ∩ A′ = ∅¶
Level: 101 · one law of the algebra of sets, on its own page
One line: Every member of the universe is in A or out of it, and none is both: the law of the excluded middle and the law of non-contradiction, written for sets.
The law¶
| Sets | Logic | Python |
|---|---|---|
| A ∪ A′ = U, A ∩ A′ = ∅ | p ∨ ¬p = true, p ∧ ¬p = false | a | (U - a) == U and a & (U - a) == set() |
Why it is true¶
For each x in U, "x ∈ A or x ∉ A" is true, since one of the two must hold, and "x ∈ A and x ∉ A" is false, since both cannot. So the union of A with its complement is all of U and the intersection is empty. The complement needs U fixed in advance: A′ means U ∖ A, and the parent page says why. A law of sets is decided one member at a time, so checking it on every subset of a four-element universe, every pattern of membership there is, proves it; the program does that and prints the matching truth table.
Where it is used, and the trap¶
This is the law behind every case split: to prove something for all x, prove it for x ∈ A and for x ∉ A, and the two cases cover everything and overlap nowhere. It is also the one law a fuzzy or three-valued logic gives up, as day or night ↗ shows: twilight is in "day" and in "not day" a little each.
What the program prints¶
Verified output of law_complement.py — regenerated by tools/run_examples.py, never hand-typed.
1. THE LAW: A ∪ A′ = U, A ∩ A′ = ∅
checked on all 16 choices of 1 subset(s) of U = {1, 2, 3, 4}: True
2. ONE INSTANCE, WORKED
A = {1, 2}, B = {2, 3}, C = {3, 4}, A' = {3, 4}, B' = {1, 4}
A ∪ A' = {1, 2, 3, 4} = U
A ∩ A' = ∅ = ∅
3. THE SAME LAW IN LOGIC: p ∨ ¬p = true, p ∧ ¬p = false
every row of the truth table agrees, which is why the member-by-member check is a proof:
p left right
T T T
F T T
Po polsku, w skrócie¶
Prawa dopełnienia: każdy element uniwersum należy do A albo do A′, i żaden do obu; to prawo wyłączonego środka i prawo niesprzeczności zapisane dla zbiorów. Dopełnienie wymaga ustalonego wcześniej U.
Auf Deutsch: Stichwörter¶
Komplementgesetze: A ∪ A′ = U und A ∩ A′ = ∅.
Stichwörter: Komplement, Grundmenge U, leere Menge, Partition in A und A′.
See also¶
- The algebra of sets — all the laws in one table, and the ones that look true and are not
- The laws, one page each — the other nine
- Truth tables and the laws of logic — the same list for ∨, ∧, ¬
- The laws of an operation — what every such list has in common