Inclusive and Exclusive OR in informal speech

As good computer scientists, we know that there are two kinds of OR.

An inclusive OR, which is what we nearly always need in programming, is true if either of its branches is true: “exit this loop if we’ve processed 50 items OR there are none left to process.”

An exclusive OR is true if exactly one if its branches is true, but not if both are. “If player 1 is attacking player 2 OR player 2 is attacking player 1 (but not both) then inflict damage.” [This is a contrived example: that’s because it’s hard to think of non-contrived examples — they hardly ever come up in real programs.]


When we use “or” in informal speech, we nearly always mean exclusive or. If I tell you I’m going to the cinema to see Skyfall on Wednesday or Thursday, you understand that I will go on one day or the other, but not both. If I ask you what you want to drink and you say Abbot Ale or Ruddles County, you’d be surprised (but maybe not disappointed) if I brought you two pints.

Inclusive OR is much less common in informal speech, but it does happen. If Chelsea win the League or the European Cup, then their manager will keep his job. He certainly wouldn’t expect to be sacked for winning both!

Why it is that we overwhelmingly use inclusive OR in programming and exclusive in informal contexts?

It also interests me that we use the same word, “or”, in both contexts: for saying which day we’re going to see Skyfall, and for predicting whether a football manager will keep his job. It feels like this ought to be ambiguous, but in practice it never seems to be.

Can anyone think of an example of a sentence where either kind of OR might be meant?

Are there natural languages in which inclusive OR and exclusive OR are represented by different words? (They are, after all, represented by different operators in programming languages.)

19 responses to “Inclusive and Exclusive OR in informal speech

  1. Exclusive-or is absolutely everywhere in common speech: remember that xor is the boolean logic equivalent to inequality. This is why in C-family languages that have pairs of boolean/bitwise operators like ||, | = or, &&, & = and, but only ^ for bitwise-xor; ^^ for logic-xor is not necessary because != will do that for you perfectly. To put differently, the operator ^ can be considered a SIMD version of inequality over an array of booleans encoded as bits. (A SIMD version of equality is not necessary as common == over integer has that effect if the integer is interpreted as an array of booleans.)

  2. I’m not sure language had to be particularly precise when it was mostly being conducted verbally. There were just so many other clues, then non-verbal language of the other person, a physical context and so on. You know you’re in a pub, you know your mate is familiar with you only drinking one drink at a time.

    It’s like the way nobody felt words needed precise spelling until so recently, Shakespeare spelling his own name many different ways and so on.

    So I suppose it’s possible terms for inclusive OR could start to appear, perhaps even creeping out of programming into common speech. I’ve found myself resorting to the clumsy “and/or” a few times.

  3. Exclusive-or conditions occur frequently in programs, but we usually express them with else-if syntax. Note that we do this in natural language as well, when we feel that it is necessary to be explicit about the exclusivity, and high-level programming languages simply adopted the same syntax. In English, we also use the either…or syntax, but if you already have ‘if’ and ‘else’ in your programming language, you are unlikely to add ‘either…or’ (I’m sure there is at least one language that has it, though.)

  4. Oh, of course! “And/or” is the (horrible) English-language word for exclusive OR.

  5. I don’t get it, araybold: if/then/else is a completely different thing from OR and XOR. It’s a control structure that says what to do if a condition is or isn’t satisfied — that’s not the same thing as the vocabulary with which the condition itself is expressed.

  6. “They can go by car or walk.”

    The or could be both exclusive and inclusive, depending on whether “they” must travel together.

    I can’t think of a way an either-or construction would be inclusive (and also not a single conjunction anymore), but there also doesn’t seem to be an exclusively inclusive (:D) form of or.

    An interesting topic, I’ll think about it more :)

  7. In human language it appears that words for OR developed from the sense of exclusivity. for instance, the Hebrew “‘o” meant “except” as well as “or”. The Greek “e” also carries an almost exclusively (ha) exclusive sense. Often in older literature, you’ll find the inclusive OR stated long-hand: “A or B or both”, because the exclusive nature of “or” is presumed. The question should be, how did that get confused in formal logic?

  8. In Latin, uel is inclusive or, and aut is exclusive or.

    The different frequencies in natural language and programs might be because they’re used for different purposes: or in programs is usually asking a question, while “or” in natural language is usually enumerating alternatives — more like an arbitrary-choice operator than a Boolean operator.

  9. Oliver Townshend

    My best friend is slightly aspergic, and will answer the question “would you like tea or coffee” with yes. Maybe being a programmer hasn’t been good for him, or maybe he’s too literal. So it’s a language problem for at least one person.

  10. @Oliver I often respond that way just to be cheeky. Or better yet, “Insufficient data. I would need to sample at least one and perhaps both of them before I could respond.”

  11. Oliver Townshend

    That sounds familiar…

  12. From my days as a linguistics student I remember a similar problem, namely that of inclusive vs. exclusive “we”, i.e. whether the term includes the person being spoken to. (“I and some friends but not you” vs. “You and I and perhaps others”)
    I think that difference is actually more likely to induce (potentially embarrassing) misunderstandings, and I know that quite many languages actually have separate words for it – which I’m not sure is the case with or/xor.

  13. Yes, the inclusive/exclusive “we” problem is interesting, too. I am not good at languages, but I know a smattering of French and German, and I remember being surprised when learning them that neither of these languages makes a distinction between the two terms. What languages do?

  14. I didn’t put it very clearly, but this is what I had in mind:

    if you would like a pint of Ruddles, then return a pint of Ruddles
    else if you would like a pint of Abbot, then return a pint of Abbot

    i don’t think the first case, about when you might see Skyfall, would appear in an imperative programming language as an expression using either or or xor – it would manifest itself as something like two rows in a normalized database, or a list of two dates returned as a response to a query. As in natural language, the exclusivity would be implicit in the context, and using the result in a way contrary to that meaning would lead to an error.

  15. There are two words for ‘or’ in Polish: ‘lub’ and ‘albo’. They both are mostly used as exclusive or in informal speech, but at least in law terms the former is inclusive and the latter exclusive.

  16. This is an interesting question, and one I have spent many hours researching. My seminal paper, “What the hell are you on about?” is the acknowledged authoritative work on the subject, but here I will briefly summarise the main points.

    Introducing selector logic
    Remarkable thought it might seem to computer programmers, in everyday speech when using the conjunctions ‘and’ and ‘or’. humans actually use a system of logic based on selection, rather than truth and falsehood.

    The advantage of selector logic over zero-order propositional forms is that it allows people to transmit concepts like “this”, “that”, “either”, “both” and “neither” using just a single operator. Furthermore, the choice of operator can be used to set expectations over the possible response domain. Thus, “Tea or coffee?” expects “tea”, “coffee”. “either” or “neither” – but not “both” as responses, while ”Milk and sugar?” expects “milk”, “sugar”, “both” or “neither”,- but not “either”. The response “I’d rather have a G & T in fact” is an example of the substitutionary response principle in selector logic. It can occasionally catch people by surprise, particularly at breakfast time.

    Comparison with binary logic systems
    The primary difference we observe between the selector and binary logic systems is that selector operations are not constrained to single-bit responses. Intense information-theoretical analysis of this phenomenon led to the prediction that fewer selection operators should exist in selector logic than in binary logic. Careful study of the respective fields has in fact yielded empirical results in line with theory. Selector logic has just two operations “and” and “or” when compared with binary logic that traditionally has three: “and”, “or”, “xor”. This result is considered a triumphant vindication of selector logic theory.

    Another important distinction is that selector logic is only partially closed under truth-functional connectives. In selector logic some (non-discriminatory) outputs are mappable to boolean functions. For example, EITHER maps to “xor”, NEITHER to “nand” and BOTH to “and”. (“Or” is the least useful boolean function in this regard, mapping to the undifferentiated selector response “WHATEVER DUDE”)

    However not all selector responses can be similarly mapped. THIS and THAT being discriminator outputs have no direct representation in propositional logic.

    Interestingly, it is this non-mapping mismatch between selector and boolean logic which gives rise to otherwise intelligent people to responding ‘yes’ to the question ‘is your cat alive or dead?’ and not – as is widely believed – a result of quantum uncertainty.

    Current difficulties
    Despite its richer solution domain when compared with purely binary systems, selector logic is not without its own problems. Recently my wife asked me to go the shops and buy some “oranges and lemons or limes”. Having reached my destination, I realised I was unable to parse her request. Did she mean oranges and (lemons or limes) or (oranges and lemons) or limes? (Although my wife is given to hyperbole from time to time, she rarely speaks parenthetically. This is clearly something she needs to work on) So what was I to do? Technically speaking, selector logic does allow for an inclusive understanding of ‘or’ but the inconvenience of a surfeit of citrus fruit lying about the house for weeks put me off such an interpretation. So I took advantage of another attribute of selector logic, the substitutionary response principle, and bought chocolate instead.


  17. The Czech language makes a diffence between OR and XOR in written form (coma majes the difference):
    ,nebo = XOR
    nebo = OR

  18. Turkish makes a difference between the inclusive and exclusive or ,although the distinction is rarely made in informal speech. Now, they are basically used interchangeably, which is quite sad because having such a distinction makes it cognitively less costly to process information.
    veya=inclusive or
    ya da= exclusive or

  19. Turkish language is also very close to Azerbaijani. That’s why in Azerbaijani language there are also two different words for ORs:
    Və ya — inclusive OR
    Ya, ya da — exclusive OR

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.