Skip to content

Instantly share code, notes, and snippets.

@gladchinda
Created October 13, 2018 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gladchinda/6b20014bd28efea534e11ce05c677fd5 to your computer and use it in GitHub Desktop.
Save gladchinda/6b20014bd28efea534e11ce05c677fd5 to your computer and use it in GitHub Desktop.
// NOT Conversion
!!A == A
!!B == B
!!C == C
// AND to OR Conversion
A && B == !(!A || !B)
// OR to AND Conversion
A || B == !(!A && !B)
// Removing nested AND
A || (B && C) == A || B && C
// Removing nested OR
A && (B || C) == !(!A || !B && !C)
@tonix-tuft
Copy link

For the last one, A && (B || C) == !(!A || !B && !C), I would add A && (B || C) == !(!A || !B && !C) == A && B || A && C (boolean algebra).

Double negation can be difficult to understand sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment