The input chain: getting the instance into the machine #
Turing.ToPartrec.Code.exists_code gives codes for fixed-arity functions
only, so the machine cannot be started on the variable-length bit table of
the instance. The continuation stack solves this: since a comp frame
applies its code to the value below it, a chain of comp frames applies
a fixed code once per frame – one frame per bit
(DescriptiveComplexity.HaltHard.inputChain). Each bit frame pushes its bit
(Turing.ToPartrec.Code.zero', or the three-node
DescriptiveComplexity.HaltHard.pushOne), the next frame folds it into the
accumulator (2·acc + b, by a code exists_code supplies), and the last
frame runs the semi-decision procedure on the folded number and the universe
size.
The number the chain folds is the flattened relation table of the instance
read back one binary digit at a time
(DescriptiveComplexity.HaltHard.structOfBits, with
DescriptiveComplexity.HaltHard.structOfBits_flatten the roundtrip): a
FirstOrder.Language.FinStruct is a size and a table, so decoding owes
only digit arithmetic, and it is primitive recursive
(DescriptiveComplexity.HaltHard.primrec_structOfBits) – which is what lets
the Part.assert trick of orderedReduction_codehalt run behind
Nat.Partrec'.part_iff₂. The bits enter the chain most significant first,
i.e. the flattened table reversed
(DescriptiveComplexity.HaltHard.foldl_two_reverse).
The chain is pure comp frames, so its frame region is a run of bare
headers (DescriptiveComplexity.HaltHard.frameSeg_inputChain), and its
evaluation is total until the final procedure
(DescriptiveComplexity.HaltHard.inputChain_dom_iff).
Bits, numbers and flattened tables #
The number whose binary digits are the listed bits, least significant first.
Equations
Instances For
Dependency graph
The digits of natOfBits are the listed bits.
Dependency graph
Folding bits most significant first computes natOfBits of their
reversal.
Dependency graph
Reading a flattened list of rows at a prefix-sum offset reads inside the row.
Dependency graph
Reading every position of a list back through getD is the list.
Dependency graph
Decoding a number into a structure #
The offset of the row of symbol i inside the flattened table, over a
universe of size c.
Equations
- DescriptiveComplexity.HaltHard.offB V c 0 = 0
- DescriptiveComplexity.HaltHard.offB V c i.succ = DescriptiveComplexity.HaltHard.offB V c i + if h : i < V.numSyms then c ^ V.arity ⟨i, h⟩ else 0
Instances For
Dependency graph
The offsets are the prefix sums of the row lengths.
Dependency graph
Decoding a number into a concrete structure: the universe has size
k + 1, and the relation tables read the binary digits of N, row by row at
the offsets of DescriptiveComplexity.HaltHard.offB.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Reading a Boolean digit back.
Dependency graph
The roundtrip: decoding the number of the flattened table of a well-shaped concrete structure gives the structure back.
Dependency graph
The tables of FirstOrder.Language.FinStruct.ofEquiv are well-shaped:
one row per symbol.
Dependency graph
The rows of FirstOrder.Language.FinStruct.ofEquiv have the lengths the
offsets expect.
Dependency graph
Decoding the folded table of an instance gives the instance's concrete presentation.
Dependency graph
The decoder is primitive recursive #
Dependency graph
Powers of two are primitive recursive in the exponent.
Dependency graph
The decoder is primitive recursive, as a function of the pair –
what the Part.assert code needs.
Dependency graph
The pushed bits, and the fold #
The code pushing a 1 in front of the value: v ↦ 1 :: v.
Equations
Instances For
Dependency graph
Dependency graph
The code pushing a bit.
Equations
Instances For
Dependency graph
Dependency graph
The fold specification: 2·acc + b, of the vector [b, acc, n].
Instances For
Dependency graph
The fold code: replace the pushed bit and the accumulator by their fold, keep the rest of the value.
Equations
Instances For
Dependency graph
Dependency graph
The chain #
The global code the machine simulates: a container for the two bit pushes, the fold, and the semi-decision procedure. It is never dispatched at its root – only the positions of its four components are.
Equations
Instances For
Dependency graph
The position of Turing.ToPartrec.Code.zero' in the container.
Instances For
Dependency graph
The position of the one-push in the container.
Equations
Instances For
Dependency graph
The position of a bit push.
Equations
Instances For
Dependency graph
The position of the fold in the container.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The position of the semi-decision procedure in the container.
Equations
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The input chain: one comp frame pushing each bit, one folding it
in, and a last frame running the procedure.
Equations
- One or more equations did not get rendered due to their size.
- DescriptiveComplexity.HaltHard.inputChain cF cP [] = DescriptiveComplexity.HaltHard.PCont.comp (DescriptiveComplexity.HaltHard.posProc cF cP) DescriptiveComplexity.HaltHard.PCont.halt
Instances For
Dependency graph
Evaluating a pending composition is composing the evaluations.
Dependency graph
The frame region of the chain: a run of bare comp headers.
Dependency graph
Evaluating the chain folds the bits and hands the result to the procedure.
Dependency graph
The procedure, and the whole chain #
The two codes of the chain exist: a fold code, and a code whose halting on the folded number and the size decides the problem.
Dependency graph
What the chain decides: started on [0, n] under the chain of the
reversed flattened table, the machine's abstract evaluation terminates
exactly when the decoded instance is a yes-instance.