Skip to content
BetterDL

Literal count

Also called: number of literals, literal cost, counting literals

The total number of literal appearances in an expression, counting every plain or barred letter. It measures how many gate inputs a circuit needs.

The literal count of an expression is how many times a literal appears in it, counting every appearance of every letter, barred or not.

  • has 6 literals.
  • has 3.
  • A canonical SOP with m minterms in n variables has m × n literals, because each minterm contains every variable.

Why count literals? In a two-level circuit, each literal in a multi-literal term is one input wire on an AND gate (or an OR gate, for a POS). So the literal count tracks the hardware cost. Together with the number of terms it decides which expression is simpler:

  1. fewer terms first (fewer gates),
  2. then fewer literals (fewer gate inputs).

That is the usual definition of a minimal sop.

The literal count is close to, but not the same as, the gate input count, which also counts the inputs of the output gate and does not need an AND gate for a single-literal term.

Worked examples

Example

Counting carefully

How many literals are in ?

  1. 1.

    First bracket: A, , C → 3.

  2. 2.

    Second bracket: , D → 2.

  3. 3.

    Third bracket: B, , → 3.

  4. 4.

    Total: 3 + 2 + 3 = 8. A letter counts every time it appears, primed or not.

Example

Canonical versus simplified

F(A, B, C) is 1 on rows 4, 5, 6 and 7. Compare the canonical SOP with the simplified form.

  1. 1.

    Canonical SOP: , 4 terms × 3 literals = 12 literals.

  2. 2.

    Simplified: A, 1 literal.

  3. 3.

    Same function, twelve times fewer literals.

Common mistakes

  • Counting distinct variables instead of appearances. In , A counts twice.

  • Forgetting barred literals. counts as one literal just like B.

Practice Literal count

Interactive questions with instant feedback and a worked solution for every wrong answer.

Learn it step by step

Literal count is taught in Boolean Algebra and Boolean Simplification.