The idea: a row of the table is a region of the diagram

A truth table lists every combination of true (1) and false (0) for the variables of a formula, and the formula's value for each one. With n variables there are 2n rows. A Venn diagram draws n sets A, B, C as overlapping circles inside a universe U. The circles cut U into 2n regions. Read "A = 1" as "the point is inside A". Then each row picks out exactly one region: row A = 1, B = 0 is the region inside A and outside B. The page names each region by the same bits, its code (here 10).

Left: the four rows of a two-variable truth table, 00, 01, 10 and 11. Right: a two-set Venn diagram with the four regions labelled 00 outside both circles, 01 only in B, 10 only in A and 11 in the overlap; each row has the same colour as its region
Four rows, four regions: each row of the table is one region of the diagram.

So a formula and a set are two views of the same thing. The set for a formula is the union of the regions whose row gives 1. On the canvas, each row turns orange in the table and in the diagram. When the result column gets its value, the region turns blue (1, in the set) or grey (0, not in the set). Press Next Row to go one row at a time, or Fill Table to do them all.

The dictionary: ∧ ∩, ∨ ∪, ¬ complement

logicsetstrue in which regions
A ∧ B (AND)A ∩ B (intersection)11 only
A ∨ B (OR)A ∪ B (union)01, 10, 11
¬A (NOT)Ac = U − A (complement)00, 01
A ⊕ B (XOR)A △ B (symmetric difference)01, 10
A → B (implies)Ac ∪ B00, 01, 11
1 (always true)Uevery region
0 (always false)∅none

AND is 1 only when both inputs are 1, so only the overlap is shaded (Demo: A ∧ B ↔ A ∩ B). OR is 1 when at least one input is 1, so everything inside either circle is shaded (Demo: A ∨ B ↔ A ∪ B). NOT flips every value, so it shades exactly what A leaves out. XOR is 1 when the inputs differ: the two crescents without the overlap (Demo: XOR).

Implication

A → B ("if A then B") is false in one row only: A = 1 and B = 0. A promise "if it rains, I take an umbrella" is broken only when it rains and there is no umbrella. When A is false the implication is true whatever B is ("vacuously true"). In the diagram that leaves one region unshaded, 10, the part of A outside B. Everything else is shaded, so A → B = ¬A ∨ B, the set Ac ∪ B (Demo: A → B). If A → B holds for every point, region 10 is empty, which is exactly A ⊆ B.

Proving De Morgan's law two ways

Two formulas are equivalent when they give the same value in every row. Since the rows are all the cases, comparing the two result columns is a complete proof. In the diagram, the same columns mean the same shaded regions. De Morgan's law says ¬(A ∧ B) = ¬A ∨ ¬B: "not both" is the same as "at least one is missing". The demo builds ¬(A ∧ B) through the helper column A ∧ B and builds ¬A ∨ ¬B from ¬A and ¬B. Both result columns read 1, 1, 1, 0, and both diagrams shade everything except the overlap: (A ∩ B)c = Ac ∪ Bc (Demo: De Morgan).

Two Venn diagrams side by side. Left: the complement of A intersect B, everything shaded except the overlap. Right: complement of A union complement of B, built from the two complements, with the same shading. Under them the two truth table columns read 1, 1, 1, 0 for rows 00, 01, 10, 11
Same column, same shading: (A ∩ B)c and Ac ∪ Bc are the same set.

The twin law ¬(A ∨ B) = ¬A ∧ ¬B, or (A ∪ B)c = Ac ∩ Bc, works the same way: both shade only region 00.

Three sets: 8 rows, 8 regions

A third variable doubles both: 8 rows and 8 regions, from 000 (outside all three circles) to 111 (the centre). (A ∧ B) ∨ C shades all of C plus the lens where A and B meet, rows 001, 011, 101, 110 and 111 (Demo: three sets). With four or more sets, circles can no longer show every region, which is one reason truth tables scale better than pictures. A table with n variables still has only 2n rows to check.

lawlogicsets
De Morgan¬(A ∧ B) = ¬A ∨ ¬B(A ∩ B)c = Ac ∪ Bc
distributiveA ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C)A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
absorptionA ∨ (A ∧ B) = AA ∪ (A ∩ B) = A
double negation¬¬A = A(Ac)c = A
excluded middleA ∨ ¬A = 1A ∪ Ac = U

Each law can be checked the same way: fill both columns, or shade both diagrams. These rules are the same Boolean algebra that simplifies circuits of AND, OR and NOT gates; see Combinational Logic for a truth table turned into gates. For counting the 2n rows, see Pascal's Triangle; for regions measured as probabilities, see Bayes' Theorem.

To count the elements of a union instead of shading it, see Inclusion–Exclusion, which adds and subtracts the region tallies until each region is counted once.

In Regex to NFA to DFA each DFA state is a set of NFA states.

To turn a truth table into the shortest AND–OR formula, see Karnaugh Maps.

What the page leaves out

Quantifiers (∀, ∃) and predicate logic, the biconditional A ↔ B (it is ¬(A ⊕ B), the shading of XOR flipped), normal forms (CNF, DNF) and Karnaugh maps, satisfiability and SAT solvers, more than three sets, and the difference between a set and a proposition about one point. The universe here is one fixed rectangle; in set theory it has to be chosen before complements make sense.