Skip to content

Instantly share code, notes, and snippets.

@pavly-gerges
Last active March 6, 2025 20:23
Show Gist options
  • Save pavly-gerges/24530dffeed91c1fdca1453b29aa21de to your computer and use it in GitHub Desktop.
Save pavly-gerges/24530dffeed91c1fdca1453b29aa21de to your computer and use it in GitHub Desktop.

Inclusive OR V.S. Exclusive OR: A deeper look

This guide establishes a deeper proof-based look into the inclusive OR (i.e., Logical Disjunction) and the exclusive OR (i.e., Mutually Exclusive or Mutually Imparted Events).

Note

Before getting started, here is a very quick whiteboard into the intuitionism behind the inclusive operations and the exclusive operations, and logical equivalences for each of them; notice the use of the intermediary formulas (e.g., Disjunctive and Conjunctive Normal Forms):

Inclusive OR Exclusive OR
inclusive-or exclusive-or

The main take off messages here are:

  • Logical Inclusive Disjunctions represent all the probablities in which the event $$p$$ only happens or the event $$q$$ only happens or both of them happens (i.e., hence the name "inclusive").
  • Logical Exclusive Disjunctions represent all the probablities in which only the event $$p$$ or the only the event $$q$$ could happen. However, both cannot happen at the same time (i.e., hence the name "exclusive").
  • Concurrency Programming: Logical Inclusive Disjunctions could be used in this context to model Asynchronous or Parallel executing tasks from two different threads (i.e., Mutually Inclusive Events); in this case both of them could return at the same time (i.e., inclusiveness applied) or at any later time.
  • Concurrency Programming: Logical Exclusive Disjunctions could be used in this context to model Synchronous or Serially executing tasks from two different threads (i.e., Mutually Exclusive Events); in this case ONLY one task is allowed to execute (i.e., exclusiveness applied).
  • Bitwise Manipulation and Switching Algebra: Logical Inclusive Disjunctions could be used to add up all pins state on a digital module (e.g., GPIO Module).
  • Bitwise Manipulation and Switching Algebra: Logical Exclusive Disjunctions could be used to test whether 2 states are different (in this case, the operation returns true).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment