Another silly one, this month; it’s summer, it’s hot and time is short both for writing and reading. Even computer scientists are allowed time off …
OK then …
“To be, or not to be, that is the question” [Hamlet, Act 3, Scene 1; William Shakespeare]
So, if that’s the question, what’s the answer? Let’s see if we can use a bit of Computer Science logic to give the poor prince a hand …
Do please bear in mind that none of this is meant to be in any way serious, starting from the very first step, which is to attempt to ‘translate’ Shakespeare’s version into its ‘equivalent’ ‘logic’ form of:
2b OR NOT(2b)
2b + 2b
in the most common (but already abused) CS Boolean Logic form. (The number of inverted commas in the sentence above give an idea of just how dubious this is and, yes, we’ve already deliberately confused ‘to’ and ‘two’ into the bargain. Let’s just see where it takes us. Also, the line representing the ‘not’ of 2b would normally be above the text rather than below it but WordPress struggles with that. Hey ho; it’s only a bit of summer fun.
Our first problem is that 2b doesn’t really mean anything in Boolean algebra, since it only operates on values of 0 and 1 (or false and true, no and yes, etc.) so what can we make of ‘two of’ something?
Well, clearly, it’s b being combined with itself somehow. In conventional algebra, 2b = b+b, which suggests b OR b as a Boolean function. However, there’s probably an equally good argument for it meaning b AND b, which might be written as b.b or just bb in Boolean. (If 2b is true then perhaps b has to be true, then true again?)
Fortunately, a quick look at the relevant ‘truth tables’ comes to our aid here:
For both operations, AND and OR, 0.0 = 0+0 = 0 and 1.1 = 1+1 = 1. Those are the only two possible values to consider so, in both cases, b.b = b+b = b. In other words, whichever way we want to shake it out, 2b has to be the same as b.
So Hamlet’s question reduces from:
2b + 2b
b + b
(“Be, or not be” in the original Shakespeare, which is what he was trying say anyway, really.) Now, we’re getting somewhere. A further glance at the truth table for NOT shows that 0 = 1 and 1 = 0. In other words, if b is zero then NOT b is one and, if b is one then NOT b is zero. NOT b will always be the opposite of b (of course, that is kinda the definition of NOT) so b + b must be either 0 + 1 or 1 + 0 one way round or the other. The order doesn’t actually matter (check the truth table for OR) so we can simplify:
b + b
1 + 0 (or 0 + 1 but it makes no difference)
Looking again at the truth table for OR, we can see that 1 + 0 = 0 + 1 = 1 in both cases so we can show the whole reduction as:
2b OR NOT(2b)
= 2b + 2b
= b + b
= 1 + 0 (or 0 + 1)
So the result is true. The answer to the question, “To be, or not to be”, is, “Yes”. Er, right … so that’s that then.
Alternatively, there’s a particular term for a logical expression that always comes out true, whatever the inputs are. It’s called a tautology (a slightly refined usage of the general English meaning). So, in fact, we could rewrite that part of the play and save future generations of school-kids a considerable amount of bewilderment in getting to grips with the rest of the soliloquy …
“To be, or not to be, that is the question …”
Disembodied voice from darkness of nunnery:
“Sorry sunshine, let me stop you there … That’s not a question; it’s a tautology. Now just run along and kill your uncle, will you? There’s a good lad; then we can all go home before the pubs shut …
Normal service will be resumed as soon as possible.