TactivergeLite

Lite / Building Machines That Respond / Week 15

From safety rules to Boolean expressions

'The press may run only when the guard is shut, a hand is on each button and there is no fault.' Can you write that as one line of algebra?

About 35 min · 3 goals · Checked by automated tests · Full interactive version

Why should I care?

Safety interlocks on machines, alarms and doors are Boolean expressions written in hardware. A mistranslated word can let a machine start when it must not, so engineers write the rule, the expression and the full truth table, and check that all three agree.

Predict

An alarm must sound if it is armed and either the door or the window opens. Which expression fits?

  1. Arm · Door + Window
  2. Arm · (Door + Window)
  3. Arm + Door + Window
Guess first, then reveal

Arm · (Door + Window). Without the brackets, AND happens first, so 'Arm · Door + Window' would sound the alarm whenever the window opens, even when disarmed. Brackets carry the meaning of 'either… or'.

Discover

Start from the interlock preset A · B · ¬C (A = guard closed, B = operator present, C = fault). Toggle the inputs to find the only row where Y = 1. Then type A · (B + C) and compare it with A · B + C: find a row where they differ. Finally write your own rule for a door alarm and check its truth table.

What the interactive shows (text version)

The explorer takes a typed Boolean expression and shows three views: input switches with a live output, a gate diagram drawn from inputs on the left to the output on the right, and a full truth table with the current row marked. For the interlock A · B · ¬C, Y = 1 only on row 110: guard closed, operator present, no fault.

You can also open the interactive on the full site when you have a faster connection.

Understand

Name the signals first

Give every input a letter and say what 1 means: G = 1 'guard closed', P = 1 'operator present', F = 1 'fault reported'. Writing what 1 means avoids the most common bug: a signal that is 1 when you thought it was 0.

Words to operators

'and', 'both', 'all' → ·. 'or', 'either', 'any' → +. 'not', 'no', 'unless' → ¬ (often 'X unless Y' becomes X · ¬Y). 'one or the other but not both' → ⊕. So the interlock is Y = G · P · ¬F.

Brackets carry meaning

AND binds tighter than OR, just as × binds tighter than +. A · B + C means (A · B) + C. If the rule says 'A and either B or C', write A · (B + C). When unsure, add brackets and check the truth table.

Check all three views

The expression is compact, the truth table is complete, and the gate diagram is what you build. If they disagree, one of them is wrong. For safety rules, read every row of the truth table aloud: 'guard open, operator present, no fault: machine off.'

Explain it another way

Intuitive

Translating rules into logic is like writing a recipe so exact that a robot cook cannot misunderstand it. Every 'and', 'or' and 'unless' becomes a symbol with one meaning only.

Technical

Natural-language connectives are ambiguous; Boolean operators are not. Specifications are written as truth tables or expressions with explicit precedence, then verified exhaustively for small input counts.

Mathematical

Y = A · (B + C) is 1 on rows 101, 110 and 111: three of eight. Y = A · B + C is 1 on 001, 011, 101, 110, 111: five of eight. The two differ on rows 001 and 011, exactly where A = 0 and C = 1.

Applied

Industrial presses use two-hand controls (both buttons, so both hands are clear) plus guard switches, with the rule built in dedicated safety hardware rather than ordinary software.

Worked example 1

'The fan runs if the temperature is high, unless the maintenance switch is on.' Write it as an expression.

Let T = 1 'temperature high' and M = 1 'maintenance switch on'. 'T unless M' = T · ¬M. Check: T = 1, M = 1 gives 0 (fan off for maintenance).

Common mix-ups

Practice

Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.

Practice 1. Machine runs only if the guard is closed (G), the operator is present (P) and there is no fault (F = 1 means fault). Which expression?

rows

rows

rows

Practice 5. 'The light is on if it is dark (D), unless the switch is off (S = 1 means switch off).' Which expression?

Apply it

Write the rule for a greenhouse vent: open if it is too hot OR too humid, but never while it is raining. Name your signals, write the expression, check its truth table in the explorer, and read the rows where the vent is open aloud.

Reflect

Which English word did you find most dangerous to translate, and how will you check it next time?

Write your answer on paper or in your own notes. Lite never stores what you write.

← Logic gates and truth tablesModule check: simplifying logic →