How can I illustrate the difference between $\lor$ and $\oplus$ in a way that isn't just boring? Are there fun ways to illustrate and provide practice for this small, yet key, distinction?
Play the “if you have brown hair stand up” game.
For the introductory lesson. We use this to introduce selection (if statements), and a little bit of boolean logic.
“Stand up if you have got brown hair.”
“Sit down.” look around “Stand up if you have blue eyes.”
With out asking them to sit down “Stand up if you …”
Address why some people are still standing, are they correct [yes], or are the seated people correct [no]. Why? [because I did not ask them to sit].
“stand up if you have brown hair or you are …” (this is where we start to cover Boolean logic, I have only done and, or, not).
In another lesson you could add
“if you have blond hair or you have blue eyes stand up”
“if you have blond hair xor you have blue eyes stand up”
You might go about explaining it by using the words "either" and "or".
"Either" means that any option out of two available would be enough:
perfect indifference of the two (or more) things.
to emphasize the mutual exclusiveness: either of the two, but not both.
(taken from Oxford English Dictionary).
This means that xor is true only when either one is, but not when neither are true or neither are false. The key point to stress is "either one".
As for practice, you can ask the students to come up with 3-4 properties (boy\girl, reads many books\doesn't read many books, etc.) that some students have and some don't.
For the first property, ask every student who has that property (can't think of a better word
:/) to write in their notebooks the numer 1 (they might ask "where should I write it?", it doesn't matter that much as long as there's room for a few more numbers). Students who don't have that property should write
Then go through the other properties (or conditions) and for each one, ask every student who has the current property to do the following:
If they have written the number
1 for the previous property, to write the number
0 (maybe next to the
Every student who didn't write
1, should do so.
Every student who doesn't have the current propery, should copy what they wrote for the last property.
After reaching the fourth property, ask students to check if the last number is
1. If it is, ask them to reflect whether they have either one of the properties, but not an even number. Explain that this is what xor does: only if an odd number of conditions is fullfilled, is the result
Now, after they understand this point, go through the 4 properties again but this time ask the students to write
1 as soon as you get to a property they have, and 0 if they don't have the current property.
Every student that has a
1, is a student that an OR operator would result in
true, had they been passed as a parameter (if they are high-school students, they might find being called "parameters" intriguing and this might make more students listen during the lesson).
By comparing the results for the first practice with the one from the second practice, the difference between OR and XOR becomes quite clear.
Another way to make it unquestionably clear is to show the truth table of each operator.
(you iterate the properties)
Think pizza shop. You order a one-topping pie. Would you like pepperoni
or sausage? In common parlance, that's an exclusive or.
I wouldn't bother trying to tie this in to English language. Exclusive or is a strange connective. For example:
$a \oplus (b \oplus c)$
means "An odd number of ($a$, $b$, $c$) is true" (you can see this by working out the truth table). In general if you stack up disjuncts like this, exclusive or means "an odd number of these disjuncts is true"; it is the binary odd counting function.
No connective in natural language behaves in this way, and definitely not English 'or'. For this reason, you should not use the English language to clarify exclusive or.
The 'or' in "You may have ice cream or cake (but not both)" is not even a disjunction, because you can infer from it that you may have ice cream. From a real disjunction like "He is in Paris or London", you can't infer that he is in Paris. Unfortunately, most elementary logic textbooks get this wrong; this highlights the confusion you get when you try to make formal logic clearer by comparing it to natural language. Math is perfectly clear; natural language is a complete mess : )
I think the simplest clarification of the difference between these two connectives is by comparing it to the difference between "At least one of these two things is true", and "Exactly one of these things is true".