Logical operations and expressions
Logical operations build new statements from old ones. Conjunction (A ∧ B, “and”) is true only when both statements are true; disjunction (A ∨ B, “or”) is true when at least one is true; inversion (¬A, “not”) turns the value into its opposite. Implication (A => B, “if A, then B”) is false only when A = 1 and B = 0; equivalence (A <=> B) is true when A and B have the same value. In the tables the pair (A, B) is written in the order 00, 01, 10, 11: the result for ∧ is 0, 0, 0, 1; for ∨ it is 0, 1, 1, 1; for => it is 1, 1, 0, 1; for <=> it is 1, 0, 0, 1. In an expression the operations are done in this order: ¬, ∧, ∨, =>, <=>; brackets come first and operations of the same level go left to right. The textbook also writes ⏋A for ¬A and A & B for A ∧ B.
| A | B | A ∧ B | A ∨ B | A => B | A <=> B |
|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 | 1 |
F = A XOR B → 1
The A and B buttons flip an input between 0 and 1
The school library has a rule: a pupil may borrow a book if the pupil has a library card or a note from a teacher, and the book is on the shelf. A pupil with a note but no card could still borrow it, because “or” needs only one of the two conditions.
Rule writers, electricians and programmers use “and”, “or” and “not” to state conditions precisely.
Take a house or class rule and write it with “and”, “or” and “not”. List on paper the cases when it is allowed.
“Living table”: four students hold up the values of A and B (0 or 1) on cards while the others show the result of a chosen operation (e.g. =>); the four cases 00, 01, 10, 11 are repeated in turn.