Structured logarithmic-cost RAM programs #
This module exposes a minimal imperative authoring language above the concrete
logarithmic-cost RAM. Source commands have independent register-store semantics;
Cmd.compile lowers structured conditionals and loops to absolute RAM jumps.
The main transfer theorem, Exec.compile_correct, is exact in all three
dimensions carried by Exec: final registers, operand-sensitive logarithmic
time, and peak register space. Thus source proofs can remain at the structured
level without weakening the concrete RAM resource statement.
Switch.select supplies the verified finite numeric case split used by the
Turing-machine transition compiler. Its branch selection has exact step
accounting and preserves explicit logarithmic-cost and space envelopes.
A closed compiled command consists of its generated code followed by one halt instruction.
Exact semantic and resource preservation for closed compilation.
A source execution reaches the halt instruction appended by Cmd.compile.