Math Fundamentals18 sections · 814 units
Open in Course

Logical Equivalences

Rewriting expressions

Two boolean expressions are logically equivalent if they produce the same output for all input combinations. De Morgan's Laws are examples of equivalences.

Other equivalences: double negation (¬(¬A)=A\neg(\neg A) = A), idempotence (AA=AA \land A = A, AA=AA \lor A = A), and identity laws (Atrue=AA \land true = A, Afalse=AA \lor false = A).

You can use equivalences to simplify code. If you see x && true, simplify to x. If you see x || false, simplify to x. Remove redundancy.