Flat programs from graded memory-client realizations #
Realizes.exists_program projects the existing realization certificate through
Refines.executes. One emitter, scratch size and exchange constant precede every runtime
argument, word width and initial memory. A statically selected coordinate of the faithful result
encoding is observed by the existing Code.program; its final halt costs one instruction.
The emitted body is shared by all coordinate observations.
Realizes.exists_program takes already installed arguments and frontier.
Realizes.exists_init_program instead executes inputPrefix from Data.init, charging
2 * k + 5 instructions to install the first k input words and frontier. Its explicit layout,
input-word and frontier-fit premises exclude free preparation and address overflow. The initial
memory is retained in full. The whole-memory postcondition and register frame remain available
through Realizes.exists_refines; no new execution judgment is introduced here.
Main definitions #
inputLoads: a fixed sequence loading consecutive cells into source registers.inputPrefix: the native register and frontier installation prefix.
Main results #
Realizes.exists_program: a uniform flat program for every static output coordinate, with boundC * (memoryCost + work + 1) + 1, including the trailing halt.inputPrefix_exec: a charged, memory-preserving native list-input prefix.Realizes.exists_init_program: the same uniform flat-program bound fromData.init, absorbing the actual prefix into its exchange constant.Realizes.exists_unit_program,Realizes.exists_init_unit_program: zero-output clients execute a zero write and halt, charging both instructions at every word width.
References #
This semantic projection is original infrastructure over the existing flat compiler.
Install consecutive input cells in the given source registers. The terminal self-copy provides the empty case without adding a skip instruction to the native language.
A native entry prefix installs the frontier and the first k input words. All data starts
from the existing Data.init convention; register installation is charged.
Argument installation takes at most 2 * k + 5 native instructions. Its memory is unchanged;
only the frontier, pointer and source registers can change. The frontier-fit premise also pays
for the constant one and every input address.
Each static coordinate of a faithfully encoded result has one flat program, independent of the runtime input, width and memory. The selected halt observes an output register of the same emitted body; the clock includes that halt. Arguments and frontier are explicit entry premises. For an empty result register vector this makes no scalar observation.
A flat exact-basis program starts from the native list-input convention and charges both
argument installation and its trailing halt. The first k cells encode the argument; the whole
input memory and its frontier are passed to the client. The fixed installation cost is absorbed
into one exchange constant before every width and runtime argument.
A Unit-returning client needs no output coordinate. Execute an actual zero constant after its body to obtain a scalar observation, preserving the entire represented client state. The extra instruction fits every width, including zero.
A zero-output Unit client has a uniform flat scalar observation after a charged zero write and halt. Both instructions are included, without a positive-width premise.
Unit-returning clients can start from Data.init too. Argument installation is charged and
absorbed into the uniform exchange constant; the real zero write and trailing halt cost two
further instructions.