The idempotent laws: A ∪ A = A and A ∩ A = A¶
Level: 101 · one law of the algebra of sets, on its own page
One line: Doing it twice is doing it once: a set joined or met with itself is itself, which numbers under + and × do not do, and which is the reason sets have no "2A".
The law¶
| Sets | Logic | Python |
|---|---|---|
| A ∪ A = A, A ∩ A = A | p ∨ p = p, p ∧ p = p | a | a == a and a & a == a |
Why it is true¶
"x ∈ A or x ∈ A" and "x ∈ A and x ∈ A" each say "x ∈ A". A repeated member is not a second member, which is extensionality again: {1, 1} = {1}. 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¶
Idempotence is what makes a set operation safe to repeat: a database UNION applied twice, a set.update run twice, a tag added twice, all leave one copy. Numbers fail it (a + a = 2a), and so do multisets, where [2] + [2] = [2, 2]; max and min on numbers pass it, which is why max and min behave like ∪ and ∩.
What the program prints¶
Verified output of law_idempotent.py — regenerated by tools/run_examples.py, never hand-typed.
1. THE LAW: A ∪ A = A, A ∩ 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} = A
A ∩ A = {1, 2} = A
3. THE SAME LAW IN LOGIC: p ∨ p = p, p ∧ p = p
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 F F
Po polsku, w skrócie¶
Prawa idempotentności: suma i przekrój zbioru z samym sobą to ten sam zbiór, bo powtórzony element to nie drugi element. Liczby tego nie mają (a + a = 2a), max i min mają.
Auf Deutsch: Stichwörter¶
Idempotenzgesetze: A ∪ A = A und A ∩ A = A.
Stichwörter: Idempotenz, Vereinigung, Schnitt, keine Wiederholung in Mengen.
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