The array stack on the word RAM #
Stack.Memory implements the bounded stack Stack.spec w C by three memory programs. Here each
program runs as the static body of its uniform realization, MemoryStack.realizes_push,
realizes_pop or realizes_size, selected by the operation's constructor through
Realization.Backend; no instruction is stepped by hand. The layout and a push value are
installed in registers before the body, uncharged, as a calling convention. A push answers ()
with no result words.
Correctness is that of Stack.Memory.refinement. Its memory charges are constant
(Stack.Memory.amortized), so one constant, chosen before every width, capacity and layout,
bounds the instructions of every operation (instruction_bound). An adaptive client with m
operations then runs within m times that constant (Bound.exists_executes_const). Each
operation leaves its method's final memory (Backend.exec_memoryState), so it writes only the
layout's cells (Stack.Memory.modifies_methods).
Main definitions #
Tag,certificates,backend: the operation constructors, their realizations, and the stack's operations on a layout.implementation: the native stack.
Main results #
implements: the backend runs the methods ofStack.Memory.instruction_bound: a constant bound per operation.
References #
One realization per constructor.
The stack's operations on layout L: every operation passes the layout, a push its value.
The backend runs the methods of Stack.Memory.
The native stack on layout L.
Constant time per operation. One constant K, chosen before every width, capacity,
layout, state and operation, bounds the instructions of every admissible operation.