This is an old revision of the document!
Table of Contents
Inclusion, or “inclusivity” in logic and computer science broadly refers to a quality inherent to certain expressions. Specifically, an expression is inclusive if a proposed range of an expression includes the start and end point of that range. Take this expression as an example:
Computer Science
X = greater than 5 AND smaller than 10
In a strict sense, 5 is not greater than 5. A number greater than 5 would be 5.00001, but not 5. Whether an application still counts 5 as being within the range of the original expression depends on how it is built.
For example, number ranges: What are the numbers from 5 to 10? That would be 5, 6, 7, 8, 9 and 10. But one could also say, depending on how they interpret it, 5, 6, 7, 8 and 9.
Both are correct, but one is inclusive, the other exclusive.
Logic
In logic, inclusivity describes whether an expression includes itself. Follow through this example:
AND is a logical operator that returns true if TWO conditions are met at the same time.
(Ball color = red) AND (Ball size = 12), ie. Is the ball red AND size 12?
Returns true iff the ball meets both conditions at the same time.
OR, on the other hand, returns true if at least one of the conditions is met.
(Ball color = red) OR (Ball size = 12), ie. is the ball red OR size 12?
It's like asking “is it at least red? or maybe size 12?”, to which you would say yes if at least one applies. In semantics I would call this a “soft” OR, in logic I call it “inclusive”. Now for contrast:
XOR is an exclusive or. It returns true only when one, and only one condition is met.
(Ball color = red) XOR (Ball size = 12), is the ball red OR size 12?
Is it red or size 12?, asked as if you want only one of these to apply. You can have one or the other, but not both. Think of a child - it can have ice cream XOR candy - ie. one or the other, but not both.