Universal finite-state TM0 machine #
This module constructs a fixed universal Post–Turing machine M₀' in Mathlib's Turing.TM0 model,
with a finite state type and finite tape alphabet.
Starting from a ToPartrec code univ that evaluates the n-th partial recursive code on input
0 (ToPartrec.Code.exists_code), Mathlib's compilers PartrecToTM2, TM2to1 and TM1to0 turn
univ into a fixed TM0 machine M₀. Applying state-set restriction (TM0.restrict) along its
finite support produces M₀'.
The input tape for a natural number n is input n, computed primitive recursively
(primrec_input). The machine halts on input n if and only if the n-th partial recursive code
halts on 0 (eval_dom_iff).
Main definitions #
Turing.TM0.Universal.univ: fixedToPartreccode evaluating then-th code at0.Turing.TM0.Universal.M₀: compiledTM0machine simulatinguniv.Turing.TM0.Universal.M₀': restriction ofM₀to its finite reachable state set.Turing.TM0.Universal.input: input tape encoding a natural numbern.
Main results #
Turing.TM0.Universal.dom_M₀':(M₀'.eval (input n)).Dom ↔ (univ.eval [n]).Dom.Turing.TM0.Universal.eval_dom_iff:(M₀'.eval (input n)).Domiff then-th code halts on0.Turing.TM0.Universal.primrec_input: the input encodinginputis primitive recursive.
References #
A ToPartrec code evaluating, on input [n], the n-th partial recursive function at
0.
The labels of the TM2 machine compiled from univ, with initial label the compiled
program.
Instances For
The TM2 machine compiled from univ.
The TM1 machine simulating M₂.
The TM0 machine simulating M₁.
The finite set of TM1 labels used by M₁.
The restriction of M₀ to its finitely many reachable states.
The tape alphabet of M₀ is primcodable through an enumeration.
The state set of M₀' is primcodable through an enumeration.
The input tape of M₀' holding the number n.
The encoding of input numbers as tape configurations for M₀' is primitive recursive.
M₀' halts on input n if and only if the n-th partial recursive code halts on 0.