Topic 10 Β· Boolean Logic Β· 10.8

Logic Expressions

A logic expression is a short written rule that describes how inputs are combined to produce an output.

Invitation

How would you write a security rule?

Imagine a secure door with two checks:

β€œThe door opens when the key card is valid AND the correct PIN is entered.”

A computer does not need the whole sentence. It can write the same rule using input labels and a logic operator.

A logic expression is the computer's short way of writing a rule.
Security rule
A = valid key card
B = correct PIN
AND ↓
X = door opens
Big Idea

Inputs + operator = output

Logic expressions use letters to represent inputs and an operator to show how those inputs are combined.

AFirst input
+
ANDLogic rule
+
BSecond input
X = A AND B
Read the expression aloud: β€œX equals A AND B.”
Bridge

The expression tells the same story

AThe key card is valid.
ANDBoth conditions must be true.
BThe correct PIN is entered.
XThe secure door opens.
The letters are labels. The operator describes the behaviour.
Visual Guide

From a logic gate to an expression

Look at the gate symbol and identify three things:

1. The input labels.
2. The gate type.
3. The output label.

Follow the signal from left to right, then write the expression in the same order.
AND gate becomes an expression
ABX
X = A AND B
Language

The operators describe behaviour

NOTReverse one input
ANDBoth inputs
OREither or both
NANDAND, then reverse
NOROR, then reverse
XORExactly one input
You already know the behaviours. Logic expressions simply write them down.
How to Read It

Read from the output backwards

When an expression begins with the output, start by saying the output label, then read the rule from left to right.

X = A OR B
XOutput
=Equals
AInput
OROperator
BInput
Say it aloud: β€œX equals A OR B.”
Worked Example

Write the expression

Question

A circuit has inputs P and Q connected to an XOR gate. The output is labelled R. Write the logic expression.

β€œR = P XOR Q”
Use the labels shown in the question. Do not automatically change them to A, B and X.
Hinge Question

Can you translate the security rule?

Question

A is a valid key card. B is the correct PIN. X means the door opens. Both checks are required. What is the expression?

β€œX = A AND B because the door opens only when both conditions are true.”
Exam Explainer

Three details earn accuracy

Correct LabelsCopy the input and output letters exactly.
Correct OperatorMatch the gate behaviour.
Correct OrderOutput first, then the rule.
Exam method: Identify the output, identify the inputs, then name the gate between them.
Common Mistake

Do not describe the picture instead of writing the rule

βœ— Incorrect

β€œThere are two inputs connected to an AND gate.”

βœ“ Correct

β€œX = A AND B”

Remember: A logic expression must include the output label, the inputs and the operator.
Summary

A logic expression is a written circuit rule

LabelsLetters represent inputs and outputs.
OperatorThe gate name shows the behaviour.
ExpressionWrite output = input operator input.
Final rule: Read the circuit, name the behaviour, then write the expression.