Preparing a current linked input in retained RAM memory #
A preparation consists of actual compiled List.Cons invocations, starting
from the current memory and extending its heap. The supplied current values
are proof-side external input, not a source callback or an already represented
root. Each node is really allocated and its invocation steps are counted.
The original order is retained by preparing the tail before the head. An existing represented suffix can be shared. Exact old object contents and their placements survive, including mutable arrays and aliases. The final world can be used by a later preloaded invocation without bootstrapping its memory.
The cost bounds the allocating invocations, not external list traversal, transport, scalar loading, or a continuous driver. In particular, keeping an old rooted value's word encoding does not save its registers across the helper calls. Those physical driver operations remain a separate boundary.
A sequence of real allocating invocations for the current input prefix. Each continuation uses the preceding outcome's complete memory and placement. The empty prefix allocates nothing and preserves the supplied tail.
- nil {kind : Complexity.Language.CellTy} {w heapLimit : ℕ} (tail : Option (Complexity.Language.NodeRef kind)) (current : Session.State w heapLimit) : Run kind [] tail current tail current 0
- cons {kind : Complexity.Language.CellTy} {w heapLimit : ℕ} {head : Complexity.Language.CellValue kind} {values : List (Complexity.Language.CellValue kind)} {tail : Option (Complexity.Language.NodeRef kind)} {current : Session.State w heapLimit} {root : Option (Complexity.Language.NodeRef kind)} {middle : Session.State w heapLimit} {steps : ℕ} (rest : Run kind values tail current root middle steps) (outcome : FunctionArenaExecution (Complexity.Language.List.Cons.program kind) (Complexity.Language.List.Cons.entry kind) 0 heapLimit middle.placement (Complexity.Language.List.Cons.args kind head root) middle.heap middle.entry) : Run kind (head :: values) tail current outcome.value (Session.State.ofExecution outcome) (steps + outcome.result.steps)
Instances For
Erase machine evidence to the same actual source constructor invocations.
The prepared root observes the original mathematical list, while every old object and placement is retained. This also frames overlapping old arrays.
Existing state words survive preparation without reconstruction from a mathematical model. This is placement stability, not a register-save program.
Every current finite input has a genuine preparation when its scalar words fit and the actual arena has three words per new node. The bound is derived from the compiled constructor's existing invocation theorem.