Skip to content

Counting-constraint expansion: AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C)

Counting-constraint expansion rewrites AT_LEAST(k; …), AT_MOST(k; …) and EXACTLY(k; …) over their operands with AND, OR and NOT, so that normal forms, Karnaugh maps and gate bases can work on a plain formula: AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C).

Engine name: Counting-constraint expansionFR: Développement d'une contrainte de comptageDE: Entfaltung einer Zählbedingung

A counting constraint is rewritten over its operands: "at least k" is built by counting the operands one by one with AND and OR, "at most k" is the negation of "at least k + 1", and "exactly k" is both.

A counting constraint takes two or more operand formulas and a whole number k, and is TRUE when at least, at most or exactly k of the operands are TRUE. The engine evaluates it by counting, draws it as one gate (≥2, ≤2, =2) and reads it literally as “at least 2 of A, B, C”. The expansion is the named step that replaces the gate by ordinary operators when a transformation needs them: “at least k” is built by counting the operands one by one with AND and OR, “at most k” is the negation of “at least k + 1”, and “exactly k” is the AND of the two.

For three operands and k = 2 the expansion is the majority function, the OR of the three pairs, and the equivalence check on this page confirms the identity on all eight rows. For “exactly one” it gives the three-term formula of the worked example, and for “at most one” the negation of a majority. The expanded form grows with the number of operands, so the step runs within the normal-form limits and reports “Not determined” beyond them rather than a partial formula.

The law matters for reading results: a simplification, a CNF or DNF, a Karnaugh map or a NAND-only form of a rule with a count is computed on the expansion, and the step name tells you so. Score thresholds, which compare a points total with a cutoff, are not expanded by this law; they stay references unless you ask for their expansion.

Statement

AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C)

Proof by truth table: AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C)

AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C)
#ABClhsrhs
0FALSEFALSEFALSEFALSEFALSE
1FALSEFALSETRUEFALSEFALSE
2FALSETRUEFALSEFALSEFALSE
3FALSETRUETRUETRUETRUE
4TRUEFALSEFALSEFALSEFALSE
5TRUEFALSETRUETRUETRUE
6TRUETRUEFALSETRUETRUE
7TRUETRUETRUETRUETRUE
lhs ≡ rhs holds · lhs and rhs agree on every assignment. · Exhaustively checked and solver cross-checked · 8 rows

The same law in four notations

WordsAT_LEAST(2; A, B, C)
ProgrammingAT_LEAST(2; A, B, C)
MathematicalAT_LEAST(2; A, B, C)
AlgebraAT_LEAST(2; A, B, C)
LaTeX\mathrm{count}_{\geq 2}(A, B, C)
Words(A AND B) OR (A AND C) OR (B AND C)
Programming(A && B) || (A && C) || (B && C)
Mathematical(A ∧ B) ∨ (A ∧ C) ∨ (B ∧ C)
Algebra(A·B) + (A·C) + (B·C)
LaTeX\left(A \cdot B\right) + \left(A \cdot C\right) + \left(B \cdot C\right)
AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C) AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C) A B C lhsPRIMARY rhs ≥2 OR AND AND AND
AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C) AT_LEAST(2; A, B, C) = (A AND B) OR (A AND C) OR (B AND C) A B C lhsPRIMARY rhs ≥2 OR AND AND AND

The common slip

Writing “at least two of three” as A XOR B XOR C, or “exactly one” as the same chain. A chain of XOR is parity, TRUE for one or for three true operands; the expansion of AT_LEAST(2; A, B, C) is the three pairs, and the equivalence checker reports the rows where the chain differs.

Questions

Why not always write the expansion by hand?

Because it grows quickly: at least three of six operands is twenty triples, while the count stays one gate however many operands it has. The expansion exists so that the algebra can still run; the gate is the form to read, test and export.

Does the expansion change what the rule means?

No. It is an identity, checked by the exact equivalence checker on every assignment of the operands, like every other law on these pages. Only the shape changes.

Related

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.