Harolds Logic Cheat Sheet
Harolds Logic Cheat Sheet
4 November 2024
∧, ∧, ∧, ⋀,
p and q
p∧q
p, but q
1) Intersection despite the fact that p, q
∧ even though p, q
although p, q
overlap
∨, ∨, ∨, ⋁,
Disjunction
p∨q
p or q
2) Union
∨ inclusive or
both combined
3) Negation ¬, ¬ ¬p not p
if p then q
if p, q
→, →, →, ⟶,
q if p
⇒, ⟹
p implies q
4) Conditional p→q
p only if q
q in case that p
p is sufficient for q
q is necessary for p
p iff q
↔, ⟷, ↔, ⇔,
p⟷q
p if and only if q
⟺
5) Biconditional p is necessary and sufficient for q
if p then q, and conversely
if not p then not q, and conversely
∀x ∀x p(x)
for all
6) Universal
for any
Quantifier
for each
∃x ∃x p(x)
7) Existential there exists
Quantifier there is at least one
is identical to
≡, ≡, ≡
is equivalent to
expression1 ≡
Equivalence is defined as
expression2
the two expressions always have
the same truth value
The structure of all mathematical statements can be understood using these symbols.
All mathematical reasoning can be analyzed in terms of the proper use of these symbols.
p∨p≡p p∧p≡p
Universal Bound Laws
Idempotent Laws
Double Negations or
¬ ¬p ≡ p
p ∨ ¬p ≡ T p ∧ ¬p ≡ F
Involution Law
Negation, Complement, or
p∨q≡q∨p p∧q≡q∧p
Complementary Laws ¬F ≡ T ¬T ≡ F
(p ∨ q) ∨ r ≡ p ∨ (q ∨ r) (p ∧ q) ∧ r ≡ p ∧ (q ∧ r)
Commutative Laws
p ∧ (q ∨ r) ≡ (p ∧ q) ∨ (p ∧ r) p ∨ (q ∧ r) ≡ (p ∨ q) ∧ (p ∨ r)
Associative Laws
(p ∧ q) ∨ (p ∧ ¬q) ≡ p (p ∨ q) ∧ (p ∨ ¬q) ≡ p
Distributive Laws
p ∨ (p ∧ q) ≡ p p ∧ (p ∨ q) ≡ p
Uniting Laws
p ∨ q ≡ ¬(¬p ∧ ¬q)
Absorption Laws
p ∧ q ≡ ¬(¬p ∨ ¬q)
¬(p ∨ q) ≡ ¬p ∧ ¬q
¬(p ∧ q) ≡ ¬p ∨ ¬q
De Morgan’s Law
(p ∨ ¬q) → r ≡ ¬r → (¬p ∧ q)
(Propositional Logic)
(p ∨ q) ∧ (¬p ∨ r) ≡ (p ∧ q) ∨ (¬p ∧ r) ≡
(p ∧ r) ∨ (¬p ∧ q) (p ∨ r) ∧ (¬p ∨ q)
Multiplying and Factoring
Laws
(p ∧ q) ∨ (q ∧ r) ∨ (¬p ∧ r) ≡ (p ∨ q) ∧ (q ∨ r) ∧ (¬p ∨ r) ≡
(p ∧ q) ∨ (¬p ∧ r) (p ∨ q) ∧ (¬p ∨ r)
Consensus Laws
p ∨ (⊤) ≡ ⊤
p ∧ (⊤) ≡ p
p ∨ ¬p ≡ ⊤ (True)
¬(⊤) = ⊥
Tautology Laws (⊤)
p ∧ (⊥) ≡ ⊥
p ∨ (⊥) ≡ p
p ∧ ¬p ≡ ⊥ (False)
¬(⊥) ≡ ⊤
Contradiction Laws (⊥)
0110 ⨁ x ⨁ y ,x ≢ y , x
y
Exclusive disjunction; nonequivalence; XOR
1011 ⊂ x∨ y ,x ⊂ y ,x ⇐ y ,[x ≥ y ], x
y
Converse implication; IF
x ∨ y , x ⊃ y , x⇒
1101 ⊃ Implication; only if; if … then
y ,[x ≤ y], y
x
Donald E. Knuth (1968). 7.1.1 Boolean Basics, The Art of Computer Programming, Pre-fascicle 0B: The
sixteen logical operations in two variables. See also Wikipedia, Truth function.
p ∨ q ≡ ¬p → q
Logical Equivalences:
p ∧ q ≡ ¬(p → ¬q)
Conditional, If ... Then,
¬(p → q) ≡ p ∧ ¬q
Conditional Laws p→q
Implication
(p → q) ∧ (p → r) ≡ p → (q ∧ r)
(p → q) ∨ (p → r) ≡ p → (q ∨ r)
(p → r) ∧ (q → r) ≡ (p ∧ q) → r
(p → r) ∨ (q → r) ≡ (p ∨ q) → r
(p → q) ∧ (q → p)
(p → q) ∧ (¬p → ¬q)
(p ∧ q) ∨ (¬p ∧ ¬q)
Biconditional Bi-conditional, If and only If, iff,
p↔q ¬p ↔ ¬q
Laws XNOR
Logical Equivalences:
¬(p ↔ q) ≡ p ↔ ¬q
Sufficient p is a sufficient
The truth of p suffices to guarantee the truth of q.
Condition condition for q
Necessary q is a necessary For p to be true, it is necessary for q to be true also.
Condition condition for p ¬q → ¬p
Is logically equivalent to (p ≡ ¬
p⟹q
p≡q
Equivalence p↔q ¬ p)
Is equivalent to
≢q→p
Contrapositive p→q ≡ ¬q → ¬p True
≢ ¬p → ¬q
Converse* p→q False
Inverse* p→q False
Therefore.
Therefore ∴
In conclusion.
p It is raining today.
Modus Ponens p→q If it is raining today, I will not ride my bike to school.
∴q Therefore, I will not ride my bike to school.
¬q If Sam studied for his test, then Sam passed his test.
Modus Tollens p→q Sam did not pass his test.
∴¬ p Therefore, Sam did not study for his test.
It is raining today.
Addition, p
Therefore, it is either It is raining today or snowing
Generalization ∴ p∨q
today or both.
p ∨q It is raining or it is Monday.
Proof by Division into p→r It is raining so it is wet.
Cases q →r It is Monday so it is wet.
∴r It is wet.
Logical
Definition Is Equivalent To (≡) Description
Expression
Universe of Discourse
Universe of All possible inputs in a given
U Universal Set
Discourse range
Universe
𝔻
Domain of All possible inputs in a given Domain of Discourse
Discourse range Universe of Discourse
Must be True or False
Proposition or p: “Roxy is a
p Cannot be a question
Logical Statement mammal”
Cannot be a command
A logical statement
whose truth value is a
function of one or more
P(x): “x is a variables
Predicate P(x)
mammal” Truth depends upon the
input variable x
P(x) ≠ a number
P(5) is a proposition
q: ∀x ∈ 𝔻,
Is either True or False
“For all x in the domain of A quantified predicate
P(x): “x is a
Example discourse, P(x) is a mammal.” turns it into a logical
mammal”
Statements statement
Predicate with two input
T(x, y) “x is a twin of y.”
variables
T = {a ∈ A | P(a)}
T = {a | P(a)}
Truth Set The set of all values of x that
a ∈T
T = P(x)
(Single Free make the statement p(x) true
Variable)
(a, b) ∈ T
T = P(x, y) Cross product truth set
Truth Set {(p, n) ∈ P × ℕ | the person p has n children} = {(John, 2), …}
Logical
Definition Is Equivalent To (≡) English
Expression
for all
∀x P(x)
“For all x in the domain, P(x) is true” all elements
∀x ∈ P(x)
for each member
∀x ∈ A P(x) ≡ ∀x (x ∈ A → P(x))
∀x ∈ 𝔻, P(x)
any
Universal
every
Quantifier
∀x, if x is in 𝔻
everyone
(∀) For the finite set domain of discourse
everybody
P(x) ≠ ∅
it is the case that
equal to ∅
the truth set is not
∃!x P(x)
there exists exactly
∃x (P(x) ∧ ∀y (P(y) → y = x))
Uniqueness
one
∃x ∀y (P(y) ↔ y = x)
Quantifier
(∃!) there is exactly one x
such that P(x)
∃x P(x) ∧ ∀y ∀z((P(y) ∧ P(z)) → y = z)
Counterexample for x, y ∈ ℤ:
Nested / Multiple- False
∀x ∃y P(x, y) ≢ ∃x ∀y P(x, y)
∀x ∃y (x + y = 0) ≡ True
Quantified
∃x ∀y (x + y = 0) ≡ False
Statements
∃!x P(x)
exactly one person <did
Exactly One
something>
No One ¬∃x (P(x) no one <did something>
A B
∀x (P(x) ∧ Q(x)) (∀x P(x) ∧ ∀x Q(x))
∃x (P(x) ∧ Q(x)) (∃x P(x) ∧ ∃x Q(x))
≡
∀x ¬P(x)
≡
∃x ¬P(x)
≡ ¬∃x P(x)
∀x ∃y T(x, y) ∃y ∀x T(x, y)
≡ ¬∀x P(x)
∀x ∀y T(x, y) ∀y ∀x T(x, y)
←
∃x ∃y T(x, y) ∃y ∃x T(x, y)
≡
∀x (P(x) → R)
≡
∃x (P(x) → R)
≡ (∃x P(x) → R)
∀x (R → Q(x)) (R → ∀x Q(x))
→ (∀x P(x) → R)
∃x (R → Q(x)) (R → ∃x Q(x))
≡
∀x R
→
∃x R
← R
→ R
Note: The above formulas are valid in classical first-order logic assuming that x does not occur free in R.
A B Counterexample
∃x (P(x) ∧ Q(x)) (∃x P(x) ∧ ∃x Q(x))
∀x (P(x) ∨ Q(x)) (∀x P(x) ∨ ∀x Q(x))
← D = {a, b}, M = {P(a), Q(b)}
∀x ∃y T(x, y) ∃y ∀x T(x, y)
→ D = {a, b}, M = {P(a), Q(a)}
∃x (P(x) → R)
→ D = {a, b}, M = {T(a, b), T(b, a)}
∃x (R → Q(x)) (R → ∃x Q(x))
← (∀x P(x) → R) D = Ø, M = {R}
∀x R
← D = Ø, M = Ø
∃x R
→ R D = Ø, M = Ø
← R D = Ø, M = {R}
Note: if empty domains are not allowed, then the last four implications above are in fact valid.
⊼ ⊽ ⊻,⊕ ⊙
Conjunction NAND Disjunction NOR XOR XNOR Negation
∧ ∨
p q (and) (or) (not)
¬P
F F F T F T F T
F T F T T F T F T
T F F T T F T F F
T T T F T F F T
⊤ ⊥
p q (If … Then) (Iff) (True) (False)
→ ↔
F F T T T F
F T T F T F
T F F F T F
T T T T T F
See also
Harold’s Sets Cheat Sheet
Harold’s Boolean Algebra Cheat Sheet
Harold’s Proofs Cheat Sheet
https://byjus.com/maths/set-theory-symbols/
https://en.wikipedia.org/wiki/List_of_logic_symbols
https://en.wikipedia.org/wiki/Truth_function#Table_of_binary_truth_functions
https://nokyotsu.com/qscripts/2014/07/distribution-of-quantifiers-over-logic-connectives.html
Donald E. Knuth (1968). 7.1.1 Boolean Basics, The Art of Computer Programming, Pre-fascicle 0B: The
sixteen logical operations in two variables.