Commutative law: A AND B = B AND A, A OR B = B OR A
The commutative law says that the order of the operands does not matter: A AND B = B AND A, A OR B = B OR A, and the same for XOR.
Swapping the inputs of an AND, an OR or an XOR gate changes nothing, which is why these gates are drawn without distinguishing their inputs and why the engine treats the operand order of a chain as a presentation detail. The law is not in the engine's named catalogue because the simplifier applies it implicitly whenever it matches a rule; it is stated here because it is the first law in every textbook list and the one students search for.
Not every operator commutes. Implication does not: A -> B and B -> A are different claims (one is the converse of the other), and NAND and NOR commute as two-input gates but do not associate, which is why the engine keeps them in function form. The biconditional commutes, like XNOR.
The proofs below cover AND and OR on the four rows over A and B.
Statement
A AND B = B AND AA OR B = B OR A Proof by truth table: A AND B = B AND A
| # | A | B | lhs | rhs |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | FALSE | FALSE |
| 2 | TRUE | FALSE | FALSE | FALSE |
| 3 | TRUE | TRUE | TRUE | TRUE |
The same law in four notations
A AND BA && BA ∧ BA·BA \cdot BB AND AB && AB ∧ AB·AB \cdot AProof by truth table: A OR B = B OR A
| # | A | B | lhs | rhs |
|---|---|---|---|---|
| 0 | FALSE | FALSE | FALSE | FALSE |
| 1 | FALSE | TRUE | TRUE | TRUE |
| 2 | TRUE | FALSE | TRUE | TRUE |
| 3 | TRUE | TRUE | TRUE | TRUE |
The same law in four notations
A OR BA || BA ∨ BA + BA + BB OR AB || AB ∨ AB + AB + AThe common slip
Assuming implication commutes. “If it rains, the ground is wet” and “if the ground is wet, it rains” are different claims, and the equivalence checker shows the row where they differ.
Questions
Does the engine reorder my operands when printing?
No. The printed formula keeps the order and the grouping you wrote; the semantics specification says that printing never regroups. The simplifier matches its laws in either order, so (A AND B) OR A is absorbed exactly like A OR (A AND B).
Related
Lesson that teaches this
Tools
- Boolean algebra calculator and simplifier with steps (every law named and verified)
- Logical equivalence checker: two expressions, exact verdict, counterexample
See also
- Associative law: (A AND B) AND C = A AND (B AND C)
- A → B does not give B → A
- The converse slip: A → B is not B → A
Laws
Generated from the Tangibool engine, semantics tangibool-semantics/1, engine 1.0.0, build . Every table, map, simplification and verdict on these pages was computed by the Tangibool engine when the site was built, and every claim was re-checked by the same exact checker the app uses. Limits are stated where they apply. © 2026 Foreranger LTD.