Boolean Algebra


Boolean algebra is the branch of algebra in which the values of the variables are the truth values true and false

Expressions

Operators

Exclusive Or

P or Q, but not both: P+Q=(P¬Q)(¬PQ)P + Q = (P \land \lnot Q) \lor (\lnot P \land Q).

PP QQ P+QP + Q P¬QP \land \lnot Q ¬PQ\lnot P \land Q
F F F F F
F T T F T
T F T T F
T T F F F

Nor

Neither P nor Q: PQ=¬P¬QP \downarrow Q = \lnot P \land \lnot Q.

PP QQ PQP \downarrow Q ¬P\lnot P ¬Q\lnot Q
F F T T T
F T F T F
T F F F T
T T F F F

Negative And (NAND)

P and Q are not both true: PQ=¬P¬QP \mid Q = \lnot P \lor \lnot Q.

PP QQ PQP \mid Q ¬P\lnot P ¬Q\lnot Q
F F T T T
F T T T F
T F T F T
T T F F F

Conditional

If P, then Q: PQ=¬PQP \rightarrow Q = \lnot P \lor Q. It is sometimes described like this:

PP QQ PQP \rightarrow Q ¬P\lnot P
F F T T
F T T T
T F F F
T T T F

A conditional can also be expressed in the following form, called contrapositive: PQ=¬Q¬PP \rightarrow Q = \lnot Q \rightarrow \lnot P.

PP QQ ¬Q¬P\lnot Q \rightarrow \lnot P ¬Q\lnot Q ¬P\lnot P
F F T T T
F T T F T
T F F T F
T T T F F

Proof:

PQ=¬Q¬P=Q¬P=¬PQ=PQ\begin{align} P \rightarrow Q &= \lnot Q \rightarrow \lnot P \ &= Q \lor \lnot P \ &= \lnot P \lor Q \ &= P \rightarrow Q \end{align}

Biconditional (iff)

P if and only Q: PQ=(PQ)(QP)P \iff Q = (P \rightarrow Q) \land (Q \rightarrow P).

PP QQ PQP \iff Q PQP \rightarrow Q QPQ \rightarrow P
F F T T T
F T F T F
T F F F T
T T T T T

Laws

DeMorgan’s Laws

¬(PQ)=¬P¬Q¬(PQ)=¬P¬Q \lnot (P \land Q) = \lnot P \lor \lnot Q \ \lnot (P \lor Q) = \lnot P \land \lnot Q

Commutative Laws

PQ=QPPQ=QP P \land Q = Q \land P \ P \lor Q = Q \lor P

Associative Laws

P(QR)=(PQ)RP(QR)=(PQ)R P \land (Q \land R) = (P \land Q) \land R \ P \lor (Q \lor R) = (P \lor Q) \lor R

Idempotence Laws

PPPPPP P \land P \iff P \ P \lor P \iff P

Unit Element Laws

PtruePPtruetrue P \land true \iff P \ P \lor true \iff true

Zero Element Laws

PfalsefalsePfalseP P \land false \iff false \ P \lor false \iff P

Complement Laws

P¬PfalseP¬Ptrue P \land \lnot P \iff false \ P \lor \lnot P \iff true

Distributive Laws

P(QR)=(PQ)(PR)P(QR)=(PQ)(PR) P \land (Q \lor R) = (P \land Q) \lor (P \land R) \ P \lor (Q \land R) = (P \lor Q) \land (P \lor R)

Absorption Laws

P(PQ)=PP(PQ)=P P \lor (P \land Q) = P \ P \land (P \lor Q) = P

Double Negation Law

¬¬P=P\lnot \lnot P = P

Truth Sets

The truth set of a statement P(x)P(x) is the set of all values of xx that make the statement P(x)P(x) true.