Sunday, May 8, 2011

The Town of Bool: Part 1 of Ann's encounter with the Booleans

Boolean logic is based on two values: TRUE and FALSE (or alternately ON and OFF for physical transistors). Complex logical expressions can be formed by using a few simple operations, such as: AND, OR, and NOT. These expressions allow computers to perform logic such as: adding binary digits, determining if an IF statement executes, or controlling when a loop terminates.

Ann found her short stay in the town of Bool most annoying. She had always heard that the Booleans were strict believers in binary logic -- everything was either true or false. She had naturally assumed that this simply meant that they were opinionated. For example, she would not expect anyone in Bool to state “Jazz is okay”. Opinions would be definite. However, she had not expected this philosophy to apply to absolutely every single aspect of life.

The first surprise had come at a local restaurant.

“May I get some more water, please?” Ann asked a waiter.

“No.” he replied. “I only refill a glass if it is: empty AND you are still eating.”

“I am still eating.” Ann assured him.

“Yes. But your glass is NOT empty.” he responded as he moved off to the next table.

Ann looked down at her glass. There was at most three drops of water left at the bottom. Ann sighed and finished those drops in preparation for the waiter's return. She decided that in this case she was going to embrace their binary philosophy and NOT give him a tip.

Luckily, Ann was well equipped for her stay. She had studied Boolean logic as an elective in kindergarten. It all came down to a few simple rules:
  • There were only two options TRUE and FALSE,
  • A AND B evaluated to TRUE if and only if both A and B were TRUE,
  • A OR B evaluated to TRUE if either A or B were TRUE,
  • NOT A evaluated to TRUE if and only if A was FALSE.
Conceptually, it was very simple and matched how most people used the terms in everyday life. Unfortunately though, the laws of Boolean logic were not really designed for living everyday life.

Over the course of her 16 hour stay, Ann continued to experience the frustration of dealing with the Booleans' world. She found that when the park proclaimed that it was “closed at dark”, the patrons would stay until the sun had technically set and then run out of the park. Similarly, getting directions turned out to be extremely aggravating.

“Is the hotel in that direction?” she asked, pointing approximately south east.

“It is NOT in that direction,” proclaimed a Boolean on the street. “It is in that direction.” The Boolean was pointing in almost, but not exactly, the same direction. Ann sighed and walked in approximately the correct direction.

“You are NOT going in the correct direction.” the Boolean shouted after her. Ann ignored him.

Even the signage in Bool was overly logical. The crosswalk light actually said “Cross when the WALK light is on AND there are no cars speeding toward you.” Did they really need to clarify that? Ann wondered what would happen if someone misprinted the sign to use an OR? Would it be chaos?

It was not until she reached the hotel that Ann really understood the true adherence to this logical formulation. There, on the back of her hotel door, was a fire escape plan like you would find at any hotel. Except in this case, all of the conditions were specified as long Boolean logic statements. “Use the South Stairs if: (they are NOT on fire AND the north stairs are on fire) OR (there is an obstruction in the hall toward the north stairs) OR …”

After reading the sign four times, Ann decided that in the event of a fire she would be too confused to escape. She promptly resolved to leave Bool as soon as she could.

----------------------------

Read Part 2 of Ann's encounter with the Booleans in Part 2: The Gates of XOR. Or see how the Booleans like to trick people in Fun with Boolean Statements.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.