Skip to content

Associative law: (A AND B) AND C = A AND (B AND C)

The associative law says that regrouping a chain of the same operator does not change its value: (A AND B) AND C = A AND (B AND C), and likewise for OR and XOR.

Engine name: AssociativityFR: AssociativitéDE: Assoziativgesetz

Regrouping a chain of the same operator (AND, OR, or XOR) does not change its value.

Because the grouping does not matter, the engine writes a chain without inner brackets, A AND B AND C, and treats it as one gate with three inputs. That is also why the parser lets you omit brackets in a same-operator chain but insists on them when operators are mixed: A AND B OR C is read by precedence, and A -> B -> C associates to the right, which is a different rule.

Associativity is what lets a circuit designer build a four-input AND from three two-input gates in any tree shape, and what lets the simplifier regroup (A AND B) AND A into one chain, recorded as an associativity step, before idempotence removes the duplicate.

The proof below is over three variables, eight rows, and the engine checks each regrouping against the flat chain.

Statement

(A AND B) AND C = A AND (B AND C) = A AND B AND C

Proof by truth table: (A AND B) AND C = A AND (B AND C) = A AND B AND C

(A AND B) AND C = A AND (B AND C) = A AND B AND C
#ABClhsmid1rhs
0FALSEFALSEFALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSEFALSEFALSE
2FALSETRUEFALSEFALSEFALSEFALSE
3FALSETRUETRUEFALSEFALSEFALSE
4TRUEFALSEFALSEFALSEFALSEFALSE
5TRUEFALSETRUEFALSEFALSEFALSE
6TRUETRUEFALSEFALSEFALSEFALSE
7TRUETRUETRUETRUETRUETRUE
lhs ≡ mid1 holds · lhs and mid1 agree on every assignment. · Exhaustively checked and solver cross-checked · 8 rows
mid1 ≡ rhs holds · mid1 and rhs agree on every assignment. · Exhaustively checked and solver cross-checked · 8 rows

The same law in four notations

Words(A AND B) AND C
Programming(A && B) && C
Mathematical(A ∧ B) ∧ C
Algebra(A·B)·C
LaTeX\left(A \cdot B\right) \cdot C
WordsA AND (B AND C)
ProgrammingA && (B && C)
MathematicalA ∧ (B ∧ C)
AlgebraA·(B·C)
LaTeXA \cdot \left(B \cdot C\right)
WordsA AND B AND C
ProgrammingA && B && C
MathematicalA ∧ B ∧ C
AlgebraA·B·C
LaTeXA \cdot B \cdot C
(A AND B) AND C = A AND (B AND C) = A AND B AND C (A AND B) AND C = A AND (B AND C) = A AND B AND C A B C lhsPRIMARY mid1 rhs AND AND AND AND AND
(A AND B) AND C = A AND (B AND C) = A AND B AND C (A AND B) AND C = A AND (B AND C) = A AND B AND C A B C lhsPRIMARY mid1 rhs AND AND AND AND AND

The common slip

Assuming implication is associative. (A -> B) -> C and A -> (B -> C) are different formulas; the engine reads an unbracketed chain A -> B -> C as A -> (B -> C), and the equivalence checker shows the row where the other grouping differs.

Questions

Does associativity hold for NAND and NOR?

No, and that is why the engine only accepts them in function form with exactly two operands. NAND(NAND(A, B), C) and NAND(A, NAND(B, C)) are different functions.

Related

Lesson that teaches this

Pitfalls

Tools

See also

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.