LOGICAL AND - a ∧ b
(a && b
) - is true if A and B are both true; else it is false.
LOGICAL OR - a ∨ b
(a || b
) - is true if A or B (or both) are true; if both are false, the statement is false.
LOGICAL XOR - a ⊕ b
(a != b
) - is true when either A or B, but not both, are true.
EQUIVALENCE - a ↔ b
(a == b
) - means A is true if B is true and A is false if B is false
LOGICAL NOT - ¬a
(!a
) - is true if and only if A is false.
IMPLICATION - a → b
(!a || b
) - means if A is true then B is also true; if A is false then nothing is said about B.
TERNARY - a ∧ b ∨ c
(a ? b : c
) -
a | b | a ∧ b | a ∨ b | a ⊕ b | a ↔ b | ¬a | a → b |
---|---|---|---|---|---|---|---|
0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
0 | 1 | 0 | 1 | 1 | 0 | 1 | 1 |
1 | 0 | 0 | 1 | 1 | 0 | 0 | 0 |
1 | 1 | 1 | 1 | 0 | 1 | 0 | 1 |
Disjunctions and conjunctions are binary operations, meaning they only operate on two inputs
(a ∧ b) ∧ c = a ∧ (b ∧ c)
(a ∨ b) ∨ c = a ∨ (b ∨ c)
(a ⊕ b) ⊕ c = a ⊕ (b ⊕ c)
a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)
a ∨ (b ∧ c) = (a ∨ b) ∧ (a ∨ c)
a ∧ (b ⊕ c) = (a ∧ b) ⊕ (a ∧ c)
a ∧ b ∨ c = (a → b) ∧ (¬a → c)
Any disjunction (||), conjunction (&&), or bicondition (===) can swap the order of its parts*.
a ∧ b = b ∧ a
a ∨ b = b ∨ a
a ⊕ b = b ⊕ a
a ↔ b = b ↔ a
¬(a ∨ b) = ¬a ∧ ¬b
¬(a ∧ b) = ¬a ∨ ¬b
¬¬a = a