The reference evaluator for coded machines #
Milestone D (planning/tm-infrastructure.md): the specification-side evaluator against
which the universal machine (Milestones E–G) will be verified, independent of its
eventual construction language. Everything is definitional over Code.toTM — this file
re-implements nothing:
Code.runFor— the configuration aftertsteps on bit inputs;Code.outputFor— the decoded bit output aftertsteps;Code.evalWithin— total, executable, budgeted evaluation (Code.BoundedResult);Code.Produces— the relational input/output semantics.
The three views agree (decision D12): evalWithin_eq_halted_iff and
evalWithin_eq_timeout_iff characterize the budgeted evaluator by configurations,
evalWithin_halted_mono makes budgeted results stable, and
produces_iff_exists_evalWithin ties the relational semantics to the executable one —
via the bit-level bridge outputString_isBit/map_bitEmbedding_decodeBitOutput (coded
machines only ever emit the two reserved bit symbols, so decoding loses nothing).
Produces.unique records that outputs are deterministic.
The BoundedResult bit codec is deliberately deferred to the Milestone F interface.
The step-indexed run #
The configuration reached by the coded machine c on bit inputs x after t
steps.
Equations
- c.runFor x t = Turing.MultiInputTM.configs (Turing.MultiInputTM.initCfg (c.bitInputs x)) t
Instances For
The bits emitted by c on bit inputs x during the first t steps.
Equations
- c.outputFor x t = c.decodeBitOutput (c.toTM.outputString (Turing.MultiInputTM.initCfg (c.bitInputs x)) t)
Instances For
Budgeted evaluation #
The result of running a coded machine under a step budget. Its canonical bit codec is deferred to the universal-machine interface (Milestone F).
- timeout : BoundedResult
The machine was still running when the budget ran out.
- halted
(output : List Bool)
: BoundedResult
The machine halted within the budget, with the given output bits.
Instances For
Equations
- Turing.Code.instDecidableEqBoundedResult.decEq Turing.Code.BoundedResult.timeout Turing.Code.BoundedResult.timeout = isTrue ⋯
- Turing.Code.instDecidableEqBoundedResult.decEq Turing.Code.BoundedResult.timeout (Turing.Code.BoundedResult.halted output) = isFalse ⋯
- Turing.Code.instDecidableEqBoundedResult.decEq (Turing.Code.BoundedResult.halted output) Turing.Code.BoundedResult.timeout = isFalse ⋯
- Turing.Code.instDecidableEqBoundedResult.decEq (Turing.Code.BoundedResult.halted a) (Turing.Code.BoundedResult.halted b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Budgeted evaluation: run for T steps; report the output if the machine has halted
by then, and timeout otherwise. Total and executable.
Equations
- c.evalWithin x T = if (c.runFor x T).state.isNone = true then Turing.Code.BoundedResult.halted (c.outputFor x T) else Turing.Code.BoundedResult.timeout
Instances For
Budgeted results are stable under enlarging the budget.
The relational semantics #
The relational input/output semantics: c on bit inputs x halts with output bits
y, in some time and space.
Equations
- c.Produces x y = ∃ (t : ℕ) (s : ℕ), c.toTM.ComputesInTimeAndSpace (c.bitInputs x) (List.map (fun (b : Bool) => c.bitEmbedding b) y) t s
Instances For
The bit-level bridge #
Coded machines only ever emit the two reserved bit symbols.
Decoding is a section on strings of bit symbols.