Unary representation of numbers in finite structures #
The unary encoding: a number carried by an instance is the cardinality of a
marked set – Set.ncard is the decoding function, and no order is needed.
This file provides the shared lemma kit so that problem files do not hand-roll
cardinality reasoning:
DescriptiveComplexity.ncard_image_equivand its predicate formDescriptiveComplexity.ncard_setOf_equiv: invariance of the decoded number under equivalences (this is what feedsDecisionProblem.iso_invariantproofs);DescriptiveComplexity.initSegandDescriptiveComplexity.ncard_initSeg: the canonical encoding ofk ≤ nas the initial segment ofFin n;DescriptiveComplexity.ncard_compl_eqandDescriptiveComplexity.ncard_compl_le_ncard_compl_iff: complement cardinality (n - k) and the resulting reversal of comparisons, which is what the Vertex Cover ↔ Independent Set reductions run on;DescriptiveComplexity.nonempty_embedding_iff_ncard_le: comparing decoded numbers is comparing sizes – the bridge to the second-order rendering of a threshold, where the injection witnessing the comparison is guessed as a relation variable (used by theΣ₁definition of Clique);DescriptiveComplexity.nonempty_embedding_iff_ncard_le₂andDescriptiveComplexity.ncard_setOf_equiv₂: the same, for a threshold carried by a marked binary relation – the arity-2 form of the representation, which is what problems counting arcs rather than vertices need;DescriptiveComplexity.ncard_tagged_eq_sum: cardinality under tag-disjoint union – the tagged framework's addition;DescriptiveComplexity.ncard_univ_pi: cardinality of a product of marked sets over the coordinates of a tuple – the tagged framework's multiplication.
Unary representation keeps numbers polynomial in the instance size; problems
whose numbers must be exponential (SubsetSum and friends) use the binary
representation of DescriptiveComplexity.Numbers.Binary instead.
The number encoded by a marked set is invariant under an equivalence of universes carrying one mark predicate to the other. This is the form the transport of a threshold along an isomorphism (or along the equivalence underlying a one-dimensional interpretation) takes in practice.
Pulling a mark predicate back along u.symm does not change the number it
encodes: the special case of DescriptiveComplexity.ncard_setOf_equiv where the
predicate on the target universe is the transported one.
Complementation reverses the comparison of decoded numbers – the
subtraction n - k is monotone decreasing in k. This is the arithmetic
content of the Vertex Cover ↔ Independent Set reductions.
Comparing decoded numbers is comparing sizes: on a finite universe the
number encoded by the marked set P is at most the one encoded by Q exactly
when the P-elements inject into the Q-elements. This is the bridge between
the cardinality reading of a threshold and its second-order rendering, where
the injection is guessed as a binary relation variable.
Comparing decoded numbers across universes: the same bridge as
DescriptiveComplexity.nonempty_embedding_iff_ncard_le, when the two marked sets live
on different types. This is what a threshold comparing a count of pairs with
a count of elements needs.
Thresholds on pairs #
Problems whose objective counts arcs rather than vertices – Feedback Arc Set,
Max Cut – need a threshold that can reach n², which a marked subset of the
universe cannot. The same unary idea one arity up does reach it: the number is
the cardinality of a marked binary relation, decoded as the Set.ncard of the
corresponding set of pairs. It stays order-free and isomorphism-invariant, and
the whole kit above applies at the type A × A; the two lemmas below are just
its curried form.
Comparing decoded numbers is comparing sizes, for thresholds carried by a binary relation.
Cardinality under tag-disjoint union: on a universe of tagged elements, the cardinalities of the per-tag marked sets add up. This is how the tagged framework represents addition.