A set (集合) is a collection of things for which it is clearly decided whether each one meets a given condition.
Operation
Symbol
Elements collected
Union
A∪B
Elements in at least one of A and B
Intersection (common part)
A∩B
Elements in both A and B
Complement
A with a bar over it, etc.
Elements of the whole that are not in A
Each individual member of a set is an element, and when every element of set X is also in set Y, X is a subset of Y. From two sets you can form the union, which gathers the elements in either one, and the intersection, which gathers only the elements in both. The elements of the whole that are not in a given set form its complement.
AnalogyLike a club roster: whether your name is on it decides whether you are in. A group such as "tall people," with a vague standard, is not a set.
How to rememberRemember ∪ as the shape of U, the first letter of Union, and ∩ as that shape turned upside down.
Exam points
ExamFor any two sets (集合), every element of the intersection (積集合) is in each original set, and every element of an original set is in the union (和集合). Inclusion runs in the order "intersection ⊆ original set ⊆ union."
A Venn diagram (ベン図) draws sets as circles and shows how they relate through the circles' overlap and position.
Region (two circles)
Circle A
Circle B
Set represented
A-only part
Inside
Outside
Elements in A but not in B
Overlap
Inside
Inside
Intersection (A∩B)
B-only part
Outside
Inside
Elements in B but not in A
Part outside every circle
Outside
Outside
Complement of the union (A∪B)
The outer rectangle stands for the whole under consideration; inside a circle is that set, and outside is its complement. Two circles split the whole into 4 regions and three circles into 8, and each region is fixed uniquely by which circles it lies inside and which it lies outside. Turning a shaded region into words or an expression lets you check by eye how the conditions are put together.
AnalogyLike circling the areas of two towns on a map and treating the houses where the circles overlap as belonging to both towns.
How to rememberIt is named after the British logician John Venn, so the name is a person's, not a description.
Exam points
ExamTo turn a shaded region into a logical expression (論理式), check for each region whether it is inside or outside each circle, then combine the conditions, using the condition itself for inside and its negation (否定) for outside.
A truth table (真理値表) lists every combination the inputs can take, one per row, together with each output.
Write every input combination
Build the column inside the brackets
Apply the outer operation
Read the output column
The last column is the output, and the rows where it is 1 show what the expression does.
4 / 4
True is usually written as 1 and false as 0, and with n inputs the table has 2 to the power n rows. Because the table spells out an operation's behavior completely, two expressions that produce the same table behave the same way.
AnalogyFor a light with two switches, a list made by trying every on/off pattern and noting whether the bulb lights.
How to rememberA "truth value" is the value true or false, and the table is named for listing those values.
Exam points
ExamWhich operation a table shows is decided by the input combinations on the rows whose output is 1. If the output is 1 only on the row where all inputs are 1, it is the logical product (論理積).
ExamFor an expression with a negation (否定) outside the brackets, build the column for the result inside the brackets, then swap its 0s and 1s to get the table.
A logical operation (論理演算) is any operation that takes only the two values true (1) and false (0) as input and returns 1 or 0 by a fixed rule.
A
B
A AND B
A OR B
A XOR B
0
0
0
0
0
0
1
0
1
1
1
0
0
1
1
1
1
1
1
0
Typical operations include AND and OR, along with negation, which takes just one input. Expressions combining operations are evaluated from the innermost brackets outward and are used in search conditions and in bit-by-bit processing inside computers. The intersection, union, and complement of sets correspond to the logical product, logical sum, and negation, respectively.
AnalogyLike a clerk who answers only "yes" or "no" and, from the one or more answers received, returns a single "yes" or "no" by a fixed procedure.
How to rememberIt is also called a Boolean operation, after George Boole, the mathematician who systematized two-valued calculation.
Exam points
ExamIn a condition, group the acceptable alternatives for one field with OR inside brackets, then join that group to another field's condition with AND. This narrows the results while keeping every alternative.
AND (logical product, 論理積) is an operation whose output is 1 only when all inputs are 1.
A single 0 among the inputs makes the output 0, and in set terms it corresponds to the intersection, which gathers the elements in both sets. It is used to narrow results by joining conditions with "and," and to pick out only certain bits of data.
AnalogyA safe door that opens only when both keys are turned.
How to rememberIt is sometimes written ∧ or "·" (the multiplication dot), and its results match multiplying 0s and 1s.
Exam points
ExamIn a bitwise AND, positions where the other operand's bit is 0 become 0, and positions where it is 1 keep the original data's value.
ExamIf an AND output is joined with a further input by another AND, the final output is 1 only when every input is 1.
OR (logical sum, 論理和) is an operation whose output is 1 if any one input is 1.
The output is 0 only when every input is 0, and in set terms it corresponds to the union, which gathers the elements in either set. It joins conditions with "or" to widen the range of targets.
AnalogyA home arrival chime that rings whether you come in through the front door or the back door.
How to rememberIt is sometimes written ∨ or "+", and the only difference from ordinary addition is that 1 + 1 is also treated as 1.
Exam points
ExamThe count matching two conditions joined by OR is the sum of each condition's count minus the count that meets both.
NOT (negation, 否定) is an operation that swaps 0 and 1 for a single input.
It is a unary operation that takes a single input, unlike operations that combine two inputs. In set terms it corresponds to the elements not in a set, that is, the complement, and in a Venn diagram it is the region outside a circle.
AnalogyA button that switches between on and off each time you press it.
How to rememberApplying NOT twice in a row gives back the original value (the negation of a negation is an affirmation).
Exam points
ExamA NOT outside the brackets inverts the whole result inside them, so negating an OR result gives 1 only on the row where all inputs are 0.
XOR (exclusive OR, 排他的論理和) is an operation whose output is 1 only when the two inputs differ.
Whether both inputs are 0 or both are 1, matching values give an output of 0. Applying XOR twice with the same value restores the original, and XOR is also used for purposes such as error detection.
AnalogyThe wiring of a stair light with one switch at the top and one at the bottom. Flipping either switch toggles the light on or off.
How to remember"Exclusive" means shutting the other out: it accepts "only one" and excludes the case where both hold.
Exam points
ExamXOR is 1 when at least one input is 1 and not both are, so it can also be written as an expression combining the other basic operations.
ExamIn a bitwise XOR, positions where the other operand's bit is 1 flip between 0 and 1, and positions where it is 0 keep the original data's value.
Mix-upWhen both inputs are 1, OR outputs 1 and XOR outputs 0, and this one row is the only difference.