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?
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.
- Translate a worded rule into a Boolean expression using AND, OR, NOT and XOR.
- Move between an expression, its truth table and its gate diagram.
- Spot ambiguous words ('or', 'unless') and resolve them before building.
Predict
An alarm must sound if it is armed and either the door or the window opens. Which expression fits?
- Arm · Door + Window
- Arm · (Door + Window)
- 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.
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
A · B + C means A AND (B OR C).
✓ AND is done first: it means (A · B) + C. Use brackets to say otherwise.If the expression looks right, the truth table must be right.
✓ Always check every row; mistranslated words often show up on just one or two rows.
Practice
Practice, not a test. Answers are checked on our server; a wrong answer gets a hint and another try. Nothing is saved.
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.