Monday, September 20, 2010

Ambiguity

Upon not having received a response to any of the 10 most recently sent messages, set X to true; otherwise, set X to false.

Enter the life of the software developer in the requirements specification phase of software development, where words do indeed have meaning, often despite the aim of trying to deliver a useful software product to a customer.

Here's a brief glimpse into the nuances of language that the literalness of computers forces into the spotlight. Read the above statement a few more times, and answer the following question: under what conditions, exactly, is X set to true? How many total responses, assuming each sent message results in at most one response, must be received in order for X to be set to true?

Most people would probably say that X is set to true when (and only when) zero total responses are returned. But is this the only interpretation of the statement? Well, no. It depends on how you interpret the word “not”. Seriously.

To figure out what “not” actually means, imagine the statement without the negation.

Upon having received a response to any of the 10 most recently sent messages, set X to true; otherwise, set X to false.

In such a case, it is clear that if one or more total responses are received, then X is set to true. Else (if zero total responses are received), then X is set to false.

The logical negation of this arrangement is to flip around the true and false assignments: if one or more total responses are received, then X is set to false; else (if zero total responses are received), then X is set to true. Simple enough. And this is how most people interpret the first, negated statement.

However, it's not clear within the rules of everyday English that the “not” applies to the entire statement's condition. It could apply only to the sub-condition “having received a response”, meaning, in other words, “having received no response”. This leads to an interpretation of the full statement better worded as:

Upon having received no response from any of the 10 most recently sent messages, set X to true. Otherwise, set X to false.

This statement means something quite different than our original interpretation (assuming you originally interpreted it as most people do). It means that X is set to true if at least one response is not received. Only if all 10 responses are received is X set to false.

Linguistically, this problem has to do with ambiguity in generating a parse tree for the statement, or not having a rigidly defined order of operations. Is the “not” parsed last and applied to the entire sentence's conditional, or is the “not” parsed before the “to any of the 10 most recently sent messages”, thus changing the sentence's meaning?

There are two takeaway points here. The first is that Craig's job is really boring to a lot of people despite it being a never ending source of curiosity for Craig himself. The second point is a bit more inspiring: all people, regardless of their affinity (or lack thereof) for logic and mathematics, possess the ability to do this kind of parsing without even thinking about it. We communicate with others using ambiguous natural languages everyday, and we seem, more often than not, to make sense of what other people mean (and they make sense of what we mean). It is only when we “condescend” to talk to such lowly entities such as computer programs that we realize just how smart people are.

2 comments:

Lindsey said...

Set X to confused.

:)

I will have to read it 9 more times before I have a chance of understanding it.

Anonymous said...

As Kramer said in Sienfield, "These pretzels are dry"