Big picture
Boolean logic studies statements that have one of two truth values. A school admission rule such as “the form is complete and the fee is paid” is a logical combination: knowing only one condition is not enough to determine the result.
The same reasoning appears in electronic circuits and Python conditions. Translate a sentence into symbols, build its truth table and interpret the result in ordinary language. This method is more reliable than guessing from how a complicated expression sounds.
Learning goals
Identify propositions and define Boolean variables.
Construct truth tables for compound conditions.
Compare basic and derived logic gates.
Apply Boolean laws and De Morgan transformations.
Translate a verbal rule into a circuit expression.
Core ideas
1. Propositions and logical variables
A proposition is a declarative statement with a definite truth value in the context being considered. “The lab is open” can be true or false; “Please open the lab” is a request and is not a proposition. Assign a logical variable such as P to the first statement. Values 1 and 0 conventionally represent true and false.
A compound proposition combines simpler propositions using logical operations. If P means the form is complete and Q means payment is confirmed, an eligibility rule may require both. Define the meanings before manipulating symbols, since an expression without a clear interpretation can be mathematically correct yet answer the wrong question. In school-level Boolean algebra, variables take only the two Boolean values.
2. NOT, AND and OR
NOT, written ¬P or P′, reverses a truth value. AND, written P ∧ Q or P·Q, is true only when both operands are true. OR, written P ∨ Q or P + Q in Boolean algebra, is true when at least one operand is true. This OR is inclusive: both being true still gives true.
P | Q | P AND Q | P OR Q | NOT P |
|---|---|---|---|---|
0 | 0 | 0 | 0 | 1 |
0 | 1 | 0 | 1 | 1 |
1 | 0 | 0 | 1 | 0 |
1 | 1 | 1 | 1 | 0 |
For a library rule, “member OR visitor-pass holder” accepts someone who has both credentials. Do not import an exclusive everyday meaning of “or” without being told to do so. Boolean plus denotes OR here, not ordinary arithmetic addition.
3. Gates and circuit interpretation
A logic gate implements a Boolean operation on binary signals. AND and OR usually have multiple inputs; NOT has one input and is called an inverter. In a diagram description, state the input labels, gate sequence and final output label. For example, P and Q enter an AND gate whose output enters a NOT gate: Y = ¬(P ∧ Q).
NAND negates AND, while NOR negates OR. XOR is true when its two inputs differ; XNOR is true when they agree. Thus two active switches give XOR output 0 but inclusive OR output 1. NAND and NOR are each universal: combinations of just one of these gate types can implement the basic operations. This is an implementation property, not a claim that every individual gate already performs every operation.
4. Truth tables for compound expressions
A truth table lists every possible assignment of input values. With n independent Boolean inputs there are 2ⁿ rows. For three inputs, list eight rows in a fixed binary order to avoid omissions. Create intermediate columns so that brackets are evaluated before outer operations.
Consider Y = P ∧ ¬Q. First compute ¬Q, then combine it with P.
P | Q | NOT Q | Y |
|---|---|---|---|
0 | 0 | 1 | 0 |
0 | 1 | 0 | 0 |
1 | 0 | 1 | 1 |
1 | 1 | 0 | 0 |
The rule activates only when P is true and Q is false. If P means a learner is registered and Q means access is blocked, this is a plausible permission condition. A single successful test case cannot establish that two expressions are equivalent; all possible rows must agree.
5. Boolean laws and simplification
Boolean identities allow an expression to be simplified without changing its truth table. Identity laws are P + 0 = P and P·1 = P. Domination laws are P + 1 = 1 and P·0 = 0. Idempotence gives P + P = P and P·P = P. Complement laws give P + P′ = 1 and P·P′ = 0; double negation gives (P′)′ = P.
Commutative and associative laws allow reordering and regrouping of repeated AND or repeated OR. Distributive laws include P·(Q + R) = P·Q + P·R and P + Q·R = (P + Q)·(P + R). The second form often surprises students accustomed only to arithmetic. Absorption gives P + P·Q = P: once P is true, the added stricter alternative contributes nothing. Name the law used at each step rather than cancelling symbols as though they were fractions.
6. De Morgan laws and negating conditions
De Morgan's laws state ¬(P ∧ Q) = ¬P ∨ ¬Q and ¬(P ∨ Q) = ¬P ∧ ¬Q. Negating a compound condition reverses the operator as well as negating every operand. Negating “registered and paid” therefore means “not registered or not paid.”
For a range condition, “score is at least 40 and at most 100” becomes “score is below 40 or above 100” when negated. The endpoints must also change correctly: not greater than or equal to means less than. In a three-part conjunction, its negation is true if any required part fails. A useful verification is to test one boundary and one mixed case, then use a complete truth table to prove the identity for all Boolean assignments.
7. From conditions to circuits and back
Translate words before drawing gates. “The alarm sounds when the door is open and the system is armed” gives Y = D ∧ A. Adding an emergency switch E that activates the alarm independently gives Y = (D ∧ A) ∨ E. The diagram has an AND gate for D and A, followed by an OR gate that also receives E.
To recover an expression from a circuit, label each intermediate wire. If X = P ∨ Q and Y = X ∧ ¬R, substitute X to obtain Y = (P ∨ Q) ∧ ¬R. Do not connect every input to the final gate without respecting the earlier gates. For scenario questions, finish by explaining an actual input case, such as an emergency overriding the normal door-and-arming requirement.
8. Python Boolean expressions and verification
Python uses True, False, not, and and or. Its Boolean precedence is not before and before or, although explicit parentheses often make intent clearer. Use == for equality; assignment uses =. In general Python and/or can return operands rather than Boolean values, so the following verification deliberately uses Boolean inputs.
for p in (False, True):
for q in (False, True):
left = not (p and q)
right = (not p) or (not q)
print(int(p), int(q), int(left), left == right)Output:
0 0 1 True
0 1 1 True
1 0 1 True
1 1 0 TrueEvery comparison is true, verifying the first De Morgan law on every input pair. In an exam, the last comparison column is evidence of equivalence, while the preceding column gives the actual output of the negated conjunction. Keep those two questions separate: an expression can produce false on a row while still agreeing perfectly with an equivalent expression.
A reliable approach to questions
Read the command word before choosing an answer. A definition needs the distinguishing feature; a comparison needs matching criteria on both sides; an application needs a reason linked to the situation.
Extract the supplied evidence and assumptions. Keep a small working table rather than relying on memory. If information is absent, state the limit instead of inventing a value or claiming certainty.
Work through the relevant rule one step at a time. For a program, record the changing state; for a scenario, connect the requirement to the feature that meets it. Explain why the closest alternative fails.
Check the result against the original question, including boundary cases, units and wording. Present a concise final answer followed by enough reasoning for another student to reproduce your conclusion.
Connections that matter
Number systems use the same binary symbols for different representational purposes.
Selection statements evaluate Boolean conditions to choose a branch.
Digital circuits implement the logical operations used by processors.
Common mistakes
Treating Boolean OR as exclusive: inclusive OR accepts two true inputs.
Negating operands without changing AND to OR: apply both parts of De Morgan.
Using one matching row as proof: compare all assignments.
Confusing a truth value with an equivalence check: false expressions can be equivalent.
Revision checklist
I can identify propositions and define Boolean variables.
I can construct truth tables for compound conditions.
I can compare basic and derived logic gates.
I can apply Boolean laws and De Morgan transformations.
I can translate a verbal rule into a circuit expression.