A-Level Computer Science / Unit 3: Hardware, Memory and Control

3.2.3 Translating Between Logic Representation

πŸ”’ Lesson slides are available to signed-in users. Sign in

3.2.3 Translating Between Logic Representations

A single Boolean function can be described as a problem statement, a logic expression, a gate circuit, or a truth table. These forms look different, but they should produce the same output for every input combination.

This section develops systematic methods for moving between the representations. The emphasis is on preserving the logic exactly rather than guessing from the final output.

By the end of this section, you should be able to:

  • Determine the number and order of rows required in a truth table.
  • Construct a truth table from a logic expression.
  • Read a logic expression from a gate circuit.
  • Construct a truth table from a circuit using intermediate workspace columns.
  • Construct a truth table from a problem statement.
  • Create a logic expression from the output-1 rows of a truth table.
  • Build a two-input-gate circuit from a truth table-derived expression.
  • Check whether two representations describe the same Boolean function.

One logic function, four representations

Original translation map. Select the image to enlarge it.
Starting point Destination Reliable method
Logic expression Truth table Create one workspace column for each operation and evaluate every row.
Logic circuit Logic expression Label each gate output and combine the labels from left to right.
Logic circuit Truth table Use a workspace column after each gate, then calculate the final output.
Problem statement Truth table Define the inputs, list every case, and apply the rule to each row.
Truth table Logic expression Create one AND term for each row where X = 1, then join the terms with OR.
Truth table Logic circuit Construct the expression first, then convert its operations into gates.

Truth-table rows and workspace columns

With n independent Boolean inputs, a complete truth table requires 2n rows.

Number of inputs Required rows Input combinations
120, 1
2400, 01, 10, 11
38000 through 111 in binary order
4160000 through 1111 in binary order

A workspace column records the result of one intermediate operation. Complex tables become much easier when every NOT, AND, OR, NAND, NOR, or XOR stage has its own column.

Workspace column: a temporary truth-table column containing the output from one gate or sub-expression.

Exam tip

Complete the input columns before calculating any output. For three inputs, check that there are exactly eight distinct rows.

Logic expression β†’ truth table

X = (A OR NOT B) AND C

Break the expression into smaller operations:

  1. M = NOT B
  2. N = A OR M
  3. X = N AND C
A B C M = NOT B N = A OR M X = N AND C
000110
001111
010000
011000
100110
101111
110010
111011

Exam tip

Evaluate bracketed and NOT operations first. The final output column should be calculated only after all of its input columns are complete.

Common mistake

Do not treat NOT B as if it changes A or C. The NOT operation affects only the signal immediately following it.

Logic circuit β†’ logic expression

Read a circuit from its inputs towards the final output. Place a label immediately after each gate and write the expression that produces that label.

Original circuit with labelled intermediate outputs. Select the image to enlarge it.
Signal How it is produced
MM = NOT A
NN = B XOR C
XX = M OR N

Substitute the definitions of M and N into the final line:

X = (NOT A) OR (B XOR C)

Common mistake

Do not name only the final gate. The output is not simply β€œOR”; it is the OR of two earlier results, and those results must also appear in the expression.

Logic circuit β†’ truth table

Use the same intermediate labels as workspace columns. Evaluate the gates in signal-flow order.

A B C M = NOT A N = B XOR C X = M OR N
000101
001111
010111
011101
100000
101011
110011
111000

The structure gives a useful check: whenever A = 0, M = 1, so the final OR output must also be 1. The first four output values should therefore all be 1.

Exam tip

Look for structural checks. A fixed input or an early NOT gate may force part of the output column to a predictable value.

Problem statement β†’ truth table

A warning should activate when a chemical cabinet is unlocked while the laboratory is unoccupied.

Define the inputs and output:

  • A = 1 when the cabinet is unlocked.
  • B = 1 when the laboratory is occupied.
  • X = 1 when the warning activates.

X = A AND NOT B

A B NOT B X = A AND NOT B Interpretation
0010The cabinet is locked.
0100The cabinet is locked.
1011Unlocked and nobody is present.
1100An occupied laboratory does not trigger this warning.

The expression is a useful intermediate step, but the table must still include every possible combinationβ€”even combinations that seem unlikely in normal operation.

Truth table β†’ logic expression

Use only the rows where the output is 1. Each selected row becomes an AND term.

A B X AND term for this row
001NOT A AND NOT B
010Not used
100Not used
111A AND B

How one row becomes a term

  • An input value of 1 uses the variable itself.
  • An input value of 0 uses the inverted variable.
  • The inputs within one row are joined using AND.
  • Different output-1 rows are joined using OR.

X = (NOT A AND NOT B) OR (A AND B)

This expression produces 1 when the two inputs match. It has been constructed directly from the table; no simplification is required.

Common mistake

For an output-1 row, an input value of 0 must appear as a NOT term. Omitting the inversion would describe a different row.

Truth table β†’ logic circuit

After producing the expression, convert each operation into gates:

  1. Create NOT A and NOT B.
  2. Use one AND branch for NOT A AND NOT B.
  3. Use a second AND branch for A AND B.
  4. Combine the two branch outputs with OR.
  5. Label the final output X.
Original circuit built from the 00 and 11 output-1 rows. Select the image to enlarge it.

Exam tip

Keep the output-1 rows visible while drawing. Each row should correspond to one AND route, and the routes should be combined by OR gates.

Interactive prerequisite: Truth Table Lab

The existing widget has been retained for practising gate-level row evaluation. Use it to confirm the behaviour of one operator before applying that operator inside a larger workspace table.

X = A AND B

AND gives 1 only when both inputs are 1.

Current row: A = 0, B = 0, so X = 0

Checking whether representations are equivalent

Two expressions or circuits are functionally equivalent when they produce the same output for every possible input combination.

Check What to compare
Expression against circuit Confirm that every operator appears as the correct gate and in the correct grouping.
Circuit against truth table Evaluate all intermediate gate outputs and compare the final X column.
Two expressions Construct both output columns using the same ordered input rows.
Problem statement against table Interpret every output-1 row in words and check that it satisfies the rule.
Functionally equivalent: producing the same output for every possible combination of input values.

Matching only one or two test cases is not proof of equivalence. A complete truth table provides a systematic comparison.

Exam support

Use workspace rather than mental shortcuts

Add a column after each gate or sub-expression. Complete the columns from left to right until the final output can be calculated.

Truth table to expression

Use only rows where X = 1. Within each row, 1 means the normal variable and 0 means its NOT form. AND the row conditions, then OR the rows.

Preserve the given function

Do not simplify or alter an expression unless the question asks you to. The aim is to translate the representation accurately.

Common mistakes and misconceptions

  • Using the wrong number of rows for the number of inputs.
  • Calculating a later workspace column before its inputs are ready.
  • Reading a circuit from right to left and losing the grouping.
  • Using output-0 rows instead of output-1 rows when constructing an expression.
  • Forgetting to invert variables whose row value is 0.
  • Joining conditions from one row with OR instead of AND.
  • Joining separate output-1 rows with AND instead of OR.
  • Assuming that a few matching test cases prove complete equivalence.

Practice

Expression β†’ truth table

Construct a complete truth table, including workspace columns, for:

X = (A NAND B) OR C

Problem statement β†’ truth table

A warning is produced when a laboratory window is open and the security system is armed.

  1. Define A, B, and X.
  2. Write the logic expression.
  3. Construct the complete truth table.

Truth table β†’ expression and circuit

ABX
000
011
101
110
  1. Create one AND term for each output-1 row.
  2. Combine the terms into a complete expression.
  3. Draw a circuit using AND, OR, and NOT gates.
  4. Identify a single standard gate with the same output pattern.

Circuit-reading challenge

A circuit first calculates M = A NOR B. It then calculates X = M XOR C.

  1. Write X as one expression without M.
  2. Construct the eight-row truth table using M as workspace.
Self-check: reveal the standard gate in the third task

The output pattern 0, 1, 1, 0 is XOR. The unsimplified expression is (NOT A AND B) OR (A AND NOT B).

Review

Translation Core method
Expression β†’ truth table Create workspace columns for the operations and evaluate every input row.
Circuit β†’ expression Label gate outputs and substitute them into the final expression.
Circuit β†’ truth table Use one workspace column after each gate.
Problem statement β†’ truth table Define the propositions, write the rule, and evaluate every case.
Truth table β†’ expression AND the conditions within each output-1 row; OR the rows together.
Truth table β†’ circuit Create the expression first, then draw a gate for each operation.
Equivalence check Compare complete output columns for the same ordered input combinations.