Documentation

CslibFrontier.DataStructure.Stack.Native

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 #

Main results #

References #

The constructors of the stack's operations.

Instances For

    The stack's operations on layout L: every operation passes the layout, a push its value.

    The backend runs the methods of Stack.Memory.

    noncomputable def Cslib.DataStructure.Stack.Native.implementation {w C : ℕ} {L : Memory.Layout} (hL : L.Valid w C) :

    The native stack on layout L.

    theorem Cslib.DataStructure.Stack.Native.instruction_bound :
    ∃ (K : ℕ), ∀ {w C : ℕ} {L : Memory.Layout} (hL : L.Valid w C), Bound (implementation hL) id fun (x : (spec w C).State) (x_1 : (spec w C).Op) => K

    Constant time per operation. One constant K, chosen before every width, capacity, layout, state and operation, bounds the instructions of every admissible operation.