Named native compiler witnesses #
This internal module retains actual deterministic machine terms through a small construction
kernel. NativeCompiler is data, not a second computability predicate: it packages a finite-state
machine, its state encoding, independent time and workspace maps, and a tidy computation proof.
NativeCompiler.computesInTimeAndSpace exposes the recorded machine to plain consumers, while
NativeCompiler.computableInTimeAndSpace forgets it into the existing existential predicate.
The resource coordinates stay componentwise. NativeCompiler.staticBits is the exact encoded
length of the compiler machine; NativeCompiler.inputBits and NativeCompiler.outputBits are the
exact encoded source and emitted-result lengths; time and workspace apply only when that
machine is executed.
In particular, using a precompiled result does not pay compiler runtime, but a result used as code
still carries its outputBits program-size charge. No scalar total is built into this kernel.
Each coordinate counts one concrete artifact occurrence: a separately stored copy must be charged
again by the enclosing certificate. Thus a payload hardwired into the compiler description and a
copy emitted as output are distinct artifacts, not double counting. The constructor clocks charge
their actual copying, framing, rewinding and intermediate marshalling; they provide no free scan of
an encoded program through finite control.
The constructors use the existing machine combinators directly. In particular, they do not select
a machine from ComputableInPolyTime, ComputableInO, ComputableInDegree, or a normal-form
existence theorem. Their resource formulas retain the constants of those combinators. The exact
static program charge is NativeCompiler.staticBits, the eDesc length of the packaged machine
under its recorded state encoding.
The constructors assemble fixed machine terms at the proof level; they are not a free dynamic code
generator. The functions and encodings in their types specify behavior and resource expressions,
not callbacks executed outside the packaged machine. A compiler that receives descriptions at
runtime must itself be a NativeCompiler whose machine performs that encoded transformation.
Oracle handlers, query/service implementations and universal interpretation are not coordinates of
this deterministic kernel and must be added separately by constructions that use them.
This is a bounded internal prerequisite for concrete compilers. It does not claim that an arbitrary
existential computability proof can be extracted into a NativeCompiler.
Main definitions #
Turing.MultiTapeTM.Internal.NativeCompiler: a named native machine and resource certificate.Turing.MultiTapeTM.Internal.NativeCompiler.staticBits: exact encoded compiler-machine length.Turing.MultiTapeTM.Internal.NativeCompiler.stateBound: numeric range of the recorded state encoding, computed from its actual codes rather than from state cardinality.Turing.MultiTapeTM.Internal.NativeCompiler.maxEntryBits: largest encoded transition-row length in the compiler description.Turing.MultiTapeTM.Internal.NativeCompiler.transducerMachineStateEncoding: constructive encoding of the full control state produced byTransducer.toTM.Turing.MultiTapeTM.Internal.NativeCompiler.inputBits: exact encoded input length.Turing.MultiTapeTM.Internal.NativeCompiler.outputBits: exact encoded output length.Turing.MultiTapeTM.Internal.NativeCompiler.identity: the copy-and-rewind machine.Turing.MultiTapeTM.Internal.NativeCompiler.const: a named constant-output machine.Turing.MultiTapeTM.Internal.NativeCompiler.ofInputEq,.ofOutputEq: zero-runtime semantic retyping when the actual input or output words agree.Turing.MultiTapeTM.Internal.NativeCompiler.comp: direct machine composition.Turing.MultiTapeTM.Internal.NativeCompiler.append: direct raw-word output concatenation.Turing.MultiTapeTM.Internal.NativeCompiler.pair: direct standard-pair construction.
Main results #
Turing.MultiTapeTM.Internal.NativeCompiler.description_holds: the recorded description contains every transition of the packaged machine under its recorded encodings.Turing.MultiTapeTM.Internal.NativeCompiler.description_table_length: the exact number of transition rows.Turing.MultiTapeTM.Internal.NativeCompiler.staticBits_le: a symbolic whole-description bound in the tape count, state-code bound, row count and maximum encoded row length.Turing.MultiTapeTM.Internal.NativeCompiler.computableInTimeAndSpace: forget the named construction into the existing plain existential calculus.
A named finite-state native machine computing f, with independent exact-form resource maps.
This is internal construction data, not a parallel public computability calculus.
- tapeCount : ℕ
Number of work tapes of the named machine.
- State : Type
Finite control-state type of the named machine.
The control-state type is explicitly finite.
The actual explicit transition table.
State encoding used for the exact universal description.
- time : α → ℕ
Native time bound when this machine is executed, kept separate from workspace.
- workspace : α → ℕ
Native workspace bound when this machine is executed, kept separate from time.
- computes (a : α) : self.table.toTM.ComputesTidilyInTimeAndSpace (encIn a) (encOut (f a)) (self.time a) (self.workspace a)
Direct tidy computation certificate for the named machine.
The unique unit state is encoded as zero.
Explicit encoding of the input-rewinding states.
Explicit encoding of the work-tape-rewinding states.
Explicit encoding of the work-tape-marking states.
Every state code lies strictly below stateEncodingBound.
The exact universal description obtained by enumerating the retained transition table.
The recorded description contains the packaged table's transition at every state and choice of symbols under the recorded state and symbol encodings.
Exact length of the compiler input under its recorded encoding. This is a separate resource coordinate, not runtime charged merely for presenting an already encoded input.
Exact length of the compiler output under its recorded encoding. When the output is executable code, this is its emitted program-size charge even if compilation itself is offline.
stateEncodingBound of the recorded control-state encoding.
Every recorded state code lies strictly below stateBound.
The retained description has one row for every control state, input symbol and tuple of work tape symbols.
A concrete upper bound on the full unary-encoded description of a retained compiler. It charges every transition row and every state code; clients can substitute exact row counts while keeping large finite tables symbolic.
Forget tidiness while retaining the same named machine and independent bounds.
Forget the construction data into the existing plain existential computability predicate. This direction packages the recorded machine; it does not extract a machine from that predicate.
Retype the semantic input of a named compiler when its actual input word is unchanged. The same machine is retained and no runtime callback is introduced.
Retype the semantic output of a named compiler when the actual emitted word is unchanged. The same machine and resource maps are retained.
The named copy-and-rewind machine.
A named constant-output machine with its exact output-length clock and zero workspace.
Direct composition of two named machines. The result contains the choice-free
MultiTapeMachine.comp table and retains every constant from its exact time and workspace
theorem.
Concatenate the raw-word outputs of two named machines on the same input.
The named finite-state transducer that frames an encoded value.
Direct standard-pair construction from two named machines on a common input. The left encoded
output is framed by encodeFrame, then the right output is appended.