The number an instance is written as, and the code that writes it #
The arithmetic half of the reduction P ≤ᶠᵒ[≤] CODEHALT: the value the
drawn code computes on input 0, and the concrete finite structure that value
is decoded back into. Nothing here mentions a formula – the first-order side
is DescriptiveComplexity.Problems.CodeHalt.Hardness.Interp.
The shape of the value #
Every branch of the drawn code is evaluated at input 0, so a constructor
node computes a constant: zero is 0, succ is 1, and
Nat.pair is what pair does. A nest is therefore a list of numbers, held
as Nat.pair a₀ (Nat.pair a₁ (…)) with 0 for the empty list
(DescriptiveComplexity.natNestFrom), and reading its d-th entry is
following d links (DescriptiveComplexity.nestGet).
The value an instance is written as is
Nat.pair card (nest over the symbols of the vocabulary)
where the entry of a symbol is a nest of nests, dim levels deep, one level
per coordinate of a tuple: at the bottom of the j-th chain sits 1 if the
symbol holds of the tuple the chain positions spell out, and 0 if it does
not. The point of nesting by coordinate rather than numbering tuples in a
mixed radix is that each level is a plain walk of the input order, which is
what a first-order guard can describe, and no arithmetic on positions has to
be proved anywhere.
Reading a value back #
DescriptiveComplexity.structOf is the decoding, a
FirstOrder.Language.FinStruct over the same vocabulary: the universe size is
the first component, and a relation holds of a tuple exactly when following
the tuple's coordinates down the nests reaches 1. It is primitive recursive
(DescriptiveComplexity.primrec_structOf), which is what lets the reduction
compose with the semi-decision procedure of the source problem.
Nests of numbers #
Following d links of a nest.
Equations
- DescriptiveComplexity.nestDrop v d = (fun (w : ℕ) => (Nat.unpair w).2)^[d] v
Instances For
Dependency graph
The d-th entry of a nest.
Equations
Instances For
Dependency graph
Following the coordinates of a tuple down a nest of nests.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Nests, as values and as codes #
A nest is written by a chain of pair nodes, whose tail is the constant 0.
Both the chain of values and the chain of codes are indexed by a starting
position, because that is what the first-order interpretation has one element
for: the node standing at position k of the chain.
The nest of the entries g k, g (k+1), …, as a number.
Equations
- DescriptiveComplexity.natNestFrom g k = if h : k < m then Nat.pair (g ⟨k, h⟩) (DescriptiveComplexity.natNestFrom g (k + 1)) else 0
Instances For
Dependency graph
The nest of the entries g k, g (k+1), …, as a code.
Equations
- DescriptiveComplexity.codeNestFrom g k = if h : k < m then (g ⟨k, h⟩).pair (DescriptiveComplexity.codeNestFrom g (k + 1)) else Nat.Partrec.Code.zero
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Reading an entry of a nest: d links past the start k sits the
entry k + d, and 0 past the end.
Dependency graph
The evaluation of the codes that write a value #
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The code of a numeral: n applications of succ to zero.
Equations
Instances For
Dependency graph
Dependency graph
The chain of codes writes the chain of values.
Dependency graph
The dimension of the interpretation #
The dimension the reduction works in: one more than the greatest arity of the vocabulary, so that every symbol's arguments fit in a tuple and the tuples have at least one coordinate (which the numeral chain walks).
Equations
- DescriptiveComplexity.dimOf V = (Finset.univ.sup fun (i : Fin V.numSyms) => V.arity i) + 1
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The value an ordered structure is written as #
Overwriting one coordinate of a tuple.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Whether the symbol i holds of the first V.arity i coordinates of the
tuple t: the bit at the bottom of the chains.
Equations
- DescriptiveComplexity.bitOf V i t = FirstOrder.Language.Structure.RelMap (V.sym i) fun (j : Fin (V.arity i)) => t (Fin.castLE ⋯ j)
Instances For
Dependency graph
The value of a symbol's block, from m levels above the bottom. At
the bottom it is the bit; one level up it is the nest of the values below,
indexed by the coordinate dimOf V - m, walked in the order of the input.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.levelVal V n f i 0 x✝ = if DescriptiveComplexity.bitOf V i x✝ then 1 else 0
Instances For
Dependency graph
The code writing DescriptiveComplexity.levelVal.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.levelCode V n f i 0 x✝ = if DescriptiveComplexity.bitOf V i x✝ then Nat.Partrec.Code.succ else Nat.Partrec.Code.zero
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The value of the block of the symbol i: its chains, all dimOf V of
them, over an arbitrary starting tuple (every coordinate is overwritten on the
way down).
Equations
- DescriptiveComplexity.blockVal V n f t₀ i = DescriptiveComplexity.levelVal V n f i (DescriptiveComplexity.dimOf V) t₀
Instances For
Dependency graph
The code of the block of the symbol i.
Equations
- DescriptiveComplexity.blockCode V n f t₀ i = DescriptiveComplexity.levelCode V n f i (DescriptiveComplexity.dimOf V) t₀
Instances For
Dependency graph
The value of a structure: its size, paired with the nest of the blocks of its symbols.
Equations
- DescriptiveComplexity.structVal V n f t₀ = Nat.pair n (DescriptiveComplexity.natNestFrom (DescriptiveComplexity.blockVal V n f t₀) 0)
Instances For
Dependency graph
Reading a value back as a concrete structure #
The leaf of the nests reached by the coordinates ds, in the block of the
symbol numbered i.
Equations
Instances For
Dependency graph
The concrete structure a value denotes: the universe has as many
elements as the first component says, and a symbol holds of a tuple exactly
when the coordinates of that tuple lead to 1 in the symbol's block.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
The value is read back as the structure it was written from #
Following the coordinates of a tuple down the chains reaches the bit of that tuple. The induction is on the level: one coordinate is consumed at each step, and the tuple built so far is the one the chains have already walked.
Dependency graph
Dependency graph
Dependency graph
The leaf of the value of a structure is the bit of the tuple the coordinates spell out.
Dependency graph
Reading a relation through the number of its symbol: the arity dependency
of FirstOrder.Language.FinVocab, discharged for a Prop-valued reading.
Dependency graph
Reading the decoded structure is reading the structure it was written from, once the two tuples are matched by their numbers.
Dependency graph
The decoding of the value of a structure is that structure, along the numbering the value was written with. This is the one mathematical fact the reduction rests on: a semi-decision procedure reading concrete instances, applied to the value drawn in the instance, answers about the instance itself.
Equations
Instances For
Dependency graph
The decoding is primitive recursive #
Dependency graph
Dependency graph
The decoding is primitive recursive: this is what lets the reduction compose with a semi-decision procedure of the source problem.