Arbitrary-base lexicographic tuple numbering #
The first coordinate is most significant, as required by Immerman's ordered first-order queries.
Coordinate reversal converts the existing colexicographic tuple numbering to this convention.
For every base n and dimension k, the resulting map is a bijection with Fin (n ^ k);
its order agrees with Mathlib's Pi.Lex. No power-of-two restriction or binary concatenation
is used. The standard canonical constants use n ≥ 2, and the tuple for one needs positive
dimension. The zero-dimensional universe still has one element.
This numbers the full tuple universe; native tuple BIT is constructed in Ordered.TupleBit.
Numeric-preserving full-tuple composition is supplied in Ordered.FullTuple.Composition.
Numeric predicates on restricted domains require separate constructions.
Main definitions #
Cslib.Logic.FO.Ordered.lexEquiv: first-coordinate-most-significant tuple numbering.Cslib.Logic.FO.Ordered.lexRank: the natural-number rank of a tuple.Cslib.Logic.FO.Ordered.tupleZero,Cslib.Logic.FO.Ordered.tupleOne,Cslib.Logic.FO.Ordered.tupleMax: the canonical full-domain tuples.
Main results #
Cslib.Logic.FO.Ordered.lexRank_lt_iff: order is determined by the first differing coordinate.Cslib.Logic.FO.Ordered.lexRank_lt_iff_lex: agreement with Mathlib's lexicographic relation.Cslib.Logic.FO.Ordered.lexRank_comp_lt_lexRank_comp_iff: increasing maps of coordinates preserve lexicographic order.Cslib.Logic.FO.Ordered.lexRank_tupleZero,Cslib.Logic.FO.Ordered.lexRank_tupleOne,Cslib.Logic.FO.Ordered.lexRank_tupleMax: exact canonical ranks.
References #
- N. Immerman, Descriptive Complexity, Remark 1.32 and Exercise 1.33(1),
with the full-domain hypothesis.
Ordered.TupleBitsupplies Exercise 1.33(3).
Lexicographic rank is the existing colexicographic index after coordinate reversal.