Documentation

DescriptiveComplexity.Numbers

Number encodings #

Umbrella file for the shared number-representation layer, and the place the per-problem choice of encoding is argued. Numbers are not a primitive of the framework: an instance is a finite structure, so a number it carries has to be read off that structure, and the semantics of numbers (sums, comparisons) is always computed in Lean inside DecisionProblem.Holds. What the encoding constrains is which reductions stay first-order, and whether the problem keeps its intended complexity.

Two encodings are in use across the catalog, complements rather than rivals:

Inside formulas, comparison and addition of binary numbers are FO(≤)-definable, but multiplication is not (it is TC⁰): a reduction into a binary problem can only write numbers it can define one bit at a time, and an iterated sum is not one of them. Reductions the other way, from a binary problem into a unary one, are unproblematic – formulas only ever read bits, never sum them.

That the choice is part of the statement and not bookkeeping is itself a theorem: DescriptiveComplexity.no_unary_encoding (DescriptiveComplexity.Encoding.UnaryBlowup) shows that no encoding of subset-sum instances sized by bit length can spend one universe element per unit of weight, with the binary encoding of the same instances as the positive contrast.