[10.3c] Logic Expressions
Logic Expressions
Writing logic expressions from statements, circuits, and truth tables
A logic expression is a concise, symbolic way to describe how outputs depend on inputs using the operators NOT, AND, and OR (and, where appropriate, XOR, NAND, NOR). In this benchmark you will practise writing a correct logic expression when the description is presented as: a written problem statement, a drawn logic circuit, or a truth table. Expressions must accurately reflect the given description using the allowed inputs (maximum three) and a single output, typically labelled Q or X.
Throughout, think in three stages: identify the inputs and what they mean, decide which operator(s) link them, and place brackets to show the intended grouping. Brackets are essential for clarity. Remember that binary signals use 0 for false/low and 1 for true/high.
Language-to-operator quick guide
| Wording in a statement | Typical operator | Example mapping |
|---|---|---|
| "both", "at the same time", "all of" | AND | "both doors open" → A AND B |
| "either", "or", "at least one" | OR | "either sensor triggers" → A OR B |
| "not", "unless", "except when", "if ... is absent" | NOT on that input | "not locked" → ¬B |
| "exactly one", "one but not both" | XOR | "exactly one button pressed" → A ⊕ B or (A AND ¬B) OR (¬A AND B) |
Worked pathways to expressions
Use the tabs to see how to produce a logic expression from each starting form. The examples are intentionally small (≤ 3 inputs) to mirror the exam constraints. Do not skip brackets: they show how the hardware or table structure translates into symbolic form.
Statement → Expression: "Alarm sounds when power is on AND (the door is closed OR the override is active)."
- Name inputs:
A= power on,B= door closed,C= override active. OutputQ= alarm. - Spot keywords: "AND" joins main parts; "OR" joins the door/override choices. The phrase gives clear grouping: power AND (door OR override).
- Write the expression:
Q = A AND (B OR C).
(A OR B) AND ¬C.Contrast: Negation carefully placed
Wording: "Light is on when switch is on AND window is not open." → Q = A AND ¬B.
Wording: "Light is on when not (window open OR door open)." → Q = ¬(A OR B) (which is equivalent to ¬A AND ¬B, but you do not need to simplify here).
Mistake to avoid: Writing ¬A OR B when the statement really means ¬(A OR B). The position of NOT changes everything, so bracket carefully.
Circuit → Expression: read the wiring left to right
Given circuit description: Inputs A and B feed an AND gate. Input C passes through a NOT gate. The outputs of AND and NOT feed an OR gate to produce Q.
- Write the sub-results in order:
X = A AND B,Y = ¬C. - Combine for the output:
Q = X OR Y. - Substitute back:
Q = (A AND B) OR (¬C).
Variants and precise reading
If the diagram shows A, B, C entering a single 3-input AND gate, write Q = A AND B AND C. If built from cascaded 2-input AND gates, still write a single grouped AND.
If the final gate is NAND taking (A AND B) on its inputs, the expression is Q = ¬(A AND B). Keep the NOT outside the whole bracket to match the NAND symbol.
If a branch uses XOR with A and B, you may write A ⊕ B or expand as (A AND ¬B) OR (¬A AND B). Use whichever the exam accepts in your centre's notation.
Truth Table → Expression: sum-of-products or product-of-sums
Example table (two inputs): Q=1 when inputs are different.
| A | B | Q |
|---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
- Sum-of-Products (SOP): make an AND term for each row where
Q=1, using NOT for any0, then OR the terms. Here:Q = (¬A AND B) OR (A AND ¬B). - Product-of-Sums (POS): make an OR term for each row where
Q=0, again using NOT appropriately, then AND the terms. Here:Q = (A OR B) AND (¬A OR ¬B).
1 rows; POS is handy when there are few 0 rows. Both are correct if built directly from the table.General procedure for accuracy
- Define inputs clearly (e.g. sensors, switches). Stick to at most three inputs as per specification.
- Map words or symbols to operators and immediately decide where brackets are needed.
- Write helper sub-expressions for multi-stage logic, then merge them into a single final expression for
Q. - Cross-check by evaluating one or two rows you can predict (e.g. all
0s, all1s) to see if the expression behaves sensibly.
Deep Dive: Negation placement and reading "unless"
Negation placement changes meaning. ¬(A OR B) means neither A nor B is true. (¬A) OR B means B is true or A is false, which is different. The word "unless" is often equivalent to "AND NOT": "start unless X" becomes start_condition AND ¬X. Brackets make these distinctions explicit and prevent ambiguity.
Terminology recap
- Logic expression: a symbolic statement combining inputs with operators to produce
Q. - Sum-of-products (SOP): OR of AND terms built from
Q=1rows. - Product-of-sums (POS): AND of OR terms built from
Q=0rows. - XOR: true when inputs differ; can be written explicitly or expanded as SOP.
Key Takeaways
- From statements, identify keywords and bracket groupings: write exactly what the wording implies.
- From circuits, translate each gate into a bracketed sub-expression and combine in signal order.
- From truth tables, build SOP from
Q=1rows or POS fromQ=0rows. - Negation placement is critical:
¬(A OR B)is not the same as(¬A) OR B. - Use at most three inputs and ensure one final output symbol, typically
Q.