Compound Boolean Statements
From Words to Symbols
Let $P$: "The shop is open" and $Q$: "I have money". Write each sentence in symbols: (a) The shop is open and I have money. (b) The shop is not open or I have money. (c) The shop is open but I have no money. (d) The shop is not open and I have no money.
Sentence (a): The word *and* joins two parts that are both claimed to be true = $P \land Q$
Sentence (b): *not* belongs only to the first part, *or* joins the two parts = $\neg P \lor Q$
Sentence (c): *but* means AND, and *I have no money* is the negation of $Q$ = $P \land \neg Q$
Sentence (d): Both parts are negated and joined with *and* = $\neg P \land \neg Q$
Answer: (a) $P \land Q$, (b) $\neg P \lor Q$, (c) $P \land \neg Q$, (d) $\neg P \land \neg Q$. Sentence (d) can also be said with neither ... nor: neither is the shop open nor do I have money.
Truth Values with Numbers
Let $P$: "$7$ is a prime number" and $Q$: "$10$ is an odd number". Find the truth value of $P \land Q$, $P \lor Q$ and $P \land \neg Q$.
Find the value of each simple statement: $7$ has only the divisors $1$ and $7$, so $P$ is true. $10$ is even, so $Q$ is false = $P = 1$, $Q = 0$
Evaluate $P \land Q$: $1 \land 0$: AND needs both parts to be true = $0$ (false)
Evaluate $P \lor Q$: $1 \lor 0$: OR needs at least one true part = $1$ (true)
Evaluate $P \land \neg Q$: First $\neg Q = \neg 0 = 1$, then $1 \land 1$ = $1$ (true)
Answer: $P \land Q$ is false, $P \lor Q$ is true and $P \land \neg Q$ is true: $7$ is prime and $10$ is not odd.
Where Does the NOT Stand?
Let $P$: "$3 > 5$" and $Q$: "$2 + 2 = 4$". Compare the truth values of $\neg(P \lor Q)$ and $\neg P \lor Q$.
Find the values of the parts: $3 > 5$ is false and $2 + 2 = 4$ is true = $P = 0$, $Q = 1$
Work out the brackets first: $P \lor Q = 0 \lor 1$ = $1$
Negate the whole bracket: $\neg(P \lor Q) = \neg 1$ = $0$
Now evaluate $\neg P \lor Q$: Here NOT touches only $P$: $\neg 0 \lor 1 = 1 \lor 1$ = $1$
Answer: $\neg(P \lor Q)$ is false, but $\neg P \lor Q$ is true. The brackets decide what NOT applies to: the whole statement or only $P$.
Negating a Compound Statement in Words
Negate the statement "Tom plays football and Tom plays chess". In which cases is the negation true?
Write the statement in symbols: $F$: Tom plays football, $C$: Tom plays chess = $F \land C$
Negate the whole statement: Put *it is not true that* in front: it is not true that Tom plays both football and chess = $\neg(F \land C)$
Check the four cases: $F \land C$ is 1 only when $F = 1$ and $C = 1$, so $\neg(F \land C)$ is 1 in the other three cases = True in 3 of the 4 cases
Say it in plain words: The negation is true as soon as at least one of the two activities is missing = Tom does not play both
Answer: The negation is: it is not true that Tom plays both football and chess, so at least one of them is missing. It is not "Tom plays neither football nor chess": that sentence is true in only 1 case, not in 3.
Three Parts, Eight Cases
A club lets you in if you are a member, or if you have a ticket and are over 16. With $M$: you are a member, $T$: you have a ticket, $A$: you are over 16, the rule is $M \lor (T \land A)$. In how many of the 8 cases do you get in?
Count the cases: 3 simple statements, each one 0 or 1 = $2^3 = 8$ cases
List the cases in order: $M$, $T$, $A$: 000, 001, 010, 011, 100, 101, 110, 111 = 8 rows, starting with 0
Column $T \land A$: True only when $T = 1$ and $A = 1$: cases 011 and 111 = 0, 0, 0, 1, 0, 0, 0, 1
Column $M \lor (T \land A)$: True when $M = 1$ (cases 100 to 111) or when $T \land A = 1$ (case 011 adds one more) = 0, 0, 0, 1, 1, 1, 1, 1
Count the true cases: 4 cases with $M = 1$ plus 1 case without membership = 5 cases
Answer: You get in in 5 of the 8 cases: always as a member, and as a non-member only with a ticket and when you are over 16.
Mistake: Thinking that "$P$ or $Q$" is false when both parts are true
Why: In everyday speech *or* often means one or the other, but not both. In logic OR is inclusive: $1 \lor 1 = 1$.
Correct: $P \lor Q$ is false only when both parts are false. For one but not both there is a separate operator, XOR (exclusive OR).
Mistake: Negating "I like tea and coffee" as "I like neither tea nor coffee"
Why: *Neither ... nor* is true only when both parts are false (1 case). The negation of an AND statement must be true whenever at least one part is false (3 cases).
Correct: Say "It is not true that I like both tea and coffee": at least one of them I do not like. The general rule (De Morgan's laws) comes in the lesson Boolean Algebra.
Mistake: Reading $\neg P \land Q$ as if it were $\neg(P \land Q)$
Why: Without brackets NOT applies only to the statement right after it. For $P = 0$ and $Q = 0$: $\neg P \land Q = 1 \land 0 = 0$, but $\neg(P \land Q) = \neg 0 = 1$.
Correct: Check what the NOT touches. Write brackets when NOT should apply to the whole compound statement.
Mistake: Not recognizing *but* as AND
Why: "The test was hard but I passed" sounds like a contrast, yet both parts are claimed to be true.
Correct: Translate *but*, *although* and *both ... and* as AND: $H \land S$ (hard test AND passed).
Online Shop Filters
Shops and search engines combine conditions with AND, OR and NOT to decide which items you see.
The filter (black OR blue) AND NOT used shows only new items, in either of the two colors.
Game Rules in Code
Video games and apps check compound conditions many times per second to decide what happens next.
A door opens if (key AND NOT alarm). With the key and no alarm: $1 \land \neg 0 = 1 \land 1 = 1$, so the door opens.
Rules and Signs
Rules on signs, tickets and contracts are compound statements, and it often matters exactly when a rule is NOT met.
"Free parking on Sundays or after 8 pm" holds on a Sunday at noon, on a Monday at 9 pm, and also on a Sunday at 9 pm.
A compound statement joins simple statements with AND ($\land$), OR ($\lor$) and NOT ($\neg$)
*and* and *but* translate to AND, *or* to OR, *not* and *it is not true that* to NOT
AND is true only when both parts are true; OR is false only when both parts are false
To find the truth value, give each part 1 or 0, work out the brackets and every NOT, then combine
Brackets decide what NOT applies to: $\neg(P \land Q)$ is not the same as $\neg P \land Q$
With 3 simple statements there are $2^3 = 8$ cases, and the negation of an AND statement is true whenever at least one part is false
Q: Does "either ... or" mean OR?
A: Not always. The operator OR is always inclusive: it is also true when both parts are true. In everyday speech *either ... or* often hints at one but not both. When a sentence clearly means one but not both, write it as the exclusive OR (XOR): $(P \lor Q) \land \neg(P \land Q)$. Otherwise read it as OR.
Q: Do I always need brackets?
A: With two parts and one operator, no. As soon as AND and OR appear together, or a NOT should apply to more than one statement, brackets make the meaning clear. The rules for reading a statement without brackets (NOT before AND before OR) come in the lesson Boolean Expressions.
Q: Can I use a calculator for truth values?
A: Partly. With 1 and 0, AND works like multiplication ($1 \times 0 = 0$, $1 \times 1 = 1$) and NOT $P$ equals $1 - P$. The calculator in this lesson does not know the words AND, OR and NOT, so use it for these products and for counting cases like $2^3$.
Q: Why can a question not be part of a compound statement?
A: A statement must be either true or false. A question like "Is it raining?" or an order like "Close the door!" has no truth value, so it cannot be one of the parts.
Compound Boolean Statements
1 / 14
Compound Boolean Statements
Learn to build compound statements from simple ones with AND, OR and NOT, translate between words and symbols, and find their truth value.