A halting computation, read off as a finite certificate #
The mathematical content of CODEHALT ∈ RE: the code drawn by an instance
halts on 0 exactly when a finite amount of data witnesses it – a numeral
segment with a linear order on it, an addition and a pairing on the segment,
the number of the code each node draws, and the value each code takes on each
argument.
The shape of the certificate #
DescriptiveComplexity.CodeHalt.Cert is the data and
DescriptiveComplexity.CodeHalt.CertOK the conditions. Every condition but the
last is a justification rule: each fact asserted must be derivable from
facts already asserted, by one of the rules of the object it is about. Nothing
asks the guessed relations to be closed under the rules – only supported by
them – and nothing needs a rank, because two things already decrease:
- the numeral of a code: the arguments of a
pair,comp,precorrfind'are numbered below it (DescriptiveComplexity.CodeHalt.dec_pairand friends), so a code's own rules appeal to strictly smaller numbers; - the argument of a
prec, which is the one rule appealing to the same code: it steps down along the second component of the argument.
So soundness is a plain induction on the pair (code number, argument), and the instance is not asked to be a well-formed tree: a code is carried by its number, and numbers decode unambiguously.
Why rfind' has no chain #
The search of an rfind' is stated by a bounded universal: the answer v
is a place where the argument returns 0, and every place between the input
and v returns something nonzero
(DescriptiveComplexity.CodeHalt.evaln_rfind'_spec). A step-by-step reading
would appeal to the same code at a larger argument, which no measure
decreases along; the universal reading appeals only to the argument's code.
The certificate #
A halting computation, as relations on a numeral segment. Le orders
the segment; Add and Pr are addition and Nat.pair on it; Dec n e says
the node n of the instance draws the code numbered e; Ev e x v says the
code numbered e returns v on x.
- Le : D → D → Prop
The order of the numeral segment.
- Add : D → D → D → Prop
Add x y z:x + y = z. - Pr : D → D → D → Prop
Pr a b p:⟨a, b⟩ = p, for Cantor's pairing. - Dec : A → D → Prop
Dec n e: the nodendraws the code numberede. - Ev : D → D → D → Prop
Ev e x v: the code numberedereturnsvon the argumentx.
Instances For
Dependency graph
Strictly below, in the numeral segment.
Instances For
Dependency graph
q is four times p.
Instances For
Dependency graph
e is q + 4.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
e is q + 5.
Instances For
Dependency graph
e is q + 6.
Instances For
Dependency graph
e is q + 7.
Instances For
Dependency graph
e is the numeral 1.
Equations
- c.IsOne e = ∃ (z : D), DescriptiveComplexity.CodeHalt.IsZ c.Le z ∧ DescriptiveComplexity.CodeHalt.IsS c.Le z e
Instances For
Dependency graph
e is the numeral 2.
Instances For
Dependency graph
e is the numeral 3.
Instances For
Dependency graph
e numbers the code pair e₁ e₂.
Instances For
Dependency graph
e numbers the code prec e₁ e₂.
Instances For
Dependency graph
e numbers the code comp e₁ e₂.
Instances For
Dependency graph
e numbers the code rfind' e₁.
Instances For
Dependency graph
The successor rule of the pairing, on the segment: this is
DescriptiveComplexity.CodeHalt.NextP with the arithmetic replaced by the
guessed order.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
What justifies “the node n draws the code numbered e”: the
constructor mark of n, and – for the four binary constructors – children
drawing the codes the number of e is built from.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
What justifies “the code numbered e returns v on x”: one clause
per constructor, mirroring Nat.Partrec.Code.eval. The prec clause is the
only one appealing to e itself, and it does so at a strictly smaller
argument; the rfind' clause states its search by a bounded universal.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
The conditions making the guessed relations a halting computation. Four justification rules and the root clause; the segment's order is linear, and that is the only shape condition, all the rest being support.
The numeral segment is linearly ordered.
- add_ok (x y z : D) : c.Add x y z → IsZ c.Le y ∧ z = x ∨ ∃ (y' : D) (z' : D), IsS c.Le y' y ∧ IsS c.Le z' z ∧ c.Add x y' z'
Every addition fact is justified by the recurrence.
- pr_ok (a b p : D) : c.Pr a b p → IsZ c.Le p ∧ IsZ c.Le a ∧ IsZ c.Le b ∨ ∃ (p' : D) (a' : D) (b' : D), IsS c.Le p' p ∧ c.Pr a' b' p' ∧ c.NextPR a' b' a b
Every pairing fact is justified by the successor rule.
Every decoding fact is justified by the node's mark and its children.
Every evaluation fact is justified by the rules of its code.
The root draws a code that returns something on
0.
Instances For
Dependency graph
Soundness: a certificate really is a halting computation #
Every guessed relation means what its name says, by induction along the two things a justification decreases: the numeral of a code, and – inside the one rule that keeps the code – the argument.
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
The node really draws the code its number denotes.
Dependency graph
The code really returns what the certificate says. The induction is on
the pair (number of the code, argument), lexicographically: every rule but the
recursive one of prec appeals to a strictly smaller code number, and that one
appeals to the same code at a strictly smaller argument.
Dependency graph
A certificate exhibits a yes-instance.
Dependency graph
Completeness: a halting computation is a certificate #
The segment is Fin (N + 1), with N large enough to hold the number of the
code, the step budget, and every value a bounded evaluation within that budget
can return (DescriptiveComplexity.CodeHalt.valBound). That is the only place
where finiteness of the certificate is at stake: every number the justification
rules appeal to is either an argument of a bounded evaluation, hence below the
budget, or one of its values, hence below the bound.
A number at most N, as a value of the segment.
Equations
- DescriptiveComplexity.CodeHalt.numVal a h = ⟨a, ⋯⟩
Instances For
Dependency graph
Dependency graph
The certificate a halting bounded evaluation carries: numerals up to
N, addition and pairing read off ℕ, the code each node draws, and the values
a bounded evaluation with budget k returns for codes numbered at most E.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
Dependency graph
A halting computation is a certificate.
Dependency graph
A yes-instance of CODEHALT is exactly one whose invented values carry a
certificate. This is the mathematical content of CODEHALT ∈ RE; the syntax
is in DescriptiveComplexity.Problems.CodeHalt.Membership.