Ambient evaluation is partial recursive #
The step of the evaluation machine on data is primitive recursive (primrec_stepData),
so evaluation — its PFun.fix from the initial configuration — is partial recursive
(partrec_evalData), and agrees with Eval (mem_evalData_iff). Consequently a
polynomial-time function of the ambient model is Mathlib-computable, as soon as its input
is produced by a computable encoding (PolyTimeFun.computable_comp). This is the bridge
from the ambient model to Mathlib's computability used by the halting-problem form of the
compression lemma; the other bridge (from Nat.Partrec.Code into the model) is
Cost/FromPartrec.lean.
The step is primitive recursive #
p ↦ unaryToNat p.left, the tag of an encoded program or frame.
Evaluation as a fixed point #
One iteration of the evaluation loop: stop with the value on a final configuration, otherwise step.
Equations
Instances For
Evaluation of the program p (as data) on x, as a partial function: the fixed
point of the evaluation loop from the initial configuration.
Equations
- MIPRE.Cost.Machine.evalData p x = PFun.fix (fun (d : MIPRE.Cost.Data) => Part.some (MIPRE.Cost.Machine.evalStep d)) (MIPRE.Cost.Machine.initData p x)
Instances For
Polynomial-time functions are computable #
A polynomial-time function of the ambient model, precomposed with a computable encoding of its input and followed by a computable decoding of its output, is Mathlib-computable.