MATH 1101 Discrete Structures · Fall 2026 · Lectures 1–5
Discrete Structures Workbook
Sets, logic and Boolean algebra from Fuad Hajiyev's lecture notes, arranged for study: short notes, worked examples, practice problems that check your answer as you type it, and an answer check for Homework 1.
Readone section of the notes
Solveits practice problems on paper
Checkby typing your answer, or open Hint and Answer
Finishwith the HW1 answer check
HW1Due Monday 19 October 2026, 23:59. Handwritten, scanned to one PDF, uploaded to Blackboard. Each late day costs 0.2 of the 1 point.
The special sequences for x, y, z pass through E = xz + x′y. The orange trace is its truth table, T(E) = 00110101 (Lecture 4–5, Exercise 1.17).
Start here
One algebra, three costumes
Lectures 1–5 study three systems: sets, propositions and logic circuits. Lecture 4–5 shows that they are one structure, a Boolean algebra. A law you learn in one column holds in the others, so this page keeps pointing back to the table below.
Boolean algebra
Sets (L1)
Propositions (L2–3)
Circuits (L4–5)
a + b
A ∪ B
p ∨ q
OR gate
ab
A ∩ B
p ∧ q
AND gate
a′
A′
¬p
NOT gate
0
∅
F
0 (low)
1
U
T
1 (high)
The laws, side by side
Law
Boolean algebra
Sets (Table 1)
Propositions (Table 14)
Idempotent
a + a = a aa = a
A ∪ A = A A ∩ A = A
p ∨ p ≡ p p ∧ p ≡ p
Associative
(a + b) + c = a + (b + c) (ab)c = a(bc)
(A ∪ B) ∪ C = A ∪ (B ∪ C) (A ∩ B) ∩ C = A ∩ (B ∩ C)
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
Commutative
a + b = b + a ab = ba
A ∪ B = B ∪ A A ∩ B = B ∩ A
p ∨ q ≡ q ∨ p p ∧ q ≡ q ∧ p
Distributive
a + bc = (a + b)(a + c) a(b + c) = ab + ac
A ∪ (B ∩ C) = (A ∪ B) ∩ (A ∪ C) A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C)
Each row is a law together with its dual: swap + with · and 0 with 1 (for sets, ∪ with ∩ and U with ∅; for logic, ∨ with ∧ and T with F). The principle of duality says the dual of a law is again a law. On a phone, the buttons above the table switch the notation.
Using the answer boxes
Typing symbols
You never need a special keyboard. Each answer box has buttons for the symbols it uses, and every box also accepts the plain-keyboard version in this table.
Symbol
Type this
Example
′ complement
' (apostrophe)
x'y + (xz)'
¬ not
~ or !
~p | q
∧ ∩ · and
& or *, or write the letters side by side
p & q, xy
∨ ∪ + or
| or +
p | q, A + B
⊕ exclusive or
^
p ^ q
→ implies
->
p -> q
↔ if and only if
<->
p <-> q
∖ set difference
\ or -
A \ B
∅ empty set
{} or the word empty in a set box; 0 inside an expression
{}
U universal set
U (in the Venn tool)
U \ A
T, F true, false
T and F, or 1 and 0
p | T
Spaces do not matter, and a leading E = or Y = is ignored. For sets of numbers, type the elements with commas: {1, 2, 3}. On paper (HW1 is handwritten) just draw the symbols as in the notes.
Lecture 1
Sets and functions
Every other structure in the course is built on sets. This chapter covers how to describe sets, how functions connect them, the set operations and their laws, and (Part 4) how to compare the sizes of infinite sets.
1.1Sets and how to describe them
Definition
A set is an unordered collection of objects, its elements. Write a ∈ A when a is an element of A, and a ∉ A when it is not.
Two ways
Listing
A = {2, 3, −1, 0, 15}
Set-builder
B = {x | x is an odd integer, x > 0} = {1, 3, 5, …}. Read the bar as “such that” and the comma as “and”.
Key fact
Order and repetition never matter: {x | x² − 3x + 2 = 0} = {2, 1} = {1, 2, 2, 1} (Example 1).
Number sets
ℕ = ℤ⁺ = {1, 2, 3, …} (in this course ℕ starts at 1), ℤ the integers, ℚ the rationals, ℝ the reals, ℂ the complex numbers, and ℤ⁺ ⊂ ℤ ⊂ ℚ ⊂ ℝ ⊂ ℂ.
ℚ is the set of fractions p/q with p ∈ ℤ, q ∈ ℕ; as decimals, exactly the finite or repeating ones.
The irrational numbers ℝ ∖ ℚ (for example √2, √3) are the non-repeating decimals.
ℂ is the set of pairs (a, b) with (a, b) + (c, d) = (a + c, b + d) and (a, b)(c, d) = (ac − bd, ad + bc). A real number a is the pair (a, 0).
Example
Write 0.6(7) = 0.6777… as a fraction.
0.6777… = 6/10 + (7/100 + 7/1000 + …). The bracket is a geometric series with first term a₁ = 7/100 and ratio r = 1/10, so it sums to a₁/(1 − r) = (7/100)/(9/10) = 7/90. Total: 54/90 + 7/90 = 61/90.
Definition
Subset:A ⊆ B when every element of A is in B. If some element of A is not in B, write A ⊈ B.
Equality:A = B exactly when A ⊆ B and B ⊆ A. This is the standard way to prove two sets are equal.
Proper subset:A ⊂ B means A ⊆ B and A ≠ B.
Theorems 1–2
A ⊆ A; if A ⊆ B and B ⊆ A then A = B; if A ⊆ B and B ⊆ C then A ⊆ C. For every set, ∅ ⊆ A ⊆ U, where U is the universal set and ∅ the (only) empty set.
Watch out
∅ and {∅} are different. ∅ has no elements; {∅} is a singleton whose one element is ∅. Think of an empty folder versus a folder that holds one empty folder. So ∅ ∈ {∅} and ∅ ⊆ {∅} are both true, while {∅} ⊆ ∅ is false.
More terms
Disjoint
no common elements; {1, 2} and {4, 5, 6} are disjoint.
Class of sets
a set whose elements are sets (also called a collection or family); a subclass is a subset of it.
Finite / infinite
finite sets have a definite number of elements; removing 1, 2, 3, … elements from an infinite set always leaves elements.
Power set
P(S), the class of all subsets of S, including ∅ and S.
Statement 1
If S has n elements, then P(S) has 2ⁿ elements: each element of S is either in a subset or out of it. That is why P(S) is also written 2S.
A functionf: X → Y assigns to every x ∈ X exactly one f(x) ∈ Y. X is the domain and Y the codomain. The image (range) is f(X) = {f(x) | x ∈ X}. For y ∈ Y the preimage is f⁻¹(y) = {x ∈ X | f(x) = y}; it is empty exactly when y ∉ f(X).
injective and surjective (a one-to-one correspondence)
exactly one element
How to prove
Injective: assume f(x₁) = f(x₂) and derive x₁ = x₂. To disprove, find x₁ ≠ x₂ with the same image.
Surjective: take any y ∈ Y and find an x with f(x) = y. To disprove, find a y that nothing maps to.
Examples 4–6
tan: (−π/2, π/2) → ℝ is a bijection: every horizontal line meets the graph exactly once.
sin: ℝ → ℝ is neither: sin 0 = sin π, and nothing maps to 2.
sin: ℝ → [−1, 1] is onto. Whether a function is onto depends on the codomain.
Composition
For f: X → Y and g: Y → Z, (g∘f)(x) = g(f(x)). The identity is idX(x) = x. A function is a bijection exactly when it has an inverseg: Y → X with g∘f = idX and f∘g = idY. An injective f has an inverse f⁻¹: f(X) → X defined on its image.
Products
The Cartesian product is X₁ × … × Xₙ = {(x₁, …, xₙ) | xᵢ ∈ Xᵢ}. Example: {1, 2, 3} × {a, b} = {(1, a), (1, b), (2, a), (2, b), (3, a), (3, b)}, and [0, 1] × [0, 1] is the unit square.
A relation from X to Y is any subset of X × Y. A function is a relation in which every x appears in exactly one pair (x, y); that set of pairs is its graph. A function X × … × X → X with n factors is an n-ary operation on X (unary, binary, ternary for n = 1, 2, 3).
Example 8
Division with remainder. For a ∈ ℤ and m ∈ ℕ there are unique q, r with a = qm + r and 0 ≤ r < m. So 13 = 4·3 + 1 and −13 = (−5)·3 + 2: the remainder is never negative.
s ≡ t (mod m) means m divides s − t. All integers are congruent mod 1; mod 2 the two classes are the even and the odd numbers.
Example 12
Floor and ceiling.⌊x⌋ is the greatest integer ≤ x, ⌈x⌉ the least integer ≥ x, and x − ⌊x⌋ the fractional part. ⌊3.14⌋ = 3, ⌊−3.14⌋ = −4, ⌈−3.14⌉ = −3, ⌊√5⌋ = 2; the fractional part of −3.14 is −3.14 − (−4) = 0.86. If x is not an integer, ⌈x⌉ = ⌊x⌋ + 1.
1.3Set operations and Venn diagrams
A ∪ Bin A or B (inclusive)A ∩ Bin A and in BA′ = U ∖ Aeverything outside AA ∖ B = A ∩ B′in A, not in BA ⊕ Bin exactly one of them
Definitions
A ∪ B = {x | x ∈ A or x ∈ B}, A ∩ B = {x | x ∈ A and x ∈ B}, A′ = {x ∈ U | x ∉ A}, B ∖ A = {x | x ∈ B, x ∉ A}, and the symmetric difference A ⊕ B = (A ∖ B) ∪ (B ∖ A) = (A ∪ B) ∖ (A ∩ B) (“union mod 2”). A and B are disjoint when A ∩ B = ∅; then A ∪ B is a disjoint union.
Theorems 3–4
A ∩ B ⊆ A ⊆ A ∪ B. The following are equivalent: A ⊆ B; A ∩ B = A; A ∪ B = B.
Generalized
⋃ᵢ Aᵢ = {x | x ∈ Aᵢ for some i} and ⋂ᵢ Aᵢ = {x | x ∈ Aᵢ for every i}.
Example (Exercise 1.6): let Aₙ = {n, 2n, 3n, …}. Then A₃ ∩ A₅ = A₁₅ and A₄ ∩ A₆ = A₁₂ (multiples of the least common multiple), and ⋃p prime Ap = ℕ ∖ {1}, because every integer from 2 on has a prime factor. If one set in an intersection is empty, the whole intersection is empty.
Theorem 5
Fundamental products. For sets A₁, …, Aₙ, a fundamental product is A₁* ∩ … ∩ Aₙ* where each Aᵢ* is Aᵢ or Aᵢ′. There are 2ⁿ of them, any two are disjoint, and their union is U. For three sets these are the 8 regions of a three-circle Venn diagram; in Lecture 4–5 they return as minterms.
Partitions
A partition of S splits it into nonempty, pairwise disjoint cells whose union is S. With S = {a, b, c, d, e, f, g} (Exercise 1.8): [{a, c, e}, {b}, {d, g}] is not a partition (f is missing), [{a, e, g}, {c, d}, {b, e, f}] is not one (e is in two cells), and [{a, b, e, g}, {c}, {d, f}] is. Any function f: A → B partitions A into the preimages of its values (Example 10).
Example 9
Arguments with Venn diagrams. All my friends are musicians. Akif is my friend. None of my neighbours are musicians. Therefore Akif is not my neighbour. Draw the friends inside the musicians and the neighbours outside the musicians; Akif lies in the friends region, which cannot meet the neighbours. The argument is valid.
1.4Algebra of sets, duality, images
Definition 5
The algebra of sets is a family of subsets of U containing ∅ and U, with the binary operations ∪, ∩ and the unary complement ′. Its laws are the “Sets” column of the laws table (Table 1 in the notes).
Two proof methods
1. Element chasing. Show that x ∈ LHS implies x ∈ RHS, and the converse. De Morgan (10a):
x ∈ (A ∪ B)′ ⟺ x ∉ A ∪ B ⟺ x ∉ A and x ∉ B ⟺ x ∈ A′ and x ∈ B′ ⟺ x ∈ A′ ∩ B′.
2. Algebra. Rewrite with the laws, using X ∖ Y = X ∩ Y′ (Exercise 1.4). Exercise 1.5:
(A ∪ B) ∖ (A ∩ B) = (A ∪ B) ∩ (A ∩ B)′difference
= (A ∪ B) ∩ (A′ ∪ B′)De Morgan
= (A ∩ A′) ∪ (A ∩ B′) ∪ (B ∩ A′) ∪ (B ∩ B′)distributive
= ∅ ∪ (A ∩ B′) ∪ (B ∩ A′) ∪ ∅ = (A ∖ B) ∪ (B ∖ A)complement, identity
Duality
The dual of a set equation swaps ∪ ↔ ∩ and U ↔ ∅. The dual of (U ∩ A) ∪ (B ∩ A) = A is (∅ ∪ A) ∩ (B ∪ A) = A. If an equation is an identity, so is its dual.
Theorems 7–9
For f: X → Y: f⁻¹(A ∪ B) = f⁻¹(A) ∪ f⁻¹(B), f⁻¹(A ∩ B) = f⁻¹(A) ∩ f⁻¹(B), f(A ∪ B) = f(A) ∪ f(B). Prove each by showing LHS ⊆ RHS and RHS ⊆ LHS. Preimages also respect complements: f⁻¹(Y ∖ B) = X ∖ f⁻¹(B) (Exercise 2.8).
Watch out
Images do not respect intersections; only f(A ∩ B) ⊆ f(A) ∩ f(B) holds. The projection (x, y) ↦ (x, 0) sends the disjoint segments {0 ≤ x ≤ 1, y = 0} and {0 ≤ x ≤ 1, y = 1} onto the same segment (Remark 1).
1.5Comparing infinite sets
Part 4 of Lecture 1: optional reading, mandatory for math students. HW1 Task 2 uses it.
Definition 3
X and Y are equivalent, X ~ Y, when there is a bijection X → Y. This relation is reflexive (use id), symmetric (use the inverse) and transitive (compose). Finite sets are equivalent exactly when they have the same number of elements; for infinite sets, counting fails but bijections still work.
Definition 6
A set is countable if it is equivalent to ℤ⁺, that is, its elements can be listed a₁, a₂, a₃, … An infinite set that is not countable is uncountable. All countable sets are equivalent to each other.
Examples 14–17
ℤ is countable: list 0, −1, 1, −2, 2, …, that is n ↦ 2n + 1 for n ≥ 0 and n ↦ 2|n| for n < 0.
The positive even numbers (n ↦ 2n) and the powers of 2 (n ↦ 2ⁿ) are countable.
ℚ is countable: write r = p/q in lowest terms with q > 0 and call |p| + q its height. Each height has finitely many rationals (height 3: −2/1, −1/2, 1/2, 2/1), so list height 1, then height 2, and so on.
These show something impossible for finite sets: an infinite set can be equivalent to a proper subset of itself.
Theorems 10–13
Every subset of a countable set is finite or countable.
A finite or countable union of countable sets is countable: write the sets as rows and count along the diagonals.
Every infinite set M has a countable subset: pick a₁ ∈ M, then a₂ ≠ a₁, then a₃ ∉ {a₁, a₂}, and so on.
Every infinite set is equivalent to one of its proper subsets: take a countable {a₁, a₂, …} ⊆ M, send aₙ ↦ a₂ₙ₋₁, and fix every other element. Then M ~ M ∖ {a₂, a₄, …}.
Theorem 11: the order in which the diagonal count visits the elements.
a₁₁ (1)
a₁₂ (2)
a₁₃ (4)
a₁₄ (7)
…
a₂₁ (3)
a₂₂ (5)
a₂₃ (8)
…
a₃₁ (6)
a₃₂ (9)
…
a₄₁ (10)
…
Theorem 14
Cantor: [0, 1] is uncountable. Take any list r₁, r₂, r₃, … of numbers in [0, 1] and build β = 0.b₁b₂b₃… with bₙ = 2 if the n-th digit of rₙ is 1, and bₙ = 1 otherwise. Then β differs from every rₙ in the n-th digit, so the list misses it. Using only the digits 1 and 2 avoids the problem 0.4999… = 0.5000….
r₁
0.
1
4
1
5
…
r₂
0.
5
0
0
0
…
r₃
0.
3
3
3
3
…
r₄
0.
7
1
8
1
…
β
0.
2
1
1
2
…
Cardinality
|M| = |N| means M ~ N. Countable sets have cardinality ℵ₀ (aleph-null); [0, 1], every interval, ℝ and the plane have the cardinality of the continuum, c. |A| ≤ |B| means there is an injection A → B, and |A| < |B| means there is an injection but no bijection. So ℵ₀ < c.
Cantor–Bernstein (Theorem 16): if |A| ≤ |B| and |B| ≤ |A|, then |A| = |B|.
Cantor (Theorem 15):|P(M)| > |M| for every set M, so there is no largest cardinality. For any f: M → P(M), the set X = {a ∈ M | a ∉ f(a)} is not f(x) for any x.
Continuum hypothesis: no cardinality lies strictly between ℵ₀ and c. Paul Cohen showed in 1963 that the usual axioms cannot decide it.
For HW1
The trick in Theorem 13, shifting a countable subset along to make room, is exactly what Task 2 needs. Practice it first in P1.14.
Quick check
{1, 2, 3} = {3, 2, 1, 1}Order and repetition do not matter.
∅ ∈ ∅∅ has no elements at all.
∅ ⊆ ∅The empty set is a subset of every set, itself included.
If A ⊆ B, then A ∪ B = A.Theorem 4 gives A ∪ B = B and A ∩ B = A.
A ⊕ B = (A ∪ B) ∩ (A ∩ B)′That is (A ∪ B) ∖ (A ∩ B), one of the two definitions of ⊕.
f: ℤ → ℤ, f(n) = 2n is a bijection.It is injective but not onto: no integer maps to an odd number.
|P({1, 2, 3, 4})| = 8A 4-element set has 2⁴ = 16 subsets.
ℝ ~ (0, 1)For example x ↦ tan(π(x − 1/2)) is a bijection (0, 1) → ℝ.
f(A ∩ B) = f(A) ∩ f(B) for every function f.Only ⊆ holds in general (Remark 1).
Every subset of ℚ is finite or countable.ℚ is countable, so Theorem 10 applies.
Practice 1 · Sets and functions
15 problems. Type into the boxes to check, or open the answers.
P1.1
List the elements
{x ∈ ℤ | x² < 10}
{x ∈ ℕ | x divides 12}
{x ∈ ℝ | x² + 1 = 0}
{x ∈ ℕ | 3 < x ≤ 7}
Hint
In (a), x² < 10 means −√10 < x < √10 ≈ 3.16. In (c), x² + 1 ≥ 1 for every real x.
Let f: ℝ → ℝ, f(x) = x², A = [−1, 0], B = [0, 2]. Find f(A), f(B), f(A ∩ B), f(A) ∩ f(B) and f⁻¹([1, 4]). Which remark of the notes does this illustrate?
Answer
f(A) = [0, 1], f(B) = [0, 4], A ∩ B = {0} so f(A ∩ B) = {0}, but f(A) ∩ f(B) = [0, 1]. And f⁻¹([1, 4]) = [−2, −1] ∪ [1, 2].
It illustrates Remark 1: the image of an intersection can be smaller than the intersection of the images.
P1.13
Building bijections
Give a bijection from ℤ⁺ onto the set of all odd integers (positive and negative).
(c) x ↦ 5x; and x ↦ tan(π(x − 1/2)), which maps (0, 1) onto (−π/2, π/2) and then onto ℝ.
P1.14
Making room: [0, 1] ~ [0, 1)
Show that [0, 1] ~ [0, 1). This is the warm-up for HW1 Task 2.
Hint
[0, 1] has one extra point, 1. Find a sequence inside [0, 1] that starts at 1, and shift it one place along.
Solution
Use the countable subset {1, 1/2, 1/3, …}. Define f(1/n) = 1/(n + 1) for n ≥ 1 and f(x) = x for every other x.
So 1 ↦ 1/2, 1/2 ↦ 1/3, … The map is injective (the shift is injective and does not meet the fixed points), and its image is [0, 1): 1 is no longer hit, every 1/(n + 1) is, and every other point is fixed. So f: [0, 1] → [0, 1) is a bijection. This shift along a countable sequence is the idea of Theorem 13.
P1.15
Valid or not? (Venn diagrams)
Decide with a Venn diagram whether the conclusion follows.
All squares are rectangles. No rectangle is a circle. So no square is a circle.Squares lie inside rectangles, which do not meet circles.
All cats are mammals. Some mammals are pets. So some cats are pets.Draw the pets meeting the mammals only outside the cats. The premises hold and the conclusion fails.
Lectures 2–3
Propositions and quantifiers
Logic gives mathematical statements a precise meaning. Part 1 is the algebra of propositions (connectives, truth tables, equivalences). Part 2 adds predicates and the quantifiers ∀ and ∃.
2.1Propositions and connectives
Definition 1
A proposition is a declarative sentence that is either true (T) or false (F), but not both. “Baku is the capital of Azerbaijan” is true; “2 + 2 = 3” is false. Not propositions: questions (“What time is it?”), commands (“Do your homework.”), and open sentences such as x + 1 = 2, which get a truth value only once x is fixed or quantified.
A compound proposition is built from simpler ones with connectives; its truth value depends only on the truth values of the parts and on how they are connected.
p
q
¬p
p ∧ q
p ∨ q
p ⊕ q
p → q
p ↔ q
T
T
F
T
T
F
T
T
T
F
F
F
T
T
F
F
F
T
T
F
T
T
T
F
F
F
T
F
F
F
T
T
Remember
∧ and
true only when both parts are true.
∨ or
inclusive: false only when both parts are false.
⊕ xor
true when exactly one part is true (“coffee or tea comes with dinner”).
→ if…then
false only when the hypothesis is true and the conclusion false, like a broken promise: “If you get 100% on the final, then you get an A.”
↔ iff
true when both parts have the same truth value; p ↔ q ≡ (p → q) ∧ (q → p).
Watch out
A conditional with a false hypothesis is true. “If Aynur has a smartphone, then 2 + 3 = 6” is true when Aynur has no smartphone. A conditional says nothing about cause and effect.
Saying p → q
if p, then q · if p, q · q if p · q when p · q whenever p · p implies q · p only if q · p is sufficient for q · q is necessary for p · q follows from p · q unless ¬p
The two that cause mistakes: “p only if q” is p → q (not q → p), and “q unless ¬p” is also p → q. For p ↔ q: “p is necessary and sufficient for q”, “p iff q”.
Precedence
¬ first, then ∧, then ∨, then →, then ↔ (Table 7). So ¬p ∧ q means (¬p) ∧ q and p ∨ q ∧ r means p ∨ (q ∧ r). When in doubt, use brackets.
Related conditionals
For p → q: the converse is q → p, the inverse is ¬p → ¬q, and the contrapositive is ¬q → ¬p. A conditional is equivalent to its contrapositive; the converse is equivalent to the inverse; the converse is not equivalent to the original.
Example 17: “The home team wins whenever it is raining” means “If it is raining, then the home team wins.” Contrapositive: “If the home team does not win, then it is not raining.” Converse: “If the home team wins, then it is raining.” Inverse: “If it is not raining, then the home team does not win.”
2.2Truth tables, tautologies and equivalence
Example 12
With n variables there are 2ⁿ rows. Add a column for each sub-expression, working inside out. For (p ∨ ¬q) → (p ∧ q):
p
q
¬q
p ∨ ¬q
p ∧ q
(p ∨ ¬q) → (p ∧ q)
T
T
F
T
T
T
T
F
T
T
F
F
F
T
F
F
F
T
F
F
T
T
F
F
Definitions 7–8
A tautology is true in every row (p ∨ ¬p); a contradiction is false in every row (p ∧ ¬p). Substituting any propositions for the variables of a tautology gives a tautology (Theorem 1). P ≡ Q (logically equivalent) means identical truth tables, or equivalently that P ↔ Q is a tautology.
Key equivalences
p → q ≡ ¬p ∨ q
¬(p → q) ≡ p ∧ ¬q
p → q ≡ ¬q → ¬p
p ∨ q ≡ ¬p → q
p ⊕ q ≡ (p ∧ ¬q) ∨ (¬p ∧ q)
p ∧ q ≡ ¬(p → ¬q)
p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q)
p ↔ q ≡ ¬p ↔ ¬q
¬(p ↔ q) ≡ p ↔ ¬q ≡ ¬p ↔ q
(p → q) ∧ (p → r) ≡ p → (q ∧ r)
(p → r) ∧ (q → r) ≡ (p ∨ q) → r
(p → q) ∨ (p → r) ≡ p → (q ∨ r)
(p → r) ∨ (q → r) ≡ (p ∧ q) → r
So every connective can be written with ¬, ∧, ∨ alone: this set is functionally complete (Theorem 2). The laws of the algebra of propositions are the “Propositions” column of the laws table.
Example 20
Show ¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬q with laws, one step at a time.
¬(p ∨ (¬p ∧ q)) ≡ ¬p ∧ ¬(¬p ∧ q)De Morgan
≡ ¬p ∧ (p ∨ ¬q)De Morgan, double negation
≡ (¬p ∧ p) ∨ (¬p ∧ ¬q)distributive
≡ F ∨ (¬p ∧ ¬q) ≡ ¬p ∧ ¬qcomplement, identity
Example 21
(p ∧ q) → (p ∨ q) ≡ ¬(p ∧ q) ∨ (p ∨ q) ≡ (¬p ∨ ¬q) ∨ (p ∨ q) ≡ (¬p ∨ p) ∨ (¬q ∨ q) ≡ T, so it is a tautology.
Negating English
Name the simple statements, for example p = “Farid has a cellphone”, q = “Farid has a laptop”.
Write the statement as a formula: p ∧ q.
Negate with De Morgan and ¬(p → q) ≡ p ∧ ¬q: ¬p ∨ ¬q.
Translate back: “Farid does not have a cellphone or he does not have a laptop.” (Example 18)
For a conditional: the negation of “If she works, she will earn money” is “She works and she will not earn money” (Exercise 1.8).
Watch out
The negation of “all the students completed their homework” is “some student did not complete their homework”, not “no student completed it”. You need this for HW1 Task 3.
2.3Bits and bit strings
Section 5
Use 1 for T and 0 for F. Bitwise OR, AND and XOR act position by position on strings of equal length:
1 0 1 0 1 0 1 1 1 0 1
1 1 1 0 1 0 1 0 0 0 1
OR
1 1 1 0 1 0 1 1 1 0 1
AND
1 0 1 0 1 0 1 0 0 0 1
XOR
0 1 0 0 0 0 0 1 1 0 0
2.4Predicates and quantifiers
Definitions 13–14
A predicate (propositional function) P(x) on a domain A turns into a proposition for each a ∈ A; formally P: A → {0, 1}. With P(x) = “x < 10”, P(5) is true and P(12) false. Predicates can have several variables: Q(x, y) = “x + y = 5”.
The truth set is TP = {x ∈ A | P(x) is true}. Logic meets sets: T¬P = (TP)′, TP∧Q = TP ∩ TQ, TP∨Q = TP ∪ TQ.
Statement
True when
False when
∀x P(x)
P(x) holds for every x (TP = A)
there is a counterexample: some x with P(x) false
∃x P(x)
P(x) holds for at least one x (TP ≠ ∅)
P(x) is false for every x
∃!x P(x)
exactly one x makes P(x) true
no x does, or at least two do
Watch out
The domain must be stated, and it changes the answer. ∀x (x² ≥ x) is false over ℝ (x = 1/2) but true over ℤ. Over ℕ: ∀n (n + 4 > 3) is true, ∀n (n + 2 > 8) is false (n = 5), ∃n (n + 5 < 10) is true, and ∃n (n + 10 < 5) is false.
Rules 1–2
If the domain is {x₁, …, xₙ}, then ∀x P(x) ≡ P(x₁) ∧ … ∧ P(xₙ) and ∃x P(x) ≡ P(x₁) ∨ … ∨ P(xₙ).
Restrictions remove terms. With domain {0, 1, 2, 3, 4}: ∀x((x ≠ 3) → P(x)) ≡ P(0) ∧ P(1) ∧ P(2) ∧ P(4), because the x = 3 term is F → P(3), which is true. Likewise ∃x((x ≥ 2) ∧ P(x)) ≡ P(2) ∨ P(3) ∨ P(4).
Uniqueness on a two-element domain {a, b}: ∃!x P(x) ≡ (P(a) ∧ ¬P(b)) ∨ (¬P(a) ∧ P(b)). On a bigger domain, write one conjunction for each element that could be “the one”.
Precedence
∀ and ∃ bind more tightly than every connective: ∀x P(x) ∨ Q(x) means (∀x P(x)) ∨ Q(x).
Theorems 7–8
De Morgan for quantifiers:¬∀x P(x) ≡ ∃x ¬P(x) and ¬∃x P(x) ≡ ∀x ¬P(x). “Not everyone passed” means “someone failed”. Moving ¬ past a quantifier flips it. Example 34: ¬∀x(P(x) → Q(x)) ≡ ∃x ¬(P(x) → Q(x)) ≡ ∃x(P(x) ∧ ¬Q(x)).
Theorem 6
∀x(P(x) ∧ Q(x)) ≡ ∀x P(x) ∧ ∀x Q(x) and ∃x(P(x) ∨ Q(x)) ≡ ∃x P(x) ∨ ∃x Q(x). The other two do not hold: over ℤ with P = “even” and Q = “odd”, ∀x(P(x) ∨ Q(x)) is true but ∀x P(x) ∨ ∀x Q(x) is false, and ∃x P(x) ∧ ∃x Q(x) is true but ∃x(P(x) ∧ Q(x)) is false.
Translating
English (domain: everyone)
Logic
Every S is P
∀x(S(x) → P(x))
Some S is P
∃x(S(x) ∧ P(x))
No S is P
∀x(S(x) → ¬P(x)) ≡ ¬∃x(S(x) ∧ P(x))
Not every S is P
∃x(S(x) ∧ ¬P(x)) ≡ ¬∀x(S(x) → P(x))
If the domain is already “the students in the class”, drop S: ∀x P(x), ∃x P(x) (Way 1 versus Way 2 in Exercise 1.14).
Watch out
∀ goes with → and ∃ goes with ∧. ∀x(S(x) ∧ P(x)) claims everyone is an S. ∃x(S(x) → P(x)) is true as soon as one person is not an S.
Example 39
Lewis Carroll's argument, with P(x) = “x is a lion”, Q(x) = “x drinks coffee”, R(x) = “x is fierce” (labels as defined in the notes; see errata): “All lions are fierce” is ∀x(P(x) → R(x)); “Some lions do not drink coffee” is ∃x(P(x) ∧ ¬Q(x)); “Some fierce creatures do not drink coffee” is ∃x(R(x) ∧ ¬Q(x)).
2.5Nested quantifiers
Statement
True when
False when
∀x∀y P(x, y)
P(x, y) holds for every pair
some pair fails
∀x∃y P(x, y)
for every x there is a y (which may depend on x)
some x has no partner y
∃x∀y P(x, y)
one x works with every y
for every x some y fails
∃x∃y P(x, y)
some pair works
every pair fails
Examples 41–42
Domain {1, …, 9}, P(x, y) = “x + y = 10”: ∀x∃y P(x, y) is true (take y = 10 − x), but ∃y∀x P(x, y) is false (no single y works for every x). Same-type quantifiers commute; mixed ones usually do not.
Domain {1, 2, 3}: ∃x∀y(x² < y + 1) is true (x = 1); ∀x∃y(x² + y² < 12) is true (y = 1); ∀x∀y(x² + y² < 12) is false (x = 2, y = 3).
Negation rule
Pass ¬ from left to right, flipping every quantifier, and negate the predicate: ¬∀x∃y∃z P(x, y, z) ≡ ∃x∀y∀z ¬P(x, y, z).
Free variables
With a quantifier for only some variables, the result is still a predicate. For A = {1, …, 10}, (∀y ∈ A)(x + y < 14) is a predicate in x with truth set {1, 2, 3} (Exercise 1.15).
Quick check
“x + 2 = 5” is a proposition.It is an open sentence: its truth depends on x.
If p is false, then p → q is true.The only false row of → is T → F.
The converse of p → q is equivalent to p → q.The contrapositive is; the converse is not.
¬(p ∧ q) ≡ ¬p ∧ ¬qDe Morgan gives ¬p ∨ ¬q.
“p only if q” means q → p.It means p → q.
p ⊕ q ≡ ¬(p ↔ q)Exclusive or is true exactly when the two values differ.
¬∀x P(x) ≡ ∃x ¬P(x)De Morgan for quantifiers.
∃x(P(x) ∧ Q(x)) ≡ ∃x P(x) ∧ ∃x Q(x)∃ does not distribute over ∧; try even/odd over ℤ.
Over ℤ, ∀x∃y(x + y = 0) is true.Take y = −x.
Over ℤ, ∃y∀x(x + y = 0) is true.One fixed y cannot cancel every x.
Practice 2 · Propositions
9 problems
P2.1
Proposition or not?
7 is a prime number.A true proposition.
x + 2 = 5An open sentence; it becomes a proposition once x is given or quantified.
Close the door.A command is not declarative.
Every even number greater than 2 is the sum of two primes.It is true or false, even though nobody knows which yet (Goldbach's conjecture).
Is it raining?A question.
2 + 2 = 5A false proposition is still a proposition.
P2.2
Tautology, contradiction or neither?
Build a truth table for each, then classify it.
((p → q) ∧ (q → r)) → (p → r)
tautology
contradiction
neither
All 8 rows are T. This is the chain rule (hypothetical syllogism).
(p ∧ q) → p
tautology
contradiction
neither
If p ∧ q is true then p is true, so no row is T → F.
p → (p ∧ q)
tautology
contradiction
neither
False when p = T, q = F; true otherwise.
(p ∨ q) ∧ ¬p ∧ ¬q
tautology
contradiction
neither
¬p ∧ ¬q ≡ ¬(p ∨ q), so this is X ∧ ¬X.
P2.3
Prove with the laws
Name the law used at each step.
(p ∧ q) ∨ (p ∧ ¬q) ≡ p
p → (q → r) ≡ (p ∧ q) → r
p ∨ (p ∧ q) ≡ p (absorption, from the other laws)
¬(p ↔ q) ≡ p ⊕ q (a truth table is fine)
Hint
For (b), replace each → using a → b ≡ ¬a ∨ b. For (c), write p as p ∧ T first.
Solution
(p ∧ q) ∨ (p ∧ ¬q) ≡ p ∧ (q ∨ ¬q)distributive
≡ p ∧ T ≡ pcomplement, identity
p → (q → r) ≡ ¬p ∨ (¬q ∨ r)a → b ≡ ¬a ∨ b twice
≡ (¬p ∨ ¬q) ∨ rassociative
≡ ¬(p ∧ q) ∨ r ≡ (p ∧ q) → rDe Morgan, then a → b again
p ∨ (p ∧ q) ≡ (p ∧ T) ∨ (p ∧ q)identity
≡ p ∧ (T ∨ q) ≡ p ∧ T ≡ pdistributive, domination, identity
(d) Both sides have the column F, T, T, F (rows TT, TF, FT, FF): each is true exactly when p and q differ.
P2.4
Converse, inverse, contrapositive
For “If a number is divisible by 6, then it is divisible by 3”, write the converse, the inverse and the contrapositive, and say which are true.
Answer
Converse: If a number is divisible by 3, then it is divisible by 6. False (9).
Inverse: If a number is not divisible by 6, then it is not divisible by 3. False (9 again).
Contrapositive: If a number is not divisible by 3, then it is not divisible by 6. True, since it is equivalent to the original.
P2.5
Rewrite as “if … then”
You can log in only if you have the password.
A sufficient condition for passing is scoring at least 60.
The alarm sounds unless the code is entered.
A working battery is necessary for the phone to turn on.
Hint
“p only if q”, “p is sufficient for q”, “q is necessary for p” and “q unless ¬p” all mean p → q.
Answer
(a) If you can log in, then you have the password. (b) If you score at least 60, then you pass. (c) If the code is not entered, then the alarm sounds. (d) If the phone turns on, then it has a working battery.
P2.6
Negate in English
Same format as HW1 Task 3: name the propositions, write the formula, negate it, and translate back.
If it rains, then the match is cancelled.
All the lights are off and the door is locked.
Some windows are open or the alarm is off.
Hint
Make the “all” statement a single proposition, for example w = “all the windows are closed”. Then “some window is open” is ¬w.
Solution
(a) r = “it rains”, c = “the match is cancelled”. Statement r → c; negation r ∧ ¬c: “It rains and the match is not cancelled.”
(b) ℓ = “all the lights are off”, d = “the door is locked”. Statement ℓ ∧ d; negation ¬ℓ ∨ ¬d: “Some light is on or the door is unlocked.”
(c) w = “all the windows are closed”, a = “the alarm is on”. Statement ¬w ∨ ¬a; negation w ∧ a: “All the windows are closed and the alarm is on.”
P2.7
Bitwise operations
For u = 11010110 and v = 10111100, find u ∨ v, u ∧ v and u ⊕ v.
Answer
u ∨ v = 11111110, u ∧ v = 10010100, u ⊕ v = 01101010.
P2.8
Precedence
Insert all brackets: (a) ¬p ∨ q ∧ r → s (b) p → q ↔ ¬q → ¬p. Is (b) a tautology?
Answer
(a) ((¬p) ∨ (q ∧ r)) → s. (b) (p → q) ↔ ((¬q) → (¬p)), a tautology, because a conditional is equivalent to its contrapositive.
P2.9
Only ¬, ∧ and ∨
Rewrite using only ¬, ∧, ∨. The checker rejects any other connective.
On A: ∀x∀y(x + y ≤ 6)The largest sum is 3 + 3 = 6.
On A: ∃x∀y(xy = y)x = 1.
On A: ∀y∃x(x + y = 4)x = 4 − y is in A for y = 1, 2, 3.
On ℤ: ∀x∃y(y = x + 1)Take y = x + 1.
On ℤ: ∃y∀x(y = x + 1)One y cannot be the successor of every x.
On ℤ: ∀x∃y(x = 2y)Fails for odd x.
On ℤ: ∃x∀y(xy = 0)x = 0.
Lectures 4–5
Circuits and Boolean algebra
Logic circuits are the third costume of the same algebra. This chapter goes from gates to the axioms of a Boolean algebra, then to the practical skills HW1 tests: sum-of-products forms, Karnaugh maps, and truth tables.
3.1Logic gates
OR · Y = A + B
0 only when every input is 0.
AND · Y = AB
1 only when every input is 1.
NOT · Y = A′
The inverter. Exactly one input.
NAND · Y = (AB)′
AND then NOT: 0 only when every input is 1.
NOR · Y = (A + B)′
OR then NOT: 1 only when every input is 0.
A
B
AND AB
OR A + B
NAND
NOR
NOT A′
1
1
1
1
0
0
0
1
0
0
1
1
0
0
0
1
0
1
1
0
1
0
0
0
0
1
1
1
Bubbles
A small circle means complement, on an output (NAND, NOR) or on an input. In Figure 7 of the notes, a bubble on input A of a NAND gate gives Y = (A′B)′, and bubbles on A, B of a three-input NOR give Y = (A′ + B′ + C)′.
Bit sequences
Each input sends a sequence of bits and the gate works position by position. With A = 10000101, B = 10100001, C = 00100100, D = 10010101, all inputs are 0 only in positions 2, 5 and 7, so the OR gate outputs 10110101. With A = 11100111, B = 01111011, C = 01110011, D = 11101110, all are 1 only in positions 2, 3 and 7, so the AND gate outputs 01100010.
Try it
3.2Logic circuits
Reading a circuit
Work from left to right and write each gate's output in terms of its inputs; a dot marks a wire that splits. In Figure 4 the AND gate gives AB and the NOT after it (AB)′; the lower OR gate gets A′ and C, giving A′ + C, then (A′ + C)′; the final OR gives Y = (AB)′ + (A′ + C)′.
Simplified: Y = A′ + B′ + AC′ = A′ + B′ + C′ = (ABC)′, using A′ + AC′ = A′ + C′. That whole circuit is a single three-input NAND gate.
AND–OR circuits
Inputs or their complements feed AND gates, and all AND outputs feed one OR gate, whose output is Y. These circuits match sums of products exactly: one AND gate per product. Example 1 (Figure 5):
The AND gates output ABC, AB′C and A′B, so Y = ABC + AB′C + A′B.
Example 2
To draw Y = AB′C + ABC′ + AB′C′, use one AND gate per product and one OR gate; inverters supply B′ and C′. This is the circuit of Figure 8, which is also HW1 Figure 26(a).
3.3Boolean algebras
Definition 3
A Boolean algebra is a set B with operations + and · (written as juxtaposition), a complement ′, and two distinct elements 0, 1, such that for all a, b, c:
[B1] Commutative
a + b = b + a
ab = ba
[B2] Distributive
a + bc = (a + b)(a + c)
a(b + c) = ab + ac
[B3] Identity
a + 0 = a
a · 1 = a
[B4] Complement
a + a′ = 1
aa′ = 0
Precedence: ′, then ·, then +. So a + bc means a + (bc) and ab′ means a(b′).
Bⁿ, the n-bit strings with bitwise operations: 110011 + 111000 = 111011, 110011 · 111000 = 110000, (110011)′ = 001100. Bⁿ has 2ⁿ elements.
A subalgebra is a subset closed under +, ·, ′. Two Boolean algebras are isomorphic if a bijection f satisfies f(a + b) = f(a) + f(b), f(ab) = f(a)f(b), f(a′) = f(a)′.
Theorem 4
Duality. The dual of a statement swaps + ↔ · and 0 ↔ 1. The axioms are their own duals, so the dual of every theorem is a theorem. Example 3: the dual of (1 + a)(b + 0) = b is (0 · a) + (b · 1) = b.
Theorem 5
From B1–B4 you can prove: idempotent a + a = a, aa = a; boundedness a + 1 = 1, a · 0 = 0; absorption a + ab = a, a(a + b) = a; associativity; uniqueness of complement (if a + x = 1 and ax = 0 then x = a′); involution (a′)′ = a; 0′ = 1, 1′ = 0; De Morgan (a + b)′ = a′b′, (ab)′ = a′ + b′.
Example (B5b), citing an axiom at every step:
a = a · 1 = a(a + a′)B3, B4
= aa + aa′ = aa + 0 = aaB2, B4, B3
The dual chain proves a + a = a.
Theorem 8
a + b = b ⟺ ab = a ⟺ a′ + b = 1 ⟺ ab′ = 0. For sets, each says A ⊆ B.
Watch out
This is not the algebra of numbers. 1 + 1 = 1; a + bc = (a + b)(a + c) holds; and nothing cancels: a + b = a + c does not give b = c (take a = 1).
Handy identities
a + a′b = a + b, since a + a′b = (a + a′)(a + b) = a + b. Consensus:ab + a′c + bc = ab + a′c. Neither is listed in the notes, but both follow from the laws (see P5.3) and save time.
3.4Sum-of-products forms
Definitions 4–7
Literal
a variable or its complement: x, x′, y, …
Fundamental product
a literal, or a product of literals with no variable repeated: xz′, xy′z, x′yz. Any product of literals reduces to 0 or a fundamental product: xyx′z = 0 since xx′ = 0, and xyzy = xyz since yy = y.
Contained in
P₁ is contained in P₂ when every literal of P₁ is a literal of P₂. Then P₁ + P₂ = P₁ by absorption: x′z + x′yz = x′z.
SoP expression
a fundamental product, or a sum of fundamental products none of which is contained in another (also called DNF).
Example 7: E₁ = xz′ + y′z + xyz′ is not an SoP expression because xz′ is contained in xyz′; absorbing gives xz′ + y′z.
Algorithm 1
Any expression to SoP.
Move complements inward with De Morgan and involution until they sit on single variables.
Multiply out with the distributive law.
Reduce each product to 0 or a fundamental product (commutative, idempotent, complement laws).
Drop the 0s and any product that contains another (absorption).
A minterm is a fundamental product containing all n variables (there are 2ⁿ). A complete sum-of-products (CSoP, CDNF) is a sum of minterms. Every nonzero expression has exactly one CSoP form (Theorem 9).
Algorithm 2
SoP to CSoP. If a product P misses the variable xᵢ, replace it by P(xᵢ + xᵢ′) and multiply out (allowed because xᵢ + xᵢ′ = 1); delete repeated products. Repeat until every product is a minterm.
For an SoP expression, EL counts the literals (with repetition) and ES the products: E = xyz + x′y′t + xy′z′t + x′yzt has EL = 14, ES = 4. E is simpler than an equivalent F when EL < FL and ES ≤ FS, or EL ≤ FL and ES < FS. A minimal SoP (MSoP) has no simpler equivalent; there can be several.
A fundamental product P is a prime implicant of E when P + E = E but no fundamental product contained in P has this property. Theorem 10: a minimal SoP is a sum of prime implicants. Karnaugh maps find them by eye.
3.5Karnaugh maps
Definition 12
Two fundamental products are adjacent when they have the same variables and differ in exactly one literal. Their sum drops that variable: xyz′ + xy′z′ = xz′(y + y′) = xz′. Not adjacent: x′yzt and xyz′t (two literals differ), or xyz′ and xyzt (different variables).
Course layout
Each square is one minterm. Neighbouring labels differ in one literal, so squares that share a side are adjacent products. The 3-variable map is glued left to right (a cylinder); the 4-variable map is also glued top to bottom (a torus), so even the four corners are neighbours.
2 variables3 variables4 variables
Definition 14
A basic rectangle is a block of 1, 2, 4 or 8 squares in a 1×1, 1×2, 1×4, 2×2 or 2×4 shape (wrapping across the glued edges is allowed). With 4 variables it gives a product of 4, 3, 2 or 1 literals; with 3 variables, 1, 2 or 4 squares give 3, 2 or 1 literals. The product consists of the literals shared by every square of the rectangle. These three rectangles are from Exercise 1.8:
2 squares, 3 literals4 squares across the side edges8 squares across top and bottom
Procedure
Check the squares of E; expand each product into all of its squares first.
Find the prime implicants: maximal basic rectangles of checked squares, as large as possible, wrapping round the edges.
A checked square that lies in only one prime implicant makes that prime essential: it appears in every minimal sum.
Cover the remaining checks with as few prime implicants as possible, preferring larger ones.
If there is a tie, there are several minimal sums. List all of them.
Example 12
(a) E₁ = xyz + xyz′ + x′yz′ + x′y′z: three prime implicants, all needed.
(b) E₂ = xyz + xyz′ + xy′z + x′yz + x′y′z: the 2×2 block z wraps across the side edges.
(c) E₃ = xyz + xyz′ + x′yz′ + x′y′z′ + x′y′z: four prime implicants, and either yz′ or x′z′ completes the cover, so there are two minimal sums.
Example 14
E = xy′ + xyz + x′y′z′ + x′yzt′. Check the four squares of xy′, two of xyz, two of x′y′z′ and one of x′yzt′. The minimal cover uses two 2×2 blocks and a pair that wraps from the top row to the bottom row.
Watch out
Rectangles have 1, 2, 4 or 8 squares: no L-shapes and no blocks of 3 or 6. Remember the wraparound; in the 4-variable map the four corners form the rectangle yt. A larger rectangle is always better than a smaller one inside it, and a prime implicant may be left out if other primes already cover its squares.
For n inputs, use strings of length 2ⁿ. The first variable is 2ⁿ⁻¹ zeros followed by 2ⁿ⁻¹ ones; the next alternates in blocks of 2ⁿ⁻²; and so on, until the last alternates 0101…. Together they list all 2ⁿ input combinations, position k holding the binary form of k − 1.
x
00001111
x′
11110000
y
00110011
y′
11001100
z
01010101
z′
10101010
For four inputs: A = 0000000011111111, B = 0000111100001111, C = 0011001100110011, D = 0101010101010101.
Truth table
T(E) is the output string when the inputs are the special sequences, written T(00001111, 00110011, 01010101) = … or simply T(E) = …. Each minterm has a single 1 (Table 5):
position
1
2
3
4
5
6
7
8
input xyz
000
001
010
011
100
101
110
111
minterm
x′y′z′
x′y′z
x′yz′
x′yz
xy′z′
xy′z
xyz′
xyz
So x′yz = 00010000 and xyz′ = 00000010. A truth table is the graph of a Boolean function Bⁿ → B.
Algorithm 3
Truth table of an SoP. (1) Write the special sequences and their complements. (2) Compute each product: 1 only where all its factors are 1. (3) Add the products: 0 only where all are 0.
Example 16: Y = ABC + AB′C + A′B. ABC = 00000001, AB′C = 00000100, A′B = 00110000, so T(Y) = 00110101.
Backwards
From a truth table to an expression: a 1 in position k gives the minterm of k − 1 in binary, and E is the sum of these minterms. Example 20: T(E) = 01001001 has 1s in positions 2, 5 and 8, so E = x′y′z + xy′z′ + xyz. Then minimise it with a K-map.
Example 18
Design a minimal AND–OR circuit with T = [A, B, C; L] = [00001111, 00110011, 01010101; 11001101]. The 1s in positions 1, 2, 5, 6, 8 give L = A′B′C′ + A′B′C + AB′C′ + AB′C + ABC. The map has two prime implicants, both needed:
So L = B′ + AC: one AND gate, one inverter and one OR gate.
Quick check
A NOR gate outputs 1 only when all its inputs are 0.NOR is OR followed by NOT.
In a Boolean algebra, a + bc = (a + b)(a + c).That is axiom B2.
xyx′z reduces to 0.xx′ = 0.
xz′ + xyz′ is in SoP form.xz′ is contained in xyz′; absorbing gives xz′.
In a 4-variable map, a 2×2 block gives a product of 3 literals.Four squares give 2 literals.
The four corner squares of the 4-variable map form one rectangle.The map is a torus; the corners give yt.
T(x′yz) = 00010000.x′yz is input 011, position 4.
A minimal sum uses every prime implicant.It uses the essential ones plus as few others as needed.
An essential prime implicant appears in every minimal sum.It is the only way to cover one of the squares.
The dual of a + 0 = a is a · 1 = a.Swap + ↔ · and 0 ↔ 1.
Practice 4 · Gates and circuits
8 problems
P4.1
Three gates, one input set
A = 101101, B = 111001, C = 011101. Find the outputs of an AND gate (Y = ABC), an OR gate (Y = A + B + C) and a NOT gate on A.
Hint
Go column by column. AND needs three 1s; OR needs one 1.
Answer
001001, 111101, 010010.
P4.2
Eight-bit inputs
A = 11001010, B = 10101100, C = 11110000. Find ABC and A + B + C.
Answer
ABC = 10000000 (only position 1 is all ones); A + B + C = 11111110 (only position 8 is all zeros).
P4.3
NAND and NOR
For A = 1100 and B = 1010, find the outputs of a NAND gate and a NOR gate.
Answer
NAND 0111, NOR 0001.
P4.4
Read the circuit
Express the output Y of this circuit in terms of A, B, C.
Hint
Follow each vertical line up to its input. A triangle with a bubble before an AND input means that input is complemented.
Answer
Y = AB′ + A′C + BC′. Bonus: T(Y) = 01111110, so Y = 0 exactly when A = B = C.
P4.5
Draw the circuit
Draw the AND–OR circuit for Y = A′B + AB′C′ + BC.
Answer
One AND gate per product, inverters for A′, B′, C′, and one three-input OR gate:
P4.6
A circuit that is just a wire
Four AND gates compute ABC, AB′C, A′BC, A′B′C and feed one OR gate. Find the simplest equivalent expression.
Solution
ABC + AB′C = AC and A′BC + A′B′C = A′C, so Y = AC + A′C = C. The whole circuit can be replaced by a wire from C.
P4.7
Truth table of a circuit
Find T(Y) for Y = AC′ + BC using the special sequences.
Solution
AC′ = 00001111 · 10101010 = 00001010; BC = 00110011 · 01010101 = 00010001; sum 00011011.
P4.8
Simplify a NOR network
A circuit computes Y = (A + B)′ + (A′ + B)′. Simplify it.
Solution
De Morgan: (A + B)′ = A′B′ and (A′ + B)′ = AB′. So Y = A′B′ + AB′ = (A′ + A)B′ = B′.
Practice 5 · Boolean algebra and SoP forms
7 problems
P5.1
Reduce the products
Reduce each to 0 or a fundamental product.
Answer
(a) x′yzt (b) xy′zt (c) 0, since it contains y and y′ (d) 0, since it contains x and x′ (e) xyt′
P5.2
Write the dual
x + x′y = x + y
(x + 1)(y + 0) = y
x(x′ + y) = xy
Answer
(a) x(x′ + y) = xy (b) (x · 0) + (y · 1) = y (c) x + x′y = x + y. Parts (a) and (c) are duals of each other.
P5.3
Prove from the axioms
x + x′y = x + y
x(x + y) = x (absorption)
xy + x′z + yz = xy + x′z (consensus)
Hint
(a) Start with the distributive law B2 read as a + bc = (a + b)(a + c). (c) Multiply yz by 1 = x + x′.
Find EL and ES: (a) E = xy′ + x′yz + z′ (b) E = xyzt + x′t + y (c) E = (x + y)z
Answer
(a) EL = 2 + 3 + 1 = 6, ES = 3. (b) EL = 4 + 2 + 1 = 7, ES = 3. (c) Not written as a sum of products, so EL and ES are not defined (Exercise 1.4(d)).
P5.6
Prime implicants
List all prime implicants of E = x′y′ + x′yz + xyz and find its minimal sum.
Answer
Prime implicants x′y′, x′z, yz. Minimal sum x′y′ + yz: x′z is a prime implicant, but its squares are already covered.
P5.7
Sets as Boolean expressions
Write as a union of intersections and simplify, with + for ∪ and juxtaposition for ∩ (Exercise 1.3 style): (a) (A ∪ B′)′ ∩ (A ∪ C) (b) (A ∩ B)′ ∩ (A ∪ B)
Solution
(a) (A + B′)′(A + C) = A′B(A + C) = A′BA + A′BC = A′BC, that is A′ ∩ B ∩ C.
(b) (AB)′(A + B) = (A′ + B′)(A + B) = A′B + AB′, which is A ⊕ B.
Practice 6 · Karnaugh maps
8 problems
P6.1
Three variables
Minimise E = x′yz + x′yz′ + xyz′ + xy′z′.
Solution
The squares x′yz and xy′z′ each lie in only one prime implicant, so x′y and xz′ are essential, and together they cover everything: E = x′y + xz′.
P6.2
A block across the edge
Minimise E = xyz + xy′z + x′yz + x′y′z + xyz′.
Solution
The four z squares form a 2×2 block across the glued side edges, and xyz′ pairs with xyz: E = z + xy.
P6.3
Two answers
E = x′y′z′ + x′y′z + x′yz′ + xy′z + xyz′ + xyz has no essential prime implicants. Find both minimal sums.
Answer
The six squares form a ring of six pairs. Taking every other pair gives the two minimal sums: xy + x′z′ + y′z and xz + yz′ + x′y′.
P6.4
Read a 4-variable map
Find a minimal sum for the expression given by this map.
Hint
One full column, one 2×2 block, and one pair that wraps from the top row to the bottom row.
Solution
P6.5
Wraparound both ways
Find a minimal sum.
Solution
The z′t column is full; yzt′ wraps from the top row to the bottom row; xy′t wraps from the right edge to the left edge.
P6.6
Find all minimal sums
This map has three different minimal sums, like HW1 2.11(a). Find them all.
Hint
Two prime implicants are essential. The remaining squares can be covered with two more primes in three different ways.
Solution
P6.7
From an expression
Use a map to minimise E = xz + xy′z′ + x′yt + x′y′z′t′.
Solution
Expanding gives 9 squares. The minimal sum is xz + xy′ + x′yt + y′z′t′: the new rectangle xy′ replaces xy′z′, and y′z′t′ replaces x′y′z′t′.
P6.8
Redesign: the voting machine
Three judges press A, B, C; a light goes on when at least two press. This circuit works, but it is not minimal. Redesign it as a minimal AND–OR circuit.
Solution
Y = ABC + ABC′ + AB′C + A′BC = AB + AC + BC: three two-input AND gates.
Practice 7 · Truth tables and design
6 problems
P7.1
Special sequences
Write the special sequences for two inputs A, B.
Answer
A = 0011, B = 0101: the four columns are 00, 01, 10, 11.
T(E) = 01100110. Find E as a CSoP, then minimise it.
Solution
1s in positions 2, 3, 6, 7, that is inputs 001, 010, 101, 110: E = x′y′z + x′yz′ + xy′z + xyz′. Minimal: E = y′z + yz′ (that is y ⊕ z; the value of x does not matter).
P7.5
Recognise a special sequence
Which single literal has (a) T(E) = 11110000 (b) T(E) = 00001111?
Answer
(a) x′ (b) x.
P7.6
Design a circuit
Design a minimal AND–OR circuit with T = [A, B, C; Y] = [00001111, 00110011, 01010101; 11010001].
Solution
1s in positions 1, 2, 4, 8: Y = A′B′C′ + A′B′C + A′BC + ABC. On the map, A′B′ and BC cover everything, so Y = A′B′ + BC.
Check anything
Checkers and tools
Use these to check your own work on any exercise, including ones from the notes. They understand the notation of both parts of the course: x′ or x' for complement, + and juxtaposition, or ¬ ∧ ∨ → ↔ ⊕.
Truth tables and equivalence
Type a proposition or a Boolean expression. You get its truth table with a column for each step, whether it is a tautology, and for up to 4 variables its CSoP, minimal sums and AND–OR circuit. Fill in the second box to test whether two expressions are equivalent.
Karnaugh map solver
Click squares to check them, or fill the map from an expression in x, y, z, t. The solver lists every prime implicant (filled chips are essential) and every minimal sum. Press “Random map” to practise; the answer stays hidden until you ask for it.
Loaded with Example 14 from the notes.
Venn diagram shader
Type a set expression in A, B, C (and U). The page shades its regions, names the fundamental products it contains, and gives the same set as a minimal Boolean expression.
Homework 1 · due Monday 19 October 2026, 23:59
HW1 answer check
All 23 HW1 tasks, in order. Solve each on paper first. Then type your answer into its box: the page says whether it is right without showing the solution. If you are stuck, the answer and the method are behind the buttons.
Before you submit
Handwritten solutions with page numbers, scanned into one multipage PDF and uploaded to Blackboard.
At the top of page 1: your name and surname, your program (computer science, math, EEE, …), “Fall 25, Discrete Structures”, and “HW1”.
File name: Name_Surname_Fall 25_DS_HW1_CRN_xxx.pdf. The template says “Fall 25” although the course runs in Fall 2026, probably carried over from last year; follow it unless your instructor says otherwise.
HW1 is worth 1 point, and each day late costs 0.2.
Sets and operations · Lecture 1
Task 1
Union and intersection of all Aₙ
Let Aₙ be the set of all positive integers divisible by n. Find (a) ⋃n=2∞ Aₙ and (b) ⋂n=2∞ Aₙ.
(a) ⋃n=2∞ Aₙ is
∅
{1}
ℕ
ℕ ∖ {1} = {2, 3, 4, …}
the prime numbers
Every m ≥ 2 lies in Am, and 1 lies in no Aₙ with n ≥ 2.
(b) ⋂n=2∞ Aₙ is
∅
{1}
A₂, the even numbers
ℕ
An element would have to be divisible by every n ≥ 2, including n = m + 1 > m.
Answer with reasons
(a) ⋃n=2∞ Aₙ = {2, 3, 4, …} = ℕ ∖ {1}. If m ≥ 2, then m is divisible by itself, so m ∈ Am and m is in the union. The number 1 is divisible by no n ≥ 2, so it is in none of the sets.
(b) ⋂n=2∞ Aₙ = ∅. Suppose m is in every Aₙ. Then m ∈ Am+1, so m + 1 divides m; but 0 < m < m + 1, a contradiction.
This is Exercise 2.9 of Lecture 1. Compare Exercise 1.6(c), where the union runs over the primes and gives the same answer.
Task 2
M is equivalent to M ∪ A
Let M be any infinite set and A any countable set. Prove that M is equivalent to M ∪ A.
Hint
Three ingredients from Part 4 of Lecture 1: the new elements are A ∖ M (Theorem 10 says how many there can be); M has a countable subset (Theorem 12); and two countable sets can be matched up (Theorem 11). Then copy the shift of P1.14.
Model proof
Let A₁ = A ∖ M. Then M ∪ A = M ∪ A₁ and M ∩ A₁ = ∅. As a subset of the countable set A, A₁ is finite or countable (Theorem 10). If A₁ = ∅, then M ∪ A = M and the identity map is a bijection. So assume A₁ ≠ ∅.
Since M is infinite, it contains a countable subset B = {b₁, b₂, b₃, …} (Theorem 12). The set B ∪ A₁ is countable (Theorem 11: a union of a countable and a finite or countable set). List it without repetition as c₁, c₂, c₃, …; then g(bₙ) = cₙ is a bijection g: B → B ∪ A₁.
Define f: M → M ∪ A by f(x) = g(x) for x ∈ B and f(x) = x for x ∈ M ∖ B. We have the disjoint unions
M = (M ∖ B) ∪ B and M ∪ A = (M ∖ B) ∪ (B ∪ A₁).
f maps M ∖ B onto itself by the identity and B onto B ∪ A₁ by the bijection g, and the pieces do not overlap. So f is one-to-one and onto, and M ~ M ∪ A. ∎
Explicit version of g (Hilbert's hotel). If A₁ = {α₁, …, αk} is finite: g(bₙ) = αₙ for n ≤ k and g(bₙ) = bn−k for n > k. If A₁ = {α₁, α₂, …} is countable: g(b2n−1) = bₙ and g(b2n) = αₙ.
Self-check for your proof
Did you use A ∖ M, so that elements of A already in M are not counted twice?
Did you cover the case where A ∖ M is finite (or empty), not only the countable case?
Did you find a countable subset of M and say why it exists?
Did you define an actual bijection and check both one-to-one and onto?
“Both sets are infinite, so they are equivalent” is not a proof: ℕ and ℝ are both infinite and not equivalent.
Propositions · Lectures 2–3
Task 3
Write, negate, translate
For each statement: (1) introduce propositions, (2) write it as a compound proposition, (3) negate it, (4) write the negation in English.
If the teacher is absent, then some students do not complete their homework.
All the students completed their homework and the teacher is present.
Some of the students did not complete their homework or the teacher is absent.
Hint
Two propositions are enough for all three statements, as long as one of them is about all the students. Then “some students do not complete” is just its negation. Use ¬(p → q) ≡ p ∧ ¬q and De Morgan.
Model answer
(1) Let p = “The teacher is present” and q = “All the students completed their homework”. Then ¬p = “The teacher is absent” and ¬q = “Some students did not complete their homework”.
(2) Formula
(3) Negation
(4) In English
(a)
¬p → ¬q
¬(¬p → ¬q) ≡ ¬p ∧ q
The teacher is absent and all the students completed their homework.
(b)
q ∧ p
¬(q ∧ p) ≡ ¬q ∨ ¬p
Some students did not complete their homework or the teacher is absent.
(c)
¬q ∨ ¬p
¬(¬q ∨ ¬p) ≡ q ∧ p
All the students completed their homework and the teacher is present.
Notice that (b) and (c) are negations of each other, which is a good check. Choosing p = “the teacher is absent” and q = “some students did not complete their homework” also works: the formulas change (for example (a) becomes p → q, negated to p ∧ ¬q), but the English answers are the same.
Task 4
Q(x): “x + 1 > 2x” over the integers
What are the truth values?
Q(0)1 > 0.
Q(−1)0 > −2.
Q(1)2 > 2 is false.
∃x Q(x)x = 0 works.
∀x Q(x)x = 1 is a counterexample.
∃x ¬Q(x)x = 1.
∀x ¬Q(x)Q(0) is true.
Method
x + 1 > 2x ⟺ x < 1, so over the integers the truth set is TQ = {…, −2, −1, 0}. It is neither empty nor all of ℤ, which settles (d)–(g) at once.
Task 5
Over the real numbers
∃x(x² = 2)x = √2.
∃x(x² = −1)A real square is never negative.
∀x(x² + 2 ≥ 1)x² + 2 ≥ 2 ≥ 1.
∀x(x² ≠ x)x = 0 (or x = 1) gives x² = x.
Task 6
A = {1, 2, 3, 4, 5}
Subtask 1: truth values. Subtask 2: negate each proposition.
(∃x ∈ A)(x + 3 = 10)It would need x = 7 ∉ A.
(∀x ∈ A)(x + 3 < 10)The largest value is 5 + 3 = 8.
To check in the boxes, write a, b, c, d, e, f for P(−5), P(−3), P(−1), P(1), P(3), P(5).
Hint
∀ becomes a conjunction and ∃ a disjunction over the six elements. A restriction such as x ≠ 1 removes the term for x = 1, because F → P(1) is true and F ∧ P(1) is false.
Answer
(a) P(−5) ∨ P(−3) ∨ P(−1) ∨ P(1) ∨ P(3) ∨ P(5)
(b) P(−5) ∧ P(−3) ∧ P(−1) ∧ P(1) ∧ P(3) ∧ P(5)
(c) P(−5) ∧ P(−3) ∧ P(−1) ∧ P(3) ∧ P(5)
(d) P(1) ∨ P(3) ∨ P(5)
(e) (¬P(−5) ∨ ¬P(−3) ∨ ¬P(−1) ∨ ¬P(1) ∨ ¬P(3) ∨ ¬P(5)) ∧ (P(−5) ∧ P(−3) ∧ P(−1)). Since the second part makes P(−5), P(−3), P(−1) true, this simplifies to P(−5) ∧ P(−3) ∧ P(−1) ∧ (¬P(1) ∨ ¬P(3) ∨ ¬P(5)).
Task 9
∃!x P(x) on D = {1, 2, 3}
Write ∃!x P(x) with negations, conjunctions and disjunctions. To check, write a, b, c for P(1), P(2), P(3).
Hint
Exactly one element is true. Write one conjunction for each choice of that element, then join them with ∨.
Boolean expressions and prime implicants · Lectures 4–5
2.1
Reduce the products
Reduce each product to 0 or a fundamental product.
Answer
(a) xxy′y′z = xy′z (b) 0, because it contains y and y′ (c) xxy′y′z′t = xy′z′t (d) 0, because of y and y′. Laws used: commutative, xx = x, xx′ = 0.
2.2
SoP and CSoP forms
Express each E(x, y, z) as an SoP and then in CSoP form. The boxes check the form as well as the value.
E = x(xy′ + x′y + y′z)
E = (x + y′z)(y + z′)
E = (x′ + y)′ + y′z
E = (x′y)′(x′ + xyz′)
E = (x + y)′(xy′)′
E = y(x + yz)′
Hint
Algorithm 1: De Morgan first, then multiply out, kill xx′ products, absorb. Algorithm 2: multiply each short product by (v + v′) for each missing variable v.
(e) (x + y)′ = x′y′ and (xy′)′ = x′ + y, so E = x′y′(x′ + y) = x′y′ + x′yy′ = x′y′. CSoP: x′y′z + x′y′z′.
(f) (x + yz)′ = x′(yz)′ = x′(y′ + z′), so E = yx′y′ + yx′z′ = x′yz′, which is already a minterm.
2.3
Minimal SoP forms
E₁ = xy′z′ + x′y + x′y′z′ + x′yz
E₂ = xy′ + x′z′t + xyzt′ + x′y′zt′
E₃ = xyzt + xyz′t′ + xz′t′ + x′y′z′ + x′yz′t
Hint
Draw the map (3 variables for E₁, 4 for the others), expanding each product into all its squares. E₃ has two different minimal sums.
Answer
(a) E₁ = x′y + y′z′. The squares are xy′z′, x′yz, x′yz′, x′y′z′; the prime implicants are x′y, x′z′, y′z′, of which x′y and y′z′ are essential and already cover everything.
(b) E₂ = xy′ + xzt′ + x′z′t + y′zt′, unique (4 products, 11 literals). All four are essential.
(c) Two minimal sums: E₃ = xyzt + xz′t′ + x′z′t + y′z′t′ and E₃ = xyzt + xz′t′ + x′z′t + x′y′z′. The square xyzt is isolated, so it stays a 4-literal product; xz′t′ and x′z′t are essential; the square x′y′z′t′ can go with either neighbour.
Logic gates and truth tables · Lectures 4–5
2.4
Read Figure 24
Express the output Y of each circuit in Figure 24 (in the HW PDF) in terms of A, B, C.
Hint
Trace each AND gate's inputs back to the input lines, one wire at a time. A triangle with a bubble on a wire complements that input.
Answer
(a) The AND gates receive (A′, B, C), (A′, C′) and (B, C′), so Y = A′BC + A′C′ + BC′.
(b) The AND gates receive (A, B, C), (A′, B, C) and (A, B′, C′), so Y = ABC + A′BC + AB′C′.
Not asked, but useful practice: (a) simplifies to A′B + A′C′ + BC′, and (b) to BC + AB′C′.
2.5
Draw the circuits
Draw the logic circuit with inputs A, B, C and output Y for (a) Y = AB′C + AC′ + A′C (b) Y = A′BC + A′BC′ + ABC′.
Hint
These are sums of products, so each is an AND–OR circuit: one AND gate per product, an inverter for each complemented input, and one OR gate at the end (Example 2).
Answer
(a) Three AND gates (3, 2 and 2 inputs) into a three-input OR gate:
(b) Three three-input AND gates into a three-input OR gate:
Your drawing can be arranged differently; what matters is which inputs, complemented or not, reach each AND gate.
2.6
AND gate outputs
Y = ABC for (a) A = 110001, B = 101101, C = 110011; (b) A = 01111100, B = 10111010, C = 00111100; (c) A = 00111110, B = 01111100, C = 11110011.
Answer
(a) 100001 (positions 1 and 6 are all ones) (b) 00111000 (positions 3, 4, 5) (c) 00110000 (positions 3, 4).
2.7
OR gate outputs
Y = A + B + C for (a) A = 100011, B = 100101, C = 100001; (b) A = 10000001, B = 00100100, C = 00000011; (c) A = 00111100, B = 11110000, C = 10000001.
Answer
(a) 100111 (all zeros only in positions 2 and 3) (b) 10100111 (positions 2, 4, 5) (c) 11111101 (position 7).
2.8
NOT gate outputs
Y = A′ for (a) 11100111 (b) 10001000 (c) 11111000.
Answer
(a) 00011000 (b) 01110111 (c) 00000111
2.9
Truth tables
Find T(E) for (a) E = xy + x′z (b) E = xyz′ + xy′z′ + x′y′z′.
(b) A sum of minterms, so read the positions from Table 5: xyz′ → 7, xy′z′ → 5, x′y′z′ → 1, giving 10001010.
2.10
From truth tables to expressions
Find E(x, y, z) for (a) T(E) = 10001010 (b) 00010001 (c) 00110000. Any equivalent form is accepted.
Answer
(a) Positions 1, 5, 7: E = x′y′z′ + xy′z′ + xyz′, which simplifies to y′z′ + xz′. This is the same function as 2.9(b).
(b) Positions 4, 8: E = x′yz + xyz = yz.
(c) Positions 3, 4: E = x′yz′ + x′yz = x′y.
2.11
All minimal sums from Figure 25
Find all possible minimal sums for each map.
Figure 25(a)Figure 25(b)
Hint
(a) has a full column and a full row, which are essential. Three squares remain, and there are three different ways to cover them with two prime implicants. (b) has a unique minimal sum; look for 2×2 blocks that wrap from the top row to the bottom row.
Answer
(a) Three minimal sums, each with 4 products and 10 literals:
The zt′ column and the x′y row are essential. The squares xyz′t, xy′zt and xy′z′t remain: xyz′t pairs with its neighbour below (xz′t) or with the bottom row across the edge (yz′t), and xy′zt pairs to its right (xy′z) or across the side edge (xy′t).
(b) One minimal sum: zt′ + yt′ + yz + xy′z′ (4 products, 9 literals). The prime implicant xt′ is not needed.
2.12
Minimal sums with a K-map
(a) E = y′z + y′z′t′ + z′t (b) E = y′zt + xzt′ + xy′z′
Hint
(a) does not contain x, so its squares come in vertical pairs; it collapses to two products. In (b), notice that xy′z′ lies inside a larger rectangle.
Answer
(a) E = y′ + z′t. The two middle rows (y′) are full, an 8-square rectangle, and z′t covers the rest of the last column.
(b) E = xy′ + y′zt + xzt′. The row xy′ is full; x′y′zt needs y′zt; xyzt′ needs xzt′.
2.13
Redesign Figure 26
Use Karnaugh maps to redesign each circuit in Figure 26 (HW PDF) as a minimal AND–OR circuit. First read the circuit, then minimise.
Hint
Figure 26(a) is the same circuit as Figure 8 in the notes (Example 2).
Answer
(a) The circuit computes Y = AB′C + ABC′ + AB′C′. On the map, AB′C + AB′C′ = AB′ and ABC′ + AB′C′ = AC′, so Y = AB′ + AC′:
(b) The circuit computes Y = ABC + A′BC′ + ABC′. Then ABC + ABC′ = AB and A′BC′ + ABC′ = BC′, so Y = AB + BC′:
2.14
Three switches, one hall light
The light is on (1) when an odd number of the switches A, B, C are up. (a) Show that T(A, B, C) = 01101001 satisfies the conditions. (b) Design a minimal AND–OR circuit with this truth table.
Hint
For (a), count the 1s in each input column 000, 001, …, 111. For (b), draw the map and look for adjacent checked squares.
Answer
(a) The inputs in order are 000, 001, 010, 011, 100, 101, 110, 111, with 0, 1, 1, 2, 1, 2, 2, 3 ones. The odd counts are in positions 2, 3, 5, 8, which is exactly where 01101001 has its 1s. Changing any one switch changes the count by one and so flips the parity, which toggles the light; so each switch controls the light from any state.
(b) L = A′B′C + A′BC′ + AB′C′ + ABC. On the map the four squares form a checkerboard: no two are adjacent, so every square is its own prime implicant and this CSoP is already minimal (this is A ⊕ B ⊕ C).
Past exam · Midterm 1, 25 October 2025 · 27 points
Midterm 1 practice (Fall 2025)
Last year's Midterm 1 came in two variants with the same seven tasks: K-map circuit design, a truth table from an expression, an MSoP from a truth table, two 4-variable K-maps, a De Morgan proof, quantifiers, and a countability proof. Work through one variant under exam conditions (about 75 minutes), check it here, then do the other.
Truth tables use the special sequences x = 00001111, y = 00110011, z = 01010101. Position 1 is x′y′z′ and position 8 is xyz.
Tasks 1–3 give marks for each step: CSoP (or SoP), then the K-map, then the MSoP, then the circuit. Show every step.
When a function has several minimal sums, one of them is enough.
Task 7 must be a proof, not an explanation (“A student may submit another proof. But it must be ‘proof’ that is not an explanation.”).
Variant 1
V1 · 1
Minimal AND–OR circuit · 4 pt
Design a three-input minimal AND–OR circuit L with truth table T[x, y, z; L] = [00001111, 00110011, 01010101; 10011011].
Hint
The 1s are in positions 1, 4, 5, 7, 8. Read each position as a minterm from Table 1, then look for pairs on the map, remembering that the left and right columns are adjacent.
Solution
Step 1: L = x′y′z′ + x′yz + xy′z′ + xyz′ + xyz.
Steps 2–3: x′y′z′ + xy′z′ = y′z′ and x′yz + xyz = yz are essential. The square xyz′ is left; it pairs with xyz (xy) or with xy′z′ (xz′). Two minimal sums, 3 products and 6 literals each:
L = y′z′ + yz + xy or L = y′z′ + yz + xz′
V1 · 2
Truth table of an expression · 5 pt
Find T(E) for E = (xy′ + z′)′(x + yz′) + (x′z + y)(y′z)′ + x′z + xy′z′. Step 1: an SoP form (3 pt). Step 2: the CSoP form (1 pt). Step 3: T(E) (1 pt).
Hint
De Morgan on the two complemented factors first: (xy′ + z′)′ = (x′ + y)z and (y′z)′ = y + z′. Then multiply out and use y + yz′ = y and y + xyz = y.
(A) needs five products; start with the 2×2 block yz′. (B) needs only three: look for a block that wraps from the left column to the right one and one that wraps from the top row to the bottom.
Answer
(A) Two minimal sums, 5 products and 14 literals each:
x ∈ (A ∪ B)′ ⟺ x ∉ A ∪ B ⟺ ¬(x ∈ A ∨ x ∈ B) ⟺ x ∉ A ∧ x ∉ B ⟺ x ∈ A′ ∧ x ∈ B′ ⟺ x ∈ A′ ∩ B′.
The third step is De Morgan's law for propositions. Both sets have the same elements, so they are equal. ∎
The sheet writes U − (A ∪ B) in the second step; here the universal set is called S.
V1 · 6
Quantifiers · 2 pt
6.1 The negation of ∃x ∃y ∀z P(x, y, z) is
∃x ∃y ∀z ¬P(x, y, z)
∀x ∀y ∀z ¬P(x, y, z)
∀x ∀y ∃z ¬P(x, y, z)
∀x ∃y ∃z ¬P(x, y, z)
Push ¬ inwards one quantifier at a time, flipping each: ∀x ¬∃y ∀z P = ∀x ∀y ¬∀z P = ∀x ∀y ∃z ¬P.
6.2 Over the integers, what are the truth values?
∀x(x > 51)x = 0 is a counterexample.
∃!x(x⁵ = −1)Only x = −1.
∃!x(2x² + 3 = 1)x² = −1 has no solution at all.
∃x(2x = 4x + 2)x = −1.
V1 · 7
Polynomials with rational coefficients · 2 pt
Using “a finite or countable union of countable sets is countable”, prove that the set P of all polynomials with rational coefficients is countable.
Hint
Split P by degree, and show each piece is countable by induction on the degree.
Model proof
Let Aₙ be the set of polynomials of degree exactly n (put the constants, including 0, in A₀). Then P = A₀ ∪ A₁ ∪ A₂ ∪ ⋯, a countable union, so it is enough to show each Aₙ is countable.
Let Bₙ = A₀ ∪ ⋯ ∪ Aₙ be the polynomials of degree at most n. B₀ = A₀ = ℚ is countable. Suppose Bₙ₋₁ is countable. For each a ∈ ℚ, the set {a xⁿ + q : q ∈ Bₙ₋₁} is in bijection with Bₙ₋₁, hence countable. Then Bₙ = ⋃a∈ℚ {a xⁿ + q : q ∈ Bₙ₋₁} is a countable union of countable sets, so it is countable. By induction every Bₙ is countable, and Aₙ ⊆ Bₙ is infinite (it contains xⁿ + q for every q ∈ ℚ), so it is countable too. ∎
The sheet's proof fixes aₙ, …, a₁, lets a₀ run through ℚ, then frees a₁, and so on: the same induction, written out step by step. It writes P = ∑ Aₙ for the disjoint union ⋃ Aₙ. Another route: aₙxⁿ + ⋯ + a₀ ↦ (aₙ, …, a₀) is a bijection from Aₙ onto a subset of ℚⁿ⁺¹, which is countable.
Variant 2
V2 · 1
Minimal AND–OR circuit · 4 pt
Design a three-input minimal AND–OR circuit L with truth table T[x, y, z; L] = [00001111, 00110011, 01010101; 01010111].
Solution
Step 1: positions 2, 4, 6, 7, 8 give L = x′y′z + x′yz + xy′z + xyz′ + xyz.
Steps 2–3: the four squares with z form a block, and xyz′ pairs with xyz: L = z + xy.
V2 · 2
Truth table of an expression · 5 pt
Find T(E) for E = (xy + z′)(x + y′z′)′ + (xy′ + z)′(yz′)′ + x′y + x′yz′.
x ∈ (A ∩ B)′ ⟺ x ∉ A ∩ B ⟺ ¬(x ∈ A ∧ x ∈ B) ⟺ x ∉ A ∨ x ∉ B ⟺ x ∈ A′ ∨ x ∈ B′ ⟺ x ∈ A′ ∪ B′.
So the two sets have the same elements. ∎
V2 · 6
Quantifiers · 2 pt
6.1 The negation of ∃x ∀y ∀z P(x, y, z) is
∀x ∀y ∀z ¬P(x, y, z)
∀x ∃y ∃z ¬P(x, y, z)
∃x ∃y ∃z ¬P(x, y, z)
∀x ∃y ∀z ¬P(x, y, z)
¬∃x ∀y ∀z P = ∀x ¬∀y ∀z P = ∀x ∃y ¬∀z P = ∀x ∃y ∃z ¬P.
6.2 Over the integers, what are the truth values?
∀x(x < −55)x = 0 is a counterexample.
∃!x(x³ = 1)Only x = 1.
∃!x(4x² + 5 = 1)x² = −1 has no solution.
∃x(7x = 4x + 1)x = 1/3 is not an integer.
V2 · 7
Rational points of the plane · 2 pt
Prove that the set of all points of the plane with rational coordinates is countable.
Model proof
The set is A = ℚ × ℚ. For each a ∈ ℚ let Bₐ = {(a, y) : y ∈ ℚ}. The map y ↦ (a, y) is a bijection ℚ → Bₐ, so each Bₐ is countable. Every point (x, y) lies in exactly one of them, Bₓ, so A = ⋃a∈ℚ Bₐ, a union of countably many countable sets. Hence A is countable; it is infinite, since it contains B₀. ∎
Past exam · Midterm 1, 19 October 2024 · 27 points
Midterm 1 practice (Fall 2024)
The Fall 2024 Midterm 1 had two variants, each with seven tasks: K-map circuit design, a truth table from an expression, an MSoP from a truth table, two 4-variable K-maps, quantifiers, a proof about infinite or countable sets, and a De Morgan proof. In both variants Task 3 uses the same truth table as Task 1. It is marked the same way as the Fall 2025 midterm.
(A) Two full rows make an 8-square block. The rest are 4-square blocks in the t′ columns. (B) yz′ is a 2×2 block; the corners z′t′ wrap around.
Answer
(A) One minimal sum: E = y + zt′ + xt′.
(B) One minimal sum: E = yz′ + z′t′ + x′zt + xy′t′ (4 products, 10 literals).
V1 · 5
Quantifiers · 3 pt
5.1 The negation of ∀x ∀y ∃z P(x, y, z) is
∃x ∃y ∀z ¬P(x, y, z)
∀x ∀y ∀z ¬P(x, y, z)
∃x ∃y ∃z ¬P(x, y, z)
∀x ∀y ∃z ¬P(x, y, z)
¬∀x ∀y ∃z P = ∃x ¬∀y ∃z P = ∃x ∃y ¬∃z P = ∃x ∃y ∀z ¬P.
5.2 Over the integers, what are the truth values?
∀x(x > 2)x = 0 is a counterexample.
∃!x(x² = 1)Two solutions: x = 1 and x = −1.
∃!x(x² = −1)No integer has a negative square.
∃x(x = 4x + 1)x = −1/3 is not an integer.
V1 · 6
Infinite sets · 2 pt
Prove that every infinite set is equivalent to one of its proper subsets.
Hint
Every infinite set contains a countable subset {a₁, a₂, a₃, …}. Shift it into its odd-numbered elements and leave everything else where it is.
Model proof
Let M be infinite. It contains a countable subset A = {a₁, a₂, a₃, …} with all aₙ distinct. Split it as A₁ = {a₁, a₃, a₅, …} and A₂ = {a₂, a₄, a₆, …}.
Define f : M → M ∖ A₂ by f(aₙ) = a₂ₙ₋₁ on A and f(x) = x for x ∈ M ∖ A. It maps A one-to-one onto A₁ and fixes M ∖ A, so it is a bijection from A ∪ (M ∖ A) = M onto A₁ ∪ (M ∖ A) = M ∖ A₂.
So M ∼ M ∖ A₂, and M ∖ A₂ is a proper subset of M because a₂ ∉ M ∖ A₂. ∎
V1 · 7
De Morgan for union · 1 pt
Let A, B ⊆ S. Prove (A ∪ B)′ = A′ ∩ B′.
Model proof
For every x ∈ S:
x ∈ (A ∪ B)′ ⟺ x ∉ A ∪ B ⟺ ¬(x ∈ A ∨ x ∈ B) ⟺ x ∉ A ∧ x ∉ B ⟺ x ∈ A′ ∧ x ∈ B′ ⟺ x ∈ A′ ∩ B′.
So the two sets have the same elements. ∎
Variant 2
V2 · 1
Minimal AND–OR circuit · 4 pt
Design a three-input minimal AND–OR circuit L with truth table T[x, y, z; L] = [00001111, 00110011, 01010101; 01011011].
Hint
Positions 2, 4, 5, 7, 8. Two pairs are forced; the last square has two possible partners.
Solution
Step 1: L = x′y′z + x′yz + xy′z′ + xyz′ + xyz.
Steps 2–3: x′z (x′y′z + x′yz) and xz′ (xy′z′ + xyz′) are essential. xyz is left; it pairs with xyz′ (xy) or with x′yz (yz):
L = xz′ + x′z + xy or L = xz′ + x′z + yz
V2 · 2
Truth table of an expression · 5 pt
Find T(E) for E = ((x + y)′ + z)′(x′ + yz′)′ + (xy + z′)′(yz′) + x′z + x′yz′.
Hint
Apply De Morgan twice to the first factor: ((x + y)′ + z)′ = (x + y)z′. In the second product, look at z against z′.
(A) needs five products; three of them are 2×2 blocks. (B) needs three: the row xy′ and two 2×2 blocks in the y rows.
Answer
(A) One minimal sum: E = xz′ + yz′ + y′t + xyt′ + x′y′z (5 products, 12 literals).
The solution sheet gives xz′ + yz′ + z′t + y′t + x′y′z + xyt′. That sum is equivalent, but z′t is redundant: its four squares are already covered by y′t, yz′ and xz′. Drop it to get the minimal sum.
(B) One minimal sum: E = xy′ + yz′ + yt.
V2 · 5
Quantifiers · 3 pt
5.1 The negation of ∀x ∃y ∃z P(x, y, z) is
∀x ∀y ∀z ¬P(x, y, z)
∃x ∃y ∃z ¬P(x, y, z)
∀x ∃y ∃z ¬P(x, y, z)
∃x ∀y ∀z ¬P(x, y, z)
¬∀x ∃y ∃z P = ∃x ¬∃y ∃z P = ∃x ∀y ¬∃z P = ∃x ∀y ∀z ¬P.
5.2 Over the integers, what are the truth values?
∀x(x is odd)x = 2 is a counterexample.
∃!x(x² = 4)Two solutions: x = 2 and x = −2.
∃!x(x² = −4)No integer has a negative square.
∃x(x = 6x + 1)x = −1/5 is not an integer.
V2 · 6
Rational intervals · 2 pt
Prove that the set of all rational intervals on the line ℝ is countable. (An interval is rational if both its end points are rational.)
Hint
Fix the left end point r₁. How many intervals start there? Then let r₁ run through ℚ.
Model proof
An interval is determined by its end points, so the set is A = {(r₁, r₂) : r₁, r₂ ∈ ℚ, r₁ < r₂}.
For each r₁ ∈ ℚ let A(r₁) = {(r₁, r₂) : r₂ ∈ ℚ, r₂ > r₁}. The map (r₁, r₂) ↦ r₂ is a bijection from A(r₁) onto {q ∈ ℚ : q > r₁}, an infinite subset of the countable set ℚ. So each A(r₁) is countable.
Every interval lies in exactly one family, so A = ⋃r₁∈ℚ A(r₁): a union of countably many countable sets. Hence A is countable. ∎
The same argument works for closed or half-open intervals: each kind is countable, and a union of four countable sets is countable.
V2 · 7
De Morgan for intersection · 1 pt
Let A, B ⊆ S. Prove (A ∩ B)′ = A′ ∪ B′.
Model proof
For every x ∈ S:
x ∈ (A ∩ B)′ ⟺ x ∉ A ∩ B ⟺ ¬(x ∈ A ∧ x ∈ B) ⟺ x ∉ A ∨ x ∉ B ⟺ x ∈ A′ ∨ x ∈ B′ ⟺ x ∈ A′ ∪ B′.
So the two sets have the same elements. ∎
Past exam · Midterm 1, 14 October 2023 · 25 points
Midterm 1 practice (Fall 2023)
One variant with seven tasks. Five of them match the later exams: K-map circuit design, a truth table, an MSoP from a truth table, two 4-variable maps, and quantifiers. The other two are different: a minimum spanning tree with Prim's algorithm, and the polynomial countability proof that came back in Fall 2025. Tasks 1 and 3 use the same truth table.
Use Prim's algorithm to find a minimum spanning tree in the graph. Press the edges in the order Prim's algorithm adds them; each choice is checked.
Hint
Start with any edge of weight 1. At every step, list the edges with exactly one end in the tree and take a lightest one. 12 vertices means 11 edges.
Solution
The sheet's order, starting from {e, f}:
Choice
Edge
Weight
1
{e, f}
1
2
{e, i}
1
3
{i, j}
2
4
{f, b}
2
5
{b, a}
2
6
{f, g}
3
7
{g, k}
1
8
{k, m}
1
9
{g, h}
2
10
{h, d}
1
11
{d, c}
2
Total weight 18. At step 6 the tree is {a, b, e, f, i, j} and both {f, g} and {j, k} leave it with weight 3. Either choice gives a minimum spanning tree of weight 18.
Task 6
Quantifiers · 2 pt
6.1 The negation of ∃x ∀y ∀z P(x, y, z) is
∀x ∀y ∀z ¬P(x, y, z)
∀x ∃y ∃z ¬P(x, y, z)
∃x ∃y ∃z ¬P(x, y, z)
∀x ∃y ∀z ¬P(x, y, z)
¬∃x ∀y ∀z P = ∀x ¬∀y ∀z P = ∀x ∃y ¬∀z P = ∀x ∃y ∃z ¬P.
6.2 Over the integers, what are the truth values?
∀x(x < 1)x = 1 is a counterexample.
∃!x(x⁵ = −1)Only x = −1.
∃!x(2x + 3 = 1)Only x = −1.
∃x(x = 4x + 1)x = −1/3 is not an integer.
Task 7
Polynomials with rational coefficients · 2 pt
Using “a finite or countable union of countable sets is countable”, prove that the set of all polynomials with rational coefficients is countable.
Hint
Split the set by degree, and show each piece is countable by induction on the degree.
Model proof
This is the same task as Fall 2025, Variant 1, Task 7; the model proof is there. In short: let Bₙ be the polynomials of degree at most n. B₀ = ℚ is countable, and Bₙ = ⋃a∈ℚ {a xⁿ + q : q ∈ Bₙ₋₁} is a countable union of countable sets. So every Bₙ is countable, and the set of all polynomials, ⋃ₙ Bₙ, is countable too. ∎
The practice sheet handed out before the Fall 2023 midterm. It has six tasks of the same kinds, slightly shorter, including a second Prim's algorithm graph.
Steps 2–3: the whole x row and the four z squares are two 4-square blocks, so L = x + z. The circuit is a single OR gate with inputs x and z; no AND gates are needed.
Task 2
Truth table of an expression · 4 pt
Find T(E) for E = (x′y′ + z)′yz′ + (x′z + y)′(y′z + x) + x′z + xy′z′. Step 1: an SoP form (2 pt). Step 2: the CSoP form (1 pt). Step 3: T(E) (1 pt).
Hint
(x′y′ + z)′ = (x + y)z′ and (x′z + y)′ = (x + z′)y′. Finish with absorption.
(A) needs five products, four of them 2×2 blocks. (B) needs four; two of the blocks wrap around the edges of the map.
Answer
(A) One minimal sum: E = x′y + x′z + yz + yt + xy′z′ (5 products, 11 literals).
(B) One minimal sum: E = x′z + y′z′ + y′t′ + xyt (4 products, 9 literals).
The sheet counts 12 literals for (A); the sum it gives has 11.
Task 6
Quantifiers · 5 pt
6.1 The negation of ∀x ∃y ∀z P(x, y, z) is
∃x ∃y ∃z ¬P(x, y, z)
∀x ∃y ∀z ¬P(x, y, z)
∃x ∀y ∃z ¬P(x, y, z)
∃x ∀y ∀z ¬P(x, y, z)
¬∀x ∃y ∀z P = ∃x ¬∃y ∀z P = ∃x ∀y ¬∀z P = ∃x ∀y ∃z ¬P.
6.2 Over the integers, what are the truth values?
∃!x(x > 1)2, 3, 4, … all work: not unique.
∃!x(x² = 1)Two solutions: x = 1 and x = −1.
∃!x(x + 3 = 2x)Only x = 3.
∃!x(x = x + 1)It would need 0 = 1: no solution.
Proof practice · Lectures 1–5 · easy to hard
Proofs, step by step
Every midterm so far ends with proofs: De Morgan's laws, countability, infinite sets. This section collects the proofs of the course in seven levels, from one-line arguments to Cantor's theorem. Most come from the theorems and exercises in the lecture notes; a few come from other discrete-structures courses (credited where they appear). Try each one on paper first, then open the model proof. Some problems are puzzles: put the steps of the proof in the right order. Others show a wrong “proof” and ask you to find the broken step.
Proof toolbox
Two sets are equal (X = Y): take any x and show x ∈ X ⟹ x ∈ Y and x ∈ Y ⟹ x ∈ X, or write one chain of ⟺. Or rewrite one side into the other with the laws of the algebra of sets.
A subset (X ⊆ Y): “Let x ∈ X. … Hence x ∈ Y.”
Not true in general: one counterexample with concrete sets (or numbers) is a complete proof.
Logical equivalence: a chain of laws from Table 14, or a truth table. Quantifiers: show that each side being true forces the other to be true, for every domain and every predicate.
Boolean algebra: use only the axioms [B1]–[B4] and laws already proved, and name one in every step. Prove one law; its dual follows by duality.
Countable: an explicit bijection with ℤ⁺, or Theorem 10 (an infinite subset of a countable set is countable), or Theorem 11 (a finite or countable union of countable sets is countable). Uncountable: assume a list exists and build an element that is not on it (diagonal argument), or find an uncountable subset.
Marking: the exam wants a proof, “not an explanation”. Start from what is given, justify each step, and end with what was to be proved (∎).
Level 1 · Warm-up: one-line proofs
P1
Intersection and union
Prove that for any sets A, B: A ∩ B ⊆ A ⊆ A ∪ B. (Theorem 3, Lecture 1.)
Model proof
Let x ∈ A ∩ B. Then x ∈ A and x ∈ B; in particular x ∈ A. So A ∩ B ⊆ A.
Let x ∈ A. Then the statement “x ∈ A or x ∈ B” is true, so x ∈ A ∪ B. So A ⊆ A ∪ B. ∎
P2
Difference as an intersection
Prove that B ∖ A = B ∩ A′. (Solved problem 1.4, Lecture 1.)
Model proof
x ∈ B ∖ A ⟺ x ∈ B ∧ x ∉ A ⟺ x ∈ B ∧ x ∈ A′ ⟺ x ∈ B ∩ A′.
The steps use the definitions of difference, complement and intersection. Both sets have the same elements. ∎
This identity is the most useful tool for differences: it turns every ∖ into ∩ and ′, so the laws of Table 1 apply.
P3
Absorption laws
Prove that A ∪ (A ∩ B) = A and A ∩ (A ∪ B) = A. (Exercise 2.4, Lecture 1.)
Hint
Two inclusions. One of them is P1.
Model proof
⊆: let x ∈ A ∪ (A ∩ B). Then x ∈ A or x ∈ A ∩ B. In the second case also x ∈ A. So x ∈ A either way.
⊇: A ⊆ A ∪ (A ∩ B) by P1. So A ∪ (A ∩ B) = A.
Second law: A ∩ (A ∪ B) ⊆ A by P1. If x ∈ A, then x ∈ A ∪ B (P1), so x ∈ A ∩ (A ∪ B). ∎
P4
Equivalences by the laws of logic
Using the laws of Table 14 (no truth tables), prove (a) ¬(p → q) ≡ p ∧ ¬q; (b) (p ∧ q) → (p ∨ q) is a tautology. (Examples 19 and 21, Lectures 2–3.)
Hint
Start with p → q ≡ ¬p ∨ q. In (b), regroup so that p meets ¬p.
Prove (A − B) − C = (A − C) − (B − C). (From UC Davis ECS 20 homework.)
Hint
Start from the right side, write membership as a proposition, apply De Morgan, distribute, and one term becomes x ∈ C ∧ x ∉ C, which is false.
Model proof
x ∈ (A − C) − (B − C) ⟺ (x ∈ A ∧ x ∉ C) ∧ ¬(x ∈ B ∧ x ∉ C)
⟺ (x ∈ A ∧ x ∉ C) ∧ (x ∉ B ∨ x ∈ C)
⟺ (x ∈ A ∧ x ∉ C ∧ x ∉ B) ∨ (x ∈ A ∧ x ∉ C ∧ x ∈ C)
⟺ (x ∈ A ∧ x ∉ B ∧ x ∉ C) ∨ F ⟺ x ∈ (A − B) − C.
Definitions, De Morgan, distributive law, negation and identity laws. ∎
P10
Taking away and putting back
(a) Show that in general (A − B) ∪ B ≠ A. (b) Prove (A − B) ∪ B = A ∪ B. (c) Deduce that (A − B) ∪ B = A exactly when B ⊆ A. (Exercise 2.5, Lecture 1.)
Model proof
(a) Counterexample: A = {1}, B = {2}. Then (A − B) ∪ B = {1} ∪ {2} = {1, 2} ≠ A.
(b) (A − B) ∪ B = (A ∩ B′) ∪ B = (A ∪ B) ∩ (B′ ∪ B) = (A ∪ B) ∩ U = A ∪ B (P2, distributive, complement, identity).
(c) By (b), (A − B) ∪ B = A ⟺ A ∪ B = A ⟺ B ⊆ A, by P6 with the roles of A and B swapped. ∎
P11
Distributive law, by elements
Prove A ∩ (B ∪ C) = (A ∩ B) ∪ (A ∩ C) by an element argument. (One of the two laws proved in Theorem 6, Lecture 1.)
Model proof
x ∈ A ∩ (B ∪ C) ⟺ x ∈ A ∧ (x ∈ B ∨ x ∈ C) ⟺ (x ∈ A ∧ x ∈ B) ∨ (x ∈ A ∧ x ∈ C) ⟺ x ∈ (A ∩ B) ∨ x ∈ (A ∩ C) ⟺ x ∈ (A ∩ B) ∪ (A ∩ C).
The second step is the distributive law of propositions; the others are definitions. ∎
Notice the pattern: every law of sets is the matching law of logic applied to the statements “x ∈ A”, “x ∈ B”, “x ∈ C”.
P12
Find the flaw: a union minus a set
A student claims (A ∪ B) − B = A for all sets and writes:
(1) x ∈ (A ∪ B) − B ⟺ x ∈ A ∪ B ∧ x ∉ B (2) ⟺ (x ∈ A ∨ x ∈ B) ∧ x ∉ B (3) ⟺ x ∈ A.
Which step is wrong?
Step (1)
Step (2)
Step (3)
None: the claim is true
Step (3) drops the condition x ∉ B. Correctly, (x ∈ A ∨ x ∈ B) ∧ x ∉ B ⟺ x ∈ A ∧ x ∉ B, so (A ∪ B) − B = A − B. Counterexample to the claim: A = B = {1} gives (A ∪ B) − B = ∅ ≠ A. The claim holds only when A ∩ B = ∅.
P13
Always true or not?
For each statement, decide whether it holds for all sets. If it does, prove it; if not, find a counterexample.
A − (B ∪ C) = (A − B) ∩ (A − C)A ∩ (B ∪ C)′ = A ∩ B′ ∩ C′ = (A ∩ B′) ∩ (A ∩ C′) (De Morgan, idempotent law).
A − (B − C) = (A − B) − CA = C = {1}, B = ∅: left side {1}, right side ∅.
P(A ∩ B) = P(A) ∩ P(B)X ⊆ A ∩ B ⟺ X ⊆ A ∧ X ⊆ B.
P(A ∪ B) = P(A) ∪ P(B)A = {1}, B = {2}: {1, 2} is in the left side only.
A ⊆ B ⟹ B′ ⊆ A′If x ∉ B, then x ∉ A; otherwise x ∈ A ⊆ B.
Level 3 · Logic and quantifiers
P14
De Morgan for quantifiers
Prove ¬∀x P(x) ≡ ∃x ¬P(x), then deduce ¬∃x P(x) ≡ ∀x ¬P(x). (Theorems 7 and 8, Lectures 2–3.)
Model proof
Fix any domain and any predicate P. ¬∀x P(x) is true ⟺ ∀x P(x) is false ⟺ there is an a in the domain with P(a) false ⟺ there is an a with ¬P(a) true ⟺ ∃x ¬P(x) is true. Both sides always have the same truth value.
For the second law, apply the first to the predicate ¬P: ¬∀x ¬P(x) ≡ ∃x ¬¬P(x) ≡ ∃x P(x). Negating both sides gives ∀x ¬P(x) ≡ ¬∃x P(x). ∎
(⟹) Suppose ∀x(P(x) ∧ Q(x)) is true. Let a be any element of the domain. Then P(a) ∧ Q(a) is true, so P(a) is true and Q(a) is true. As a was arbitrary, ∀x P(x) and ∀x Q(x) are both true.
(⟸) Suppose ∀x P(x) and ∀x Q(x) are true. For any a, P(a) and Q(a) are true, so P(a) ∧ Q(a) is true. Hence ∀x(P(x) ∧ Q(x)). ∎
P16
Where the quantifier laws stop
Show that (a) ∀x P(x) ∨ ∀x Q(x) and ∀x(P(x) ∨ Q(x)) are not equivalent; (b) ∃x P(x) ∧ ∃x Q(x) and ∃x(P(x) ∧ Q(x)) are not equivalent. (Exercises 2.16 and 2.17, Lectures 2–3.)
Hint
One domain and one pair of predicates works for both: integers, “x is even”, “x is odd”.
Model proof
Domain ℤ, P(x): “x is even”, Q(x): “x is odd”.
(a) ∀x(P(x) ∨ Q(x)) is true: every integer is even or odd. But ∀x P(x) is false (x = 1) and ∀x Q(x) is false (x = 2), so ∀x P(x) ∨ ∀x Q(x) is false.
(b) ∃x P(x) (take 2) and ∃x Q(x) (take 1) are true, so the left side is true. No integer is both even and odd, so ∃x(P(x) ∧ Q(x)) is false. ∎
One direction does hold in each case: ∀x P ∨ ∀x Q ⟹ ∀x(P ∨ Q) and ∃x(P ∧ Q) ⟹ ∃x P ∧ ∃x Q.
The first step is P14; the second is P4(a) applied inside the quantifier. ∎
In words: “not every P is a Q” means “some P is not a Q”.
P18
Proof by contradiction: chaining implications
Prove that [(p → q) ∧ (q → r)] → (p → r) is a tautology without a truth table.
Hint
An implication is false only when its premise is true and its conclusion is false. Assume that happens.
Model proof
Suppose that for some truth values the proposition is false. Then its premise (p → q) ∧ (q → r) is true and its conclusion p → r is false. From the conclusion, p is true and r is false. Since p is true and p → q is true, q is true. Since q is true and q → r is true, r is true. That contradicts “r is false”. So the proposition is never false: it is a tautology. ∎
Level 4 · Functions, images and preimages
P19
Compositions
Let f : X → Y and g : Y → Z. Prove: (a) if f, g are injective, so is g ∘ f; (b) if f, g are surjective, so is g ∘ f. Deduce that equivalence of sets is transitive: X ∼ Y and Y ∼ Z give X ∼ Z.
Model proof
(a) Let (g ∘ f)(x₁) = (g ∘ f)(x₂), i.e. g(f(x₁)) = g(f(x₂)). Since g is injective, f(x₁) = f(x₂); since f is injective, x₁ = x₂.
(b) Let z ∈ Z. Since g is onto, z = g(y) for some y ∈ Y; since f is onto, y = f(x) for some x ∈ X. Then (g ∘ f)(x) = z.
If f : X → Y and g : Y → Z are bijections, then by (a) and (b) g ∘ f : X → Z is a bijection, so X ∼ Z. ∎
P20
Puzzle: preimage of a union
Put the steps of the proof of f⁻¹(A ∪ B) = f⁻¹(A) ∪ f⁻¹(B) in order. (Theorem 7, Lecture 1. The same chain with ∧ proves Theorem 8, f⁻¹(A ∩ B) = f⁻¹(A) ∩ f⁻¹(B).)
Let f : X → Y, A, B ⊆ Y, and let x ∈ X.
x ∈ f⁻¹(A ∪ B) ⟺ f(x) ∈ A ∪ B (definition of preimage)
⟺ f(x) ∈ A ∨ f(x) ∈ B (definition of union)
⟺ x ∈ f⁻¹(A) ∨ x ∈ f⁻¹(B) (definition of preimage)
⟺ x ∈ f⁻¹(A) ∪ f⁻¹(B) (definition of union)
So both sets have the same elements. ∎
P21
Complements: preimage yes, image no
Let f : X → Y, B ⊆ Y. (a) Prove f⁻¹(Y − B) = X − f⁻¹(B). (b) Is f(X − A) = Y − f(A) for every A ⊆ X? Prove it or give a counterexample. (Exercise 2.8, Lecture 1.)
Model proof
(a) For x ∈ X: x ∈ f⁻¹(Y − B) ⟺ f(x) ∈ Y − B ⟺ f(x) ∉ B ⟺ x ∉ f⁻¹(B) ⟺ x ∈ X − f⁻¹(B). ∎
(b) No. Let X = {1, 2}, Y = {a, b}, f(1) = f(2) = a, A = {1}. Then f(X − A) = f({2}) = {a}, but Y − f(A) = {a, b} − {a} = {b}.
The equality does hold when f is a bijection: injectivity gives f(X − A) ⊆ Y − f(A) and surjectivity gives ⊇.
P22
Images of unions and intersections
Prove f(A ∪ B) = f(A) ∪ f(B) (Theorem 9, Lecture 1) and f(A ∩ B) ⊆ f(A) ∩ f(B). Show that the second inclusion can be strict.
Model proof
y ∈ f(A ∪ B) ⟺ ∃x ∈ A ∪ B with f(x) = y ⟺ (∃x ∈ A with f(x) = y) ∨ (∃x ∈ B with f(x) = y) ⟺ y ∈ f(A) ∪ f(B). The middle step is “∃ distributes over ∨”.
If y ∈ f(A ∩ B), then y = f(x) with x ∈ A and x ∈ B, so y ∈ f(A) and y ∈ f(B).
Strict: f(x) = x² on ℝ, A = {−1}, B = {1}. Then f(A ∩ B) = f(∅) = ∅ but f(A) ∩ f(B) = {1}. ∎
P23
Find the flaw: image of an intersection
A “proof” that f(A) ∩ f(B) ⊆ f(A ∩ B):
(1) Let y ∈ f(A) ∩ f(B). (2) Then y ∈ f(A) and y ∈ f(B). (3) So y = f(x) for some x ∈ A, and y = f(x) for some x ∈ B. (4) Hence y = f(x) with x ∈ A ∩ B, so y ∈ f(A ∩ B).
Where does it go wrong?
Step (2): the definition of intersection is misused
Step (3): y ∈ f(A) does not mean y = f(x) for some x ∈ A
Nowhere: the inclusion is true
Step (4): the two elements called x may be different
Step (3) should say y = f(x₁) with x₁ ∈ A and y = f(x₂) with x₂ ∈ B. Nothing forces x₁ = x₂ unless f is injective. P22 gives a counterexample. Using one letter for two different objects is a classic error.
Level 5 · Boolean algebra from the axioms
The axioms (Lectures 4–5)
[B1] commutative: a + b = b + a, ab = ba
[B2] distributive: a + bc = (a + b)(a + c), a(b + c) = ab + ac
[B3] identity: a + 0 = a, a · 1 = a
[B4] complement: a + a′ = 1, aa′ = 0
Nothing else may be used unless it has already been proved from these. In particular, a truth table is not a proof here: an arbitrary Boolean algebra need not be {0, 1}.
P24
Puzzle: idempotent law
Put the steps of the proof of aa = a (B5b) in order. Then a + a = a follows by duality.
a = a · 1 [B3b]
= a(a + a′) [B4a]
= aa + aa′ [B2b]
= aa + 0 [B4b]
= aa [B3a] ∎
P25
Boundedness and absorption
From the axioms, prove (a) a · 0 = 0 (B6b); (b) a(a + b) = a (B7b). State the duals.
Hint
(a) Write a0 as a0 + aa′. (b) Write the first a as a + 0, then use [B2a] backwards.
Using P27, prove (a′)′ = a (B10) and 0′ = 1, 1′ = 0 (B11).
Model proof
By [B4] and [B1], a′ + a = 1 and a′a = 0. So a satisfies the two conditions of a complement of a′, and by P27, a = (a′)′.
0 + 1 = 1 + 0 = 1 [B1, B3a] and 0 · 1 = 0 [B3b]. So 1 is a complement of 0: 0′ = 1 by P27. By duality, 1′ = 0. ∎
P29
De Morgan in a Boolean algebra
Prove (a + b)′ = a′b′ (Theorem 7, Lectures 4–5; left as an exercise there). You may use the laws B5–B9.
Hint
Use uniqueness (P27): it is enough to show (a + b) + a′b′ = 1 and (a + b) · a′b′ = 0.
Model proof
Sum: (a + b) + a′b′ = ((a + b) + a′)((a + b) + b′) [B2a]. Here (a + b) + a′ = (a + a′) + b = 1 + b = 1 [B1, B8a, B4a, B6a], and (a + b) + b′ = a + (b + b′) = a + 1 = 1 [B8a, B4a, B6a]. So the sum is 1 · 1 = 1.
Prove that f : ℤ → ℤ⁺, f(n) = 2n + 1 for n ≥ 0 and f(n) = 2|n| for n < 0, is a bijection. (Example 14, Lecture 1.)
Model proof
Well defined: for n ≥ 0, 2n + 1 ≥ 1 is odd; for n < 0, 2|n| ≥ 2 is even. So f(n) ∈ ℤ⁺.
Injective: an odd value never equals an even value, so if f(n) = f(m) then n, m have the same sign. If both are ≥ 0, 2n + 1 = 2m + 1 gives n = m; if both are negative, 2|n| = 2|m| gives n = m.
Surjective: an odd k is f((k − 1)/2) with (k − 1)/2 ≥ 0; an even k is f(−k/2) with −k/2 < 0. ∎
P32
Subsets of countable sets
Using Theorem 10 (“every subset of a countable set is finite or countable”), prove that the set of prime numbers and the set of perfect squares are countable.
Model proof
Both are subsets of the countable set ℤ⁺, so each is finite or countable. Neither is finite. For the squares, n ↦ n² is injective on ℤ⁺. For the primes, suppose there were only finitely many, p₁, …, pₖ. Then N = p₁p₂⋯pₖ + 1 leaves remainder 1 when divided by every pᵢ, so any prime factor of N is a new prime, a contradiction (Euclid). Hence both sets are countable. ∎
P33
Pairs of positive integers
Prove that g : ℤ⁺ × ℤ⁺ → ℤ⁺, g(m, n) = 2ᵐ⁻¹(2n − 1), is a bijection. Hence ℤ⁺ × ℤ⁺ is countable.
Hint
Every positive integer can be written in exactly one way as a power of 2 times an odd number.
Model proof
Surjective: let k ∈ ℤ⁺. Divide k by 2 as often as possible: k = 2ᵃ · q with a ≥ 0 and q odd. Put m = a + 1 and n = (q + 1)/2; then g(m, n) = k.
Injective: if 2ᵐ⁻¹(2n − 1) = 2ᵐ′⁻¹(2n′ − 1) and, say, m > m′, divide by 2ᵐ′⁻¹: the left side is even and the right side is odd, which is impossible. So m = m′, and then 2n − 1 = 2n′ − 1 gives n = n′. ∎
This replaces the diagonal picture (4.2) in the proof of Theorem 11 with a formula.
P34
The rationals, via Theorem 11
Give a proof that ℚ is countable using Theorem 11 instead of “heights” (Example 17).
Model proof
For each q ∈ ℤ⁺ let Q_q = {p/q : p ∈ ℤ}. The map p ↦ p/q is a bijection ℤ → Q_q, so each Q_q is countable (P31 and transitivity, P19). Every rational can be written with a positive denominator, so ℚ = ⋃q∈ℤ⁺ Q_q: a countable union of countable sets. By Theorem 11, ℚ is countable. ∎
The sets Q_q overlap (1/1 = 2/2); Theorem 11 allows that, as its proof first makes the sets disjoint.
P35
Algebraic numbers
A number is algebraic if it is a root of a nonzero polynomial with rational coefficients. Prove that the set of algebraic numbers is countable. (Exercise 2.12, Lecture 1.)
Hint
Polynomials with rational coefficients form a countable set (midterm proof), and a nonzero polynomial of degree n has at most n roots.
Model proof
Let 𝒫 be the set of nonzero polynomials with rational coefficients; it is countable (a subset of a countable set, infinite). For P ∈ 𝒫 let R(P) be its set of roots; it is finite (at most deg P elements). The set of algebraic numbers is 𝔸 = ⋃P∈𝒫 R(P), a countable union of finite sets, so it is finite or countable: list the polynomials as P₁, P₂, …, then list the roots of P₁, then those of P₂, and so on, skipping repeats. It is infinite, because every rational r is the root of t − r. Hence 𝔸 is countable. ∎
P36
Adding a countable set changes nothing
Let M be infinite and A countable. Prove M ∪ A ∼ M. (Exercise 2.15*, Lecture 1.)
Hint
Copy the idea of Theorem 13: find a countable C ⊆ M (Theorem 12), map C ∪ A onto C, and leave the rest of M fixed.
Model proof
Let A₀ = A − M; then M ∪ A = M ∪ A₀ with M ∩ A₀ = ∅, and A₀ is finite or countable (Theorem 10). If A₀ = ∅ there is nothing to prove.
By Theorem 12, M has a countable subset C. Then C ∪ A₀ is countable (Theorem 11; a finite set can be listed first). So there is a bijection g : C ∪ A₀ → C, since both are countable.
Define h : M ∪ A₀ → M by h(x) = g(x) for x ∈ C ∪ A₀ and h(x) = x for x ∈ M − C. The two parts C ∪ A₀ and M − C partition M ∪ A₀, their images C and M − C partition M, and h is a bijection on each part. So h is a bijection and M ∪ A ∼ M. ∎
P37
Find the flaw: listing infinite sequences
“The set S of all infinite sequences of 0s and 1s is countable: list first the sequences that start with 0, then those that start with 1. Within each group, order by the second digit, and so on. Every sequence gets a place in the list.”
What is wrong with this argument?
Nothing: S is countable, by Theorem 11
“Every sequence gets a place” is never shown, and it is false: already the first group is infinite, so no sequence of the second group gets a finite position
The groups overlap, so the list has repetitions
Sequences of 0s and 1s are finite, so the list is finite
A list must give every element a finite position 1, 2, 3, …. “Sort by first digit, then second, …” is an infinite sorting that never finishes the first group. In fact S is uncountable: the diagonal argument (P40) applies word for word, flipping the n-th digit of the n-th sequence.
Level 7 · Uncountable sets and cardinality
P38
A set with an uncountable subset
Prove that a set with an uncountable subset is itself uncountable. (Exercise 2.17, Lecture 1.)
Model proof
Let B ⊆ M with B uncountable, and suppose M is not uncountable, i.e. M is finite or countable. If M is finite, so is its subset B. If M is countable, B is finite or countable by Theorem 10. Either way B is not uncountable, a contradiction. ∎
P39
Intervals and the real line
(a) For a < b and c < d, prove [a, b] ∼ [c, d] with an explicit bijection (Example 19 does it geometrically). (b) Prove (0, 1) ∼ ℝ.
Model proof
(a) f(x) = c + (d − c)(x − a)/(b − a) maps a ↦ c and b ↦ d, and is increasing, so it maps [a, b] into [c, d]. Its inverse g(y) = a + (b − a)(y − c)/(d − c) maps [c, d] into [a, b], and g(f(x)) = x, f(g(y)) = y. A function with a two-sided inverse is a bijection.
(b) h(x) = tan(π(x − ½)): as x runs over (0, 1), π(x − ½) runs over (−π/2, π/2), and tan is a bijection from there onto ℝ (Example 4). A composition of bijections is a bijection (P19). ∎
With P38: [0, 1] is uncountable (P40), so ℝ and every interval [c, d] are uncountable.
P40
Puzzle: Cantor's diagonal argument
Put the steps of the proof that [0, 1] is uncountable (Theorem 14, Lecture 1) in order. Using only the digits 4 and 5 avoids numbers with two decimal expansions, such as 0.1999… = 0.2000….
Assume the contrary: [0, 1] is countable, so its elements can be listed as α₁, α₂, α₃, …
Write each in decimal: αₙ = 0.aₙ₁aₙ₂aₙ₃…
Define β = 0.b₁b₂b₃… by bₙ = 5 if aₙₙ ≠ 5 and bₙ = 4 if aₙₙ = 5.
Then β ∈ [0, 1], and its expansion is the only one it has, because it contains no 0s or 9s.
For every n, β and αₙ differ in the n-th digit, so β ≠ αₙ.
So β is not in the list, which contradicts the assumption that the list contains all of [0, 1]. ∎
P41
Transcendental numbers exist, uncountably many
Prove that the set of real numbers that are not algebraic is uncountable. (Exercise 2.16*, Lecture 1.)
Model proof
Let 𝔸_ℝ be the real algebraic numbers and T = ℝ − 𝔸_ℝ. 𝔸_ℝ is countable (an infinite subset of the countable set in P35). Suppose T were finite or countable. Then ℝ = 𝔸_ℝ ∪ T would be countable by Theorem 11. But ℝ is uncountable (P39 with P38). So T is uncountable; in particular it is not empty. ∎
The proof shows that transcendental numbers exist without exhibiting a single one. Proving that a specific number such as π or e is transcendental is much harder.
P42
Closed and open intervals
Prove [0, 1] ∼ (0, 1) with an explicit bijection.
Hint
Two points too many. Make room in a countable sequence inside (0, 1), such as ½, ⅓, ¼, …, by shifting it two places, the same trick as in Theorem 13.
Model proof
Define h : [0, 1] → (0, 1): h(0) = ½, h(1) = ⅓, h(1/n) = 1/(n + 2) for n ≥ 2, and h(x) = x for every other x.
Let E = {1/n : n ≥ 2}. h maps {0, 1} ∪ E one-to-one onto E: 0, 1, ½, ⅓, … go to ½, ⅓, ¼, ⅕, …, which is all of E without repetition. It maps the rest, (0, 1) − E, identically onto itself. These two pieces partition [0, 1] and their images partition (0, 1), so h is a bijection. ∎
The same idea gives a general fact (from IIT Kharagpur CS60005 tutorial solutions): if A is uncountable and B ⊆ A is countable, then A − B ∼ A. Take a countable C = {c₁, c₂, …} ⊆ A − B and send bₙ ↦ c₂ₙ₋₁, cₙ ↦ c₂ₙ, everything else to itself.
P43
Cantor's theorem: |M| < |P(M)|
Prove that for every set M there is no surjection f : M → P(M), while there is an injection M → P(M). So the power set always has strictly larger cardinality. (Behind Exercise 2.18*, Lecture 1.)
Hint
Given f, look at the elements that do not belong to their own image: D = {x ∈ M : x ∉ f(x)}. Could D = f(d)?
Model proof
The map x ↦ {x} is injective, so |M| ≤ |P(M)|.
Let f : M → P(M) be any function and D = {x ∈ M : x ∉ f(x)} ∈ P(M). Suppose D = f(d) for some d ∈ M. If d ∈ D, then by the definition of D, d ∉ f(d) = D. If d ∉ D = f(d), then by the definition of D, d ∈ D. Both cases are impossible, so D is not in the image of f: no f is onto. Hence there is no bijection and |M| < |P(M)|. ∎
Exercise 2.18 follows: a function M → {0, 1} is the same as a subset of M (the set where it equals 1), so the set of all such functions has cardinality |P(M)| > |M|. Note that this is the diagonal argument again: D differs from f(x) at the element x.
P44
Challenge: the Cantor–Bernstein theorem
Let f : A → B and g : B → A be injections. Prove that A ∼ B (Theorem 16, Lecture 1). Then use it to give an indirect proof that [a, b] ∼ (a, b) (Exercise 2.18).
Hint
Points of A outside g(B) must be sent by f. So must everything reached from them by g ∘ f. Send all other points back with g⁻¹.
Model proof
Let C₀ = A − g(B), Cₙ₊₁ = g(f(Cₙ)), and C = C₀ ∪ C₁ ∪ C₂ ∪ ⋯. Define h : A → B by h(x) = f(x) for x ∈ C and h(x) = g⁻¹(x) for x ∉ C. The second case makes sense: x ∉ C₀ means x ∈ g(B), and g⁻¹(x) is unique because g is injective.
Injective. On C, h = f is injective; off C, h = g⁻¹ is injective. Suppose f(x) = g⁻¹(x′) with x ∈ Cₙ and x′ ∉ C. Then x′ = g(f(x)) ∈ Cₙ₊₁ ⊆ C, a contradiction.
Surjective. Let y ∈ B. If g(y) ∉ C, then h(g(y)) = g⁻¹(g(y)) = y. If g(y) ∈ C, then g(y) ∉ C₀ (it lies in g(B)), so g(y) ∈ Cₙ₊₁ = g(f(Cₙ)) for some n. That is, g(y) = g(f(x)) with x ∈ Cₙ, and since g is injective, y = f(x) = h(x). So h is a bijection. ∎
Application. The inclusion (a, b) → [a, b] is injective. So is x ↦ m + (x − m)/2 from [a, b] to (a, b), where m = (a + b)/2: it shrinks [a, b] to the middle half, [(3a + b)/4, (a + 3b)/4] ⊂ (a, b). By Cantor–Bernstein, [a, b] ∼ (a, b), without building the bijection by hand as in P42.
Read with care
Errata in the notes
Typos found while checking every example in the notes (version 4). None of them changes a method, but some can cost you time when you compare answers.
Lecture 1 · p. 13 · Theorem 4, last line of the proofIt reads “A ⊆ B, A ∪ B = A and A ∪ B = B are equivalent”; the middle condition should be A ∩ B = A.
Lecture 1 · p. 18 · Example 14The rule “n ↦ 2n + 1 if n > 0” should read n ≥ 0; otherwise 0 is never matched (it goes to 1).
Lectures 2–3 · p. 15 · Example 23“CS3 is on the list of computers under attack” should say it is not on the list, which is why P(CS3) is false.
Lectures 2–3 · p. 19 · Example 32(b)“∀xP(x) is the same as the disjunction” should say conjunction; the formula shown, with ∧, is right.
Lectures 2–3 · p. 24 · Example 36(b), Case 2b∀x(S(x) → (C(x) ∨ M(x))) should be ∀x(S(x) → (Sh(x) ∨ K(x))).
Lectures 2–3 · p. 24 · Example 37(d)By De Morgan, ∀x ¬(P(x) ∨ Q(x)) ≡ ∀x(¬P(x) ∧ ¬Q(x)), not ∀x(¬P(x) ∨ ¬Q(x)).
Lectures 2–3 · p. 25 · Example 39With Q(x) = “x drinks coffee” and R(x) = “x is fierce” as defined there, the translations are ∀x(P(x) → R(x)), ∃x(P(x) ∧ ¬Q(x)) and ∃x(R(x) ∧ ¬Q(x)). The printed formulas use the textbook's labels, where Q and R are swapped.
Lectures 2–3 · p. 27 · Example 43(b)The statement repeats ∃x∀y P(x, y), but the solution negates ∀x∀y P(x, y).
Lectures 4–5 · p. 18 · Example 15(a)C and D are printed with 20 bits; with 4 inputs they have 16: C = 0011001100110011, D = 0101010101010101.
Lectures 4–5 · p. 19 · Example 16It refers to “Example 13, Figure 13”; the circuit Y = ABC + AB′C + A′B is Example 1, Figure 5.
Lectures 4–5 · p. 25 · Exercise 1.13(b)The answer is printed as 0101000 (7 bits). The correct output is 00101000: positions 3 and 5 are the only ones where all inputs are 1.
Before the exam
Last-minute sheet
Sets
A = B ⟺ A ⊆ B and B ⊆ A
A ⊆ B ⟺ A ∩ B = A ⟺ A ∪ B = B
A ∖ B = A ∩ B′, A ⊕ B = (A ∖ B) ∪ (B ∖ A)
|P(S)| = 2ⁿ; n sets give 2ⁿ fundamental products
f(A ∩ B) ⊆ f(A) ∩ f(B) only
Functions and size
Each preimage has at most 1 (injective), at least 1 (onto), exactly 1 (bijective) element
Countable = can be listed; ℤ, ℚ are countable
[0, 1], ℝ are uncountable (diagonal argument)
ℵ₀ < c, |M| < |P(M)|
Infinite ⟺ equivalent to a proper subset
Connectives
p → q is false only for T → F
p → q ≡ ¬p ∨ q ≡ ¬q → ¬p
¬(p → q) ≡ p ∧ ¬q
p ↔ q ≡ (p ∧ q) ∨ (¬p ∧ ¬q), p ⊕ q ≡ ¬(p ↔ q)
“p only if q” is p → q
Quantifiers
¬∀x P ≡ ∃x ¬P, ¬∃x P ≡ ∀x ¬P
∀ goes with →, ∃ goes with ∧
Finite domain: ∀ is a big ∧, ∃ a big ∨
∀x∃y and ∃y∀x are different
Negate nested: flip every quantifier, negate the predicate