Complete signed-program translation with charged input preparation #
The input words are encoded individually, using one unsigned word per source integer. Both machines install their inputs without charging instructions. Their length headers differ: the unsigned machine supplies the natural length, while the source representation needs its signed encoding. A five-instruction prologue converts that header in place. The final native halt returns the encoded signed output and is included in the simulation bound.
Main definitions #
ToWordRAM.prologue,ToWordRAM.compile: input preparation and the complete fixed program.
Main results #
ToWordRAM.runs_compile_input: run-prefix simulation preserving all memory and registers.ToWordRAM.executes_compile_input: every successful source execution transfers with two extra bits and at most32 * t + 5target instructions.
References #
The translation uses the existing signed RAM input convention and unsigned compiler.
Convert the native unsigned length header to its signed encoding in five instructions.
Instances For
The complete program, with a charged header conversion and fixed-size instruction blocks.
Callers supply input.map encode and decode the returned word, including for nonnegative values.
Instances For
Complete run-prefix simulation preserves every source memory cell and register, with charged header preparation and the translated instruction counter. This supports clients whose observable output is a memory block rather than just the returned register.
The encoded source input fits the target width, including its native length header.
Complete execution, starting from the ordinary unsigned input convention, costs at most
32 * t + 5 instructions at width w + 2 and returns the encoded signed output. Forward
correctness transfers successful runs without claiming reflection of source faults.