The order on an expanded universe #
An exponential expansion's sentences see the order of the structure they expand
(DescriptiveComplexity.ExpExpansion). To compose an expansion with anything
that reads its order – which is what a complete problem for an exponential
class needs – that order must in turn be definable by a first-order sentence
over the base. It is, and this file builds it: the analogue, one level up, of
DescriptiveComplexity.tagTupleOrder and
DescriptiveComplexity.FOInterpretation.ordExtend.
The order #
Points of the expanded universe are tagged block assignments. Order them by
tag first – statically, by an arbitrary linear order on the finite tag type –
and then by reading an assignment as a binary number: ρ is below σ when,
at the least atom where they differ, σ holds and ρ does not.
“Atom” here means a relation variable of the block together with a tuple of
elements. Arities differ from variable to variable, so the atoms are indexed by
a dependent sum; this file avoids it by padding every tuple to the block's
maximal arity (DescriptiveComplexity.blockArityBound), which turns the index
type into a plain product B.ι × (Fin D → A) – exactly the shape
DescriptiveComplexity.tagTupleOrder already orders. Padding loses nothing:
an assignment is determined by the atoms it makes true
(DescriptiveComplexity.SOBlock.atomSet_injective), since every tuple of the
relevant arity is the prefix of some padded tuple.
Layers #
DescriptiveComplexity.setLinearOrder– the binary-number order on the subsets of any finite linearly ordered index type, obtained from Mathlib'sPi.Lexon functions toBool, so that transitivity and totality are inherited rather than proved.DescriptiveComplexity.SOBlock.atomSet– an assignment read as such a subset, and its injectivity.DescriptiveComplexity.ExpExpansion.mapLinearOrder– the two put together with the tag, and transported to the subtypeX.Map A.
The defining formula and its realization lemma live in
DescriptiveComplexity.Exponential.OrdFormula; this file is the semantics it
is proved against.
The binary-number order on subsets of a finite linear order #
The binary-number order on subsets of a finite linearly ordered index
type: one subset is below another when, at the least index where they differ,
the second contains it and the first does not. Lifted from Pi.Lex, so the
linear-order axioms come for free.
Instances For
Dependency graph
What the order says, unfolded.
Dependency graph
An assignment read as a set of padded atoms #
The index of a padded atom of a block: a relation variable together
with a tuple of the block's maximal arity, of which only the first
B.arity i coordinates are read. A plain product, deliberately: the honest
index type is a dependent sum, and padding trades it for a shape
DescriptiveComplexity.tagTupleOrder already orders.
Instances For
Dependency graph
The padded atoms an assignment makes true.
Equations
- B.atomSet ρ p = ρ p.1 fun (j : Fin (B.arity p.1)) => p.2 (Fin.castLE ⋯ j)
Instances For
Dependency graph
The padded atoms are linearly ordered: the relation variable first, in
an arbitrary order on the finite index type of the block, then the tuple
lexicographically. This is DescriptiveComplexity.tagTupleOrder at
Tag := B.ι, written directly as a lift into B.ι ×ₗ Lex (Fin D → A) so that
its strict order unfolds by DescriptiveComplexity.prodLex_lt_iff without a
detour through DescriptiveComplexity.tagTupleLe.
Equations
- B.atomIxLinearOrder A = LinearOrder.lift' (fun (p : B.AtomIx A) => toLex (p.1, toLex p.2)) ⋯
Instances For
Dependency graph
The order on padded atoms as a plain relation. Consumers use this
rather than <: AtomIx is a product, so the product's own order instances
would compete with DescriptiveComplexity.SOBlock.atomIxLinearOrder and <
would resolve ambiguously. All the instance juggling is confined to this file.
Instances For
Dependency graph
What the order on padded atoms is: the plain relation above.
Dependency graph
An assignment is determined by the padded atoms it makes true: every tuple of the relevant arity is the prefix of a padded tuple, so nothing is lost by the padding.
Dependency graph
The comparison of two assignments, packaged: the binary-number order on
their padded atoms, stated entirely in terms of
DescriptiveComplexity.SOBlock.atomLt so that no consumer has to resolve an
order instance on a product.
Dependency graph
The order on the points of an expansion #
The order on the candidate points of an expansion: tag first, then the assignment read as a binary number.
Equations
- X.pointLinearOrder A = LinearOrder.lift' (fun (p : X.Point A) => toLex (p.1, X.B.atomSet p.2)) ⋯
Instances For
Dependency graph
The order on the expanded universe, carried to the definable subset.
Equations
- X.mapLinearOrder A = LinearOrder.lift' (fun (x : X.Map A) => ↑x) ⋯