Raw

Lecture 4. Boolean algebra — basics

4.1 Overview

This lecture builds the algebraic foundation for the digital‑logic part of the course. We start from the everyday notion of a statement that is either true or false, encode the two truth values as 11 and 00, and study how statements combine through a small set of logical operations.

The central object is Boolean algebra: the two‑element set {0,1}\{0,1\} with negation (¬\neg), conjunction (\wedge) and disjunction (\vee), plus the derived operations exclusive‑or (\oplus), implication (\to) and equivalence (\leftrightarrow). Every operation is completely described by a truth table; a function of nn Boolean variables is nothing more than a truth table; and these functions obey a compact list of laws — commutativity, associativity, distributivity, De Morgan’s laws, and more. Physical realisation (logic gates), systematic simplification (canonical forms, Karnaugh maps) and the deductive side (propositional logic) come in later lectures; here we stay with the algebra, which — as the final sections show — is literally the same structure you met in set algebra (Lecture 2) and will meet again in propositional logic (Lecture 6).

Why should we care?

Boolean algebra is the mathematics of decisions and yes/no information, and it sits underneath almost everything a computer does.

  • Hardware. A wire in a digital circuit is either at a high voltage or a low voltage — two states, exactly the alphabet {1,0}\{1,0\}. A logic gate computes a Boolean operation on its input wires. An adder, a multiplexer, the control unit of a processor — all are Boolean functions realised in silicon. Claude Shannon’s 1937 master’s thesis showed that the algebra Boole invented to formalise reasoning is precisely the algebra of switching circuits, and modern chip design still rests on that identification.
  • Software. Every if, while, and ? : in a program is steered by a Boolean expression. The short‑circuit operators && and ||, the bitwise operators & | ~ ^, and the conditions in database queries and search engines (“cats AND (black OR white) NOT kittens”) are Boolean algebra in disguise.
  • Reasoning. The same laws let us decide when two conditions are equivalent (so one can safely replace the other), when a condition can never be satisfied (a bug — dead code), and when one always holds (a redundant test).

The pay‑off of this lecture is a small toolkit — a dozen laws and one principle (duality) — that lets you transform, simplify and reason about such expressions with the confidence of ordinary algebra.

Roadmap

We proceed from statements to their symbolic encoding; define the elementary operations by truth tables; count how many Boolean functions of nn variables exist (the answer, 22n2^{2^n}, is proved); introduce tautologies, contradictions and logical equivalence; state the laws and prove every one of them by truth table; state and justify the duality principle; show how identities are also derived algebraically; and finally explain in what precise sense logic, sets and bits are three faces of one structure. A short historical note and a list of exercises close the chapter.

4.2 Statements (propositions) and truth values

A statement (or proposition) is a declarative sentence that is either true or false, but not both. Being a statement has nothing to do with our knowing which of the two it is — only with the sentence being definitely one or the other.

Examples and non‑examples.

  • “Today is Sunday.” — a statement (true or false depending on the day).
  • 2+2=42 + 2 = 4.” — a statement (true).
  • “There are infinitely many twin primes.” — a statement: it is definitely true or definitely false, even though (as of today) nobody knows which. Having a truth value does not require us to know it.
  • x<0x < 0.” — this is a predicate (open sentence): it becomes a statement only once xx is fixed. Predicates with variables and quantifiers are the subject of predicate logic, not of this lecture.
  • “How are you?” — not a statement; a question has no truth value.
  • “Close the door.” — not a statement; a command has no truth value.
  • “This sentence is false.” — not a statement; assuming it true makes it false and vice versa, so it can be assigned neither value consistently (the liar paradox).

We attach a symbolic truth value to every statement:

true=1=T,false=0=F.\text{true} = 1 = T, \qquad \text{false} = 0 = F.

Working with the digits 00 and 11 (rather than the words) is exactly what turns logic into an algebra: truth values become quantities we can compute with, and logical connectives become operations like ++ and ×\times.

Remark. Some authors write T/FT/F, some /\top/\bot, some 1/01/0. This course uses 11 and 00 almost everywhere, because it makes the bridge to arithmetic and hardware immediate: conjunction will behave exactly like multiplication of bits, and disjunction almost like addition.

Compound statements

Simple statements are usually named by letters p,q,r,p, q, r, \dots and combined into compound statements using connectives. Let

  • pp = “Today is Friday”,
  • qq = “The weather is good”.

Then:

Compound statement Reads as
pqp \wedge q “Today is Friday and the weather is good”
pqp \vee q “Today is Friday or the weather is good”
¬p\neg p “Today is not Friday”
¬pq\neg p \wedge q “Today is not Friday and the weather is good”

The truth value of a compound statement depends only on the truth values of its parts and on the connectives used — never on the meaning of the words. This property is called truth‑functionality, and it is the whole point of moving to Boolean algebra: once the parts’ truth values are fixed, the compound’s value is determined by pure calculation.

4.3 Elementary logical operations

The alphabet of Boolean algebra is just the two symbols {0,1}\{0, 1\}. On top of it we define the operations below. Each operation is defined by a truth table that lists its output for every combination of inputs. We list input rows in ascending binary order (00,01,10,1100, 01, 10, 11); other authors use a different row order, but the operation is the same.

Negation (NOT, ¬\neg)

Negation flips the truth value: ¬p\neg p is true exactly when pp is false. Common notations: ¬p\neg p, p\sim p, !p!p, pˉ\bar p, pp'. Negation is a unary operation (one input); all the others below are binary (two inputs).

pp ¬p\neg p
0 1
1 0

Conjunction (AND, \wedge)

Conjunction pqp \wedge q is true exactly when both operands are true. Notations: pqp \wedge q, pqp \cdot q, pqpq. Comparing the table below with a multiplication table for 0/10/1 shows they are identical: pq=pqp \wedge q = p \cdot q. This is why conjunction is often written as a product.

pp qq pqp \wedge q
0 0 0
0 1 0
1 0 0
1 1 1

Disjunction (OR, \vee)

Disjunction pqp \vee q is true when at least one operand is true (this is the inclusive or). Notations: pqp \vee q, p+qp + q. It behaves like addition of bits except that 11=11 \vee 1 = 1 (not 22): disjunction is “saturating” addition capped at 11.

pp qq pqp \vee q
0 0 0
0 1 1
1 0 1
1 1 1

Common pitfall. Everyday English “or” is often exclusive (“soup or salad” means one, not both), but the logical \vee is inclusive: 11=11 \vee 1 = 1. The exclusive reading is a different operation, XOR, defined next.

Exclusive‑or (XOR, \oplus)

Exclusive‑or pqp \oplus q is true when the operands differ — exactly one of them is true. It is the “or, but not both” of everyday speech, and also “the operands are unequal”, so pq=1p \oplus q = 1 iff pqp \neq q. It behaves like addition modulo 2: pq=(p+q)mod2p \oplus q = (p + q) \bmod 2.

pp qq pqp \oplus q
0 0 0
0 1 1
1 0 1
1 1 0

Because \oplus is addition mod 2 it has a clean algebra: pp=0p\oplus p=0, p0=pp\oplus 0=p, p1=pp\oplus 1=\overline p; it is commutative and associative; and \wedge distributes over it, p(qr)=(pq)(pr)p\wedge(q\oplus r)=(p\wedge q)\oplus(p\wedge r). This makes ({0,1},,)(\{0,1\},\oplus,\wedge) a field, and is the basis of the algebraic normal form (Lecture 5) and of parity/checksum circuits.

Implication (IF … THEN …, \to)

Implication pqp \to q (“if pp then qq”) is false in only one case: a true premise pp leading to a false conclusion qq. In particular, whenever pp is false the implication is vacuously true — a false premise never breaks a promise. Here pp is the antecedent (hypothesis) and qq the consequent (conclusion). Notations: pqp \to q, pqp \Rightarrow q, pqp \supset q.

pp qq pqp \to q
0 0 1
0 1 1
1 0 0
1 1 1

Think of pqp \to q as the promise “if pp happens, then I guarantee qq”. The promise is broken only if pp happens and qq fails to — the single 101 \to 0 row.

Common pitfall. Implication is not symmetric: pqp \to q and qpq \to p are different functions (compare their columns). And ¬(pq)\neg(p\to q) is not p¬qp \to \neg q; the correct negation is ¬(pq)=p¬q\neg(p \to q) = p \wedge \neg q (the promise is broken exactly when the premise holds but the conclusion fails). Also, \to carries no idea of cause: “If 2+2=52+2=5 then the moon is cheese” is true, because the premise is false.

Equivalence (IF AND ONLY IF, \leftrightarrow)

Equivalence pqp \leftrightarrow q (also written pqp \equiv q or pqp \odot q) is true when both operands have the same truth value. It is exactly the negation of XOR: pq=¬(pq)p \leftrightarrow q = \neg(p \oplus q), i.e. pq=1p \leftrightarrow q = 1 iff p=qp = q.

pp qq pqp \leftrightarrow q
0 0 1
0 1 0
1 0 0
1 1 1

All binary operations at a glance

Putting the two‑variable operations side by side makes their patterns easy to compare:

pp qq pqp \wedge q pqp \vee q pqp \oplus q pqp \to q pqp \leftrightarrow q
0 0 0 0 0 1 1
0 1 0 1 1 1 0
1 0 0 1 1 0 0
1 1 1 1 0 1 1

The five binary connectives side by side — conjunction, disjunction, exclusive-or, implication, and biconditional — one truth-table column each

Only three of these operations are primitive; the rest are abbreviations. We will prove below (and again in Lecture 5) that \oplus, \to and \leftrightarrow can each be rewritten with ¬\neg, \wedge, \vee alone. Two identities worth memorising now, because they are used constantly, are

pq  =  ¬pq,pq  =  (pq)(qp).p \to q \;=\; \neg p \vee q, \qquad p \leftrightarrow q \;=\; (p \to q)\wedge(q \to p).

The first is verified in the worked examples below.

4.4 Precedence and reading compound expressions

To avoid a thicket of parentheses we adopt the standard precedence (binding strength), from tightest to loosest:

¬    >        >        >        >    .\neg \;\;>\;\; \wedge \;\;>\;\; \vee \;\;>\;\; \to \;\;>\;\; \leftrightarrow .

Thus ¬pq\neg p \wedge q means (¬p)q(\neg p) \wedge q, and pqrp \wedge q \vee r means (pq)r(p \wedge q) \vee r, and pqrp \vee q \to r means (pq)r(p \vee q) \to r. Negation applies to the smallest expression to its right; \wedge binds like multiplication and \vee like addition. When in doubt, parenthesise: clarity beats brevity.

Common pitfall. ¬pq\neg p \wedge q is (¬p)q(\neg p)\wedge q, not ¬(pq)\neg(p \wedge q) — the bar/¬ does not stretch over the \wedge unless you write it that way. In the notation pq\overline{p}\,q vs pq\overline{pq} the difference is visible; in linear text it is a frequent source of error.

4.5 Boolean variables and Boolean functions

A Boolean variable is a variable that ranges over {0,1}\{0, 1\}. A Boolean function of nn variables is any rule

f:{0,1}n{0,1}f : \{0,1\}^n \longrightarrow \{0,1\}

that assigns a value 00 or 11 to each of the 2n2^n possible input combinations. Here {0,1}n\{0,1\}^n is the set of all nn‑tuples (input vectors) (x1,,xn)(x_1, \dots, x_n) of bits.

A truth table is the function. Because the domain {0,1}n\{0,1\}^n is finite, a Boolean function is fully specified simply by listing its output on every input row. Two Boolean expressions denote the same function precisely when their truth tables agree in every row. This is the single most important tool of the chapter:

To prove that two Boolean expressions are equal, build both truth tables and check that the final columns are identical, row by row. To disprove equality, it is enough to exhibit one row where they differ (a counterexample).

Counting Boolean functions

How many different Boolean functions of nn variables are there? The answer is surprisingly large and grows doubly exponentially.

Theorem (number of Boolean functions). The number of Boolean functions of nn variables is

N(n)  =  22n.N(n) \;=\; 2^{\,2^{\,n}}.

The number of Boolean functions grows doubly exponentially:  functions for  variables

Proof. We count in two stages.

Stage 1 — the number of input rows. An input is an nn‑tuple (x1,,xn)(x_1, \dots, x_n) with each xi{0,1}x_i \in \{0,1\}. By the multiplication (product) rule there are 22 independent choices for each of the nn coordinates, so

{0,1}n  =  222n  =  2n|\{0,1\}^n| \;=\; \underbrace{2 \cdot 2 \cdots 2}_{n} \;=\; 2^{\,n}

distinct input rows. Call this number m=2nm = 2^n.

Stage 2 — the number of ways to fill the output column. A function ff is determined exactly by the value ff assigns to each of the mm input rows, and these values may be chosen independently: any of the 2m2^m output columns of length mm (each entry 00 or 11) determines a genuine function, and different columns determine different functions (they differ on some row). Again by the product rule there are

222m  =  2m\underbrace{2 \cdot 2 \cdots 2}_{m} \;=\; 2^{\,m}

such columns. Substituting m=2nm = 2^n gives N(n)=22nN(n) = 2^{\,2^{\,n}}. \blacksquare

The two‑stage structure — first count the rows 2n2^n, then count the fillings 2(rows)2^{(\text{rows})} — is the reason the exponent is itself an exponential.

nn rows 2n2^n functions 22n2^{2^n}
0 1 2
1 2 4
2 4 16
3 8 256
4 16 65 536
5 32 4 294 967 296

The growth is ferocious: already at n=6n = 6 there are 2641.8×10192^{64} \approx 1.8 \times 10^{19} functions, more than the number of grains of sand on Earth. This explosion is exactly why systematic simplification methods (Lecture 5) are needed — one cannot search all functions by hand.

The case n=0n = 0. A function of no variables has the single empty input tuple ()() as its only “row” (20=12^0 = 1 row), and there are 220=21=22^{2^0} = 2^1 = 2 such functions: the constant 00 and the constant 11. This matches the two truth values and is a good sanity check on the formula.

Example — the 4 functions of one variable. For n=1n = 1 the theorem gives 221=42^{2^1} = 4:

pp 0\mathbf{0} pp ¬p\neg p 1\mathbf{1}
0 0 0 1 1
1 0 1 0 1

They are: the constant 00, the identity pp, the negation ¬p\neg p, and the constant 11. There are literally no others — every possible two‑row output column appears.

Example — the 16 functions of two variables. With n=2n = 2 there are exactly 24=162^{4} = 16 functions F0,,F15F_0, \dots, F_{15}. Reading each column top‑to‑bottom over the input rows (x,y)=00,01,10,11(x,y) = 00, 01, 10, 11 gives its truth table (and the subscript kk is the binary number spelled by that column, MSB at the top):

xx yy F0F_0 F1F_1 F2F_2 F3F_3 F4F_4 F5F_5 F6F_6 F7F_7 F8F_8 F9F_9 F10F_{10} F11F_{11} F12F_{12} F13F_{13} F14F_{14} F15F_{15}
0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1
0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1
1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

Several of these columns are the operations we already named:

  • F0=0F_0 = 0 (constant false), F15=1F_{15} = 1 (constant true);
  • F1=xyF_1 = x \wedge y (AND), F7=xyF_7 = x \vee y (OR);
  • F3=xF_3 = x, F5=yF_5 = y, F12=¬xF_{12} = \neg x, F10=¬yF_{10} = \neg y (projections and their negations);
  • F6=xyF_6 = x \oplus y (XOR), F9=xyF_9 = x \leftrightarrow y (equivalence);
  • F13=xyF_{13} = x \to y, F11=yxF_{11} = y \to x (implications);
  • F8=¬(xy)F_8 = \neg(x \vee y) (NOR), F14=¬(xy)F_{14} = \neg(x \wedge y) (NAND).

The important takeaway is not the individual names but the count: every possible two‑variable truth table appears exactly once, and there are 1616 of them — no more, no fewer. (The exhaustive named list of these sixteen, and how NAND or NOR alone can generate them all, is taken up in Lecture 5.)

4.6 Truth tables of compound expressions

Any compound expression is evaluated column by column: introduce a helper column for each sub‑expression, fill it from the operator’s truth table, and combine helper columns until the final column is reached. With nn variables the table has 2n2^n rows. List the rows in ascending binary order so that nothing is skipped.

Example 1 (easy) — evaluate ¬(¬p)\neg(\neg p). Two rows suffice, and the result recovers pp:

pp ¬p\neg p ¬(¬p)\neg(\neg p)
0 1 0
1 0 1

The final column equals the pp column: ¬¬p=p\neg\neg p = p. (This is the involution law, proved formally below.)

Example 2 (easy) — evaluate (pq)¬r(p \wedge q) \vee \neg r. Three variables give 23=82^3 = 8 rows. Build pqp \wedge q, then ¬r\neg r, then their disjunction:

pp qq rr pqp \wedge q ¬r\neg r (pq)¬r(p \wedge q) \vee \neg r
0 0 0 0 1 1
0 0 1 0 0 0
0 1 0 0 1 1
0 1 1 0 0 0
1 0 0 0 1 1
1 0 1 0 0 0
1 1 0 1 1 1
1 1 1 1 0 1

The last column is the function computed by the expression; it equals 11 on five of the eight rows.

Example 3 (medium) — “exactly one of p,qp, q”: evaluate (pq)¬(pq)(p \vee q) \wedge \neg(p \wedge q).

pp qq pqp \vee q pqp \wedge q ¬(pq)\neg(p \wedge q) (pq)¬(pq)(p \vee q) \wedge \neg(p \wedge q)
0 0 0 0 1 0
0 1 1 0 1 1
1 0 1 0 1 1
1 1 1 1 0 0

The final column reads 0,1,1,00, 1, 1, 0 — exactly the XOR table. So we have derived the identity pq=(pq)¬(pq)p \oplus q = (p \vee q) \wedge \neg(p \wedge q), showing that XOR is not a new primitive but a combination of \wedge, \vee and ¬\neg.

Example 4 (medium) — pqp \to q equals ¬pq\neg p \vee q. This rewriting of implication in terms of the three primitives is used everywhere; here is its proof.

pp qq pqp \to q ¬p\neg p ¬pq\neg p \vee q
0 0 1 1 1
0 1 1 1 1
1 0 0 0 0
1 1 1 0 1

The columns for pqp \to q and ¬pq\neg p \vee q are identical, so pq=¬pqp \to q = \neg p \vee q.

Example 5 (harder) — the hypothetical syllogism is a tautology. We show that ((pq)(qr))(pr)\bigl((p \to q) \wedge (q \to r)\bigr) \to (p \to r) is true in every row — the formal content of “if pp implies qq and qq implies rr, then pp implies rr”.

pp qq rr pqp \to q qrq \to r (pq)(qr)(p\to q)\wedge(q\to r) prp \to r whole formula
0 0 0 1 1 1 1 1
0 0 1 1 1 1 1 1
0 1 0 1 0 0 1 1
0 1 1 1 1 1 1 1
1 0 0 0 1 0 0 1
1 0 1 0 1 0 1 1
1 1 0 1 0 0 0 1
1 1 1 1 1 1 1 1

The final column is all $1$s, so the formula is a tautology. Notice the mechanism: on every row where the hypothesis (pq)(qr)(p\to q)\wedge(q\to r) is 11 (rows 000,001,011,111000, 001, 011, 111), the conclusion prp\to r is also 11; on the remaining rows the hypothesis is 00, so the outer implication is vacuously 11.

4.7 Tautologies, contradictions, and logical equivalence

A tautology is an expression whose value is 11 for every assignment of its variables — the final truth‑table column is all $1$s. A contradiction (or unsatisfiable expression) is an expression whose value is 00 for every assignment — the final column is all $0$s. An expression that is 11 on at least one row is called satisfiable; one that is 11 on some rows and 00 on others is a contingency.

Example — the tautology p¬pp \vee \neg p (the law of excluded middle):

pp ¬p\neg p p¬pp \vee \neg p
0 1 1
1 0 1

Example — the contradiction p¬pp \wedge \neg p (the law of non‑contradiction):

pp ¬p\neg p p¬pp \wedge \neg p
0 1 0
1 0 0

These two facts, p¬p=1p \vee \neg p = 1 and p¬p=0p \wedge \neg p = 0, are the complement laws and appear among the axioms below.

Logical equivalence. Two expressions AA and BB are logically equivalent, written ABA \equiv B, when they have the same truth value in every row — equivalently, when the biconditional ABA \leftrightarrow B is a tautology. This is the precise meaning of the “==” sign in every Boolean identity: A=BA = B is ABA \equiv B. So the whole next section is a catalogue of logical equivalences, each certified by a truth table.

Remark. Satisfiability — “is there an assignment making this expression 11?” — is the celebrated SAT problem, the first problem proved NP‑complete (Cook, 1971). A truth table settles it in 2n2^n rows, but for large nn that is hopeless, which is why SAT is central to complexity theory. We only need the small‑nn case here.

4.8 The laws (identities) of Boolean algebra

The following identities hold for all Boolean variables. They are written in dual pairs: an AND‑form and an OR‑form.

Law AND‑form (\wedge) OR‑form (\vee)
Commutative pq=qpp \wedge q = q \wedge p pq=qpp \vee q = q \vee p
Associative (pq)r=p(qr)(p \wedge q) \wedge r = p \wedge (q \wedge r) (pq)r=p(qr)(p \vee q) \vee r = p \vee (q \vee r)
Distributive p(qr)=(pq)(pr)p \wedge (q \vee r) = (p \wedge q) \vee (p \wedge r) p(qr)=(pq)(pr)p \vee (q \wedge r) = (p \vee q) \wedge (p \vee r)
Identity p1=pp \wedge 1 = p p0=pp \vee 0 = p
Domination p0=0p \wedge 0 = 0 p1=1p \vee 1 = 1
Idempotent pp=pp \wedge p = p pp=pp \vee p = p
Complement p¬p=0p \wedge \neg p = 0 p¬p=1p \vee \neg p = 1
Absorption p(pq)=pp \wedge (p \vee q) = p p(pq)=pp \vee (p \wedge q) = p
De Morgan ¬(pq)=¬p¬q\neg(p \wedge q) = \neg p \vee \neg q ¬(pq)=¬p¬q\neg(p \vee q) = \neg p \wedge \neg q
Involution ¬(¬p)=p\neg(\neg p) = p (self‑dual)

We now prove each law by the truth‑table method: build both sides and compare final columns. Since A=BA = B means precisely “same value in every row”, a matching pair of columns is a complete proof.

Commutativity

Theorem. pq=qpp \wedge q = q \wedge p and pq=qpp \vee q = q \vee p.

Proof. All four rows for both operations:

pp qq pqp \wedge q qpq \wedge p pqp \vee q qpq \vee p
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 0 1 1
1 1 1 1 1 1

Column pqp\wedge q equals column qpq\wedge p, and column pqp\vee q equals column qpq\vee p, in every row. \blacksquare

Associativity

Theorem. (pq)r=p(qr)(p \wedge q) \wedge r = p \wedge (q \wedge r) and (pq)r=p(qr)(p \vee q) \vee r = p \vee (q \vee r).

Proof. For conjunction:

pp qq rr pqp \wedge q (pq)r(p \wedge q)\wedge r qrq \wedge r p(qr)p \wedge (q \wedge r)
0 0 0 0 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
0 1 1 0 0 1 0
1 0 0 0 0 0 0
1 0 1 0 0 0 0
1 1 0 1 0 0 0
1 1 1 1 1 1 1

The columns (pq)r(p\wedge q)\wedge r and p(qr)p\wedge(q\wedge r) agree (both are 11 exactly when p=q=r=1p=q=r=1). For disjunction:

pp qq rr pqp \vee q (pq)r(p \vee q)\vee r qrq \vee r p(qr)p \vee (q \vee r)
0 0 0 0 0 0 0
0 0 1 0 1 1 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 1 1 0 1
1 0 1 1 1 1 1
1 1 0 1 1 1 1
1 1 1 1 1 1 1

The columns (pq)r(p\vee q)\vee r and p(qr)p\vee(q\vee r) agree (both are 00 exactly when p=q=r=0p=q=r=0). \blacksquare

Remark. Associativity is what lets us write pqrp \wedge q \wedge r and pqrp \vee q \vee r without parentheses at all: the grouping does not affect the value. Together with commutativity it means a long AND (resp. OR) is just “are all inputs 11?” (resp. “is at least one input 11?”), regardless of order or grouping.

Distributivity

Theorem. p(qr)=(pq)(pr)p \wedge (q \vee r) = (p \wedge q) \vee (p \wedge r) and p(qr)=(pq)(pr)p \vee (q \wedge r) = (p \vee q) \wedge (p \vee r).

Proof. First form (\wedge over \vee):

pp qq rr qrq \vee r p(qr)p \wedge (q \vee r) pqp \wedge q prp \wedge r (pq)(pr)(p \wedge q) \vee (p \wedge r)
0 0 0 0 0 0 0 0
0 0 1 1 0 0 0 0
0 1 0 1 0 0 0 0
0 1 1 1 0 0 0 0
1 0 0 0 0 0 0 0
1 0 1 1 1 0 1 1
1 1 0 1 1 1 0 1
1 1 1 1 1 1 1 1

The columns p(qr)p \wedge (q \vee r) and (pq)(pr)(p \wedge q) \vee (p \wedge r) coincide. Second form (\vee over \wedge):

pp qq rr qrq \wedge r p(qr)p \vee (q \wedge r) pqp \vee q prp \vee r (pq)(pr)(p \vee q) \wedge (p \vee r)
0 0 0 0 0 0 0 0
0 0 1 0 0 0 1 0
0 1 0 0 0 1 0 0
0 1 1 1 1 1 1 1
1 0 0 0 1 1 1 1
1 0 1 0 1 1 1 1
1 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1

The columns p(qr)p \vee (q \wedge r) and (pq)(pr)(p \vee q) \wedge (p \vee r) coincide. \blacksquare

Remark. The first form mimics ordinary arithmetic (a(b+c)=ab+aca(b+c) = ab + ac). The second form, p(qr)=(pq)(pr)p \vee (q \wedge r) = (p \vee q)\wedge(p \vee r), has no analogue in ordinary arithmetic — a+bc(a+b)(a+c)a + bc \neq (a+b)(a+c) in general — and is a hallmark of Boolean algebra. In Boolean algebra, \vee and \wedge distribute over each other, perfectly symmetrically.

Identity and domination

Theorem. p1=pp \wedge 1 = p,  p0=p\ p \vee 0 = p (identity);  p0=0\ p \wedge 0 = 0,  p1=1\ p \vee 1 = 1 (domination).

Proof. Here 00 and 11 are constants, so only the two values of pp matter:

pp p1p \wedge 1 p0p \vee 0 p0p \wedge 0 p1p \vee 1
0 0 0 0 1
1 1 1 0 1

Columns p1p\wedge 1 and p0p\vee 0 equal the pp column; column p0p\wedge 0 is constantly 00; column p1p\vee 1 is constantly 11. \blacksquare

The identity law says 11 is the neutral element for \wedge and 00 is the neutral element for \vee (compare a×1=aa \times 1 = a and a+0=aa + 0 = a). Domination says 00 annihilates under \wedge (like a×0=0a \times 0 = 0) and 11 annihilates under \vee.

Idempotence

Theorem. pp=pp \wedge p = p and pp=pp \vee p = p.

Proof.

pp ppp \wedge p ppp \vee p
0 0 0
1 1 1

Both columns equal pp. \blacksquare

Remark. Idempotence is where Boolean algebra departs sharply from arithmetic: p+p=pp + p = p and pp=pp \cdot p = p hold for all Boolean values, whereas a+a=2aa + a = 2a and a2a^2 are usually different from aa. Consequently repeated terms collapse — ppp=pp \vee p \vee p = p — which is the first tool of simplification.

Complement

Theorem. p¬p=0p \wedge \neg p = 0 and p¬p=1p \vee \neg p = 1.

Proof.

pp ¬p\neg p p¬pp \wedge \neg p p¬pp \vee \neg p
0 1 0 1
1 0 0 1

Column p¬pp\wedge\neg p is constantly 00; column p¬pp\vee\neg p is constantly 11. \blacksquare

These are exactly the contradiction and the tautology met earlier: a value and its negation can never both hold, and one of them always holds.

Involution

Theorem. ¬(¬p)=p\neg(\neg p) = p.

Proof.

pp ¬p\neg p ¬(¬p)\neg(\neg p)
0 1 0
1 0 1

The column ¬¬p\neg\neg p equals the pp column. \blacksquare

Involution is self‑dual: swapping \wedge \leftrightarrow \vee and 010 \leftrightarrow 1 leaves it unchanged, since it mentions neither.

Absorption

Theorem. p(pq)=pp \wedge (p \vee q) = p and p(pq)=pp \vee (p \wedge q) = p.

Proof. First form:

pp qq pqp \vee q p(pq)p \wedge (p \vee q)
0 0 0 0
0 1 1 0
1 0 1 1
1 1 1 1

Column p(pq)p\wedge(p\vee q) equals the pp column. Second form:

pp qq pqp \wedge q p(pq)p \vee (p \wedge q)
0 0 0 0
0 1 0 0
1 0 0 1
1 1 1 1

Column p(pq)p\vee(p\wedge q) equals the pp column. \blacksquare

Remark. “Absorption” names the phenomenon that the qq term is swallowed whole: whatever qq is, it makes no difference. Circuit designers love absorption because it deletes an entire gate. An algebraic derivation (not a truth table) is given in the next section.

De Morgan’s laws

Theorem (De Morgan). ¬(pq)=¬p¬q\neg(p \wedge q) = \neg p \vee \neg q and ¬(pq)=¬p¬q\neg(p \vee q) = \neg p \wedge \neg q.

De Morgan's first law checked by truth table: the columns for  and  agree on every row

Proof. First law:

pp qq pqp \wedge q ¬(pq)\neg(p \wedge q) ¬p\neg p ¬q\neg q ¬p¬q\neg p \vee \neg q
0 0 0 1 1 1 1
0 1 0 1 1 0 1
1 0 0 1 0 1 1
1 1 1 0 0 0 0

The columns ¬(pq)\neg(p \wedge q) and ¬p¬q\neg p \vee \neg q are equal in every row. Second law:

pp qq pqp \vee q ¬(pq)\neg(p \vee q) ¬p\neg p ¬q\neg q ¬p¬q\neg p \wedge \neg q
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0

The columns ¬(pq)\neg(p \vee q) and ¬p¬q\neg p \wedge \neg q are equal in every row. \blacksquare

Common pitfall. De Morgan’s laws say the negation flips the connective: ¬(pq)\neg(p\wedge q) is ¬p¬q\neg p \vee \neg q, not ¬p¬q\neg p \wedge \neg q. “Not (rich and famous)” means “poor or obscure”, not “poor and obscure”. Distributing a negation across \wedge/\vee without switching the connective is the single most common error in this subject. In hardware terms: NOT of an AND is an OR of NOTs (a NAND rearranges into an OR gate with inverted inputs), and dually for NOR.

De Morgan’s laws also show that {,¬}\{\wedge, \neg\} and {,¬}\{\vee, \neg\} each suffice to express the other connective: pq=¬(¬p¬q)p \vee q = \neg(\neg p \wedge \neg q) and pq=¬(¬p¬q)p \wedge q = \neg(\neg p \vee \neg q). This idea of a functionally complete set of operations is developed fully in Lecture 5.

4.9 The duality principle

Look again at the table of laws: the two columns are mirror images. Swap \wedge \leftrightarrow \vee and 010 \leftrightarrow 1 throughout, and every left‑hand identity becomes the right‑hand one. This is no coincidence.

The dual of an expression. Given a Boolean expression EE built from variables, the constants 0,10, 1, and the operations ¬,,\neg, \wedge, \vee, its dual EdE^{d} is obtained by interchanging \wedge \leftrightarrow \vee and 010 \leftrightarrow 1 everywhere, while leaving variables and negations untouched. For instance the dual of p(q0)p \wedge (q \vee 0) is p(q1)p \vee (q \wedge 1).

Duality Principle. If an identity E1=E2E_1 = E_2 holds for all Boolean values, then the dual identity E1d=E2dE_1^{d} = E_2^{d} also holds.

The practical consequence is that the laws come in pairs for free: prove one form and its dual is automatically a theorem. This halves the work of building and memorising the theory. But why is it true? The justification rests on De Morgan and involution.

Lemma (complementation is dualization with negated inputs). For every Boolean expression E(x1,,xn)E(x_1, \dots, x_n) built from ¬,,\neg, \wedge, \vee and constants,

¬E(x1,,xn)  =  Ed(¬x1,,¬xn)\neg\, E(x_1, \dots, x_n) \;=\; E^{d}(\neg x_1, \dots, \neg x_n)

as functions.

Proof. By structural induction on the way EE is built.

Base cases.

  • E=xiE = x_i (a variable). Then Ed=xiE^{d} = x_i, so Ed(¬x)=¬xi=¬EE^{d}(\neg x) = \neg x_i = \neg E. ✓
  • E=0E = 0. Then Ed=1E^{d} = 1, and ¬E=¬0=1=Ed(¬x)\neg E = \neg 0 = 1 = E^{d}(\neg x). ✓
  • E=1E = 1. Then Ed=0E^{d} = 0, and ¬E=¬1=0=Ed(¬x)\neg E = \neg 1 = 0 = E^{d}(\neg x). ✓

Inductive step. Assume the claim for sub‑expressions A,BA, B.

  • E=ABE = A \wedge B. Then Ed=AdBdE^{d} = A^{d} \vee B^{d}, and

¬E=¬(AB)=De M.¬A¬B=IHAd(¬x)Bd(¬x)=(AdBd)(¬x)=Ed(¬x).\neg E = \neg(A \wedge B) \overset{\text{De M.}}{=} \neg A \vee \neg B \overset{\text{IH}}{=} A^{d}(\neg x) \vee B^{d}(\neg x) = (A^{d}\vee B^{d})(\neg x) = E^{d}(\neg x). \checkmark

  • E=ABE = A \vee B. Dually, Ed=AdBdE^{d} = A^{d}\wedge B^{d} and ¬E=¬(AB)=¬A¬B=Ad(¬x)Bd(¬x)=Ed(¬x)\neg E = \neg(A\vee B) = \neg A \wedge \neg B = A^{d}(\neg x)\wedge B^{d}(\neg x) = E^{d}(\neg x). ✓
  • E=¬AE = \neg A. Negation is unchanged by dualization, so Ed=¬(Ad)E^{d} = \neg(A^{d}), and

¬E=¬(¬A)=invol.A,Ed(¬x)=¬(Ad(¬x))=IH¬(¬A)=A.\neg E = \neg(\neg A) \overset{\text{invol.}}{=} A, \qquad E^{d}(\neg x) = \neg\bigl(A^{d}(\neg x)\bigr) \overset{\text{IH}}{=} \neg(\neg A) = A.

So ¬E=Ed(¬x)\neg E = E^{d}(\neg x). ✓

By induction the identity holds for every expression EE. \blacksquare

Proof of the Duality Principle. Suppose E1=E2E_1 = E_2 holds for all inputs. Then ¬E1=¬E2\neg E_1 = \neg E_2 holds for all inputs as well. By the Lemma,

E1d(¬x1,,¬xn)=E2d(¬x1,,¬xn)for all (x1,,xn).E_1^{d}(\neg x_1, \dots, \neg x_n) = E_2^{d}(\neg x_1, \dots, \neg x_n) \quad\text{for all } (x_1,\dots,x_n).

As (x1,,xn)(x_1,\dots,x_n) ranges over all of {0,1}n\{0,1\}^n, the negated tuple (¬x1,,¬xn)(\neg x_1, \dots, \neg x_n) also ranges over all of {0,1}n\{0,1\}^n (negation is a bijection of {0,1}\{0,1\}). Hence E1d(y1,,yn)=E2d(y1,,yn)E_1^{d}(y_1,\dots,y_n) = E_2^{d}(y_1,\dots,y_n) for all (y1,,yn)(y_1,\dots,y_n), i.e. E1d=E2dE_1^{d} = E_2^{d}. \blacksquare

Example. The distributive law p(qr)=(pq)(pr)p \wedge (q \vee r) = (p \wedge q) \vee (p \wedge r) has dual p(qr)=(pq)(pr)p \vee (q \wedge r) = (p \vee q) \wedge (p \vee r) — the second distributive law, which we no longer need to prove separately. Likewise absorption p(pq)=pp\wedge(p\vee q)=p dualizes to p(pq)=pp\vee(p\wedge q)=p, and the two De Morgan laws are duals of each other.

Common pitfall. The dual is not the negation. To dualize you swap \wedge\leftrightarrow\vee and 010\leftrightarrow1 but leave the variables and their bars alone. Negating an expression is a different operation (and, by the Lemma above, equals the dual only after you also negate every variable).

4.10 Proving identities algebraically

Truth tables always work, but for expressions with many variables they are long. Once the laws are established, we can also prove new identities algebraically — by rewriting one side into the other using the laws as rewrite rules. This is exactly how one simplifies circuits (Lecture 5), and it is the style of proof used in propositional logic (Lecture 6).

Example — absorption derived from the axioms. We prove p(pq)=pp \vee (p \wedge q) = p using only identity, distributivity and domination:

p(pq)=(p1)(pq)(identity: p=p1)=p(1q)(distributive, factor out p)=p1(domination: 1q=1)=p.(identity)\begin{aligned} p \vee (p \wedge q) &= (p \wedge 1) \vee (p \wedge q) && \text{(identity: } p = p\wedge 1)\\ &= p \wedge (1 \vee q) && \text{(distributive, factor out } p)\\ &= p \wedge 1 && \text{(domination: } 1 \vee q = 1)\\ &= p. && \text{(identity)} \end{aligned}

By the duality principle, dualizing every step proves the other absorption law p(pq)=pp \wedge (p \vee q) = p at once — no separate calculation required.

Example — simplify ¬(¬pq)(pq)\neg(\neg p \wedge q) \wedge (p \vee q).

¬(¬pq)(pq)=(¬¬p¬q)(pq)(De Morgan)=(p¬q)(pq)(involution)=p(¬qq)(distributive, factor out p)=p0(complement)=p.(identity)\begin{aligned} \neg(\neg p \wedge q) \wedge (p \vee q) &= (\neg\neg p \vee \neg q) \wedge (p \vee q) && \text{(De Morgan)}\\ &= (p \vee \neg q) \wedge (p \vee q) && \text{(involution)}\\ &= p \vee (\neg q \wedge q) && \text{(distributive, factor out } p)\\ &= p \vee 0 && \text{(complement)}\\ &= p. && \text{(identity)} \end{aligned}

A four‑operator expression collapses to the single variable pp. Verifying this by truth table would take four rows; the algebra explains why it holds.

Algebraic simplification of  down to , each step justified by a named law: De Morgan, involution, distributive, complement, identity

Remark. An algebraic proof and a truth‑table proof establish the same fact but serve different purposes. The truth table is a decision procedure — it always terminates with a yes/no. The algebraic derivation gives insight and structure, and it scales to symbolic settings where truth tables do not (e.g. reasoning about circuits with hundreds of inputs, where 2n2^{n} rows is out of reach).

4.11 Three faces of one structure: logic, sets, and bits

The laws we proved are not special to truth values. The same list of laws governs the algebra of sets (Lecture 2) and the algebra of propositions (Lecture 6). This is because all three are instances of one abstract structure — a Boolean algebra — and we can line the three up operation for operation.

Logic, sets, and bits are one structure: $edge/ap/ee/up/eg//$NOT, with  at the bottom and  at the top

Concept Propositional logic Set algebra Boolean (bit) algebra
“or” pqp \vee q ABA \cup B aba \vee b
“and” pqp \wedge q ABA \cap B aba \wedge b
“not” ¬p\neg p A\overline{A} ¬a\neg a
bottom / empty FF (contradiction) \varnothing 00
top / universe TT (tautology) UU 11
“same” pqp \equiv q A=BA = B a=ba = b
“at most” pqp \to q ABA \subseteq B aba \le b

Every law reads identically down any column. For example, De Morgan appears as

¬(pq)=¬p¬q,AB=AB,¬(ab)=¬a¬b,\neg(p \wedge q) = \neg p \vee \neg q, \qquad \overline{A \cap B} = \overline{A} \cup \overline{B}, \qquad \neg(a \wedge b) = \neg a \vee \neg b,

and absorption, distributivity, complement, and the rest all match line for line. This is why a fact proved in one setting transfers to the others; the membership table you used for sets in Lecture 2 is the same computation as the truth table you use here.

A genuine isomorphism (sets \leftrightarrow bit vectors). The correspondence between sets and bits can be made completely precise. Fix a universe UU. To each subset AUA \subseteq U associate its characteristic (indicator) function

χA:U{0,1},χA(x)={1xA,0xA.\chi_A : U \to \{0,1\}, \qquad \chi_A(x) = \begin{cases} 1 & x \in A,\\ 0 & x \notin A. \end{cases}

The map AχAA \mapsto \chi_A is a bijection between the power set P(U)\mathcal{P}(U) and the set {0,1}U\{0,1\}^{U} of all bit‑valued functions on UU (both have 2U2^{|U|} elements, and the map is clearly one‑to‑one and onto). Moreover it respects every operation, computed pointwise:

χAB=χAχB,χAB=χAχB,χA=¬χA,χ=0,χU=1.\chi_{A \cap B} = \chi_A \wedge \chi_B, \quad \chi_{A \cup B} = \chi_A \vee \chi_B, \quad \chi_{\overline A} = \neg\,\chi_A, \quad \chi_{\varnothing} = 0, \quad \chi_{U} = 1.

A structure‑preserving bijection like this is called an isomorphism: set algebra on P(U)\mathcal{P}(U) is, up to renaming, the coordinatewise Boolean algebra {0,1}U\{0,1\}^{U}. In the smallest case U=1|U| = 1 we get P(U){0,1}\mathcal{P}(U) \cong \{0,1\} exactly — the two‑element bit algebra of this lecture, with 0\varnothing \leftrightarrow 0 and U1U \leftrightarrow 1.

And propositional logic. On the logic side, formulas modulo logical equivalence (grouping together all formulas with the same truth table) form a Boolean algebra too, with ,,¬\wedge, \vee, \neg as operations, the class of contradictions as 00, and the class of tautologies as 11. So the three “faces” are:

  • bits {0,1}\{0,1\} under ,,¬\wedge, \vee, \neg — the hardware/arithmetic view;
  • subsets of a universe under ,,  \cap, \cup, \overline{\ \cdot\ } — the set view;
  • propositions (up to equivalence) under and/or/not — the reasoning view.

They obey the same laws because they are the same algebra wearing three costumes. This is the deep reason the Venn‑diagram intuition from Lecture 2 and the truth tables of this lecture never conflict.

4.12 A note on history: Boole and Shannon

The algebra of this chapter is named for George Boole (1815–1864), a largely self‑taught English mathematician. In The Mathematical Analysis of Logic (1847) and the fuller An Investigation of the Laws of Thought (1854), Boole argued that the laws of correct reasoning could be written as algebraic equations over quantities taking the values 00 and 11 — turning logic, for the first time, into calculation. The idempotent law x2=xx^2 = x (our pp=pp \wedge p = p) was, in Boole’s own treatment, the equation that singled out this special algebra from ordinary algebra.

The bridge to computing came much later. In his 1937 MIT master’s thesis, A Symbolic Analysis of Relay and Switching Circuits, Claude Shannon (1916–2001) observed that a network of on/off switches obeys exactly Boole’s laws — a switch is 00 or 11, series wiring is \wedge, parallel wiring is \vee — so any switching circuit can be designed and simplified algebraically. That single insight is the theoretical foundation of all digital hardware. It is often called one of the most influential master’s theses ever written.

4.13 Connections to computer science and hardware

Boolean algebra is the working mathematics of the machine layer. A few threads we will pick up or that you already use:

  • Logic gates. The primitive operations ¬,,\neg, \wedge, \vee (and the derived NAND, NOR, XOR) are realised as physical gates; a Boolean expression becomes a circuit and vice versa. Lecture 5 builds gates, translates expressions to circuits, and shows how NAND or NOR alone can implement everything.
  • Minimization. Because there are 22n2^{2^n} functions but many expressions for each, we want the smallest expression (fewest gates). The laws above — especially absorption, distributivity and idempotence — are the algebraic tools; canonical normal forms (CDNF/CCNF) and Karnaugh maps are the systematic ones, both in Lecture 5.
  • Bitwise operations. In C/Java/Python the operators &, |, ~, ^ apply ,,¬,\wedge, \vee, \neg, \oplus to all bits of an integer in parallel — Boolean algebra on 3232 or 6464 independent copies at once. Masks, flags and toggles are De Morgan and complement in action.
  • Control flow and short‑circuiting. && and || evaluate left‑to‑right and stop early; their algebra is exactly \wedge and \vee, and refactoring a condition safely (e.g. !(a && b) into !a || !b) is De Morgan.
  • Search and databases. Query languages combine conditions with AND/OR/NOT; query optimisation rewrites them using these very laws.
  • Deductive logic. The tautologies and equivalences here become the propositional equivalences of Lecture 6 (propositional logic) and the rules of inference of Lecture 7 (proof techniques) — for instance, the hypothetical syllogism proved above.

Chapter summary

  • A statement is a declarative sentence that is definitely true or false; we encode the values as 11 (true) and 00 (false). Compound statements are truth‑functional: their value depends only on the parts’ values and the connectives.
  • Boolean algebra works over the alphabet {0,1}\{0, 1\} with the primitive operations ¬,,\neg, \wedge, \vee and the derived operations ,,\oplus, \to, \leftrightarrow; each is defined by a truth table. Standard precedence is ¬>>>>\neg > \wedge > \vee > \to > \leftrightarrow.
  • \wedge is true only when both inputs are 11; \vee (inclusive) is true when at least one is 11; \oplus is true when the inputs differ; pqp \to q is false only for p=1,q=0p=1, q=0; pqp \leftrightarrow q is true when the inputs match. Key rewrites: pq=¬pqp\to q = \neg p \vee q and pq=(p¬q)(¬pq)p \oplus q = (p\wedge\neg q)\vee(\neg p\wedge q).
  • A Boolean function of nn variables is exactly a truth table with 2n2^n rows; there are 22n2^{2^n} such functions (22 for n=0n=0, 44 for n=1n=1, 1616 for n=2n=2, 256256 for n=3n=3) — proved by counting rows then fillings.
  • A tautology is always 11; a contradiction is always 00; expressions A,BA, B are logically equivalent (ABA \equiv B) when their columns match, which is what a Boolean identity A=BA = B means. Compound expressions are evaluated column by column.
  • The laws (commutative, associative, distributive, identity, domination, idempotent, complement, absorption, involution, De Morgan) come in dual pairs and were each proved by truth table. Identities can also be derived algebraically from the laws.
  • The Duality Principle — swap \wedge\leftrightarrow\vee and 010\leftrightarrow1 — turns any true identity into another true identity; it is justified via the lemma ¬E(x)=Ed(¬x)\neg E(x) = E^{d}(\neg x), proved by structural induction from De Morgan and involution.
  • Logic, sets and bits are one structure. \vee\leftrightarrow\cup, \wedge\leftrightarrow\cap, ¬\neg\leftrightarrow complement, 00\leftrightarrow \varnothing, 1U1\leftrightarrow U; the characteristic‑function map AχAA \mapsto \chi_A is a genuine isomorphism P(U){0,1}U\mathcal{P}(U)\cong\{0,1\}^{U}, so every law transfers among the three.
  • Forward pointers: gates, functional completeness, canonical forms and Karnaugh maps in Lecture 5; the semantics of propositional logic in Lecture 6; proof and inference in Lecture 7.

Exercises

Warm‑up

  1. Statement or not? Classify each sentence as a statement (proposition) or not, and if it is a statement give its truth value where possible: (a) “1717 is prime.” (b) “Read Lecture 4.” (c) “x2=4x^2 = 4.” (d) “Every even number greater than 22 is a sum of two primes.” (e) “Ouch!”

  2. Fill the tables. From memory, write the truth tables of ¬p\neg p, pqp \wedge q, pqp \vee q, pqp \oplus q, pqp \to q, pqp \leftrightarrow q. State in one phrase what makes each operation output 11.

  3. Evaluate at a point. With p=1p = 1, q=0q = 0, r=1r = 1, compute the value of (pq)¬r(p \vee q) \wedge \neg r and of p(q¬r)p \to (q \vee \neg r).

  4. Precedence. Insert full parentheses according to the standard precedence: (a) ¬pqr\neg p \wedge q \vee r (b) pq¬rp \vee q \to \neg r (c) ¬¬pq\neg\neg p \wedge q.

  5. When is it false? State the single row on which pqp \to q is 00, and explain in words why pqp \to q is 11 whenever p=0p = 0.

  6. Dictionary. Give the set‑algebra counterpart and the propositional‑logic counterpart of each of \wedge, \vee, ¬\neg, 00, 11.

Standard

  1. Build a table. Construct the full truth table of (p¬q)r(p \vee \neg q) \wedge r and state on how many of the 88 rows it equals 11.

  2. Implication rewrite. Prove pq¬pqp \to q \equiv \neg p \vee q by truth table, then use it to write ¬(pq)\neg(p \to q) in terms of \wedge and ¬\neg only.

  3. Contrapositive. Prove by truth table that pq¬q¬pp \to q \equiv \neg q \to \neg p. (This equivalence is the basis of proof by contraposition, Lecture 7.)

  4. Second De Morgan. Prove ¬(pq)=¬p¬q\neg(p \vee q) = \neg p \wedge \neg q by constructing and comparing truth tables.

  5. Both absorptions. Verify p(pq)=pp \vee (p \wedge q) = p by truth table, then give a purely algebraic derivation of p(pq)=pp \wedge (p \vee q) = p from the laws.

  6. XOR in primitives. Show pq=(p¬q)(¬pq)p \oplus q = (p \wedge \neg q) \vee (\neg p \wedge q) by truth table.

  7. Classify. For each formula decide whether it is a tautology, a contradiction, or a contingency, and justify with its final column: (a) p(qp)p \to (q \to p) (b) (p¬p)q(p \wedge \neg p) \to q (c) p¬pp \leftrightarrow \neg p (d) (pq)p¬q(p \to q) \wedge p \wedge \neg q.

  8. Duals. Write the dual of each identity (do not negate): (a) p(qr)=(pq)(pr)p \wedge (q \vee r) = (p \wedge q) \vee (p \wedge r) (b) p1=1p \vee 1 = 1 (c) p(pq)=pp \wedge (p \vee q) = p.

  9. Counting. How many Boolean functions are there of 33 variables? Of 55 variables? Of the 1616 two‑variable functions, how many are commutative (satisfy f(x,y)=f(y,x)f(x,y) = f(y,x))? Justify the last count.

  10. Simplify algebraically. Using the laws, simplify (pq)(p¬q)(p \wedge q) \vee (p \wedge \neg q) and  (pq)(¬pq)\ (p \vee q) \wedge (\neg p \vee q) to a single variable each. Name every law you use.

Challenge

  1. Hypothetical syllogism. Prove that ((pq)(qr))(pr)\bigl((p \to q) \wedge (q \to r)\bigr) \to (p \to r) is a tautology, and identify which rows make the outer implication vacuously true.

  2. Duality by hand. For the specific expression E=p(¬q0)E = p \wedge (\neg q \vee 0), write down EdE^{d}, and verify the lemma ¬E=Ed(¬p,¬q)\neg E = E^{d}(\neg p, \neg q) by an 44‑row truth table.

  3. Self‑dual functions. A Boolean function ff is self‑dual if f=fdf = f^{d}, equivalently f(¬x1,,¬xn)=¬f(x1,,xn)f(\neg x_1, \dots, \neg x_n) = \neg f(x_1, \dots, x_n) for all inputs. How many self‑dual functions of 22 variables are there? (Hint: pair each input with its bitwise complement.) List one non‑trivial example.

  4. Isomorphism check. Let U={1,2,3}U = \{1, 2, 3\}, A={1,2}A = \{1, 2\}, B={2,3}B = \{2, 3\}. Write the characteristic vectors χA,χB{0,1}3\chi_A, \chi_B \in \{0,1\}^3 (order the coordinates 1,2,31, 2, 3). Compute χAχB\chi_A \wedge \chi_B, χAχB\chi_A \vee \chi_B and ¬χA\neg \chi_A coordinatewise, and confirm they are the characteristic vectors of ABA \cap B, ABA \cup B and A\overline{A} respectively.

Selected answers & hints

1. (a) statement, true. (b) not a statement (command). (c) open sentence — a statement only once xx is fixed. (d) statement (Goldbach’s conjecture): it has a definite truth value even though it is currently unknown. (e) not a statement (exclamation).

3. (pq)¬r=(10)¬1=10=0(p\vee q)\wedge\neg r = (1\vee 0)\wedge\neg 1 = 1 \wedge 0 = 0.  p(q¬r)=1(00)=10=0\ p\to(q\vee\neg r) = 1 \to (0 \vee 0) = 1 \to 0 = 0.

4. (a) ((¬p)q)r((\neg p)\wedge q)\vee r. (b) (pq)(¬r)(p\vee q)\to(\neg r). (c) (¬(¬p))q(\neg(\neg p))\wedge q.

5. False only on the row p=1,q=0p=1, q=0. When p=0p=0 the promise “if pp then qq” is never triggered, so it cannot be broken — the implication is vacuously 11.

7. The column of (p¬q)r(p\vee\neg q)\wedge r is 11 on exactly 33 of the 88 rows — those with r=1r=1 and (p¬q)=1(p\vee\neg q)=1, namely (p,q,r)=(0,0,1),(1,0,1),(1,1,1)(p,q,r) = (0,0,1),(1,0,1),(1,1,1).

8. The two columns match (see Example 4). Then ¬(pq)=¬(¬pq)=¬¬p¬q=p¬q\neg(p\to q) = \neg(\neg p \vee q) = \neg\neg p \wedge \neg q = p \wedge \neg q by De Morgan and involution.

9. Both columns equal 1,1,0,11,1,0,1 over the rows 00,01,10,1100,01,10,11; hence equivalent.

11. Table for p(pq)p\vee(p\wedge q) reads 0,0,1,1=p0,0,1,1 = p. Algebraic derivation of the dual: p(pq)=(p0)(pq)=p(0q)=p0=pp\wedge(p\vee q) = (p\vee 0)\wedge(p\vee q) = p \vee (0\wedge q) = p \vee 0 = p (identity, distributive, domination, identity) — or simply dualize the derivation in the text.

13. (a) tautology; (b) tautology (a contradiction implies anything); (c) contradiction; (d) contradiction (it asserts pqp\to q together with pp and ¬q\neg q, which is impossible).

14. (a) p(qr)=(pq)(pr)p \vee (q \wedge r) = (p \vee q) \wedge (p \vee r). (b) p0=0p \wedge 0 = 0. (c) p(pq)=pp \vee (p \wedge q) = p.

15. 33 variables: 223=28=2562^{2^3} = 2^8 = 256. 55 variables: 225=232=42949672962^{2^5} = 2^{32} = 4\,294\,967\,296. Commutative two‑variable functions: the outputs on rows 0101 and 1010 must be equal, so we freely choose the output on row 0000 (22 ways), on the merged 01=1001{=}10 (22 ways) and on row 1111 (22 ways): 23=82^3 = 8.

16. (pq)(p¬q)=p(q¬q)=p1=p(p\wedge q)\vee(p\wedge\neg q) = p\wedge(q\vee\neg q) = p\wedge 1 = p (distributive, complement, identity). (pq)(¬pq)=q(p¬p)=q0=q(p\vee q)\wedge(\neg p\vee q) = q\vee(p\wedge\neg p) = q\vee 0 = q (dual distributive, complement, identity).

17. See the worked 88‑row table in the text; the final column is all $1$s. The outer implication is vacuously true on exactly the rows where the hypothesis (pq)(qr)(p\to q)\wedge(q\to r) is 00, namely (p,q,r)=010,100,101,110(p,q,r) = 010, 100, 101, 110.

18. E=p(¬q0)=p¬qE = p \wedge (\neg q \vee 0) = p \wedge \neg q, with column 0,0,1,00,0,1,0 over pq=00,01,10,11pq = 00,01,10,11, so ¬E\neg E has column 1,1,0,11,1,0,1. Dually Ed=p(¬q1)E^{d} = p \vee (\neg q \wedge 1), and Ed(¬p,¬q)=¬p(q1)=¬pqE^{d}(\neg p, \neg q) = \neg p \vee (q \wedge 1) = \neg p \vee q, whose column is also 1,1,0,11,1,0,1. The two columns agree in all four rows, confirming ¬E=Ed(¬p,¬q)\neg E = E^{d}(\neg p, \neg q).

19. 44 self‑dual functions of two variables. The inputs pair up as {00,11}\{00,11\} and {01,10}\{01,10\} under bitwise complement; on each pair the two outputs must be complementary, leaving 22 pairs × 2\times\ 2 choices =22=4= 2^2 = 4. Example: the projection f(x,y)=xf(x,y) = x is self‑dual.

20. χA=(1,1,0)\chi_A = (1,1,0), χB=(0,1,1)\chi_B = (0,1,1). Then χAχB=(0,1,0)=χAB\chi_A\wedge\chi_B = (0,1,0) = \chi_{A\cap B} with AB={2}A\cap B = \{2\}; χAχB=(1,1,1)=χAB\chi_A\vee\chi_B = (1,1,1) = \chi_{A\cup B} with AB={1,2,3}=UA\cup B = \{1,2,3\} = U; ¬χA=(0,0,1)=χA\neg\chi_A = (0,0,1) = \chi_{\overline A} with A={3}\overline A = \{3\}. All three match, illustrating the isomorphism.

Further reading

  • K. H. Rosen, Discrete Mathematics and Its Applications — the chapter on logic and logical equivalences (propositional logic, laws, tautologies) and the chapter on Boolean algebra (Boolean functions, identities, duality, gates).
  • S. S. Epp, Discrete Mathematics with Applications — the chapter on the logic of compound statements (truth tables, logical equivalence, De Morgan’s laws) and the section on Boolean algebras and digital logic circuits.
  • Historical primary sources: G. Boole, An Investigation of the Laws of Thought (1854); C. E. Shannon, “A Symbolic Analysis of Relay and Switching Circuits” (1938).

Lectures/CDM-L04.md · 53.2 KB · updated 2026-08-01 20:55